CMS 3D CMS Logo

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

#include <FourVectorHLTClient.h>

Inheritance diagram for FourVectorHLTClient:
edm::EDAnalyzer

Public Member Functions

 FourVectorHLTClient (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~FourVectorHLTClient ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Fake Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun. More...
 
void endJob ()
 Endjob. More...
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
 DQM Client Diagnostic. More...
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 EndRun. More...
 
void normalizeHLTMatrix ()
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Member Functions

void calculateRatio (TH1F *effHist, TH1F *denHist)
 
TH1F * get1DHisto (std::string meName, DQMStore *dbi)
 
TProfile * get1DProfile (std::string meName, DQMStore *dbi)
 
TH2F * get2DHisto (std::string meName, DQMStore *dbi)
 
TProfile2D * get2DProfile (std::string meName, DQMStore *dbi)
 
void initialize ()
 
TString removeVersions (TString histVersion)
 

Private Attributes

TString clientDir_
 
int counterEvt_
 counter More...
 
int counterLS_
 
TString customEffDir_
 
std::vector< std::pair
< std::string, std::string > > 
custompathnamepairs_
 
DQMStoredbe_
 
HLTConfigProvider hltConfig_
 
std::vector< TString > hltMEName
 
std::vector< MonitorElement * > hltMEs
 
std::vector< TString > hltPathName
 
MonitorElementklmgrvTest_
 
int nChannels
 prescale on number of events More...
 
edm::ParameterSet parameters_
 
std::string pathsSummaryFilterCountsFolder_
 
std::string pathsSummaryFilterEfficiencyFolder_
 
std::string pathsSummaryFolder_
 
std::string pathsSummaryHLTCorrelationsFolder_
 
int prescaleEvt_
 units of lumi sections More...
 
int prescaleLS_
 counter More...
 
std::string processname_
 
Float_t reportSummary
 
MonitorElementreportSummary_
 
MonitorElementreportSummaryContent_ [20]
 
MonitorElementreportSummaryMap_
 
TString sourceDir_
 
Float_t summaryContent [20]
 
Float_t summarySum
 
MonitorElementtestHLTEff_
 
std::vector< MonitorElement * > v_ME_HLTPass_Normalized_Any_
 
std::vector< MonitorElement * > v_ME_HLTPassPass_
 
std::vector< MonitorElement * > v_ME_HLTPassPass_Normalized_
 

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 &)
 

Detailed Description

Definition at line 31 of file FourVectorHLTClient.h.

Constructor & Destructor Documentation

FourVectorHLTClient::FourVectorHLTClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 43 of file FourVectorHLTClient.cc.

44 {
45 
46  parameters_=ps;
47  initialize();
48 
49 }
edm::ParameterSet parameters_
FourVectorHLTClient::~FourVectorHLTClient ( )
virtual

Destructor.

Definition at line 51 of file FourVectorHLTClient.cc.

References LogDebug.

51  {
52 
53  LogDebug("FourVectorHLTClient")<< "FourVectorHLTClient: ending...." ;
54 
55 }
#define LogDebug(id)

Member Function Documentation

void FourVectorHLTClient::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Fake Analyze.

Implements edm::EDAnalyzer.

Definition at line 160 of file FourVectorHLTClient.cc.

References LogDebug.

160  {
161 
162  counterEvt_++;
163  if (prescaleEvt_<1) return;
164  if (prescaleEvt_>0 && counterEvt_%prescaleEvt_ != 0) return;
165 
166  LogDebug("FourVectorHLTClient")<<"analyze..." << endl;
167 
168 }
#define LogDebug(id)
int prescaleEvt_
units of lumi sections
void FourVectorHLTClient::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 117 of file FourVectorHLTClient.cc.

References dbe_, LogDebug, and cppFunctionSkipper::operator.

117  {
118 
119  LogDebug("FourVectorHLTClient")<<"[FourVectorHLTClient]: beginJob" << endl;
120  // get backendinterface
122 
123 }
#define LogDebug(id)
void FourVectorHLTClient::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 150 of file FourVectorHLTClient.cc.

150  {
151  // optionally reset histograms here
152 }
void FourVectorHLTClient::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 126 of file FourVectorHLTClient.cc.

References LogDebug.

126  {
127 
128  LogDebug("FourVectorHLTClient")<<"[FourVectorHLTClient]: beginRun" << endl;
129  // HLT config does not change within runs!
130  bool changed=false;
131 
132  if (!hltConfig_.init(r, context, processname_, changed)) {
133 
134  processname_ = "FU";
135 
136  if (!hltConfig_.init(r, context, processname_, changed)){
137 
138  LogDebug("FourVectorHLTOffline") << "HLTConfigProvider failed to initialize.";
139 
140  }
141 
142  // check if trigger name in (new) config
143  // cout << "Available TriggerNames are: " << endl;
144  // hltConfig_.dump("Triggers");
145  }
146 
147 }
#define LogDebug(id)
HLTConfigProvider hltConfig_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
void FourVectorHLTClient::calculateRatio ( TH1F *  effHist,
TH1F *  denHist 
)
private

