12 #include "TGraphAsymmErrors.h" 49 TProfile * efficHist =
new TProfile(name.c_str(), title.c_str(),denum->GetXaxis()->GetNbins(), denum->GetXaxis()->GetXmin(),denum->GetXaxis()->GetXmax());
51 for (
int i=1;
i <= denum->GetNbinsX();
i++) {
53 double nNum = num->GetBinContent(
i);
54 double nDenum = denum->GetBinContent(
i);
55 if ( nDenum == 0 || nNum ==0 ) {
58 if ( nNum > nDenum ) {
62 edm::LogWarning(
"MuonME0DigisHarvestor")<<
"Alert! specific bin's num is bigger than denum "<<
i<<
" "<<nNum<<
" "<<nDenum;
64 const double effVal = nNum/nDenum;
65 efficHist->SetBinContent(
i, effVal);
66 efficHist->SetBinEntries(
i,1);
67 efficHist->SetBinError(
i,0);
68 const double errLo = TEfficiency::ClopperPearson((
int)nDenum,(
int)nNum,0.683,
false);
69 const double errUp = TEfficiency::ClopperPearson((
int)nDenum,(
int)nNum,0.683,
true);
70 const double errVal = (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
71 efficHist->SetBinError(
i,
sqrt(effVal * effVal + errVal * errVal));
80 if( num !=
nullptr && den !=
nullptr ) {
84 TString x_axis_title = TString(num->GetXaxis()->GetTitle());
85 TString
title = TString::Format(
"Digi Efficiency;%s;Eff.",x_axis_title.Data());
87 profile->SetTitle( title.Data());
96 if ( num ==
nullptr)
edm::LogWarning(
"MuonME0DigisHarvestor")<<
"num not found";
97 if ( den ==
nullptr)
edm::LogWarning(
"MuonME0DigisHarvestor")<<
"den not found";
109 hist1->SetName(name.c_str());
110 for (
int bin = 1;
bin<=hist1->GetNbinsX();++
bin){
112 double R_min = hist1->GetBinCenter(
bin) - 0.5 * hist1->GetBinWidth(
bin);
113 double R_max = hist1->GetBinCenter(
bin) + 0.5 * hist1->GetBinWidth(
bin);
115 double Area =
TMath::Pi() * ( R_max*R_max - R_min*R_min );
116 hist1->SetBinContent(
bin,(hist1->GetBinContent(
bin))/Area);
117 hist1->SetBinError(
bin,(hist1->GetBinError(
bin))/Area);
121 int nEvts = hist2->GetEntries();
122 float scale = 6*2*nEvts*3*25
e-9;
123 hist1->Scale(1.0/scale);
132 if( hist1 !=
nullptr && hist2 !=
nullptr ) {
136 TString x_axis_title = TString(hist1->GetXaxis()->GetTitle());
137 TString origTitle = TString(hist1->GetTitle());
138 TString
title = TString::Format((origTitle+
";%s;Rate [Hz/cm^{2}]").Data(),x_axis_title.Data());
140 rate->SetTitle( title.Data() );
147 if ( hist1 ==
nullptr )
edm::LogWarning(
"MuonME0DigisHarvestor")<<
"num not found";
148 if ( hist2 ==
nullptr )
edm::LogWarning(
"MuonME0DigisHarvestor")<<
"den not found";
161 const char*
l_suffix[6] = {
"_l1",
"_l2",
"_l3",
"_l4",
"_l5",
"_l6"};
162 const char* r_suffix[2] = {
"-1",
"1"};
164 TString eta_label_den_tot = TString(
dbe_path_)+
"me0_strip_dg_den_eta_tot";
165 TString eta_label_num_tot = TString(
dbe_path_)+
"me0_strip_dg_num_eta_tot";
166 if( ig.
get(eta_label_num_tot.Data()) !=
nullptr && ig.
get(eta_label_den_tot.Data()) !=
nullptr ) {
168 TH1F* num_vs_eta_tot = (TH1F*)ig.
get(eta_label_num_tot.Data())->getTH1F()->Clone();
169 num_vs_eta_tot->Sumw2();
170 TH1F *den_vs_eta_tot = (TH1F*)ig.
get(eta_label_den_tot.Data())->getTH1F()->Clone();
171 den_vs_eta_tot->Sumw2();
173 ProcessBooking( ibooker, ig,
"me0_strip_dg_eta_tot", num_vs_eta_tot, den_vs_eta_tot );
175 delete num_vs_eta_tot;
176 delete den_vs_eta_tot;
179 else edm::LogWarning(
"MuonME0DigisHarvestor")<<
"Can not find histograms: "<<eta_label_num_tot<<
" or "<<eta_label_den_tot;
181 for(
int i = 0 ;
i < 2 ;
i++) {
183 for(
int j = 0; j < 6 ; j++) {
185 TString eta_label_den = TString(
dbe_path_)+
"me0_strip_dg_den_eta"+r_suffix[
i]+l_suffix[j];
186 TString eta_label_num = TString(
dbe_path_)+
"me0_strip_dg_num_eta"+r_suffix[
i]+l_suffix[j];
188 if( ig.
get(eta_label_num.Data()) !=
nullptr && ig.
get(eta_label_den.Data()) !=
nullptr) {
190 TH1F* num_vs_eta = (TH1F*)ig.
get(eta_label_num.Data())->getTH1F()->Clone();
192 TH1F* den_vs_eta = (TH1F*)ig.
get(eta_label_den.Data())->getTH1F()->Clone();
204 else edm::LogWarning(
"MuonME0DigisHarvestor")<<
"Can not find histograms: "<<eta_label_num<<
" "<<eta_label_den;
210 TString label_eleBkg = TString(
dbe_path_)+
"me0_strip_dg_bkgElePos_radius";
211 TString label_neuBkg = TString(
dbe_path_)+
"me0_strip_dg_bkgNeutral_radius";
212 TString label_totBkg = TString(
dbe_path_)+
"me0_strip_dg_bkg_radius_tot";
213 TString label_evts = TString(
dbe_path_)+
"num_evts";
215 if( ig.
get(label_evts.Data()) !=
nullptr ) {
217 TH1F* numEvts = (TH1F*)ig.
get(label_evts.Data())->getTH1F()->Clone();
219 if( ig.
get(label_eleBkg.Data()) !=
nullptr ) {
221 TH1F* eleBkg = (TH1F*)ig.
get(label_eleBkg.Data())->getTH1F()->Clone();
228 if( ig.
get(label_neuBkg.Data()) !=
nullptr ) {
230 TH1F* neuBkg = (TH1F*)ig.
get(label_neuBkg.Data())->getTH1F()->Clone();
237 if( ig.
get(label_totBkg.Data()) !=
nullptr ) {
239 TH1F* totBkg = (TH1F*)ig.
get(label_totBkg.Data())->getTH1F()->Clone();
static const std::array< std::string, 4 > l_suffix
void ProcessBookingBKG(DQMStore::IBooker &ibooker, DQMStore::IGetter &ig, std::string nameHist, TH1F *hist, TH1F *hist2)
TH1F * ComputeBKG(TH1F *hist1, TH1F *hist2, std::string nameHist)
MonitorElement * bookProfile(Args &&...args)
#define DEFINE_FWK_MODULE(type)
void setCurrentFolder(std::string const &fullpath)
~MuonME0DigisHarvestor() override
destructor
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
MuonME0DigisHarvestor(const edm::ParameterSet &)
constructor
TProfile * ComputeEff(TH1F *num, TH1F *denum, std::string nameHist)
MonitorElement * book1D(Args &&...args)
MonitorElement * get(std::string const &path)
bin
set the eta bin as selection string.
void ProcessBooking(DQMStore::IBooker &, DQMStore::IGetter &, std::string nameHist, TH1F *num, TH1F *den)