CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTOfflineReproducibility.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTOfflineReproducibility
4 // Class: HLTOfflineReproducibility
5 //
13 //
14 // Original Author: Juliette Marie Alimena,40 3-A02,+41227671577,
15 // Created: Fri Apr 22 15:46:58 CEST 2011
16 //
17 //
18 
19 using namespace std;
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
36 
42 
44 
47 
50 
51 #include <TMath.h>
52 #include <TFile.h>
53 #include <TTree.h>
54 #include <TH1.h>
55 #include <TH2.h>
56 #include <vector>
57 #include <iostream>
58 #include <ostream>
59 //
60 // class declaration
61 //
62 
64 public:
67 
68  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
69 
70 
71 private:
72  virtual void beginJob() override ;
73  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
74  virtual void endJob() override ;
75 
76  virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
77  virtual void endRun(edm::Run const&, edm::EventSetup const&) override;
78  virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
79  virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
80 
81  bool check(std::string process, std::string pCheck);
82 
83  // ----------member data ---------------------------
84  bool dqm_;
86 
91 
92  //Trigger Stuff
93  unsigned int nPaths_, nPathsORIG_, nPathsNEW_, nDatasets_;
94  vector<string> triggerNames_;
95  vector< vector<string> > moduleLabel_, moduleLabelORIG_, moduleLabelNEW_;
96  vector<unsigned int> nModules_, nPaths_PD_;
97  vector<string> datasetNames_;
98  vector<vector<string> > datasetContent_;
99  vector< vector< vector<bool> > > triggerNames_matched_;
100 
104 
105  int Nfiles_;
109  vector<int> trigger_ORIG_;
110  vector<int> trigger_NEW_;
111 
117 
118  vector<TH1F*> path_ORIG_hist_PD;
119  vector<TH1F*> path_ORIGnotNEW_hist_PD;
120  vector<TH1F*> path_NEWnotORIG_hist_PD;
123 
124 };
125 
126 //
127 // constants, enums and typedefs
128 //
129 
130 //
131 // static data member definitions
132 //
133 
134 //
135 // constructors and destructor
136 //
138  dqm_ (iConfig.getUntrackedParameter<bool>("dqm")),
139  triggerLabelORIG_ (iConfig.getUntrackedParameter<edm::InputTag>("triggerTagORIG")),
140  triggerLabelNEW_ (iConfig.getUntrackedParameter<edm::InputTag>("triggerTagNEW")),
141  nPaths_ (0),
142  nDatasets_ (0),
143  triggerNames_ (),
144  moduleLabel_ (),
145  nModules_ (),
146  nPaths_PD_ (),
147  datasetNames_ (),
148  datasetContent_ (),
149  triggerNames_matched_ (),
150  processNameORIG_ (iConfig.getParameter<std::string>("processNameORIG")),
151  processNameNEW_ (iConfig.getParameter<std::string>("processNameNEW")),
152  Nfiles_ (iConfig.getUntrackedParameter<int>("Nfiles",0)),
153  Normalization_ (iConfig.getUntrackedParameter<double>("Norm",40.)),
154  isRealData_ (iConfig.getUntrackedParameter<bool>("isRealData",true)),
155  LumiSecNumber_ (iConfig.getUntrackedParameter<int>("LumiSecNumber",1)),
156  path_ORIG_hist (0),
157  path_ORIGnotNEW_hist (0),
158  path_NEWnotORIG_hist (0),
159  pathmodule_ORIGnotNEW_hist(0),
160  pathmodule_NEWnotORIG_hist(0),
161  path_ORIG_hist_PD (),
162  path_ORIGnotNEW_hist_PD (),
163  path_NEWnotORIG_hist_PD (),
164  pathmodule_ORIGnotNEW_hist_PD(),
165  pathmodule_NEWnotORIG_hist_PD()
166 {
167  //now do what ever initialization is needed
168  //define parameters
170  triggerTokenORIG_ = consumes<edm::TriggerResults>(triggerLabelORIG_);
171  triggerTokenNEW_ = consumes<edm::TriggerResults>(triggerLabelNEW_);
172 }
173 
174 
176 {
177 
178  // do anything here that needs to be done at desctruction time
179  // (e.g. close files, deallocate resources etc.)
180 
181 }
182 
183 
184 //
185 // member functions
186 //
187 
188 // ------------ method called for each event ------------
189 void
191 {
192  // if DQM was requested, check that the DQMService is available
193  if (dqm_ and not dqms_) return;
194 
195  using namespace edm;
196 
197  //Initialize Trigger
198  TriggerResults trORIG_;
199  Handle<TriggerResults> h_trigResORIG_;
200  iEvent.getByToken(triggerTokenORIG_, h_trigResORIG_);
201  trORIG_ = *h_trigResORIG_;
202 
203  TriggerResults trNEW_;
204  Handle<TriggerResults> h_trigResNEW_;
205  iEvent.getByToken(triggerTokenNEW_, h_trigResNEW_);
206  trNEW_ = *h_trigResNEW_;
207 
208  vector<string> triggerListORIG_;
210  bool foundNamesORIG_ = tnsORIG_->getTrigPaths(trORIG_,triggerListORIG_);
211  if (!foundNamesORIG_) LogError("DataNotFound")<<"Could not get ORIG trigger names!";
212  if (trORIG_.size()!=triggerListORIG_.size()) LogError("DataNotFound")<<"Length of names and paths not the same: " << triggerListORIG_.size() << "," << trORIG_.size() << endl;
213 
214  vector<string> triggerListNEW_;
216  bool foundNamesNEW_ = tnsNEW_->getTrigPaths(trNEW_,triggerListNEW_);
217  if (!foundNamesNEW_) LogError("DataNotFound")<<"Could not get trigger names!";
218  if (trNEW_.size()!=triggerListNEW_.size()) LogError("DataNotFound")<<"Length of names and paths not the same: " << triggerListNEW_.size() << "," << trNEW_.size() << endl;
219 
220 
221  vector<bool> ORIG_accept_, NEW_accept_, fails_prescaler_;
222  vector<int> module_indexORIG_, module_indexNEW_;
223  vector<string> module_index_labelORIG_, module_index_labelNEW_;
224 
225  for (unsigned int x=0; x<nPaths_; x++) {
226  ORIG_accept_.push_back(false);
227  NEW_accept_.push_back(false);
228  module_indexORIG_.push_back(-1);
229  module_indexNEW_.push_back(-1);
230  module_index_labelORIG_.push_back(" ");
231  module_index_labelNEW_.push_back(" ");
232  fails_prescaler_.push_back(false);
233  }
234 
235  //loop over ORIG trigger paths
236  for (unsigned int i=0; i<nPathsORIG_; i++) {
237  for (unsigned int x=0; x<nPaths_; x++) {
238  //match to list of paths that are in common to both ORIG and NEW
239  if (triggerListORIG_.at(i)==triggerNames_.at(x)) {
240  LogDebug("event")<<"triggerListORIG and triggerNames matched for 'global' path "<<x<<", "<<triggerNames_.at(x);
241 
242  //if ORIG accepted
243  if (trORIG_.at(i).wasrun()==1 && trORIG_.at(i).accept()==1 && trORIG_.at(i).error()==0) {
244  LogDebug("event")<<"ORIG accepted";
245  ORIG_accept_.at(x) = true;
246  trigger_ORIG_.at(x)++;
247  path_ORIG_hist->Fill(x);
248  for (unsigned int a=0; a<nDatasets_; a++) {
249  for (unsigned int b=0; b<nPaths_PD_.at(a); b++) {
250  if (triggerNames_matched_.at(x).at(a).at(b)){
251  path_ORIG_hist_PD.at(a)->Fill(b);
252  }
253  }
254  }
255  }
256 
257  //if ORIG failed
258  if (trORIG_.at(i).accept() == 0){
259  LogDebug("event")<<"ORIG failed";
260  module_index_labelORIG_.at(x) = moduleLabelORIG_.at(i)[trORIG_.at(i).index()];
261  module_indexORIG_.at(x) = hltConfig_.moduleIndex(triggerNames_.at(x),module_index_labelORIG_.at(x));
262  }
263 
264  //for each path, loop over modules and find if a path fails on a prescaler
265  for (unsigned int j=0; j<nModules_.at(x); ++j) {
266  //const string& moduleLabel_(moduleLabel.at(j));
267  const string& moduleType = hltConfig_.moduleType(moduleLabel_.at(x).at(j));
268  if ( (trORIG_.at(i).accept()==0 && j==trORIG_.at(i).index()) && (moduleType=="HLTPrescaler" || moduleType=="TriggerResultsFilter") ) fails_prescaler_.at(x) = true;
269  }
270 
271  }
272  }
273  }
274 
275  //loop over NEW trigger paths
276  for (unsigned int i=0; i<nPathsNEW_; i++) {
277  for (unsigned int x=0; x<nPaths_; x++) {
278  if (triggerListNEW_.at(i)==triggerNames_.at(x)) {
279 
280  //if NEW accepted
281  if (trNEW_.at(i).wasrun()==1 && trNEW_.at(i).accept()==1 && trNEW_.at(i).error()==0) {
282  NEW_accept_.at(x) = true;
283  trigger_NEW_.at(x)++;
284  }
285 
286  //if NEW failed
287  if (trNEW_.at(i).accept() == 0) {
288  module_index_labelNEW_.at(x) = moduleLabelNEW_.at(i)[trNEW_.at(i).index()];
289  module_indexNEW_.at(x) = hltConfig_.moduleIndex(triggerNames_.at(x),module_index_labelNEW_.at(x));
290  }
291 
292  //for each path, loop over modules and find if a path fails on a prescaler
293  for (unsigned int j=0; j<nModules_.at(x); ++j) {
294  //const string& moduleLabel_(moduleLabel.at(j));
295  const string& moduleType = hltConfig_.moduleType(moduleLabel_.at(x).at(j));
296  if ( (trNEW_.at(i).accept()==0 && j==trNEW_.at(i).index()) && (moduleType=="HLTPrescaler" || moduleType=="TriggerResultsFilter") ) fails_prescaler_.at(x) = true;
297  }
298 
299  }
300  }
301  }
302 
303 
304  //check agreement between ORIG and NEW
305  //loop over trigger paths (ORIG and NEW)
306  for (unsigned int x=0; x<nPaths_; x++) {
307  if (!fails_prescaler_.at(x)){ //ignore paths that fail on a prescale
308  if(ORIG_accept_.at(x) && !NEW_accept_.at(x)){ //ORIG fires but NEW doesn't
309  path_ORIGnotNEW_hist->Fill(x);
310  pathmodule_ORIGnotNEW_hist->Fill(x,module_indexNEW_.at(x)); //module and path for where it fails NEW
311  LogInfo("EventNotReproduced")<<"Fires in ORIG but not NEW!!"<<" Path is: "<<triggerNames_.at(x)<<", last run module is: "<<module_index_labelNEW_.at(x);
312  for (unsigned int a=0; a<nDatasets_; a++) {
313  for (unsigned int b=0; b<nPaths_PD_.at(a); b++) {
314  if (triggerNames_matched_.at(x).at(a).at(b)){
315  path_ORIGnotNEW_hist_PD.at(a)->Fill(b);
316  pathmodule_ORIGnotNEW_hist_PD.at(a)->Fill(b,module_indexNEW_.at(x)); //module and path for where it fails NEW
317  }
318  }
319  }
320  }
321  if(!ORIG_accept_.at(x) && NEW_accept_.at(x)){//NEW fires but ORIG doesn't
322  path_NEWnotORIG_hist->Fill(x);
323  pathmodule_NEWnotORIG_hist->Fill(x,module_indexORIG_.at(x)); //module and path for where it fails ORIG
324  LogInfo("EventNotReproduced")<<"Fires in NEW but not ORIG!!"<<" Path is: "<<triggerNames_.at(x)<<", last run module is: "<<module_index_labelORIG_.at(x)<<endl;
325  for (unsigned int a=0; a<nDatasets_; a++) {
326  for (unsigned int b=0; b<nPaths_PD_.at(a); b++) {
327  if (triggerNames_matched_.at(x).at(a).at(b)){
328  path_NEWnotORIG_hist_PD.at(a)->Fill(b);
329  pathmodule_NEWnotORIG_hist_PD.at(a)->Fill(b,module_indexORIG_.at(x)); //module and path for where it fails ORIG
330  }
331  }
332  }
333  }
334  }
335  }//end of loop over trigger paths
336 
337 }
338 
339 
340 // ------------ method called once each job just before starting event loop ------------
341 void
343 {
344 }
345 
346 // ------------ method called once each job just after ending the event loop ------------
347 void
349 {
350 }
351 
352 // ------------ method called when starting to processes a run ------------
353 void
355 {
357  void init(const edm::TriggerResults &, const edm::TriggerNames & HLTNames);
358 
359  bool changed(true);
360  nPathsORIG_=0, nPathsNEW_=0;
361  vector<string> triggerNamesORIG_, triggerNamesNEW_;
362  vector<string> temp_;
363  unsigned int max_nModules_=0;
364  vector<unsigned int> max_nModules_PD_, nModules_diff_;
365  bool TriggerModuleNamesOK_ = true;
366 
367  //---------------------------------------hltConfig for ORIG-------------------------------
368  if (hltConfig_.init(iRun,iSetup,processNameORIG_,changed)) {
369  // if init returns TRUE, initialisation has succeeded!
370  if (changed) {
371  edm::LogInfo("HLTConfigProvider")<<"hlt_Config_.init returns true for ORIG"<<endl;
372  // The HLT config has actually changed wrt the previous Run, hence rebook your
373  // histograms or do anything else dependent on the revised HLT config
374  // check if trigger name in (new) config
375  triggerNamesORIG_ = hltConfig_.triggerNames();
376 
377  //loop over trigger paths
379  for (unsigned int i=0; i<nPathsORIG_; i++) {
380  temp_.clear();
381  //const vector<string> & moduleLabelsORIG(hltConfig_.moduleLabels(i));
382  for (unsigned int j=0; j<hltConfig_.moduleLabels(i).size(); j++) {
383  temp_.push_back(hltConfig_.moduleLabel(i,j));
384  }
385  moduleLabelORIG_.push_back(temp_);
386  }
387 
388  }
389  }
390  else {
391  // if init returns FALSE, initialisation has NOT succeeded, which indicates a problem
392  // with the file and/or code and needs to be investigated!
393  edm::LogError("HLTConfigProvider")<<" HLT config extraction failure with process name " << processNameORIG_;
394  // In this case, all access methods will return empty values!
395  }
396 
397  //-------------------hltConfig for NEW----------------------------------------
398  if (hltConfig_.init(iRun,iSetup,processNameNEW_,changed)) {
399  // if init returns TRUE, initialisation has succeeded!
400  if (changed) {
401  edm::LogInfo("HLTConfigProvider")<<"hlt_Config_.init returns true for NEW"<<endl;
402  // The HLT config has actually changed wrt the previous Run, hence rebook your
403  // histograms or do anything else dependent on the revised HLT config
404  // check if trigger name in (new) config
405  triggerNamesNEW_ = hltConfig_.triggerNames();
406 
407  //loop over trigger paths
409  for (unsigned int i=0; i<nPathsNEW_; i++) {
410  temp_.clear();
411  for (unsigned int j=0; j<hltConfig_.moduleLabels(i).size(); j++){
412  temp_.push_back(hltConfig_.moduleLabel(i,j));
413  }
414  moduleLabelNEW_.push_back(temp_);
415  }
416 
417  }
418  }
419  else {
420  // if init returns FALSE, initialisation has NOT succeeded, which indicates a problem
421  // with the file and/or code and needs to be investigated!
422  edm::LogError("HLTConfigProvider")<<" HLT config extraction failure with process name " << processNameNEW_;
423  // In this case, all access methods will return empty values!
424  }
425 
426  //------------------compare ORIG and NEW hltConfig------------------------
427  if (nPathsORIG_==0 || nPathsNEW_==0){
428  edm::LogError("TooLittleData")<<"There are 0 paths ORIG or NEW!! There are "<<nPathsORIG_<<" paths ORIG and "<<nPathsNEW_<<" paths NEW!!!";
429  TriggerModuleNamesOK_ = false;
430  }
431  else{
432  //define nPaths_ as number of paths shared between ORIG and NEW
434  else nPaths_=nPathsNEW_;
435 
436  for (unsigned int i=0; i<nPathsORIG_; i++) {
437  for (unsigned int j=0; j<nPathsNEW_; j++) {
438  if (triggerNamesORIG_.at(i)==triggerNamesNEW_.at(j)){
439  triggerNames_.push_back(triggerNamesORIG_.at(i));
440  if (i!=j) edm::LogInfo("PathInfo")<<"Path "<<triggerNamesORIG_.at(i)<<" corresponds to path number "<<i<<" for ORIG and path number "<<j<<" for NEW";
441 
442  //define nModules_ as number of modules shared between ORIG and NEW
443  if (moduleLabelORIG_.at(i).size()<=moduleLabelNEW_.at(j).size()){
444  nModules_.push_back(moduleLabelORIG_.at(i).size());
445  LogDebug("")<<"moduleLabelORIG<=moduleLabelNEW, so moduleLabelORIG_.at(i).size() is: "<<moduleLabelORIG_.at(i).size()<<" for ORIG path "<<i;
446  }
447  else {
448  nModules_.push_back(moduleLabelNEW_.at(j).size());
449  LogDebug("")<<"moduleLabelORIG>moduleLabelNEW, so moduleLabelNEW_.at(j).size() is: "<<moduleLabelNEW_.at(j).size()<<" for NEW path "<<j;
450  }
451  int x;
452  if (i<=j) x=i;
453  else x=j;
454  LogDebug("")<<"nModules for 'global' path "<<x<<" is: "<<nModules_.at(x);
455 
456  if (nModules_.at(x)>max_nModules_) max_nModules_=nModules_.at(x);
457 
458  if (moduleLabelORIG_.at(i).size()>moduleLabelNEW_.at(j).size()) nModules_diff_.push_back(moduleLabelORIG_.at(i).size()-moduleLabelNEW_.at(j).size());
459  else nModules_diff_.push_back(moduleLabelNEW_.at(j).size()-moduleLabelORIG_.at(i).size());
460  LogDebug("")<<"nModules_diff is: "<<nModules_diff_.at(x)<<" for 'global' path "<<x;
461 
462  temp_.clear();
463  for (unsigned int a=0; a<moduleLabelORIG_.at(i).size(); a++) {
464  for (unsigned int b=0; b<moduleLabelNEW_.at(j).size(); b++) {
465  //match ORIG and NEW module labels
466  //since a module can be run twice per path, but not usually right after one another,
467  //require that a and b be fairly close to each other, +/- the difference in the number of modules run NEW vs ORIG,
468  //to avoid double-counting modules that are repeated later in the path
469  //also, since we need to work with unsigned ints, a or b could also be 0, ignoring the requirement described above
470  if ( (moduleLabelORIG_.at(i).at(a)==moduleLabelNEW_.at(j).at(b)) && ( (b<=a+nModules_diff_.at(x) && b>=a-nModules_diff_.at(x)) || (a==0 || b==0) ) ){
471  temp_.push_back(moduleLabelORIG_.at(i).at(a));
472  if (a!=b){
473  edm::LogInfo("PathInfo")<<"For path "<<triggerNamesORIG_.at(i)<<" in ORIG and "<<triggerNamesNEW_.at(j)<<" in NEW:"<<" module "<<moduleLabelORIG_.at(i).at(a)<<" corresponds to module number "<<a<<" for ORIG and module number "<<b<<" for NEW";
474  }
475  }
476  }
477  }
478  moduleLabel_.push_back(temp_);
479  }
480  }
481  }
482  }
483 
484 
485  //----------------------------------------------------------------------------------------------------------
486 
487  //if everything is good:
488  //save path and module names to be used in event loop, print out the module names and types for each path
489  //get paths in each dataset
490  if (TriggerModuleNamesOK_){
491 
492  //------------all paths--------------
493  edm::LogInfo("PathInfo")<<"There are "<<nPaths_<<" paths in total";
494  edm::LogInfo("PathInfo")<<"Maximum number of modules over all paths is: "<<max_nModules_;
495 
496  for (unsigned int x=0; x<nPaths_; x++) {
497  trigger_ORIG_.push_back(0);
498  trigger_NEW_.push_back(0);
499  edm::LogInfo("PathInfo")<<"For "<<triggerNames_.at(x)<<" (trigger number "<<x<<"), there are "<<nModules_.at(x)<<" modules:";
500  for (unsigned int j=0; j<nModules_.at(x); j++) {
501  const string& moduleType_ = hltConfig_.moduleType(moduleLabel_.at(x).at(j));
502  edm::LogInfo("PathInfo")<<" module "<<j<<" is "<<moduleLabel_.at(x).at(j)<<" and is of type "<<moduleType_;
503  }
504  }
505 
506 
507  //---------paths per dataset-------------------------------------------
508  //get datasets, initialize max_nModules_PD_
510  nDatasets_ = datasetNames_.size();
511  for (unsigned int a=0; a<nDatasets_; a++) {
512  max_nModules_PD_.push_back(0);
513  }
514 
515  //loop over datasets, paths in each dataset
516  for (unsigned int a=0; a<nDatasets_; a++) {
517  temp_.clear();
518  vector<string> datasetcontent_ = hltConfig_.datasetContent(a);
519  nPaths_PD_.push_back(datasetcontent_.size());
520  edm::LogInfo("DatasetInfo")<<"For dataset "<<datasetNames_.at(a)<<" (dataset number "<<a<<"), there are "<<nPaths_PD_.at(a)<<" paths:";
521  for (unsigned int b=0; b<nPaths_PD_.at(a); b++) {
522  edm::LogInfo("DatasetInfo")<<" path "<<b<<" is "<<datasetcontent_.at(b);
523  temp_.push_back(datasetcontent_.at(b));
524  }
525  datasetContent_.push_back(temp_);
526  }
527 
528  //match trigger names in full list to trigger names per dataset; find max number of modules over all triggers in each dataset
529  //find matches
530  vector <vector<bool> > temp1_;
531  vector<bool> temp2_;
532  for (unsigned int x=0; x<nPaths_; x++) {
533  temp1_.clear();
534  for (unsigned int a=0; a<nDatasets_; a++) {
535  temp2_.clear();
536  for (unsigned int b=0; b<nPaths_PD_.at(a); b++) {
537  if (triggerNames_.at(x)==datasetContent_.at(a).at(b)){
538  temp2_.push_back(true);
539  LogDebug("")<<"Matched trigger name is: "<<datasetContent_.at(a).at(b)<<" for dataset "<<a<<" and dataset path "<<b;
540  }
541  else temp2_.push_back(false);
542  }
543  temp1_.push_back(temp2_);
544  }
545  triggerNames_matched_.push_back(temp1_);
546  }
547 
548  //if matched and # of modules is bigger than all previous ones, take that number as new maximum
549  for (unsigned int x=0; x<nPaths_; x++) {
550  for (unsigned int a=0; a<nDatasets_; a++) {
551  for (unsigned int b=0; b<nPaths_PD_.at(a); b++) {
552  if (triggerNames_matched_.at(x).at(a).at(b) && nModules_.at(x)>max_nModules_PD_.at(a)) max_nModules_PD_.at(a)=nModules_.at(x);
553  }
554  }
555  }
556 
557  //for (unsigned int a=0; a<nDatasets_; a++) {
558  //LogDebug("")<<"For dataset "<<datasetNames_.at(a)<<", the max number of modules is: "<<max_nModules_PD_.at(a);
559  //}
560 
561  }//end if all triggers and modules match from ORIG to NEW
562 
563 
564  //----------------------------------------------------------------------------------------------------------
565 
566  //define histograms
567 
568  //all paths
569  if(dqm_){
570  if (not dqms_) return;
571  dqms_->setCurrentFolder("DQMExample/DQMSource_HLTOfflineReproducibility");
572 
573  path_ORIG_hist = dqms_->book1D("path_ORIG_hist","Total Times Path Fires in ORIG",nPaths_,0,nPaths_)->getTH1F();
574  path_ORIGnotNEW_hist = dqms_->book1D("path_ORIGnotNEW_hist","Path fires in ORIG but not in NEW",nPaths_,0,nPaths_)->getTH1F();
575  path_NEWnotORIG_hist = dqms_->book1D("path_NEWnotORIG_hist","Path fires in NEW but not in ORIG",nPaths_,0,nPaths_)->getTH1F();
576  pathmodule_ORIGnotNEW_hist = dqms_->book2D("pathmodule_ORIGnotNEW_hist","Last run module index vs Path for NEW, when ORIG fired but NEW didn't",nPaths_,0,nPaths_,max_nModules_,0,max_nModules_)->getTH2F();
577  pathmodule_NEWnotORIG_hist = dqms_->book2D("pathmodule_NEWnotORIG_hist","Last run module index vs Path for ORIG, when NEW fired but ORIG didn't",nPaths_,0,nPaths_,max_nModules_,0,max_nModules_)->getTH2F();
578  }
579  else{
580  path_ORIG_hist = fs->make<TH1F>("path_ORIG_hist", "Total Times ORIG Path Fires in ORIG", nPaths_, 0, nPaths_);
581  path_ORIGnotNEW_hist = fs->make<TH1F>("path_ORIGnotNEW_hist", "Path fires in ORIG but not in NEW", nPaths_, 0, nPaths_);
582  path_NEWnotORIG_hist = fs->make<TH1F>("path_NEWnotORIG_hist", "Path fires in NEW but not in ORIG", nPaths_, 0, nPaths_);
583  pathmodule_ORIGnotNEW_hist = fs->make<TH2F>("pathmodule_ORIGnotNEW_hist", "Last run module index vs Path for NEW, when ORIG fired but NEW didn't", nPaths_, 0, nPaths_, max_nModules_, 0, max_nModules_);
584  pathmodule_NEWnotORIG_hist = fs->make<TH2F>("pathmodule_NEWnotORIG_hist", "Last run module index vs Path for ORIG, when NEW fired but ORIG didn't", nPaths_, 0, nPaths_, max_nModules_, 0, max_nModules_);
585  }
586 
587  //paths per dataset
588  char folder_name[500];
589  char path_ORIG_name[100], path_ORIGnotNEW_name[100], path_NEWnotORIG_name[100], pathmodule_ORIGnotNEW_name[100], pathmodule_NEWnotORIG_name[100];
590  for (unsigned int a = 0; a < nDatasets_; ++a) {
591  snprintf(path_ORIG_name, 100, "path_ORIG_hist_%s", datasetNames_.at(a).c_str());
592  snprintf(path_ORIGnotNEW_name, 100, "path_ORIGnotNEW_hist_%s", datasetNames_.at(a).c_str());
593  snprintf(path_NEWnotORIG_name, 100, "path_NEWnotORIG_hist_%s", datasetNames_.at(a).c_str());
594  snprintf(pathmodule_ORIGnotNEW_name, 100, "pathmodule_ORIGnotNEW_hist_%s", datasetNames_.at(a).c_str());
595  snprintf(pathmodule_NEWnotORIG_name, 100, "pathmodule_NEWnotORIG_hist_%s", datasetNames_.at(a).c_str());
596 
597  TString path_ORIG_title = "Total Times Path Fires ORIG (" + datasetNames_.at(a) + " dataset)";
598  TString path_ORIGnotNEW_title = "Path fires in ORIG but not in NEW (" + datasetNames_.at(a) + " dataset)";
599  TString path_NEWnotORIG_title = "Path fires in NEW but not in ORIG (" + datasetNames_.at(a) + " dataset)";
600  TString pathmodule_ORIGnotNEW_title = "Last run module index vs Path for NEW, when ORIG fired but NEW didn't (" + datasetNames_.at(a) + " dataset)";
601  TString pathmodule_NEWnotORIG_title = "Last run module index vs Path for ORIG, when NEW fired but ORIG didn't (" + datasetNames_.at(a) + " dataset)";
602 
603  if(dqm_){
604  sprintf(folder_name,"DQMExample/DQMSource_HLTOfflineReproducibility/%s",datasetNames_.at(a).c_str());
605  dqms_->setCurrentFolder(folder_name);
606 
607  path_ORIG_hist_PD.push_back(dqms_->book1D(path_ORIG_name,path_ORIG_title,nPaths_PD_.at(a),0,nPaths_PD_.at(a))->getTH1F());
608  path_ORIGnotNEW_hist_PD.push_back(dqms_->book1D(path_ORIGnotNEW_name,path_ORIGnotNEW_title,nPaths_PD_.at(a),0,nPaths_PD_.at(a))->getTH1F());
609  path_NEWnotORIG_hist_PD.push_back(dqms_->book1D(path_NEWnotORIG_name,path_NEWnotORIG_title,nPaths_PD_.at(a),0,nPaths_PD_.at(a))->getTH1F());
610  pathmodule_ORIGnotNEW_hist_PD.push_back(dqms_->book2D(pathmodule_ORIGnotNEW_name,pathmodule_ORIGnotNEW_title,nPaths_PD_.at(a),0,nPaths_PD_.at(a),max_nModules_PD_.at(a),0,max_nModules_PD_.at(a))->getTH2F());
611  pathmodule_NEWnotORIG_hist_PD.push_back(dqms_->book2D(pathmodule_NEWnotORIG_name,pathmodule_NEWnotORIG_title,nPaths_PD_.at(a),0,nPaths_PD_.at(a),max_nModules_PD_.at(a),0,max_nModules_PD_.at(a))->getTH2F());
612  }
613  else{
614  sprintf(folder_name,"%s",datasetNames_.at(a).c_str());
615  TFileDirectory subDir = fs->mkdir(folder_name);
616 
617  path_ORIG_hist_PD.push_back(subDir.make<TH1F>(path_ORIG_name, path_ORIG_title, nPaths_PD_.at(a), 0, nPaths_PD_.at(a)));
618  path_ORIGnotNEW_hist_PD.push_back(subDir.make<TH1F>(path_ORIGnotNEW_name, path_ORIGnotNEW_title, nPaths_PD_.at(a), 0, nPaths_PD_.at(a)));
619  path_NEWnotORIG_hist_PD.push_back(subDir.make<TH1F>(path_NEWnotORIG_name, path_NEWnotORIG_title, nPaths_PD_.at(a), 0, nPaths_PD_.at(a)));
620  pathmodule_ORIGnotNEW_hist_PD.push_back(subDir.make<TH2F>(pathmodule_ORIGnotNEW_name, pathmodule_ORIGnotNEW_title, nPaths_PD_.at(a), 0, nPaths_PD_.at(a), max_nModules_PD_.at(a), 0, max_nModules_PD_.at(a)));
621  pathmodule_NEWnotORIG_hist_PD.push_back(subDir.make<TH2F>(pathmodule_NEWnotORIG_name, pathmodule_NEWnotORIG_title, nPaths_PD_.at(a), 0, nPaths_PD_.at(a), max_nModules_PD_.at(a), 0, max_nModules_PD_.at(a)));
622  }
623 
624  }
625 
626 }
627 
628 // ------------ method called when ending the processing of a run ------------
629 void
631 {
632  // if DQM was requested, check that the DQMService is available
633  if (dqm_ and not dqms_) return;
634 
635  //all paths
636  for (unsigned int x=0; x<nPaths_; x++) {
637  edm::LogInfo("OrigNewFired")<<triggerNames_.at(x)<<" ORIG accepts: "<<trigger_ORIG_.at(x)<<", NEW accepts: "<<trigger_NEW_.at(x);
638  path_ORIG_hist->GetXaxis()->SetBinLabel(x+1,triggerNames_.at(x).c_str());
639  path_ORIGnotNEW_hist->GetXaxis()->SetBinLabel(x+1,triggerNames_.at(x).c_str());
640  path_NEWnotORIG_hist->GetXaxis()->SetBinLabel(x+1,triggerNames_.at(x).c_str());
641  pathmodule_ORIGnotNEW_hist->GetXaxis()->SetBinLabel(x+1,triggerNames_.at(x).c_str());
642  pathmodule_NEWnotORIG_hist->GetXaxis()->SetBinLabel(x+1,triggerNames_.at(x).c_str());
643  }
644 
645  //paths per dataset
646  for (unsigned int a=0; a<nDatasets_; a++) {
647  for (unsigned int b=0; b<nPaths_PD_.at(a); b++) {
648  path_ORIG_hist_PD.at(a)->GetXaxis()->SetBinLabel(b+1,datasetContent_.at(a).at(b).c_str());
649  path_ORIGnotNEW_hist_PD.at(a)->GetXaxis()->SetBinLabel(b+1,datasetContent_.at(a).at(b).c_str());
650  path_NEWnotORIG_hist_PD.at(a)->GetXaxis()->SetBinLabel(b+1,datasetContent_.at(a).at(b).c_str());
651  pathmodule_ORIGnotNEW_hist_PD.at(a)->GetXaxis()->SetBinLabel(b+1,datasetContent_.at(a).at(b).c_str());
652  pathmodule_NEWnotORIG_hist_PD.at(a)->GetXaxis()->SetBinLabel(b+1,datasetContent_.at(a).at(b).c_str());
653  }
654  }
655 
656 }
657 
658 // ------------ method called when starting to processes a luminosity block ------------
659 void
661 {
662 }
663 
664 // ------------ method called when ending the processing of a luminosity block ------------
665 void
667 {
668 }
669 
670 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
671 void
673  //The following says we do not know what parameters are allowed so do no validation
674  // Please change this to state exactly what you do use, even if it is no parameters
676  desc.setUnknown();
677  descriptions.addDefault(desc);
678 }
679 
680 //define this as a plug-in
#define LogDebug(id)
unsigned int size() const
number of trigger paths in trigger table
virtual void beginRun(edm::Run const &, edm::EventSetup const &) override
int i
Definition: DBlmapReader.cc:9
const std::string moduleType(const std::string &module) const
C++ class name of module.
edm::EDGetTokenT< edm::TriggerResults > triggerTokenORIG_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const std::vector< std::string > & triggerNames() const
names of trigger paths
int init
Definition: HydjetWrapper.h:67
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
const std::string & moduleLabel(unsigned int trigger, unsigned int module) const
void beginJob()
Definition: Breakpoints.cc:15
edm::EDGetTokenT< edm::TriggerResults > triggerTokenNEW_
int iEvent
Definition: GenABIO.cc:230
unsigned int moduleIndex(unsigned int trigger, const std::string &module) const
slot position of module on trigger path (0 to size-1)
void addDefault(ParameterSetDescription const &psetDescription)
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
int j
Definition: DBlmapReader.cc:9
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
vector< vector< string > > moduleLabel_
vector< vector< string > > datasetContent_
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
const std::vector< std::string > & datasetContent(unsigned int dataset) const
names of trigger paths in dataset with index i
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
double b
Definition: hdecay.h:120
HLTOfflineReproducibility(const edm::ParameterSet &)
double a
Definition: hdecay.h:121
vector< vector< vector< bool > > > triggerNames_matched_
TH2F * getTH2F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
vector< vector< string > > moduleLabelORIG_
virtual void endRun(edm::Run const &, edm::EventSetup const &) override
tuple process
Definition: LaserDQM_cfg.py:3
moduleLabel_(iConfig.getParameter< string >("@module_label"))
Definition: Run.h:43
const std::vector< std::string > & datasetNames() const
vector< vector< string > > moduleLabelNEW_