CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EmDQMFeeder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EmDQMFeeder
4 // Class: EmDQMFeeder
5 //
6 //
7 // Original Author: Thomas Reis,40 4-B24,+41227671567,
8 // Created: Tue Mar 15 12:24:11 CET 2011
9 // $Id: EmDQMFeeder.cc,v 1.23 2012/03/17 20:43:14 treis Exp $
10 //
11 //
12 
13 // class header file
15 
17 // constructors and destructor
20  iConfig(iConfig_)
21 {
22  //now do what ever initialization is needed
23  //processName_ = iConfig_.getParameter<std::string>("processname");
24  triggerObject_ = iConfig_.getParameter<edm::InputTag>("triggerobject");
25  verbosity_ = iConfig_.getUntrackedParameter<unsigned int>("verbosity",0);
26 }
27 
28 
30 {
31 
32  // do anything here that needs to be done at desctruction time
33  // (e.g. close files, deallocate resources etc.)
34 
35 }
36 
37 
39 // member functions
41 
42 // ------------ method called for each event ------------
43 void
45 {
46  using namespace edm;
47 
48  for (unsigned i = 0; i < emDQMmodules.size(); ++i) {
49  emDQMmodules[i]->analyze(iEvent, iSetup);
50  }
51 
52 // #ifdef THIS_IS_AN_EVENT_EXAMPLE
53 // Handle<ExampleData> pIn;
54 // iEvent.getByLabel("example",pIn);
55 // #endif
56 //
57 // #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
58 // ESHandle<SetupData> pSetup;
59 // iSetup.get<SetupRecord>().get(pSetup);
60 // #endif
61 }
62 
63 
64 // ------------ method called once each job just before starting event loop ------------
65 void
67 {
68 // for (unsigned i = 0; i < emDQMmodules.size(); ++i)
69 // emDQMmodules[i]->beginJob();
70 }
71 
72 // ------------ method called once each job just after ending the event loop ------------
73 void
75 {
76  for (unsigned i = 0; i < emDQMmodules.size(); ++i)
77  emDQMmodules[i]->endJob();
78 }
79 
80 // ------------ method called when starting to processes a run ------------
81 void
82 EmDQMFeeder::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup)
83 {
84  bool changed(true);
85  //if (hltConfig_.init(iRun, iSetup, processName_, changed)) {
86  if (hltConfig_.init(iRun, iSetup, triggerObject_.process(), changed)) {
87 
88  // if init returns TRUE, initialisation has succeeded!
89 
90  if (verbosity_ >= OUTPUT_ALL) {
91  // Output general information on the menu
92  edm::LogPrint("EmDQMFeeder") << "inited=" << hltConfig_.inited();
93  edm::LogPrint("EmDQMFeeder") << "changed=" << hltConfig_.changed();
94  edm::LogPrint("EmDQMFeeder") << "processName=" << hltConfig_.processName();
95  edm::LogPrint("EmDQMFeeder") << "tableName=" << hltConfig_.tableName();
96  edm::LogPrint("EmDQMFeeder") << "size=" << hltConfig_.size();
97  }
98 
99  // All electron and photon paths
100  std::vector<std::vector<std::string> > egammaPaths = findEgammaPaths();
101  //std::cout << "Found " << egammaPaths[TYPE_SINGLE_ELE].size() << " single electron paths" << std::endl;
102  //std::cout << "Found " << egammaPaths[TYPE_DOUBLE_ELE].size() << " double electron paths" << std::endl;
103  //std::cout << "Found " << egammaPaths[TYPE_TRIPLE_ELE].size() << " triple electron paths" << std::endl;
104  //std::cout << "Found " << egammaPaths[TYPE_SINGLE_PHOTON].size() << " single photon paths" << std::endl;
105  //std::cout << "Found " << egammaPaths[TYPE_DOUBLE_PHOTON].size() << " double photon paths" << std::endl;
106 
107  std::vector<std::string> filterModules;
108 
109  for (unsigned int j=0; j < egammaPaths.size() ; j++) {
110 
111  for (unsigned int i=0; i < egammaPaths.at(j).size() ; i++) {
112  // get pathname of this trigger
113  const std::string pathName = egammaPaths.at(j).at(i);
114  if (verbosity_ >= OUTPUT_ALL)
115  edm::LogPrint("EmDQMFeeder") << "Path: " << pathName;
116 
117  // get filters of the current path
118  filterModules = getFilterModules(pathName);
119 
120  //--------------------
121  edm::ParameterSet paramSet;
122 
123  paramSet.addUntrackedParameter("pathIndex", hltConfig_.triggerIndex(pathName));
124  paramSet.addParameter("@module_label", hltConfig_.removeVersion(pathName) + "_DQM");
125  //paramSet.addParameter("@module_label", pathName + "_DQM");
126  //paramSet.addParameter("triggerobject", iConfig.getParameter<edm::InputTag>("triggerobject"));
127  paramSet.addParameter("triggerobject", triggerObject_);
128  paramSet.addParameter("genEtaAcc", iConfig.getParameter<double>("genEtaAcc"));
129  paramSet.addParameter("genEtAcc", iConfig.getParameter<double>("genEtAcc"));
130 
131  // plotting parameters (untracked because they don't affect the physics)
132  double genEtMin = getPrimaryEtCut(pathName);
133  if (genEtMin >= 0) {
134  paramSet.addUntrackedParameter("genEtMin", genEtMin);
135  } else {
137  edm::LogWarning("EmDQMFeeder") << "Pathname: '" << pathName << "': Unable to determine a minimum Et. Will not include this path in the validation.";
138  continue;
139  }
140 
141  // set the x axis of the et plots to some reasonable value based
142  // on the primary et cut determined from the path name
143  double ptMax = iConfig.getUntrackedParameter<double>("PtMax",1000.);
144  double ptMin = iConfig.getUntrackedParameter<double>("PtMin",0.);
145  if (ptMax < (1.2*genEtMin)) {
146  paramSet.addUntrackedParameter<double>("PtMax", (10*ceil(0.12 * genEtMin)));
147  paramSet.addUntrackedParameter<double>("PtMin", (10*ceil(0.12 * genEtMin) - ptMax + ptMin));
148  }
149  else {
150  paramSet.addUntrackedParameter<double>("PtMax", ptMax);
151  paramSet.addUntrackedParameter<double>("PtMin", ptMin);
152  }
153 
154  paramSet.addUntrackedParameter("EtaMax", iConfig.getUntrackedParameter<double>("EtaMax", 2.7));
155  paramSet.addUntrackedParameter("PhiMax", iConfig.getUntrackedParameter<double>("PhiMax", 3.15));
156  paramSet.addUntrackedParameter("Nbins", iConfig.getUntrackedParameter<unsigned int>("Nbins",40));
157  paramSet.addUntrackedParameter("minEtForEtaEffPlot", iConfig.getUntrackedParameter<unsigned int>("minEtForEtaEffPlot", 15));
158  paramSet.addUntrackedParameter("useHumanReadableHistTitles", iConfig.getUntrackedParameter<bool>("useHumanReadableHistTitles", false));
159  paramSet.addUntrackedParameter("mcMatchedOnly", iConfig.getUntrackedParameter<bool>("mcMatchedOnly", true));
160  paramSet.addUntrackedParameter("noPhiPlots", iConfig.getUntrackedParameter<bool>("noPhiPlots", true));
161  paramSet.addUntrackedParameter("noIsolationPlots", iConfig.getUntrackedParameter<bool>("noIsolationPlots", true));
162 
163  // verbosity of output messages when running
164  paramSet.addUntrackedParameter<unsigned int>("verbosity", verbosity_);
165 
166  //preselction cuts
167  switch (j) {
168  case TYPE_SINGLE_ELE:
169  paramSet.addParameter<unsigned>("reqNum", 1);
170  paramSet.addParameter<int>("pdgGen", 11);
171  paramSet.addParameter<edm::InputTag>("cutcollection", edm::InputTag("fiducialWenu"));
172  paramSet.addParameter<int>("cutnum", 1);
173  break;
174  case TYPE_DOUBLE_ELE:
175  paramSet.addParameter<unsigned>("reqNum", 2);
176  paramSet.addParameter<int>("pdgGen", 11);
177  paramSet.addParameter<edm::InputTag>("cutcollection", edm::InputTag("fiducialZee"));
178  paramSet.addParameter<int>("cutnum", 2);
179  break;
180  case TYPE_TRIPLE_ELE:
181  paramSet.addParameter<unsigned>("reqNum", 3);
182  paramSet.addParameter<int>("pdgGen", 11);
183  paramSet.addParameter<edm::InputTag>("cutcollection", edm::InputTag("fiducialZee"));
184  paramSet.addParameter<int>("cutnum", 3);
185  break;
186  case TYPE_SINGLE_PHOTON:
187  paramSet.addParameter<unsigned>("reqNum", 1);
188  paramSet.addParameter<int>("pdgGen", 22);
189  paramSet.addParameter<edm::InputTag>("cutcollection", edm::InputTag("fiducialGammaJet"));
190  paramSet.addParameter<int>("cutnum", 1);
191  break;
192  case TYPE_DOUBLE_PHOTON:
193  paramSet.addParameter<unsigned>("reqNum", 2);
194  paramSet.addParameter<int>("pdgGen", 22);
195  paramSet.addParameter<edm::InputTag>("cutcollection", edm::InputTag("fiducialDiGamma"));
196  paramSet.addParameter<int>("cutnum", 2);
197  }
198  //--------------------
199 
200  // TODO: extend this
201  if (iConfig.getParameter<bool>("isData")) paramSet.addParameter<edm::InputTag>("cutcollection", edm::InputTag("gsfElectrons"));
202 
203  std::vector<edm::ParameterSet> filterVPSet;
204  edm::ParameterSet filterPSet;
205  std::string moduleLabel;
206 
207  // loop over filtermodules of current trigger path
208  for (std::vector<std::string>::iterator filter = filterModules.begin(); filter != filterModules.end(); ++filter) {
209  std::string moduleType = hltConfig_.modulePSet(*filter).getParameter<std::string>("@module_type");
210  moduleLabel = hltConfig_.modulePSet(*filter).getParameter<std::string>("@module_label");
211 
212  // first check if it is a filter we are not interrested in
213  if (moduleType == "Pythia6GeneratorFilter" ||
214  moduleType == "HLTTriggerTypeFilter" ||
215  moduleType == "HLTLevel1Activity" ||
216  moduleType == "HLTPrescaler" ||
217  moduleType == "HLTBool")
218  continue;
219 
220  // now check for the known filter types
221  if (moduleType == "HLTLevel1GTSeed") {
222  filterPSet = makePSetForL1SeedFilter(moduleLabel);
223  }
224  else if (moduleType == "HLTEgammaL1MatchFilterRegional") {
225  filterPSet = makePSetForL1SeedToSuperClusterMatchFilter(moduleLabel);
226  }
227  else if (moduleType == "HLTEgammaEtFilter") {
228  filterPSet = makePSetForEtFilter(moduleLabel);
229  }
230  else if (moduleType == "HLTElectronOneOEMinusOneOPFilterRegional") {
231  filterPSet = makePSetForOneOEMinusOneOPFilter(moduleLabel);
232  }
233  else if (moduleType == "HLTElectronPixelMatchFilter") {
234  filterPSet = makePSetForPixelMatchFilter(moduleLabel);
235  }
236  else if (moduleType == "HLTEgammaGenericFilter") {
237  filterPSet = makePSetForEgammaGenericFilter(moduleLabel);
238  }
239  else if (moduleType == "HLTEgammaGenericQuadraticFilter") {
240  filterPSet = makePSetForEgammaGenericQuadraticFilter(moduleLabel);
241  }
242  else if (moduleType == "HLTElectronGenericFilter") {
243  filterPSet = makePSetForElectronGenericFilter(moduleLabel);
244  }
245  else if (moduleType == "HLTEgammaDoubleEtDeltaPhiFilter") {
246  filterPSet = makePSetForEgammaDoubleEtDeltaPhiFilter(moduleLabel);
247  }
248  else if (moduleType == "HLTGlobalSumsMET"
249  || moduleType == "HLTMhtHtFilter"
250  || moduleType == "HLTJetTag"
251  || moduleType == "HLT1CaloJet"
252  || moduleType == "HLT1CaloBJet"
253  || moduleType == "HLT1Tau"
254  || moduleType == "PFTauSelector"
255  || moduleType == "EtMinCaloJetSelector"
256  || moduleType == "LargestEtCaloJetSelector"
257  || moduleType == "HLTEgammaTriggerFilterObjectWrapper" // 'fake' filter
258  || moduleType == "HLTEgammaDoubleLegCombFilter" // filter does not put anything in TriggerEventWithRefs
259  //|| moduleType == "HLT2ElectronTau"
260  || moduleType == "HLTPMMassFilter"
261  || moduleType == "HLTHcalTowerFilter"
262  //|| moduleType == "HLT1Photon"
263  )
264  continue;
265  else {
267  edm::LogWarning("EmDQMFeeder") << "No parameter set for filter '" << moduleLabel << "' with filter type '" << moduleType << "' added. Module will not be analyzed.";
268  continue;
269  }
270 
271  // something went wrong when the parameter set is empty.
272  if (!filterPSet.empty()) {
273  if (!hltConfig_.modulePSet(moduleLabel).exists("saveTags")) {
274  // make sure that 'theHLTOutputTypes' before an unseeded filter in a photon path is set to trigger::TriggerPhoton
275  // this is coupled to the parameter 'saveTag = true'
276  if (moduleLabel.find("Unseeded") != std::string::npos && (j == TYPE_DOUBLE_PHOTON || j == TYPE_SINGLE_PHOTON)) {
277  filterVPSet.back().addParameter<int>("theHLTOutputTypes", trigger::TriggerPhoton);
278  }
279  }
280  // if ncandcut is -1 (when parsing for the number of particles in the name of the L1seed filter fails),
281  // fall back to setting ncandcut to the number of particles needed for the given path.
282  if (filterPSet.getParameter<int>("ncandcut") < 0) filterPSet.addParameter<int>("ncandcut", paramSet.getParameter<int>("cutnum"));
283  else if (filterPSet.getParameter<int>("ncandcut") > paramSet.getParameter<int>("cutnum")) {
284  paramSet.addParameter<int>("cutnum", filterPSet.getParameter<int>("ncandcut"));
285  paramSet.addParameter<unsigned>("reqNum", (unsigned)filterPSet.getParameter<int>("ncandcut"));
286  }
287 
288  filterVPSet.push_back(filterPSet);
289  }
290  else
291  break;
292 
293  } // end loop over filter modules of current trigger path
294 
295  // do not include this path when an empty filterPSet is detected.
296  if (!filterPSet.empty()) {
297  std::string lastModuleName = filterPSet.getParameter<edm::InputTag>("HLTCollectionLabels").label();
298  if (!hltConfig_.modulePSet(lastModuleName).exists("saveTags")) {
299  // make sure that 'theHLTOutputTypes' of the last filter of a photon path is set to trigger::TriggerPhoton
300  // this is coupled to the parameter 'saveTag = true'
301  if ((j == TYPE_SINGLE_PHOTON || j == TYPE_DOUBLE_PHOTON) && pathName.rfind("Ele") == std::string::npos) {
302  filterVPSet.back().addParameter<int>("theHLTOutputTypes", trigger::TriggerPhoton);
303  }
304  }
305  paramSet.addParameter<std::vector<edm::ParameterSet> >("filters", filterVPSet);
306  }
307  else {
308  if (verbosity_ >= OUTPUT_ALL)
309  edm::LogPrint("EmDQMFeeder") << "Will not include this path in the validation due to errors while generating the parameter set.";
310  continue;
311  }
312 
313  // dump generated parameter set
314  //std::cout << paramSet.dump() << std::endl;
315 
316  emDQMmodules.push_back(new EmDQM(paramSet));
317 
318  emDQMmodules.back()->beginJob();
319  emDQMmodules.back()->beginRun(iRun, iSetup);
320  } // loop over all paths of this analysis type
321 
322  } // loop over analysis types (single ele etc.)
323 
324  if (changed) {
325  // The HLT config has actually changed wrt the previous Run, hence rebook your
326  // histograms or do anything else dependent on the revised HLT config
327  }
328  } else {
329  // if init returns FALSE, initialisation has NOT succeeded, which indicates a problem
330  // with the file and/or code and needs to be investigated!
331  if (verbosity_ >= OUTPUT_ERRORS)
332  edm::LogError("EmDQMFeeder") << " HLT config extraction failure with process name '" << triggerObject_.process() << "'.";
333  // In this case, all access methods will return empty values!
334  }
335 }
336 
337 // ------------ method called when ending the processing of a run ------------
338 void
340 {
341  for (unsigned i = 0; i < emDQMmodules.size(); ++i)
342  emDQMmodules[i]->endRun(iEvent, iSetup);
343 }
344 
345 // ------------ method called when starting to processes a luminosity block ------------
346 void
348 {
349 // for (unsigned i = 0; i < emDQMmodules.size(); ++i)
350 // emDQMmodules[i]->beginLuminosityBlock(lumi, iSetup);
351 }
352 
353 // ------------ method called when ending the processing of a luminosity block ------------
354 void
356 {
357 // for (unsigned i = 0; i < emDQMmodules.size(); ++i)
358 // emDQMmodules[i]->endLuminosityBlock(lumi, iSetup);
359 }
360 
361 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
362 void
364  //The following says we do not know what parameters are allowed so do no validation
365  // Please change this to state exactly what you do use, even if it is no parameters
366 
367  // see: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideConfigurationValidationAndHelp
369  desc.setUnknown();
370  descriptions.addDefault(desc);
371 }
372 
373 //----------------------------------------------------------------------
374 
375 std::vector<std::vector<std::string> >
377 {
378  std::vector<std::vector<std::string> > Paths(5);
379  // Loop over all paths in the menu
380  for (unsigned int i=0; i<hltConfig_.size(); i++) {
381 
382  std::string path = hltConfig_.triggerName(i);
383 
384  // Find electron and photon paths
385  if (int(path.find("HLT_")) == 0) { // Path should start with 'HLT_'
386  if (path.find("HLT_Ele") != std::string::npos && path.rfind("Ele") == 4 && path.find("SC") == std::string::npos) {
387  Paths[TYPE_SINGLE_ELE].push_back(path);
388  //std::cout << "Electron " << path << std::endl;
389  }
390  if (path.find("HLT_Ele") != std::string::npos && path.find("EleId") != std::string::npos && path.rfind("Ele") == path.find("EleId")) {
391  Paths[TYPE_SINGLE_ELE].push_back(path);
392  //std::cout << "Electron " << path << std::endl;
393  }
394  else if (path.find("HLT_Ele") != std::string::npos && path.rfind("Ele") > 4) {
395  Paths[TYPE_DOUBLE_ELE].push_back(path);
396  //std::cout << "DoubleElectron " << path << std::endl;
397  }
398  else if (path.find("HLT_DoubleEle") != std::string::npos && path.find("Ele") == path.rfind("Ele")) {
399  Paths[TYPE_DOUBLE_ELE].push_back(path);
400  //std::cout << "DoubleElectron " << path << std::endl;
401  }
402  else if (path.find("HLT_Ele") != std::string::npos && path.find("SC") != std::string::npos) {
403  Paths[TYPE_DOUBLE_ELE].push_back(path);
404  //std::cout << "DoubleElectron " << path << std::endl;
405  }
406  else if (path.find("HLT_DoubleEle") != std::string::npos && path.find("Ele") != path.rfind("Ele")) {
407  Paths[TYPE_TRIPLE_ELE].push_back(path);
408  //std::cout << "TripleElectron " << path << std::endl;
409  }
410  else if (path.find("HLT_TripleEle") != std::string::npos && path.find("Ele") == path.rfind("Ele")) {
411  Paths[TYPE_TRIPLE_ELE].push_back(path);
412  //std::cout << "TripleElectron " << path << std::endl;
413  }
414  else if (path.find("HLT_Photon") != std::string::npos && path.find("Ele") != std::string::npos) {
415  Paths[TYPE_DOUBLE_PHOTON].push_back(path);
416  //std::cout << "DoublePhoton " << path << std::endl;
417  }
418  else if (path.find("HLT_Photon") != std::string::npos && path.rfind("Photon") == 4) {
419  Paths[TYPE_SINGLE_PHOTON].push_back(path);
420  //std::cout << "Photon " << path << std::endl;
421  }
422  else if (path.find("HLT_Photon") != std::string::npos && path.rfind("Photon") > 4) {
423  Paths[TYPE_DOUBLE_PHOTON].push_back(path);
424  //std::cout << "DoublePhoton " << path << std::endl;
425  }
426  else if (path.find("HLT_DoublePhoton") != std::string::npos) {
427  Paths[TYPE_DOUBLE_PHOTON].push_back(path);
428  //std::cout << "DoublePhoton " << path << std::endl;
429  }
430  }
431  //std::cout << i << " triggerName: " << path << " containing " << hltConfig_.size(i) << " modules."<< std::endl;
432  }
433  return Paths;
434 }
435 
436 //----------------------------------------------------------------------
437 
438 std::vector<std::string>
440 {
441  std::vector<std::string> filters;
442 
443  //std::cout << "Pathname: " << path << std::endl;
444 
445  // Loop over all modules in the path
446  for (unsigned int i=0; i<hltConfig_.size(path); i++) {
447 
448  std::string module = hltConfig_.moduleLabel(path, i);
449  std::string moduleType = hltConfig_.moduleType(module);
450  std::string moduleEDMType = hltConfig_.moduleEDMType(module);
451 
452  // Find filters
453  if (moduleEDMType == "EDFilter" || moduleType.find("Filter") != std::string::npos) { // older samples may not have EDMType data included
454  filters.push_back(module);
455  //std::cout << i << " moduleLabel: " << module << " moduleType: " << moduleType << " moduleEDMType: " << moduleEDMType << std::endl;
456  }
457  }
458  return filters;
459 }
460 
461 //----------------------------------------------------------------------
462 
463 double
465 {
466  double minEt = -1;
467 
468  boost::regex reg("^HLT_.*?([[:digit:]]+).*");
469 
470  boost::smatch what;
471  if (boost::regex_match(path, what, reg, boost::match_extra))
472  {
473  minEt = boost::lexical_cast<double>(what[1]);
474  }
475 
476  return minEt;
477 }
478 
479 //----------------------------------------------------------------------
480 
482 EmDQMFeeder::makePSetForL1SeedFilter(const std::string& moduleName)
483 {
484  // generates a PSet to analyze the behaviour of an L1 seed.
485  //
486  // moduleName is the name of the HLT module which filters
487  // on the L1 seed.
488  edm::ParameterSet retPSet;
489 
490  retPSet.addParameter<std::vector<double> >("PlotBounds", std::vector<double>(2, 0.0));
491  //retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", processName_));
492  retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", triggerObject_.process()));
493  retPSet.addParameter<std::vector<edm::InputTag> >("IsoCollections", std::vector<edm::InputTag>(1, std::string("none")));
494  retPSet.addParameter<int>("theHLTOutputTypes", trigger::TriggerL1NoIsoEG);
495 
496  // as HLTLevel1GTSeed has no parameter ncandcut we determine the value from the name of the filter
497  if (moduleName.find("Single") != std::string::npos)
498  retPSet.addParameter<int>("ncandcut", 1);
499  else if (moduleName.find("Double") != std::string::npos)
500  retPSet.addParameter<int>("ncandcut", 2);
501  else if (moduleName.find("Triple") != std::string::npos)
502  retPSet.addParameter<int>("ncandcut", 3);
503  else
504  retPSet.addParameter<int>("ncandcut", -1);
505 
506  return retPSet;
507 }
508 
509 //----------------------------------------------------------------------
510 
513 {
514  // generates a PSet to analyze the behaviour of L1 to supercluster match filter.
515  //
516  // moduleName is the name of the HLT module which requires the match
517  // between supercluster and L1 seed.
518  //
519  edm::ParameterSet retPSet;
520 
521  retPSet.addParameter<std::vector<double> >("PlotBounds", std::vector<double>(2, 0.0));
522  //retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", processName_));
523  retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", triggerObject_.process()));
524  retPSet.addParameter<std::vector<edm::InputTag> >("IsoCollections", std::vector<edm::InputTag>(1, std::string("none")));
525  retPSet.addParameter<int>("theHLTOutputTypes", trigger::TriggerCluster);
526  retPSet.addParameter<int>("ncandcut", hltConfig_.modulePSet(moduleName).getParameter<int>("ncandcut"));
527 
528  return retPSet;
529 }
530 
531 //----------------------------------------------------------------------
532 
534 EmDQMFeeder::makePSetForEtFilter(const std::string& moduleName)
535 {
536  edm::ParameterSet retPSet;
537 
538  retPSet.addParameter<std::vector<double> >("PlotBounds", std::vector<double>(2, 0.0));
539  //retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", processName_));
540  retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", triggerObject_.process()));
541  retPSet.addParameter<std::vector<edm::InputTag> >("IsoCollections", std::vector<edm::InputTag>(1, std::string("none")));
542  retPSet.addParameter<int>("theHLTOutputTypes", trigger::TriggerCluster);
543  retPSet.addParameter<int>("ncandcut", hltConfig_.modulePSet(moduleName).getParameter<int>("ncandcut"));
544 
545  return retPSet;
546 }
547 
548 //----------------------------------------------------------------------
549 
551 EmDQMFeeder::makePSetForOneOEMinusOneOPFilter(const std::string& moduleName)
552 {
553  edm::ParameterSet retPSet;
554 
555  retPSet.addParameter<std::vector<double> >("PlotBounds", std::vector<double>(2, 0.0));
556  //retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", processName_));
557  retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", triggerObject_.process()));
558  retPSet.addParameter<std::vector<edm::InputTag> >("IsoCollections", std::vector<edm::InputTag>(1, std::string("none")));
559  retPSet.addParameter<int>("theHLTOutputTypes", trigger::TriggerElectron);
560  retPSet.addParameter<int>("ncandcut", hltConfig_.modulePSet(moduleName).getParameter<int>("ncandcut"));
561 
562  return retPSet;
563 }
564 
565 //----------------------------------------------------------------------
566 
568 EmDQMFeeder::makePSetForPixelMatchFilter(const std::string& moduleName)
569 {
570  edm::ParameterSet retPSet;
571 
572  retPSet.addParameter<std::vector<double> >("PlotBounds", std::vector<double>(2, 0.0));
573  //retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", processName_));
574  retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", triggerObject_.process()));
575  retPSet.addParameter<std::vector<edm::InputTag> >("IsoCollections", std::vector<edm::InputTag>(1, std::string("none")));
576  retPSet.addParameter<int>("theHLTOutputTypes", trigger::TriggerCluster);
577  retPSet.addParameter<int>("ncandcut", hltConfig_.modulePSet(moduleName).getParameter<int>("ncandcut"));
578 
579  return retPSet;
580 }
581 
582 //----------------------------------------------------------------------
583 
586 {
587  edm::ParameterSet retPSet;
588 
589  retPSet.addParameter<std::vector<double> >("PlotBounds", std::vector<double>(2, 0.0));
590  //retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", processName_));
591  retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", triggerObject_.process()));
592  retPSet.addParameter<std::vector<edm::InputTag> >("IsoCollections", std::vector<edm::InputTag>(1, std::string("none")));
593  retPSet.addParameter<int>("theHLTOutputTypes", trigger::TriggerCluster);
594  retPSet.addParameter<int>("ncandcut", 2);
595 
596  return retPSet;
597 }
598 
599 //----------------------------------------------------------------------
600 
602 EmDQMFeeder::makePSetForEgammaGenericFilter(const std::string& moduleName)
603 {
604  edm::ParameterSet retPSet;
605 
606  // example usages of HLTEgammaGenericFilter are:
607  // R9 shape filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolR9ShapeFilter
608  // cluster shape filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolClusterShapeFilter
609  // Ecal isolation filter hltL1NonIsoHLTNonIsoSingleElectronEt17TIghterEleIdIsolEcalIsolFilter
610  // H/E filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHEFilter
611  // HCAL isolation filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHcalIsolFilter
612 
613  // infer the type of filter by the type of the producer which
614  // generates the collection used to cut on this
615  edm::InputTag isoTag = hltConfig_.modulePSet(moduleName).getParameter<edm::InputTag>("isoTag");
616  edm::InputTag nonIsoTag = hltConfig_.modulePSet(moduleName).getParameter<edm::InputTag>("nonIsoTag");
617  //std::cout << "isoTag.label " << isoTag.label() << " nonIsoTag.label " << nonIsoTag.label() << std::endl;
618 
619  std::string inputType = hltConfig_.moduleType(isoTag.label());
620  //std::cout << "inputType " << inputType << " moduleName " << moduleName << std::endl;
621 
622  //--------------------
623  // sanity check: non-isolated path should be produced by the
624  // same type of module
625 
626  // first check that the non-iso tag is non-empty
627  //if (nonIsoTag.label().empty()) {
628  // edm::LogError("EmDQMFeeder") << "nonIsoTag of HLTEgammaGenericFilter '" << moduleName << "' is empty.";
629  // return retPSet;
630  //}
631  //if (inputType != hltConfig_.moduleType(nonIsoTag.label())) {
632  // edm::LogError("EmDQMFeeder") << "C++ Type of isoTag '" << inputType << "' and nonIsoTag '" << hltConfig_.moduleType(nonIsoTag.label()) << "' are not the same for HLTEgammaGenericFilter '" << moduleName << "'.";
633  // return retPSet;
634  //}
635  //--------------------
636 
637  // parameter saveTag determines the output type
638  if (hltConfig_.saveTags(moduleName))
639  retPSet.addParameter<int>("theHLTOutputTypes", trigger::TriggerPhoton);
640  else
641  retPSet.addParameter<int>("theHLTOutputTypes", trigger::TriggerCluster);
642 
643  std::vector<edm::InputTag> isoCollections;
644  isoCollections.push_back(isoTag);
645  if (!nonIsoTag.label().empty())
646  isoCollections.push_back(nonIsoTag);
647 
648  //--------------------
649  // the following cases seem to have identical PSets ?
650  //--------------------
651 
652  if (inputType == "EgammaHLTR9Producer" || // R9 shape
653  inputType == "EgammaHLTR9IDProducer" || // R9 ID
654  inputType == "EgammaHLTClusterShapeProducer" || // cluster shape
655  inputType == "EgammaHLTEcalRecIsolationProducer" || // ecal isolation
656  inputType == "EgammaHLTHcalIsolationProducersRegional" || // HCAL isolation and HE
657  inputType == "EgammaHLTGsfTrackVarProducer" // GSF track deta and dphi filter
658  ) {
659  retPSet.addParameter<std::vector<double> >("PlotBounds", std::vector<double>(2, 0.0));
660  //retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", processName_));
661  retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", triggerObject_.process()));
662  retPSet.addParameter<std::vector<edm::InputTag> >("IsoCollections", isoCollections);
663  retPSet.addParameter<int>("ncandcut", hltConfig_.modulePSet(moduleName).getParameter<int>("ncandcut"));
664 
665  return retPSet;
666  }
667 
668  if (verbosity_ >= OUTPUT_ERRORS)
669  edm::LogError("EmDQMFeeder") << "Can't determine what the HLTEgammaGenericFilter '" << moduleName << "' should do: uses a collection produced by a module of C++ type '" << inputType << "'.";
670  return edm::ParameterSet();
671 }
672 
673 //----------------------------------------------------------------------
674 
677 {
678  edm::ParameterSet retPSet;
679 
680  // example usages of HLTEgammaGenericFilter are:
681  // R9 shape filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolR9ShapeFilter
682  // cluster shape filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolClusterShapeFilter
683  // Ecal isolation filter hltL1NonIsoHLTNonIsoSingleElectronEt17TIghterEleIdIsolEcalIsolFilter
684  // H/E filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHEFilter
685  // HCAL isolation filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHcalIsolFilter
686 
687  // infer the type of filter by the type of the producer which
688  // generates the collection used to cut on this
689  edm::InputTag isoTag = hltConfig_.modulePSet(moduleName).getParameter<edm::InputTag>("isoTag");
690  edm::InputTag nonIsoTag = hltConfig_.modulePSet(moduleName).getParameter<edm::InputTag>("nonIsoTag");
691  //std::cout << "isoTag.label " << isoTag.label() << " nonIsoTag.label " << nonIsoTag.label() << std::endl;
692 
693  std::string inputType = hltConfig_.moduleType(isoTag.label());
694  //std::cout << "inputType " << inputType << " moduleName " << moduleName << std::endl;
695 
696  //--------------------
697  // sanity check: non-isolated path should be produced by the
698  // same type of module
699 
700  // first check that the non-iso tag is non-empty
701  //if (nonIsoTag.label().empty()) {
702  // edm::LogError("EmDQMFeeder") << "nonIsoTag of HLTEgammaGenericFilter '" << moduleName << "' is empty.";
703  // return retPSet;
704  //}
705  //if (inputType != hltConfig_.moduleType(nonIsoTag.label())) {
706  // edm::LogError("EmDQMFeeder") << "C++ Type of isoTag '" << inputType << "' and nonIsoTag '" << hltConfig_.moduleType(nonIsoTag.label()) << "' are not the same for HLTEgammaGenericFilter '" << moduleName << "'.";
707  // return retPSet;
708  //}
709  //--------------------
710 
711  // parameter saveTag determines the output type
712  if (hltConfig_.saveTags(moduleName))
713  retPSet.addParameter<int>("theHLTOutputTypes", trigger::TriggerPhoton);
714  else
715  retPSet.addParameter<int>("theHLTOutputTypes", trigger::TriggerCluster);
716 
717  std::vector<edm::InputTag> isoCollections;
718  isoCollections.push_back(isoTag);
719  if (!nonIsoTag.label().empty())
720  isoCollections.push_back(nonIsoTag);
721 
722  //--------------------
723  // the following cases seem to have identical PSets ?
724  //--------------------
725 
726  if (inputType == "EgammaHLTR9Producer" || // R9 shape
727  inputType == "EgammaHLTR9IDProducer" || // R9 ID
728  inputType == "EgammaHLTClusterShapeProducer" || // cluster shape
729  inputType == "EgammaHLTEcalRecIsolationProducer" || // ecal isolation
730  inputType == "EgammaHLTHcalIsolationProducersRegional" || // HCAL isolation and HE
731  inputType == "EgammaHLTPhotonTrackIsolationProducersRegional" // Photon track isolation
732  ) {
733  retPSet.addParameter<std::vector<double> >("PlotBounds", std::vector<double>(2, 0.0));
734  //retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", processName_));
735  retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", triggerObject_.process()));
736  retPSet.addParameter<std::vector<edm::InputTag> >("IsoCollections", isoCollections);
737  retPSet.addParameter<int>("ncandcut", hltConfig_.modulePSet(moduleName).getParameter<int>("ncandcut"));
738 
739  return retPSet;
740  }
741 
742  if (verbosity_ >= OUTPUT_ERRORS)
743  edm::LogError("EmDQMFeeder") << "Can't determine what the HLTEgammaGenericQuadraticFilter '" << moduleName << "' should do: uses a collection produced by a module of C++ type '" << inputType << "'.";
744  return edm::ParameterSet();
745 }
746 
747 
748 //----------------------------------------------------------------------
749 
751 EmDQMFeeder::makePSetForElectronGenericFilter(const std::string& moduleName)
752 {
753  edm::ParameterSet retPSet;
754 
755  // example usages of HLTElectronGenericFilter are:
756  //
757  // deta filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDetaFilter
758  // dphi filter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDphiFilter
759  // track isolation hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolTrackIsolFilter
760 
761  // infer the type of filter by the type of the producer which
762  // generates the collection used to cut on this
763  edm::InputTag isoTag = hltConfig_.modulePSet(moduleName).getParameter<edm::InputTag>("isoTag");
764  edm::InputTag nonIsoTag = hltConfig_.modulePSet(moduleName).getParameter<edm::InputTag>("nonIsoTag");
765  //std::cout << "isoTag.label " << isoTag.label() << " nonIsoTag.label " << nonIsoTag.label() << std::endl;
766 
767  std::string inputType = hltConfig_.moduleType(isoTag.label());
768  //std::cout << "inputType iso " << inputType << " inputType noniso " << hltConfig_.moduleType(nonIsoTag.label()) << " moduleName " << moduleName << std::endl;
769 
770  //--------------------
771  // sanity check: non-isolated path should be produced by the
772  // same type of module
773  //if (nonIsoTag.label().empty()) {
774  // edm::LogError("EmDQMFeeder") << "nonIsoTag of HLTElectronGenericFilter '" << moduleName << "' is empty.";
775  // return retPSet;
776  //}
777  //if (inputType != hltConfig_.moduleType(nonIsoTag.label())) {
778  // edm::LogError("EmDQMFeeder") << "C++ Type of isoTag '" << inputType << "' and nonIsoTag '" << hltConfig_.moduleType(nonIsoTag.label()) << "' are not the same for HLTElectronGenericFilter '" << moduleName << "'.";
779  // return retPSet;
780  //}
781  //--------------------
782 
783  // the type of object to look for seems to be the
784  // same for all uses of HLTEgammaGenericFilter
785  retPSet.addParameter<int>("theHLTOutputTypes", trigger::TriggerElectron);
786 
787  std::vector<edm::InputTag> isoCollections;
788  isoCollections.push_back(isoTag);
789  if (!nonIsoTag.label().empty())
790  isoCollections.push_back(nonIsoTag);
791 
792  //--------------------
793  // the following cases seem to have identical PSets ?
794  //--------------------
795 
796  // note that whether deta or dphi is used is determined from
797  // the product instance (not the module label)
798  if (inputType == "EgammaHLTElectronDetaDphiProducer" || // deta and dphi filter
799  inputType == "EgammaHLTElectronTrackIsolationProducers" // track isolation
800  ) {
801  retPSet.addParameter<std::vector<double> >("PlotBounds", std::vector<double>(2, 0.0));
802  //retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", processName_));
803  retPSet.addParameter<edm::InputTag>("HLTCollectionLabels", edm::InputTag(moduleName, "", triggerObject_.process()));
804  retPSet.addParameter<std::vector<edm::InputTag> >("IsoCollections", isoCollections);
805  retPSet.addParameter<int>("ncandcut", hltConfig_.modulePSet(moduleName).getParameter<int>("ncandcut"));
806 
807  return retPSet;
808  }
809 
810  if (verbosity_ >= OUTPUT_ERRORS)
811  edm::LogError("EmDQMFeeder") << "Can't determine what the HLTElectronGenericFilter '" << moduleName << "' should do: uses a collection produced by a module of C++ type '" << inputType << "'.";
812  return edm::ParameterSet();
813 }
814 
815 //----------------------------------------------------------------------
816 
unsigned int size() const
number of trigger paths in trigger table
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:219
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual void endRun(edm::Run const &, edm::EventSetup const &)
Definition: EmDQMFeeder.cc:339
bool saveTags(const std::string &module) const
Is module an L3 filter (ie, tracked saveTags=true)
const std::string moduleType(const std::string &module) const
C++ class name of module.
edm::ParameterSet makePSetForPixelMatchFilter(const std::string &)
Definition: EmDQMFeeder.cc:568
std::vector< EmDQM * > emDQMmodules
Definition: EmDQMFeeder.h:85
const std::string & triggerName(unsigned int triggerIndex) const
const edm::ParameterSet & iConfig
Definition: EmDQMFeeder.h:64
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
tuple lumi
Definition: fjr2json.py:35
bool exists(std::string const &parameterName) const
checks if a parameter exists
const std::string moduleEDMType(const std::string &module) const
C++ base class name of module.
const std::string & tableName() const
HLT ConfDB table name.
const edm::ParameterSet & modulePSet(const std::string &module) const
ParameterSet of module.
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: EmDQMFeeder.cc:82
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: EmDQMFeeder.cc:347
static const unsigned OUTPUT_ERRORS
Definition: EmDQMFeeder.h:95
Definition: EmDQM.h:24
std::vector< TPRegexp > filters
Definition: eve_filter.cc:25
bool changed() const
changed?
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: EmDQMFeeder.cc:355
static const unsigned TYPE_DOUBLE_PHOTON
Definition: EmDQMFeeder.h:90
const std::string & moduleLabel(unsigned int trigger, unsigned int module) const
static const std::string removeVersion(const std::string &trigger)
static const unsigned TYPE_SINGLE_ELE
Definition: EmDQMFeeder.h:87
bool inited() const
Accessors (const methods)
edm::ParameterSet makePSetForEgammaGenericFilter(const std::string &)
Definition: EmDQMFeeder.cc:602
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
EmDQMFeeder(const edm::ParameterSet &)
Definition: EmDQMFeeder.cc:19
list path
Definition: scaleCards.py:51
int iEvent
Definition: GenABIO.cc:243
double getPrimaryEtCut(const std::string &)
Definition: EmDQMFeeder.cc:464
unsigned verbosity_
Definition: EmDQMFeeder.h:93
void addDefault(ParameterSetDescription const &psetDescription)
edm::ParameterSet makePSetForL1SeedToSuperClusterMatchFilter(const std::string &)
Definition: EmDQMFeeder.cc:512
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: EmDQMFeeder.cc:363
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Definition: EmDQMFeeder.cc:44
std::vector< std::vector< std::string > > findEgammaPaths()
Definition: EmDQMFeeder.cc:376
edm::ParameterSet makePSetForL1SeedFilter(const std::string &)
Definition: EmDQMFeeder.cc:482
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:145
static const unsigned TYPE_DOUBLE_ELE
Definition: EmDQMFeeder.h:88
static const unsigned TYPE_SINGLE_PHOTON
Definition: EmDQMFeeder.h:89
int j
Definition: DBlmapReader.cc:9
edm::ParameterSet makePSetForOneOEMinusOneOPFilter(const std::string &)
Definition: EmDQMFeeder.cc:551
virtual void beginJob()
Definition: EmDQMFeeder.cc:66
static const unsigned OUTPUT_ALL
Definition: EmDQMFeeder.h:97
const std::string & processName() const
process name
HLTConfigProvider hltConfig_
The instance of the HLTConfigProvider as a data member.
Definition: EmDQMFeeder.h:69
virtual void endJob()
Definition: EmDQMFeeder.cc:74
edm::ParameterSet makePSetForEtFilter(const std::string &)
Definition: EmDQMFeeder.cc:534
static const unsigned OUTPUT_WARNINGS
Definition: EmDQMFeeder.h:96
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:209
edm::InputTag triggerObject_
Definition: EmDQMFeeder.h:67
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::string const & label() const
Definition: InputTag.h:25
edm::ParameterSet makePSetForElectronGenericFilter(const std::string &)
Definition: EmDQMFeeder.cc:751
std::string const & process() const
Definition: InputTag.h:29
edm::ParameterSet makePSetForEgammaDoubleEtDeltaPhiFilter(const std::string &)
Definition: EmDQMFeeder.cc:585
std::vector< std::string > getFilterModules(const std::string &)
Definition: EmDQMFeeder.cc:439
Definition: vlib.h:209
Definition: Run.h:33
static const unsigned TYPE_TRIPLE_ELE
Definition: EmDQMFeeder.h:91
edm::ParameterSet makePSetForEgammaGenericQuadraticFilter(const std::string &)
Definition: EmDQMFeeder.cc:676