CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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::EDProducer< T > 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 beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &) override
 
virtual void dqmAnalyze (DQMStore::IBooker &, DQMStore::IGetter &, edm::Event const &, edm::EventSetup const &)
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &es) final
 
void endProcessBlockProduce (edm::ProcessBlock &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &es) final
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< T >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenjobmegetter_
 
edm::EDPutTokenT< DQMTokenjobToken_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
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

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

References dqm::implementation::IBooker::bookProfile(), makePileupJSON::denom, alignCSCRings::e, Efficiency(), submitPVValidationJobs::err, getHistogram(), dqm::legacy::MonitorElement::getTProfile(), mps_fire::i, pileupDistInMC::num, submitPVResolutionJobs::out, dqm::implementation::NavigatorBase::pwd(), dqm::impl::MonitorElement::setEfficiencyFlag(), and mathSSE::sqrt().

Referenced by dqmEndJob().

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)
virtual std::string pwd()
Definition: DQMStore.cc:16
char const * label
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
T sqrt(T t)
Definition: SSEVec.h:19
TH1F * getHistogram(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &histoPath)
virtual TProfile * getTProfile() const
Log< level::Warning, false > LogWarning
void JetMETDQMPostProcessor::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 21 of file JetMETDQMPostProcessor.cc.

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

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 }
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:700
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:730
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)
Log< level::Warning, false > LogWarning
void JetMETDQMPostProcessor::Efficiency ( int  passing,
int  total,
double  level,
double &  mode,
double &  lowerBound,
double &  upperBound 
)
private

Definition at line 252 of file JetMETDQMPostProcessor.cc.

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 }
tuple level
Definition: testEve_cfg.py:47
TH1F * JetMETDQMPostProcessor::getHistogram ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
const std::string &  histoPath 
)
private

Definition at line 240 of file JetMETDQMPostProcessor.cc.

References dqm::implementation::IGetter::get(), dqm::legacy::MonitorElement::getTH1F(), and dqm::implementation::NavigatorBase::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
virtual std::string pwd()
Definition: DQMStore.cc:16
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673

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().