New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tau3mu HLT producer #19696
Add tau3mu HLT producer #19696
Conversation
A new Pull Request was created by @rmanzoni (Riccardo Manzoni) for master. It involves the following packages: HLTrigger/Muon @Martin-Grunewald, @silviodonato, @cmsbuild, @fwyzard, @davidlange6 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
// Create the 3-muon candidates | ||
// loop over L3/Trk muons and create all combinations | ||
for (unsigned int i = 0; i != AllMuCands->size(); ++i){ | ||
const reco::TrackRef &tk_i = (*AllMuCands)[i].track(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use some modern-style loop constructs such as for (auto const & muon : AllMuCands) {...
for these three loops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I prefer this style, as it is more legible.
auto
obfuscates things, IMO, and I'm not sure that nested range-based loops would improve the legibility.
But let me try anyways and see if it ends up nicely enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you can use a range-based for loop here, since you use the index of the outer loop as the starting point of the inner loop, and so on.
It might be slightly more efficient using iterators, but the difference is probably negligible:
auto AllMuCands_end = AllMuCands->end();
for (auto i = AllMuCands->begin(); i != AllMuCands_end; ++i) {
const reco::TrackRef &tk_i = i->track();
for (auto j = i+1; j != AllMuCands_end; ++j) {
const reco::TrackRef &tk_j = j->track();
...
and so on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes, of course!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, understood.
So I give up my attempts at playing magic with ranges and move to iterators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just leave the indices here, if you find it more readable. The difference is just a multiplication and a sum.
if ( itau->pt() < TriMuonPtCut_ ) continue; | ||
if ( itau->mass() < MinTriMuonMass_) continue; | ||
if ( itau->mass() > MaxTriMuonMass_) continue; | ||
if (abs(itau->eta()) > TriMuonEtaCut_ ) continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use std::abs
instead of just abs
everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, abs
will truncate to an integer !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, pretty lame of me
for (unsigned int k = j+1; k != AllMuCands->size(); ++k){ | ||
const reco::TrackRef &tk_k = (*AllMuCands)[k].track(); | ||
|
||
int passingPreviousFilter_1 = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be calculated in the first loop
const reco::TrackRef &tk_k = (*AllMuCands)[k].track(); | ||
|
||
int passingPreviousFilter_1 = 0; | ||
int passingPreviousFilter_2 = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be calculated and kept in the 2nd loop
|
||
int passingPreviousFilter_1 = 0; | ||
int passingPreviousFilter_2 = 0; | ||
int passingPreviousFilter_3 = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only this would need to be calculated within the 3rd loop
if (((passingPreviousFilter_1 < 1) & (passingPreviousFilter_2 < 1)) || | ||
((passingPreviousFilter_1 < 1) & (passingPreviousFilter_3 < 1)) || | ||
((passingPreviousFilter_2 < 1) & (passingPreviousFilter_3 < 1))) continue; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IOW, the above should be caluclated less often in the corresponding loop for i/1, j/2 and k/3.
if (!( (passingPreviousFilter_1 & passingPreviousFilter_2 ) || | ||
(passingPreviousFilter_1 & passingPreviousFilter_3 ) || | ||
(passingPreviousFilter_2 & passingPreviousFilter_3 ) )) continue; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, if the passingPreviousFilter_1/2/3 were all unsigned ints - either 0 or 1,
then the condition would be simply passingPreviousFilter_1+passingPreviousFilter_2+passingPreviousFilter_3<3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it, but I found out that you can have the same muon appearing twice in the output of the previous filter, just because there is more than one combination that picks it up.
For example if the two good pairs are (1,2) and (1,3), you end up having 1 appearing twice and that would bump the sum up artificially
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In light of the comment you made below, here the condition reduces to checking that
passingPreviousFilter_3
is true
, correct?
wrong...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the same muons appears twice in the collection?
Otherwise, the nested loops start at +1 index off the outer loop index, so the same
muon is not used twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IOW, even with (1,2) and (1,3), passingPreviousFilter_1 would be at most 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same muon can appear more than once in PassedL3Muons
, so if I loop on the entire PassedL3Muons
collection for each muon of AllMuCands
, even in the nested loop, that muon of AllMuCands
can bump the counter several times
reco::TrackRef candTrkRef = (*imu)->get<reco::TrackRef>(); | ||
if (reco::deltaR2(tk_j->momentum(), candTrkRef->momentum()) < (0.03*0.03)) passingPreviousFilter_2 = true; | ||
} | ||
for (auto k = j+1; k != AllMuCands_end; ++k){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to execute 3rd loop if passingPreviousFilter_1 and passingPreviousFilter_2 are both FALSE (or 0).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point
const reco::TrackRef &tk_i = i->track(); | ||
for (std::vector<reco::RecoChargedCandidateRef>::const_iterator imu = PassedL3Muons.begin(); imu != PassedL3Muons.end(); ++imu){ | ||
reco::TrackRef candTrkRef = (*imu)->get<reco::TrackRef>(); | ||
if (reco::deltaR2(tk_i->momentum(), candTrkRef->momentum()) < (0.03*0.03)) passingPreviousFilter_1 = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.03 is a magic number - better make it a configurable plugin parameter and of course add it to fillDescriptions()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
please test |
The tests are being triggered in jenkins. |
+1 The following merge commits were also included on top of IB + this PR after doing git cms-merge-topic: |
Comparison job queued. |
Pull request #19696 was updated. @Martin-Grunewald, @silviodonato, @cmsbuild, @fwyzard, @davidlange6 can you please check and sign again. |
please test |
The tests are being triggered in jenkins. |
+1 The following merge commits were also included on top of IB + this PR after doing git cms-merge-topic: |
Comparison job queued. |
+1 |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @davidlange6, @smuzaffar |
Comparison is ready Comparison Summary:
|
+1 |
Add new HLT producer that builds a
reco::CompositeCandidate
tau out of 3 muons.Then it applies further selection, most notably tracker based isolation around the tau candidate.