CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HGCalSimHitsClient Class Reference
Inheritance diagram for HGCalSimHitsClient:
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 beginRun (const edm::Run &run, const edm::EventSetup &c) override
 
void dqmEndJob (DQMStore::IBooker &ib, DQMStore::IGetter &ig) override
 
 HGCalSimHitsClient (const edm::ParameterSet &)
 
virtual void runClient_ (DQMStore::IBooker &ib, DQMStore::IGetter &ig)
 
int simHitsEndjob (const std::vector< MonitorElement * > &hcalMEs)
 
 ~HGCalSimHitsClient () 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 ()
 
 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

unsigned int layers_
 
std::string nameDetector_
 
int nTimes_
 
int verbosity_
 

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 30 of file HGCalSimHitsClient.cc.

Constructor & Destructor Documentation

◆ HGCalSimHitsClient()

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

Definition at line 47 of file HGCalSimHitsClient.cc.

48  : nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
49  nTimes_(iConfig.getParameter<int>("TimeSlices")),
50  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)) {}

◆ ~HGCalSimHitsClient()

HGCalSimHitsClient::~HGCalSimHitsClient ( )
inlineoverride

Definition at line 39 of file HGCalSimHitsClient.cc.

39 {}

Member Function Documentation

◆ beginRun()

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

Definition at line 52 of file HGCalSimHitsClient.cc.

52  {
53  if (nameDetector_ == "HCal") {
55  iSetup.get<HcalRecNumberingRecord>().get(pHRNDC);
56  const HcalDDDRecConstants *hcons = &(*pHRNDC);
57  layers_ = hcons->getMaxDepth(1);
58  } else {
60  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
61  const HGCalDDDConstants &hgcons = (*pHGDC);
62  layers_ = hgcons.layers(false);
63  }
64  if (verbosity_ > 0)
65  edm::LogVerbatim("HGCalValidation") << "Initialize HGCalSimHitsClient for " << nameDetector_ << " : " << layers_;
66 }

References edm::EventSetup::get(), get, HcalDDDRecConstants::getMaxDepth(), HGCalDDDConstants::layers(), layers_, nameDetector_, and verbosity_.

◆ dqmEndJob()

void HGCalSimHitsClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 68 of file HGCalSimHitsClient.cc.

68 { runClient_(ib, ig); }

References cuy::ib, and runClient_().

◆ runClient_()

void HGCalSimHitsClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Definition at line 70 of file HGCalSimHitsClient.cc.

70  {
71  ig.setCurrentFolder("/");
72  if (verbosity_ > 0)
73  edm::LogVerbatim("HGCalValidation") << " runClient";
74  std::vector<MonitorElement *> hgcalMEs;
75  std::vector<std::string> fullDirPath = ig.getSubdirs();
76 
77  for (unsigned int i = 0; i < fullDirPath.size(); i++) {
78  if (verbosity_ > 0)
79  edm::LogVerbatim("HGCalValidation") << "fullPath: " << fullDirPath.at(i);
80  ig.setCurrentFolder(fullDirPath.at(i));
81  std::vector<std::string> fullSubDirPath = ig.getSubdirs();
82 
83  for (unsigned int j = 0; j < fullSubDirPath.size(); j++) {
84  if (verbosity_ > 0)
85  edm::LogVerbatim("HGCalValidation") << "fullSubPath: " << fullSubDirPath.at(j);
86  std::string nameDirectory = "HGCAL/HGCalSimHitsV/" + nameDetector_;
87 
88  if (strcmp(fullSubDirPath.at(j).c_str(), nameDirectory.c_str()) == 0) {
89  hgcalMEs = ig.getContents(fullSubDirPath.at(j));
90  if (verbosity_ > 0)
91  edm::LogVerbatim("HGCalValidation") << "hgcalMES size : " << hgcalMEs.size();
92  if (!simHitsEndjob(hgcalMEs))
93  edm::LogWarning("HGCalValidation") << "\nError in SimhitsEndjob!";
94  }
95  }
96  }
97 }

References dqm::implementation::IGetter::getContents(), dqm::implementation::IGetter::getSubdirs(), mps_fire::i, dqmiolumiharvest::j, nameDetector_, dqm::implementation::NavigatorBase::setCurrentFolder(), simHitsEndjob(), AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

