132 double const MuMass = 0.106;
133 double const MuMass2 = MuMass*MuMass;
144 if (mucands->empty())
return false;
145 auto const &tk = (*mucands)[0].track();
148 if (tk->seedRef().isNonnull()){
150 useL3MTS =
a !=
nullptr;
154 std::map<reco::TrackRef, std::vector<RecoChargedCandidateRef> > L2toL3s;
158 unsigned int maxI = mucands->size();
159 for (
unsigned int i=0;
i!=
maxI;
i++){
160 const TrackRef &tk = (*mucands)[
i].track();
162 TrackRef staTrack = l3seedRef->l2Track();
173 for(
unsigned int i(0);
i < mucands->size(); ++
i){
175 for(
auto const & link : *links){
181 float dR2 =
deltaR2(tk->eta(),tk->phi(),globalTrack.
eta(),globalTrack.
phi());
182 float dPt =
std::abs(tk->pt() - globalTrack.
pt())/tk->pt();
183 const TrackRef staTrack = link.standAloneTrack();
184 if (dR2 < 0.02*0.02 and dPt < 0.001) {
196 beamSpot = *recoBeamSpotHandle;
203 vector<RecoChargedCandidateRef> vl2cands;
211 auto L2toL3s_it1 = L2toL3s.begin();
212 auto L2toL3s_end = L2toL3s.end();
213 bool atLeastOneTriplet=
false;
214 for (; L2toL3s_it1!=L2toL3s_end; ++L2toL3s_it1){
220 unsigned int maxItk1=L2toL3s_it1->second.size();
221 for (; iTk1!=maxItk1; iTk1++){
222 bool thisL3Index1isDone=
false;
226 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" 1st muon in loop: q*pt= " 227 << tk1->charge()*tk1->pt() <<
" (" << cand1->charge()*cand1->pt()<<
") " <<
", eta= " << tk1->eta() <<
" (" << cand1->eta() <<
") " <<
", hits= " << tk1->numberOfValidHits();
229 if (fabs(cand1->eta())>
max_Eta_)
continue;
232 if (tk1->numberOfValidHits()<
min_Nhits_)
continue;
236 if (fabs( (- (cand1->vx()-beamSpot.
x0()) * cand1->py() + (cand1->vy()-beamSpot.
y0()) * cand1->px() ) / cand1->pt() ) >
max_Dr_)
continue;
239 if (fabs((cand1->vz()-beamSpot.
z0()) - ((cand1->vx()-beamSpot.
x0())*cand1->px()+(cand1->vy()-beamSpot.
y0())*cand1->py())/cand1->pt() * cand1->pz()/cand1->pt())>
max_Dz_)
continue;
242 double pt1 = cand1->pt();
247 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" ... 1st muon in loop, pt1= " 248 << pt1 <<
", ptLx1= " << ptLx1;
249 auto L2toL3s_it2 = L2toL3s_it1;
251 for (; L2toL3s_it2!=L2toL3s_end; ++L2toL3s_it2){
256 unsigned int maxItk2=L2toL3s_it2->second.size();
257 for (; iTk2!=maxItk2; iTk2++){
262 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" 2nd muon in loop: q*pt= " << tk2->charge()*tk2->pt() <<
" (" << cand2->charge()*cand2->pt() <<
") " <<
", eta= " << tk2->eta() <<
" (" << cand2->eta() <<
") " <<
", hits= " << tk2->numberOfValidHits() <<
", d0= " << tk2->d0() ;
263 if (fabs(cand2->eta())>
max_Eta_)
continue;
266 if (tk2->numberOfValidHits()<
min_Nhits_)
continue;
270 if (fabs( (- (cand2->vx()-beamSpot.
x0()) * cand2->py() + (cand2->vy()-beamSpot.
y0()) * cand2->px() ) / cand2->pt() ) >
max_Dr_)
continue;
273 if (fabs((cand2->vz()-beamSpot.
z0()) - ((cand2->vx()-beamSpot.
x0())*cand2->px()+(cand2->vy()-beamSpot.
y0())*cand2->py())/cand2->pt() * cand2->pz()/cand2->pt())>
max_Dz_)
continue;
276 double pt2 = cand2->pt();
281 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" ... 2nd muon in loop, pt2= " 282 << pt2 <<
", ptLx2= " << ptLx2;
284 auto L2toL3s_it3 = L2toL3s_it2;
286 for (; L2toL3s_it3!=L2toL3s_end; ++L2toL3s_it3){
292 unsigned int maxItk3=L2toL3s_it3->second.size();
293 for (; iTk3!=maxItk3; iTk3++){
297 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" 3rd muon in loop: q*pt= " 298 << tk3->charge()*tk3->pt() <<
" (" << cand3->charge()*cand3->pt()<<
") " <<
", eta= " << tk3->eta() <<
" (" << cand3->eta() <<
") " <<
", hits= " << tk3->numberOfValidHits();
300 if (fabs(cand3->eta())>
max_Eta_)
continue;
303 if (tk3->numberOfValidHits()<
min_Nhits_)
continue;
307 if (fabs( (- (cand3->vx()-beamSpot.
x0()) * cand3->py() + (cand3->vy()-beamSpot.
y0()) * cand3->px() ) / cand3->pt() ) >
max_Dr_)
continue;
310 if (fabs((cand3->vz()-beamSpot.
z0()) - ((cand3->vx()-beamSpot.
x0())*cand3->px()+(cand3->vy()-beamSpot.
y0())*cand3->py())/cand3->pt() * cand3->pz()/cand3->pt())>
max_Dz_)
continue;
313 double pt3 = cand3->pt();
318 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" ... 3rd muon in loop, pt3= " 319 << pt3 <<
", ptLx3= " << ptLx3;
321 if (ptLx1>ptLx2 && ptLx1>ptLx3 && ptLx1<
min_PtMax_)
continue;
322 else if (ptLx2>ptLx1 && ptLx2>ptLx3 && ptLx2<
min_PtMax_)
continue;
323 else if (ptLx3<ptLx2 && ptLx3>ptLx1 && ptLx3<
min_PtMax_)
continue;
325 if (ptLx1<ptLx2 && ptLx1<ptLx3 && ptLx1<
min_PtMin_)
continue;
326 else if (ptLx2<ptLx1 && ptLx2<ptLx3 && ptLx2<
min_PtMin_)
continue;
327 else if (ptLx3<ptLx2 && ptLx3<ptLx1 && ptLx3<
min_PtMin_)
continue;
330 if (
abs (cand1->charge()+cand2->charge()+cand3->charge()) !=
chargeOpt_)
continue;
334 double acop = fabs(cand1->phi()-cand2->phi());
335 if (acop>
M_PI) acop = 2*
M_PI - acop;
337 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" ... 1-2 acop= " << acop;
341 acop = fabs(cand1->phi()-cand3->phi());
342 if (acop>
M_PI) acop = 2*
M_PI - acop;
344 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" ... 1-3 acop= " << acop;
348 acop = fabs(cand3->phi()-cand2->phi());
349 if (acop>
M_PI) acop = 2*
M_PI - acop;
351 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" ... 3-2 acop= " << acop;
356 double ptbalance = fabs(cand1->pt()-cand2->pt());
359 ptbalance = fabs(cand1->pt()-cand3->pt());
362 ptbalance = fabs(cand3->pt()-cand2->pt());
367 e1 =
sqrt(cand1->momentum().Mag2()+MuMass2);
368 e2 =
sqrt(cand2->momentum().Mag2()+MuMass2);
369 e3 =
sqrt(cand3->momentum().Mag2()+MuMass2);
375 double pt123 = p.pt();
376 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" ... 1-2 pt123= " << pt123;
379 double invmass =
abs(p.mass());
381 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" ... 1-2 invmass= " << invmass;
410 double rapidity = fabs(p.Rapidity());
415 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" Track1 passing filter: pt= " << cand1->pt() <<
", eta: " << cand1->eta();
416 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" Track2 passing filter: pt= " << cand2->pt() <<
", eta: " << cand2->eta();
417 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" Track2 passing filter: pt= " << cand3->pt() <<
", eta: " << cand3->eta();
418 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" Invmass= " << invmass;
423 vector<RecoChargedCandidateRef> vref;
425 for (
auto &
i : vref) {
430 }
else if (tktmp==tk2) {
432 }
else if (tktmp==tk3) {
435 if (i1done && i2done && i3done)
break;
449 thisL3Index1isDone=
true;
450 atLeastOneTriplet=
true;
464 if (thisL3Index1isDone)
break;
471 const bool accept (n >= 1);
473 LogDebug(
"HLTMuonTrimuonL3Filter") <<
" >>>>> Result of HLTMuonTrimuonL3Filter is "<<
accept <<
", number of muon triplets passing thresholds= " <<
n;
double z0() const
z coordinate
float distance() const override
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const FreeTrajectoryState & theState() const
static bool triggeredByLevel2(const reco::TrackRef &track, std::vector< reco::RecoChargedCandidateRef > &vcands)
edm::Ref< RecoChargedCandidateCollection > RecoChargedCandidateRef
reference to an object in a collection of RecoChargedCandidate objects
double phi() const
azimuthal angle of momentum vector
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
edm::EDGetTokenT< reco::BeamSpot > beamspotToken_
double eta() const
pseudorapidity of momentum vector
bool status() const override
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
double pt() const
track transverse momentum
Abs< T >::type abs(const T &t)
T const * get() const
Returns C++ pointer to the item.
const edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
double y0() const
y coordinate
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > candToken_
math::PtEtaPhiELorentzVectorF LorentzVector
double x0() const
x coordinate