Definition at line 675 of file FourVectorHLTClient.cc.

References i, gen::k, N, and mathSSE::sqrt().

675  {
676 
677  //cout << " NUMERATOR histogram name = " << effHist->GetName() << endl;
678  int nBins= effHist->GetNbinsX();
679  for (int i=0;i<=nBins;i++) {
680 
681  float k = effHist->GetBinContent(i); // number of pass
682  float N = denHist->GetBinContent(i); // number of total
683 
684  float ratio;
685  float err;
686 
687  //ratio = N ? k / N : 0;
688  if(N>0) ratio = k / N;
689  else ratio = 0;
690 
691  if(N > 0) {
692 
693  if(ratio <= 1) {
694  err = sqrt(ratio*(1-ratio)/N);
695  }
696  //else if(ratio == 1) {
697  //err = 1./sqrt(2*N);
698  //}
699  else {
700  err = 0;
701  }
702 
703  effHist->SetBinContent(i,ratio);
704  effHist->SetBinError(i,err);
705 
706  }
707 
708  }
709 
710 }
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:46
int k[5][pyjets_maxn]
#define N
Definition: blowfish.cc:9
void FourVectorHLTClient::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 599 of file FourVectorHLTClient.cc.

599  {
600 }
void FourVectorHLTClient::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 154 of file FourVectorHLTClient.cc.

154  {
155 }
void FourVectorHLTClient::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

EndRun.

add dataset name and thier triggers to the list

Reimplemented from edm::EDAnalyzer.

Definition at line 171 of file FourVectorHLTClient.cc.

References newFWLiteAna::bin, DQMStore::book1D(), DQMStore::book2D(), makeLayoutFileForGui::datasetNames, dbe_, DQMStore::get(), DQMStore::getContents(), edm::getName(), DQMStore::getSubdirs(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), i, gen::k, prof2calltree::l, LogDebug, m, mergeVDriftHistosByStation::name, DQMStore::setCurrentFolder(), and findQualityFiles::size.

