CMS 3D CMS Logo

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

#include <CaloTowersClient.h>

Inheritance diagram for CaloTowersClient:
DQMEDHarvester edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, 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
 
 CaloTowersClient (const edm::ParameterSet &)
 
int CaloTowersEndjob (const std::vector< MonitorElement * > &hcalMEs)
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
 ~CaloTowersClient () override
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
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 ()
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
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 endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &es) 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::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator >
 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
 
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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 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
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
- Protected Attributes inherited from DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 34 of file CaloTowersClient.h.

Constructor & Destructor Documentation

◆ CaloTowersClient()

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

Definition at line 11 of file CaloTowersClient.cc.

11  : conf_(iConfig) {
12  outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile", "myfile.root");
13 
14  debug_ = false;
15  verbose_ = false;
16  dirName_ = iConfig.getParameter<std::string>("DQMDirName");
17 }

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

◆ ~CaloTowersClient()

CaloTowersClient::~CaloTowersClient ( )
override

Definition at line 19 of file CaloTowersClient.cc.

19 {}

Member Function Documentation

◆ beginJob()

void CaloTowersClient::beginJob ( void  )
overridevirtual

Reimplemented from DQMEDHarvester.

Definition at line 21 of file CaloTowersClient.cc.

21 {}

◆ CaloTowersEndjob()

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

Definition at line 57 of file CaloTowersClient.cc.

57  {
58  int useAllHistos = 0;
59  MonitorElement* Ntowers_vs_ieta = nullptr;
60  MonitorElement *mapEnergy_N = nullptr, *mapEnergy_E = nullptr, *mapEnergy_H = nullptr, *mapEnergy_EH = nullptr;
61  MonitorElement *occupancy_map = nullptr, *occupancy_vs_ieta = nullptr;
62  for (unsigned int ih = 0; ih < hcalMEs.size(); ih++) {
63  if (strcmp(hcalMEs[ih]->getName().c_str(), "Ntowers_per_event_vs_ieta") == 0) {
64  Ntowers_vs_ieta = hcalMEs[ih];
65  }
66  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_Nentries") == 0) {
67  mapEnergy_N = hcalMEs[ih];
68  }
69  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_H") == 0) {
70  useAllHistos++;
71  mapEnergy_H = hcalMEs[ih];
72  }
73  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_E") == 0) {
74  useAllHistos++;
75  mapEnergy_E = hcalMEs[ih];
76  }
77  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_EH") == 0) {
78  useAllHistos++;
79  mapEnergy_EH = hcalMEs[ih];
80  }
81  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_occupancy") == 0) {
82  occupancy_map = hcalMEs[ih];
83  }
84  if (strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_occupancy_vs_ieta") == 0) {
85  occupancy_vs_ieta = hcalMEs[ih];
86  }
87  }
88  if (useAllHistos != 0 && useAllHistos != 3)
89  return 0;
90 
91  double nevent = mapEnergy_N->getEntries();
92  if (verbose_)
93  std::cout << "nevent : " << nevent << std::endl;
94 
95  // mean number of towers per ieta
96  int nx = Ntowers_vs_ieta->getNbinsX();
97  float cont;
98  float econt;
99  float fev = float(nevent);
100 
101  for (int i = 1; i <= nx; i++) {
102  cont = Ntowers_vs_ieta->getBinContent(i) / fev;
103  econt = Ntowers_vs_ieta->getBinError(i) / fev;
104  Ntowers_vs_ieta->setBinContent(i, cont);
105  Ntowers_vs_ieta->setBinError(i, econt);
106  }
107 
108  // mean energies & occupancies evaluation
109 
110  nx = mapEnergy_N->getNbinsX();
111  int ny = mapEnergy_N->getNbinsY();
112  float cnorm;
113  float enorm;
114  float phi_factor;
115 
116  for (int i = 1; i <= nx; i++) {
117  float sumphi = 0.;
118  float sumphie = 0.;
119 
120  for (int j = 1; j <= ny; j++) {
121  // Emean
122  cnorm = mapEnergy_N->getBinContent(i, j);
123  //Phi histos are not used in the macros
124  if (cnorm > 0.000001 && useAllHistos) {
125  cont = mapEnergy_E->getBinContent(i, j) / cnorm;
126  econt = mapEnergy_E->getBinError(i, j) / cnorm;
127  mapEnergy_E->setBinContent(i, j, cont);
128  mapEnergy_E->setBinError(i, j, econt);
129 
130  cont = mapEnergy_H->getBinContent(i, j) / cnorm;
131  econt = mapEnergy_H->getBinError(i, j) / cnorm;
132  mapEnergy_H->setBinContent(i, j, cont);
133  mapEnergy_H->setBinError(i, j, econt);
134 
135  cont = mapEnergy_EH->getBinContent(i, j) / cnorm;
136  econt = mapEnergy_EH->getBinError(i, j) / cnorm;
137  mapEnergy_EH->setBinContent(i, j, cont);
138  mapEnergy_EH->setBinError(i, j, econt);
139  }
140 
141  // Occupancy (needed for occupancy vs ieta)
142  cnorm = occupancy_map->getBinContent(i, j) / fev;
143  enorm = occupancy_map->getBinError(i, j) / fev;
144  if (cnorm > 1.e-30)
145  occupancy_map->setBinContent(i, j, cnorm);
146 
147  sumphi += cnorm;
148  sumphie += enorm * enorm;
149 
150  } // end of iphy cycle (j)
151 
152  //Occupancy vs ieta histo is drawn
153  // phi-factor evaluation for occupancy_vs_ieta calculation
154  int ieta = i - 42; // -41,-1,1,41
155  if (ieta >= -20 && ieta <= 20) {
156  phi_factor = 72.;
157  } else {
158  if (ieta >= 40 || ieta <= -40) {
159  phi_factor = 18.;
160  } else
161  phi_factor = 36.;
162  }
163 
164  cnorm = sumphi / phi_factor;
165  enorm = sqrt(sumphie) / phi_factor;
166  occupancy_vs_ieta->setBinContent(i, cnorm);
167  occupancy_vs_ieta->setBinError(i, enorm);
168 
169  } // end of ieta cycle (i)
170 
171  return 1;
172 }

