CMS 3D CMS Logo

HLTTauDQMPathPlotter.cc
Go to the documentation of this file.
5 
6 namespace {
7  std::string stripVersion(const std::string& pathName) {
8  size_t versionStart = pathName.rfind("_v");
9  if(versionStart == std::string::npos)
10  return pathName;
11  return pathName.substr(0, versionStart);
12  }
13 }
14 
16  bool doRefAnalysis, const std::string& dqmBaseFolder,
17  const std::string& hltProcess, int ptbins, int etabins, int phibins,
18  double ptmax, double highptmax,
19  double l1MatchDr, double hltMatchDr):
20  HLTTauDQMPlotter(stripVersion(pathName), dqmBaseFolder),
21  ptbins_(ptbins),
22  etabins_(etabins),
23  phibins_(phibins),
24  ptmax_(ptmax),
25  highptmax_(highptmax),
26  l1MatchDr_(l1MatchDr),
27  hltMatchDr_(hltMatchDr),
28  doRefAnalysis_(doRefAnalysis),
29  hltPath_(pathName, hltProcess, doRefAnalysis_, HLTCP)
30 {
32 }
33 
34 #include <algorithm>
36  if(!isValid())
37  return;
38 
39  // Book histograms
40  iBooker.setCurrentFolder(triggerTag());
41 
42  hAcceptedEvents_ = iBooker.book1D("EventsPerFilter", "Accepted Events per filter;;entries", hltPath_.filtersSize(), 0, hltPath_.filtersSize());
43  for(size_t i=0; i<hltPath_.filtersSize(); ++i) {
45  }
46 
47  // Efficiency helpers
48  if(doRefAnalysis_) {
49  iBooker.setCurrentFolder(triggerTag()+"/helpers");
50  if(hltPath_.hasL2Taus()) {
51  hL2TrigTauEtEffNum_ = iBooker.book1D("L2TrigTauEtEffNum", "L2 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_);
52  hL2TrigTauEtEffDenom_ = iBooker.book1D("L2TrigTauEtEffDenom", "L2 #tau p_{T} denominator;Ref #tau p_{T};Efficiency", ptbins_, 0, ptmax_);
53  hL2TrigTauEtaEffNum_ = iBooker.book1D("L2TrigTauEtaEffNum", "L2 #tau #eta efficiency;Ref #tau #eta;entries", etabins_, -2.5, 2.5);
54  hL2TrigTauEtaEffDenom_ = iBooker.book1D("L2TrigTauEtaEffDenom", "L2 #tau #eta denominator;Ref #tau #eta;Efficiency", etabins_, -2.5, 2.5);
55  hL2TrigTauPhiEffNum_ = iBooker.book1D("L2TrigTauPhiEffNum", "L2 #tau #phi efficiency;Ref #tau #phi;entries", phibins_, -3.2, 3.2);
56  hL2TrigTauPhiEffDenom_ = iBooker.book1D("L2TrigTauPhiEffDenom", "L2 #tau #phi denominator;Ref #tau #phi;Efficiency", phibins_, -3.2, 3.2);
57  hL2TrigTauHighEtEffNum_ = iBooker.book1D("L2TrigTauHighEtEffNum", "L2 #tau p_{T} efficiency (high p_{T});Ref #tau p_{T};entries", ptbins_, 0, highptmax_);
58  hL2TrigTauHighEtEffDenom_ = iBooker.book1D("L2TrigTauHighEtEffDenom", "L2 #tau p_{T} denominator (high p_{T});Ref #tau p_{T};Efficiency", ptbins_, 0, highptmax_);
59  }
60 
61  if(hltPath_.hasL3Taus()) {
62  hL3TrigTauEtEffNum_ = iBooker.book1D("L3TrigTauEtEffNum", "L3 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_);
63  hL3TrigTauEtEffDenom_ = iBooker.book1D("L3TrigTauEtEffDenom", "L3 #tau p_{T} denominator;Ref #tau p_{T};Efficiency", ptbins_, 0, ptmax_);
64  hL3TrigTauEtaEffNum_ = iBooker.book1D("L3TrigTauEtaEffNum", "L3 #tau #eta efficiency;Ref #tau #eta;entries", etabins_, -2.5, 2.5);
65  hL3TrigTauEtaEffDenom_ = iBooker.book1D("L3TrigTauEtaEffDenom", "L3 #tau #eta denominator;Ref #tau #eta;Efficiency", etabins_, -2.5, 2.5);
66  hL3TrigTauPhiEffNum_ = iBooker.book1D("L3TrigTauPhiEffNum", "L3 #tau #phi efficiency;Ref #tau #phi;entries", phibins_, -3.2, 3.2);
67  hL3TrigTauPhiEffDenom_ = iBooker.book1D("L3TrigTauPhiEffDenom", "L3 #tau #phi denominator;Ref #tau #phi;Efficiency", phibins_, -3.2, 3.2);
68  hL3TrigTauHighEtEffNum_ = iBooker.book1D("L3TrigTauHighEtEffNum", "L3 #tau p_{T} efficiency (high p_{T});Ref #tau p_{T};entries", ptbins_, 0, highptmax_);
69  hL3TrigTauHighEtEffDenom_ = iBooker.book1D("L3TrigTauHighEtEffDenom", "L3 #tau p_{T} denominator (high p_{T});Ref #tau p_{T};Efficiency", ptbins_, 0, highptmax_);
70  hL3TrigTauEtaPhiEffNum_ = iBooker.book2D("L3TrigTauEtaPhiEffNum", "L3 efficiency in eta-phi plane", etabins_, -2.5, 2.5, phibins_, -3.2, 3.2);
71  hL3TrigTauEtaPhiEffDenom_ = iBooker.book2D("L3TrigTauEtaPhiEffDenom", "L3 denominator in eta-phi plane", etabins_, -2.5, 2.5, phibins_, -3.2, 3.2);
72  hL3TrigTauEtaPhiEffDenom_->getTH2F()->SetOption("COL");
73  }
74 
75  if(hltPath_.hasL2Electrons()) {
76  hL2TrigElectronEtEffNum_ = iBooker.book1D("L2TrigElectronEtEffNum", "L2 electron p_{T} efficiency;Ref electron p_{T};entries", ptbins_, 0, ptmax_);
77  hL2TrigElectronEtEffDenom_ = iBooker.book1D("L2TrigElectronEtEffDenom", "L2 electron p_{T} denominator;Ref electron p_{T};Efficiency", ptbins_, 0, ptmax_);
78  hL2TrigElectronEtaEffNum_ = iBooker.book1D("L2TrigElectronEtaEffNum", "L2 electron #eta efficiency;Ref electron #eta;entries", etabins_, -2.5, 2.5);
79  hL2TrigElectronEtaEffDenom_ = iBooker.book1D("L2TrigElectronEtaEffDenom", "L2 electron #eta denominator;Ref electron #eta;Efficiency", etabins_, -2.5, 2.5);
80  hL2TrigElectronPhiEffNum_ = iBooker.book1D("L2TrigElectronPhiEffNum", "L2 electron #phi efficiency;Ref electron #phi;entries", phibins_, -3.2, 3.2);
81  hL2TrigElectronPhiEffDenom_ = iBooker.book1D("L2TrigElectronPhiEffDenom", "L2 electron #phi denominator;Ref electron #phi;Efficiency", phibins_, -3.2, 3.2);
82  }
83 
84  if(hltPath_.hasL3Electrons()) {
85  hL3TrigElectronEtEffNum_ = iBooker.book1D("L3TrigElectronEtEffNum", "L3 electron p_{T} efficiency;Ref electron p_{T};entries", ptbins_, 0, ptmax_);
86  hL3TrigElectronEtEffDenom_ = iBooker.book1D("L3TrigElectronEtEffDenom", "L3 electron p_{T} denominator;Ref electron p_{T};Efficiency", ptbins_, 0, ptmax_);
87  hL3TrigElectronEtaEffNum_ = iBooker.book1D("L3TrigElectronEtaEffNum", "L3 electron #eta efficiency;Ref electron #eta;entries", etabins_, -2.5, 2.5);
88  hL3TrigElectronEtaEffDenom_ = iBooker.book1D("L3TrigElectronEtaEffDenom", "L3 electron #eta denominator;Ref electron #eta;Efficiency", etabins_, -2.5, 2.5);
89  hL3TrigElectronPhiEffNum_ = iBooker.book1D("L3TrigElectronPhiEffNum", "L3 electron #phi efficiency;Ref electron #phi;entries", phibins_, -3.2, 3.2);
90  hL3TrigElectronPhiEffDenom_ = iBooker.book1D("L3TrigElectronPhiEffDenom", "L3 electron #phi denominator;Ref electron #phi;Efficiency", phibins_, -3.2, 3.2);
91  }
92 
93  if(hltPath_.hasL2Muons()) {
94  hL2TrigMuonEtEffNum_ = iBooker.book1D("L2TrigMuonEtEffNum", "L2 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_);
95  hL2TrigMuonEtEffDenom_ = iBooker.book1D("L2TrigMuonEtEffDenom", "L2 muon p_{T} denominator;Ref muon p_{T};Efficiency", ptbins_, 0, ptmax_);
96  hL2TrigMuonEtaEffNum_ = iBooker.book1D("L2TrigMuonEtaEffNum", "L2 muon #eta efficiency;Ref muon #eta;entries", etabins_, -2.5, 2.5);
97  hL2TrigMuonEtaEffDenom_ = iBooker.book1D("L2TrigMuonEtaEffDenom", "L2 muon #eta denominator;Ref muon #eta;Efficiency", etabins_, -2.5, 2.5);
98  hL2TrigMuonPhiEffNum_ = iBooker.book1D("L2TrigMuonPhiEffNum", "L2 muon #phi efficiency;Ref muon #phi;entries", phibins_, -3.2, 3.2);
99  hL2TrigMuonPhiEffDenom_ = iBooker.book1D("L2TrigMuonPhiEffDenom", "L2 muon #phi denominator;Ref muon #phi;Efficiency", phibins_, -3.2, 3.2);
100  }
101 
102  if(hltPath_.hasL3Muons()) {
103  hL3TrigMuonEtEffNum_ = iBooker.book1D("L3TrigMuonEtEffNum", "L3 muon p_{T} efficiency;Ref muon p_{T};entries", ptbins_, 0, ptmax_);
104  hL3TrigMuonEtEffDenom_ = iBooker.book1D("L3TrigMuonEtEffDenom", "L3 muon p_{T} denominator;Ref muon p_{T};Efficiency", ptbins_, 0, ptmax_);
105  hL3TrigMuonEtaEffNum_ = iBooker.book1D("L3TrigMuonEtaEffNum", "L3 muon #eta efficiency;Ref muon #eta;entries", etabins_, -2.5, 2.5);
106  hL3TrigMuonEtaEffDenom_ = iBooker.book1D("L3TrigMuonEtaEffDenom", "L3 muon #eta denominator;Ref muon #eta;Efficiency", etabins_, -2.5, 2.5);
107  hL3TrigMuonPhiEffNum_ = iBooker.book1D("L3TrigMuonPhiEffNum", "L3 muon #phi efficiency;Ref muon #phi;entries", phibins_, -3.2, 3.2);
108  hL3TrigMuonPhiEffDenom_ = iBooker.book1D("L3TrigMuonPhiEffDenom", "L3 muon #phi denominator;Ref muon #phi;Efficiency", phibins_, -3.2, 3.2);
109  }
110 
111  if(hltPath_.hasL2CaloMET()) {
112  hL2TrigMETEtEffNum_ = iBooker.book1D("L2TrigMETEtEffNum", "L2 MET efficiency;Ref MET;entries", ptbins_, 0, ptmax_);
113  hL2TrigMETEtEffDenom_ = iBooker.book1D("L2TrigMETEtEffDenom", "L2 MET denominator;Ref MET;Efficiency", ptbins_, 0, ptmax_);
114  }
115 
116  iBooker.setCurrentFolder(triggerTag());
117  }
118 
119  // Book di-object invariant mass histogram only for mu+tau, ele+tau, and di-tau paths
120  hMass_ = nullptr;
121  if(doRefAnalysis_) {
125 
126  int nmet = 0;
127  int lastMatchedMETFilter = -1;
128  for(size_t i = 0; i < hltPath_.filtersSize(); ++i){
129  if(hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length()) lastMatchedMETFilter = i;
130  }
131  if(lastMatchedMETFilter >= 0) nmet = hltPath_.getFilterMET(lastMatchedMETFilter);
132  auto create = [&](const std::string& name) {
133  if(name == "tau-met"){
134  this->hMass_ = iBooker.book1D("ReferenceMass", "Transverse mass of reference "+name+";Reference transverse mass;entries", 100, 0, 500);
135  }else{
136  this->hMass_ = iBooker.book1D("ReferenceMass", "Invariant mass of reference "+name+";Reference invariant mass;entries", 100, 0, 500);
137  }
138  };
139  LogDebug("HLTTauDQMOffline") << "Path " << hltPath_.getPathName() << " number of taus " << ntaus << " electrons " << neles << " muons " << nmus;
140  if(ntaus > 0) {
141  hTrigTauEt_ = iBooker.book1D("TrigTauEt", "Triggered #tau p_{T};#tau p_{T};entries", ptbins_, 0, ptmax_);
142  hTrigTauEta_ = iBooker.book1D("TrigTauEta", "Triggered #tau #eta;#tau #eta;entries", etabins_, -2.5, 2.5);
143  hTrigTauPhi_ = iBooker.book1D("TrigTauPhi", "Triggered #tau #phi;#tau #phi;entries", phibins_, -3.2, 3.2);
144  }
145  if(neles > 0) {
146  hTrigElectronEt_ = iBooker.book1D("TrigElectronEt", "Triggered electron p_{T};electron p_{T};entries", ptbins_, 0, ptmax_);
147  hTrigElectronEta_ = iBooker.book1D("TrigElectronEta", "Triggered electron #eta;electron #eta;entries", etabins_, -2.5, 2.5);
148  hTrigElectronPhi_ = iBooker.book1D("TrigElectronPhi", "Triggered electron #phi;electron #phi;entries", phibins_, -3.2, 3.2);
149  }
150  if(nmus > 0) {
151  hTrigMuonEt_ = iBooker.book1D("TrigMuonEt", "Triggered muon p_{T};muon p_{T};entries", ptbins_, 0, ptmax_);
152  hTrigMuonEta_ = iBooker.book1D("TrigMuonEta", "Triggered muon #eta;muon #eta;entries", etabins_, -2.5, 2.5);
153  hTrigMuonPhi_ = iBooker.book1D("TrigMuonPhi", "Triggered muon #phi;muon #phi;entries", phibins_, -3.2, 3.2);
154  }
155  if(nmet > 0) {
156  hTrigMETEt_ = iBooker.book1D("TrigMETEt", "Triggered MET E_{T};MET E_{T};entries", ptbins_, 0, ptmax_);
157  hTrigMETPhi_ = iBooker.book1D("TrigMETPhi", "Triggered MET #phi;MET #phi;entries", phibins_, -3.2, 3.2);
158  }
159  if(ntaus == 2 && neles == 0 && nmus == 0 && nmet == 0) create("di-tau");
160  if(ntaus == 1 && neles == 1 && nmus == 0 && nmet == 0) create("electron-tau");
161  if(ntaus == 1 && neles == 0 && nmus == 1 && nmet == 0) create("muon-tau");
162  if(ntaus == 1 && neles == 0 && nmus == 0 && nmet == 1) create("tau-met");
163  }
164 }
165 
166 
168 
170  std::vector<HLTTauDQMPath::Object> triggerObjs;
171  std::vector<HLTTauDQMPath::Object> matchedTriggerObjs;
172  HLTTauDQMOfflineObjects matchedOfflineObjs;
173 
174  // Events per filter
175  const int lastPassedFilter = hltPath_.lastPassedFilter(triggerResults);
176  int lastMatchedFilter = -1;
177  int lastMatchedMETFilter = -1;
178  int lastMatchedElectronFilter = -1;
179  int lastMatchedMuonFilter = -1;
180  int lastMatchedTauFilter = -1;
181  int firstMatchedMETFilter = -1;
182 
183  if(doRefAnalysis_) {
184  double matchDr = hltPath_.isFirstFilterL1Seed() ? l1MatchDr_ : hltMatchDr_;
185  for(int i=0; i<=lastPassedFilter; ++i) {
186  triggerObjs.clear();
187  matchedTriggerObjs.clear();
188  matchedOfflineObjs.clear();
189  hltPath_.getFilterObjects(triggerEvent, i, triggerObjs);
190  //std::cout << "Filter name " << hltPath_.getFilterName(i) << " nobjs " << triggerObjs.size() << " " << "ref size " << refCollection.taus.size() << std::endl;
191  bool matched = hltPath_.offlineMatching(i, triggerObjs, refCollection, matchDr, matchedTriggerObjs, matchedOfflineObjs);
192  //std::cout << " offline matching: " << matched << " " << matchedTriggerObjs.size() << std::endl;
193  matchDr = hltMatchDr_;
194  if(!matched)
195  break;
196 
197  hAcceptedEvents_->Fill(i+0.5);
198  lastMatchedFilter = i;
199  if(hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length()) lastMatchedMETFilter = i;
200  if(hltPath_.getFilterType(i) == "HLTMuonL3PreFilter" || hltPath_.getFilterType(i) == "HLTMuonIsoFilter") lastMatchedMuonFilter = i;
201  if(hltPath_.getFilterName(i).find("hltEle") < hltPath_.getFilterName(i).length()) lastMatchedElectronFilter = i;
202  if(hltPath_.getFilterName(i).find("hltPFTau") < hltPath_.getFilterName(i).length() ||
203  hltPath_.getFilterName(i).find("hltHpsPFTau") < hltPath_.getFilterName(i).length() ||
204  hltPath_.getFilterName(i).find("hltDoublePFTau") < hltPath_.getFilterName(i).length() ||
205  hltPath_.getFilterName(i).find("hltHpsDoublePFTau") < hltPath_.getFilterName(i).length()) lastMatchedTauFilter = i;
206  if(firstMatchedMETFilter < 0 && hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length()) firstMatchedMETFilter = i;
207  }
208  }
209  else {
210  for(int i=0; i<=lastPassedFilter; ++i) {
211  hAcceptedEvents_->Fill(i+0.5);
212  }
213  }
214 
215  // Efficiency plots
216  if(doRefAnalysis_ && lastMatchedFilter >= 0) {
217  // L2 taus
218  if(hltPath_.hasL2Taus()) {
219  // Denominators
220  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2TauIndex()) {
221  for(const LV& tau: refCollection.taus) {
222  hL2TrigTauEtEffDenom_->Fill(tau.pt());
223  hL2TrigTauHighEtEffDenom_->Fill(tau.pt());
224  hL2TrigTauEtaEffDenom_->Fill(tau.eta());
225  hL2TrigTauPhiEffDenom_->Fill(tau.phi());
226  }
227  }
228 
229  // Numerators
230  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2TauFilterIndex()) {
231  triggerObjs.clear();
232  matchedTriggerObjs.clear();
233  matchedOfflineObjs.clear();
234  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2TauFilterIndex(), triggerObjs);
235  bool matched = hltPath_.offlineMatching(hltPath_.getLastL2TauFilterIndex(), triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs);
236  if(matched) {
237  for(const LV& tau: matchedOfflineObjs.taus) {
238  hL2TrigTauEtEffNum_->Fill(tau.pt());
239  hL2TrigTauHighEtEffNum_->Fill(tau.pt());
240  hL2TrigTauEtaEffNum_->Fill(tau.eta());
241  hL2TrigTauPhiEffNum_->Fill(tau.phi());
242  }
243  }
244  }
245  }
246 
247  // L3 taus
248  if(hltPath_.hasL3Taus()) {
249  // Denominators
250  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3TauIndex()) {
251  for(const LV& tau: refCollection.taus) {
252  hL3TrigTauEtEffDenom_->Fill(tau.pt());
253  hL3TrigTauHighEtEffDenom_->Fill(tau.pt());
254  hL3TrigTauEtaEffDenom_->Fill(tau.eta());
255  hL3TrigTauPhiEffDenom_->Fill(tau.phi());
256  hL3TrigTauEtaPhiEffDenom_->Fill(tau.eta(),tau.phi());
257  }
258  }
259 
260  // Numerators
261  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3TauFilterIndex()) {
262  triggerObjs.clear();
263  matchedTriggerObjs.clear();
264  matchedOfflineObjs.clear();
265  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL3TauFilterIndex(), triggerObjs);
266  bool matched = hltPath_.offlineMatching(hltPath_.getLastL3TauFilterIndex(), triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs);
267  if(matched) {
268  for(const LV& tau: matchedOfflineObjs.taus) {
269  hL3TrigTauEtEffNum_->Fill(tau.pt());
270  hL3TrigTauHighEtEffNum_->Fill(tau.pt());
271  hL3TrigTauEtaEffNum_->Fill(tau.eta());
272  hL3TrigTauPhiEffNum_->Fill(tau.phi());
273  hL3TrigTauEtaPhiEffNum_->Fill(tau.eta(),tau.phi());
274  }
275  }
276  }
277  }
278 
279  // L2 Electrons
280  if(hltPath_.hasL2Electrons()) {
281  // Denominators
282  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2ElectronIndex()) {
283  for(const LV& electron: refCollection.electrons) {
284  hL2TrigElectronEtEffDenom_->Fill(electron.pt());
285  hL2TrigElectronEtaEffDenom_->Fill(electron.eta());
286  hL2TrigElectronPhiEffDenom_->Fill(electron.phi());
287  }
288  }
289 
290  // Numerators
291  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2ElectronFilterIndex()) {
292  triggerObjs.clear();
293  matchedTriggerObjs.clear();
294  matchedOfflineObjs.clear();
295  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2ElectronFilterIndex(), triggerObjs);
296  bool matched = hltPath_.offlineMatching(hltPath_.getLastL2ElectronFilterIndex(), triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs);
297  if(matched) {
298  for(const LV& electron: matchedOfflineObjs.electrons) {
299  hL2TrigElectronEtEffNum_->Fill(electron.pt());
300  hL2TrigElectronEtaEffNum_->Fill(electron.eta());
301  hL2TrigElectronPhiEffNum_->Fill(electron.phi());
302  }
303  }
304  }
305  }
306 
307  // L3 electron
308  if(hltPath_.hasL3Electrons()) {
309  // Denominators
310  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3ElectronIndex()) {
311  for(const LV& electron: refCollection.electrons) {
312  hL3TrigElectronEtEffDenom_->Fill(electron.pt());
313  hL3TrigElectronEtaEffDenom_->Fill(electron.eta());
314  hL3TrigElectronPhiEffDenom_->Fill(electron.phi());
315  }
316  }
317 
318  // Numerators
319  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3ElectronFilterIndex()) {
320  triggerObjs.clear();
321  matchedTriggerObjs.clear();
322  matchedOfflineObjs.clear();
323  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL3ElectronFilterIndex(), triggerObjs);
324  bool matched = hltPath_.offlineMatching(hltPath_.getLastL3ElectronFilterIndex(), triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs);
325  if(matched) {
326  for(const LV& electron: matchedOfflineObjs.electrons) {
327  hL3TrigElectronEtEffNum_->Fill(electron.pt());
328  hL3TrigElectronEtaEffNum_->Fill(electron.eta());
329  hL3TrigElectronPhiEffNum_->Fill(electron.phi());
330  }
331  }
332  }
333  }
334 
335  // L2 Muons
336  if(hltPath_.hasL2Muons()) {
337  // Denominators
338  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL2MuonIndex()) {
339  for(const LV& muon: refCollection.muons) {
340  hL2TrigMuonEtEffDenom_->Fill(muon.pt());
341  hL2TrigMuonEtaEffDenom_->Fill(muon.eta());
342  hL2TrigMuonPhiEffDenom_->Fill(muon.phi());
343  }
344  }
345 
346  // Numerators
347  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL2MuonFilterIndex()) {
348  triggerObjs.clear();
349  matchedTriggerObjs.clear();
350  matchedOfflineObjs.clear();
351  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2MuonFilterIndex(), triggerObjs);
352  bool matched = hltPath_.offlineMatching(hltPath_.getLastL2MuonFilterIndex(), triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs);
353  if(matched) {
354  for(const LV& muon: matchedOfflineObjs.muons) {
355  hL2TrigMuonEtEffNum_->Fill(muon.pt());
356  hL2TrigMuonEtaEffNum_->Fill(muon.eta());
357  hL2TrigMuonPhiEffNum_->Fill(muon.phi());
358  }
359  }
360  }
361  }
362 
363  // L3 muon
364  if(hltPath_.hasL3Muons()) {
365  // Denominators
366  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastFilterBeforeL3MuonIndex()) {
367  for(const LV& muon: refCollection.muons) {
368  hL3TrigMuonEtEffDenom_->Fill(muon.pt());
369  hL3TrigMuonEtaEffDenom_->Fill(muon.eta());
370  hL3TrigMuonPhiEffDenom_->Fill(muon.phi());
371  }
372  }
373 
374  // Numerators
375  if(static_cast<size_t>(lastMatchedFilter) >= hltPath_.getLastL3MuonFilterIndex()) {
376  triggerObjs.clear();
377  matchedTriggerObjs.clear();
378  matchedOfflineObjs.clear();
379  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL3MuonFilterIndex(), triggerObjs);
380  bool matched = hltPath_.offlineMatching(hltPath_.getLastL3MuonFilterIndex(), triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs);
381  if(matched) {
382  for(const LV& muon: matchedOfflineObjs.muons) {
383  hL3TrigMuonEtEffNum_->Fill(muon.pt());
384  hL3TrigMuonEtaEffNum_->Fill(muon.eta());
385  hL3TrigMuonPhiEffNum_->Fill(muon.phi());
386  }
387  }
388  }
389  }
390 
391  // L2 CaloMET
392  if(hltPath_.hasL2CaloMET()) {
393  // Denominators
394  if(static_cast<size_t>(firstMatchedMETFilter) >= hltPath_.getFirstFilterBeforeL2CaloMETIndex()) {
395  hL2TrigMETEtEffDenom_->Fill(refCollection.met[0].pt());
396  }
397 
398  // Numerators
399  if(static_cast<size_t>(lastMatchedMETFilter) >= hltPath_.getLastL2CaloMETFilterIndex()) {
400  triggerObjs.clear();
401  matchedTriggerObjs.clear();
402  matchedOfflineObjs.clear();
403  hltPath_.getFilterObjects(triggerEvent, hltPath_.getLastL2CaloMETFilterIndex(), triggerObjs);
404  bool matched = hltPath_.offlineMatching(hltPath_.getLastL2CaloMETFilterIndex(), triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs);
405  if(matched) {
406  hL2TrigMETEtEffNum_->Fill(matchedOfflineObjs.met[0].pt());
407  }
408  }
409  }
410  }
411 
412  if(hltPath_.fired(triggerResults)) {
413  triggerObjs.clear();
414  matchedTriggerObjs.clear();
415  matchedOfflineObjs.clear();
416 
417  if(lastMatchedMETFilter >= 0) hltPath_.getFilterObjects(triggerEvent, lastMatchedMETFilter, triggerObjs);
418  if(lastMatchedMuonFilter >= 0) hltPath_.getFilterObjects(triggerEvent, lastMatchedMuonFilter, triggerObjs);
419  if(lastMatchedElectronFilter >= 0) hltPath_.getFilterObjects(triggerEvent, lastMatchedElectronFilter, triggerObjs);
420 
421  if(lastMatchedTauFilter >= 0) hltPath_.getFilterObjects(triggerEvent, lastMatchedTauFilter, triggerObjs);
422 
423  if(doRefAnalysis_) {
424  bool matched = hltPath_.offlineMatching(lastPassedFilter, triggerObjs, refCollection, hltMatchDr_, matchedTriggerObjs, matchedOfflineObjs);
425  if(matched) {
426  // Di-object invariant mass
427  if(hMass_) {
428  const int ntaus = hltPath_.getFilterNTaus(lastPassedFilter);
429  if(ntaus == 2 && hltPath_.getFilterNElectrons(lastMatchedElectronFilter) == 0 && hltPath_.getFilterNMuons(lastMatchedMuonFilter) == 0) {
430  // Di-tau (matchedOfflineObjs are already sorted)
431  hMass_->Fill( (matchedOfflineObjs.taus[0]+matchedOfflineObjs.taus[1]).M() );
432  }
433  // Electron+tau
434  else if(ntaus == 1 && hltPath_.getFilterNElectrons(lastPassedFilter) == 1) {
435  hMass_->Fill( (matchedOfflineObjs.taus[0]+matchedOfflineObjs.electrons[0]).M() );
436  }
437  // Muon+tau
438  else if(ntaus == 1 && hltPath_.getFilterNMuons(lastPassedFilter) == 1) {
439  hMass_->Fill( (matchedOfflineObjs.taus[0]+matchedOfflineObjs.muons[0]).M() );
440  }
441  // Tau+MET
442  if(hltPath_.getFilterNTaus(lastPassedFilter) == 1 && hltPath_.getFilterMET(lastMatchedMETFilter) == 1) {
443  double taupt = matchedOfflineObjs.taus[0].Pt();
444  double tauphi = matchedOfflineObjs.taus[0].Phi();
445  double met = matchedOfflineObjs.met[0].Pt();
446  double metphi = matchedOfflineObjs.met[0].Phi();
447  double mT = sqrt( 2 * taupt * met * (1-cos(tauphi-metphi)) );
448 
449  hMass_->Fill( mT );
450  }
451  }
452  }
453 
454  // Triggered object kinematics
455  for(const HLTTauDQMPath::Object& obj: triggerObjs) {
456  if(obj.id == trigger::TriggerTau){
457  hTrigTauEt_->Fill(obj.object.pt());
458  hTrigTauEta_->Fill(obj.object.eta());
459  hTrigTauPhi_->Fill(obj.object.phi());
460  }
462  hTrigElectronEt_->Fill(obj.object.pt());
463  hTrigElectronEta_->Fill(obj.object.eta());
464  hTrigElectronPhi_->Fill(obj.object.phi());
465  }
466  if(obj.id == trigger::TriggerMuon){
467  hTrigMuonEt_->Fill(obj.object.pt());
468  hTrigMuonEta_->Fill(obj.object.eta());
469  hTrigMuonPhi_->Fill(obj.object.phi());
470  }
471  if(obj.id == trigger::TriggerMET){
472  hTrigMETEt_->Fill(obj.object.pt());
473  hTrigMETPhi_->Fill(obj.object.phi());
474  }
475  }
476  }
477  }
478 }
#define LogDebug(id)
bool isValid() const
size_t getLastL2TauFilterIndex() const
Definition: HLTTauDQMPath.h:72
MonitorElement * hL3TrigTauEtEffDenom_
MonitorElement * hTrigElectronEta_
bool hasL3Electrons() const
Definition: HLTTauDQMPath.h:67
MonitorElement * hL3TrigTauPhiEffDenom_
MonitorElement * hL2TrigTauPhiEffDenom_
MonitorElement * hL3TrigMuonPhiEffNum_
MonitorElement * hL3TrigMuonEtaEffDenom_
MonitorElement * hL2TrigTauEtEffDenom_
MonitorElement * hTrigTauEt_
std::vector< LV > electrons
The single EDProduct to be saved for each event (AOD case)
Definition: TriggerEvent.h:25
def create(alignables, pedeDump, additionalData, outputFile, config)
size_t getLastL3ElectronFilterIndex() const
Definition: HLTTauDQMPath.h:79
std::vector< LV > taus
HLTTauDQMPathPlotter(const std::string &pathName, const HLTConfigProvider &HLTCP, bool doRefAnalysis, const std::string &dqmBaseFolder, const std::string &hltProcess, int ptbins, int etabins, int phibins, double ptmax, double highptmax, double l1MatchDr, double hltMatchDr)
math::XYZTLorentzVectorD LV
size_t getLastL3MuonFilterIndex() const
Definition: HLTTauDQMPath.h:84
MonitorElement * hTrigElectronPhi_
bool isValid() const
Definition: HLTTauDQMPath.h:41
bool hasL2Muons() const
Definition: HLTTauDQMPath.h:68
MonitorElement * hL3TrigTauEtEffNum_
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
int lastPassedFilter(const edm::TriggerResults &triggerResults) const
MonitorElement * hL2TrigMuonEtaEffNum_
const std::string & triggerTag() const
MonitorElement * hL3TrigMuonEtaEffNum_
MonitorElement * hL2TrigTauEtEffNum_
MonitorElement * hAcceptedEvents_
MonitorElement * hL2TrigElectronEtEffNum_
MonitorElement * hL2TrigMuonPhiEffNum_
int getFilterNElectrons(size_t i) const
Definition: HLTTauDQMPath.h:56
int getFilterNTaus(size_t i) const
Definition: HLTTauDQMPath.h:55
bool isFirstFilterL1Seed() const
Definition: HLTTauDQMPath.h:61
MonitorElement * hL2TrigTauPhiEffNum_
void Fill(long long x)
MonitorElement * hL3TrigTauEtaPhiEffDenom_
size_t getLastFilterBeforeL3TauIndex() const
Definition: HLTTauDQMPath.h:73
MonitorElement * hL3TrigMuonEtEffNum_
MonitorElement * hL2TrigMuonEtEffDenom_
void getFilterObjects(const trigger::TriggerEvent &triggerEvent, size_t i, std::vector< Object > &retval) const
const std::string & getFilterType(size_t i) const
Definition: HLTTauDQMPath.h:54
bool hasL2CaloMET() const
Definition: HLTTauDQMPath.h:70
MonitorElement * hL3TrigTauHighEtEffNum_
MonitorElement * hL3TrigElectronEtaEffNum_
MonitorElement * hL2TrigElectronPhiEffDenom_
MonitorElement * hL3TrigTauEtaEffDenom_
int getFilterNMuons(size_t i) const
Definition: HLTTauDQMPath.h:57
MonitorElement * hL3TrigTauEtaPhiEffNum_
MonitorElement * hL2TrigMuonEtaEffDenom_
MonitorElement * hL2TrigMETEtEffDenom_
T sqrt(T t)
Definition: SSEVec.h:18
size_t getLastFilterBeforeL3ElectronIndex() const
Definition: HLTTauDQMPath.h:78
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
size_t filtersSize() const
Definition: HLTTauDQMPath.h:52
size_t getLastFilterBeforeL2MuonIndex() const
Definition: HLTTauDQMPath.h:81
MonitorElement * hL3TrigElectronEtEffDenom_
MonitorElement * hL3TrigTauPhiEffNum_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
MonitorElement * hTrigMETEt_
MonitorElement * hL3TrigTauEtaEffNum_
size_t getLastL2CaloMETFilterIndex() const
Definition: HLTTauDQMPath.h:87
void analyze(const edm::TriggerResults &triggerResults, const trigger::TriggerEvent &triggerEvent, const HLTTauDQMOfflineObjects &refCollection)
MonitorElement * hTrigMETPhi_
size_t getLastL2MuonFilterIndex() const
Definition: HLTTauDQMPath.h:82
bool hasL3Taus() const
Definition: HLTTauDQMPath.h:65
static std::string const triggerResults
Definition: EdmProvDump.cc:41
MonitorElement * hTrigMuonEt_
MonitorElement * hL2TrigMETEtEffNum_
size_t getLastFilterBeforeL3MuonIndex() const
Definition: HLTTauDQMPath.h:83
size_t getLastL3TauFilterIndex() const
Definition: HLTTauDQMPath.h:74
std::vector< LV > met
TH2F * getTH2F() const
MonitorElement * hL2TrigTauHighEtEffNum_
bool offlineMatching(size_t i, const std::vector< Object > &triggerObjects, const HLTTauDQMOfflineObjects &offlineObjects, double dR, std::vector< Object > &matchedTriggerObjects, HLTTauDQMOfflineObjects &matchedOfflineObjects) const
MonitorElement * hL3TrigElectronEtEffNum_
MonitorElement * hL3TrigElectronEtaEffDenom_
void bookHistograms(DQMStore::IBooker &iBooker)
MonitorElement * hL2TrigElectronPhiEffNum_
MonitorElement * hTrigTauPhi_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
MonitorElement * hL2TrigElectronEtaEffDenom_
bool hasL3Muons() const
Definition: HLTTauDQMPath.h:69
met
===> hadronic RAZOR
MonitorElement * hTrigElectronEt_
MonitorElement * hL3TrigMuonPhiEffDenom_
const std::string & getFilterName(size_t i) const
Definition: HLTTauDQMPath.h:53
bool fired(const edm::TriggerResults &triggerResults) const
size_t getLastL2ElectronFilterIndex() const
Definition: HLTTauDQMPath.h:77
MonitorElement * hTrigMuonEta_
size_t getLastFilterBeforeL2TauIndex() const
Definition: HLTTauDQMPath.h:71
int getFilterMET(size_t i) const
Definition: HLTTauDQMPath.h:58
size_t getLastFilterBeforeL2ElectronIndex() const
Definition: HLTTauDQMPath.h:76
const std::string & getPathName() const
Definition: HLTTauDQMPath.h:49
MonitorElement * hL2TrigTauEtaEffNum_
MonitorElement * hL2TrigTauHighEtEffDenom_
bool hasL2Taus() const
Definition: HLTTauDQMPath.h:64
size_t getFirstFilterBeforeL2CaloMETIndex() const
Definition: HLTTauDQMPath.h:88
MonitorElement * hL3TrigElectronPhiEffDenom_
bool hasL2Electrons() const
Definition: HLTTauDQMPath.h:66
MonitorElement * hTrigTauEta_
MonitorElement * hL2TrigTauEtaEffDenom_
MonitorElement * hL3TrigMuonEtEffDenom_
MonitorElement * hL2TrigElectronEtEffDenom_
MonitorElement * hL2TrigElectronEtaEffNum_
MonitorElement * hTrigMuonPhi_
MonitorElement * hL3TrigElectronPhiEffNum_
MonitorElement * hL2TrigMuonPhiEffDenom_
std::vector< LV > muons
MonitorElement * hL3TrigTauHighEtEffDenom_
MonitorElement * hL2TrigMuonEtEffNum_