18 #include <boost/algorithm/string.hpp>
20 #include "TGraphAsymmErrors.h"
26 edm::LogError(
"EgHLTOfflineClient") <<
"unable to get DQMStore service, upshot is no client histograms will be made";
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;
134 std::vector<std::string> regions;
135 regions.push_back(
"eb");
136 regions.push_back(
"ee");
140 for(
size_t regionNr=0;regionNr<regions.size();regionNr++){
141 for(
size_t effNr=0;effNr<
eleEffTags_.size();effNr++){
154 for(
size_t regionNr=0;regionNr<regions.size();regionNr++){
155 for(
size_t effNr=0;effNr<
eleEffTags_.size();effNr++){
168 for(
size_t regionNr=0;regionNr<regions.size();regionNr++){
169 for(
size_t effNr=0;effNr<
phoEffTags_.size();effNr++){
186 for(
size_t regionNr=0;regionNr<regions.size();regionNr++){
214 for(
size_t varNr=0;varNr<varNames.size();varNr++){
218 std::string effHistName(baseName+
"_HLToverOffline_"+varNames[varNr]+
"_"+region);
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];
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());
247 for(
size_t varNr=0;varNr<varNames.size();varNr++){
250 std::string effHistName(baseName+
"_n1Eff_"+varNames[varNr]+
"_"+region);
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];
269 for(
size_t varNr=0;varNr<varNames.size();varNr++){
272 std::string effHistName(baseName+
"_singleEff_"+varNames[varNr]+
"_"+region);
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];
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);
295 std::string passName(
dirName_+
"/Source_Histos/"+filterName+
"/"+filterName+
"_trigTagProbe_"+objName+
"_pass_"+vsVarNames[varNr]+
"_"+region);
302 std::string effHistTitle(filterName+
"_trigTagProbeEff_"+objName+
"_vs_"+vsVarNames[varNr]+
"_"+region);
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];
308 makeEffMonElemFromPassAndAll(filterName,filterName+
"_trigTagProbeEff_"+objName+
"_vs_"+vsVarNames[varNr]+
"_"+region,effHistTitle,pass,all);
314 for(
size_t varNr=0;varNr<vsVarNames.size();varNr++){
322 std::string passName(
dirName_+
"/Source_Histos/"+filterName+
"/"+filterName+
"_trigTagProbe_"+objName+
"_passNotTag_"+vsVarNames[varNr]+
"_"+region);
324 if(passNotTag==
NULL){
328 std::string passTagTagName(
dirName_+
"/Source_Histos/"+filterName+
"/"+filterName+
"_trigTagProbe_"+objName+
"_passTagTag_"+vsVarNames[varNr]+
"_"+region);
330 if(passTagTag==
NULL){
334 std::string failName(
dirName_+
"/Source_Histos/"+filterName+
"/"+filterName+
"_trigTagProbe_"+objName+
"_fail_"+vsVarNames[varNr]+
"_"+region);
341 std::string effHistTitle(filterName+
"_trigTagProbeEff_"+objName+
"_vs_"+vsVarNames[varNr]+
"_"+region);
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];
353 for(
size_t varNr=0;varNr<vsVarNames.size();varNr++){
355 std::string allName(
dirName_+
"/Source_Histos/"+filterNameLeg2+
"/"+filterNameLeg2+
"_trigTagProbe_"+objName+
"_all_"+vsVarNames[varNr]+
"_"+region);
358 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist "<<allName;
361 std::string Leg2NotLeg1SourceName(
dirName_+
"/Source_Histos/"+filterNameLeg2+
"/"+filterNameLeg2+
"_trigTagProbe_"+objName+
"_passLeg2failLeg1_"+vsVarNames[varNr]+
"_"+region);
363 if(Leg2NotLeg1Source==
NULL){
364 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist "<<Leg2NotLeg1SourceName;
368 std::string Leg1EffName(
dirName_+
"/Client_Histos/"+filterNameLeg1+
"/"+filterNameLeg1+
"_trigTagProbeEff_"+objName+
"_vs_"+vsVarNames[varNr]+
"_"+region);
371 edm::LogInfo(
"EgHLTOfflineClient") <<
" couldnt get hist "<<Leg1EffName;
374 std::string effHistTitle(filterNameLeg2+
"_trigTagProbeEff2Leg_"+objName+
"_vs_"+vsVarNames[varNr]+
"_"+region);
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];
379 makeEffMonElem2Leg(filterNameLeg2,filterNameLeg2+
"_trigTagProbeEff2Leg_"+objName+
"_vs_"+vsVarNames[varNr]+
"_"+region,effHistTitle,Leg1Eff,Leg2NotLeg1Source,all);
386 for(
size_t varNr=0;varNr<vsVarNames.size();varNr++){
387 for(
size_t trigNr=0;trigNr<tightLooseTrigNames.size();trigNr++){
390 if(splitString.size()!=2)
continue;
406 const std::string newHistName(tightTrig+
"_trigEffTo_"+looseTrig+
"_"+objName+
"_vs_"+vsVarNames[varNr]+
"_"+region);
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];
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");
433 effHist->SetTitle(title.c_str());
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());
460 effHist->Divide(numer,denom,1,1,
"B");
463 effHist->SetTitle(title.c_str());
477 TH1F* allHist = all->
getTH1F();
478 if(allHist->GetSumw2()==0)allHist->Sumw2();
479 TH1F* Leg2NotLeg1SourceHist = Leg2NotLeg1Source->
getTH1F();
480 if(Leg2NotLeg1SourceHist->GetSumw2()==0)Leg2NotLeg1SourceHist->Sumw2();
482 TH1F* effHistLeg2NotLeg1 = (TH1F*)allHist->Clone(name.c_str());
483 if(effHistLeg2NotLeg1->GetSumw2()==0)effHistLeg2NotLeg1->Sumw2();
484 effHistLeg2NotLeg1->Divide(Leg2NotLeg1SourceHist, allHist, 1, 1,
"B");
486 TH1F* Leg1EffHist = Leg1Eff->
getTH1F();
487 if(Leg1EffHist->GetSumw2()==0)Leg1EffHist->Sumw2();
489 TH1F* effHistTerm1 = (TH1F*)allHist->Clone(name.c_str());
490 if(effHistTerm1->GetSumw2()==0)effHistTerm1->Sumw2();
491 effHistTerm1->Multiply(Leg1EffHist, Leg1EffHist, 1, 1,
"B");
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);
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());
517 TH1F* failHist = fail->
getTH1F();
518 if(failHist->GetSumw2N()==0) failHist->Sumw2();
519 TH1F* passHist = pass->
getTH1F();
520 if(passHist->GetSumw2N()==0) passHist->Sumw2();
522 TH1F* effHist = (TH1F*) passHist->Clone(name.c_str());
523 effHist->Add(failHist);
524 effHist->Divide(passHist,effHist,1,1,
"B");
526 effHist->SetTitle(title.c_str());
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
std::vector< std::string > eleHLTFilterNames_
std::vector< std::string > phoHLTFilterNames2Leg_
void createSingleEffHists(const std::string &filterName, const std::string &baseName, const std::string ®ion, const std::vector< std::string > &varNames)
std::vector< std::string > phoLooseTightTrigEffVsVars_
void createN1EffHists(const std::string &filterName, const std::string &baseName, const std::string ®ion, const std::vector< std::string > &varNames)
EgHLTOfflineClient(const EgHLTOfflineClient &rhs)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< std::string > splitString(const std::string &fLine)
bool runClientEndLumiBlock_
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 ®ion, const std::vector< std::string > &vsVarNames, const std::string &objName)
virtual ~EgHLTOfflineClient()
std::vector< std::string > eleTrigTPEffVsVars_
void setVerbose(unsigned level)
std::vector< std::string > phoEffTags_
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
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 ®ion, const std::vector< std::string > &vsVarNames, const std::string &objName)
void createHLTvsOfflineHists(const std::string &filterName, const std::string &baseName, const std::string ®ion, 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)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
TH1F * getTH1F(void) const
bool filterInactiveTriggers_
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 ®ion, const std::vector< std::string > &vsVarNames, const std::string &objName)
std::vector< std::string > phoHLTFilterNames_
std::vector< std::string > eleLooseTightTrigEffVsVars_
std::vector< std::string > eleEffTags_
void createLooseTightTrigEff(const std::vector< std::string > &tightLooseTrigNames, const std::string ®ion, const std::vector< std::string > &vsVarNames, const std::string &objName)
MonitorElement * makeEffMonElem2Leg(const std::string &filter, const std::string &name, const std::string &title, const MonitorElement *Leg1Eff, const MonitorElement *Leg2NotLeg1Source, const MonitorElement *all)
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)
std::vector< std::string > eleHLTFilterNames2Leg_
std::vector< std::string > eleSingleEffVars_