CMS 3D CMS Logo

EwkMuLumiMonitorDQM.cc
Go to the documentation of this file.
2 
6 
9 
11 
14 
17 
24 
27 
29 
30 using namespace edm;
31 using namespace std;
32 using namespace reco;
33 using namespace isodeposit;
34 
36  : // Input collections
37  trigTag_(cfg.getUntrackedParameter<edm::InputTag>("TrigTag", edm::InputTag("TriggerResults::HLT"))),
38  trigToken_(consumes<edm::TriggerResults>(trigTag_)),
39  trigEvToken_(consumes<trigger::TriggerEvent>(cfg.getUntrackedParameter<edm::InputTag>("triggerEvent"))),
40  beamSpotToken_(consumes<reco::BeamSpot>(
41  cfg.getUntrackedParameter<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot")))),
42  muonToken_(consumes<edm::View<reco::Muon> >(cfg.getUntrackedParameter<edm::InputTag>("muons"))),
43  trackToken_(consumes<reco::TrackCollection>(cfg.getUntrackedParameter<edm::InputTag>("tracks"))),
44  caloTowerToken_(consumes<CaloTowerCollection>(cfg.getUntrackedParameter<edm::InputTag>("calotower"))),
45  metToken_(consumes<edm::View<reco::MET> >(cfg.getUntrackedParameter<edm::InputTag>("metTag"))),
46  metIncludesMuons_(cfg.getUntrackedParameter<bool>("METIncludesMuons")),
47  // Main cuts
48  // massMin_(cfg.getUntrackedParameter<double>("MtMin", 20.)),
49  // massMax_(cfg.getUntrackedParameter<double>("MtMax", 2000.))
50  // hltPath_(cfg.getUntrackedParameter<std::string> ("hltPath")) ,
51  // L3FilterName_(cfg.getUntrackedParameter<std::string>
52  // ("L3FilterName")),
53  ptMuCut_(cfg.getUntrackedParameter<double>("ptMuCut")),
54  etaMuCut_(cfg.getUntrackedParameter<double>("etaMuCut")),
55  isRelativeIso_(cfg.getUntrackedParameter<bool>("IsRelativeIso")),
56  isCombinedIso_(cfg.getUntrackedParameter<bool>("IsCombinedIso")),
57  isoCut03_(cfg.getUntrackedParameter<double>("IsoCut03")),
58  // deltaRTrk_(cfg.getUntrackedParameter<double>("deltaRTrk")),
59  ptThreshold_(cfg.getUntrackedParameter<double>("ptThreshold")),
60  // deltaRVetoTrk_(cfg.getUntrackedParameter<double>("deltaRVetoTrk")),
61  maxDPtRel_(cfg.getUntrackedParameter<double>("maxDPtRel")),
62  maxDeltaR_(cfg.getUntrackedParameter<double>("maxDeltaR")),
63  mtMin_(cfg.getUntrackedParameter<double>("mtMin")),
64  mtMax_(cfg.getUntrackedParameter<double>("mtMax")),
65  acopCut_(cfg.getUntrackedParameter<double>("acopCut")),
66  dxyCut_(cfg.getUntrackedParameter<double>("DxyCut")) {
67  // just to initialize
68  isValidHltConfig_ = false;
69 }
70 
71 void EwkMuLumiMonitorDQM::dqmBeginRun(const Run& r, const EventSetup& iSetup) {
72  nall = 0;
73  nEvWithHighPtMu = 0;
74  nInKinRange = 0;
75  nsel = 0;
76  niso = 0;
77  nhlt = 0;
78  n1hlt = 0;
79  n2hlt = 0;
80  nNotIso = 0;
81  nGlbSta = 0;
82  nGlbTrk = 0;
83  nTMass = 0;
84  nW = 0;
85 
86  // passed as parameter to HLTConfigProvider::init(), not yet used
87  bool isConfigChanged = false;
88 
89  // isValidHltConfig_ used to short-circuit analyze() in case of problems
90  isValidHltConfig_ = hltConfigProvider_.init(r, iSetup, trigTag_.process(), isConfigChanged);
91  // std::cout << "hlt config trigger is valid??" << isValidHltConfig_ <<
92  // std::endl;
93 }
94 
96  ibooker.setCurrentFolder("Physics/EwkMuLumiMonitorDQM");
97 
98  mass2HLT_ = ibooker.book1D("Z_2HLT_MASS", "Z mass [GeV/c^{2}]", 200, 0., 200.);
99  mass1HLT_ = ibooker.book1D("Z_1HLT_MASS", "Z mass [GeV/c^{2}]", 200, 0., 200.);
100  massNotIso_ = ibooker.book1D("Z_NOTISO_MASS", "Z mass [GeV/c^{2}]", 200, 0., 200.);
101  massGlbSta_ = ibooker.book1D("Z_GLBSTA_MASS", "Z mass [GeV/c^{2}]", 200, 0., 200.);
102  massGlbTrk_ = ibooker.book1D("Z_GLBTRK_MASS", "Z mass [GeV/c^{2}]", 200, 0., 200.);
103  massIsBothGlbTrkThanW_ = ibooker.book1D("Z_ISBOTHGLBTRKTHANW_MASS", "Z mass [GeV/c^{2}]", 200, 0., 200.);
104 
105  highMass2HLT_ = ibooker.book1D("Z_2HLT_HIGHMASS", "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
106  highMass1HLT_ = ibooker.book1D("Z_1HLT_HIGHMASS", "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
107  highMassNotIso_ = ibooker.book1D("Z_NOTISO_HIGHMASS", "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
108  highMassGlbSta_ = ibooker.book1D("Z_GLBSTA_HIGHMASS", "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
109  highMassGlbTrk_ = ibooker.book1D("Z_GLBTRK_HIGHMASS", "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
111  ibooker.book1D("Z_ISBOTHGLBTRKTHANW_HIGHMASS", "Z high mass [GeV/c^{2}]", 2000, 0., 2000.);
112 
113  TMass_ = ibooker.book1D("TMASS", "Transverse mass [GeV]", 300, 0., 300.);
114 }
115 
117  double isovar = mu.isolationR03().sumPt;
118  if (isCombinedIso_) {
119  isovar += mu.isolationR03().emEt;
120  isovar += mu.isolationR03().hadEt;
121  }
122  if (isRelativeIso_)
123  isovar /= mu.pt();
124  return isovar;
125 }
126 
130  double ptSum = 0;
131  for (size_t i = 0; i < tracks->size(); ++i) {
132  const reco::Track& elem = tracks->at(i);
133  double elemPt = elem.pt();
134  // same parameter used for muIsolation: dR [0.01, IsoCut03_], |dZ|<0.2,
135  // |d_r(xy)|<0.1
136  double elemVx = elem.vx();
137  double elemVy = elem.vy();
138  double elemD0 = sqrt(elemVx * elemVx + elemVy * elemVy);
139  if (elemD0 > 0.2)
140  continue;
141  double dz = fabs(elem.vz() - tk.vz());
142  if (dz > 0.1)
143  continue;
144  // evaluate only for tracks with pt>ptTreshold
145  if (elemPt < ptThreshold_)
146  continue;
147  double dR = deltaR(elem.eta(), elem.phi(), tk.eta(), tk.phi());
148  // isolation in a cone with dR=0.3, and vetoing the track itself
149  if ((dR < 0.01) || (dR > 0.3))
150  continue;
151  ptSum += elemPt;
152  }
153  if (isCombinedIso_) {
154  // loop on clusters....
155  for (CaloTowerCollection::const_iterator it = calotower->begin(); it != calotower->end(); ++it) {
156  double dR = deltaR(it->eta(), it->phi(), tk.outerEta(), tk.outerPhi());
157  // veto value is 0.1 for towers....
158  if ((dR < 0.1) || (dR > 0.3))
159  continue;
160  ptSum += it->emEnergy();
161  ptSum += it->hadEnergy();
162  }
163  }
164  if (isRelativeIso_)
165  ptSum /= tk.pt();
166  return ptSum;
167 }
168 
170  const std::vector<reco::Particle>& HLTMu,
171  double DR,
172  double DPtRel) {
173  size_t dim = HLTMu.size();
174  size_t nPass = 0;
175  if (dim == 0)
176  return false;
177  for (size_t k = 0; k < dim; k++) {
178  if ((deltaR(HLTMu[k], mu) < DR) && (fabs(HLTMu[k].pt() - mu.pt()) / HLTMu[k].pt() < DPtRel)) {
179  nPass++;
180  }
181  }
182  return (nPass > 0);
183 }
184 
186  nall++;
187  bool hlt_sel = false;
188  double iso1 = -1;
189  double iso2 = -1;
190  bool isMu1Iso = false;
191  bool isMu2Iso = false;
192  bool singleTrigFlag1 = false;
193  bool singleTrigFlag2 = false;
194  isZGolden1HLT_ = false;
195  isZGolden2HLT_ = false;
196  isZGoldenNoIso_ = false;
197  isZGlbSta_ = false;
198  isZGlbTrk_ = false;
199  isW_ = false;
200  // Trigger
201  bool trigger_fired = false;
202 
204  if (!ev.getByToken(trigToken_, triggerResults)) {
205  // LogWarning("") << ">>> TRIGGER collection does not exist !!!";
206  return;
207  }
208 
209  ev.getByToken(trigToken_, triggerResults);
210  /*
211  const edm::TriggerNames & trigNames = ev.triggerNames(*triggerResults);
212 
213 
214  for (size_t i=0; i<triggerResults->size(); i++) {
215  std::string trigName = trigNames.triggerName(i);
216  //std::cout << " trigName == " << trigName << std::endl;
217  if ( trigName == hltPath_ && triggerResults->accept(i)) {
218  trigger_fired = true;
219  hlt_sel=true;
220  nhlt++;
221  }
222  }
223  */
224  // see the trigger single muon which are present
225  string lowestMuonUnprescaledTrig = "";
226  bool lowestMuonUnprescaledTrigFound = false;
227  const std::vector<std::string>& triggerNames = hltConfigProvider_.triggerNames();
228  for (size_t ts = 0; ts < triggerNames.size(); ts++) {
229  string trig = triggerNames[ts];
230  size_t f = trig.find("HLT_Mu");
231  if ((f != std::string::npos)) {
232  // std::cout << "single muon trigger present: " << trig << std::endl;
233  // See if the trigger is prescaled;
235  bool prescaled = false;
236  const unsigned int prescaleSize = hltConfigProvider_.prescaleSize();
237  for (unsigned int ps = 0; ps < prescaleSize; ps++) {
238  const unsigned int prescaleValue = hltConfigProvider_.prescaleValue(ps, trig);
239  if (prescaleValue != 1)
240  prescaled = true;
241  // std::cout<< " prescaleValue[" << ps << "] =" << prescaleValue
242  //<<std::endl;
243  }
244  if (!prescaled) {
245  // looking now for the lowest hlt path not prescaled, with name of the
246  // form HLT_MuX or HLTMuX_vY
247  for (unsigned int n = 9; n < 100; n++) {
248  string lowestTrig = "HLT_Mu";
249  string lowestTrigv0 = "copy";
250  std::stringstream out;
251  out << n;
252  std::string s = out.str();
253  lowestTrig.append(s);
254  lowestTrigv0 = lowestTrig;
255  for (unsigned int v = 1; v < 10; v++) {
256  lowestTrig.append("_v");
257  std::stringstream oout;
258  oout << v;
259  std::string ss = oout.str();
260  lowestTrig.append(ss);
261  if (trig == lowestTrig)
262  lowestMuonUnprescaledTrig = trig;
263  if (trig == lowestTrig)
264  lowestMuonUnprescaledTrigFound = true;
265  if (trig == lowestTrig)
266  break;
267  }
268  if (lowestMuonUnprescaledTrigFound)
269  break;
270 
271  lowestTrig = lowestTrigv0;
272  if (trig == lowestTrig)
273  lowestMuonUnprescaledTrig = trig;
274  // if (trig==lowestTrig) {std::cout << " before break, lowestTrig
275  // lowest single muon trigger present unprescaled: " << lowestTrig <<
276  // std::endl; }
277  if (trig == lowestTrig)
278  lowestMuonUnprescaledTrigFound = true;
279  if (trig == lowestTrig)
280  break;
281  }
282  if (lowestMuonUnprescaledTrigFound)
283  break;
284  }
285  }
286  }
287  // std::cout << "after break, lowest single muon trigger present unprescaled:
288  // " << lowestMuonUnprescaledTrig << std::endl;
289  unsigned int triggerIndex; // index of trigger path
290 
291  // See if event passed trigger paths
292  std::string hltPath_ = lowestMuonUnprescaledTrig;
293 
294  triggerIndex = hltConfigProvider_.triggerIndex(hltPath_);
295  if (triggerIndex < triggerResults->size())
296  trigger_fired = triggerResults->accept(triggerIndex);
297  std::string L3FilterName_ = "";
298  if (trigger_fired) {
299  const std::vector<std::string>& moduleLabs = hltConfigProvider_.moduleLabels(hltPath_);
300  /*for (size_t k =0; k < moduleLabs.size()-1 ; k++){
301  std::cout << "moduleLabs[" << k << "] == " << moduleLabs[k] << std::endl;
302  }
303  */
304  // the l3 filter name is just the last module....
305  size_t moduleLabsSizeMinus2 = moduleLabs.size() - 2;
306  // std::cout<<"moduleLabs[" << moduleLabsSizeMinus2 << "]== "<<
307  // moduleLabs[moduleLabsSizeMinus2] << std::endl;
308 
309  L3FilterName_ = moduleLabs[moduleLabsSizeMinus2];
310  }
311 
312  edm::Handle<trigger::TriggerEvent> handleTriggerEvent;
313  LogTrace("") << ">>> Trigger bit: " << trigger_fired << " (" << hltPath_ << ")";
314  if (!ev.getByToken(trigEvToken_, handleTriggerEvent)) {
315  // LogWarning( "errorTriggerEventValid" ) << "trigger::TriggerEvent product
316  // with InputTag " << trigEv_.encode() << " not in event";
317  return;
318  }
319  ev.getByToken(trigEvToken_, handleTriggerEvent);
320  const trigger::TriggerObjectCollection& toc(handleTriggerEvent->getObjects());
321  size_t nMuHLT = 0;
322  std::vector<reco::Particle> HLTMuMatched;
323  for (size_t ia = 0; ia < handleTriggerEvent->sizeFilters(); ++ia) {
324  std::string fullname = handleTriggerEvent->filterTag(ia).encode();
325  // std::cout<< "fullname::== " << fullname<< std::endl;
327  size_t p = fullname.find_first_of(':');
328  if (p != std::string::npos) {
329  name = fullname.substr(0, p);
330  } else {
331  name = fullname;
332  }
333  if (!toc.empty()) {
334  const trigger::Keys& k = handleTriggerEvent->filterKeys(ia);
335  for (trigger::Keys::const_iterator ki = k.begin(); ki != k.end(); ++ki) {
336  // looking at all the single muon l3 trigger present, for example
337  // hltSingleMu15L3Filtered15.....
338  if (name == L3FilterName_) {
339  // trigger_fired = true;
340  hlt_sel = true;
341  nhlt++;
342  HLTMuMatched.push_back(toc[*ki].particle());
343  nMuHLT++;
344  }
345  }
346  }
347  }
348 
349  // Beam spot
350  Handle<reco::BeamSpot> beamSpotHandle;
351  if (!ev.getByToken(beamSpotToken_, beamSpotHandle)) {
352  // LogWarning("") << ">>> No beam spot found !!!";
353  return;
354  }
355 
356  // looping on muon....
358  if (!ev.getByToken(muonToken_, muons)) {
359  // LogError("") << ">>> muon collection does not exist !!!";
360  return;
361  }
362 
363  ev.getByToken(muonToken_, muons);
364  // saving only muons with pt> ptMuCut and eta<etaMuCut, and dxy<dxyCut
365  std::vector<reco::Muon> highPtGlbMuons;
366  std::vector<reco::Muon> highPtStaMuons;
367 
368  for (size_t i = 0; i < muons->size(); i++) {
369  const reco::Muon& mu = muons->at(i);
370  double pt = mu.pt();
371  double eta = mu.eta();
372  if (pt > ptMuCut_ && fabs(eta) < etaMuCut_) {
373  if (mu.isGlobalMuon()) {
374  // check the dxy....
375  double dxy = mu.innerTrack()->dxy(beamSpotHandle->position());
376  if (fabs(dxy) > dxyCut_)
377  continue;
378  highPtGlbMuons.push_back(mu);
379  }
380  if (mu.isGlobalMuon())
381  continue;
382  // if is not, look if it is a standalone....
383  if (mu.isStandAloneMuon())
384  highPtStaMuons.push_back(mu);
385  nEvWithHighPtMu++;
386  }
387  }
388  size_t nHighPtGlbMu = highPtGlbMuons.size();
389  size_t nHighPtStaMu = highPtStaMuons.size();
390  if (hlt_sel && (nHighPtGlbMu > 0)) {
391  // loop on high pt muons if there's at least two with opposite charge build
392  // a Z, more then one z candidate is foreseen.........
393  // stop the loop after 10 cicles....
394  (nHighPtGlbMu > 10) ? nHighPtGlbMu = 10 : 1;
395  // Z selection
396  if (nHighPtGlbMu > 1) {
397  for (unsigned int i = 0; i < nHighPtGlbMu; i++) {
398  reco::Muon muon1 = highPtGlbMuons[i];
399  const math::XYZTLorentzVector& mu1(muon1.p4());
400  // double pt1= muon1.pt();
401  for (unsigned int j = i + 1; j < nHighPtGlbMu; ++j) {
402  reco::Muon muon2 = highPtGlbMuons[j];
403  const math::XYZTLorentzVector& mu2(muon2.p4());
404  // double pt2= muon2.pt();
405  if (muon1.charge() == muon2.charge())
406  continue;
407  math::XYZTLorentzVector pair = mu1 + mu2;
408  double mass = pair.M();
409  // checking isolation and hlt maching
410  iso1 = muIso(muon1);
411  iso2 = muIso(muon2);
412  isMu1Iso = (iso1 < isoCut03_);
413  isMu2Iso = (iso2 < isoCut03_);
414  singleTrigFlag1 = IsMuMatchedToHLTMu(muon1, HLTMuMatched, maxDeltaR_, maxDPtRel_);
415  singleTrigFlag2 = IsMuMatchedToHLTMu(muon2, HLTMuMatched, maxDeltaR_, maxDPtRel_);
416  if (singleTrigFlag1 && singleTrigFlag2)
417  isZGolden2HLT_ = true;
418  if ((singleTrigFlag1 && !singleTrigFlag2) || (!singleTrigFlag1 && singleTrigFlag2))
419  isZGolden1HLT_ = true;
420  // Z Golden passing all criteria, with 2 or 1 muon matched to an HLT
421  // muon. Using the two cathegories as a control sample for the HLT
422  // matching efficiency
424  // a Z golden has been found, let's remove the two muons from the
425  // list, dome for avoiding resolution effect enter muons in the
426  // standalone and tracker collections.........
427  highPtGlbMuons.erase(highPtGlbMuons.begin() + i);
428  highPtGlbMuons.erase(highPtGlbMuons.begin() + j);
429  // and updating the number of high pt muons....
430  nHighPtGlbMu = highPtGlbMuons.size();
431 
432  if (isMu1Iso && isMu2Iso) {
433  niso++;
434  if (isZGolden2HLT_) {
435  n2hlt++;
436  mass2HLT_->Fill(mass);
438  /*
439  if (pt1 > pt2) {
440  highest_mupt2HLT_ -> Fill (pt1);
441  lowest_mupt2HLT_ -> Fill (pt2);
442  } else {
443  highest_mupt2HLT_ -> Fill (pt2);
444  lowest_mupt2HLT_ -> Fill (pt1);
445  }
446  */
447  }
448  if (isZGolden1HLT_) {
449  n1hlt++;
450  mass1HLT_->Fill(mass);
452  /*
453  if (pt1 >pt2) {
454  highest_mupt1HLT_ -> Fill (pt1);
455  lowest_mupt1HLT_ -> Fill (pt2);
456  } else {
457  highest_mupt1HLT_ -> Fill (pt2);
458  lowest_mupt1HLT_ -> Fill (pt1);
459  }
460  */
461  }
462  } else {
463  // ZGlbGlb when at least one of the two muon is not isolated and
464  // at least one HLT matched, used as control sample for the
465  // isolation efficiency
466  // filling events with one muon not isolated and both hlt mathced
467  if (((isMu1Iso && !isMu2Iso) || (!isMu1Iso && isMu2Iso)) && (isZGolden2HLT_ && isZGolden1HLT_)) {
468  isZGoldenNoIso_ = true;
469  nNotIso++;
472  }
473  /*
474  if (pt1 > pt2) {
475  highest_muptNotIso_ -> Fill (pt1);
476  lowest_muptNotIso_ -> Fill (pt2);
477  } else {
478  highest_muptNotIso_ -> Fill (pt2);
479  lowest_muptNotIso_ -> Fill (pt1);
480  }
481  */
482  }
483  }
484  }
485  }
486  }
487  // W->MuNu selection (if at least one muon has been selected)
488  // looking for a W if a Z is not found.... let's think if we prefer to
489  // exclude zMuMuNotIso or zMuSta....
490  if (!(isZGolden2HLT_ || isZGolden1HLT_)) {
492  if (!ev.getByToken(metToken_, metCollection)) {
493  // LogError("") << ">>> MET collection does not exist !!!";
494  return;
495  }
496  const MET& met = metCollection->at(0);
497  nW = 0;
498  for (unsigned int i = 0; i < nHighPtGlbMu; i++) {
499  reco::Muon muon1 = highPtGlbMuons[i];
500  /*
501  quality cut not implemented
502  Quality Cuts double dxy =
503 gm->dxy(beamSpotHandle->position());
504  Cut in 0.2 double trackerHits =
505 gm->hitPattern().numberOfValidTrackerHits();
506  Cut in 11 bool quality = fabs(dxy)<dxyCut_ &&
507 muon::isGoodMuon(mu,muon::GlobalMuonPromptTight) && trackerHits>=trackerHitsCut_
508 && mu.isTrackerMuon() ;
509 if (!quality) continue;
510  */
511  // isolation cut and hlt maching
512  iso1 = muIso(muon1);
513  isMu1Iso = (iso1 < isoCut03_);
514  if (!isMu1Iso)
515  continue;
516  // checking if muon is matched to any HLT muon....
517  singleTrigFlag1 = IsMuMatchedToHLTMu(muon1, HLTMuMatched, maxDeltaR_, maxDPtRel_);
518  if (!singleTrigFlag1)
519  continue;
520  // std::cout << " is GlobMu macthecd to HLT: " << singleTrigFlag1 <<
521  // std::endl;
522  // MT cuts
523  double met_px = met.px();
524  double met_py = met.py();
525 
526  if (!metIncludesMuons_) {
527  for (unsigned int i = 0; i < nHighPtGlbMu; i++) {
528  reco::Muon muon1 = highPtGlbMuons[i];
529  met_px -= muon1.px();
530  met_py -= muon1.py();
531  }
532  }
533  double met_et = met.pt(); // sqrt(met_px*met_px+met_py*met_py);
534  LogTrace("") << ">>> MET, MET_px, MET_py: " << met_et << ", " << met_px << ", " << met_py << " [GeV]";
535  double w_et = met_et + muon1.pt();
536  double w_px = met_px + muon1.px();
537  double w_py = met_py + muon1.py();
538  double massT = w_et * w_et - w_px * w_px - w_py * w_py;
539  massT = (massT > 0) ? sqrt(massT) : 0;
540  // Acoplanarity cuts
541  Geom::Phi<double> deltaphi(muon1.phi() - atan2(met_py, met_px));
542  double acop = M_PI - fabs(deltaphi.value());
543  // std::cout << " is acp of W candidate less then cut: " << (acop<
544  // acopCut_) << std::endl;
545  if (acop > acopCut_)
546  continue; // Cut in 2.0
547  TMass_->Fill(massT);
548  if (massT < mtMin_ || massT > mtMax_)
549  continue; // Cut in (50,200) GeV
550  // we give the number of W only in the tMass selected but we have a look
551  // at mass tails to check the QCD background
552  isW_ = true;
553  nW++;
554  nTMass++;
555  }
556  }
557  // if a zGlobal is not selected, look at the dimuonGlobalOneStandAlone and
558  // dimuonGlobalOneTrack...., used as a control sample for the tracking
559  // efficiency and muon system efficiency
561  for (unsigned int i = 0; i < nHighPtGlbMu; ++i) {
562  reco::Muon glbMuon = highPtGlbMuons[i];
563  const math::XYZTLorentzVector& mu1(glbMuon.p4());
564  // double pt1= glbMuon.pt();
565  // checking that the global muon is hlt matched otherwise skip the event
566  singleTrigFlag1 = IsMuMatchedToHLTMu(glbMuon, HLTMuMatched, maxDeltaR_, maxDPtRel_);
567  if (!singleTrigFlag1)
568  continue;
569  // checking that the global muon is isolated matched otherwise skip the
570  // event
571  iso1 = muIso(glbMuon);
572  isMu1Iso = (iso1 < isoCut03_);
573  if (!isMu1Iso)
574  continue;
575  // look at the standalone muon ....
576  // stop the loop after 10 cicles....
577  (nHighPtStaMu > 10) ? nHighPtStaMu = 10 : 1;
578  for (unsigned int j = 0; j < nHighPtStaMu; ++j) {
579  reco::Muon staMuon = highPtStaMuons[j];
580  const math::XYZTLorentzVector& mu2(staMuon.p4());
581  // double pt2= staMuon.pt();
582  if (glbMuon.charge() == staMuon.charge())
583  continue;
584  math::XYZTLorentzVector pair = mu1 + mu2;
585  double mass = pair.M();
586  iso2 = muIso(staMuon);
587  isMu2Iso = (iso2 < isoCut03_);
588  LogTrace("") << "\t... isolation value" << iso1 << ", isolated? " << isMu1Iso;
589  LogTrace("") << "\t... isolation value" << iso2 << ", isolated? " << isMu2Iso;
590  // requiring theat the global mu is mathed to the HLT and both are
591  // isolated
592  if (isMu2Iso) {
593  isZGlbSta_ = true;
594  nGlbSta++;
597  /*
598  if (pt1 > pt2) {
599  highest_muptGlbSta_ -> Fill (pt1);
600  lowest_muptGlbSta_ -> Fill (pt2);
601  } else {
602  highest_muptGlbSta_ -> Fill (pt2);
603  lowest_muptGlbSta_ -> Fill (pt1);
604  }
605  */
606  }
607  }
608  // look at the tracks....
610  if (!ev.getByToken(trackToken_, tracks)) {
611  // LogError("") << ">>> track collection does not exist !!!";
612  return;
613  }
614  ev.getByToken(trackToken_, tracks);
616  if (!ev.getByToken(caloTowerToken_, calotower)) {
617  // LogError("") << ">>> calotower collection does not exist !!!";
618  return;
619  }
620  ev.getByToken(caloTowerToken_, calotower);
621  // avoid to loop on more than 5000 trks
622  size_t nTrk = tracks->size();
623  (nTrk > 5000) ? nTrk = 5000 : 1;
624  for (unsigned int j = 0; j < nTrk; j++) {
625  const reco::Track& tk = tracks->at(j);
626  if (glbMuon.charge() == tk.charge())
627  continue;
628  double pt2 = tk.pt();
629  double eta = tk.eta();
630  double dxy = tk.dxy(beamSpotHandle->position());
631  if (pt2 < ptMuCut_ || fabs(eta) > etaMuCut_ || fabs(dxy) > dxyCut_)
632  continue;
633  // assuming that the track is a mu....
634  math::XYZTLorentzVector mu2(tk.px(), tk.py(), tk.pz(), sqrt((tk.p() * tk.p()) + (0.10566 * 0.10566)));
635  math::XYZTLorentzVector pair = mu1 + mu2;
636  double mass = pair.M();
637  // now requiring that the tracks is isolated.......
638  iso2 = tkIso(tk, tracks, calotower);
639  isMu2Iso = (iso2 < isoCut03_);
640  // std::cout << "found a track with rel/comb iso: " << iso2
641  //<< std::endl;
642  if (isMu2Iso) {
643  isZGlbTrk_ = true;
644  nGlbTrk++;
647  if (!isW_)
648  continue;
651  /*
652  if (pt1 > pt2) {
653  highest_muptGlbTrk_ -> Fill (pt1);
654  lowest_muptGlbTrk_ -> Fill (pt2);
655  } else {
656  highest_muptGlbTrk_ -> Fill (pt2);
657  lowest_muptGlbTrk_ -> Fill (pt1);
658  }
659  */
660  }
661  }
662  }
663  }
664  }
665  if ((hlt_sel || isZGolden2HLT_ || isZGolden1HLT_ || isZGoldenNoIso_ || isZGlbSta_ || isZGlbTrk_ || isW_)) {
666  nsel++;
667  LogTrace("") << ">>>> Event ACCEPTED";
668  } else {
669  LogTrace("") << ">>>> Event REJECTED";
670  }
671  return;
672 }
673 
674 // Local Variables:
675 // show-trailing-whitespace: t
676 // truncate-lines: t
677 // End:
EwkMuLumiMonitorDQM::isZGlbTrk_
bool isZGlbTrk_
Definition: EwkMuLumiMonitorDQM.h:128
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
EwkMuLumiMonitorDQM::muIso
double muIso(const reco::Muon &)
Definition: EwkMuLumiMonitorDQM.cc:116
HLTConfigProvider::prescaleSize
unsigned int prescaleSize() const
Definition: HLTConfigProvider.h:184
Handle.h
trigger::TriggerEvent::sizeFilters
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:146
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
EwkMuLumiMonitorDQM::maxDeltaR_
double maxDeltaR_
Definition: EwkMuLumiMonitorDQM.h:74
electrons_cff.bool
bool
Definition: electrons_cff.py:372
mps_fire.i
i
Definition: mps_fire.py:355
HLT_2018_cff.pt2
pt2
Definition: HLT_2018_cff.py:8552
edm::SortedCollection< CaloTower >::const_iterator
std::vector< CaloTower >::const_iterator const_iterator
Definition: SortedCollection.h:80
EwkMuLumiMonitorDQM::nhlt
unsigned int nhlt
Definition: EwkMuLumiMonitorDQM.h:115
EwkMuLumiMonitorDQM::ptMuCut_
double ptMuCut_
Definition: EwkMuLumiMonitorDQM.h:63
IsoDepositVetos.h
trigger::TriggerEvent::filterKeys
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:118
MessageLogger.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
EwkMuLumiMonitorDQM::nTMass
unsigned int nTMass
Definition: EwkMuLumiMonitorDQM.h:121
TriggerResults.h
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
EwkMuLumiMonitorDQM::niso
unsigned int niso
Definition: EwkMuLumiMonitorDQM.h:114
susyDQM_cfi.metCollection
metCollection
Definition: susyDQM_cfi.py:11
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
reco::TrackBase::p
double p() const
momentum vector magnitude
Definition: TrackBase.h:605
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
edm::Run
Definition: Run.h:45
EwkMuLumiMonitorDQM::muonToken_
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
Definition: EwkMuLumiMonitorDQM.h:54
TriggerEvent.h
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
EwkMuLumiMonitorDQM::isZGolden1HLT_
bool isZGolden1HLT_
Definition: EwkMuLumiMonitorDQM.h:124
EwkMuLumiMonitorDQM::isRelativeIso_
bool isRelativeIso_
Definition: EwkMuLumiMonitorDQM.h:66
triggerResults
static const std::string triggerResults
Definition: EdmProvDump.cc:45
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
reco::TrackBase::vx
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:626
EwkMuLumiMonitorDQM::ptThreshold_
double ptThreshold_
Definition: EwkMuLumiMonitorDQM.h:71
edm::SortedCollection< CaloTower >
edm::InputTag::process
std::string const & process() const
Definition: InputTag.h:40
DQMStore.h
EwkMuLumiMonitorDQM::mtMax_
double mtMax_
Definition: EwkMuLumiMonitorDQM.h:76
reco::TrackBase::px
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:611
ewkMuLumiMonitorDQM_cfi.calotower
calotower
Definition: ewkMuLumiMonitorDQM_cfi.py:36
EwkMuLumiMonitorDQM::n2hlt
unsigned int n2hlt
Definition: EwkMuLumiMonitorDQM.h:117
EwkMuLumiMonitorDQM::nNotIso
unsigned int nNotIso
Definition: EwkMuLumiMonitorDQM.h:118
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::Handle
Definition: AssociativeIterator.h:50
EwkMuLumiMonitorDQM::acopCut_
double acopCut_
Definition: EwkMuLumiMonitorDQM.h:77
IsoDepositDirection.h
EwkMuLumiMonitorDQM::massGlbTrk_
MonitorElement * massGlbTrk_
Definition: EwkMuLumiMonitorDQM.h:100
Muon
Definition: Muon.py:1
reco::Muon
Definition: Muon.h:27
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
EwkMuLumiMonitorDQM.h
nJettinessAdder_cfi.nPass
nPass
Definition: nJettinessAdder_cfi.py:14
deltaR.h
reco::TrackBase::pt
double pt() const
track transverse momentum
Definition: TrackBase.h:608
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
HLTConfigProvider::moduleLabels
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
Definition: HLTConfigProvider.h:75
reco::MET
Definition: MET.h:41
alignCSCRings.s
s
Definition: alignCSCRings.py:92
EwkMuLumiMonitorDQM::nW
unsigned int nW
Definition: EwkMuLumiMonitorDQM.h:122
EwkMuLumiMonitorDQM::highMassGlbTrk_
MonitorElement * highMassGlbTrk_
Definition: EwkMuLumiMonitorDQM.h:101
trigger::TriggerEvent::filterTag
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:108
EwkMuLumiMonitorDQM::highMassGlbSta_
MonitorElement * highMassGlbSta_
Definition: EwkMuLumiMonitorDQM.h:96
EwkMuLumiMonitorDQM::EwkMuLumiMonitorDQM
EwkMuLumiMonitorDQM(const edm::ParameterSet &)
Definition: EwkMuLumiMonitorDQM.cc:35
EwkMuLumiMonitorDQM::highMassNotIso_
MonitorElement * highMassNotIso_
Definition: EwkMuLumiMonitorDQM.h:91
BeamSpot.h
reco::TrackBase::py
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:614
reco::TrackBase::vz
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:632
reco::LeafCandidate::py
double py() const final
y coordinate of momentum vector
Definition: LeafCandidate.h:142
L1TEGammaOffline_cfi.triggerNames
triggerNames
Definition: L1TEGammaOffline_cfi.py:40
Service.h
PVValHelper::eta
Definition: PVValidationHelpers.h:69
EwkMuLumiMonitorDQM::massGlbSta_
MonitorElement * massGlbSta_
Definition: EwkMuLumiMonitorDQM.h:95
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
reco::BeamSpot
Definition: BeamSpot.h:21
EwkMuLumiMonitorDQM::isCombinedIso_
bool isCombinedIso_
Definition: EwkMuLumiMonitorDQM.h:67
reco::Track
Definition: Track.h:27
EwkMuLumiMonitorDQM::trigToken_
edm::EDGetTokenT< edm::TriggerResults > trigToken_
Definition: EwkMuLumiMonitorDQM.h:51
EwkMuLumiMonitorDQM::etaMuCut_
double etaMuCut_
Definition: EwkMuLumiMonitorDQM.h:64
EwkMuLumiMonitorDQM::nGlbSta
unsigned int nGlbSta
Definition: EwkMuLumiMonitorDQM.h:119
reco::TrackBase::charge
int charge() const
track electric charge
Definition: TrackBase.h:581
reco::Track::outerEta
double outerEta() const
pseudorapidity of the momentum vector at the outermost hit position
Definition: Track.h:127
EwkMuLumiMonitorDQM::nall
unsigned int nall
Definition: EwkMuLumiMonitorDQM.h:110
dqmdumpme.k
k
Definition: dqmdumpme.py:60
reco::BeamSpot::position
const Point & position() const
position
Definition: BeamSpot.h:59
EwkMuLumiMonitorDQM::nGlbTrk
unsigned int nGlbTrk
Definition: EwkMuLumiMonitorDQM.h:120
reco::TrackBase::phi
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:620
EwkMuLumiMonitorDQM::trackToken_
edm::EDGetTokenT< reco::TrackCollection > trackToken_
Definition: EwkMuLumiMonitorDQM.h:55
EwkMuLumiMonitorDQM::highMass1HLT_
MonitorElement * highMass1HLT_
Definition: EwkMuLumiMonitorDQM.h:86
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TFileService.h
edm::View
Definition: CaloClusterFwd.h:14
edm::ParameterSet
Definition: ParameterSet.h:36
EwkMuLumiMonitorDQM::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: EwkMuLumiMonitorDQM.cc:185
Event.h
EwkMuLumiMonitorDQM::isoCut03_
double isoCut03_
Definition: EwkMuLumiMonitorDQM.h:68
EwkMuLumiMonitorDQM::IsMuMatchedToHLTMu
bool IsMuMatchedToHLTMu(const reco::Muon &, const std::vector< reco::Particle > &, double, double)
Definition: EwkMuLumiMonitorDQM.cc:169
EwkMuLumiMonitorDQM::caloTowerToken_
edm::EDGetTokenT< CaloTowerCollection > caloTowerToken_
Definition: EwkMuLumiMonitorDQM.h:56
HLTConfigProvider::prescaleValue
unsigned int prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
Definition: HLTConfigProvider.h:186
EwkMuLumiMonitorDQM::trigEvToken_
edm::EDGetTokenT< trigger::TriggerEvent > trigEvToken_
Definition: EwkMuLumiMonitorDQM.h:52
trigger::TriggerObjectCollection
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
EwkMuLumiMonitorDQM::dqmBeginRun
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: EwkMuLumiMonitorDQM.cc:71
reco::TrackBase::eta
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:623
LorentzVector.h
TriggerNames.h
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
trigger::Keys
std::vector< size_type > Keys
Definition: TriggerTypeDefs.h:19
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
Geom::Phi
Definition: Phi.h:52
EwkMuLumiMonitorDQM::metIncludesMuons_
bool metIncludesMuons_
Definition: EwkMuLumiMonitorDQM.h:58
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
reco::LeafCandidate::charge
int charge() const final
electric charge
Definition: LeafCandidate.h:106
edm::EventSetup
Definition: EventSetup.h:57
EwkMuLumiMonitorDQM::isZGlbSta_
bool isZGlbSta_
Definition: EwkMuLumiMonitorDQM.h:127
EwkMuLumiMonitorDQM::trigTag_
edm::InputTag trigTag_
Definition: EwkMuLumiMonitorDQM.h:50
EwkMuLumiMonitorDQM::massIsBothGlbTrkThanW_
MonitorElement * massIsBothGlbTrkThanW_
Definition: EwkMuLumiMonitorDQM.h:107
ClusterTask_cfi.trig
trig
Definition: ClusterTask_cfi.py:336
trigger::TriggerEvent::getObjects
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:101
EwkMuLumiMonitorDQM::mass2HLT_
MonitorElement * mass2HLT_
Definition: EwkMuLumiMonitorDQM.h:80
TriggerObject.h
EwkMuLumiMonitorDQM::tkIso
double tkIso(const reco::Track &, edm::Handle< reco::TrackCollection >, edm::Handle< CaloTowerCollection >)
Definition: EwkMuLumiMonitorDQM.cc:127
HLTConfigProvider::triggerIndex
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
Definition: HLTConfigProvider.h:72
EwkMuLumiMonitorDQM::highMass2HLT_
MonitorElement * highMass2HLT_
Definition: EwkMuLumiMonitorDQM.h:81
looper.cfg
cfg
Definition: looper.py:297
alignCSCRings.r
r
Definition: alignCSCRings.py:93
EwkMuLumiMonitorDQM::isW_
bool isW_
Definition: EwkMuLumiMonitorDQM.h:129
MET.h
EwkMuLumiMonitorDQM::metToken_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
Definition: EwkMuLumiMonitorDQM.h:57
std
Definition: JetResolutionObject.h:76
reco::Track::outerPhi
double outerPhi() const
azimuthal angle of the momentum vector at the outermost hit position
Definition: Track.h:124
reco::TrackBase::vy
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:629
HLTConfigProvider::init
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
Definition: HLTConfigProvider.cc:36
PVValHelper::dxy
Definition: PVValidationHelpers.h:47
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
PVValHelper::dz
Definition: PVValidationHelpers.h:50
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
EwkMuLumiMonitorDQM::nsel
unsigned int nsel
Definition: EwkMuLumiMonitorDQM.h:113
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
EwkMuLumiMonitorDQM::maxDPtRel_
double maxDPtRel_
Definition: EwkMuLumiMonitorDQM.h:73
EwkMuLumiMonitorDQM::isValidHltConfig_
bool isValidHltConfig_
Definition: EwkMuLumiMonitorDQM.h:131
EwkMuLumiMonitorDQM::nEvWithHighPtMu
unsigned int nEvWithHighPtMu
Definition: EwkMuLumiMonitorDQM.h:111
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EwkMuLumiMonitorDQM::beamSpotToken_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: EwkMuLumiMonitorDQM.h:53
EwkMuLumiMonitorDQM::hltConfigProvider_
HLTConfigProvider hltConfigProvider_
Definition: EwkMuLumiMonitorDQM.h:132
dqm::implementation::IBooker
Definition: DQMStore.h:43
EwkMuLumiMonitorDQM::isZGoldenNoIso_
bool isZGoldenNoIso_
Definition: EwkMuLumiMonitorDQM.h:126
trigger
Definition: HLTPrescaleTableCond.h:8
EwkMuLumiMonitorDQM::n1hlt
unsigned int n1hlt
Definition: EwkMuLumiMonitorDQM.h:116
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
reco::TrackBase::pz
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:617
EwkMuLumiMonitorDQM::highMassIsBothGlbTrkThanW_
MonitorElement * highMassIsBothGlbTrkThanW_
Definition: EwkMuLumiMonitorDQM.h:108
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
EwkMuLumiMonitorDQM::mass1HLT_
MonitorElement * mass1HLT_
Definition: EwkMuLumiMonitorDQM.h:85
View.h
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
ParameterSet.h
EwkMuLumiMonitorDQM::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: EwkMuLumiMonitorDQM.cc:95
HLTConfigProvider::triggerNames
const std::vector< std::string > & triggerNames() const
names of trigger paths
Definition: HLTConfigProvider.h:68
EwkMuLumiMonitorDQM::TMass_
MonitorElement * TMass_
Definition: EwkMuLumiMonitorDQM.h:105
EwkMuLumiMonitorDQM::nInKinRange
unsigned int nInKinRange
Definition: EwkMuLumiMonitorDQM.h:112
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
EwkMuLumiMonitorDQM::dxyCut_
double dxyCut_
Definition: EwkMuLumiMonitorDQM.h:78
EwkMuLumiMonitorDQM::massNotIso_
MonitorElement * massNotIso_
Definition: EwkMuLumiMonitorDQM.h:90
reco::TrackBase::dxy
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:593
reco::LeafCandidate::px
double px() const final
x coordinate of momentum vector
Definition: LeafCandidate.h:140
EwkMuLumiMonitorDQM::isZGolden2HLT_
bool isZGolden2HLT_
Definition: EwkMuLumiMonitorDQM.h:125
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::TriggerResults
Definition: TriggerResults.h:35
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
ZCounting_cff.TriggerEvent
TriggerEvent
Definition: ZCounting_cff.py:5
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443