CMS 3D CMS Logo

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::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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 () override
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
void endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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 DQMEDHarvester
typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 12 of file JetMETDQMPostProcessor.h.

Constructor & Destructor Documentation

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

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 187 of file JetMETDQMPostProcessor.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::bookProfile(), makePileupJSON::denom, MillePedeFileConverter_cfg::e, Efficiency(), runTheMatrix::err, getHistogram(), dqm::legacy::MonitorElement::getTProfile(), LaserClient_cfi::high, mps_fire::i, createfilelist::int, LaserClient_cfi::low, EgammaValidation_cff::num, MillePedeFileConverter_cfg::out, dqm::dqmstoreimpl::DQMStore::IBooker::pwd(), dqm::impl::MonitorElement::setEfficiencyFlag(), and mathSSE::sqrt().

Referenced by dqmEndJob(), and ~JetMETDQMPostProcessor().

193  {
194  // ibooker.pwd();
195  // std::cout << "In dividehistos: " << ibooker.pwd() << std::endl;
196 
197  // std::cout << numName <<std::endl;
198  TH1F *num = getHistogram(ibooker, igetter, ibooker.pwd() + "/" + numName);
199 
200  // std::cout << denomName << std::endl;
201  TH1F *denom = getHistogram(ibooker, igetter, ibooker.pwd() + "/" + denomName);
202 
203  if (num == nullptr)
204  edm::LogWarning("JetMETDQMPostProcessor")
205  << "numerator histogram " << ibooker.pwd() + "/" + numName << " does not exist";
206  if (denom == nullptr)
207  edm::LogWarning("JetMETDQMPostProcessor")
208  << "denominator histogram " << ibooker.pwd() + "/" + denomName << " does not exist";
209 
210  // Check if histograms actually exist
211  if (!num || !denom)
212  return nullptr;
213 
214  MonitorElement *meOut = ibooker.bookProfile(
215  outName, titel, num->GetXaxis()->GetNbins(), num->GetXaxis()->GetXmin(), num->GetXaxis()->GetXmax(), 0., 1.2);
216  meOut->setEfficiencyFlag();
217  TProfile *out = meOut->getTProfile();
218  out->GetXaxis()->SetTitle(label.c_str());
219  out->SetYTitle("Efficiency");
220  out->SetOption("PE");
221  out->SetLineColor(2);
222  out->SetLineWidth(2);
223  out->SetMarkerStyle(20);
224  out->SetMarkerSize(0.8);
225  out->SetStats(kFALSE);
226 
227  for (int i = 1; i <= num->GetNbinsX(); i++) {
228  double e, low, high;
229  Efficiency((int)num->GetBinContent(i), (int)denom->GetBinContent(i), 0.683, e, low, high);
230  double err = e - low > high - e ? e - low : high - e;
231  // here is the trick to store info in TProfile:
232  out->SetBinContent(i, e);
233  out->SetBinEntries(i, 1);
234  out->SetBinError(i, sqrt(e * e + err * err));
235  }
236  return out;
237 }
void Efficiency(int passing, int total, double level, double &mode, double &lowerBound, double &upperBound)
char const * label
T sqrt(T t)
Definition: SSEVec.h:19
TH1F * getHistogram(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &histoPath)
virtual TProfile * getTProfile() const
void JetMETDQMPostProcessor::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 21 of file JetMETDQMPostProcessor.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::cd(), DeadROC_duringRun::dir, dqm::dqmstoreimpl::DQMStore::IGetter::dirExists(), dividehistos(), dqm::dqmstoreimpl::DQMStore::IGetter::getSubdirs(), dqm::dqmstoreimpl::DQMStore::IBooker::goUp(), patternJetTrg_, patternMetTrg_, subDir_, and personalPlayback::subdirectories.

Referenced by ~JetMETDQMPostProcessor().

