CMS 3D CMS Logo

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

#include <JetMETDQMPostProcessor.h>

Inheritance diagram for JetMETDQMPostProcessor:
DQMEDHarvester edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

TProfile * dividehistos (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &numName, const std::string &denomName, const std::string &outName, const std::string &label, const std::string &titel)
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
 JetMETDQMPostProcessor (const edm::ParameterSet &pset)
 
 ~JetMETDQMPostProcessor ()
 
- Public Member Functions inherited from DQMEDHarvester
virtual void analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDHarvester (void)
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void Efficiency (int passing, int total, double level, double &mode, double &lowerBound, double &upperBound)
 
TH1F * getHistogram (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &histoPath)
 

Private Attributes

std::string patternJetTrg_
 
std::string patternMetTrg_
 
std::string subDir_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 12 of file JetMETDQMPostProcessor.h.

Constructor & Destructor Documentation

JetMETDQMPostProcessor::JetMETDQMPostProcessor ( const edm::ParameterSet pset)
JetMETDQMPostProcessor::~JetMETDQMPostProcessor ( )
inline

Definition at line 15 of file JetMETDQMPostProcessor.h.

15 {};

Member Function Documentation

TProfile * JetMETDQMPostProcessor::dividehistos ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const std::string &  numName,
const std::string &  denomName,
const std::string &  outName,
const std::string &  label,
const std::string &  titel 
)

Definition at line 97 of file JetMETDQMPostProcessor.cc.

References DQMStore::IBooker::bookProfile(), alignCSCRings::e, Efficiency(), getHistogram(), MonitorElement::getTProfile(), i, NULL, pileupDistInMC::num, dbtoconf::out, DQMStore::IBooker::pwd(), MonitorElement::setEfficiencyFlag(), and mathSSE::sqrt().

Referenced by dqmEndJob().

99 {
100  //ibooker.pwd();
101  //std::cout << "In dividehistos: " << ibooker.pwd() << std::endl;
102 
103  //std::cout << numName <<std::endl;
104  TH1F* num = getHistogram(ibooker, igetter, ibooker.pwd()+"/"+numName);
105 
106  //std::cout << denomName << std::endl;
107  TH1F* denom = getHistogram(ibooker, igetter, ibooker.pwd()+"/"+denomName);
108 
109  if (num == NULL)
110  edm::LogWarning("JetMETDQMPostProcessor") << "numerator histogram " << ibooker.pwd()+"/"+numName << " does not exist";
111  if (denom == NULL)
112  edm::LogWarning("JetMETDQMPostProcessor") << "denominator histogram " << ibooker.pwd()+"/"+denomName << " does not exist";
113 
114  // Check if histograms actually exist
115  if(!num || !denom) return 0;
116 
117  MonitorElement* meOut = ibooker.bookProfile(outName, titel, num->GetXaxis()->GetNbins(), num->GetXaxis()->GetXmin(), num->GetXaxis()->GetXmax(),0.,1.2);
118  meOut->setEfficiencyFlag();
119  TProfile* out = meOut->getTProfile();
120  out->GetXaxis()->SetTitle(label.c_str());
121  out->SetYTitle("Efficiency");
122  out->SetOption("PE");
123  out->SetLineColor(2);
124  out->SetLineWidth(2);
125  out->SetMarkerStyle(20);
126  out->SetMarkerSize(0.8);
127  out->SetStats(kFALSE);
128 
129  for(int i=1;i<=num->GetNbinsX();i++){
130  double e, low, high;
131  Efficiency( (int)num->GetBinContent(i), (int)denom->GetBinContent(i), 0.683, e, low, high );
132  double err = e-low>high-e ? e-low : high-e;
133  //here is the trick to store info in TProfile:
134  out->SetBinContent( i, e );
135  out->SetBinEntries( i, 1 );
136  out->SetBinError( i, sqrt(e*e+err*err) );
137  }
138  return out;
139 }
int i
Definition: DBlmapReader.cc:9
void Efficiency(int passing, int total, double level, double &mode, double &lowerBound, double &upperBound)
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
const std::string & pwd(void)
Definition: DQMStore.cc:282
#define NULL
Definition: scimark2.h:8
T sqrt(T t)
Definition: SSEVec.h:48
TH1F * getHistogram(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &histoPath)
tuple out
Definition: dbtoconf.py:99
TProfile * getTProfile(void) const
void setEfficiencyFlag(void)
void JetMETDQMPostProcessor::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 25 of file JetMETDQMPostProcessor.cc.

