CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CaloTowersDQMClient Class Reference

#include <CaloTowersDQMClient.h>

Inheritance diagram for CaloTowersDQMClient:
DQMEDHarvester edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob (void) override
 
void beginRun (const edm::Run &run, const edm::EventSetup &c) override
 
 CaloTowersDQMClient (const edm::ParameterSet &)
 
int CaloTowersEndjob (const std::vector< MonitorElement *> &hcalMEs)
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
 ~CaloTowersDQMClient () 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< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator >
 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::ParameterSet conf_
 
bool debug_
 
std::string dirName_
 
std::string dirNameJet_
 
std::string dirNameMET_
 
std::string outputFile_
 
bool verbose_
 

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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
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 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 31 of file CaloTowersDQMClient.h.

Constructor & Destructor Documentation

◆ CaloTowersDQMClient()

CaloTowersDQMClient::CaloTowersDQMClient ( const edm::ParameterSet iConfig)
explicit

Definition at line 10 of file CaloTowersDQMClient.cc.

References debug_, dirName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), outputFile_, AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

10  : conf_(iConfig) {
11  outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile", "myfile.root");
12  debug_ = false;
13  verbose_ = false;
14  dirName_ = iConfig.getParameter<std::string>("DQMDirName");
15 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ParameterSet conf_
T getUntrackedParameter(std::string const &, T const &) const

◆ ~CaloTowersDQMClient()

CaloTowersDQMClient::~CaloTowersDQMClient ( )
override

Definition at line 17 of file CaloTowersDQMClient.cc.

17 {}

Member Function Documentation

◆ beginJob()

void CaloTowersDQMClient::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 19 of file CaloTowersDQMClient.cc.

19 {}

◆ beginRun()

void CaloTowersDQMClient::beginRun ( const edm::Run run,
const edm::EventSetup c 
)
override

Definition at line 21 of file CaloTowersDQMClient.cc.

21 {}

◆ CaloTowersEndjob()

int CaloTowersDQMClient::CaloTowersEndjob ( const std::vector< MonitorElement *> &  hcalMEs)

Definition at line 25 of file CaloTowersDQMClient.cc.

References generateEDF::cont, gather_cfg::cout, MillePedeFileConverter_cfg::e, nano_mu_digi_cff::float, dqm::impl::MonitorElement::getBinContent(), dqm::impl::MonitorElement::getBinError(), dqm::impl::MonitorElement::getEntries(), ForwardName::getName(), dqm::impl::MonitorElement::getNbinsX(), dqm::impl::MonitorElement::getNbinsY(), mps_fire::i, hcalRecHitTable_cff::ieta, dqmiolumiharvest::j, nevent, funct::pow(), dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), CaloTowersParam_cfi::useAllHistos, and verbose_.

Referenced by dqmEndJob().

25  {
26  int useAllHistos = 0;
27  MonitorElement *Ntowers_vs_ieta = nullptr;
28  MonitorElement *mapEnergy_N = nullptr, *mapEnergy_E = nullptr, *mapEnergy_H = nullptr, *mapEnergy_EH = nullptr;
29  MonitorElement *occupancy_map = nullptr, *occupancy_vs_ieta = nullptr;
30  for (unsigned int ih = 0; ih < hcalMEs.size(); ih++) {
31  if (strcmp(hcalMEs[ih]->getName().c_str(), "Ntowers_per_event_vs_ieta") == 0) {
32  Ntowers_vs_ieta = hcalMEs[ih];
33  }
34  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_Nentries") == 0) {
35  mapEnergy_N = hcalMEs[ih];
36  }
37  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_H") == 0) {
38  useAllHistos++;
39  mapEnergy_H = hcalMEs[ih];
40  }
41  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_E") == 0) {
42  useAllHistos++;
43  mapEnergy_E = hcalMEs[ih];
44  }
45  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_EH") == 0) {
46  useAllHistos++;
47  mapEnergy_EH = hcalMEs[ih];
48  }
49  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_occupancy") == 0) {
50  occupancy_map = hcalMEs[ih];
51  }
52  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_occupancy_vs_ieta") == 0) {
53  occupancy_vs_ieta = hcalMEs[ih];
54  }
55  }
56  if (useAllHistos != 0 && useAllHistos != 3)
57  return 0;
58 
59  double nevent = mapEnergy_N->getEntries();
60  if (verbose_)
61  std::cout << "nevent : " << nevent << std::endl;
62 
63  // mean number of towers per ieta
64  int nx = Ntowers_vs_ieta->getNbinsX();
65  float cont;
66  float conte;
67  float fev = float(nevent);
68 
69  for (int i = 1; i <= nx; i++) {
70  cont = Ntowers_vs_ieta->getBinContent(i) / fev;
71  conte = pow(Ntowers_vs_ieta->getBinContent(i), 0.5) / fev;
72  Ntowers_vs_ieta->setBinContent(i, cont);
73  Ntowers_vs_ieta->setBinError(i, conte);
74  }
75 
76  // mean energies & occupancies evaluation
77 
78  nx = mapEnergy_N->getNbinsX();
79  int ny = mapEnergy_N->getNbinsY();
80  float cnorm;
81  float cnorme;
82  float phi_factor;
83 
84  for (int i = 1; i <= nx; i++) {
85  float sumphi = 0.;
86 
87  for (int j = 1; j <= ny; j++) {
88  // Emean
89  cnorm = mapEnergy_N->getBinContent(i, j);
90  // Phi histos are not used in the macros
91  if (cnorm > 0.000001 && useAllHistos) {
92  cont = mapEnergy_E->getBinContent(i, j) / cnorm;
93  conte = mapEnergy_E->getBinError(i, j) / cnorm;
94  mapEnergy_E->setBinContent(i, j, cont);
95  mapEnergy_E->setBinError(i, j, conte);
96 
97  cont = mapEnergy_H->getBinContent(i, j) / cnorm;
98  conte = mapEnergy_H->getBinError(i, j) / cnorm;
99  mapEnergy_H->setBinContent(i, j, cont);
100  mapEnergy_H->setBinError(i, j, conte);
101 
102  cont = mapEnergy_EH->getBinContent(i, j) / cnorm;
103  conte = mapEnergy_EH->getBinError(i, j) / cnorm;
104  mapEnergy_EH->setBinContent(i, j, cont);
105  mapEnergy_EH->setBinError(i, j, conte);
106  }
107 
108  // Occupancy (needed for occupancy vs ieta)
109  cont = occupancy_map->getBinContent(i, j);
110  conte = occupancy_map->getBinError(i, j);
111  if (fev > 0. && cnorm > 1.e-30) {
112  occupancy_map->setBinContent(i, j, cont / fev);
113  occupancy_map->setBinError(i, j, conte / fev);
114  }
115 
116  sumphi += cont;
117 
118  } // end of iphy cycle (j)
119 
120  // Occupancy vs ieta histo is drawn
121  // phi-factor evaluation for occupancy_vs_ieta calculation
122  int ieta = i - 43; // should be the same as int ieta =
123  // int(occupancy_vs_ieta->getBinCenter(i));
124 
125  if (ieta >= -20 && ieta <= 20) {
126  phi_factor = 72.;
127  } else {
128  if (ieta >= 40 || ieta <= -40) {
129  phi_factor = 18.;
130  } else
131  phi_factor = 36.;
132  }
133 
134  cnorm = sumphi / phi_factor;
135  cnorme = pow(sumphi, 0.5) / phi_factor;
136  if (fev > 0. && cnorm > 1.e-30) {
137  occupancy_vs_ieta->setBinContent(i, cnorm / fev);
138  occupancy_vs_ieta->setBinError(i, cnorme / fev);
139  }
140 
141  } // end of ieta cycle (i)
142 
143  return 1;
144 }
int nevent
Definition: AMPTWrapper.h:84
virtual double getEntries() const
get # of entries
virtual int getNbinsY() const
get # of bins in Y-axis
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
std::string getName(const G4String &)
Definition: ForwardName.cc:3
virtual int getNbinsX() const
get # of bins in X-axis
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
cont
load Luminosity info ##
Definition: generateEDF.py:620
virtual double getBinContent(int binx) const
get content of bin (1-D)

