34 Out(std::vector<double>
const&
v): v_(v) {}
36 std::vector<double>
const& v_;
39 #if defined(EDM_ML_DEBUG) 42 for(
double v: iO.v_) {
52 beamspotTag_ (iConfig.getParameter<
edm::
InputTag > (
"BeamSpotTag")),
54 candTag_ (iConfig.getParameter<
edm::
InputTag > (
"CandTag")),
56 previousCandTag_ (iConfig.getParameter<
InputTag > (
"PreviousCandTag")),
58 l1CandTag_ (iConfig.getParameter<
InputTag > (
"L1CandTag")),
60 recoMuTag_ (iConfig.getParameter<
InputTag > (
"inputMuonCollection")),
62 previousCandIsL2_(iConfig.getParameter<
bool> (
"PreviousCandIsL2")),
63 fast_Accept_ (iConfig.getParameter<
bool> (
"FastAccept")),
64 min_N_ (iConfig.getParameter<
int> (
"MinN")),
65 max_Eta_ (iConfig.getParameter<double> (
"MaxEta")),
66 min_Nhits_ (iConfig.getParameter<
int> (
"MinNhits")),
67 max_Dr_ (iConfig.getParameter<double> (
"MaxDr")),
68 max_Dz_ (iConfig.getParameter<double> (
"MaxDz")),
69 chargeOpt_ (iConfig.getParameter<
int> (
"ChargeOpt")),
70 min_PtPair_ (iConfig.getParameter< vector<double> > (
"MinPtPair")),
71 max_PtPair_ (iConfig.getParameter< vector<double> > (
"MaxPtPair")),
72 min_PtMax_ (iConfig.getParameter< vector<double> > (
"MinPtMax")),
73 min_PtMin_ (iConfig.getParameter< vector<double> > (
"MinPtMin")),
74 max_PtMin_ (iConfig.getParameter< vector<double> > (
"MaxPtMin")),
75 min_InvMass_ (iConfig.getParameter< vector<double> > (
"MinInvMass")),
76 max_InvMass_ (iConfig.getParameter< vector<double> > (
"MaxInvMass")),
77 min_Acop_ (iConfig.getParameter<double> (
"MinAcop")),
78 max_Acop_ (iConfig.getParameter<double> (
"MaxAcop")),
79 min_PtBalance_ (iConfig.getParameter<double> (
"MinPtBalance")),
80 max_PtBalance_ (iConfig.getParameter<double> (
"MaxPtBalance")),
81 nsigma_Pt_ (iConfig.getParameter<double> (
"NSigmaPt")),
82 max_DCAMuMu_ (iConfig.getParameter<double>(
"MaxDCAMuMu")),
83 max_YPair_ (iConfig.getParameter<double>(
"MaxRapidityPair")),
84 cutCowboys_(iConfig.getParameter<
bool>(
"CutCowboys")),
85 theL3LinksLabel (iConfig.getParameter<
InputTag>(
"InputLinks")),
87 L1MatchingdR_ (iConfig.getParameter<double> (
"L1MatchingdR")),
88 matchPreviousCand_ (iConfig.getParameter<
bool>(
"MatchToPreviousCand") ),
93 <<
" CandTag/MinN/MaxEta/MinNhits/MaxDr/MaxDz/MinPt1/MinPt2/MinInvMass/MaxInvMass/MinAcop/MaxAcop/MinPtBalance/MaxPtBalance/NSigmaPt/MaxDzMuMu/MaxRapidityPair : " 123 desc.
add<
bool>(
"PreviousCandIsL2",
true);
124 desc.
add<
bool>(
"FastAccept",
false);
125 desc.
add<
int>(
"MinN",1);
126 desc.
add<
double>(
"MaxEta",2.5);
127 desc.
add<
int>(
"MinNhits",0);
128 desc.
add<
double>(
"MaxDr",2.0);
129 desc.
add<
double>(
"MaxDz",9999.0);
130 desc.
add<
int>(
"ChargeOpt",0);
131 vector<double> v1; v1.push_back(0.0);
132 vector<double> v2; v2.push_back(1e125);
133 vector<double> v3; v3.push_back(3.0);
134 vector<double> v4; v4.push_back(3.0);
135 vector<double> v5; v5.push_back(1e125);
136 vector<double> v6; v6.push_back(2.8);
137 vector<double> v7; v7.push_back(3.4);
138 desc.
add<vector<double> >(
"MinPtPair",v1);
139 desc.
add<vector<double> >(
"MaxPtPair",v2);
140 desc.
add<vector<double> >(
"MinPtMax",v3);
141 desc.
add<vector<double> >(
"MinPtMin",v4);
142 desc.
add<vector<double> >(
"MaxPtMin",v5);
143 desc.
add<vector<double> >(
"MinInvMass",v6);
144 desc.
add<vector<double> >(
"MaxInvMass",v7);
145 desc.
add<
double>(
"MinAcop",-1.0);
146 desc.
add<
double>(
"MaxAcop",3.15);
147 desc.
add<
double>(
"MinPtBalance",-1.0);
148 desc.
add<
double>(
"MaxPtBalance",999999.0);
149 desc.
add<
double>(
"NSigmaPt",0.0);
150 desc.
add<
double>(
"MaxDCAMuMu",99999.9);
151 desc.
add<
double>(
"MaxRapidityPair",999999.0);
152 desc.
add<
bool>(
"CutCowboys",
false);
154 desc.
add<
double>(
"L1MatchingdR",0.3);
155 desc.
add<
bool>(
"MatchToPreviousCand",
true);
156 descriptions.
add(
"hltMuonDimuonL3Filter",desc);
187 vector<RecoChargedCandidateRef> vl2cands;
196 std::map<reco::TrackRef, std::vector<RecoChargedCandidateRef> > L2toL3s;
198 std::map<unsigned int, RecoChargedCandidateRef > MuonToL3s;
201 if (mucands->empty())
return false;
202 auto const &tk = (*mucands)[0].track();
205 if (tk->seedRef().isNonnull()){
207 useL3MTS =
a !=
nullptr;
212 unsigned int maxI = mucands->size();
213 for (
unsigned int i=0;
i!=
maxI;
i++){
214 const TrackRef &tk = (*mucands)[
i].track();
217 TrackRef staTrack = l3seedRef->l2Track();
231 std::vector<l1t::MuonRef> vl1cands;
233 bool check_l1match =
true;
236 for(
unsigned int i(0);
i < mucands->size(); ++
i){
245 check_l1match =
true;
246 for(
auto const & link : *links){
250 const reco::Track& trackerTrack = *link.trackerTrack();
251 if (tk->pt()==0
or trackerTrack.
pt()==0)
continue;
253 float dR2 =
deltaR2(tk->eta(),tk->phi(),trackerTrack.
eta(),trackerTrack.
phi());
254 float dPt =
std::abs(tk->pt() - trackerTrack.
pt())/tk->pt();
256 if (dR2 < 0.02*0.02 and dPt < 0.001) {
257 const TrackRef staTrack = link.standAloneTrack();
259 check_l1match =
false;
266 const unsigned int nL1Muons(vl1cands.size());
267 for (
unsigned int il1=0; il1!=nL1Muons; ++il1) {
268 if (
deltaR(cand->eta(), cand->phi(), vl1cands[il1]->eta(), vl1cands[il1]->phi()) <
L1MatchingdR_) {
285 auto L2toL3s_it1 = L2toL3s.begin();
286 auto L2toL3s_end = L2toL3s.end();
287 bool atLeastOnePair=
false;
288 for (; L2toL3s_it1!=L2toL3s_end; ++L2toL3s_it1){
294 unsigned int maxItk1=L2toL3s_it1->second.size();
295 for (; iTk1!=maxItk1; iTk1++){
296 bool thisL3Index1isDone=
false;
300 LogDebug(
"HLTMuonDimuonL3Filter") <<
" 1st muon in loop: q*pt= " << tk1->charge()*tk1->pt()
301 <<
" (" << cand1->charge()*cand1->pt()<<
") " <<
", eta= " << tk1->eta()
302 <<
" (" << cand1->eta() <<
") " <<
", hits= " << tk1->numberOfValidHits();
309 LogDebug(
"HLTMuonDimuonL3Filter") <<
" ... 1st muon in loop, pt1= " << cand1->pt();
312 auto L2toL3s_it2 = L2toL3s_it1;
314 for (; L2toL3s_it2!=L2toL3s_end; ++L2toL3s_it2){
319 unsigned int maxItk2=L2toL3s_it2->second.size();
320 for (; iTk2!=maxItk2; iTk2++){
324 LogDebug(
"HLTMuonDimuonL3Filter") <<
" 2nd muon in loop: q*pt= " << tk2->charge()*tk2->pt()
325 <<
" (" << cand2->charge()*cand2->pt() <<
") " <<
", eta= " << tk2->eta()
326 <<
" (" << cand2->eta() <<
") " <<
", hits= " << tk2->numberOfValidHits() <<
", d0= " << tk2->d0() ;
333 LogDebug(
"HLTMuonDimuonL3Filter") <<
" ... 2nd muon in loop, pt2= " << cand2->pt();
340 LogDebug(
"HLTMuonDimuonL3Filter") <<
" Track1 passing filter: pt= " << cand1->pt() <<
", eta: " << cand1->eta();
341 LogDebug(
"HLTMuonDimuonL3Filter") <<
" Track2 passing filter: pt= " << cand2->pt() <<
", eta: " << cand2->eta();
345 vector<RecoChargedCandidateRef> vref;
347 for (
auto &
i : vref) {
350 if (tktmp==tk1) i1done =
true;
351 else if (tktmp==tk2) i2done =
true;
352 if (i1done && i2done)
break;
358 thisL3Index1isDone=
true;
367 if (thisL3Index1isDone)
break;
370 auto MuonToL3s_it1 = MuonToL3s.begin();
371 auto MuonToL3s_end = MuonToL3s.end();
372 for (; MuonToL3s_it1!=MuonToL3s_end; ++MuonToL3s_it1){
380 LogDebug(
"HLTMuonDimuonL3Filter") <<
" L3FromL2 Track1 passing filter: pt= " << cand1->pt() <<
", eta: " << cand1->eta();
381 LogDebug(
"HLTMuonDimuonL3Filter") <<
" L3FromL1 Track2 passing filter: pt= " << cand2->pt() <<
", eta: " << cand2->eta();
385 vector<RecoChargedCandidateRef> vref;
387 for (
auto &
i : vref) {
390 if (tktmp==tk1) i1done =
true;
391 else if (tktmp==tk2) i2done =
true;
392 if (i1done && i2done)
break;
398 thisL3Index1isDone=
true;
404 if (thisL3Index1isDone)
break;
413 auto MuonToL3s_it1 = MuonToL3s.begin();
414 auto MuonToL3s_end = MuonToL3s.end();
415 for (; MuonToL3s_it1!=MuonToL3s_end; ++MuonToL3s_it1){
416 bool thisL3Index1isDone=
false;
422 auto MuonToL3s_it2 = MuonToL3s_it1;
423 for (; MuonToL3s_it2!=MuonToL3s_end; ++MuonToL3s_it2){
432 LogDebug(
"HLTMuonDimuonL3Filter") <<
" L3FromL1 Track1 passing filter: pt= " << cand1->pt() <<
", eta: " << cand1->eta();
433 LogDebug(
"HLTMuonDimuonL3Filter") <<
" L3FromL1 Track2 passing filter: pt= " << cand2->pt() <<
", eta: " << cand2->eta();
437 vector<RecoChargedCandidateRef> vref;
439 for (
auto &
i : vref) {
442 if (tktmp==tk1) i1done =
true;
443 else if (tktmp==tk2) i2done =
true;
444 if (i1done && i2done)
break;
450 thisL3Index1isDone=
true;
457 if (thisL3Index1isDone)
break;
464 LogDebug(
"HLTMuonDimuonL3Filter") <<
" >>>>> Result of HLTMuonDimuonL3Filter is "<< accept <<
", number of muon pairs passing thresholds= " <<
n;
472 for (
auto const & vcand : vcands) {
473 if ( vcand->get<
TrackRef>() == staTrack ) {
475 LogDebug(
"HLTMuonL3PreFilter") <<
"The L2 track triggered";
488 if (tk->numberOfValidHits()<
min_Nhits_)
return false;
491 if (
std::abs( (- (cand->vx()-beamSpot.
x0()) * cand->py() + (cand->vy()-beamSpot.
y0()) * cand->px() ) / cand->pt() ) >
max_Dr_)
return false;
494 if (
std::abs((cand->vz()-beamSpot.
z0()) - ((cand->vx()-beamSpot.
x0())*cand->px()+(cand->vy()-beamSpot.
y0())*cand->py())/cand->pt() * cand->pz()/cand->pt())>
max_Dz_)
return false;
502 if (
chargeOpt_<0 and (cand1->charge()*cand2->charge()>0))
return false;
503 else if (
chargeOpt_>0 and (cand1->charge()*cand2->charge()<0))
return false;
506 double acop =
std::abs(cand1->phi()-cand2->phi());
507 if (acop>
M_PI) acop = 2*
M_PI - acop;
509 LogDebug(
"HLTMuonDimuonL3Filter") <<
" ... 1-2 acop= " << acop;
514 double ptbalance =
std::abs(cand1->pt()-cand2->pt());
527 double pt12 = p.pt();
528 LogDebug(
"HLTMuonDimuonL3Filter") <<
" ... 1-2 pt12= " << pt12;
530 double ptLx1 = cand1->pt();
531 double ptLx2 = cand2->pt();
532 double invmass =
abs(p.mass());
534 LogDebug(
"HLTMuonDimuonL3Filter") <<
" ... 1-2 invmass= " << invmass;
536 for (
unsigned int iv=0 ; iv<
min_InvMass_.size(); iv++) {
553 if (!proceed)
return false;
574 double rapidity =
std::abs(p.Rapidity());
578 if(
cutCowboys_ && (cand1->charge()*
deltaPhi(cand1->phi(), cand2->phi()) > 0.))
return false;
bool applyDiMuonSelection(const reco::RecoChargedCandidateRef &, const reco::RecoChargedCandidateRef &, const reco::BeamSpot &, const edm::ESHandle< MagneticField > &) const
std::vector< double > max_PtPair_
double z0() const
z coordinate
float distance() const override
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > previousCandToken_
std::vector< double > max_PtMin_
std::vector< double > max_InvMass_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
enum start value shifted to 81 so as to avoid clashes with PDG codes
TrajectoryStateClosestToPoint impactPointTSCP() const
const FreeTrajectoryState & theState() const
std::vector< double > min_InvMass_
edm::Ref< RecoChargedCandidateCollection > RecoChargedCandidateRef
reference to an object in a collection of RecoChargedCandidate objects
double phi() const
azimuthal angle of momentum vector
bool applyMuonSelection(const reco::RecoChargedCandidateRef &, const reco::BeamSpot &) const
std::vector< double > min_PtPair_
~HLTMuonDimuonL3Filter() override
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
std::vector< Muon > MuonCollection
collection of Muon objects
std::vector< MuonTrackLinks > MuonTrackLinksCollection
collection of MuonTrackLinks
const edm::InputTag l1CandTag_
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref<C>)
const bool matchPreviousCand_
#define DEFINE_FWK_MODULE(type)
double eta() const
pseudorapidity of momentum vector
bool status() const override
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > l1CandToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
double pt() const
track transverse momentum
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Abs< T >::type abs(const T &t)
T const * get() const
Returns C++ pointer to the item.
std::vector< double > min_PtMin_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< double > min_PtMax_
std::vector< RecoChargedCandidate > RecoChargedCandidateCollection
collectin of RecoChargedCandidate objects
const edm::EDGetTokenT< reco::BeamSpot > beamspotToken_
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)
const edm::EDGetTokenT< reco::RecoChargedCandidateCollection > candToken_
double y0() const
y coordinate
HLTMuonDimuonL3Filter(const edm::ParameterSet &)
const edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
bool cutCowboys_
if true, reject muon-track pairs that bend towards each other
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
static bool triggeredByLevel2(reco::TrackRef const &track, std::vector< reco::RecoChargedCandidateRef > const &vcands)
const edm::InputTag candTag_
math::PtEtaPhiELorentzVectorF LorentzVector
double x0() const
x coordinate
const double L1MatchingdR_