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 edm::EDConsumerBase

Public Member Functions

 FourVectorHLTClient (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~FourVectorHLTClient ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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

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
 
- 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 30 of file FourVectorHLTClient.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 42 of file FourVectorHLTClient.cc.

References initialize().

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

Destructor.

Definition at line 50 of file FourVectorHLTClient.cc.

References LogDebug.

50  {
51 
52  LogDebug("FourVectorHLTClient")<< "FourVectorHLTClient: ending...." ;
53 
54 }
#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 159 of file FourVectorHLTClient.cc.

References LogDebug.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 116 of file FourVectorHLTClient.cc.

References dbe_, LogDebug, and cppFunctionSkipper::operator.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 149 of file FourVectorHLTClient.cc.

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 125 of file FourVectorHLTClient.cc.

References LogDebug.

125  {
126 
127  LogDebug("FourVectorHLTClient")<<"[FourVectorHLTClient]: beginRun" << endl;
128  // HLT config does not change within runs!
129  bool changed=false;
130 
131  if (!hltConfig_.init(r, context, processname_, changed)) {
132 
133  processname_ = "FU";
134 
135  if (!hltConfig_.init(r, context, processname_, changed)){
136 
137  LogDebug("FourVectorHLTOffline") << "HLTConfigProvider failed to initialize.";
138 
139  }
140 
141  // check if trigger name in (new) config
142  // cout << "Available TriggerNames are: " << endl;
143  // hltConfig_.dump("Triggers");
144  }
145 
146 }
#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 674 of file FourVectorHLTClient.cc.

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

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

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 598 of file FourVectorHLTClient.cc.

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

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 153 of file FourVectorHLTClient.cc.

153  {
154 }
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 170 of file FourVectorHLTClient.cc.

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

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

Definition at line 602 of file FourVectorHLTClient.cc.

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

603 {
604 
605  MonitorElement * me_ = dbi->get(meName);
606 
607  if (!me_) {
608  LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
609  return NULL;
610  }
611 
612  return me_->getTH1F();
613 
614 }
#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:1693
TH1F * getTH1F(void) const
TProfile * FourVectorHLTClient::get1DProfile ( std::string  meName,
DQMStore dbi 
)
private

Definition at line 646 of file FourVectorHLTClient.cc.

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

647 {
648 
649  MonitorElement * me_ = dbi->get(meName);
650 
651  if (!me_) {
652  LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
653  return NULL;
654  }
655 
656  return me_->getTProfile();
657 }
#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:1693
TProfile * getTProfile(void) const
TH2F * FourVectorHLTClient::get2DHisto ( std::string  meName,
DQMStore dbi 
)
private

Definition at line 617 of file FourVectorHLTClient.cc.

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

618 {
619 
620 
621  MonitorElement * me_ = dbi->get(meName);
622 
623  if (!me_) {
624  LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
625  return NULL;
626  }
627 
628  return me_->getTH2F();
629 }
#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:1693
TH2F * getTH2F(void) const
TProfile2D * FourVectorHLTClient::get2DProfile ( std::string  meName,
DQMStore dbi 
)
private

Definition at line 632 of file FourVectorHLTClient.cc.

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

633 {
634 
635  MonitorElement * me_ = dbi->get(meName);
636 
637  if (!me_) {
638  LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
639  return NULL;
640  }
641 
642  return me_->getTProfile2D();
643 }
#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:1693
void FourVectorHLTClient::initialize ( )
private

Definition at line 57 of file FourVectorHLTClient.cc.

References dbe_, LogDebug, cppFunctionSkipper::operator, and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

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

References cuy::ii, contentValuesCheck::ss, and BeamSplash_cfg::version.

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

Member Data Documentation

TString FourVectorHLTClient::clientDir_
private

Definition at line 81 of file FourVectorHLTClient.h.

int FourVectorHLTClient::counterEvt_
private

counter

Definition at line 101 of file FourVectorHLTClient.h.

int FourVectorHLTClient::counterLS_
private

Definition at line 100 of file FourVectorHLTClient.h.

TString FourVectorHLTClient::customEffDir_
private

Definition at line 82 of file FourVectorHLTClient.h.

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

Definition at line 89 of file FourVectorHLTClient.h.

DQMStore* FourVectorHLTClient::dbe_
private

Definition at line 79 of file FourVectorHLTClient.h.

HLTConfigProvider FourVectorHLTClient::hltConfig_
private

Definition at line 109 of file FourVectorHLTClient.h.

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

Definition at line 85 of file FourVectorHLTClient.h.

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

Definition at line 88 of file FourVectorHLTClient.h.

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

Definition at line 86 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::klmgrvTest_
private

Definition at line 114 of file FourVectorHLTClient.h.

int FourVectorHLTClient::nChannels
private

prescale on number of events

Definition at line 104 of file FourVectorHLTClient.h.

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

Definition at line 97 of file FourVectorHLTClient.h.

std::string FourVectorHLTClient::pathsSummaryFilterEfficiencyFolder_
private

Definition at line 98 of file FourVectorHLTClient.h.

std::string FourVectorHLTClient::pathsSummaryFolder_
private

Definition at line 95 of file FourVectorHLTClient.h.

std::string FourVectorHLTClient::pathsSummaryHLTCorrelationsFolder_
private

Definition at line 96 of file FourVectorHLTClient.h.

int FourVectorHLTClient::prescaleEvt_
private

units of lumi sections

Definition at line 103 of file FourVectorHLTClient.h.

int FourVectorHLTClient::prescaleLS_
private

counter

Definition at line 102 of file FourVectorHLTClient.h.

std::string FourVectorHLTClient::processname_
private

Definition at line 83 of file FourVectorHLTClient.h.

Float_t FourVectorHLTClient::reportSummary
private

Definition at line 105 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::reportSummary_
private

Definition at line 110 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::reportSummaryContent_[20]
private

Definition at line 111 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::reportSummaryMap_
private

Definition at line 112 of file FourVectorHLTClient.h.

TString FourVectorHLTClient::sourceDir_
private

Definition at line 80 of file FourVectorHLTClient.h.

Float_t FourVectorHLTClient::summaryContent[20]
private

Definition at line 107 of file FourVectorHLTClient.h.

Float_t FourVectorHLTClient::summarySum
private

Definition at line 106 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::testHLTEff_
private

Definition at line 113 of file FourVectorHLTClient.h.

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

Definition at line 93 of file FourVectorHLTClient.h.

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

Definition at line 91 of file FourVectorHLTClient.h.

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

Definition at line 92 of file FourVectorHLTClient.h.