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

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

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

Constructor & Destructor Documentation

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

Definition at line 50 of file HGCalSimHitsClient.cc.

50  :
51  nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
52  nTimes_(iConfig.getParameter<int>("TimeSlices")),
53  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity",0)) { }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
HGCalSimHitsClient::~HGCalSimHitsClient ( )
inlineoverride

Member Function Documentation

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

Definition at line 55 of file HGCalSimHitsClient.cc.

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

Referenced by ~HGCalSimHitsClient().

55  {
56 
57  if (nameDetector_ == "HCal") {
59  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
60  const HcalDDDRecConstants *hcons = &(*pHRNDC);
61  layers_ = hcons->getMaxDepth(1);
62  } else {
64  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
65  const HGCalDDDConstants & hgcons = (*pHGDC);
66  layers_ = hgcons.layers(false);
67  }
68  if (verbosity_>0)
69  edm::LogVerbatim("HGCalValidation") << "Initialize HGCalSimHitsClient for "
70  << nameDetector_ << " : " << layers_;
71 }
unsigned int layers(bool reco) const
int getMaxDepth(const int &type) const
void HGCalSimHitsClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 73 of file HGCalSimHitsClient.cc.

References runClient_().

Referenced by ~HGCalSimHitsClient().

73  {
74  runClient_(ib, ig);
75 }
virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
void HGCalSimHitsClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Definition at line 77 of file HGCalSimHitsClient.cc.

References DQMStore::IGetter::getContents(), DQMStore::IGetter::getSubdirs(), mps_fire::i, nameDetector_, DQMStore::IGetter::setCurrentFolder(), simHitsEndjob(), AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

Referenced by dqmEndJob(), and ~HGCalSimHitsClient().

77  {
78 
79  ig.setCurrentFolder("/");
80  if (verbosity_>0) edm::LogVerbatim("HGCalValidation") << " runClient";
81  std::vector<MonitorElement*> hgcalMEs;
82  std::vector<std::string> fullDirPath = ig.getSubdirs();
83 
84  for (unsigned int i=0; i<fullDirPath.size(); i++) {
85  if (verbosity_>0)
86  edm::LogVerbatim("HGCalValidation") << "fullPath: " << fullDirPath.at(i);
87  ig.setCurrentFolder(fullDirPath.at(i));
88  std::vector<std::string> fullSubDirPath = ig.getSubdirs();
89 
90  for (unsigned int j=0; j<fullSubDirPath.size(); j++) {
91  if (verbosity_>0)
92  edm::LogVerbatim("HGCalValidation") << "fullSubPath: "
93  << fullSubDirPath.at(j);
94  std::string nameDirectory = "HGCAL/HGCalSimHitsV/"+nameDetector_;
95 
96  if (strcmp(fullSubDirPath.at(j).c_str(), nameDirectory.c_str()) == 0) {
97  hgcalMEs = ig.getContents(fullSubDirPath.at(j));
98  if (verbosity_>0)
99  edm::LogVerbatim("HGCalValidation") << "hgcalMES size : "
100  << hgcalMEs.size();
101  if (!simHitsEndjob(hgcalMEs))
102  edm::LogWarning("HGCalValidation") << "\nError in SimhitsEndjob!";
103  }
104  }
105  }
106 }
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 simHitsEndjob(const std::vector< MonitorElement * > &hcalMEs)
int HGCalSimHitsClient::simHitsEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

loop over timeslice

Definition at line 108 of file HGCalSimHitsClient.cc.

References DEFINE_FWK_MODULE, MonitorElement::getMean(), getName(), mps_fire::i, createfilelist::int, layers_, dataset::name, nevent, nTimes_, and MonitorElement::setBinContent().

Referenced by runClient_(), and ~HGCalSimHitsClient().

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

Member Data Documentation

unsigned int HGCalSimHitsClient::layers_
private

Definition at line 38 of file HGCalSimHitsClient.cc.

Referenced by beginRun(), and simHitsEndjob().

std::string HGCalSimHitsClient::nameDetector_
private

Definition at line 36 of file HGCalSimHitsClient.cc.

Referenced by beginRun(), and runClient_().

int HGCalSimHitsClient::nTimes_
private

Definition at line 37 of file HGCalSimHitsClient.cc.

Referenced by simHitsEndjob().

int HGCalSimHitsClient::verbosity_
private

Definition at line 37 of file HGCalSimHitsClient.cc.

Referenced by beginRun(), and runClient_().