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

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 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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 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 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::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 38 of file CaloTowersDQMClient.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file CaloTowersDQMClient.cc.

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

12  : conf_(iConfig) {
13  outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile", "myfile.root");
14  debug_ = false;
15  verbose_ = false;
16  dirName_ = iConfig.getParameter<std::string>("DQMDirName");
17 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet conf_
CaloTowersDQMClient::~CaloTowersDQMClient ( )
override

Definition at line 19 of file CaloTowersDQMClient.cc.

19 {}

Member Function Documentation

void CaloTowersDQMClient::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 21 of file CaloTowersDQMClient.cc.

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

Definition at line 23 of file CaloTowersDQMClient.cc.

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

Definition at line 27 of file CaloTowersDQMClient.cc.

References gather_cfg::cout, MillePedeFileConverter_cfg::e, objects.autophobj::float, MonitorElement::getBinContent(), MonitorElement::getBinError(), MonitorElement::getEntries(), getName(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), mps_fire::i, nevent, funct::pow(), MonitorElement::setBinContent(), MonitorElement::setBinError(), and verbose_.

Referenced by dqmEndJob().

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

Implements DQMEDHarvester.

Definition at line 148 of file CaloTowersDQMClient.cc.

References CaloTowersEndjob(), gather_cfg::cout, DEFINE_FWK_MODULE, dirName_, DQMStore::IGetter::getContents(), DQMStore::IGetter::getSubdirs(), mps_fire::i, DQMStore::IGetter::setCurrentFolder(), and verbose_.

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

Member Data Documentation

edm::ParameterSet CaloTowersDQMClient::conf_
private

Definition at line 41 of file CaloTowersDQMClient.h.

bool CaloTowersDQMClient::debug_
private

Definition at line 44 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient().

std::string CaloTowersDQMClient::dirName_
private

Definition at line 46 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient(), and dqmEndJob().

std::string CaloTowersDQMClient::dirNameJet_
private

Definition at line 47 of file CaloTowersDQMClient.h.

std::string CaloTowersDQMClient::dirNameMET_
private

Definition at line 48 of file CaloTowersDQMClient.h.

std::string CaloTowersDQMClient::outputFile_
private

Definition at line 40 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient().

bool CaloTowersDQMClient::verbose_
private

Definition at line 43 of file CaloTowersDQMClient.h.

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