CMS 3D CMS Logo

MuonCosmicCompatibilityFiller.cc
Go to the documentation of this file.
1 
14 // system include files
15 #include <memory>
16 #include <string>
17 
18 // user include files
23 
27 
31 
34 
37 
38 #include "TMath.h"
39 
40 using namespace edm;
41 using namespace std;
42 
45  : inputMuonCollections_(iConfig.getParameter<std::vector<edm::InputTag> >("InputMuonCollections")),
46  inputTrackCollections_(iConfig.getParameter<std::vector<edm::InputTag> >("InputTrackCollections")),
47  inputCosmicMuonCollection_(iConfig.getParameter<edm::InputTag>("InputCosmicMuonCollection")),
48  inputVertexCollection_(iConfig.getParameter<edm::InputTag>("InputVertexCollection")) {
49  //kinematic vars
50  angleThreshold_ = iConfig.getParameter<double>("angleCut");
51  deltaPt_ = iConfig.getParameter<double>("deltaPt");
52  //time
53  offTimePosTightMult_ = iConfig.getParameter<double>("offTimePosTightMult");
54  offTimeNegTightMult_ = iConfig.getParameter<double>("offTimeNegTightMult");
55  offTimePosTight_ = iConfig.getParameter<double>("offTimePosTight");
56  offTimeNegTight_ = iConfig.getParameter<double>("offTimeNegTight");
57  offTimePosLooseMult_ = iConfig.getParameter<double>("offTimePosLooseMult");
58  offTimeNegLooseMult_ = iConfig.getParameter<double>("offTimeNegLooseMult");
59  offTimePosLoose_ = iConfig.getParameter<double>("offTimePosLoose");
60  offTimeNegLoose_ = iConfig.getParameter<double>("offTimeNegLoose");
61  corrTimeNeg_ = iConfig.getParameter<double>("corrTimeNeg");
62  corrTimePos_ = iConfig.getParameter<double>("corrTimePos");
63  //rechits
64  sharedHits_ = iConfig.getParameter<int>("sharedHits");
65  sharedFrac_ = iConfig.getParameter<double>("sharedFrac");
66  ipThreshold_ = iConfig.getParameter<double>("ipCut");
67  //segment comp, matches
68  nChamberMatches_ = iConfig.getParameter<int>("nChamberMatches");
69  segmentComp_ = iConfig.getParameter<double>("segmentComp");
70  //ip, vertex
71  maxdzLooseMult_ = iConfig.getParameter<double>("maxdzLooseMult");
72  maxdxyLooseMult_ = iConfig.getParameter<double>("maxdxyLooseMult");
73  maxdzTightMult_ = iConfig.getParameter<double>("maxdzTightMult");
74  maxdxyTightMult_ = iConfig.getParameter<double>("maxdxyTightMult");
75  maxdzLoose_ = iConfig.getParameter<double>("maxdzLoose");
76  maxdxyLoose_ = iConfig.getParameter<double>("maxdxyLoose");
77  maxdzTight_ = iConfig.getParameter<double>("maxdzTight");
78  maxdxyTight_ = iConfig.getParameter<double>("maxdxyTight");
79  largedxyMult_ = iConfig.getParameter<double>("largedxyMult");
80  largedxy_ = iConfig.getParameter<double>("largedxy");
81  hIpTrdxy_ = iConfig.getParameter<double>("hIpTrdxy");
82  hIpTrvProb_ = iConfig.getParameter<double>("hIpTrvProb");
83  minvProb_ = iConfig.getParameter<double>("minvProb");
84  maxvertZ_ = iConfig.getParameter<double>("maxvertZ");
85  maxvertRho_ = iConfig.getParameter<double>("maxvertRho");
86  // nTrackThreshold_ = iConfig.getParameter<unsigned int>("nTrackThreshold");
87 
88  for (unsigned int i = 0; i < inputMuonCollections_.size(); ++i)
90  for (unsigned int i = 0; i < inputTrackCollections_.size(); ++i)
92 
96 }
97 
99 
102  const edm::EventSetup& iSetup) {
103  const std::string theCategory = "MuonCosmicCompatibilityFiller";
104 
106 
107  float timeCompatibility = muonTiming(iEvent, muon, false);
108  float backToBackCompatibility = backToBack2LegCosmic(iEvent, muon);
109  float overlapCompatibility = isOverlappingMuon(iEvent, iSetup, muon);
110  float ipCompatibility = pvMatches(iEvent, muon, false);
111  float vertexCompatibility = eventActivity(iEvent, muon);
112  float combinedCompatibility = combinedCosmicID(iEvent, iSetup, muon, false, false);
113 
114  returnComp.timeCompatibility = timeCompatibility;
115  returnComp.backToBackCompatibility = backToBackCompatibility;
116  returnComp.overlapCompatibility = overlapCompatibility;
117  returnComp.cosmicCompatibility = combinedCompatibility;
118  returnComp.ipCompatibility = ipCompatibility;
119  returnComp.vertexCompatibility = vertexCompatibility;
120 
121  return returnComp;
122 }
123 
124 //
125 //Timing: 0 - not cosmic-like
126 //
127 float MuonCosmicCompatibilityFiller::muonTiming(const edm::Event& iEvent, const reco::Muon& muon, bool isLoose) const {
128  float offTimeNegMult, offTimePosMult, offTimeNeg, offTimePos;
129 
130  if (isLoose) {
131  //use "loose" parameter set
132  offTimeNegMult = offTimeNegLooseMult_;
133  offTimePosMult = offTimePosLooseMult_;
134  offTimeNeg = offTimeNegLoose_;
135  offTimePos = offTimePosLoose_;
136  } else {
137  offTimeNegMult = offTimeNegTightMult_;
138  offTimePosMult = offTimePosTightMult_;
139  offTimeNeg = offTimeNegTight_;
140  offTimePos = offTimePosTight_;
141  }
142 
143  float result = 0.0;
144 
145  if (muon.isTimeValid()) {
146  //case of multiple muon event
147  if (nMuons(iEvent) > 1) {
148  float positiveTime = 0;
149  if (muon.time().timeAtIpInOut < offTimeNegMult || muon.time().timeAtIpInOut > offTimePosMult)
150  result = 1.;
151  if (muon.time().timeAtIpInOut > 0.)
152  positiveTime = muon.time().timeAtIpInOut;
153 
154  //special case, looking for time-correlation
155  // between muons in opposite hemispheres
156  if (!isLoose && result == 0 && positiveTime > corrTimePos_) {
157  //check hemi of this muon
158  bool isUp = false;
159  reco::TrackRef outertrack = muon.outerTrack();
160  if (outertrack.isNonnull()) {
161  if (outertrack->phi() > 0)
162  isUp = true;
163 
164  //loop over muons in that event and find if there are any in the opposite hemi
166  iEvent.getByToken(muonTokens_[1], muonHandle);
167 
168  if (!muonHandle.failedToGet()) {
169  for (reco::MuonCollection::const_iterator iMuon = muonHandle->begin(); iMuon != muonHandle->end();
170  ++iMuon) {
171  if (!iMuon->isGlobalMuon())
172  continue;
173 
174  reco::TrackRef checkedTrack = iMuon->outerTrack();
175  if (muon.isTimeValid()) {
176  // from bottom up
177  if (checkedTrack->phi() < 0 && isUp) {
178  if (iMuon->time().timeAtIpInOut < corrTimeNeg_)
179  result = 1.0;
180  break;
181  } else if (checkedTrack->phi() > 0 && !isUp) {
182  // from top down
183  if (iMuon->time().timeAtIpInOut < corrTimeNeg_)
184  result = 1.0;
185  break;
186  }
187  } //muon is time valid
188  }
189  }
190  } //track is nonnull
191  } //double check timing
192  } else {
193  //case of a single muon event
194  if (muon.time().timeAtIpInOut < offTimeNeg || muon.time().timeAtIpInOut > offTimePos)
195  result = 1.;
196  }
197  } //is time valid
198 
199  if (!isLoose && result > 0) {
200  //check loose ip
201  if (pvMatches(iEvent, muon, true) == 0)
202  result *= 2.;
203  }
204 
205  return result;
206 }
207 
208 //
209 //Back-to-back selector
210 //
212  const reco::Muon& muon) const {
213  unsigned int result = 0; //no partners - collision
215  if (muon.isGlobalMuon())
216  track = muon.innerTrack();
217  else if (muon.isTrackerMuon())
218  track = muon.track();
219  else if (muon.isStandAloneMuon() || muon.isRPCMuon() || muon.isGEMMuon() || muon.isME0Muon())
220  return false;
221 
222  for (unsigned int iColl = 0; iColl < trackTokens_.size(); ++iColl) {
224  iEvent.getByToken(trackTokens_[iColl], trackHandle);
225  if (muonid::findOppositeTrack(trackHandle, *track, angleThreshold_, deltaPt_).isNonnull()) {
226  result++;
227  }
228  } //loop over track collections
229 
230  return result;
231 }
232 
233 //
234 //Check the number of global muons in an event, return true if there are more than 1 muon
235 //
237  unsigned int nGlb = 0;
238 
240  iEvent.getByToken(muonTokens_[1], muonHandle);
241 
242  if (!muonHandle.failedToGet()) {
243  for (reco::MuonCollection::const_iterator iMuon = muonHandle->begin(); iMuon != muonHandle->end(); ++iMuon) {
244  if (!iMuon->isGlobalMuon())
245  continue;
246  nGlb++;
247  }
248  }
249 
250  return nGlb;
251 }
252 
253 //
254 //Check overlap between collections, use shared hits info
255 //
257  const edm::EventSetup& iSetup,
258  const reco::Muon& muon) const {
259  // 4 steps in this module
260  // step1 : check whether it's 1leg cosmic muon or not
261  // step2 : both muons (muons and muonsFromCosmics1Leg) should have close IP
262  // step3 : both muons should share very close reference point
263  // step4 : check shared hits in both muon tracks
264 
265  // check if this muon is available in muonsFromCosmics collection
266  bool overlappingMuon = false; //false - not cosmic-like
267  if (!muon.isGlobalMuon())
268  return false;
269 
270  // reco muons for cosmics
272  iEvent.getByToken(cosmicToken_, muonHandle);
273 
274  // Global Tracking Geometry
276 
277  // PV
278  math::XYZPoint RefVtx;
279  RefVtx.SetXYZ(0, 0, 0);
280 
282  iEvent.getByToken(vertexToken_, pvHandle);
283  const reco::VertexCollection& vertices = *pvHandle.product();
284  for (reco::VertexCollection::const_iterator it = vertices.begin(); it != vertices.end(); ++it) {
285  RefVtx = it->position();
286  }
287 
288  if (!muonHandle.failedToGet()) {
289  for (reco::MuonCollection::const_iterator cosmicMuon = muonHandle->begin(); cosmicMuon != muonHandle->end();
290  ++cosmicMuon) {
291  if (cosmicMuon->innerTrack() == muon.innerTrack() || cosmicMuon->outerTrack() == muon.outerTrack())
292  return true;
293 
294  reco::TrackRef outertrack = muon.outerTrack();
295  reco::TrackRef costrack = cosmicMuon->outerTrack();
296 
297  bool isUp = false;
298  if (outertrack->phi() > 0)
299  isUp = true;
300 
301  // shared hits
302  int RecHitsMuon = outertrack->numberOfValidHits();
303  int RecHitsCosmicMuon = 0;
304  int shared = 0;
305  // count hits for same hemisphere
306  if (costrack.isNonnull()) {
307  int nhitsUp = 0;
308  int nhitsDown = 0;
309  // unused
310  // bool isCosmic1Leg = false;
311  // bool isCloseIP = false;
312  // bool isCloseRef = false;
313 
314  for (trackingRecHit_iterator coshit = costrack->recHitsBegin(); coshit != costrack->recHitsEnd(); coshit++) {
315  if ((*coshit)->isValid()) {
316  DetId id((*coshit)->geographicalId());
317  double hity = trackingGeometry->idToDet(id)->position().y();
318  if (hity > 0)
319  nhitsUp++;
320  if (hity < 0)
321  nhitsDown++;
322 
323  if (isUp && hity > 0)
324  RecHitsCosmicMuon++;
325  if (!isUp && hity < 0)
326  RecHitsCosmicMuon++;
327  }
328  }
329  // step1
330  //UNUSED: if( nhitsUp > 0 && nhitsDown > 0 ) isCosmic1Leg = true;
331  //if( !isCosmic1Leg ) continue;
332 
333  if (outertrack.isNonnull()) {
334  // step2
335  //UNUSED: const double ipErr = (double)outertrack->d0Error();
336  //UNUSED: double ipThreshold = max(ipThreshold_, ipErr);
337  //UNUSED: if( fabs(outertrack->dxy(RefVtx) + costrack->dxy(RefVtx)) < ipThreshold ) isCloseIP = true;
338  //if( !isCloseIP ) continue;
339 
340  // step3
341  GlobalPoint muonRefVtx(outertrack->vx(), outertrack->vy(), outertrack->vz());
342  GlobalPoint cosmicRefVtx(costrack->vx(), costrack->vy(), costrack->vz());
343  //UNUSED: float dist = (muonRefVtx - cosmicRefVtx).mag();
344  //UNUSED: if( dist < 0.1 ) isCloseRef = true;
345  //if( !isCloseRef ) continue;
346 
347  for (trackingRecHit_iterator trkhit = outertrack->recHitsBegin(); trkhit != outertrack->recHitsEnd();
348  trkhit++) {
349  if ((*trkhit)->isValid()) {
350  for (trackingRecHit_iterator coshit = costrack->recHitsBegin(); coshit != costrack->recHitsEnd();
351  coshit++) {
352  if ((*coshit)->isValid()) {
353  if ((*trkhit)->geographicalId() == (*coshit)->geographicalId()) {
354  if (((*trkhit)->localPosition() - (*coshit)->localPosition()).mag() < 10e-5)
355  shared++;
356  }
357  }
358  }
359  }
360  }
361  }
362  }
363  // step4
364  double fraction = -1;
365  if (RecHitsMuon != 0)
366  fraction = shared / (double)RecHitsMuon;
367  // std::cout << "shared = " << shared << " " << fraction << " " << RecHitsMuon << " " << RecHitsCosmicMuon << std::endl;
368  if (shared > sharedHits_ && fraction > sharedFrac_) {
369  overlappingMuon = true;
370  break;
371  }
372  }
373  }
374 
375  return overlappingMuon;
376 }
377 
378 //
379 //pv matches
380 //
382  const reco::Muon& muon,
383  bool isLoose) const {
384  float maxdxyMult, maxdzMult, maxdxy, maxdz;
385 
386  if (isLoose) {
387  //use "loose" parameter set
388  maxdxyMult = maxdxyLooseMult_;
389  maxdzMult = maxdzLooseMult_;
390  maxdxy = maxdxyLoose_;
391  maxdz = maxdzLoose_;
392  } else {
393  maxdxyMult = maxdxyTightMult_;
394  maxdzMult = maxdzTightMult_;
395  maxdxy = maxdxyTight_;
396  maxdz = maxdzTight_;
397  }
398 
399  unsigned int result = 0;
400 
402  if (muon.isGlobalMuon())
403  track = muon.innerTrack();
404  else if (muon.isTrackerMuon() || muon.isRPCMuon())
405  track = muon.track();
406  else if (muon.isStandAloneMuon())
407  track = muon.standAloneMuon();
408 
409  bool multipleMu = false;
410  if (nMuons(iEvent) > 1)
411  multipleMu = true;
412 
413  math::XYZPoint RefVtx;
414  RefVtx.SetXYZ(0, 0, 0);
415 
417  iEvent.getByToken(vertexToken_, pvHandle);
418  const reco::VertexCollection& vertices = *pvHandle.product();
419  for (reco::VertexCollection::const_iterator it = vertices.begin(); it != vertices.end(); ++it) {
420  RefVtx = it->position();
421 
422  if (track.isNonnull()) {
423  if (multipleMu) {
424  //multiple muon event
425 
426  if (fabs((*track).dxy(RefVtx)) < maxdxyMult || fabs((*track).dz(RefVtx)) < maxdzMult) {
427  result++;
428 
429  //case of extra large dxy
430  if (!isLoose && fabs((*track).dxy(RefVtx)) > largedxyMult_)
431  result -= 1;
432  }
433  } else {
434  //single muon event
435 
436  if (fabs((*track).dxy(RefVtx)) < maxdxy || fabs((*track).dz(RefVtx)) < maxdz) {
437  result++;
438 
439  //case of extra large dxy
440  if (!isLoose && fabs((*track).dxy(RefVtx)) > largedxy_)
441  result -= 1;
442  }
443  }
444  } //track is nonnull
445  } //loop over vertices
446 
447  //special case for non-cosmic large ip muons
448  if (result == 0 && multipleMu) {
449  // consider all reco muons in an event
451  iEvent.getByToken(muonTokens_[1], muonHandle);
452 
453  //cosmic event should have zero good vertices
455  iEvent.getByToken(vertexToken_, pvHandle);
456  const reco::VertexCollection& vertices = *pvHandle.product();
457 
458  //find the "other" one
459  if (!muonHandle.failedToGet()) {
460  for (reco::MuonCollection::const_iterator muons = muonHandle->begin(); muons != muonHandle->end(); ++muons) {
461  if (!muons->isGlobalMuon())
462  continue;
463  //skip this track
464  if (muons->innerTrack() == muon.innerTrack() && muons->outerTrack() == muon.outerTrack())
465  continue;
466  //check ip and vertex of the "other" muon
468  if (muons->isGlobalMuon())
469  tracks = muons->innerTrack();
470  if (fabs((*tracks).dxy(RefVtx)) > hIpTrdxy_)
471  continue;
472  //check if vertex collection is empty
473  if (vertices.begin() == vertices.end())
474  continue;
475  //for(reco::VertexCollection::const_iterator it=vertices.begin() ; it!=vertices.end() ; ++it) {
476  //find matching vertex by position
477  //if (fabs(it->z() - tracks->vz()) > 0.01) continue; //means will not be untagged from cosmics
478  if (TMath::Prob(vertices.front().chi2(), (int)(vertices.front().ndof())) > hIpTrvProb_)
479  result = 1;
480  //}
481  }
482  }
483  }
484 
485  return result;
486 }
487 
489  const edm::EventSetup& iSetup,
490  const reco::Muon& muon,
491  bool CheckMuonID,
492  bool checkVertex) const {
493  float result = 0.0;
494 
495  // return >=1 = identify as cosmic muon (the more like cosmics, the higher is the number)
496  // return 0.0 = identify as collision muon
497  if (muon.isGlobalMuon()) {
498  unsigned int cosmicVertex = eventActivity(iEvent, muon);
499  bool isOverlapping = isOverlappingMuon(iEvent, iSetup, muon);
500  unsigned int looseIp = pvMatches(iEvent, muon, true);
501  unsigned int tightIp = pvMatches(iEvent, muon, false);
502  float looseTime = muonTiming(iEvent, muon, true);
503  float tightTime = muonTiming(iEvent, muon, false);
504  unsigned int backToback = backToBack2LegCosmic(iEvent, muon);
505  //bool cosmicSegment = checkMuonSegments(muon);
506 
507  //short cut to reject cosmic event
508  if (checkVertex && cosmicVertex == 0)
509  return 10.0;
510 
511  // compatibility (0 - 10)
512  // weight is assigned by the performance of individual module
513  // btob: ~90% eff / ~0% misid
514  // ip: ~90% eff / ~0% misid
515  // time: ~30% eff / ~0% misid
516  double weight_btob = 2.0;
517  double weight_ip = 2.0;
518  double weight_time = 1.0;
519  double weight_overlap = 0.5;
520 
521  // collision muon should have compatibility < 4 (0 - 4)
522  // cosmic muon should have compatibility >= 4 (4 - 10)
523 
524  // b-to-b (max comp.: 4.0)
525  if (backToback >= 1) {
526  //in this case it is cosmic for sure
527  result += weight_btob * 2.;
528  if (tightIp == 1) {
529  // check with other observables to reduce mis-id (subtract compatibilities)
530  if (looseIp == 1) {
531  if (backToback < 2)
532  result -= weight_btob * 0.5;
533  }
534  }
535  }
536 
537  // ip (max comp.: 4.0)
538  if (tightIp == 0) {
539  //in this case it is cosmic for sure
540  result += weight_ip * 2.0;
541  if (backToback == 0) {
542  // check with other observables to reduce mis-id (subtract compatibilities)
543  if (tightTime == 0) {
544  if (looseTime == 0 && !isOverlapping)
545  result -= weight_ip * 1.0;
546  }
547  }
548  } else if (tightIp >= 2) {
549  // in this case it is almost collision-like (reduce compatibility)
550  // if multi pvs: comp = -2.0
551  if (backToback >= 1)
552  result -= weight_ip * 1.0;
553  }
554 
555  // timing (max comp.: 2.0)
556  if (tightTime > 0) {
557  // bonus track
558  if (looseTime > 0) {
559  if (backToback >= 1) {
560  if (tightIp == 0)
561  result += weight_time * tightTime;
562  else if (looseIp == 0)
563  result += weight_time * 0.25;
564  }
565  } else {
566  if (backToback >= 1 && tightIp == 0)
567  result += weight_time * 0.25;
568  }
569  }
570 
571  // overlapping
572  if (backToback == 0 && isOverlapping) {
573  // bonus track
574  if (tightIp == 0 && tightTime >= 1) {
575  result += weight_overlap * 1.0;
576  }
577  }
578  } //is global muon
579 
580  // if (CheckMuonID && cosmicSegment) result += 4;
581 
582  return result;
583 }
584 
585 //
586 //Track activity/vertex quality, count good vertices
587 //
589  unsigned int result = 0; //no good vertices - cosmic-like
590 
591  //check track activity
593  iEvent.getByToken(trackTokens_[0], tracks);
594  if (!tracks.failedToGet() && tracks->size() < 3)
595  return 0;
596 
597  //cosmic event should have zero good vertices
599  if (!iEvent.getByToken(vertexToken_, pvHandle)) {
600  return 0;
601  } else {
602  const reco::VertexCollection& vertices = *pvHandle.product();
603  //check if vertex collection is empty
604  if (vertices.begin() == vertices.end())
605  return 0;
606  for (reco::VertexCollection::const_iterator it = vertices.begin(); it != vertices.end(); ++it) {
607  if ((TMath::Prob(it->chi2(), (int)it->ndof()) > minvProb_) && (fabs(it->z()) <= maxvertZ_) &&
608  (fabs(it->position().rho()) <= maxvertRho_))
609  result++;
610  }
611  }
612  return result;
613 }
614 
615 //
616 //Muon iD variables
617 //
619  bool result = false;
620  // initial set up using Jordan's study: GlobalMuonPromptTight + TMOneStationLoose
622  result = true;
623 
624  return result;
625 }
626 
628  bool result = false;
630  result = true;
631 
632  return result;
633 }
GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
reco::MuonCosmicCompatibility::timeCompatibility
float timeCompatibility
cosmic-likeness based on time: 0 == prompt-like
Definition: MuonCosmicCompatibility.h:9
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
MuonCosmicCompatibilityFiller::segmentComp_
double segmentComp_
Definition: MuonCosmicCompatibilityFiller.h:124
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
MuonCosmicCompatibilityFiller::hIpTrvProb_
double hIpTrvProb_
Definition: MuonCosmicCompatibilityFiller.h:103
mps_fire.i
i
Definition: mps_fire.py:428
MuonCosmicCompatibilityFiller::offTimeNegLoose_
double offTimeNegLoose_
Definition: MuonCosmicCompatibilityFiller.h:109
MuonCosmicCompatibilityFiller::offTimeNegLooseMult_
double offTimeNegLooseMult_
Definition: MuonCosmicCompatibilityFiller.h:113
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
MuonCosmicCompatibilityFiller::inputTrackCollections_
std::vector< edm::InputTag > inputTrackCollections_
Definition: MuonCosmicCompatibilityFiller.h:82
edm::Handle::product
T const * product() const
Definition: Handle.h:70
MuonCosmicCompatibilityFiller::cosmicToken_
edm::EDGetTokenT< reco::MuonCollection > cosmicToken_
Definition: MuonCosmicCompatibilityFiller.h:88
MuonCosmicCompatibilityFiller::trackTokens_
std::vector< edm::EDGetTokenT< reco::TrackCollection > > trackTokens_
Definition: MuonCosmicCompatibilityFiller.h:87
MuonCosmicCompatibilityFiller::~MuonCosmicCompatibilityFiller
~MuonCosmicCompatibilityFiller()
Definition: MuonCosmicCompatibilityFiller.cc:98
muon
Definition: MuonCocktails.h:17
muon::segmentCompatibility
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
Definition: MuonSelectors.cc:61
edm
HLT enums.
Definition: AlignableModifier.h:19
MuonCosmicCompatibilityFiller::maxdzTightMult_
double maxdzTightMult_
Definition: MuonCosmicCompatibilityFiller.h:99
MuonCosmicCompatibilityFiller::maxdxyLoose_
double maxdxyLoose_
Definition: MuonCosmicCompatibilityFiller.h:92
MuonCosmicCompatibilityFiller::hIpTrdxy_
double hIpTrdxy_
Definition: MuonCosmicCompatibilityFiller.h:102
MuonCosmicCompatibilityFiller::maxdzLoose_
double maxdzLoose_
Definition: MuonCosmicCompatibilityFiller.h:93
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
MuonCosmicCompatibilityFiller::nMuons
unsigned int nMuons(const edm::Event &) const
get number of muons in the vent
Definition: MuonCosmicCompatibilityFiller.cc:236
MuonCosmicCompatibilityFiller::largedxyMult_
double largedxyMult_
Definition: MuonCosmicCompatibilityFiller.h:100
MuonCosmicCompatibilityFiller.h
muon::GlobalMuonPromptTight
Definition: MuonSelectors.h:25
reco::MuonCosmicCompatibility::backToBackCompatibility
float backToBackCompatibility
cosmic-likeness based on presence of a track in opp side: 0 == no matching opp tracks
Definition: MuonCosmicCompatibility.h:11
GlobalTrackingGeometryRecord
Definition: GlobalTrackingGeometryRecord.h:17
TrackingRecHitFwd.h
MuonCosmicCompatibilityFiller::offTimePosLoose_
double offTimePosLoose_
Definition: MuonCosmicCompatibilityFiller.h:108
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
edm::Handle< reco::MuonCollection >
MuonCosmicCompatibilityFiller::maxdzTight_
double maxdzTight_
Definition: MuonCosmicCompatibilityFiller.h:95
reco::Muon
Definition: Muon.h:27
edm::Ref< TrackCollection >
MuonCosmicCompatibilityFiller::maxdxyTight_
double maxdxyTight_
Definition: MuonCosmicCompatibilityFiller.h:94
MuonCosmicCompatibilityFiller::largedxy_
double largedxy_
Definition: MuonCosmicCompatibilityFiller.h:101
MuonCosmicCompatibilityFiller::deltaPt_
double deltaPt_
Definition: MuonCosmicCompatibilityFiller.h:118
DetId
Definition: DetId.h:17
TrackingRecHit.h
muon::isGoodMuon
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
Definition: MuonSelectors.cc:649
GlobalTrackingGeometry
Definition: GlobalTrackingGeometry.h:20
MuonCosmicCompatibilityFiller::sharedFrac_
double sharedFrac_
Definition: MuonCosmicCompatibilityFiller.h:121
MuonCosmicCompatibilityFiller::minvProb_
double minvProb_
Definition: MuonCosmicCompatibilityFiller.h:104
MuonCosmicCompatibilityFiller::geometryToken_
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > geometryToken_
Definition: MuonCosmicCompatibilityFiller.h:90
HLT_FULL_cff.fraction
fraction
Definition: HLT_FULL_cff.py:52861
MuonCosmicCompatibilityFiller::fillCompatibility
reco::MuonCosmicCompatibility fillCompatibility(const reco::Muon &muon, edm::Event &, const edm::EventSetup &)
fill cosmic compatibility variables
Definition: MuonCosmicCompatibilityFiller.cc:100
MuonCosmicCompatibilityFiller::pvMatches
unsigned int pvMatches(const edm::Event &, const reco::Muon &, bool) const
return cosmic-likeness based on the 2D impact parameters (dxy, dz wrt to PV). 0 == cosmic-like
Definition: MuonCosmicCompatibilityFiller.cc:381
MuonSelectors.h
MuonCosmicCompatibilityFiller::combinedCosmicID
float combinedCosmicID(const edm::Event &, const edm::EventSetup &iSetup, const reco::Muon &, bool CheckMuonID, bool checkVertex) const
combined cosmic-likeness: 0 == not cosmic-like
Definition: MuonCosmicCompatibilityFiller.cc:488
reco::MuonCollection
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
MuonCosmicCompatibilityFiller::maxdxyTightMult_
double maxdxyTightMult_
Definition: MuonCosmicCompatibilityFiller.h:98
MuonCosmicCompatibilityFiller::offTimeNegTightMult_
double offTimeNegTightMult_
Definition: MuonCosmicCompatibilityFiller.h:115
reco::MuonCosmicCompatibility::cosmicCompatibility
float cosmicCompatibility
combined cosmic-likeness: 0 == not cosmic-like
Definition: MuonCosmicCompatibility.h:7
edm::ESHandle< GlobalTrackingGeometry >
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
MuonCosmicCompatibility.h
MuonCosmicCompatibilityFiller::maxvertZ_
double maxvertZ_
Definition: MuonCosmicCompatibilityFiller.h:105
Point3DBase< float, GlobalTag >
reco::MuonCosmicCompatibility::vertexCompatibility
float vertexCompatibility
cosmic-likeness based on the event activity information: tracker track multiplicity and vertex qualit...
Definition: MuonCosmicCompatibility.h:17
MuonCosmicCompatibilityFiller::MuonCosmicCompatibilityFiller
MuonCosmicCompatibilityFiller(const edm::ParameterSet &, edm::ConsumesCollector &)
Definition: MuonCosmicCompatibilityFiller.cc:43
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonCosmicCompatibilityFiller::checkMuonID
bool checkMuonID(const reco::Muon &) const
tag a muon as cosmic based on the muonID information
Definition: MuonCosmicCompatibilityFiller.cc:618
edm::HandleBase::failedToGet
bool failedToGet() const
Definition: HandleBase.h:72
edm::ParameterSet
Definition: ParameterSet.h:47
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
MuonCosmicCompatibilityFiller::inputCosmicMuonCollection_
edm::InputTag inputCosmicMuonCollection_
Definition: MuonCosmicCompatibilityFiller.h:83
MuonCosmicCompatibilityFiller::eventActivity
unsigned int eventActivity(const edm::Event &, const reco::Muon &) const
returns cosmic-likeness based on the event activity information: tracker track multiplicity and verte...
Definition: MuonCosmicCompatibilityFiller.cc:588
MuonCosmicCompatibilityFiller::offTimePosTight_
double offTimePosTight_
Definition: MuonCosmicCompatibilityFiller.h:110
Event.h
MuonCosmicCompatibilityFiller::muonTiming
float muonTiming(const edm::Event &iEvent, const reco::Muon &muon, bool isLoose) const
check muon time (DT and CSC) information: 0 == prompt-like
Definition: MuonCosmicCompatibilityFiller.cc:127
MuonCosmicCompatibilityFiller::vertexToken_
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
Definition: MuonCosmicCompatibilityFiller.h:89
MuonCosmicCompatibilityFiller::offTimeNegTight_
double offTimeNegTight_
Definition: MuonCosmicCompatibilityFiller.h:111
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::MuonCosmicCompatibility
Definition: MuonCosmicCompatibility.h:5
reco::MuonCosmicCompatibility::overlapCompatibility
float overlapCompatibility
cosmic-likeness based on overlap with traversing cosmic muon (only muon/STA hits are used)
Definition: MuonCosmicCompatibility.h:13
MuonCosmicCompatibilityFiller::inputMuonCollections_
std::vector< edm::InputTag > inputMuonCollections_
Definition: MuonCosmicCompatibilityFiller.h:81
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
MuonCosmicCompatibilityFiller::backToBack2LegCosmic
unsigned int backToBack2LegCosmic(const edm::Event &, const reco::Muon &) const
return cosmic-likeness based on presence of a track in opp side: 0 == no matching opp tracks
Definition: MuonCosmicCompatibilityFiller.cc:211
edm::EventSetup
Definition: EventSetup.h:57
MuonCosmicCompatibilityFiller::corrTimePos_
double corrTimePos_
Definition: MuonCosmicCompatibilityFiller.h:116
MuonCosmicCompatibilityFiller::muonTokens_
std::vector< edm::EDGetTokenT< reco::MuonCollection > > muonTokens_
Definition: MuonCosmicCompatibilityFiller.h:86
MuonCosmicCompatibilityFiller::angleThreshold_
double angleThreshold_
Definition: MuonCosmicCompatibilityFiller.h:119
reco::MuonCosmicCompatibility::ipCompatibility
float ipCompatibility
cosmic-likeness based on the 2D impact parameters (dxy, dz wrt to PV). 0 == cosmic-like
Definition: MuonCosmicCompatibility.h:15
muon::TMOneStationLoose
Definition: MuonSelectors.h:30
MuonSubdetId.h
MuonCosmicCompatibilityFiller::inputVertexCollection_
edm::InputTag inputVertexCollection_
Definition: MuonCosmicCompatibilityFiller.h:84
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
std
Definition: JetResolutionObject.h:76
MuonCosmicCompatibilityFiller::sharedHits_
int sharedHits_
Definition: MuonCosmicCompatibilityFiller.h:120
MuonCosmicCompatibilityFiller::offTimePosTightMult_
double offTimePosTightMult_
Definition: MuonCosmicCompatibilityFiller.h:114
MuonCosmicCompatibilityFiller::isOverlappingMuon
bool isOverlappingMuon(const edm::Event &, const edm::EventSetup &iSetup, const reco::Muon &) const
returns cosmic-likeness based on overlap with traversing cosmic muon (only muon/STA hits are used)
Definition: MuonCosmicCompatibilityFiller.cc:256
MuonCosmicCompatibilityFiller::corrTimeNeg_
double corrTimeNeg_
Definition: MuonCosmicCompatibilityFiller.h:117
DetId.h
Frameworkfwd.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
MuonServiceProxy::trackingGeometry
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
Definition: MuonServiceProxy.h:59
GlobalTrackingGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: GlobalTrackingGeometry.cc:44
reco::Muon::numberOfMatches
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
DetLayer.h
MuonCosmicCompatibilityFiller::maxvertRho_
double maxvertRho_
Definition: MuonCosmicCompatibilityFiller.h:106
MuonCosmicCompatibilityFiller::checkMuonSegments
bool checkMuonSegments(const reco::Muon &muon) const
tag a muon as cosmic based on segment compatibility and the number of segment matches
Definition: MuonCosmicCompatibilityFiller.cc:627
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MuonCosmicCompatibilityFiller::maxdxyLooseMult_
double maxdxyLooseMult_
Definition: MuonCosmicCompatibilityFiller.h:96
MuonCosmicCompatibilityFiller::ipThreshold_
double ipThreshold_
Definition: MuonCosmicCompatibilityFiller.h:122
mps_fire.result
result
Definition: mps_fire.py:311
ParameterSet.h
MuonCosmicCompatibilityFiller::offTimePosLooseMult_
double offTimePosLooseMult_
Definition: MuonCosmicCompatibilityFiller.h:112
MuonCosmicCompatibilityFiller::maxdzLooseMult_
double maxdzLooseMult_
Definition: MuonCosmicCompatibilityFiller.h:97
MuonCosmicCompatibilityFiller::nChamberMatches_
int nChamberMatches_
Definition: MuonCosmicCompatibilityFiller.h:123
muonid::findOppositeTrack
reco::TrackRef findOppositeTrack(const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05)
Definition: MuonCosmicsId.cc:28
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
MuonCosmicsId.h
DTRecSegment4DCollection.h
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37