Referenced by dqmEndJob().

◆ simHitsEndjob()

int HGCalSimHitsClient::simHitsEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

loop over timeslice

Definition at line 99 of file HGCalSimHitsClient.cc.

99  {
100  std::vector<MonitorElement *> energy_[6];
101  std::vector<MonitorElement *> EtaPhi_Plus_, EtaPhi_Minus_;
102  std::vector<MonitorElement *> HitOccupancy_Plus_, HitOccupancy_Minus_;
103  MonitorElement *MeanHitOccupancy_Plus_, *MeanHitOccupancy_Minus_;
104 
105  std::ostringstream name;
106  double nevent;
107  int nbinsx, nbinsy;
108  for (unsigned int ilayer = 0; ilayer < layers_; ilayer++) {
109  for (int itimeslice = 0; itimeslice < nTimes_; itimeslice++) {
110  //Energy
111  name.str("");
112  name << "energy_time_" << itimeslice << "_layer_" << ilayer;
113  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
114  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
115  energy_[itimeslice].push_back(hgcalMEs[ih]);
116  }
117  }
118  //normalization
119  nevent = energy_[itimeslice].at(ilayer)->getEntries();
120  nbinsx = energy_[itimeslice].at(ilayer)->getNbinsX();
121  for (int i = 1; i <= nbinsx; i++) {
122  double binValue = energy_[itimeslice].at(ilayer)->getBinContent(i) / nevent;
123  energy_[itimeslice].at(ilayer)->setBinContent(i, binValue);
124  }
125  }
126 
127  //EtaPhi 2d plots
128  name.str("");
129  name << "EtaPhi_Plus_"
130  << "layer_" << ilayer;
131  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
132  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
133  EtaPhi_Plus_.push_back(hgcalMEs[ih]);
134  }
135  }
136 
137  name.str("");
138  name << "EtaPhi_Minus_"
139  << "layer_" << ilayer;
140  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
141  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
142  EtaPhi_Minus_.push_back(hgcalMEs[ih]);
143  }
144  }
145  //normalization EtaPhi
146  nevent = EtaPhi_Plus_.at(ilayer)->getEntries();
147  nbinsx = EtaPhi_Plus_.at(ilayer)->getNbinsX();
148  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
149  for (int i = 1; i <= nbinsx; ++i) {
150  for (int j = 1; j <= nbinsy; ++j) {
151  double binValue = EtaPhi_Plus_.at(ilayer)->getBinContent(i, j) / nevent;
152  EtaPhi_Plus_.at(ilayer)->setBinContent(i, j, binValue);
153  }
154  }
155 
156  nevent = EtaPhi_Minus_.at(ilayer)->getEntries();
157  nbinsx = EtaPhi_Minus_.at(ilayer)->getNbinsX();
158  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
159  for (int i = 1; i <= nbinsx; ++i) {
160  for (int j = 1; j <= nbinsy; ++j) {
161  double binValue = EtaPhi_Minus_.at(ilayer)->getBinContent(i, j) / nevent;
162  EtaPhi_Minus_.at(ilayer)->setBinContent(i, j, binValue);
163  }
164  }
165 
166  //HitOccupancy
167  name.str("");
168  name << "HitOccupancy_Plus_layer_" << ilayer;
169  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
170  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
171  HitOccupancy_Plus_.push_back(hgcalMEs[ih]);
172  }
173  }
174  name.str("");
175  name << "HitOccupancy_Minus_layer_" << ilayer;
176  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
177  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
178  HitOccupancy_Minus_.push_back(hgcalMEs[ih]);
179  }
180  }
181 
182  nevent = HitOccupancy_Plus_.at(ilayer)->getEntries();
183  nbinsx = HitOccupancy_Plus_.at(ilayer)->getNbinsX();
184  for (int i = 1; i <= nbinsx; ++i) {
185  double binValue = HitOccupancy_Plus_.at(ilayer)->getBinContent(i) / nevent;
186  HitOccupancy_Plus_.at(ilayer)->setBinContent(i, binValue);
187  }
188 
189  nevent = HitOccupancy_Minus_.at(ilayer)->getEntries();
190  nbinsx = HitOccupancy_Minus_.at(ilayer)->getNbinsX();
191  for (int i = 1; i <= nbinsx; ++i) {
192  double binValue = HitOccupancy_Minus_.at(ilayer)->getBinContent(i) / nevent;
193  HitOccupancy_Minus_.at(ilayer)->setBinContent(i, binValue);
194  }
195 
196  } //loop over layers
197 
198  name.str("");
199  name << "MeanHitOccupancy_Plus";
200  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
201  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
202  MeanHitOccupancy_Plus_ = hgcalMEs[ih];
203  for (int ilayer = 0; ilayer < static_cast<int>(layers_); ++ilayer) {
204  double meanVal = HitOccupancy_Plus_.at(ilayer)->getMean();
205  MeanHitOccupancy_Plus_->setBinContent(ilayer + 1, meanVal);
206  }
207  break;
208  }
209  }
210 
211  name.str("");
212  name << "MeanHitOccupancy_Minus";
213  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
214  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
215  MeanHitOccupancy_Minus_ = hgcalMEs[ih];
216  for (int ilayer = 0; ilayer < static_cast<int>(layers_); ++ilayer) {
217  double meanVal = HitOccupancy_Minus_.at(ilayer)->getMean();
218  MeanHitOccupancy_Minus_->setBinContent(ilayer + 1, meanVal);
219  }
220  break;
221  }
222  }
223 
224  return 1;
225 }

