CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Attributes
HltSusyExoPostProcessor Class Reference

#include <HltSusyExoPostProcessor.h>

Inheritance diagram for HltSusyExoPostProcessor:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 
MonitorElementbookEffMEProfileFromTH1 (TH1F *, std::string)
 
void endRun (edm::Run const &, edm::EventSetup const &)
 
 HltSusyExoPostProcessor (const edm::ParameterSet &pset)
 
 ~HltSusyExoPostProcessor ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Public Attributes

DQMStoredqm
 

Private Attributes

std::vector< std::string > mc_dirs
 
std::vector< edm::ParameterSetmc_parametersets
 
bool mcFlag
 
std::vector< std::string > reco_dirs
 
std::vector< edm::ParameterSetreco_parametersets
 
std::string subDir_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 11 of file HltSusyExoPostProcessor.h.

Constructor & Destructor Documentation

HltSusyExoPostProcessor::HltSusyExoPostProcessor ( const edm::ParameterSet pset)

Definition at line 21 of file HltSusyExoPostProcessor.cc.

References i, mc_dirs, mc_parametersets, reco_dirs, and reco_parametersets.

21  :
22  subDir_(pset.getUntrackedParameter<std::string>("subDir", std::string("HLT/SusyExo"))),
23  mcFlag(pset.getUntrackedParameter<bool>("mc_flag",true)),
24  reco_parametersets(pset.getParameter<VParameterSet>("reco_parametersets")),
25  mc_parametersets(pset.getParameter<VParameterSet>("mc_parametersets"))
26 {
27  for(unsigned int i=0; i<reco_parametersets.size(); ++i)
28  reco_dirs.push_back(reco_parametersets[i].getParameter<string>("name"));
29  for(unsigned int i=0; i<mc_parametersets.size(); ++i)
30  mc_dirs.push_back(mc_parametersets[i].getParameter<string>("name"));
31 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > mc_dirs
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
std::vector< edm::ParameterSet > mc_parametersets
std::vector< edm::ParameterSet > reco_parametersets
std::vector< std::string > reco_dirs
HltSusyExoPostProcessor::~HltSusyExoPostProcessor ( )
inline

Definition at line 14 of file HltSusyExoPostProcessor.h.

14 {};

Member Function Documentation

void HltSusyExoPostProcessor::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
inlinevirtual

Implements edm::EDAnalyzer.

Definition at line 16 of file HltSusyExoPostProcessor.h.

16 {};
MonitorElement * HltSusyExoPostProcessor::bookEffMEProfileFromTH1 ( TH1F *  histo,
std::string  name 
)

Definition at line 599 of file HltSusyExoPostProcessor.cc.

References DQMStore::bookProfile(), dqm, i, MonitorElement::setBinLabel(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by endRun().

599  {
600  MonitorElement* myEffME;
601  if(name == "Eff") {
602  // myEffME = dqm->bookProfile("Eff_"+((std::string) histo->GetName()), new TProfile(name.c_str(), histo->GetTitle(), histo->GetXaxis()->GetNbins(), histo->GetXaxis()->GetXmin(), histo->GetXaxis()->GetXmax(),"s"));
603  myEffME = dqm->bookProfile((std::string) ("Eff_"+((std::string) histo->GetName())), ((std::string) histo->GetTitle()), histo->GetXaxis()->GetNbins(), histo->GetXaxis()->GetXmin(), histo->GetXaxis()->GetXmax(), 100, 0, 1, "");
604  }
605  else {
606  myEffME = dqm->bookProfile(name, new TProfile(name.c_str(), histo->GetTitle(), histo->GetXaxis()->GetNbins(), histo->GetXaxis()->GetXmin(), histo->GetXaxis()->GetXmax()));
607  }
608  for(int i=0; i<histo->GetXaxis()->GetNbins(); i++) {
609  myEffME->setBinLabel(i+1, histo->GetXaxis()->GetBinLabel(i+1),1);
610  }
611  return myEffME;
612 }
int i
Definition: DBlmapReader.cc:9
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1036
void HltSusyExoPostProcessor::endRun ( edm::Run const &  run,
edm::EventSetup const &  es 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 34 of file HltSusyExoPostProcessor.cc.

References DQMStore::book1D(), bookEffMEProfileFromTH1(), DQMStore::bookProfile(), DQMStore::cd(), DQMStore::dirExists(), dqm, error, DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getTH1F(), MonitorElement::getTProfile(), i, j, LogDebug, mc_dirs, mcFlag, cppFunctionSkipper::operator, DQMStore::pwd(), reco_dirs, MonitorElement::setBinContent(), MonitorElement::setBinEntries(), MonitorElement::setBinError(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), MonitorElement::setTitle(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, subDir_, and relativeConstraints::value.

35 {
36 
37  LogDebug("HltSusyExoPostProcessor") << "Start endRun";
39  // setup DQM store //
41 
42  dqm = 0;
44 
45  if ( ! dqm ) {
46  edm::LogInfo("HltSusyExoPostProcessor") << "Cannot create DQMStore instance\n";
47  return;
48  }
49 
50  LogDebug("HltSusyExoPostProcessor") << "DQMStore opened";
51 
52  //go to the directory to be processed
54  else {
55  edm::LogWarning("HltSusyExoPostProcessor") << "cannot find directory: " << subDir_ << " , skipping";
56  return;
57  }
58 
59  LogDebug("HltSusyExoPostProcessor") << "DQMStore cd";
60 
61  // --- set the names in the dbe folders ---
62  std::string triggerBitsDir = "/TriggerBits";
63  std::string recoSelBitsDir = "/RecoSelection";
64  std::string mcSelBitsDir = "/McSelection";
65  std::string byEventDir = "/By_Event";
66  std::string byMuonDir = "/By_Muon";
67 
68 
69 
70  //get the number of bins of the MonitorElements (valid for all the MonitorElements, independently of selection on the final state)
71  //we take the number of bins from the MonitorElements of the source, and we subtract one because the last bin was reserved for the Total number of events
72  int nL1bins = (dqm->get(dqm->pwd() + triggerBitsDir + "/L1Bits")->getNbinsX());
73  int nHltbins = (dqm->get(dqm->pwd() + triggerBitsDir + "/HltBits")->getNbinsX());
74 
75  std::vector<int> L1placement; for(int i=0; i<nL1bins-1*mcFlag; ++i) L1placement.push_back(6);
76  std::vector<int> Hltplacement; for(int i=0; i<nHltbins-1*mcFlag; ++i) Hltplacement.push_back(7);
77  int L1bins[7]; for(unsigned int i=0; i<sizeof(L1bins)/sizeof(L1bins[0]); ++i) L1bins[i]=0;
78  int Hltbins[8]; for(unsigned int i=0; i<sizeof(Hltbins)/sizeof(Hltbins[0]); ++i) Hltbins[i]=0;
79  string L1search[8] = {"Mu","EG","Jet","ET","TauJet","X",""};
80  string L1search3 = "HTT", L1search6 = "Bias";
81  string Hltsearch[8] = {"Mu","Ele","Jet","Photon","MET","Tau","X",""};
82  string Hltsearch4 = "HT", Hltsearch5 = "BTag", Hltsearch6_1 = "EG", Hltsearch6_2 = "ET", Hltsearch7_1 = "Bias", Hltsearch7_2 = "AlCa";
83 
84 
85  LogDebug("HltSusyExoPostProcessor") << "number of L1 bins = " << nL1bins << " number of HLT bins = " << nHltbins;
86  double value = 0;
87  double error = 0;
88 
89  //Calculate the efficiencies for histos without any selection
90  dqm->setCurrentFolder(subDir_ + triggerBitsDir);
91  //book the MonitorElements for the efficiencies
92 // MonitorElement* hL1EffBeforeCuts = dqm->book1D("L1Eff", dqm->get(subDir_ + triggerBitsDir + "/L1Paths")->getTH1F());
93 // hL1EffBeforeCuts->setTitle("L1 Efficiencies");
94 // MonitorElement* hHltEffBeforeCuts = dqm->book1D("HltEff",dqm->get(subDir_ + triggerBitsDir + "/HltPaths")->getTH1F());
95 // hHltEffBeforeCuts->setTitle("HLT Efficiencies");
96 
97  TH1F* hL1Paths = dqm->get(subDir_ + triggerBitsDir + "/L1Paths")->getTH1F();
98  MonitorElement* hL1EffBeforeCuts = bookEffMEProfileFromTH1(hL1Paths, "Eff");
99  TH1F* hHltPaths = dqm->get(subDir_ + triggerBitsDir + "/HltPaths")->getTH1F();
100  MonitorElement* hHltEffBeforeCuts = bookEffMEProfileFromTH1(hHltPaths, "Eff");
101 
102 
103 
104  LogDebug("HltSusyExoPostProcessor") << "MonitorElements booked";
105 
106  //get the total number of events
107  float nTotalBeforeCuts = -1;
108  int reference_bin = -1;
109  if(mcFlag)
110  {
111  nTotalBeforeCuts = dqm->get(subDir_ + triggerBitsDir + "/L1Bits")->getBinContent(nL1bins);
112  reference_bin = nL1bins;
113  }
114  else
115  {
116  for(int i=0; i<nHltbins; ++i)
117  {
118  string triggername = ((TProfile*)hHltEffBeforeCuts->getTProfile())->GetXaxis()->GetBinLabel(i+1);
119  string eff_search = "HLT_ZeroBias";
120  if(triggername.find(eff_search)!=string::npos && triggername.size()==eff_search.size())
121  {
122  nTotalBeforeCuts = ((TProfile*)hHltEffBeforeCuts->getTProfile())->GetBinContent(i+1);
123  reference_bin = i+1;
124  break;
125  }
126  }
127  if(nTotalBeforeCuts == -1)
128  {
129  nTotalBeforeCuts = dqm->get(subDir_ + triggerBitsDir + "/L1Bits")->getBinContent(nL1bins);
130  reference_bin = nHltbins;
131  }
132  }
133  LogDebug("HltSusyExoPostProcessor") << "Total number of events = " << nTotalBeforeCuts;
134 
135  //fill the eff histo
136  for(int i=0; i<nL1bins-1*mcFlag; i++) {
137  value = (double) dqm->get(subDir_ + triggerBitsDir + "/L1Paths")->getBinContent(i+1) / (double) nTotalBeforeCuts;
138  error = sqrt(value*(1-value)/(double)nTotalBeforeCuts);
139  hL1EffBeforeCuts->setBinContent(i+1,value);
140  hL1EffBeforeCuts->setBinEntries(i+1,1);
141  hL1EffBeforeCuts->setBinError(i+1,error);
142  //if(i!=nL1bins)
143  // {
144  string triggername = ((TProfile*)hL1EffBeforeCuts->getTProfile())->GetXaxis()->GetBinLabel(i+1);
145  if( triggername.find(L1search6)==string::npos )
146  {
147  for(unsigned int j=0; j<sizeof(L1search)/sizeof(L1search[0])-2; ++j)
148  {
149  if( triggername.find(L1search[j])!=string::npos || (j==3 && triggername.find(L1search3)!=string::npos) )
150  {
151  if(L1placement[i]==6)
152  L1placement[i]=j;
153  else if(L1placement[i]==2 && j==4)
154  L1placement[i]=4;
155  else
156  L1placement[i]=5;
157  }
158  else if(triggername.size()==0 || triggername.find("Total")!=string::npos)
159  L1placement[i]=-1;
160  }
161  }
162  }
163 
164  for(unsigned int i=0; i<L1placement.size(); ++i)
165  if(L1placement[i]!=-1)
166  ++L1bins[L1placement[i]];
167 
168  for(int i=0; i<nHltbins-1*mcFlag; i++) {
169  value = (double)dqm->get(subDir_ + triggerBitsDir + "/HltPaths")->getBinContent(i+1) / (double)nTotalBeforeCuts;
170  error = sqrt(value*(1-value)/(double)nTotalBeforeCuts);
171  hHltEffBeforeCuts->setBinContent(i+1,value);
172  hHltEffBeforeCuts->setBinEntries(i+1,1);
173  hHltEffBeforeCuts->setBinError(i+1,error);
174  // if(i!=nHltbins)
175  // {
176  string triggername = ((TProfile*)hHltEffBeforeCuts->getTProfile())->GetXaxis()->GetBinLabel(i+1);
177  if( triggername.find(Hltsearch7_1)==string::npos && triggername.find(Hltsearch7_2)==string::npos )
178  {
179  for(unsigned int j=0; j<sizeof(Hltsearch)/sizeof(Hltsearch[0])-2; ++j)
180  {
181  if( triggername.find(Hltsearch[j])!=string::npos || (j==4 && triggername.find(Hltsearch4)!=string::npos) || (j==5 && triggername.find(Hltsearch5)!=string::npos) )
182  {
183  if(Hltplacement[i]==7)
184  Hltplacement[i]=j;
185  else if( triggername.find(Hltsearch5)!=string::npos )
186  Hltplacement[i]=5;
187  else
188  Hltplacement[i]=6;
189  }
190  else if(triggername.size()==0 || triggername.find("Total")!=string::npos)
191  Hltplacement[i]=-1;
192  }
193  if(Hltplacement[i]>=0 && Hltplacement[i]<=5 && (triggername.find(Hltsearch6_1)!=string::npos || (triggername.find(Hltsearch6_2)!=string::npos && Hltplacement[i]!=4) ))
194  Hltplacement[i]=6;
195  }
196  }
197 
198  for(unsigned int i=0; i<Hltplacement.size(); ++i)
199  if(Hltplacement[i]!=-1)
200  ++Hltbins[Hltplacement[i]];
201 
202 
203 
204 
205  LogDebug("HltSusyExoPostProcessor") << "MonitorElements filled";
206 
207  //Create the sorted histograms
208  dqm->setCurrentFolder(subDir_ + triggerBitsDir);
209  MonitorElement* hL1EffSorted[7] = {dqm->bookProfile("L1_Mu", new TProfile("L1_Mu","Efficiencies of L1 Muon Triggers",L1bins[0],0,L1bins[0])),
210  dqm->bookProfile("L1_EG", new TProfile("L1_EG","Efficiencies of L1 EG Triggers",L1bins[1],0,L1bins[1])),
211  dqm->bookProfile("L1_Jet", new TProfile("L1_Jet","Efficiencies of L1 Jet Triggers",L1bins[2],0,L1bins[2])),
212  dqm->bookProfile("L1_ETM_ETT_HTT", new TProfile("L1_ETM_ETT_HTT","Efficiencies of L1 ETM, ETT, and HTT Triggers",L1bins[3],0,L1bins[3])),
213  dqm->bookProfile("L1_TauJet", new TProfile("L1_TauJet","Efficiencies of L1 TauJet Triggers",L1bins[4],0,L1bins[4])),
214  dqm->bookProfile("L1_XTrigger", new TProfile("L1_XTrigger","Efficiencies of L1 Cross Triggers",L1bins[5],0,L1bins[5])),
215  dqm->bookProfile("L1_Overflow", new TProfile("L1_Overflow","Efficiencies of L1 Unsorted Triggers",L1bins[6],0,L1bins[6])) };
216 
217  MonitorElement* hHltEffSorted[8] = {dqm->bookProfile("Hlt_Mu", new TProfile("Hlt_Mu","Efficiencies of HL Muon Triggers",Hltbins[0],0,Hltbins[0])),
218  dqm->bookProfile("Hlt_Ele", new TProfile("Hlt_Ele","Efficiencies of HL Electron Triggers",Hltbins[1],0,Hltbins[1])),
219  dqm->bookProfile("Hlt_Jet", new TProfile("Hlt_Jet","Efficiencies of HL Jet Triggers",Hltbins[2],0,Hltbins[2],"s")),
220  dqm->bookProfile("Hlt_Photon", new TProfile("Hlt_Photon","Efficiencies of HL Photon Triggers",Hltbins[3],0,Hltbins[3])),
221  dqm->bookProfile("Hlt_MET_HT", new TProfile("Hlt_MET_HT","Efficiencies of HL MET and HT Triggers",Hltbins[4],0,Hltbins[4])),
222  dqm->bookProfile("Hlt_Tau_BTag", new TProfile("Hlt_Tau_Btag","Efficiencies of HL Tau and BTag Triggers",Hltbins[5],0,Hltbins[5])),
223  dqm->bookProfile("Hlt_XTrigger", new TProfile("Hlt_XTrigger","Efficiencies of HL Cross Triggers",Hltbins[6],0,Hltbins[6])),
224  dqm->bookProfile("Hlt_Overflow", new TProfile("Hlt_Overflow","Efficiencies of HL Unsorted Triggers",Hltbins[7],0,Hltbins[7])) };
225 
226  int L1bincounter[8]; for(unsigned int i=0; i<sizeof(L1bincounter)/sizeof(L1bincounter[0]); ++i) L1bincounter[i]=0;
227  int Hltbincounter[8]; for(unsigned int i=0; i<sizeof(Hltbincounter)/sizeof(Hltbincounter[0]); ++i) Hltbincounter[i]=0;
228  TProfile* hL1_ = (TProfile*)hL1EffBeforeCuts->getTProfile();
229  TProfile* hHlt_ = (TProfile*)hHltEffBeforeCuts->getTProfile();
230  // for(int i = 0; i<hHlt_->GetXaxis()->GetNbins(); i++) cout << "hHLT_->GetBinError(" << i << ") = " << hHlt_->GetBinError(i+1) << endl;
231  for(unsigned int i=0; i<L1placement.size(); ++i)
232  {
233  if(L1placement[i]!=-1)
234  {
235  hL1EffSorted[L1placement[i]]->setBinLabel(L1bincounter[L1placement[i]]+1, hL1_->GetXaxis()->GetBinLabel(i+1));
236  hL1EffSorted[L1placement[i]]->setBinContent(L1bincounter[L1placement[i]]+1, hL1_->GetBinContent(i+1));
237  hL1EffSorted[L1placement[i]]->setBinEntries(L1bincounter[L1placement[i]]+1, 1);
238  hL1EffSorted[L1placement[i]]->setBinError(L1bincounter[L1placement[i]]+1, hL1_->GetBinError(i+1));
239  ++L1bincounter[L1placement[i]];
240  }
241  }
242  for(unsigned int i=0; i<Hltplacement.size(); ++i)
243  {
244  if(Hltplacement[i]!=-1)
245  {
246  hHltEffSorted[Hltplacement[i]]->setBinLabel(Hltbincounter[Hltplacement[i]]+1, hHlt_->GetXaxis()->GetBinLabel(i+1));
247  hHltEffSorted[Hltplacement[i]]->setBinContent(Hltbincounter[Hltplacement[i]]+1, hHlt_->GetBinContent(i+1));
248  hHltEffSorted[Hltplacement[i]]->setBinEntries(Hltbincounter[Hltplacement[i]]+1, 1);
249  hHltEffSorted[Hltplacement[i]]->setBinError(Hltbincounter[Hltplacement[i]]+1, hHlt_->GetBinError(i+1));
250  ++Hltbincounter[Hltplacement[i]];
251  }
252  }
253 
254  for(unsigned int i=0; i<mc_dirs.size(); ++i)
255  {
256  //Calculate the efficiencies for histos after MC selection
257  dqm->setCurrentFolder(subDir_ + mcSelBitsDir + "/" + mc_dirs[i]);
258  //book the MonitorElements for the efficiencies
259  char set_name_L1[256], set_name_Hlt[256];
260  sprintf(set_name_L1, "L1Eff_%s", mc_dirs[i].c_str());
261  sprintf(set_name_Hlt, "HltEff_%s", mc_dirs[i].c_str());
262  // MonitorElement* hL1EffAfterMcCuts = dqm->book1D(set_name_L1, dqm->get(subDir_ + mcSelBitsDir + "/" + mc_dirs[i] + "/L1Paths_" + mc_dirs[i])->getTH1F());
263  MonitorElement* hL1EffAfterMcCuts = bookEffMEProfileFromTH1(dqm->get(subDir_ + mcSelBitsDir + "/" + mc_dirs[i] + "/L1Paths_" + mc_dirs[i])->getTH1F(), (std::string) set_name_L1);
264  hL1EffAfterMcCuts->setTitle("L1 Efficiencies for " + mc_dirs[i] + " selection");
265  // MonitorElement* hHltEffAfterMcCuts = dqm->book1D(set_name_Hlt, dqm->get(subDir_ + mcSelBitsDir + "/" + mc_dirs[i] + "/HltPaths_" + mc_dirs[i])->getTH1F());
266  MonitorElement* hHltEffAfterMcCuts = bookEffMEProfileFromTH1(dqm->get(subDir_ + mcSelBitsDir + "/" + mc_dirs[i] + "/HltPaths_" + mc_dirs[i])->getTH1F(), (std::string) set_name_Hlt);
267  hHltEffAfterMcCuts->setTitle("HLT Efficiencies for " + mc_dirs[i] + " selection");
268 
269  LogDebug("HltSusyExoPostProcessor") << "MonitorElements for " << mc_dirs[i] << " selection booked";
270 
271  //get the total number of events
272 
273  float nTotalAfterMcCuts;
274  if(mcFlag)
275  nTotalAfterMcCuts = dqm->get(subDir_ + mcSelBitsDir + "/" + mc_dirs[i] + "/L1Bits_" + mc_dirs[i])->getBinContent(nL1bins);
276  else
277  nTotalAfterMcCuts = dqm->get(subDir_ + mcSelBitsDir + "/" + mc_dirs[i] + "/HltBits_" + mc_dirs[i])->getBinContent(reference_bin);
278 
279  LogDebug("HltSusyExoPostProcessor") << "Total number of events = " << nTotalAfterMcCuts;
280 
281  MonitorElement* hL1EffSorted_mc[7];
282  MonitorElement* hHltEffSorted_mc[8];
283  char buffer1[256], buffer2[256];
284  string L1_nametags[7] = {"Mu","EG","Jet","ETM_ETT_HTT","TauJet","XTrigger","Overflow"};
285  string L1_titletags[7] = {"Muon","EG","Jet","ETM, ETT, and HTT","TauJet","Cross","Unsorted"};
286  string Hlt_nametags[8] = {"Mu","Ele","Jet","Photon","MET_HT","Tau_BTag","XTrigger","Overflow"};
287  string Hlt_titletags[8] = {"Muon","Electron","Jet","Photon","MET and HT","Tau and BTag","Cross","Unsorted"};
288  for(unsigned int j=0; j<sizeof(hL1EffSorted_mc)/sizeof(hL1EffSorted_mc[0]); ++j)
289  {
290  sprintf(buffer1,"L1_%s_%s",mc_dirs[i].c_str(),L1_nametags[j].c_str());
291  sprintf(buffer2,"Efficiencies of L1 %s Triggers for %s Selection",L1_titletags[j].c_str(),mc_dirs[i].c_str());
292  hL1EffSorted_mc[j] = dqm->bookProfile(buffer1, new TProfile(buffer1,buffer2,L1bins[j],0,L1bins[j]));
293  }
294  for(unsigned int j=0; j<sizeof(hHltEffSorted_mc)/sizeof(hHltEffSorted_mc[0]); ++j)
295  {
296  sprintf(buffer1,"Hlt_%s_%s",mc_dirs[i].c_str(),Hlt_nametags[j].c_str());
297  sprintf(buffer2,"Efficiencies of HL %s Triggers for %s Selection",Hlt_titletags[j].c_str(),mc_dirs[i].c_str());
298  hHltEffSorted_mc[j] = dqm->bookProfile(buffer1, new TProfile(buffer1,buffer2,Hltbins[j],0,Hltbins[j]));
299  }
300  /*
301  MonitorElement* hL1EffSorted_mc[7] = {dqm->book1D("L1_"+mc_dirs[i]+"_Mu", new TH1F("L1_"+mc_dirs[i].c_str()+"_Mu","Efficiencies of L1 Muon Triggers for "+mc_dirs[i]+" Selection",L1bins[0],0,L1bins[0])),
302  dqm->book1D("L1_"+mc_dirs[i]+"_EG", new TH1F("L1_"+mc_dirs[i]+"_EG","Efficiencies of L1 EG Triggers for "+mc_dirs[i]+" Selection",L1bins[1],0,L1bins[1])),
303  dqm->book1D("L1_"+mc_dirs[i]+"_Jet", new TH1F("L1_"+mc_dirs[i]+"_Jet","Efficiencies of L1 Jet Triggers for "+mc_dirs[i]+" Selection",L1bins[2],0,L1bins[2])),
304  dqm->book1D("L1_"+mc_dirs[i]+"_ETM_ETT_HTT", new TH1F("L1_"+mc_dirs[i]+"_ETM_ETT_HTT","Efficiencies of L1 ETM, ETT, and HTT Triggers for "+mc_dirs[i]+" Selection",L1bins[3],0,L1bins[3])),
305  dqm->book1D("L1_"+mc_dirs[i]+"_TauJet", new TH1F("L1_"+mc_dirs[i]+"_TauJet","Efficiencies of L1 TauJet Triggers for "+mc_dirs[i]+" Selection",L1bins[4],0,L1bins[4])),
306  dqm->book1D("L1_"+mc_dirs[i]+"_XTrigger", new TH1F("L1_"+mc_dirs[i]+"_XTrigger","Efficiencies of L1 Cross Triggers for "+mc_dirs[i]+" Selection",L1bins[5],0,L1bins[5])),
307  dqm->book1D("L1_"+mc_dirs[i]+"_Overflow", new TH1F("L1_"+mc_dirs[i]+"_Overflow","Efficiencies of L1 Unsorted Triggers for "+mc_dirs[i]+" Selection",L1bins[6],0,L1bins[6])) };
308  MonitorElement* hHltEffSorted_mc[8] = {dqm->book1D("Hlt_"+mc_dirs[i]+"_Mu", new TH1F("Hlt_"+mc_dirs[i]+"_Mu","Efficiencies of HL Muon Triggers for "+mc_dirs[i]+" Selection",Hltbins[0],0,Hltbins[0])),
309  dqm->book1D("Hlt_"+mc_dirs[i]+"_Ele", new TH1F("Hlt_"+mc_dirs[i]+"_Ele","Efficiencies of HL Electron Triggers for "+mc_dirs[i]+" Selection",Hltbins[1],0,Hltbins[1])),
310  dqm->book1D("Hlt_"+mc_dirs[i]+"_Jet", new TH1F("Hlt_"+mc_dirs[i]+"_Jet","Efficiencies of HL Jet Triggers for "+mc_dirs[i]+" Selection",Hltbins[2],0,Hltbins[2])),
311  dqm->book1D("Hlt_"+mc_dirs[i]+"_Photon", new TH1F("Hlt_"+mc_dirs[i]+"_Photon","Efficiencies of HL Photon Triggers for "+mc_dirs[i]+" Selection",Hltbins[3],0,Hltbins[3])),
312  dqm->book1D("Hlt_"+mc_dirs[i]+"_MET_HT", new TH1F("Hlt_"+mc_dirs[i]+"_MET_HT","Efficiencies of HL MET and HT Triggers for "+mc_dirs[i]+" Selection",Hltbins[4],0,Hltbins[4])),
313  dqm->book1D("Hlt_"+mc_dirs[i]+"_Tau_BTag", new TH1F("Hlt_"+mc_dirs[i]+"_Tau_Btag","Efficiencies of HL Tau and BTag Triggers for "+mc_dirs[i]+" Selection",Hltbins[5],0,Hltbins[5])),
314  dqm->book1D("Hlt_"+mc_dirs[i]+"_XTrigger", new TH1F("Hlt_"+mc_dirs[i]+"_XTrigger","Efficiencies of HL Cross Triggers for "+mc_dirs[i]+" Selection",Hltbins[6],0,Hltbins[6])),
315  dqm->book1D("Hlt_"+mc_dirs[i]+"_Overflow", new TH1F("Hlt_"+mc_dirs[i]+"_Overflow","Efficiencies of HL Unsorted Triggers for "+mc_dirs[i]+" Selection",Hltbins[7],0,Hltbins[7])) };*/
316 
317  //fill the eff histo
318  int L1bincounter_mc[8]; for(unsigned int j=0; j<sizeof(L1bincounter_mc)/sizeof(L1bincounter_mc[0]); ++j) L1bincounter_mc[j]=0;
319  int Hltbincounter_mc[8]; for(unsigned int j=0; j<sizeof(Hltbincounter_mc)/sizeof(Hltbincounter_mc[0]); ++j) Hltbincounter_mc[j]=0;
320  TProfile* hL1_mc = (TProfile*)hL1EffAfterMcCuts->getTProfile();
321  TProfile* hHlt_mc = (TProfile*)hHltEffAfterMcCuts->getTProfile();
322  for(unsigned int j=0; j<L1placement.size(); j++) {
323  value = nTotalAfterMcCuts ? (float)dqm->get(subDir_ + mcSelBitsDir + "/" + mc_dirs[i] + "/L1Paths_" + mc_dirs[i])->getBinContent(j+1) / nTotalAfterMcCuts : 0;
324  error = nTotalAfterMcCuts ? sqrt(value*(1-value)/nTotalAfterMcCuts) : 0;
325  hL1EffAfterMcCuts->setBinContent(j+1,value);
326  hL1EffAfterMcCuts->setBinEntries(j+1,1);
327  hL1EffAfterMcCuts->setBinError(j+1,error);
328  if(L1placement[j]!=-1)
329  {
330  hL1EffSorted_mc[L1placement[j]]->setBinLabel(L1bincounter_mc[L1placement[j]]+1, hL1_mc->GetXaxis()->GetBinLabel(j+1));
331  hL1EffSorted_mc[L1placement[j]]->setBinContent(L1bincounter_mc[L1placement[j]]+1, hL1_mc->GetBinContent(j+1));
332  hL1EffSorted_mc[L1placement[j]]->setBinEntries(L1bincounter_mc[L1placement[j]]+1, 1);
333  hL1EffSorted_mc[L1placement[j]]->setBinError(L1bincounter_mc[L1placement[j]]+1, hL1_mc->GetBinError(j+1));
334  ++L1bincounter_mc[L1placement[j]];
335  }
336  }
337  if(nL1bins!=int(L1placement.size()))
338  {
339  value = nTotalAfterMcCuts ? (float)dqm->get(subDir_ + mcSelBitsDir + "/" + mc_dirs[i] + "/L1Paths_" + mc_dirs[i])->getBinContent(nL1bins) / nTotalAfterMcCuts : 0;
340  error = nTotalAfterMcCuts ? sqrt(value*(1-value)/nTotalAfterMcCuts) : 0;
341  hL1EffAfterMcCuts->setBinContent(nL1bins,value);
342  hL1EffAfterMcCuts->setBinEntries(nL1bins,1);
343  hL1EffAfterMcCuts->setBinError(nL1bins,error);
344  }
345  for(unsigned int j=0; j<Hltplacement.size(); j++) {
346  value = nTotalAfterMcCuts ? (float)dqm->get(subDir_ + mcSelBitsDir + "/" + mc_dirs[i] + "/HltPaths_" + mc_dirs[i])->getBinContent(j+1) / nTotalAfterMcCuts : 0;
347  error = nTotalAfterMcCuts ? sqrt(value*(1-value)/nTotalAfterMcCuts) : 0;
348  hHltEffAfterMcCuts->setBinContent(j+1,value);
349  hHltEffAfterMcCuts->setBinEntries(j+1,1);
350  hHltEffAfterMcCuts->setBinError(j+1,error);
351  if(Hltplacement[j]!=-1)
352  {
353  hHltEffSorted_mc[Hltplacement[j]]->setBinLabel(Hltbincounter_mc[Hltplacement[j]]+1, hHlt_mc->GetXaxis()->GetBinLabel(j+1));
354  hHltEffSorted_mc[Hltplacement[j]]->setBinContent(Hltbincounter_mc[Hltplacement[j]]+1, hHlt_mc->GetBinContent(j+1));
355  hHltEffSorted_mc[Hltplacement[j]]->setBinEntries(Hltbincounter_mc[Hltplacement[j]]+1, 1);
356  hHltEffSorted_mc[Hltplacement[j]]->setBinError(Hltbincounter_mc[Hltplacement[j]]+1, hHlt_mc->GetBinError(j+1));
357  ++Hltbincounter_mc[Hltplacement[j]];
358  }
359  }
360  if(nHltbins!=int(Hltplacement.size()))
361  {
362  value = nTotalAfterMcCuts ? (float)dqm->get(subDir_ + mcSelBitsDir + "/" + mc_dirs[i] + "/HltPaths_" + mc_dirs[i])->getBinContent(nHltbins) / nTotalAfterMcCuts : 0;
363  error = nTotalAfterMcCuts ? sqrt(value*(1-value)/nTotalAfterMcCuts) : 0;
364  hHltEffAfterMcCuts->setBinContent(nHltbins,value);
365  hHltEffAfterMcCuts->setBinEntries(nHltbins,1);
366  hHltEffAfterMcCuts->setBinError(nHltbins,error);
367  }
368  LogDebug("HltSusyExoPostProcessor") << "MonitorElements filled for " << mc_dirs[i] <<" selection";
369  }
370 
371  for(unsigned int i=0; i<reco_dirs.size(); ++i)
372  {
373  //Calculate the efficiencies for histos after RECO selection
374  dqm->setCurrentFolder(subDir_ + recoSelBitsDir + "/" + reco_dirs[i]);
375  //book the MonitorElements for the efficiencies
376  char set_name_L1[256], set_name_Hlt[256];
377  sprintf(set_name_L1, "L1Eff_%s", reco_dirs[i].c_str());
378  sprintf(set_name_Hlt, "HltEff_%s", reco_dirs[i].c_str());
379  // MonitorElement* hL1EffAfterRecoCuts = dqm->book1D(set_name_L1, dqm->get(subDir_ + recoSelBitsDir + "/" + reco_dirs[i] + "/L1Paths_" + reco_dirs[i])->getTH1F());
380  MonitorElement* hL1EffAfterRecoCuts = bookEffMEProfileFromTH1(dqm->get(subDir_ + recoSelBitsDir + "/" + reco_dirs[i] + "/L1Paths_" + reco_dirs[i])->getTH1F(), (std::string) set_name_L1);
381  hL1EffAfterRecoCuts->setTitle("L1 Efficiencies for " + reco_dirs[i] + " selection");
382  // MonitorElement* hHltEffAfterRecoCuts = dqm->book1D(set_name_Hlt, dqm->get(subDir_ + recoSelBitsDir + "/" + reco_dirs[i] + "/HltPaths_" + reco_dirs[i])->getTH1F());
383  MonitorElement* hHltEffAfterRecoCuts = bookEffMEProfileFromTH1(dqm->get(subDir_ + recoSelBitsDir + "/" + reco_dirs[i] + "/HltPaths_" + reco_dirs[i])->getTH1F(), (std::string) set_name_Hlt);
384  hHltEffAfterRecoCuts->setTitle("HLT Efficiencies for " + reco_dirs[i] + " selection");
385 
386  LogDebug("HltSusyExoPostProcessor") << "MonitorElements for " << reco_dirs[i] << " selection booked";
387 
388  //get the total number of events
389  float nTotalAfterRecoCuts;
390  if(mcFlag)
391  nTotalAfterRecoCuts = dqm->get(subDir_ + recoSelBitsDir + "/" + reco_dirs[i] + "/L1Bits_" + reco_dirs[i])->getBinContent(nL1bins);
392  else
393  nTotalAfterRecoCuts = dqm->get(subDir_ + recoSelBitsDir + "/" + reco_dirs[i] + "/HltBits_" + reco_dirs[i])->getBinContent(reference_bin);
394 
395  LogDebug("HltSusyExoPostProcessor") << "Total number of events = " << nTotalAfterRecoCuts;
396 
397  MonitorElement* hL1EffSorted_reco[7];
398  MonitorElement* hHltEffSorted_reco[8];
399  char buffer1[256], buffer2[256];
400  string L1_nametags[7] = {"Mu","EG","Jet","ETM_ETT_HTT","TauJet","XTrigger","Overflow"};
401  string L1_titletags[7] = {"Muon","EG","Jet","ETM, ETT, and HTT","TauJet","Cross","Unsorted"};
402  string Hlt_nametags[8] = {"Mu","Ele","Jet","Photon","MET_HT","Tau_BTag","XTrigger","Overflow"};
403  string Hlt_titletags[8] = {"Muon","Electron","Jet","Photon","MET and HT","Tau and BTag","Cross","Unsorted"};
404  for(unsigned int j=0; j<sizeof(hL1EffSorted_reco)/sizeof(hL1EffSorted_reco[0]); ++j)
405  {
406  sprintf(buffer1,"L1_%s_%s",reco_dirs[i].c_str(),L1_nametags[j].c_str());
407  sprintf(buffer2,"Efficiencies of L1 %s Triggers for %s Selection",L1_titletags[j].c_str(),reco_dirs[i].c_str());
408  hL1EffSorted_reco[j] = dqm->bookProfile(buffer1, new TProfile(buffer1,buffer2,L1bins[j],0,L1bins[j]));
409  }
410  for(unsigned int j=0; j<sizeof(hHltEffSorted_reco)/sizeof(hHltEffSorted_reco[0]); ++j)
411  {
412  sprintf(buffer1,"Hlt_%s_%s",reco_dirs[i].c_str(),Hlt_nametags[j].c_str());
413  sprintf(buffer2,"Efficiencies of HL %s Triggers for %s Selection",Hlt_titletags[j].c_str(),reco_dirs[i].c_str());
414  hHltEffSorted_reco[j] = dqm->bookProfile(buffer1, new TProfile(buffer1,buffer2,Hltbins[j],0,Hltbins[j]));
415  }
416  /*
417  MonitorElement* hL1EffSorted_reco[7] = {dqm->book1D("L1_"+reco_dirs[i]+"_Mu", new TH1F("L1_"+reco_dirs[i]+"_Mu","Efficiencies of L1 Muon Triggers for "+reco_dirs[i]+" Selection",L1bins[0],0,L1bins[0])),
418  dqm->book1D("L1_"+reco_dirs[i]+"_EG", new TH1F("L1_"+reco_dirs[i]+"_EG","Efficiencies of L1 EG Triggers for "+reco_dirs[i]+" Selection",L1bins[1],0,L1bins[1])),
419  dqm->book1D("L1_"+reco_dirs[i]+"_Jet", new TH1F("L1_"+reco_dirs[i]+"_Jet","Efficiencies of L1 Jet Triggers for "+reco_dirs[i]+" Selection",L1bins[2],0,L1bins[2])),
420  dqm->book1D("L1_"+reco_dirs[i]+"_ETM_ETT_HTT", new TH1F("L1_"+reco_dirs[i]+"_ETM_ETT_HTT","Efficiencies of L1 ETM, ETT, and HTT Triggers for "+reco_dirs[i]+" Selection",L1bins[3],0,L1bins[3])),
421  dqm->book1D("L1_"+reco_dirs[i]+"_TauJet", new TH1F("L1_"+reco_dirs[i]+"_TauJet","Efficiencies of L1 TauJet Triggers for "+reco_dirs[i]+" Selection",L1bins[4],0,L1bins[4])),
422  dqm->book1D("L1_"+reco_dirs[i]+"_XTrigger", new TH1F("L1_"+reco_dirs[i]+"_XTrigger","Efficiencies of L1 Cross Triggers for "+reco_dirs[i]+" Selection",L1bins[5],0,L1bins[5])),
423  dqm->book1D("L1_"+reco_dirs[i]+"_Overflow", new TH1F("L1_"+reco_dirs[i]+"_Overflow","Efficiencies of L1 Unsorted Triggers for "+reco_dirs[i]+" Selection",L1bins[6],0,L1bins[6])) };
424  MonitorElement* hHltEffSorted_reco[8] = {dqm->book1D("Hlt_"+reco_dirs[i]+"_Mu", new TH1F("Hlt_"+reco_dirs[i]+"_Mu","Efficiencies of HL Muon Triggers for "+reco_dirs[i]+" Selection",Hltbins[0],0,Hltbins[0])),
425  dqm->book1D("Hlt_"+reco_dirs[i]+"_Ele", new TH1F("Hlt_"+reco_dirs[i]+"_Ele","Efficiencies of HL Electron Triggers for "+reco_dirs[i]+" Selection",Hltbins[1],0,Hltbins[1])),
426  dqm->book1D("Hlt_"+reco_dirs[i]+"_Jet", new TH1F("Hlt_"+reco_dirs[i]+"_Jet","Efficiencies of HL Jet Triggers for "+reco_dirs[i]+" Selection",Hltbins[2],0,Hltbins[2])),
427  dqm->book1D("Hlt_"+reco_dirs[i]+"_Photon", new TH1F("Hlt_"+reco_dirs[i]+"_Photon","Efficiencies of HL Photon Triggers for "+reco_dirs[i]+" Selection",Hltbins[3],0,Hltbins[3])),
428  dqm->book1D("Hlt_"+reco_dirs[i]+"_MET_HT", new TH1F("Hlt_"+reco_dirs[i]+"_MET_HT","Efficiencies of HL MET and HT Triggers for "+reco_dirs[i]+" Selection",Hltbins[4],0,Hltbins[4])),
429  dqm->book1D("Hlt_"+reco_dirs[i]+"_Tau_BTag", new TH1F("Hlt_"+reco_dirs[i]+"_Tau_Btag","Efficiencies of HL Tau and BTag Triggers for "+reco_dirs[i]+" Selection",Hltbins[5],0,Hltbins[5])),
430  dqm->book1D("Hlt_"+reco_dirs[i]+"_XTrigger", new TH1F("Hlt_"+reco_dirs[i]+"_XTrigger","Efficiencies of HL Cross Triggers for "+reco_dirs[i]+" Selection",Hltbins[6],0,Hltbins[6])),
431  dqm->book1D("Hlt_"+reco_dirs[i]+"_Overflow", new TH1F("Hlt_"+reco_dirs[i]+"_Overflow","Efficiencies of HL Unsorted Triggers for "+reco_dirs[i]+" Selection",Hltbins[7],0,Hltbins[7])) };
432  */
433 
434  //fill the eff histo
435  int L1bincounter_reco[8]; for(unsigned int j=0; j<sizeof(L1bincounter_reco)/sizeof(L1bincounter_reco[0]); ++j) L1bincounter_reco[j]=0;
436  int Hltbincounter_reco[8]; for(unsigned int j=0; j<sizeof(Hltbincounter_reco)/sizeof(Hltbincounter_reco[0]); ++j) Hltbincounter_reco[j]=0;
437  TProfile* hL1_reco = (TProfile*)hL1EffAfterRecoCuts->getTProfile();
438  TProfile* hHlt_reco = (TProfile*)hHltEffAfterRecoCuts->getTProfile();
439  for(unsigned int j=0; j<L1placement.size(); j++) {
440  value = nTotalAfterRecoCuts ? (float)dqm->get(subDir_ + recoSelBitsDir + "/" + reco_dirs[i] + "/L1Paths_" + reco_dirs[i])->getBinContent(j+1) / nTotalAfterRecoCuts : 0;
441  error = nTotalAfterRecoCuts ? sqrt(value*(1-value)/nTotalAfterRecoCuts) : 0;
442  hL1EffAfterRecoCuts->setBinContent(j+1,value);
443  hL1EffAfterRecoCuts->setBinEntries(j+1,1);
444  hL1EffAfterRecoCuts->setBinError(j+1,error);
445  if(L1placement[j]!=-1)
446  {
447  hL1EffSorted_reco[L1placement[j]]->setBinLabel(L1bincounter_reco[L1placement[j]]+1, hL1_reco->GetXaxis()->GetBinLabel(j+1));
448  hL1EffSorted_reco[L1placement[j]]->setBinContent(L1bincounter_reco[L1placement[j]]+1, hL1_reco->GetBinContent(j+1));
449  hL1EffSorted_reco[L1placement[j]]->setBinEntries(L1bincounter_reco[L1placement[j]]+1, 1);
450  hL1EffSorted_reco[L1placement[j]]->setBinError(L1bincounter_reco[L1placement[j]]+1, hL1_reco->GetBinError(j+1));
451  ++L1bincounter_reco[L1placement[j]];
452  }
453  }
454  if(nL1bins!=int(L1placement.size()))
455  {
456  value = nTotalAfterRecoCuts ? (float)dqm->get(subDir_ + recoSelBitsDir + "/" + reco_dirs[i] + "/L1Paths_" + reco_dirs[i])->getBinContent(nL1bins) / nTotalAfterRecoCuts : 0;
457  error = nTotalAfterRecoCuts ? sqrt(value*(1-value)/nTotalAfterRecoCuts) : 0;
458  hL1EffAfterRecoCuts->setBinContent(nL1bins,value);
459  hL1EffAfterRecoCuts->setBinEntries(nL1bins,1);
460  hL1EffAfterRecoCuts->setBinError(nL1bins,error);
461  }
462  for(unsigned int j=0; j<Hltplacement.size(); j++) {
463  value = nTotalAfterRecoCuts ? (float)dqm->get(subDir_ + recoSelBitsDir + "/" + reco_dirs[i] + "/HltPaths_" + reco_dirs[i])->getBinContent(j+1) / nTotalAfterRecoCuts : 0;
464  error = nTotalAfterRecoCuts ? sqrt(value*(1-value)/nTotalAfterRecoCuts) : 0;
465  hHltEffAfterRecoCuts->setBinContent(j+1,value);
466  hHltEffAfterRecoCuts->setBinEntries(j+1,1);
467  hHltEffAfterRecoCuts->setBinError(j+1,error);
468  if(Hltplacement[j]!=-1)
469  {
470  hHltEffSorted_reco[Hltplacement[j]]->setBinLabel(Hltbincounter_reco[Hltplacement[j]]+1, hHlt_reco->GetXaxis()->GetBinLabel(j+1));
471  hHltEffSorted_reco[Hltplacement[j]]->setBinContent(Hltbincounter_reco[Hltplacement[j]]+1, hHlt_reco->GetBinContent(j+1));
472  hHltEffSorted_reco[Hltplacement[j]]->setBinEntries(Hltbincounter_reco[Hltplacement[j]]+1, 1);
473  hHltEffSorted_reco[Hltplacement[j]]->setBinError(Hltbincounter_reco[Hltplacement[j]]+1, hHlt_reco->GetBinError(j+1));
474  ++Hltbincounter_reco[Hltplacement[j]];
475  }
476  }
477  if(nHltbins!=int(Hltplacement.size()))
478  {
479  value = nTotalAfterRecoCuts ? (float)dqm->get(subDir_ + recoSelBitsDir + "/" + reco_dirs[i] + "/HltPaths_" + reco_dirs[i])->getBinContent(nHltbins) / nTotalAfterRecoCuts : 0;
480  error = nTotalAfterRecoCuts ? sqrt(value*(1-value)/nTotalAfterRecoCuts) : 0;
481  hHltEffAfterRecoCuts->setBinContent(nHltbins,value);
482  hHltEffAfterRecoCuts->setBinEntries(nHltbins,1);
483  hHltEffAfterRecoCuts->setBinError(nHltbins,error);
484  }
485  LogDebug("HltSusyExoPostProcessor") << "MonitorElements filled";
486  }
487 
488  int pt_bins=100, eta_bins=100;
489  double pt_floor=0., pt_ceiling = 200., eta_floor=-3.5, eta_ceiling=3.5;
490  dqm->setCurrentFolder(subDir_ + byEventDir);
491  MonitorElement* hPt_1_ByEvent = dqm->book1D("Pt_1_ByEvent","Turn on as a Function of P_{t}, |Eta|<1.2, By Event",pt_bins, pt_floor, pt_ceiling);
492  MonitorElement* hEta_1_ByEvent= dqm->book1D("Eta_1_ByEvent","Efficiency as a Function of Eta, P_{t}>0, By Event", eta_bins, eta_floor,eta_ceiling);
493  MonitorElement* hPt_2_ByEvent = dqm->book1D("Pt_2_ByEvent","Turn on as a Function of P_{t}, 1.2<|Eta|<2.1, By Event",pt_bins, pt_floor, pt_ceiling);
494  MonitorElement* hEta_2_ByEvent= dqm->book1D("Eta_2_ByEvent","Efficiency as a Function of Eta, P_{t}>10, By Event", eta_bins, eta_floor,eta_ceiling);
495  MonitorElement* hPt_3_ByEvent = dqm->book1D("Pt_3_ByEvent","Turn on as a Function of P_{t}, |Eta|>2.1, By Event",pt_bins, pt_floor, pt_ceiling);
496  MonitorElement* hEta_3_ByEvent= dqm->book1D("Eta_3_ByEvent","Efficiency as a Function of Eta, P_{t}>20, By Event", eta_bins, eta_floor,eta_ceiling);
497  dqm->setCurrentFolder(subDir_ + byMuonDir);
498  MonitorElement* hPt_1_ByMuon = dqm->book1D("Pt_1_ByMuon","Turn on as a Function of P_{t}, |Eta|<1.2, By Muon",pt_bins, pt_floor, pt_ceiling);
499  MonitorElement* hEta_1_ByMuon= dqm->book1D("Eta_1_ByMuon","Efficiency as a Function of Eta, P_{t}>0, By Muon", eta_bins, eta_floor,eta_ceiling);
500  MonitorElement* hPt_2_ByMuon = dqm->book1D("Pt_2_ByMuon","Turn on as a Function of P_{t}, 1.2<|Eta|<2.1, By Muon",pt_bins, pt_floor, pt_ceiling);
501  MonitorElement* hEta_2_ByMuon= dqm->book1D("Eta_2_ByMuon","Efficiency as a Function of Eta, P_{t}>10, By Muon", eta_bins, eta_floor,eta_ceiling);
502  MonitorElement* hPt_3_ByMuon = dqm->book1D("Pt_3_ByMuon","Turn on as a Function of P_{t}, |Eta|>2.1, By Muon",pt_bins, pt_floor, pt_ceiling);
503  MonitorElement* hEta_3_ByMuon= dqm->book1D("Eta_3_ByMuon","Efficiency as a Function of Eta, P_{t}>20, By Muon", eta_bins, eta_floor,eta_ceiling);
504 
505  for(int i=1; i<=hPt_1_ByEvent->getNbinsX(); ++i)
506  {
507  double n1 = (double)dqm->get(subDir_ + byEventDir + "/LeadAssocRecoMuonPt_1_ByEvent")->getBinContent(i);
508  double n2 = (double)dqm->get(subDir_ + byEventDir + "/LeadRecoMuonPt_1_ByEvent")->getBinContent(i);
509  double value = (n2!=0 ? n1/n2 : 0);
510  double error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
511  hPt_1_ByEvent->setBinContent(i,value);
512  hPt_1_ByEvent->setBinError(i,error);
513 
514  n1 = (double)dqm->get(subDir_ + byEventDir + "/LeadAssocRecoMuonPt_2_ByEvent")->getBinContent(i);
515  n2 = (double)dqm->get(subDir_ + byEventDir + "/LeadRecoMuonPt_2_ByEvent")->getBinContent(i);
516  value = (n2!=0 ? n1/n2 : 0);
517  error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
518  hPt_2_ByEvent->setBinContent(i,value);
519  hPt_2_ByEvent->setBinError(i,error);
520 
521  n1 = (double)dqm->get(subDir_ + byEventDir + "/LeadAssocRecoMuonPt_3_ByEvent")->getBinContent(i);
522  n2 = (double)dqm->get(subDir_ + byEventDir + "/LeadRecoMuonPt_3_ByEvent")->getBinContent(i);
523  value = (n2!=0 ? n1/n2 : 0);
524  error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
525  hPt_3_ByEvent->setBinContent(i,value);
526  hPt_3_ByEvent->setBinError(i,error);
527 
528  n1 = (double)dqm->get(subDir_ + byMuonDir + "/AssocRecoMuonPt_1_ByMuon")->getBinContent(i);
529  n2 = (double)dqm->get(subDir_ + byMuonDir + "/RecoMuonPt_1_ByMuon")->getBinContent(i);
530  value = (n2!=0 ? n1/n2 : 0);
531  error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
532  hPt_1_ByMuon->setBinContent(i,value);
533  hPt_1_ByMuon->setBinError(i,error);
534 
535  n1 = (double)dqm->get(subDir_ + byMuonDir + "/AssocRecoMuonPt_2_ByMuon")->getBinContent(i);
536  n2 = (double)dqm->get(subDir_ + byMuonDir + "/RecoMuonPt_2_ByMuon")->getBinContent(i);
537  value = (n2!=0 ? n1/n2 : 0);
538  error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
539  hPt_2_ByMuon->setBinContent(i,value);
540  hPt_2_ByMuon->setBinError(i,error);
541 
542  n1 = (double)dqm->get(subDir_ + byMuonDir + "/AssocRecoMuonPt_3_ByMuon")->getBinContent(i);
543  n2 = (double)dqm->get(subDir_ + byMuonDir + "/RecoMuonPt_3_ByMuon")->getBinContent(i);
544  value = (n2!=0 ? n1/n2 : 0);
545  error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
546  hPt_3_ByMuon->setBinContent(i,value);
547  hPt_3_ByMuon->setBinError(i,error);
548  }
549 
550  for(int i=1; i<=hEta_1_ByEvent->getNbinsX(); ++i)
551  {
552  double n1 = (double)dqm->get(subDir_ + byEventDir + "/LeadAssocRecoMuonEta_1_ByEvent")->getBinContent(i);
553  double n2 = (double)dqm->get(subDir_ + byEventDir + "/LeadRecoMuonEta_1_ByEvent")->getBinContent(i);
554  double value = (n2!=0 ? n1/n2 : 0);
555  double error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
556  hEta_1_ByEvent->setBinContent(i,value);
557  hEta_1_ByEvent->setBinError(i,error);
558 
559  n1 = (double)dqm->get(subDir_ + byEventDir + "/LeadAssocRecoMuonEta_2_ByEvent")->getBinContent(i);
560  n2 = (double)dqm->get(subDir_ + byEventDir + "/LeadRecoMuonEta_2_ByEvent")->getBinContent(i);
561  value = (n2!=0 ? n1/n2 : 0);
562  error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
563  hEta_2_ByEvent->setBinContent(i,value);
564  hEta_2_ByEvent->setBinError(i,error);
565 
566  n1 = (double)dqm->get(subDir_ + byEventDir + "/LeadAssocRecoMuonEta_3_ByEvent")->getBinContent(i);
567  n2 = (double)dqm->get(subDir_ + byEventDir + "/LeadRecoMuonEta_3_ByEvent")->getBinContent(i);
568  value = (n2!=0 ? n1/n2 : 0);
569  error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
570  hEta_3_ByEvent->setBinContent(i,value);
571  hEta_3_ByEvent->setBinError(i,error);
572 
573  n1 = (double)dqm->get(subDir_ + byMuonDir + "/AssocRecoMuonEta_1_ByMuon")->getBinContent(i);
574  n2 = (double)dqm->get(subDir_ + byMuonDir + "/RecoMuonEta_1_ByMuon")->getBinContent(i);
575  value = (n2!=0 ? n1/n2 : 0);
576  error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
577  hEta_1_ByMuon->setBinContent(i,value);
578  hEta_1_ByMuon->setBinError(i,error);
579 
580  n1 = (double)dqm->get(subDir_ + byMuonDir + "/AssocRecoMuonEta_2_ByMuon")->getBinContent(i);
581  n2 = (double)dqm->get(subDir_ + byMuonDir + "/RecoMuonEta_2_ByMuon")->getBinContent(i);
582  value = (n2!=0 ? n1/n2 : 0);
583  error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
584  hEta_2_ByMuon->setBinContent(i,value);
585  hEta_2_ByMuon->setBinError(i,error);
586 
587  n1 = (double)dqm->get(subDir_ + byMuonDir + "/AssocRecoMuonEta_3_ByMuon")->getBinContent(i);
588  n2 = (double)dqm->get(subDir_ + byMuonDir + "/RecoMuonEta_3_ByMuon")->getBinContent(i);
589  value = (n2!=0 ? n1/n2 : 0);
590  error = (n2!=0 ? sqrt(value*(1-value)/n2) : 0);
591  hEta_3_ByMuon->setBinContent(i,value);
592  hEta_3_ByMuon->setBinError(i,error);
593  }
594 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > mc_dirs
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:411
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
MonitorElement * bookEffMEProfileFromTH1(TH1F *, std::string)
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1036
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
void setTitle(const std::string &title)
set (ie. change) histogram/profile title
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:498
std::vector< std::string > reco_dirs
TH1F * getTH1F(void) const
double getBinContent(int binx) const
get content of bin (1-D)
TProfile * getTProfile(void) const
int getNbinsX(void) const
get # of bins in X-axis
void setBinEntries(int bin, double nentries)
set # of bin entries (to be used for profiles)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
const std::string & pwd(void) const
Definition: DQMStore.cc:406

Member Data Documentation

DQMStore* HltSusyExoPostProcessor::dqm

Definition at line 21 of file HltSusyExoPostProcessor.h.

Referenced by bookEffMEProfileFromTH1(), and endRun().

std::vector<std::string> HltSusyExoPostProcessor::mc_dirs
private

Definition at line 29 of file HltSusyExoPostProcessor.h.

Referenced by endRun(), and HltSusyExoPostProcessor().

std::vector<edm::ParameterSet> HltSusyExoPostProcessor::mc_parametersets
private

Definition at line 27 of file HltSusyExoPostProcessor.h.

Referenced by HltSusyExoPostProcessor().

bool HltSusyExoPostProcessor::mcFlag
private

Definition at line 25 of file HltSusyExoPostProcessor.h.

Referenced by endRun().

std::vector<std::string> HltSusyExoPostProcessor::reco_dirs
private

Definition at line 28 of file HltSusyExoPostProcessor.h.

Referenced by endRun(), and HltSusyExoPostProcessor().

std::vector<edm::ParameterSet> HltSusyExoPostProcessor::reco_parametersets
private

Definition at line 26 of file HltSusyExoPostProcessor.h.

Referenced by HltSusyExoPostProcessor().

std::string HltSusyExoPostProcessor::subDir_
private

Definition at line 24 of file HltSusyExoPostProcessor.h.

Referenced by endRun().