21  {
23  // setup DQM stor //
25 
26  bool isJetDir = false;
27  bool isMetDir = false;
28 
29  TPRegexp patternJet(patternJetTrg_);
30  TPRegexp patternMet(patternMetTrg_);
31 
32  // go to the directory to be processed
33  if (igetter.dirExists(subDir_))
34  ibooker.cd(subDir_);
35  else {
36  edm::LogWarning("JetMETDQMPostProcessor") << "cannot find directory: " << subDir_ << " , skipping";
37  return;
38  }
39 
40  std::vector<std::string> subdirectories = igetter.getSubdirs();
41  for (std::vector<std::string>::iterator dir = subdirectories.begin(); dir != subdirectories.end(); dir++) {
42  ibooker.cd(*dir);
43 
44  isJetDir = false;
45  isMetDir = false;
46 
47  if (TString(*dir).Contains(patternJet))
48  isJetDir = true;
49  if (TString(*dir).Contains(patternMet))
50  isMetDir = true;
51 
52  if (isMetDir) {
53  // std::cout << "JetMETDQMPostProcessor - Met paths: " << ibooker.pwd() <<
54  // " " << *dir << std::endl;
55 
56  // GenMET
57  dividehistos(ibooker,
58  igetter,
59  "_meGenMETTrgMC",
60  "_meGenMET",
61  "_meTurnOngMET",
62  "Gen Missing ET",
63  "Gen Missing ET Turn-On RelVal");
64  dividehistos(ibooker,
65  igetter,
66  "_meGenMETTrg",
67  "_meGenMETTrgLow",
68  "_meTurnOngMETLow",
69  "Gen Missing ETLow",
70  "Gen Missing ET Turn-On Data");
71 
72  // HLTMET
73  dividehistos(ibooker,
74  igetter,
75  "_meHLTMETTrgMC",
76  "_meHLTMET",
77  "_meTurnOnhMET",
78  "HLT Missing ET",
79  "HLT Missing ET Turn-On RelVal");
80  dividehistos(ibooker,
81  igetter,
82  "_meHLTMETTrg",
83  "_meHLTMETTrgLow",
84  "_meTurnOnhMETLow",
85  "HLT Missing ETLow",
86  "HLT Missing ET Turn-On Data");
87  }
88 
89  if (isJetDir) {
90  // std::cout << "JetMETDQMPostProcessor - Jet paths: " << ibooker.pwd() <<
91  // " " << *dir << std::endl;
92 
93  // GenJets
94  dividehistos(ibooker,
95  igetter,
96  "_meGenJetPtTrgMC",
97  "_meGenJetPt",
98  "_meTurnOngJetPt",
99  "Gen Jet Pt",
100  "Gen Jet Pt Turn-On RelVal");
101  dividehistos(ibooker,
102  igetter,
103  "_meGenJetPtTrg",
104  "_meGenJetPtTrgLow",
105  "_meTurnOngJetPt",
106  "Gen Jet PtLow",
107  "Gen Jet Pt Turn-On Data");
108  dividehistos(ibooker,
109  igetter,
110  "_meGenJetEtaTrgMC",
111  "_meGenJetEta",
112  "_meTurnOngJetEta",
113  "Gen Jet Eta",
114  "Gen Jet Eta Turn-On RelVal");
115  dividehistos(ibooker,
116  igetter,
117  "_meGenJetEtaTrg",
118  "_meGenJetEtaTrgLow",
119  "_meTurnOngJetEta",
120  "Gen Jet EtaLow",
121  "Gen Jet Eta Turn-On Data");
122  dividehistos(ibooker,
123  igetter,
124  "_meGenJetPhiTrgMC",
125  "_meGenJetPhi",
126  "_meTurnOngJetPhi",
127  "Gen Jet Phi",
128  "Gen Jet Phi Turn-On RelVal");
129  dividehistos(ibooker,
130  igetter,
131  "_meGenJetPhiTrg",
132  "_meGenJetPhiTrgLow",
133  "_meTurnOngJetPhi",
134  "Gen Jet PhiLow",
135  "Gen Jet Phi Turn-On Data");
136 
137  // HLTJets
138  dividehistos(ibooker,
139  igetter,
140  "_meHLTJetPtTrgMC",
141  "_meHLTJetPt",
142  "_meTurnOnhJetPt",
143  "HLT Jet Pt",
144  "HLT Jet Pt Turn-On RelVal");
145  dividehistos(ibooker,
146  igetter,
147  "_meHLTJetPtTrg",
148  "_meHLTJetPtTrgLow",
149  "_meTurnOnhJetPt",
150  "HLT Jet PtLow",
151  "HLT Jet Pt Turn-On Data");
152  dividehistos(ibooker,
153  igetter,
154  "_meHLTJetEtaTrgMC",
155  "_meHLTJetEta",
156  "_meTurnOnhJetEta",
157  "HLT Jet Eta",
158  "HLT Jet Eta Turn-On RelVal");
159  dividehistos(ibooker,
160  igetter,
161  "_meHLTJetEtaTrg",
162  "_meHLTJetEtaTrgLow",
163  "_meTurnOnhJetEta",
164  "HLT Jet EtaLow",
165  "HLT Jet Eta Turn-On Data");
166  dividehistos(ibooker,
167  igetter,
168  "_meHLTJetPhiTrgMC",
169  "_meHLTJetPhi",
170  "_meTurnOnhJetPhi",
171  "HLT Jet Phi",
172  "HLT Jet Phi Turn-On RelVal");
173  dividehistos(ibooker,
174  igetter,
175  "_meHLTJetPhiTrg",
176  "_meHLTJetPhiTrgLow",
177  "_meTurnOnhJetPhi",
178  "HLT Jet PhiLow",
179  "HLT Jet Phi Turn-On Data");
180  }
181 
182  ibooker.goUp();
183  }
184 }
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 JetMETDQMPostProcessor::Efficiency ( int  passing,
int  total,
double  level,
double &  mode,
double &  lowerBound,
double &  upperBound 
)
private

