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