CMS 3D CMS Logo

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

#include <HcalSimHitsClient.h>

Inheritance diagram for HcalSimHitsClient:
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 beginRun (edm::Run const &run, edm::EventSetup const &c) override
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
 HcalSimHitsClient (const edm::ParameterSet &)
 
virtual void runClient_ (DQMStore::IBooker &, DQMStore::IGetter &)
 
 ~HcalSimHitsClient () 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

std::vector< std::string > getHistogramTypes ()
 
int SimHitsEndjob (const std::vector< MonitorElement * > &hcalMEs)
 

Private Attributes

std::string dirName_
 
const HcalDDDRecConstantshcons
 
int maxDepthHB_
 
int maxDepthHE_
 
int maxDepthHF_
 
int maxDepthHO_
 
bool verbose_
 

Static Private Attributes

static const int nTime = 4
 
static const int nType1 = 4
 

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 33 of file HcalSimHitsClient.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file HcalSimHitsClient.cc.

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

13  {
14  dirName_ = iConfig.getParameter<std::string>("DQMDirName");
15  verbose_ = iConfig.getUntrackedParameter<bool>("Verbosity", false);
16 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
HcalSimHitsClient::~HcalSimHitsClient ( )
override

Definition at line 18 of file HcalSimHitsClient.cc.

18 {}

Member Function Documentation

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

Definition at line 20 of file HcalSimHitsClient.cc.

References edm::EventSetup::get(), HcalDDDRecConstants::getMaxDepth(), hcons, maxDepthHB_, maxDepthHE_, maxDepthHF_, and maxDepthHO_.

20  {
22  c.get<HcalRecNumberingRecord>().get(pHRNDC);
23  hcons = &(*pHRNDC);
28 
29  edm::LogInfo("HitsValidationHcal") << " Maximum Depths HB:" << maxDepthHB_ << " HE:" << maxDepthHE_
30  << " HO:" << maxDepthHO_ << " HF:" << maxDepthHF_;
31 }
const HcalDDDRecConstants * hcons
int getMaxDepth(const int &type) const
void HcalSimHitsClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 33 of file HcalSimHitsClient.cc.

References runClient_().

33 { runClient_(ib, ig); }
virtual void runClient_(DQMStore::IBooker &, DQMStore::IGetter &)
ib
Definition: cuy.py:662
std::vector< std::string > HcalSimHitsClient::getHistogramTypes ( )
private

Definition at line 171 of file HcalSimHitsClient.cc.

References DEFINE_FWK_MODULE, LEDCalibrationChannels::depth, dqmdumpme::k, SiStripPI::max, HLT_2018_cff::maxDepth, maxDepthHB_, maxDepthHE_, maxDepthHF_, maxDepthHO_, AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

Referenced by SimHitsEndjob().

171  {
173  if (verbose_)
174  edm::LogInfo("HitsValidationHcal") << "Max depth 1st step:: " << maxDepth;
175  maxDepth = std::max(maxDepth, maxDepthHF_);
176  if (verbose_)
177  edm::LogInfo("HitsValidationHcal") << "Max depth 2nd step:: " << maxDepth;
178  maxDepth = std::max(maxDepth, maxDepthHO_);
179  if (verbose_)
180  edm::LogInfo("HitsValidationHcal") << "Max depth 3rd step:: " << maxDepth;
181  std::vector<std::string> divisions;
182  char name1[20];
183 
184  // first overall Hcal
185  for (int depth = 0; depth < maxDepth; ++depth) {
186  sprintf(name1, "HC%d", depth);
187  divisions.push_back(std::string(name1));
188  }
189  // HB
190  for (int depth = 0; depth < maxDepthHB_; ++depth) {
191  sprintf(name1, "HB%d", depth);
192  divisions.push_back(std::string(name1));
193  }
194  // HE
195  for (int depth = 0; depth < maxDepthHE_; ++depth) {
196  sprintf(name1, "HE%d+z", depth);
197  divisions.push_back(std::string(name1));
198  sprintf(name1, "HE%d-z", depth);
199  divisions.push_back(std::string(name1));
200  }
201  // HO
202  {
203  int depth = maxDepthHO_;
204  sprintf(name1, "HO%d", depth);
205  divisions.push_back(std::string(name1));
206  }
207  // HF (first absorber, then different types of abnormal hits)
208  std::string hfty1[4] = {"A", "W", "B", "J"};
209  for (int k = 0; k < 4; ++k) {
210  for (int depth = 0; depth < maxDepthHF_; ++depth) {
211  sprintf(name1, "HF%s%d+z", hfty1[k].c_str(), depth);
212  divisions.push_back(std::string(name1));
213  sprintf(name1, "HF%s%d-z", hfty1[k].c_str(), depth);
214  divisions.push_back(std::string(name1));
215  }
216  }
217  return divisions;
218 }
void HcalSimHitsClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Definition at line 35 of file HcalSimHitsClient.cc.

References dirName_, dqm::dqmstoreimpl::DQMStore::IGetter::getContents(), dqm::dqmstoreimpl::DQMStore::IGetter::getSubdirs(), mps_fire::i, dqmiolumiharvest::j, dqm::dqmstoreimpl::DQMStore::IGetter::setCurrentFolder(), SimHitsEndjob(), and verbose_.

Referenced by dqmEndJob().

35  {
36  ig.setCurrentFolder(dirName_);
37 
38  if (verbose_)
39  edm::LogInfo("HitsValidationHcal") << "runClient";
40 
41  std::vector<MonitorElement *> hcalMEs;
42 
43  std::vector<std::string> fullPathHLTFolders = ig.getSubdirs();
44  for (unsigned int i = 0; i < fullPathHLTFolders.size(); i++) {
45  if (verbose_)
46  edm::LogInfo("HitsValidationHcal") << "fullPath: " << fullPathHLTFolders[i];
47  ig.setCurrentFolder(fullPathHLTFolders[i]);
48 
49  std::vector<std::string> fullSubPathHLTFolders = ig.getSubdirs();
50  for (unsigned int j = 0; j < fullSubPathHLTFolders.size(); j++) {
51  if (verbose_)
52  edm::LogInfo("HitsValidationHcal") << "fullSub: " << fullSubPathHLTFolders[j];
53 
54  if (strcmp(fullSubPathHLTFolders[j].c_str(), "HcalHitsV/SimHitsValidationHcal") == 0) {
55  hcalMEs = ig.getContents(fullSubPathHLTFolders[j]);
56  if (verbose_)
57  edm::LogInfo("HitsValidationHcal") << "hltMES size : " << hcalMEs.size();
58  if (!SimHitsEndjob(hcalMEs))
59  edm::LogWarning("HitsValidationHcal") << "Error in SimhitEndjob!";
60  }
61  }
62  }
63 }
int SimHitsEndjob(const std::vector< MonitorElement * > &hcalMEs)
int HcalSimHitsClient::SimHitsEndjob ( const std::vector< MonitorElement * > &  hcalMEs)
private

Definition at line 67 of file HcalSimHitsClient.cc.

References generateEDF::cont, EcalCondDBWriter_cfi::Energy, dqmMemoryStats::float, dqm::impl::MonitorElement::getBinContent(), dqm::impl::MonitorElement::getEntries(), getHistogramTypes(), getName(), dqm::impl::MonitorElement::getNbinsX(), dqm::impl::MonitorElement::getNbinsY(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, Skims_PA_cff::name, hfnoseParametersInitialization_cfi::name2, nevent, nTime, nType1, dqm::impl::MonitorElement::setBinContent(), AlCaHLTBitMon_QueryRunRegistry::string, ntuplemaker::time, and verbose_.

Referenced by runClient_().

67  {
68  std::vector<std::string> divisions = getHistogramTypes();
69  MonitorElement *Occupancy_map[nTime][divisions.size()];
70  MonitorElement *Energy[nType1], *Time_weighteden[nType1];
71  MonitorElement *HitEnergyvsieta[divisions.size()], *HitTimevsieta[divisions.size()];
72 
73  std::string time[nTime] = {"25", "50", "100", "250"};
74  std::string detdivision[nType1] = {"HB", "HE", "HF", "HO"};
75  char name[40], name1[40], name2[40], name3[40], name4[40];
76 
77  for (int k = 0; k < nType1; k++) {
78  Energy[k] = nullptr;
79  Time_weighteden[k] = nullptr;
80  for (unsigned int ih = 0; ih < hcalMEs.size(); ih++) {
81  sprintf(name1, "Energy_%s", detdivision[k].c_str());
82  sprintf(name2, "Time_Enweighted_%s", detdivision[k].c_str());
83  if (strcmp(hcalMEs[ih]->getName().c_str(), name1) == 0) {
84  Energy[k] = hcalMEs[ih];
85  }
86  if (strcmp(hcalMEs[ih]->getName().c_str(), name2) == 0) {
87  Time_weighteden[k] = hcalMEs[ih];
88  }
89  }
90  }
91 
92  for (int i = 0; i < nTime; i++) {
93  for (unsigned int j = 0; j < divisions.size(); j++) {
94  for (unsigned int ih = 0; ih < hcalMEs.size(); ih++) {
95  sprintf(name, "HcalHitE%s%s", time[i].c_str(), divisions[j].c_str());
96  if (strcmp(hcalMEs[ih]->getName().c_str(), name) == 0) {
97  Occupancy_map[i][j] = hcalMEs[ih];
98  }
99  }
100  }
101  }
102 
103  for (unsigned int k = 0; k < divisions.size(); k++) {
104  HitEnergyvsieta[k] = nullptr;
105  HitTimevsieta[k] = nullptr;
106  for (unsigned int ih = 0; ih < hcalMEs.size(); ih++) {
107  sprintf(name3, "HcalHitEta%s", divisions[k].c_str());
108  sprintf(name4, "HcalHitTimeAEta%s", divisions[k].c_str());
109  if (strcmp(hcalMEs[ih]->getName().c_str(), name3) == 0) {
110  HitEnergyvsieta[k] = hcalMEs[ih];
111  }
112  if (strcmp(hcalMEs[ih]->getName().c_str(), name4) == 0) {
113  HitTimevsieta[k] = hcalMEs[ih];
114  }
115  }
116  }
117 
118  // mean energy
119 
120  double nevent = Energy[0]->getEntries();
121  if (verbose_)
122  edm::LogInfo("HitsValidationHcal") << "nevent : " << nevent;
123 
124  float cont[nTime][divisions.size()];
125  float en[nType1], tme[nType1];
126  float hitenergy[divisions.size()], hittime[divisions.size()];
127  float fev = float(nevent);
128 
129  for (int dettype = 0; dettype < nType1; dettype++) {
130  int nx1 = Energy[dettype]->getNbinsX();
131  for (int i = 0; i <= nx1; i++) {
132  en[dettype] = Energy[dettype]->getBinContent(i) / fev;
133  Energy[dettype]->setBinContent(i, en[dettype]);
134  }
135  int nx2 = Time_weighteden[dettype]->getNbinsX();
136  for (int i = 0; i <= nx2; i++) {
137  tme[dettype] = Time_weighteden[dettype]->getBinContent(i) / fev;
138  Time_weighteden[dettype]->setBinContent(i, tme[dettype]);
139  }
140  }
141 
142  for (unsigned int dettype = 0; dettype < divisions.size(); dettype++) {
143  int nx1 = HitEnergyvsieta[dettype]->getNbinsX();
144  for (int i = 0; i <= nx1; i++) {
145  hitenergy[dettype] = HitEnergyvsieta[dettype]->getBinContent(i) / fev;
146  HitEnergyvsieta[dettype]->setBinContent(i, hitenergy[dettype]);
147  }
148  int nx2 = HitTimevsieta[dettype]->getNbinsX();
149  for (int i = 0; i <= nx2; i++) {
150  hittime[dettype] = HitTimevsieta[dettype]->getBinContent(i) / fev;
151  HitTimevsieta[dettype]->setBinContent(i, hittime[dettype]);
152  }
153  }
154 
155  for (int itime = 0; itime < nTime; itime++) {
156  for (unsigned int det = 0; det < divisions.size(); det++) {
157  int ny = Occupancy_map[itime][det]->getNbinsY();
158  int nx = Occupancy_map[itime][det]->getNbinsX();
159  for (int i = 1; i < nx + 1; i++) {
160  for (int j = 1; j < ny + 1; j++) {
161  cont[itime][det] = Occupancy_map[itime][det]->getBinContent(i, j) / fev;
162  Occupancy_map[itime][det]->setBinContent(i, j, cont[itime][det]);
163  }
164  }
165  }
166  }
167 
168  return 1;
169 }
static const int nType1
virtual int getNbinsY() const
get # of bins in Y-axis
std::vector< std::string > getHistogramTypes()
int nevent
Definition: AMPTWrapper.h:84
virtual int getNbinsX() const
get # of bins in X-axis
virtual double getEntries() const
get # of entries
virtual double getBinContent(int binx) const
get content of bin (1-D)
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:236
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
static const int nTime
cont
load Luminosity info ##
Definition: generateEDF.py:629

Member Data Documentation

std::string HcalSimHitsClient::dirName_
private

Definition at line 38 of file HcalSimHitsClient.h.

Referenced by HcalSimHitsClient(), and runClient_().

const HcalDDDRecConstants* HcalSimHitsClient::hcons
private

Definition at line 42 of file HcalSimHitsClient.h.

Referenced by beginRun().

int HcalSimHitsClient::maxDepthHB_
private

Definition at line 43 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

int HcalSimHitsClient::maxDepthHE_
private

Definition at line 43 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

int HcalSimHitsClient::maxDepthHF_
private

Definition at line 43 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

int HcalSimHitsClient::maxDepthHO_
private

Definition at line 43 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

const int HcalSimHitsClient::nTime = 4
staticprivate

Definition at line 40 of file HcalSimHitsClient.h.

Referenced by SimHitsEndjob().

const int HcalSimHitsClient::nType1 = 4
staticprivate

Definition at line 41 of file HcalSimHitsClient.h.

Referenced by SimHitsEndjob().

bool HcalSimHitsClient::verbose_
private