Definition at line 252 of file JetMETDQMPostProcessor.cc.

References DEFINE_FWK_MODULE.

Referenced by dividehistos().

253  {
254  // protection
255  if (total == 0) {
256  mode = 0.5;
257  lowerBound = 0;
258  upperBound = 1;
259  return;
260  }
261  mode = passing / ((double)total);
262 
263  // see http://root.cern.ch/root/html/TEfficiency.html#compare
264  lowerBound = TEfficiency::Wilson(total, passing, level, false);
265  upperBound = TEfficiency::Wilson(total, passing, level, true);
266 }
TH1F * JetMETDQMPostProcessor::getHistogram ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const std::string &  histoPath 
)
private

Definition at line 240 of file JetMETDQMPostProcessor.cc.

References dqm::dqmstoreimpl::DQMStore::IGetter::get(), dqm::legacy::MonitorElement::getTH1F(), and dqm::dqmstoreimpl::DQMStore::IBooker::pwd().

Referenced by dividehistos().

242  {
243  ibooker.pwd();
244  MonitorElement *monElement = igetter.get(histoPath);
245  if (monElement != nullptr)
246  return monElement->getTH1F();
247  else
248  return nullptr;
249 }
virtual TH1F * getTH1F() const

Member Data Documentation

std::string JetMETDQMPostProcessor::patternJetTrg_
private

Definition at line 29 of file JetMETDQMPostProcessor.h.

Referenced by dqmEndJob(), and JetMETDQMPostProcessor().

std::string JetMETDQMPostProcessor::patternMetTrg_
private

Definition at line 29 of file JetMETDQMPostProcessor.h.

Referenced by dqmEndJob(), and JetMETDQMPostProcessor().

std::string JetMETDQMPostProcessor::subDir_
private

Definition at line 29 of file JetMETDQMPostProcessor.h.

Referenced by dqmEndJob(), and JetMETDQMPostProcessor().