References DQMStore::IBooker::cd(), dir, DQMStore::IGetter::dirExists(), dividehistos(), DQMStore::IGetter::getSubdirs(), DQMStore::IBooker::goUp(), patternJetTrg_, patternMetTrg_, and subDir_.

26 {
28  // setup DQM stor //
30 
31  bool isJetDir = false;
32  bool isMetDir = false;
33 
34  TPRegexp patternJet(patternJetTrg_);
35  TPRegexp patternMet(patternMetTrg_);
36 
37  //go to the directory to be processed
38  if(igetter.dirExists(subDir_)) ibooker.cd(subDir_);
39  else {
40  edm::LogWarning("JetMETDQMPostProcessor") << "cannot find directory: " << subDir_ << " , skipping";
41  return;
42  }
43 
44  std::vector<std::string> subdirectories = igetter.getSubdirs();
45  for(std::vector<std::string>::iterator dir = subdirectories.begin() ;dir!= subdirectories.end(); dir++ ){
46 
47  ibooker.cd(*dir);
48 
49  isJetDir = false;
50  isMetDir = false;
51 
52  if (TString(*dir).Contains(patternJet)) isJetDir = true;
53  if (TString(*dir).Contains(patternMet)) isMetDir = true;
54 
55  if (isMetDir) {
56 
57  //std::cout << "JetMETDQMPostProcessor - Met paths: " << ibooker.pwd() << " " << *dir << std::endl;
58 
59  //GenMET
60  dividehistos(ibooker, igetter, "_meGenMETTrgMC", "_meGenMET", "_meTurnOngMET", "Gen Missing ET", "Gen Missing ET Turn-On RelVal");
61  dividehistos(ibooker, igetter, "_meGenMETTrg", "_meGenMETTrgLow", "_meTurnOngMETLow", "Gen Missing ETLow", "Gen Missing ET Turn-On Data");
62 
63  //HLTMET
64  dividehistos(ibooker, igetter, "_meHLTMETTrgMC", "_meHLTMET", "_meTurnOnhMET", "HLT Missing ET", "HLT Missing ET Turn-On RelVal");
65  dividehistos(ibooker, igetter, "_meHLTMETTrg", "_meHLTMETTrgLow", "_meTurnOnhMETLow", "HLT Missing ETLow", "HLT Missing ET Turn-On Data");
66 
67  }
68 
69  if (isJetDir) {
70 
71  //std::cout << "JetMETDQMPostProcessor - Jet paths: " << ibooker.pwd() << " " << *dir << std::endl;
72 
73  //GenJets
74  dividehistos(ibooker, igetter, "_meGenJetPtTrgMC", "_meGenJetPt", "_meTurnOngJetPt", "Gen Jet Pt", "Gen Jet Pt Turn-On RelVal");
75  dividehistos(ibooker, igetter, "_meGenJetPtTrg", "_meGenJetPtTrgLow", "_meTurnOngJetPt", "Gen Jet PtLow", "Gen Jet Pt Turn-On Data");
76  dividehistos(ibooker, igetter, "_meGenJetEtaTrgMC", "_meGenJetEta", "_meTurnOngJetEta", "Gen Jet Eta", "Gen Jet Eta Turn-On RelVal");
77  dividehistos(ibooker, igetter, "_meGenJetEtaTrg", "_meGenJetEtaTrgLow", "_meTurnOngJetEta", "Gen Jet EtaLow", "Gen Jet Eta Turn-On Data");
78  dividehistos(ibooker, igetter, "_meGenJetPhiTrgMC", "_meGenJetPhi", "_meTurnOngJetPhi", "Gen Jet Phi", "Gen Jet Phi Turn-On RelVal");
79  dividehistos(ibooker, igetter, "_meGenJetPhiTrg", "_meGenJetPhiTrgLow", "_meTurnOngJetPhi", "Gen Jet PhiLow", "Gen Jet Phi Turn-On Data");
80 
81  //HLTJets
82  dividehistos(ibooker, igetter, "_meHLTJetPtTrgMC", "_meHLTJetPt", "_meTurnOnhJetPt", "HLT Jet Pt", "HLT Jet Pt Turn-On RelVal");
83  dividehistos(ibooker, igetter, "_meHLTJetPtTrg", "_meHLTJetPtTrgLow", "_meTurnOnhJetPt", "HLT Jet PtLow", "HLT Jet Pt Turn-On Data");
84  dividehistos(ibooker, igetter, "_meHLTJetEtaTrgMC", "_meHLTJetEta", "_meTurnOnhJetEta", "HLT Jet Eta", "HLT Jet Eta Turn-On RelVal");
85  dividehistos(ibooker, igetter, "_meHLTJetEtaTrg", "_meHLTJetEtaTrgLow", "_meTurnOnhJetEta", "HLT Jet EtaLow", "HLT Jet Eta Turn-On Data");
86  dividehistos(ibooker, igetter, "_meHLTJetPhiTrgMC", "_meHLTJetPhi", "_meTurnOnhJetPhi", "HLT Jet Phi", "HLT Jet Phi Turn-On RelVal");
87  dividehistos(ibooker, igetter, "_meHLTJetPhiTrg", "_meHLTJetPhiTrgLow", "_meTurnOnhJetPhi", "HLT Jet PhiLow", "HLT Jet Phi Turn-On Data");
88 
89  }
90 
91  ibooker.goUp();
92  }
93 }
void cd(void)
Definition: DQMStore.cc:266
TProfile * dividehistos(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &numName, const std::string &denomName, const std::string &outName, const std::string &label, const std::string &titel)
bool dirExists(const std::string &path)
Definition: DQMStore.cc:318
void goUp(void)
Definition: DQMStore.cc:278
std::vector< std::string > getSubdirs(void)
Definition: DQMStore.cc:306
dbl *** dir
Definition: mlp_gen.cc:35
void JetMETDQMPostProcessor::Efficiency ( int  passing,
int  total,
double  level,
double &  mode,
double &  lowerBound,
double &  upperBound 
)
private