◆ dqmEndJob()

void CaloTowersDQMClient::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 146 of file CaloTowersDQMClient.cc.

References CaloTowersEndjob(), gather_cfg::cout, dirName_, dqm::implementation::IGetter::getContents(), dqm::implementation::IGetter::getSubdirs(), mps_fire::i, dqmiolumiharvest::j, dqm::implementation::NavigatorBase::setCurrentFolder(), and verbose_.

146  {
147  igetter.setCurrentFolder(dirName_);
148  if (verbose_)
149  std::cout << "\nrunClient" << std::endl;
150 
151  std::vector<MonitorElement *> hcalMEs;
152 
153  // Since out folders are fixed to three, we can just go over these three
154  // folders i.e., CaloTowersD/CaloTowersTask, HcalRecHitsD/HcalRecHitTask,
155  // NoiseRatesV/NoiseRatesTask.
156  std::vector<std::string> fullPathHLTFolders = igetter.getSubdirs();
157  for (unsigned int i = 0; i < fullPathHLTFolders.size(); i++) {
158  if (verbose_)
159  std::cout << "\nfullPath: " << fullPathHLTFolders[i] << std::endl;
160  igetter.setCurrentFolder(fullPathHLTFolders[i]);
161 
162  std::vector<std::string> fullSubPathHLTFolders = igetter.getSubdirs();
163  for (unsigned int j = 0; j < fullSubPathHLTFolders.size(); j++) {
164  if (verbose_)
165  std::cout << "fullSub: " << fullSubPathHLTFolders[j] << std::endl;
166 
167  if (strcmp(fullSubPathHLTFolders[j].c_str(), "CaloTowersD/CaloTowersTask") == 0) {
168  hcalMEs = igetter.getContents(fullSubPathHLTFolders[j]);
169  if (verbose_)
170  std::cout << "hltMES size : " << hcalMEs.size() << std::endl;
171  if (!CaloTowersEndjob(hcalMEs))
172  std::cout << "\nError in CaloTowersEndjob!" << std::endl << std::endl;
173  }
174  }
175  }
176 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
int CaloTowersEndjob(const std::vector< MonitorElement *> &hcalMEs)
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
Definition: DQMStore.cc:625
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:739

Member Data Documentation

◆ conf_

edm::ParameterSet CaloTowersDQMClient::conf_
private

Definition at line 34 of file CaloTowersDQMClient.h.

◆ debug_

bool CaloTowersDQMClient::debug_
private

Definition at line 37 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient().

◆ dirName_

std::string CaloTowersDQMClient::dirName_
private

Definition at line 39 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient(), and dqmEndJob().

◆ dirNameJet_

std::string CaloTowersDQMClient::dirNameJet_
private

Definition at line 40 of file CaloTowersDQMClient.h.

◆ dirNameMET_

std::string CaloTowersDQMClient::dirNameMET_
private

Definition at line 41 of file CaloTowersDQMClient.h.

◆ outputFile_

std::string CaloTowersDQMClient::outputFile_
private

Definition at line 33 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient().

◆ verbose_

bool CaloTowersDQMClient::verbose_
private

Definition at line 36 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient(), CaloTowersEndjob(), and dqmEndJob().