References generateEDF::cont, gather_cfg::cout, MillePedeFileConverter_cfg::e, dqmMemoryStats::float, dqm::impl::MonitorElement::getBinContent(), dqm::impl::MonitorElement::getBinError(), dqm::impl::MonitorElement::getEntries(), getName(), dqm::impl::MonitorElement::getNbinsX(), dqm::impl::MonitorElement::getNbinsY(), mps_fire::i, LEDCalibrationChannels::ieta, dqmiolumiharvest::j, nevent, dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), mathSSE::sqrt(), CaloTowersParam_cfi::useAllHistos, and verbose_.

Referenced by dqmEndJob().

◆ dqmEndJob()

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

Implements DQMEDHarvester.

Definition at line 23 of file CaloTowersClient.cc.

23  {
24  igetter.setCurrentFolder(dirName_);
25 
26  if (verbose_)
27  std::cout << "\nrunClient" << std::endl;
28 
29  std::vector<MonitorElement*> hcalMEs;
30 
31  // Since out folders are fixed to three, we can just go over these three folders
32  // i.e., CaloTowersV/CaloTowersTask, HcalRecHitsV/HcalRecHitTask, NoiseRatesV/NoiseRatesTask.
33  std::vector<std::string> fullPathHLTFolders = igetter.getSubdirs();
34  for (unsigned int i = 0; i < fullPathHLTFolders.size(); i++) {
35  if (verbose_)
36  std::cout << "\nfullPath: " << fullPathHLTFolders[i] << std::endl;
37  igetter.setCurrentFolder(fullPathHLTFolders[i]);
38 
39  std::vector<std::string> fullSubPathHLTFolders = igetter.getSubdirs();
40  for (unsigned int j = 0; j < fullSubPathHLTFolders.size(); j++) {
41  if (verbose_)
42  std::cout << "fullSub: " << fullSubPathHLTFolders[j] << std::endl;
43 
44  if (strcmp(fullSubPathHLTFolders[j].c_str(), "CaloTowersV/CaloTowersTask") == 0) {
45  hcalMEs = igetter.getContents(fullSubPathHLTFolders[j]);
46  if (verbose_)
47  std::cout << "hltMES size : " << hcalMEs.size() << std::endl;
48  if (!CaloTowersEndjob(hcalMEs))
49  std::cout << "\nError in CaloTowersEndjob!" << std::endl << std::endl;
50  }
51  }
52  }
53 }

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_.

Member Data Documentation

◆ conf_

edm::ParameterSet CaloTowersClient::conf_
private

Definition at line 38 of file CaloTowersClient.h.

◆ debug_

bool CaloTowersClient::debug_
private

Definition at line 41 of file CaloTowersClient.h.

Referenced by CaloTowersClient().

◆ dirName_

std::string CaloTowersClient::dirName_
private

Definition at line 43 of file CaloTowersClient.h.

Referenced by CaloTowersClient(), and dqmEndJob().

◆ dirNameJet_

std::string CaloTowersClient::dirNameJet_
private

Definition at line 44 of file CaloTowersClient.h.

◆ dirNameMET_

std::string CaloTowersClient::dirNameMET_
private

Definition at line 45 of file CaloTowersClient.h.

◆ outputFile_

std::string CaloTowersClient::outputFile_
private

Definition at line 36 of file CaloTowersClient.h.

Referenced by CaloTowersClient().

◆ verbose_

bool CaloTowersClient::verbose_
private

Definition at line 40 of file CaloTowersClient.h.

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

nevent
int nevent
Definition: AMPTWrapper.h:84
mps_fire.i
i
Definition: mps_fire.py:355
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
CaloTowersClient::conf_
edm::ParameterSet conf_
Definition: CaloTowersClient.h:38
CaloTowersClient::outputFile_
std::string outputFile_
Definition: CaloTowersClient.h:36
gather_cfg.cout
cout
Definition: gather_cfg.py:144
generateEDF.cont
cont
load Luminosity info ##
Definition: generateEDF.py:629
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
CaloTowersParam_cfi.useAllHistos
useAllHistos
Definition: CaloTowersParam_cfi.py:8
CaloTowersClient::verbose_
bool verbose_
Definition: CaloTowersClient.h:40
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
getName
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:235
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CaloTowersClient::dirName_
std::string dirName_
Definition: CaloTowersClient.h:43
dqm::impl::MonitorElement::getEntries
virtual double getEntries() const
get # of entries
Definition: MonitorElement.cc:628
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
CaloTowersClient::CaloTowersEndjob
int CaloTowersEndjob(const std::vector< MonitorElement * > &hcalMEs)
Definition: CaloTowersClient.cc:57
dqm::impl::MonitorElement::getNbinsY
virtual int getNbinsY() const
get # of bins in Y-axis
Definition: MonitorElement.cc:580
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:691
dqm::impl::MonitorElement::getNbinsX
virtual int getNbinsX() const
get # of bins in X-axis
Definition: MonitorElement.cc:574
dqm::impl::MonitorElement::setBinError
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
Definition: MonitorElement.cc:709
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
dqm::impl::MonitorElement::getBinError
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
Definition: MonitorElement.cc:610
CaloTowersClient::debug_
bool debug_
Definition: CaloTowersClient.h:41
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:592
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37