Definition at line 155 of file JetMETDQMPostProcessor.cc.

Referenced by dividehistos().

156 {
157  // protection
158  if (total == 0)
159  {
160  mode = 0.5;
161  lowerBound = 0;
162  upperBound = 1;
163  return;
164  }
165  mode = passing / ((double) total);
166 
167  // see http://root.cern.ch/root/html/TEfficiency.html#compare
168  lowerBound = TEfficiency::Wilson(total, passing, level, false);
169  upperBound = TEfficiency::Wilson(total, passing, level, true);
170 }
tuple level
Definition: testEve_cfg.py:34
TH1F * JetMETDQMPostProcessor::getHistogram ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const std::string &  histoPath 
)
private

Definition at line 143 of file JetMETDQMPostProcessor.cc.

References DQMStore::IGetter::get(), MonitorElement::getTH1F(), NULL, and DQMStore::IBooker::pwd().

Referenced by dividehistos().

144 {
145  ibooker.pwd();
146  MonitorElement *monElement = igetter.get(histoPath);
147  if (monElement != NULL)
148  return monElement->getTH1F();
149  else
150  return NULL;
151 }
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
const std::string & pwd(void)
Definition: DQMStore.cc:282
#define NULL
Definition: scimark2.h:8
TH1F * getTH1F(void) const

Member Data Documentation

std::string JetMETDQMPostProcessor::patternJetTrg_
private

Definition at line 22 of file JetMETDQMPostProcessor.h.

Referenced by dqmEndJob(), and JetMETDQMPostProcessor().

std::string JetMETDQMPostProcessor::patternMetTrg_
private

Definition at line 22 of file JetMETDQMPostProcessor.h.

Referenced by dqmEndJob(), and JetMETDQMPostProcessor().

std::string JetMETDQMPostProcessor::subDir_
private

Definition at line 22 of file JetMETDQMPostProcessor.h.

Referenced by dqmEndJob(), and JetMETDQMPostProcessor().