17 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,0)
18 #include "TEfficiency.h"
20 #include "TGraphAsymmErrors.h"
25 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,0)
37 void calculateEfficiency1D( TH1*
num, TH1* den,
string name );
38 void calculateEfficiency2D( TH2F*
num, TH2F* den,
string name );
45 myDQMrootFolder( pset.getUntrackedParameter<string>(
"MyDQMrootFolder") ),
46 efficiencies( pset.getUntrackedParameter<
VParameterSet>(
"Efficiencies") )
53 LogError(
"HLTriggerOfflineHeavyFlavor") <<
"Could not find DQMStore service\n";
64 if(numDenEffMEnames.size()!=3){
65 LogDebug(
"HLTriggerOfflineHeavyFlavor") <<
"NumDenEffMEnames must have three names"<<endl;
72 if(denME==0 || numME==0){
73 LogDebug(
"HLTriggerOfflineHeavyFlavor") <<
"Could not find MEs: "<<denMEname<<
" or "<<numMEname<<endl;
76 TH1 *den = denME->
getTH1();
79 if( den->GetNbinsX() != num->GetNbinsX() || den->GetNbinsY() != num->GetNbinsY() || den->GetNbinsZ() != num->GetNbinsZ() ){
80 LogDebug(
"HLTriggerOfflineHeavyFlavor") <<
"Monitoring elements "<<numMEname<<
" and "<<denMEname<<
"are incompatible"<<endl;
84 string effName = numDenEffMEnames[2];
87 if ( string::npos != slashPos ) {
88 effDir +=
"/"+effName.substr(0, slashPos);
89 effName.erase(0, slashPos+1);
93 int dimensions = num->GetDimension();
96 }
else if(dimensions==2){
98 TH1D* numX = ((TH2F*)num)->ProjectionX();
99 TH1D* denX = ((TH2F*)den)->ProjectionX();
103 TH1D* numY = ((TH2F*)num)->ProjectionY();
104 TH1D* denY = ((TH2F*)den)->ProjectionY();
115 if(num->GetXaxis()->GetXbins()->GetSize()==0){
116 eff =
new TProfile(effName.c_str(),effName.c_str(),num->GetXaxis()->GetNbins(),num->GetXaxis()->GetXmin(),num->GetXaxis()->GetXmax());
118 eff =
new TProfile(effName.c_str(),effName.c_str(),num->GetXaxis()->GetNbins(),num->GetXaxis()->GetXbins()->GetArray());
120 eff->SetTitle(effName.c_str());
121 eff->SetXTitle( num->GetXaxis()->GetTitle() );
122 eff->SetYTitle(
"Efficiency");
123 eff->SetOption(
"PE");
124 eff->SetLineColor(2);
125 eff->SetLineWidth(2);
126 eff->SetMarkerStyle(20);
127 eff->SetMarkerSize(0.8);
128 eff->GetYaxis()->SetRangeUser(-0.001,1.001);
129 eff->SetStats(kFALSE);
130 for(
int i=1;
i<=num->GetNbinsX();
i++){
132 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,0)
133 if (
int(den->GetBinContent(
i))>0.) e= double(num->GetBinContent(
i))/
double(den->GetBinContent(
i));
135 low=TEfficiency::Wilson((
double)den->GetBinContent(
i),(double)num->GetBinContent(
i),0.683,
false);
136 high=TEfficiency::Wilson((
double)den->GetBinContent(
i),(double)num->GetBinContent(
i),0.683,
true);
138 Efficiency( (
double)num->GetBinContent(
i), (double)den->GetBinContent(
i), 0.683,
e, low, high );
140 double err = e-low>high-e ? e-low : high-
e;
142 eff->SetBinContent(
i, e );
143 eff->SetBinEntries(
i, 1 );
144 eff->SetBinError(
i,
sqrt(e*e+err*err) );
152 if(num->GetXaxis()->GetXbins()->GetSize()==0 && num->GetYaxis()->GetXbins()->GetSize()==0){
153 eff =
new TProfile2D(effName.c_str(),effName.c_str(),num->GetXaxis()->GetNbins(),num->GetXaxis()->GetXmin(),num->GetXaxis()->GetXmax(),num->GetYaxis()->GetNbins(),num->GetYaxis()->GetXmin(),num->GetYaxis()->GetXmax());
154 }
else if(num->GetXaxis()->GetXbins()->GetSize()!=0 && num->GetYaxis()->GetXbins()->GetSize()==0){
155 eff =
new TProfile2D(effName.c_str(),effName.c_str(),num->GetXaxis()->GetNbins(),num->GetXaxis()->GetXbins()->GetArray(),num->GetYaxis()->GetNbins(),num->GetYaxis()->GetXmin(),num->GetYaxis()->GetXmax());
156 }
else if(num->GetXaxis()->GetXbins()->GetSize()==0 && num->GetYaxis()->GetXbins()->GetSize()!=0){
157 eff =
new TProfile2D(effName.c_str(),effName.c_str(),num->GetXaxis()->GetNbins(),num->GetXaxis()->GetXmin(),num->GetXaxis()->GetXmax(),num->GetYaxis()->GetNbins(),num->GetYaxis()->GetXbins()->GetArray());
159 eff =
new TProfile2D(effName.c_str(),effName.c_str(),num->GetXaxis()->GetNbins(),num->GetXaxis()->GetXbins()->GetArray(),num->GetYaxis()->GetNbins(),num->GetYaxis()->GetXbins()->GetArray());
161 eff->SetTitle(effName.c_str());
162 eff->SetXTitle( num->GetXaxis()->GetTitle() );
163 eff->SetYTitle( num->GetYaxis()->GetTitle() );
164 eff->SetZTitle(
"Efficiency");
165 eff->SetOption(
"colztexte");
166 eff->GetZaxis()->SetRangeUser(-0.001,1.001);
167 eff->SetStats(kFALSE);
168 for(
int i=0;
i<num->GetSize();
i++){
170 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,27,0)
171 if (
int(den->GetBinContent(
i))>0.) e= double(num->GetBinContent(
i))/
double(den->GetBinContent(
i));
173 low=TEfficiency::Wilson((
double)den->GetBinContent(
i),(double)num->GetBinContent(
i),0.683,
false);
174 high=TEfficiency::Wilson((
double)den->GetBinContent(
i),(double)num->GetBinContent(
i),0.683,
true);
176 Efficiency( (
double)num->GetBinContent(
i), (double)den->GetBinContent(
i), 0.683,
e, low, high );
178 double err = e-low>high-e ? e-low : high-
e;
180 eff->SetBinContent(
i, e );
181 eff->SetBinEntries(
i, 1 );
182 eff->SetBinError(
i,
sqrt(e*e+err*err) );
T getUntrackedParameter(std::string const &, T const &) const
void calculateEfficiency2D(TH2F *num, TH2F *den, string name)
virtual void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
#define DEFINE_FWK_MODULE(type)
std::vector< ParameterSet > VParameterSet
void calculateEfficiency1D(TH1 *num, TH1 *den, string name)
virtual ~HeavyFlavorHarvesting()
void calculateEfficiency(const ParameterSet &pset)
const VParameterSet efficiencies
HeavyFlavorHarvesting(const edm::ParameterSet &pset)
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual void endRun(const edm::Run &, const edm::EventSetup &)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")