171  {
172 
173  LogDebug("FourVectorHLTClient")<<"FourVectorHLTClient:: endLuminosityBlock " << endl;
174 
175 
176  // Work with PathsSummary ME's
179 
180  std::vector<MonitorElement*> summaryME;
181  summaryME = dbe_->getContents(pathsSummaryFilterCountsFolder_.c_str());
182 
183  vector<float> hltPassCount;
184 
185  for(unsigned int i=0; i< summaryME.size(); i++) {
186 
187  TString nameME = (summaryME[i])->getName();
188  LogDebug("FourVectorHLTClient") << "ME = " << nameME << endl;
189 
190  TString fullPathToME = pathsSummaryFilterCountsFolder_ + nameME;
191  LogDebug("FourVectorHLTClient") << "fullPathME = " << fullPathToME << endl;
192 
193  if(nameME.Contains("Filters_")) {
194 
195 
196  TH1F* MEHist = summaryME[i]->getTH1F() ;
197  LogDebug("FourVectorHLTClient") << "this is TH1 first bin label = " << MEHist->GetXaxis()->GetBinLabel(1) << endl;
198  LogDebug("FourVectorHLTClient") << "is this is TH1 = " << fullPathToME << endl;
199 
200  TString nameMEeff = nameME+"_Eff";
201  TString titleMEeff = nameME+" Efficiency wrt input to L1";
202 
203  TH1F* effHist = (TH1F*) MEHist->Clone(nameMEeff.Data());
204  effHist->SetTitle(titleMEeff.Data());
205 
206  float firstBinContent = MEHist->GetBinContent(1);
207 
208  if(firstBinContent !=0 ) {
209 
210  effHist->Scale(1./firstBinContent);
211 
212  }
213  else {
214 
215  unsigned int nBins = effHist->GetNbinsX();
216  for(unsigned int bin = 0; bin < nBins+1; bin++) effHist->SetBinContent(bin, 0);
217 
218  }
219 
221 
222  dbe_->book1D(nameMEeff.Data(), effHist);
223 
224 
225  } // end if "Filters_" ME
226 
227  } // end for MEs
228 
229  // Normalize PassPass and PassFail Matrices
231  vector<string> name;
232  name.push_back("All");
233  name.push_back("Muon");
234  name.push_back("Egamma");
235  name.push_back("Tau");
236  name.push_back("JetMET");
237  name.push_back("Rest");
238  name.push_back("Special");
239 
241  vector<string> datasetNames = hltConfig_.datasetNames() ;
242 
243  for (unsigned int i=0;i<datasetNames.size();i++) {
244 
245  name.push_back(datasetNames[i]);
246 
247  }
248 
249  string fullPathToME;
250 
251  for (unsigned int i=0;i<name.size();i++) {
252 
253  fullPathToME = pathsSummaryFolder_ +"HLT_"+name[i]+"_PassPass";
254  v_ME_HLTPassPass_.push_back( dbe_->get(fullPathToME));
255 
256  fullPathToME = pathsSummaryHLTCorrelationsFolder_+"HLT_"+name[i]+"_PassPass_Normalized";
257  v_ME_HLTPassPass_Normalized_.push_back( dbe_->get(fullPathToME));
258 
259  fullPathToME = pathsSummaryHLTCorrelationsFolder_+"HLT_"+name[i]+"_Pass_Normalized_Any";
260  v_ME_HLTPass_Normalized_Any_.push_back( dbe_->get(fullPathToME));
261 
262  }
264 
265 
266 
267  // HLT paths
268  TObjArray *hltPathNameColl = new TObjArray(100);
269  hltPathNameColl->SetOwner();
270  std::vector<std::string> fullPathHLTFolders;
271 
272  // get subdir of the sourceDir_ to get HLT path names
275 
276  fullPathHLTFolders = dbe_->getSubdirs();
277 
278 
279  LogDebug("FourVectorHLTClient")<<"endRun: sourceDir_(" << sourceDir_.Data() << ") has " << fullPathHLTFolders.size() << " folders. " << endl;
280 
281 
282  for(unsigned int i=0;i<fullPathHLTFolders.size();i++) {
283 
284  LogDebug("FourVectorHLTClient")<<"endRun: sourceDir_(" << sourceDir_.Data() << ") folder["<< i << "] = " << fullPathHLTFolders[i] << endl;
285  TString hltPath = fullPathHLTFolders[i].substr(fullPathHLTFolders[i].rfind('/')+1, fullPathHLTFolders[i].size());
286 
287  //*****
288  hltPath = removeVersions(hltPath);
289  //*****
290 
292  // Efficiencies
294 
295  TString currEffFolder = clientDir_ + "/" + hltPath + "/" + customEffDir_ + "/";
296 
297  //*****
298  currEffFolder = removeVersions(currEffFolder);
299  //*****
300 
301 
302  LogDebug("FourVectorHLTClient")<< "Custom Efficiencies dir path = " << currEffFolder << endl;
303 
304  dbe_->setCurrentFolder(currEffFolder.Data());
305 
306 
307  hltMEs = dbe_->getContents(fullPathHLTFolders[i]);
308  LogDebug("FourVectorHLTClient")<< "Number of MEs for this HLT path = " << hltMEs.size() << endl;
309 
310  // custom efficiencies
311 
312  for (std::vector<std::pair<std::string, std::string> >::iterator custompathnamepair = custompathnamepairs_.begin(); custompathnamepair != custompathnamepairs_.end(); ++custompathnamepair)
313  {
314 
315  //TString numPathName=TString(custompathnamepair->first);
316  //if(!hltPath.Contains(numPathName,TString::kExact)) continue;
317  //TString numPathName=hltPath;
318  //if(!hltPath.Contains(numPathName,TString::kExact)) continue;
319  //LogDebug("FourVectorHLTClient")<< "hltPath = " << hltPath << " matchString = " << custompathnamepair->first << endl;
320  //if(!hltPath.Contains(TString(custompathnamepair->first),TString::kExact)) continue;
321  if(!hltPath.Contains(TString(custompathnamepair->first))) continue;
322 
323  TString numPathName=hltPath;
324  TString denPathName=TString(custompathnamepair->second);
325 
326  numPathName = removeVersions(numPathName);
327 
328 
329 
330  vector<TString> vStage;
331  vStage.push_back(TString("L1"));
332  vStage.push_back(TString("On"));
333  vStage.push_back(TString("Off"));
334  vStage.push_back(TString("Mc"));
335  vStage.push_back(TString("L1UM"));
336  vStage.push_back(TString("OnUM"));
337  vStage.push_back(TString("OffUM"));
338  vStage.push_back(TString("McUM"));
339 
340  vector<TString> vObj;
341  vObj.push_back(TString("l1Et"));
342  vObj.push_back(TString("onEt"));
343  vObj.push_back(TString("offEt"));
344  vObj.push_back(TString("mcEt"));
345 
346 
347  // TH1Fs
348  for (unsigned int k=0; k<vObj.size();k++) {
349  for (unsigned int l=0; l<vStage.size();l++) {
350  for (unsigned int m=0; m<vStage.size();m++) {
351 
352  TString oldHistPathNum;
353  TString oldHistPathNumBck;
354  TString oldHistPathDen;
355 
356  // not the differeence b/w Num and NumBck, as in OnOff vs OffOn
357  oldHistPathNum = sourceDir_+"/"+hltPath+"/"+numPathName+"_wrt_"+denPathName+"_"+vObj[k]+vStage[l]+vStage[m];
358  oldHistPathNumBck = sourceDir_+"/"+hltPath+"/"+numPathName+"_wrt_"+denPathName+"_"+vObj[k]+vStage[m]+vStage[l];
359 
360  // In the deominator hist name, we don't have any "UM" substrings, so remove them
361  TString tempDenString = vStage[l];
362  tempDenString.ReplaceAll("UM","") ;
363  oldHistPathDen = sourceDir_+"/"+hltPath+"/"+numPathName+"_wrt_"+denPathName+"_"+vObj[k]+tempDenString;
364 
365  MonitorElement *numME = dbe_->get(oldHistPathNum.Data());
366  MonitorElement *numMEBck = dbe_->get(oldHistPathNumBck.Data());
367  MonitorElement *denME = dbe_->get(oldHistPathDen.Data());
368 
369  LogDebug("FourVectorHLTClient")<< " oldHistPathNum = " << oldHistPathNum << endl;
370  LogDebug("FourVectorHLTClient")<< " oldHistPathNumBck = " << oldHistPathNumBck << endl;
371  LogDebug("FourVectorHLTClient")<< " oldHistPathDen = " << oldHistPathDen << endl;
372 
373  //check if HLTOffline histogram exist
374  if ( numME && denME ) {
375 
376  LogDebug("FourVectorHLTClient")<< "DID find NUM and DEN histograms to derive eff " << vStage[m]<<"To"<<vStage[l]<<" using:" <<endl
377  << " NUM = " << oldHistPathNum << endl
378  << " DEN = " << oldHistPathDen << endl;
379 
380  }
381  else {
382 
383  LogDebug("FourVectorHLTClient")<< "Cannot find NUM and DEN histograms to derive eff " << vStage[m]<<"To"<<vStage[l]<<" using:" <<endl
384  << " NUM = " << oldHistPathNum << endl
385  << " DEN = " << oldHistPathDen << endl;
386 
387  if ( numMEBck && denME) {
388 
389  LogDebug("FourVectorHLTClient")<< "DID find NUM and DEN histograms to derive eff " << vStage[m]<<"To"<<vStage[l]<<" using:" <<endl
390  << " NUM = " << oldHistPathNumBck << endl
391  << " DEN = " << oldHistPathDen << endl;
392 
393  numME = numMEBck;
394 
395  }
396  else {
397 
398  LogDebug("FourVectorHLTClient")<< "Cannot find NUM and DEN histograms to derive eff " << vStage[m]<<"To"<<vStage[l]<<" using:" <<endl
399  << " NUM = " << oldHistPathNumBck << endl
400  << " DEN = " << oldHistPathDen << endl;
401 
402  continue;
403  }
404 
405  }
406 
407  // EtaPhi histos are TH2s, the rest are TH1s
408  TH1F * numHist = numME->getTH1F();
409  TH1F * denHist = denME->getTH1F();
410 
411  // build names and title for efficiency histogram
412  TString newHistName = hltPath +"_wrt_" + denPathName +"_"+vObj[k]+"_Eff_"+vStage[m]+"To"+vStage[l];
413 
414  // if there is "UM", remove it first,then append it to the end of the name
415  if(newHistName.Contains("UM")) {
416 
417  newHistName.ReplaceAll("UM","");
418  newHistName.Append("_UM");
419 
420  }
421 
422  TString newHistTitle = numPathName+" given " + denPathName +" "+vObj[k]+" Eff "+vStage[m]+"To"+vStage[l];
423 
424  // if there is "UM", remove it first,then append it to the end of the name
425  if(newHistTitle.Contains("UM")) {
426 
427  newHistTitle.ReplaceAll("UM","");
428  newHistTitle.Append("_UM");
429 
430  }
431 
432  TString newHistPath = currEffFolder+newHistName;
433 
434  LogDebug("FourVectorHLTClient")<< "Will make efficiency histogram " << newHistPath << endl;
435 
436  TH1F* effHist = (TH1F*) numHist->Clone(newHistName.Data());
437 
438  effHist->SetTitle(newHistTitle.Data());
439 
440  //effHist->Sumw2();
441  //denHist->Sumw2();
442  //effHist->Divide(numHist,denHist);
443 
444  //effHist->Divide(numHist,denHist,1.,1.,"B");
445 
446  calculateRatio(effHist, denHist);
447 
448  /*
449  effHist->Divide(numHist,denHist,1.,1.);
450 
451  for (int i=0;i<=effHist->GetNbinsX();i++) {
452 
453  float err = 0;
454  if(numHist->GetBinContent(i)>0) err = 1./sqrt(numHist->GetBinContent(i)); // 1/sqrt(number of total)
455  effHist->SetBinError(i,err);
456 
457  }
458  */
459 
460  LogDebug("FourVectorHLTClient")<< "Numerator hist " << numHist->GetName() << endl;
461  LogDebug("FourVectorHLTClient")<< "Denominator hist " << denHist->GetName() << endl;
462 
463  LogDebug("FourVectorHLTClient")<< "Booking efficiency histogram path " << newHistPath << endl;
464  LogDebug("FourVectorHLTClient")<< "Booking efficiency histogram name " << newHistName << endl;
465 
466  // book eff histos
467  dbe_->book1D(newHistName.Data(), effHist);
468 
469 
470  } // end for Stage m
471  } // end for Stage l
472  } //end for obj k
473 
474  vObj.clear();
475  vObj.push_back(TString("l1Etal1Phi"));
476  vObj.push_back(TString("onEtaonPhi"));
477  vObj.push_back(TString("offEtaoffPhi"));
478  vObj.push_back(TString("mcEtamcPhi"));
479 
480  for (unsigned int k=0; k<vObj.size();k++) {
481  for (unsigned int l=0; l<vStage.size();l++) {
482  for (unsigned int m=0; m<vStage.size();m++) {
483 
484 
485  TString oldHistPathNum;
486  TString oldHistPathNumBck;
487  TString oldHistPathDen;
488 
489  // not the differeence b/w Num and NumBck, as in OnOff vs OffOn
490  oldHistPathNum = sourceDir_+"/"+hltPath+"/"+numPathName+"_wrt_"+denPathName+"_"+vObj[k]+vStage[l]+vStage[m];
491  oldHistPathNumBck = sourceDir_+"/"+hltPath+"/"+numPathName+"_wrt_"+denPathName+"_"+vObj[k]+vStage[m]+vStage[l];
492 
493  // In the deominator hist name, we don't have any "UM" substrings, so remove them
494  TString tempDenString = vStage[l];
495  tempDenString.ReplaceAll("UM","") ;
496  oldHistPathDen = sourceDir_+"/"+hltPath+"/"+numPathName+"_wrt_"+denPathName+"_"+vObj[k]+tempDenString;
497 
498  MonitorElement *numME = dbe_->get(oldHistPathNum.Data());
499  MonitorElement *numMEBck = dbe_->get(oldHistPathNumBck.Data());
500  MonitorElement *denME = dbe_->get(oldHistPathDen.Data());
501 
502  LogDebug("FourVectorHLTClient")<< " oldHistPathNum = " << oldHistPathNum << endl;
503  LogDebug("FourVectorHLTClient")<< " oldHistPathNumBck = " << oldHistPathNumBck << endl;
504  LogDebug("FourVectorHLTClient")<< " oldHistPathDen = " << oldHistPathDen << endl;
505 
506  //check if HLTOffline histogram exist
507  if ( numME && denME ) {
508 
509  LogDebug("FourVectorHLTClient")<< "DID find NUM and DEN histograms to derive eff " << vStage[m]<<"To"<<vStage[l]<<" using:" <<endl
510  << " NUM = " << oldHistPathNum << endl
511  << " DEN = " << oldHistPathDen << endl;
512 
513  }
514  else {
515 
516  LogDebug("FourVectorHLTClient")<< "Cannot find NUM and DEN histograms to derive eff " << vStage[m]<<"To"<<vStage[l]<<" using:" <<endl
517  << " NUM = " << oldHistPathNum << endl
518  << " DEN = " << oldHistPathDen << endl;
519 
520  if ( numMEBck && denME) {
521 
522  LogDebug("FourVectorHLTClient")<< "DID find NUM and DEN histograms to derive eff " << vStage[m]<<"To"<<vStage[l]<<" using:" <<endl
523  << " NUM = " << oldHistPathNumBck << endl
524  << " DEN = " << oldHistPathDen << endl;
525  numME = numMEBck;
526 
527  }
528  else {
529 
530  LogDebug("FourVectorHLTClient")<< "Cannot find NUM and DEN histograms to derive eff " << vStage[m]<<"To"<<vStage[l]<<" using:" <<endl
531  << " NUM = " << oldHistPathNumBck << endl
532  << " DEN = " << oldHistPathDen << endl;
533 
534  continue;
535 
536  }
537 
538  }
539 
540  TH2F* numHist = numME->getTH2F();
541  TH2F* denHist = denME->getTH2F();
542 
543  // build names and title for efficiency histogram
544 
545  TString newHistName = hltPath +"_wrt_" + denPathName +"_"+vObj[k]+"_Eff_"+vStage[m]+"To"+vStage[l];
546 
547  // if there is "UM", remove it first,then append it to the end of the name
548  if(newHistName.Contains("UM")) {
549 
550  newHistName.ReplaceAll("UM","");
551  newHistName.Append("_UM");
552 
553  }
554 
555  TString newHistTitle = numPathName+" given " + denPathName +" "+vObj[k]+" Eff "+vStage[m]+"To"+vStage[l];
556  // if there is "UM", remove it first,then append it to the end of the name
557  if(newHistTitle.Contains("UM")) {
558 
559  newHistTitle.ReplaceAll("UM","");
560  newHistTitle.Append("_UM");
561 
562  }
563 
564  TString newHistPath = currEffFolder+newHistName;
565  newHistPath = removeVersions(newHistPath);
566 
567  LogDebug("FourVectorHLTClient")<< "Will make efficiency histogram " << newHistPath << endl;
568 
569  TH2F* effHist = (TH2F*) numHist->Clone(newHistName.Data());
570 
571  effHist->SetTitle(newHistTitle.Data());
572  effHist->Sumw2();
573  //denHist->Sumw2();
574  //effHist->Divide(numHist,denHist,1.,1.,"B");
575  effHist->Divide(numHist,denHist,1.,1.);
576 
577  //reportSummaryMap_ = dbe_->book2D(numHist->Divide(denHist));
578 
579  LogDebug("FourVectorHLTClient")<< "Booking efficiency histogram path " << newHistPath << endl;
580  LogDebug("FourVectorHLTClient")<< "Booking efficiency histogram name " << newHistName << endl;
581 
582  // book eff histos
583  dbe_->book2D(newHistName.Data(), effHist);
584 
585  } // end for Stage m
586  } // end for Stage l
587  } //end for obj k
588 
589  } // end for custompathpair
590 
591  } // end loop over folders for i
592 
593 
594  hltPathNameColl->Delete();
595 
596 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1419
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
std::vector< MonitorElement * > v_ME_HLTPassPass_
std::vector< MonitorElement * > v_ME_HLTPassPass_Normalized_
TString removeVersions(TString histVersion)
std::vector< MonitorElement * > v_ME_HLTPass_Normalized_Any_
std::string pathsSummaryFilterCountsFolder_
HLTConfigProvider hltConfig_
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1497
std::string pathsSummaryFolder_
int k[5][pyjets_maxn]
std::vector< MonitorElement * > hltMEs
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
TH1F * getTH1F(void) const
void calculateRatio(TH1F *effHist, TH1F *denHist)
std::string pathsSummaryHLTCorrelationsFolder_
TH2F * getTH2F(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
std::string pathsSummaryFilterEfficiencyFolder_
tuple size
Write out results.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
const std::vector< std::string > & datasetNames() const
TH1F * FourVectorHLTClient::get1DHisto ( std::string  meName,
DQMStore dbi 
)
private

Definition at line 603 of file FourVectorHLTClient.cc.

References DQMStore::get(), MonitorElement::getTH1F(), LogDebug, and NULL.

604 {
605 
606  MonitorElement * me_ = dbi->get(meName);
607 
608  if (!me_) {
609  LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
610  return NULL;
611  }
612 
613  return me_->getTH1F();
614 
615 }
#define LogDebug(id)
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
TH1F * getTH1F(void) const
TProfile * FourVectorHLTClient::get1DProfile ( std::string  meName,
DQMStore dbi 
)
private

Definition at line 647 of file FourVectorHLTClient.cc.

References DQMStore::get(), MonitorElement::getTProfile(), LogDebug, and NULL.

648 {
649 
650  MonitorElement * me_ = dbi->get(meName);
651 
652  if (!me_) {
653  LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
654  return NULL;
655  }
656 
657  return me_->getTProfile();
658 }
#define LogDebug(id)
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
TProfile * getTProfile(void) const
TH2F * FourVectorHLTClient::get2DHisto ( std::string  meName,
DQMStore dbi 
)
private

Definition at line 618 of file FourVectorHLTClient.cc.

References DQMStore::get(), MonitorElement::getTH2F(), LogDebug, and NULL.

619 {
620 
621 
622  MonitorElement * me_ = dbi->get(meName);
623 
624  if (!me_) {
625  LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
626  return NULL;
627  }
628 
629  return me_->getTH2F();
630 }
#define LogDebug(id)
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
TH2F * getTH2F(void) const
TProfile2D * FourVectorHLTClient::get2DProfile ( std::string  meName,
DQMStore dbi 
)
private

Definition at line 633 of file FourVectorHLTClient.cc.

References DQMStore::get(), MonitorElement::getTProfile2D(), LogDebug, and NULL.

634 {
635 
636  MonitorElement * me_ = dbi->get(meName);
637 
638  if (!me_) {
639  LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
640  return NULL;
641  }
642 
643  return me_->getTProfile2D();
644 }
#define LogDebug(id)
TProfile2D * getTProfile2D(void) const
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
void FourVectorHLTClient::initialize ( )
private

Definition at line 58 of file FourVectorHLTClient.cc.

References dbe_, LogDebug, and cppFunctionSkipper::operator.

58  {
59 
60  counterLS_=0;
61  counterEvt_=0;
62 
63  // get back-end interface
65 
66  processname_ = parameters_.getUntrackedParameter<std::string>("processname","HLT");
67 
68 
69  // base folder for the contents of this job
70  sourceDir_ = TString(parameters_.getUntrackedParameter<string>("hltSourceDir",""));
71 
72 
73 
74  // remove trainling "/" from dirname
75  while(sourceDir_.Last('/') == sourceDir_.Length()-1) {
76  sourceDir_.Remove(sourceDir_.Length()-1);
77  }
78  LogDebug("FourVectorHLTClient")<< "Source dir = " << sourceDir_ << endl;
79 
80  clientDir_ = TString(parameters_.getUntrackedParameter<string>("hltClientDir",""));
81 
82  // remove trainling "/" from dirname
83  while(clientDir_.Last('/') == clientDir_.Length()-1) {
84  clientDir_.Remove(clientDir_.Length()-1);
85  }
86  LogDebug("FourVectorHLTClient")<< "Client dir = " << clientDir_ << endl;
87 
88  prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
89  LogDebug("FourVectorHLTClient")<< "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< endl;
90 
91  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
92  LogDebug("FourVectorHLTClient")<< "DQM event prescale = " << prescaleEvt_ << " events(s)"<< endl;
93 
94  customEffDir_ = TString(parameters_.getUntrackedParameter<string>("customEffDir","custom-efficiencies"));
95  LogDebug("FourVectorHLTClient")<< "Custom Efficiencies dir = " << customEffDir_ << endl;
96 
97  std::vector<edm::ParameterSet> effpaths = parameters_.getParameter<std::vector<edm::ParameterSet> >("effpaths");
98 
99  std::pair<std::string, std::string> custompathnamepair;
100  for(std::vector<edm::ParameterSet>::iterator pathconf = effpaths.begin() ; pathconf != effpaths.end();
101  pathconf++) {
102  custompathnamepair.first =pathconf->getParameter<std::string>("pathname");
103  custompathnamepair.second = pathconf->getParameter<std::string>("denompathname");
104  custompathnamepairs_.push_back(custompathnamepair);
105  // customdenompathnames_.push_back(pathconf->getParameter<std::string>("denompathname"));
106  // custompathnames_.push_back(pathconf->getParameter<std::string>("pathname"));
107  }
108 
109  pathsSummaryFolder_ = parameters_.getUntrackedParameter ("pathsSummaryFolder",std::string("HLT/FourVector/PathsSummary/"));
110  pathsSummaryHLTCorrelationsFolder_ = parameters_.getUntrackedParameter ("hltCorrelationsFolder",std::string("HLT/FourVector/PathsSummary/HLT Correlations/"));
111  pathsSummaryFilterCountsFolder_ = parameters_.getUntrackedParameter ("filterCountsFolder",std::string("HLT/FourVector/PathsSummary/Filters Counts/"));
112  pathsSummaryFilterEfficiencyFolder_ = parameters_.getUntrackedParameter ("filterEfficiencyFolder",std::string("HLT/FourVector/PathsSummary/Filters Efficiencies/"));
113 
114 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters_
int prescaleEvt_
units of lumi sections
std::string pathsSummaryFilterCountsFolder_
std::string pathsSummaryFolder_
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
std::string pathsSummaryHLTCorrelationsFolder_
std::string pathsSummaryFilterEfficiencyFolder_
void FourVectorHLTClient::normalizeHLTMatrix ( )
protected

Definition at line 713 of file FourVectorHLTClient.cc.

References MonitorElement::getTH1F(), MonitorElement::getTH2F(), and i.

713  {
714 
715 
716  for (unsigned int i =0;i<v_ME_HLTPassPass_.size();i++) {
717 
718  MonitorElement* ME_HLTPassPass_ = v_ME_HLTPassPass_[i];
719  MonitorElement* ME_HLTPassPass_Normalized_ = v_ME_HLTPassPass_Normalized_[i];
720  MonitorElement* ME_HLTPass_Normalized_Any_ = v_ME_HLTPass_Normalized_Any_[i];
721 
722  if(!ME_HLTPassPass_ || !ME_HLTPassPass_Normalized_ || !ME_HLTPass_Normalized_Any_) return;
723 
724  float passCount = 0;
725  unsigned int nBinsX = ME_HLTPassPass_->getTH2F()->GetNbinsX();
726  unsigned int nBinsY = ME_HLTPassPass_->getTH2F()->GetNbinsY();
727 
728  for(unsigned int binX = 0; binX < nBinsX+1; binX++) {
729 
730  passCount = ME_HLTPassPass_->getTH2F()->GetBinContent(binX,binX);
731 
732 
733  for(unsigned int binY = 0; binY < nBinsY+1; binY++) {
734 
735  if(passCount != 0) {
736 
737  // normalize each bin to number of passCount
738  float normalizedBinContentPassPass = (ME_HLTPassPass_->getTH2F()->GetBinContent(binX,binY))/passCount;
739  //float normalizedBinContentPassFail = (ME_HLTPassFail_->getTH2F()->GetBinContent(binX,binY))/passCount;
740 
741  ME_HLTPassPass_Normalized_->getTH2F()->SetBinContent(binX,binY,normalizedBinContentPassPass);
742  //ME_HLTPassFail_Normalized_->getTH2F()->SetBinContent(binX,binY,normalizedBinContentPassFail);
743 
744  if(binX == nBinsX) {
745 
746  ME_HLTPass_Normalized_Any_->getTH1F()->SetBinContent(binY,normalizedBinContentPassPass);
747 
748  }
749 
750  }
751  else {
752 
753  ME_HLTPassPass_Normalized_->getTH2F()->SetBinContent(binX,binY,0);
754  //ME_HLTPassFail_Normalized_->getTH2F()->SetBinContent(binX,binY,0);
755 
756  } // end if else
757 
758  } // end for binY
759 
760  } // end for binX
761 
762  } // end for i
763 
764 }
int i
Definition: DBlmapReader.cc:9
std::vector< MonitorElement * > v_ME_HLTPassPass_
std::vector< MonitorElement * > v_ME_HLTPassPass_Normalized_
std::vector< MonitorElement * > v_ME_HLTPass_Normalized_Any_
TH1F * getTH1F(void) const
TH2F * getTH2F(void) const
TString FourVectorHLTClient::removeVersions ( TString  histVersion)
private

Definition at line 660 of file FourVectorHLTClient.cc.

References BeamSplash_cfg::version.

660  {
661  for (int ii = 100; ii >= 0; ii--) {
662  string ver = "_v";
663  string version ="";
664  stringstream ss;
665  ss << ver << ii;
666  ss >> version;
667 
668  if (histVersion.Contains(version)){
669  histVersion.ReplaceAll(version,"");
670  }
671  }
672  return histVersion;
673 }

Member Data Documentation

TString FourVectorHLTClient::clientDir_
private

Definition at line 82 of file FourVectorHLTClient.h.

int FourVectorHLTClient::counterEvt_
private

counter

Definition at line 102 of file FourVectorHLTClient.h.

int FourVectorHLTClient::counterLS_
private

Definition at line 101 of file FourVectorHLTClient.h.

TString FourVectorHLTClient::customEffDir_
private

Definition at line 83 of file FourVectorHLTClient.h.

std::vector<std::pair<std::string, std::string> > FourVectorHLTClient::custompathnamepairs_
private

Definition at line 90 of file FourVectorHLTClient.h.

DQMStore* FourVectorHLTClient::dbe_
private

Definition at line 80 of file FourVectorHLTClient.h.

HLTConfigProvider FourVectorHLTClient::hltConfig_
private

Definition at line 110 of file FourVectorHLTClient.h.

std::vector<TString> FourVectorHLTClient::hltMEName
private

Definition at line 86 of file FourVectorHLTClient.h.

std::vector<MonitorElement*> FourVectorHLTClient::hltMEs
private

Definition at line 89 of file FourVectorHLTClient.h.

std::vector<TString> FourVectorHLTClient::hltPathName
private

Definition at line 87 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::klmgrvTest_
private

Definition at line 115 of file FourVectorHLTClient.h.

int FourVectorHLTClient::nChannels
private

prescale on number of events

Definition at line 105 of file FourVectorHLTClient.h.

edm::ParameterSet FourVectorHLTClient::parameters_
private
std::string FourVectorHLTClient::pathsSummaryFilterCountsFolder_
private

Definition at line 98 of file FourVectorHLTClient.h.

std::string FourVectorHLTClient::pathsSummaryFilterEfficiencyFolder_
private

Definition at line 99 of file FourVectorHLTClient.h.

std::string FourVectorHLTClient::pathsSummaryFolder_
private

Definition at line 96 of file FourVectorHLTClient.h.

std::string FourVectorHLTClient::pathsSummaryHLTCorrelationsFolder_
private

Definition at line 97 of file FourVectorHLTClient.h.

int FourVectorHLTClient::prescaleEvt_
private

units of lumi sections

Definition at line 104 of file FourVectorHLTClient.h.

int FourVectorHLTClient::prescaleLS_
private

counter

Definition at line 103 of file FourVectorHLTClient.h.

std::string FourVectorHLTClient::processname_
private

Definition at line 84 of file FourVectorHLTClient.h.

Float_t FourVectorHLTClient::reportSummary
private

Definition at line 106 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::reportSummary_
private

Definition at line 111 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::reportSummaryContent_[20]
private

Definition at line 112 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::reportSummaryMap_
private

Definition at line 113 of file FourVectorHLTClient.h.

TString FourVectorHLTClient::sourceDir_
private

Definition at line 81 of file FourVectorHLTClient.h.

Float_t FourVectorHLTClient::summaryContent[20]
private

Definition at line 108 of file FourVectorHLTClient.h.

Float_t FourVectorHLTClient::summarySum
private

Definition at line 107 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::testHLTEff_
private

Definition at line 114 of file FourVectorHLTClient.h.

std::vector<MonitorElement*> FourVectorHLTClient::v_ME_HLTPass_Normalized_Any_
private

Definition at line 94 of file FourVectorHLTClient.h.

std::vector<MonitorElement*> FourVectorHLTClient::v_ME_HLTPassPass_
private

Definition at line 92 of file FourVectorHLTClient.h.

std::vector<MonitorElement*> FourVectorHLTClient::v_ME_HLTPassPass_Normalized_
private

Definition at line 93 of file FourVectorHLTClient.h.