References dqm::impl::MonitorElement::getMean(), getName(), mps_fire::i, dqmiolumiharvest::j, layers_, Skims_PA_cff::name, nevent, nTimes_, and dqm::impl::MonitorElement::setBinContent().

Referenced by runClient_().

Member Data Documentation

◆ layers_

unsigned int HGCalSimHitsClient::layers_
private

Definition at line 35 of file HGCalSimHitsClient.cc.

Referenced by beginRun(), and simHitsEndjob().

◆ nameDetector_

std::string HGCalSimHitsClient::nameDetector_
private

Definition at line 33 of file HGCalSimHitsClient.cc.

Referenced by beginRun(), and runClient_().

◆ nTimes_

int HGCalSimHitsClient::nTimes_
private

Definition at line 34 of file HGCalSimHitsClient.cc.

Referenced by simHitsEndjob().

◆ verbosity_

int HGCalSimHitsClient::verbosity_
private

Definition at line 34 of file HGCalSimHitsClient.cc.

Referenced by beginRun(), and runClient_().

nevent
int nevent
Definition: AMPTWrapper.h:84
mps_fire.i
i
Definition: mps_fire.py:355
HGCalSimHitsClient::nTimes_
int nTimes_
Definition: HGCalSimHitsClient.cc:34
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
HGCalSimHitsClient::nameDetector_
std::string nameDetector_
Definition: HGCalSimHitsClient.cc:33
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HGCalDDDConstants
Definition: HGCalDDDConstants.h:25
HGCalSimHitsClient::layers_
unsigned int layers_
Definition: HGCalSimHitsClient.cc:35
getName
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:235
edm::ESHandle
Definition: DTSurvey.h:22
HcalRecNumberingRecord
Definition: HcalRecNumberingRecord.h:23
HGCalSimHitsClient::simHitsEndjob
int simHitsEndjob(const std::vector< MonitorElement * > &hcalMEs)
Definition: HGCalSimHitsClient.cc:99
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
HGCalDDDConstants::layers
unsigned int layers(bool reco) const
Definition: HGCalDDDConstants.cc:558
edm::LogVerbatim
Definition: MessageLogger.h:297
HGCalSimHitsClient::verbosity_
int verbosity_
Definition: HGCalSimHitsClient.cc:34
cuy.ib
ib
Definition: cuy.py:662
HGCalSimHitsClient::runClient_
virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
Definition: HGCalSimHitsClient.cc:70
get
#define get
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
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm::impl::MonitorElement::getMean
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:549
HcalDDDRecConstants::getMaxDepth
int getMaxDepth(const int &type) const
Definition: HcalDDDRecConstants.h:88
HcalDDDRecConstants
Definition: HcalDDDRecConstants.h:23
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27