46 beamspotTag_ (iConfig.getParameter<
edm::
InputTag > (
"BeamSpotTag")),
48 candTag_ (iConfig.getParameter<
edm::
InputTag > (
"CandTag")),
50 previousCandTag_ (iConfig.getParameter<
InputTag > (
"PreviousCandTag")),
52 fast_Accept_ (iConfig.getParameter<
bool> (
"FastAccept")),
53 max_Eta_ (iConfig.getParameter<double> (
"MaxEta")),
54 min_Nhits_ (iConfig.getParameter<
int> (
"MinNhits")),
55 max_Dr_ (iConfig.getParameter<double> (
"MaxDr")),
56 max_Dz_ (iConfig.getParameter<double> (
"MaxDz")),
57 chargeOpt_ (iConfig.getParameter<
int> (
"ChargeOpt")),
58 min_PtTriplet_ (iConfig.getParameter<double> (
"MinPtTriplet")),
59 min_PtMax_ (iConfig.getParameter<double> (
"MinPtMax")),
60 min_PtMin_ (iConfig.getParameter<double> (
"MinPtMin")),
61 min_InvMass_ (iConfig.getParameter<double> (
"MinInvMass")),
62 max_InvMass_ (iConfig.getParameter<double> (
"MaxInvMass")),
63 min_Acop_ (iConfig.getParameter<double> (
"MinAcop")),
64 max_Acop_ (iConfig.getParameter<double> (
"MaxAcop")),
65 min_PtBalance_ (iConfig.getParameter<double> (
"MinPtBalance")),
66 max_PtBalance_ (iConfig.getParameter<double> (
"MaxPtBalance")),
67 nsigma_Pt_ (iConfig.getParameter<double> (
"NSigmaPt")),
68 max_DCAMuMu_ (iConfig.getParameter<double>(
"MaxDCAMuMu")),
69 max_YTriplet_ (iConfig.getParameter<double>(
"MaxRapidityTriplet")),
70 theL3LinksLabel (iConfig.getParameter<
InputTag>(
"InputLinks")),
75 <<
" CandTag/MinN/MaxEta/MinNhits/MaxDr/MaxDz/MinPt1/MinPt2/MinInvMass/MaxInvMass/MinAcop/MaxAcop/MinPtBalance/MaxPtBalance/NSigmaPt/MaxDzMuMu/MaxRapidityTriplet : " 101 desc.
add<
bool>(
"FastAccept",
false);
102 desc.
add<
double>(
"MaxEta",2.5);
103 desc.
add<
int>(
"MinNhits",0);
104 desc.
add<
double>(
"MaxDr",2.0);
105 desc.
add<
double>(
"MaxDz",9999.0);
106 desc.
add<
int>(
"ChargeOpt",0);
107 desc.
add<
double>(
"MinPtTriplet",0.0);
108 desc.
add<
double>(
"MinPtMax",3.0);
109 desc.
add<
double>(
"MinPtMin",3.0);
110 desc.
add<
double>(
"MinInvMass",2.8);
111 desc.
add<
double>(
"MaxInvMass",3.4);
112 desc.
add<
double>(
"MinAcop",-1.0);
113 desc.
add<
double>(
"MaxAcop",3.15);
114 desc.
add<
double>(
"MinPtBalance",-1.0);
115 desc.
add<
double>(
"MaxPtBalance",999999.0);
116 desc.
add<
double>(
"NSigmaPt",0.0);
117 desc.
add<
double>(
"MaxDCAMuMu",99999.9);
118 desc.
add<
double>(
"MaxRapidityTriplet",999999.0);
120 descriptions.
add(
"hltMuonTrimuonL3Filter",desc);
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;
483 for (
auto & vcand : vcands) {
484 if ( vcand->get<
TrackRef>() == staTrack ) {
486 LogDebug(
"HLTMuonL3PreFilter") <<
"The L2 track triggered";
double z0() const
z coordinate
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HLTMuonTrimuonL3Filter(const edm::ParameterSet &)
float distance() const override
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrajectoryStateClosestToPoint impactPointTSCP() 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)
std::vector< MuonTrackLinks > MuonTrackLinksCollection
collection of MuonTrackLinks
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
edm::EDGetTokenT< reco::BeamSpot > beamspotToken_
#define DEFINE_FWK_MODULE(type)
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
~HLTMuonTrimuonL3Filter() override
Abs< T >::type abs(const T &t)
T const * get() const
Returns C++ pointer to the item.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
std::vector< RecoChargedCandidate > RecoChargedCandidateCollection
collectin of RecoChargedCandidate objects
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
void add(std::string const &label, ParameterSetDescription const &psetDescription)
double y0() const
y coordinate
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > candToken_
math::PtEtaPhiELorentzVectorF LorentzVector
double x0() const
x coordinate