CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgHLTOfflineClient.cc
Go to the documentation of this file.
2 
3 
8 
10 
13 
15 
17 
18 #include <boost/algorithm/string.hpp>
19 
20 #include "TGraphAsymmErrors.h"
21 
23 {
24  dbe_ = edm::Service<DQMStore>().operator->(); //only one chance to get this, if we every have another shot, remember to check isSetup is okay
25  if (!dbe_) {
26  edm::LogError("EgHLTOfflineClient") << "unable to get DQMStore service, upshot is no client histograms will be made";
27  }
28  if(iConfig.getUntrackedParameter<bool>("DQMStore", false)) {
29  if(dbe_) dbe_->setVerbose(0);
30  }
31 
32 
33  eleHLTFilterNames_ = iConfig.getParameter<std::vector<std::string> >("eleHLTFilterNames");
34  eleHLTFilterNames2Leg_ = iConfig.getParameter<std::vector<std::string> >("eleHLTFilterNames2Leg");
35  eleTightLooseTrigNames_ = iConfig.getParameter<std::vector<std::string> >("eleTightLooseTrigNames");
36  phoHLTFilterNames_ = iConfig.getParameter<std::vector<std::string> >("phoHLTFilterNames");
37  phoHLTFilterNames2Leg_ = iConfig.getParameter<std::vector<std::string> >("phoHLTFilterNames2Leg");
38  phoTightLooseTrigNames_ = iConfig.getParameter<std::vector<std::string> >("phoTightLooseTrigNames");
39 
40  eleN1EffVars_=iConfig.getParameter<std::vector<std::string> >("eleN1EffVars");
41  eleSingleEffVars_ = iConfig.getParameter<std::vector<std::string> >("eleSingleEffVars");
42  eleEffTags_ = iConfig.getParameter<std::vector<std::string> >("eleEffTags");
43  eleTrigTPEffVsVars_ = iConfig.getParameter<std::vector<std::string> >("eleTrigTPEffVsVars");
44  eleLooseTightTrigEffVsVars_ = iConfig.getParameter<std::vector<std::string> >("eleLooseTightTrigEffVsVars");
45  eleHLTvOfflineVars_ = iConfig.getParameter<std::vector<std::string> >("eleHLTvOfflineVars");
46 
47  phoN1EffVars_=iConfig.getParameter<std::vector<std::string> >("phoN1EffVars");
48  phoSingleEffVars_ = iConfig.getParameter<std::vector<std::string> >("phoSingleEffVars");
49  phoEffTags_ = iConfig.getParameter<std::vector<std::string> >("phoEffTags");
50  phoTrigTPEffVsVars_ = iConfig.getParameter<std::vector<std::string> >("phoTrigTPEffVsVars");
51  phoLooseTightTrigEffVsVars_ = iConfig.getParameter<std::vector<std::string> >("phoLooseTightTrigEffVsVars");
52  phoHLTvOfflineVars_ = iConfig.getParameter<std::vector<std::string> >("phoHLTvOfflineVars");
53 
54  runClientEndLumiBlock_ = iConfig.getParameter<bool>("runClientEndLumiBlock");
55  runClientEndRun_ = iConfig.getParameter<bool>("runClientEndRun");
56  runClientEndJob_ = iConfig.getParameter<bool>("runClientEndJob");
57 
58 
59 
60  dirName_=iConfig.getParameter<std::string>("DQMDirName");
61  if(dbe_) dbe_->setCurrentFolder(dirName_);
62 
63 
64  filterInactiveTriggers_ =iConfig.getParameter<bool>("filterInactiveTriggers");
65  hltTag_ = iConfig.getParameter<std::string>("hltTag");
66 
67 
68 }
69 
70 
72 {
73 
74 }
75 
77 {
78 
79 
80 }
81 
83 {
85 }
86 
88 {
89  if(!isSetup_){
92  bool changed=false;
93  hltConfig.init(run,c,hltTag_,changed);
94  std::vector<std::string> activeFilters;
95  std::vector<std::string> activeEleFilters;
96  std::vector<std::string> activeEle2LegFilters;
97  std::vector<std::string> activePhoFilters;
98  std::vector<std::string> activePho2LegFilters;
99  egHLT::trigTools::getActiveFilters(hltConfig,activeFilters,activeEleFilters,activeEle2LegFilters,activePhoFilters,activePho2LegFilters);
100 
106  }
107  isSetup_=true;
108  }
109 }
110 
111 
113 {
115 }
116 
117 //dummy analysis function
119 {
120 
121 }
122 
124 {
126 }
127 
129 {
130  if(!dbe_) return; //we dont have the DQMStore so we cant do anything
131  dbe_->setCurrentFolder(dirName_+"/Client_Histos");
132 
133 
134  std::vector<std::string> regions;
135  regions.push_back("eb");
136  regions.push_back("ee");
137 
138  for(size_t filterNr=0;filterNr<eleHLTFilterNames_.size();filterNr++){
139  //std::cout<<"FilterName: "<<eleHLTFilterNames_[filterNr]<<std::endl;
140  for(size_t regionNr=0;regionNr<regions.size();regionNr++){
141  for(size_t effNr=0;effNr<eleEffTags_.size();effNr++){
142  //----Morse----
143  dbe_->setCurrentFolder(dirName_+"/Client_Histos/"+eleHLTFilterNames_[filterNr]);
144  //--------------
145  createN1EffHists(eleHLTFilterNames_[filterNr],eleHLTFilterNames_[filterNr]+"_gsfEle_"+eleEffTags_[effNr],regions[regionNr],eleN1EffVars_);
146  createSingleEffHists(eleHLTFilterNames_[filterNr],eleHLTFilterNames_[filterNr]+"_gsfEle_"+eleEffTags_[effNr],regions[regionNr],eleSingleEffVars_);
147  createTrigTagProbeEffHistsNewAlgo(eleHLTFilterNames_[filterNr],regions[regionNr],eleTrigTPEffVsVars_,"gsfEle");
148  createHLTvsOfflineHists(eleHLTFilterNames_[filterNr],eleHLTFilterNames_[filterNr]+"_gsfEle_passFilter",regions[regionNr],eleHLTvOfflineVars_);
149  }
150  }
151  }
152  for(size_t filterNr=0;filterNr<eleHLTFilterNames2Leg_.size();filterNr++){
153  //std::cout<<"FilterName: "<<eleHLTFilterNames2Leg_[filterNr]<<std::endl;
154  for(size_t regionNr=0;regionNr<regions.size();regionNr++){
155  for(size_t effNr=0;effNr<eleEffTags_.size();effNr++){
156  std::string trigNameLeg1 = eleHLTFilterNames2Leg_[filterNr].substr(0,eleHLTFilterNames2Leg_[filterNr].find("::"));
157  std::string trigNameLeg2 = eleHLTFilterNames2Leg_[filterNr].substr(eleHLTFilterNames2Leg_[filterNr].find("::")+2);
158  dbe_->setCurrentFolder(dirName_+"/Client_Histos/"+trigNameLeg2);
159  createTrigTagProbeEffHists2Leg(trigNameLeg1,trigNameLeg2,regions[regionNr],eleTrigTPEffVsVars_,"gsfEle");
160  }
161  }
162  }
163  //------Morse
164  // dbe_->setCurrentFolder(dirName_);
165  //--------------
166 
167  for(size_t filterNr=0;filterNr<phoHLTFilterNames_.size();filterNr++){
168  for(size_t regionNr=0;regionNr<regions.size();regionNr++){
169  for(size_t effNr=0;effNr<phoEffTags_.size();effNr++){
170  //----Morse----
171  dbe_->setCurrentFolder(dirName_+"/Client_Histos/"+phoHLTFilterNames_[filterNr]);
172  //createN1EffHists(eleHLTFilterNames_[filterNr]+"_pho_"+phoEffTags_[effNr],regions[regionNr],phoN1EffVars_);
173  //createSingleEffHists(eleHLTFilterNames_[filterNr]+"_gsfEle_"+phoEffTags_[effNr],regions[regionNr],phoSingleEffVars_);
174  createN1EffHists(phoHLTFilterNames_[filterNr],phoHLTFilterNames_[filterNr]+"_pho_"+phoEffTags_[effNr],regions[regionNr],phoN1EffVars_);
175  createSingleEffHists(phoHLTFilterNames_[filterNr],phoHLTFilterNames_[filterNr]+"_pho_"+phoEffTags_[effNr],regions[regionNr],phoSingleEffVars_);
177  createHLTvsOfflineHists(phoHLTFilterNames_[filterNr],phoHLTFilterNames_[filterNr]+"_pho_passFilter",regions[regionNr],phoHLTvOfflineVars_);
178 
179  //--------------
180  }
181  }
182  }
183  //------Morse
184  // dbe_->setCurrentFolder(dirName_);
185  //--------------
186  for(size_t regionNr=0;regionNr<regions.size();regionNr++){
191  }
192  //----Morse-----
194  //----------
195 }
196 
197 void EgHLTOfflineClient::createHLTvsOfflineHists(const std::string& filterName,const std::string& baseName,const std::string& region,const std::vector<std::string>& varNames){
198  //need to do Energy manually to get SC Energy
199  /*
200  MonitorElement* numer = dbe_->get(dirName_+"/Source_Histos/"+filterName+"/"+baseName+"_HLTenergy"+"_"+region);
201  MonitorElement* denom = dbe_->get(dirName_+"/Source_Histos/"+filterName+"/"+baseName+"_energy"+"_"+region);
202 
203  if(numer!=NULL && denom!=NULL){
204  std::string effHistName(baseName+"_HLToverOfflineSC_energy_"+region);//std::cout<<"hltVSoffline: "<<effHistName<<std::endl;
205  std::string effHistTitle(effHistName);
206  if(region=="eb" || region=="ee"){
207  if(region=="eb") effHistTitle = "Barrel "+baseName+" HLToverOfflineSC Energy";
208  if(region=="ee") effHistTitle = "Endcap "+baseName+" HLToverOfflineSC Energy";
209  FillHLTvsOfflineHist(filterName,effHistName,effHistTitle,numer,denom);
210  }
211  }//end Et
212  */
213  //now eta, phi automatically
214  for(size_t varNr=0;varNr<varNames.size();varNr++){
215  MonitorElement* numer = dbe_->get(dirName_+"/Source_Histos/"+filterName+"/"+baseName+"_HLT"+varNames[varNr]+"_"+region);
216  MonitorElement* denom = dbe_->get(dirName_+"/Source_Histos/"+filterName+"/"+baseName+"_"+varNames[varNr]+"_"+region);
217  if(numer!=NULL && denom!=NULL){
218  std::string effHistName(baseName+"_HLToverOffline_"+varNames[varNr]+"_"+region);//std::cout<<"hltVSoffline: "<<effHistName<<std::endl;
219  std::string effHistTitle(effHistName);
220  if(region=="eb" || region=="ee"){
221  if(region=="eb") effHistTitle = "Barrel "+baseName+" HLToverOffline "+varNames[varNr];
222  if(region=="ee") effHistTitle = "Endcap "+baseName+" HLToverOffline "+varNames[varNr];
223  FillHLTvsOfflineHist(filterName,effHistName,effHistTitle,numer,denom);
224  }
225  }
226  }//end loop over varNames
227 }
229  TH1F* num = numer->getTH1F();if(num->GetSumw2N()==0) num->Sumw2();
230  TH1F* den = denom->getTH1F();if(den->GetSumw2N()==0) den->Sumw2();
231  TH1F* h_eff = (TH1F*)num->Clone(name.c_str());
232  h_eff->Divide(num,den,1,1,"B");
233  h_eff->SetTitle(title.c_str());
234  MonitorElement* eff = dbe_->get(dirName_+"/Client_Histos/"+filter+"/"+name);
235  if(eff==NULL)eff=dbe_->book1D(name,h_eff);
236  else{ //I was having problems with collating the histograms, hence why I'm just resetting the histogram value
237  *eff->getTH1F()=*h_eff;
238  delete h_eff;
239  }
240  return eff;
241 }
242 
243 void EgHLTOfflineClient::createN1EffHists(const std::string& filterName,const std::string& baseName,const std::string& region,const std::vector<std::string>& varNames)
244 {
245  MonitorElement* numer = dbe_->get(dirName_+"/Source_Histos/"+filterName+"/"+baseName+"_allCuts_"+region);
246 
247  for(size_t varNr=0;varNr<varNames.size();varNr++){
248  MonitorElement* denom = dbe_->get(dirName_+"/Source_Histos/"+filterName+"/"+baseName+"_n1_"+varNames[varNr]+"_"+region);
249  if(numer!=NULL && denom!=NULL){
250  std::string effHistName(baseName+"_n1Eff_"+varNames[varNr]+"_"+region);//std::cout<<"N1: "<<effHistName<<std::endl;
251  //std::cout<<region<<" ";
252  //----Morse-----------
253  std::string effHistTitle(effHistName);//std::cout<<effHistTitle<<std::endl;
254  if(region=="eb" || region=="ee"){
255  if(region=="eb") effHistTitle = "Barrel "+baseName+" N1eff "+varNames[varNr];
256  if(region=="ee") effHistTitle = "Endcap "+baseName+" N1eff "+varNames[varNr];
257  }//std::cout<<effHistTitle<<std::endl;
258  //makeEffMonElemFromPassAndAll(effHistName,numer,denom);
259  makeEffMonElemFromPassAndAll(filterName,effHistName,effHistTitle,numer,denom);
260  //---------------------
261  }
262  }//end loop over varNames
263 }
264 
265 void EgHLTOfflineClient::createSingleEffHists(const std::string& filterName,const std::string& baseName,const std::string& region,const std::vector<std::string>& varNames)
266 {
267  MonitorElement* denom = dbe_->get(dirName_+"/Source_Histos/"+filterName+"/"+baseName+"_noCuts_"+region);
268 
269  for(size_t varNr=0;varNr<varNames.size();varNr++){
270  MonitorElement* numer = dbe_->get(dirName_+"/Source_Histos/"+filterName+"/"+baseName+"_single_"+varNames[varNr]+"_"+region);
271  if(numer!=NULL && denom!=NULL){
272  std::string effHistName(baseName+"_singleEff_"+varNames[varNr]+"_"+region);//std::cout<<"Si: "<<effHistName<<std::endl;
273  //----Morse-----------
274  std::string effHistTitle(effHistName);//std::cout<<effHistTitle<<std::endl;
275  if(region=="eb" || region=="ee"){
276  if(region=="eb") effHistTitle = "Barrel "+baseName+" SingleEff "+varNames[varNr];
277  if(region=="ee") effHistTitle = "Endcap "+baseName+" SingleEff "+varNames[varNr];
278  }//std::cout<<effHistTitle<<std::endl;
279  //makeEffMonElemFromPassAndAll(effHistName,numer,denom);
280  makeEffMonElemFromPassAndAll(filterName,effHistName,effHistTitle,numer,denom);
281  //--------------------
282  }
283  }//end loop over varNames
284 }
285 
286 void EgHLTOfflineClient::createTrigTagProbeEffHists(const std::string& filterName,const std::string& region,const std::vector<std::string>& vsVarNames,const std::string& objName)
287 {
288  for(size_t varNr=0;varNr<vsVarNames.size();varNr++){
289  std::string allName(dirName_+"/Source_Histos/"+filterName+"/"+filterName+"_trigTagProbe_"+objName+"_all_"+vsVarNames[varNr]+"_"+region);
290  MonitorElement* all = dbe_->get(allName);
291  if(all==NULL){
292  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<allName;
293  continue;
294  }
295  std::string passName(dirName_+"/Source_Histos/"+filterName+"/"+filterName+"_trigTagProbe_"+objName+"_pass_"+vsVarNames[varNr]+"_"+region);
296  MonitorElement* pass = dbe_->get(passName);
297  if(pass==NULL){
298  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<passName;
299  continue;
300  }
301  //----Morse-----
302  std::string effHistTitle(filterName+"_trigTagProbeEff_"+objName+"_vs_"+vsVarNames[varNr]+"_"+region);//std::cout<<effHistTitle<<std::endl;
303  if(region=="eb" || region=="ee"){
304  if(region=="eb") effHistTitle = "Barrel "+filterName+"_"+objName+" TrigTagProbeEff vs "+vsVarNames[varNr];
305  if(region=="ee") effHistTitle = "Endcap "+filterName+"_"+objName+" TrigTagProbeEff vs "+vsVarNames[varNr];
306  }//std::cout<<effHistTitle<<std::endl;
307  //------------
308  makeEffMonElemFromPassAndAll(filterName,filterName+"_trigTagProbeEff_"+objName+"_vs_"+vsVarNames[varNr]+"_"+region,effHistTitle,pass,all);
309  }//end loop over vsVarNames
310 }
311 
312 void EgHLTOfflineClient::createTrigTagProbeEffHistsNewAlgo(const std::string& filterName,const std::string& region,const std::vector<std::string>& vsVarNames,const std::string& objName)
313 {
314  for(size_t varNr=0;varNr<vsVarNames.size();varNr++){
315  /*
316  std::string allName(dirName_+"/Source_Histos/"+filterName+"/"+filterName+"_trigTagProbe_"+objName+"_all_"+vsVarNames[varNr]+"_"+region);
317  MonitorElement* all = dbe_->get(allName);
318  if(all==NULL){
319  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<allName;
320  continue;
321  }*/
322  std::string passName(dirName_+"/Source_Histos/"+filterName+"/"+filterName+"_trigTagProbe_"+objName+"_passNotTag_"+vsVarNames[varNr]+"_"+region);
323  MonitorElement* passNotTag = dbe_->get(passName);
324  if(passNotTag==NULL){
325  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<passName;
326  continue;
327  }
328  std::string passTagTagName(dirName_+"/Source_Histos/"+filterName+"/"+filterName+"_trigTagProbe_"+objName+"_passTagTag_"+vsVarNames[varNr]+"_"+region);
329  MonitorElement* passTagTag = dbe_->get(passTagTagName);
330  if(passTagTag==NULL){
331  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<passTagTagName;
332  continue;
333  }
334  std::string failName(dirName_+"/Source_Histos/"+filterName+"/"+filterName+"_trigTagProbe_"+objName+"_fail_"+vsVarNames[varNr]+"_"+region);
335  MonitorElement* fail = dbe_->get(failName);
336  if(fail==NULL){
337  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<failName;
338  continue;
339  }
340  //----Morse-----
341  std::string effHistTitle(filterName+"_trigTagProbeEff_"+objName+"_vs_"+vsVarNames[varNr]+"_"+region);//std::cout<<effHistTitle<<std::endl;
342  if(region=="eb" || region=="ee"){
343  if(region=="eb") effHistTitle = "Barrel "+filterName+"_"+objName+" TrigTagProbeEff vs "+vsVarNames[varNr];
344  if(region=="ee") effHistTitle = "Endcap "+filterName+"_"+objName+" TrigTagProbeEff vs "+vsVarNames[varNr];
345  }//std::cout<<effHistTitle<<std::endl;
346  //------------
347  makeEffMonElemFromPassAndFailAndTagTag(filterName,filterName+"_trigTagProbeEff_"+objName+"_vs_"+vsVarNames[varNr]+"_"+region,effHistTitle,passNotTag,fail,passTagTag);
348  }//end loop over vsVarNames
349 }
350 
351 void EgHLTOfflineClient::createTrigTagProbeEffHists2Leg(const std::string& filterNameLeg1,const std::string& filterNameLeg2,const std::string& region,const std::vector<std::string>& vsVarNames,const std::string& objName)
352 {
353  for(size_t varNr=0;varNr<vsVarNames.size();varNr++){
354 
355  std::string allName(dirName_+"/Source_Histos/"+filterNameLeg2+"/"+filterNameLeg2+"_trigTagProbe_"+objName+"_all_"+vsVarNames[varNr]+"_"+region);
356  MonitorElement* all = dbe_->get(allName);
357  if(all==NULL){
358  edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<allName;
359  continue;
360  }
361  std::string Leg2NotLeg1SourceName(dirName_+"/Source_Histos/"+filterNameLeg2+"/"+filterNameLeg2+"_trigTagProbe_"+objName+"_passLeg2failLeg1_"+vsVarNames[varNr]+"_"+region);
362  MonitorElement* Leg2NotLeg1Source = dbe_->get(Leg2NotLeg1SourceName);
363  if(Leg2NotLeg1Source==NULL){
364  edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<Leg2NotLeg1SourceName;
365  continue;
366  }
367 
368  std::string Leg1EffName(dirName_+"/Client_Histos/"+filterNameLeg1+"/"+filterNameLeg1+"_trigTagProbeEff_"+objName+"_vs_"+vsVarNames[varNr]+"_"+region);
369  MonitorElement *Leg1Eff = dbe_->get(Leg1EffName);
370  if(Leg1Eff==NULL){
371  edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<Leg1EffName;
372  continue;
373  }
374  std::string effHistTitle(filterNameLeg2+"_trigTagProbeEff2Leg_"+objName+"_vs_"+vsVarNames[varNr]+"_"+region);//std::cout<<effHistTitle<<std::endl;
375  if(region=="eb" || region=="ee"){
376  if(region=="eb") effHistTitle = "Barrel "+filterNameLeg2+"_"+objName+" TrigTagProbeEff2Leg vs "+vsVarNames[varNr];
377  if(region=="ee") effHistTitle = "Endcap "+filterNameLeg2+"_"+objName+" TrigTagProbeEff2Leg vs "+vsVarNames[varNr];
378  }//std::cout<<effHistTitle<<std::endl;
379  makeEffMonElem2Leg(filterNameLeg2,filterNameLeg2+"_trigTagProbeEff2Leg_"+objName+"_vs_"+vsVarNames[varNr]+"_"+region,effHistTitle,Leg1Eff,Leg2NotLeg1Source,all);
380  }//end loop over vsVarNames
381 }
382 
383 
384 void EgHLTOfflineClient::createLooseTightTrigEff(const std::vector<std::string>& tightLooseTrigNames,const std::string& region,const std::vector<std::string>& vsVarNames,const std::string& objName)
385 {
386  for(size_t varNr=0;varNr<vsVarNames.size();varNr++){
387  for(size_t trigNr=0;trigNr<tightLooseTrigNames.size();trigNr++){
388  std::vector<std::string> splitString;
389  boost::split(splitString,tightLooseTrigNames[trigNr],boost::is_any_of(std::string(":")));
390  if(splitString.size()!=2) continue; //format incorrect
391  const std::string& tightTrig = splitString[0];
392  const std::string& looseTrig = splitString[1];
393  MonitorElement* fail = dbe_->get(dirName_+"/Source_Histos/"+tightTrig+"_"+looseTrig+"_"+objName+"_failTrig_"+vsVarNames[varNr]+"_"+region);
394  if(fail==NULL){
395  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<dirName_+"/"+tightTrig+"_"+looseTrig+"_"+objName+"_failTrig_"+vsVarNames[varNr]+"_"+region;
396 
397  continue;
398  }
399 
400  MonitorElement* pass = dbe_->get(dirName_+"/Source_Histos/"+tightTrig+"_"+looseTrig+"_"+objName+"_passTrig_"+vsVarNames[varNr]+"_"+region);
401  if(pass==NULL){
402 
403  //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<dirName_+"/"+tightTrig+"_"+looseTrig+"_"+objName+"_passTrig_"+vsVarNames[varNr]+"_"+region;
404  continue;
405  }
406  const std::string newHistName(tightTrig+"_trigEffTo_"+looseTrig+"_"+objName+"_vs_"+vsVarNames[varNr]+"_"+region);
407  //----Morse-----
408  std::string effHistTitle(newHistName);//std::cout<<effHistTitle<<std::endl;
409  if(region=="eb" || region=="ee"){
410  if(region=="eb") effHistTitle = "Barrel "+tightTrig+"_TrigEffTo_"+looseTrig+"_"+objName+" vs "+vsVarNames[varNr];
411  if(region=="ee") effHistTitle = "Endcap "+tightTrig+"_TrigEffTo_"+looseTrig+"_"+objName+" vs "+vsVarNames[varNr];
412  }
413  //std::cout<<effHistTitle<<std::endl;
414  //dbe_->setCurrentFolder(dirName_+"/"+tightTrig+"_"+looseTrig);
415  //------------
416  makeEffMonElemFromPassAndFail("LooseTight",newHistName,effHistTitle,pass,fail);
417  }//end loop over trigger pairs
418  } //end loop over vsVarNames
419 
420 }
421 //-----Morse-------
422 //MonitorElement* EgHLTOfflineClient::makeEffMonElemFromPassAndAll(const std::string& name,const MonitorElement* pass,const MonitorElement* all)
424 //-----------------
425 {
426  TH1F* passHist = pass->getTH1F();
427  if(passHist->GetSumw2N()==0) passHist->Sumw2();
428  TH1F* allHist = all->getTH1F();
429  if(allHist->GetSumw2N()==0) allHist->Sumw2();
430  TH1F* effHist = (TH1F*) passHist->Clone(name.c_str());
431  effHist->Divide(passHist,allHist,1,1,"B");
432  //----Morse---------
433  effHist->SetTitle(title.c_str());
434  //------------------
435  MonitorElement* eff = dbe_->get(dirName_+"/Client_Histos/"+filterName+"/"+name);
436  if(eff==NULL) eff= dbe_->book1D(name,effHist);
437  else{ //I was having problems with collating the histograms, hence why I'm just resetting the histogram value
438  *eff->getTH1F()=*effHist;
439  delete effHist;
440  }
441  return eff;
442 }
443 
445 //-----------------
446 {
447  TH1F* passHist = passNotTag->getTH1F();
448  if(passHist->GetSumw2N()==0) passHist->Sumw2();
449  TH1F* failHist = fail->getTH1F();
450  if(failHist->GetSumw2N()==0) failHist->Sumw2();
451  TH1F* tagtagHist = tagtag->getTH1F();
452  if(tagtagHist->GetSumw2N()==0) tagtagHist->Sumw2();
453  TH1F* numer = (TH1F*) passHist->Clone(name.c_str());if(numer->GetSumw2N()==0) numer->Sumw2();
454  numer->Add(tagtagHist,passHist,2,1);
455  TH1F* denom = (TH1F*) passHist->Clone(name.c_str());if(denom->GetSumw2N()==0) denom->Sumw2();
456  denom->Add(tagtagHist,passHist,2,1);
457  denom->Add(failHist,1);
458  TH1F* effHist = (TH1F*) passHist->Clone(name.c_str());
459  //TGraphAsymmErrors *effHist = new TGraphAsymmErrors(numer,denom,"cl=0.683 b(1,1) mode");
460  effHist->Divide(numer,denom,1,1,"B");
461  //effHist->Divide(numer,denom,"cl=0.683 b(1,1) mode");
462  //----Morse---------
463  effHist->SetTitle(title.c_str());
464  //------------------
465  MonitorElement* eff = dbe_->get(dirName_+"/Client_Histos/"+filter+"/"+name);
466  if(eff==NULL) eff= dbe_->book1D(name,effHist);
467  //if(eff==NULL) eff = dbe_->bookGraphAsymmErrors(name,effHist);
468  else{ //I was having problems with collating the histograms, hence why I'm just resetting the histogram value
469  *eff->getTH1F()=*effHist;
470  //*eff->getTGraphAsymmErrors()=*effHist;
471  delete effHist;
472  }
473  return eff;
474 }
476 {
477  TH1F* allHist = all->getTH1F();
478  if(allHist->GetSumw2()==0)allHist->Sumw2();
479  TH1F* Leg2NotLeg1SourceHist = Leg2NotLeg1Source->getTH1F();
480  if(Leg2NotLeg1SourceHist->GetSumw2()==0)Leg2NotLeg1SourceHist->Sumw2();
481 
482  TH1F* effHistLeg2NotLeg1 = (TH1F*)allHist->Clone(name.c_str());
483  if(effHistLeg2NotLeg1->GetSumw2()==0)effHistLeg2NotLeg1->Sumw2();
484  effHistLeg2NotLeg1->Divide(Leg2NotLeg1SourceHist, allHist, 1, 1, "B");
485 
486  TH1F* Leg1EffHist = Leg1Eff->getTH1F();
487  if(Leg1EffHist->GetSumw2()==0)Leg1EffHist->Sumw2();
488 
489  TH1F* effHistTerm1 = (TH1F*)allHist->Clone(name.c_str());
490  if(effHistTerm1->GetSumw2()==0)effHistTerm1->Sumw2();
491  effHistTerm1->Multiply(Leg1EffHist, Leg1EffHist, 1, 1, "B");
492 
493  TH1F* effHistTerm2 = (TH1F*)allHist->Clone(name.c_str());
494  if(effHistTerm2->GetSumw2()==0)effHistTerm2->Sumw2();
495  effHistTerm2->Multiply(Leg1EffHist, effHistLeg2NotLeg1, 1, 1, "B");
496  effHistTerm2->Scale(2);
497 
498  TH1F* effHist = (TH1F*)allHist->Clone(name.c_str());
499  if(effHist->GetSumw2()==0)effHist->Sumw2();
500  effHist->Add(effHistTerm1, effHistTerm2, 1, 1);
501  effHist->SetTitle(title.c_str());
502 
503  MonitorElement* eff = dbe_->get(dirName_+"/Client_Histos/"+filter+"/"+name);
504  if(eff==NULL) eff= dbe_->book1D(name,effHist);
505  else{ //I was having problems with collating the histograms, hence why I'm just resetting the histogram value
506  *eff->getTH1F()=*effHist;
507  delete effHist;
508  }
509  return eff;
510 }
511 
512 //-----Morse-------
513 //MonitorElement* EgHLTOfflineClient::makeEffMonElemFromPassAndFail(const std::string& name,const MonitorElement* pass,const MonitorElement* fail)
515 //-------------
516 {
517  TH1F* failHist = fail->getTH1F();
518  if(failHist->GetSumw2N()==0) failHist->Sumw2();
519  TH1F* passHist = pass->getTH1F();
520  if(passHist->GetSumw2N()==0) passHist->Sumw2();
521 
522  TH1F* effHist = (TH1F*) passHist->Clone(name.c_str());
523  effHist->Add(failHist);
524  effHist->Divide(passHist,effHist,1,1,"B");
525  //----Morse---------
526  effHist->SetTitle(title.c_str());
527  //------------------
528  MonitorElement* eff = dbe_->get(dirName_+"/Client_Histos/"+filterName+"/"+name);
529  if(eff==NULL) eff = dbe_->book1D(name,effHist);
530  else{ //I was having problems with collating the histograms, hence why I'm just reseting the histogram value
531  *eff->getTH1F()=*effHist;
532  delete effHist;
533  }
534  return eff;
535 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void beginJob()
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:975
std::vector< std::string > eleHLTFilterNames_
std::vector< std::string > phoHLTFilterNames2Leg_
void createSingleEffHists(const std::string &filterName, const std::string &baseName, const std::string &region, const std::vector< std::string > &varNames)
std::vector< std::string > phoLooseTightTrigEffVsVars_
void createN1EffHists(const std::string &filterName, const std::string &baseName, const std::string &region, const std::vector< std::string > &varNames)
#define NULL
Definition: scimark2.h:8
EgHLTOfflineClient(const EgHLTOfflineClient &rhs)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< std::string > splitString(const std::string &fLine)
std::vector< std::string > phoTrigTPEffVsVars_
std::vector< std::string > eleTightLooseTrigNames_
MonitorElement * FillHLTvsOfflineHist(const std::string &filter, const std::string &name, const std::string &title, const MonitorElement *numer, const MonitorElement *denom)
std::vector< std::string > phoN1EffVars_
std::vector< std::string > eleHLTvOfflineVars_
void createTrigTagProbeEffHistsNewAlgo(const std::string &filterName, const std::string &region, const std::vector< std::string > &vsVarNames, const std::string &objName)
int iEvent
Definition: GenABIO.cc:230
std::vector< std::string > eleTrigTPEffVsVars_
void setVerbose(unsigned level)
Definition: DQMStore.cc:652
std::vector< std::string > phoEffTags_
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1729
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
DQMStore * dbe_
std::vector< std::string > phoSingleEffVars_
MonitorElement * makeEffMonElemFromPassAndAll(const std::string &filterName, const std::string &name, const std::string &title, const MonitorElement *pass, const MonitorElement *all)
void createTrigTagProbeEffHists(const std::string &filterName, const std::string &region, const std::vector< std::string > &vsVarNames, const std::string &objName)
void createHLTvsOfflineHists(const std::string &filterName, const std::string &baseName, const std::string &region, const std::vector< std::string > &varNames)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * makeEffMonElemFromPassAndFail(const std::string &filterName, const std::string &name, const std::string &title, const MonitorElement *pass, const MonitorElement *fail)
void getActiveFilters(const HLTConfigProvider &hltConfig, std::vector< std::string > &activeFilters, std::vector< std::string > &activeEleFilters, std::vector< std::string > &activeEle2LegFilters, std::vector< std::string > &activePhoFilters, std::vector< std::string > &activePho2LegFilters)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
char const * varNames[]
TH1F * getTH1F(void) const
virtual void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
virtual void endRun(const edm::Run &run, const edm::EventSetup &c)
std::vector< std::string > eleN1EffVars_
std::vector< std::string > phoTightLooseTrigNames_
std::vector< std::string > phoHLTvOfflineVars_
void createTrigTagProbeEffHists2Leg(const std::string &filterNameLeg1, const std::string &filterNameLeg2, const std::string &region, const std::vector< std::string > &vsVarNames, const std::string &objName)
std::vector< std::string > phoHLTFilterNames_
std::vector< std::string > eleLooseTightTrigEffVsVars_
void filterInactiveTriggers(std::vector< std::string > &namesToFilter, std::vector< std::string > &activeFilters)
std::vector< std::string > eleEffTags_
volatile std::atomic< bool > shutdown_flag false
void createLooseTightTrigEff(const std::vector< std::string > &tightLooseTrigNames, const std::string &region, const std::vector< std::string > &vsVarNames, const std::string &objName)
void filterInactiveTightLooseTriggers(std::vector< std::string > &namesToFilter, const std::vector< std::string > &activeFilters)
MonitorElement * makeEffMonElem2Leg(const std::string &filter, const std::string &name, const std::string &title, const MonitorElement *Leg1Eff, const MonitorElement *Leg2NotLeg1Source, const MonitorElement *all)
double split
Definition: MVATrainer.cc:139
MonitorElement * makeEffMonElemFromPassAndFailAndTagTag(const std::string &filter, const std::string &name, const std::string &title, const MonitorElement *pass, const MonitorElement *fail, const MonitorElement *tagtag)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:688
Definition: Run.h:41
std::vector< std::string > eleHLTFilterNames2Leg_
std::vector< std::string > eleSingleEffVars_