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

Constructor & Destructor Documentation

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

Definition at line 14 of file HcalSimHitsClient.cc.

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

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

Definition at line 19 of file HcalSimHitsClient.cc.

19 {}

Member Function Documentation

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

Definition at line 21 of file HcalSimHitsClient.cc.

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

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

Implements DQMEDHarvester.

Definition at line 34 of file HcalSimHitsClient.cc.

References runClient_().

34 { runClient_(ib, ig); }
virtual void runClient_(DQMStore::IBooker &, DQMStore::IGetter &)
std::vector< std::string > HcalSimHitsClient::getHistogramTypes ( )
private

Definition at line 172 of file HcalSimHitsClient.cc.

References DEFINE_FWK_MODULE, egammaForCoreTracking_cff::depth, gen::k, SiStripPI::max, CMSBoostedTauSeedingParameters_cfi::maxDepth, maxDepthHB_, maxDepthHE_, maxDepthHF_, maxDepthHO_, AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

Referenced by SimHitsEndjob().

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

Definition at line 36 of file HcalSimHitsClient.cc.

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

Referenced by dqmEndJob().

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

Definition at line 68 of file HcalSimHitsClient.cc.

References objects.autophobj::float, MonitorElement::getBinContent(), MonitorElement::getEntries(), getHistogramTypes(), getName(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), mps_fire::i, gen::k, dataset::name, nevent, nTime, nType1, MonitorElement::setBinContent(), AlCaHLTBitMon_QueryRunRegistry::string, ntuplemaker::time, and verbose_.

Referenced by runClient_().

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

Member Data Documentation

std::string HcalSimHitsClient::dirName_
private

Definition at line 41 of file HcalSimHitsClient.h.

Referenced by HcalSimHitsClient(), and runClient_().

const HcalDDDRecConstants* HcalSimHitsClient::hcons
private

Definition at line 45 of file HcalSimHitsClient.h.

Referenced by beginRun().

int HcalSimHitsClient::maxDepthHB_
private

Definition at line 46 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

int HcalSimHitsClient::maxDepthHE_
private

Definition at line 46 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

int HcalSimHitsClient::maxDepthHF_
private

Definition at line 46 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

int HcalSimHitsClient::maxDepthHO_
private

Definition at line 46 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

const int HcalSimHitsClient::nTime = 4
staticprivate

Definition at line 43 of file HcalSimHitsClient.h.

Referenced by SimHitsEndjob().

const int HcalSimHitsClient::nType1 = 4
staticprivate

Definition at line 44 of file HcalSimHitsClient.h.

Referenced by SimHitsEndjob().

bool HcalSimHitsClient::verbose_
private