CMS 3D CMS Logo

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

unsigned int layers_
 
std::string nameDetector_
 
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
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 27 of file HGCalRecHitsClient.cc.

Constructor & Destructor Documentation

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

Definition at line 45 of file HGCalRecHitsClient.cc.

46  : nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
47  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)) {}
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
HGCalRecHitsClient::~HGCalRecHitsClient ( )
inlineoverride

Member Function Documentation

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

Definition at line 49 of file HGCalRecHitsClient.cc.

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

Referenced by ~HGCalRecHitsClient().

49  {
50  if (nameDetector_ == "HCal") {
52  iSetup.get<HcalRecNumberingRecord>().get(pHRNDC);
53  const HcalDDDRecConstants *hcons = &(*pHRNDC);
54  layers_ = hcons->getMaxDepth(1);
55  } else {
57  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
58  const HGCalDDDConstants &hgcons_ = (*pHGDC);
59  layers_ = hgcons_.layers(true);
60  }
61 }
unsigned int layers(bool reco) const
int getMaxDepth(const int &type) const
void HGCalRecHitsClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 63 of file HGCalRecHitsClient.cc.

References runClient_().

Referenced by ~HGCalRecHitsClient().

63 { runClient_(ib, ig); }
virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
ib
Definition: cuy.py:662
int HGCalRecHitsClient::recHitsEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

Definition at line 93 of file HGCalRecHitsClient.cc.

References DEFINE_FWK_MODULE, getName(), mps_fire::i, createfilelist::int, dqmiolumiharvest::j, layers_, Skims_PA_cff::name, and nevent.

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

93  {
94  std::vector<MonitorElement *> energy_;
95  std::vector<MonitorElement *> EtaPhi_Plus_;
96  std::vector<MonitorElement *> EtaPhi_Minus_;
97  std::vector<MonitorElement *> HitOccupancy_Plus_;
98  std::vector<MonitorElement *> HitOccupancy_Minus_;
99  std::vector<MonitorElement *> MeanHitOccupancy_Plus_;
100  std::vector<MonitorElement *> MeanHitOccupancy_Minus_;
101 
102  std::ostringstream name;
103  double nevent;
104  int nbinsx, nbinsy;
105 
106  for (unsigned int ilayer = 0; ilayer < layers_; ilayer++) {
107  name.str("");
108  name << "energy_layer_" << ilayer;
109  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
110  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
111  energy_.push_back(hgcalMEs[ih]);
112  }
113  }
114 
115  //normalization
116  nevent = energy_.at(ilayer)->getEntries();
117  nbinsx = energy_.at(ilayer)->getNbinsX();
118  for (int i = 1; i <= nbinsx; i++) {
119  double binValue = energy_.at(ilayer)->getBinContent(i) / nevent;
120  energy_.at(ilayer)->setBinContent(i, binValue);
121  }
122 
123  //EtaPhi 2d plots
124  name.str("");
125  name << "EtaPhi_Plus_"
126  << "layer_" << ilayer;
127  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
128  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
129  EtaPhi_Plus_.push_back(hgcalMEs[ih]);
130  }
131  }
132 
133  name.str("");
134  name << "EtaPhi_Minus_"
135  << "layer_" << ilayer;
136  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
137  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
138  EtaPhi_Minus_.push_back(hgcalMEs[ih]);
139  }
140  }
141 
142  //normalization EtaPhi
143  nevent = EtaPhi_Plus_.at(ilayer)->getEntries();
144  nbinsx = EtaPhi_Plus_.at(ilayer)->getNbinsX();
145  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
146  for (int i = 1; i <= nbinsx; ++i) {
147  for (int j = 1; j <= nbinsy; ++j) {
148  double binValue = EtaPhi_Plus_.at(ilayer)->getBinContent(i, j) / nevent;
149  EtaPhi_Plus_.at(ilayer)->setBinContent(i, j, binValue);
150  }
151  }
152 
153  nevent = EtaPhi_Minus_.at(ilayer)->getEntries();
154  nbinsx = EtaPhi_Minus_.at(ilayer)->getNbinsX();
155  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
156  for (int i = 1; i <= nbinsx; ++i) {
157  for (int j = 1; j <= nbinsy; ++j) {
158  double binValue = EtaPhi_Minus_.at(ilayer)->getBinContent(i, j) / nevent;
159  EtaPhi_Minus_.at(ilayer)->setBinContent(i, j, binValue);
160  }
161  }
162 
163  //HitOccupancy
164  name.str("");
165  name << "HitOccupancy_Plus_layer_" << ilayer;
166  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
167  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
168  HitOccupancy_Plus_.push_back(hgcalMEs[ih]);
169  }
170  }
171 
172  name.str("");
173  name << "HitOccupancy_Minus_layer_" << ilayer;
174  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
175  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
176  HitOccupancy_Minus_.push_back(hgcalMEs[ih]);
177  }
178  }
179 
180  //normalization of hit occupancy histos
181  nevent = HitOccupancy_Plus_.at(ilayer)->getEntries();
182  nbinsx = HitOccupancy_Plus_.at(ilayer)->getNbinsX();
183  for (int i = 1; i <= nbinsx; ++i) {
184  double binValue = HitOccupancy_Plus_.at(ilayer)->getBinContent(i) / nevent;
185  HitOccupancy_Plus_.at(ilayer)->setBinContent(i, binValue);
186  }
187 
188  nevent = HitOccupancy_Minus_.at(ilayer)->getEntries();
189  nbinsx = HitOccupancy_Minus_.at(ilayer)->getNbinsX();
190  for (int i = 1; i <= nbinsx; ++i) {
191  double binValue = HitOccupancy_Minus_.at(ilayer)->getBinContent(i) / nevent;
192  HitOccupancy_Minus_.at(ilayer)->setBinContent(i, binValue);
193  }
194 
195  } //loop over layers
196 
197  name.str("");
198  name << "SUMOfRecHitOccupancy_Plus";
199  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
200  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
201  MeanHitOccupancy_Plus_.push_back(hgcalMEs[ih]);
202  unsigned int indx = MeanHitOccupancy_Plus_.size() - 1;
203  for (int ilayer = 0; ilayer < (int)layers_; ++ilayer) {
204  double meanVal = HitOccupancy_Plus_.at(ilayer)->getMean();
205  MeanHitOccupancy_Plus_[indx]->setBinContent(ilayer + 1, meanVal);
206  }
207  break;
208  }
209  }
210 
211  name.str("");
212  name << "SUMOfRecHitOccupancy_Plus";
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_.push_back(hgcalMEs[ih]);
216  unsigned indx = MeanHitOccupancy_Minus_.size() - 1;
217  for (int ilayer = 0; ilayer < (int)layers_; ++ilayer) {
218  double meanVal = HitOccupancy_Minus_.at(ilayer)->getMean();
219  MeanHitOccupancy_Minus_[indx]->setBinContent(ilayer + 1, meanVal);
220  }
221  break;
222  }
223  }
224 
225  return 1;
226 }
int nevent
Definition: AMPTWrapper.h:84
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:236
void HGCalRecHitsClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Definition at line 65 of file HGCalRecHitsClient.cc.

References dqm::dqmstoreimpl::DQMStore::IGetter::getContents(), dqm::dqmstoreimpl::DQMStore::IGetter::getSubdirs(), mps_fire::i, dqmiolumiharvest::j, nameDetector_, recHitsEndjob(), dqm::dqmstoreimpl::DQMStore::IGetter::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

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

65  {
66  ig.setCurrentFolder("/");
67  if (verbosity_ > 0)
68  edm::LogVerbatim("HGCalValidation") << "\nrunClient";
69  std::vector<MonitorElement *> hgcalMEs;
70  std::vector<std::string> fullDirPath = ig.getSubdirs();
71 
72  for (unsigned int i = 0; i < fullDirPath.size(); i++) {
73  if (verbosity_ > 0)
74  edm::LogVerbatim("HGCalValidation") << "\nfullPath: " << fullDirPath.at(i);
75  ig.setCurrentFolder(fullDirPath.at(i));
76  std::vector<std::string> fullSubDirPath = ig.getSubdirs();
77 
78  for (unsigned int j = 0; j < fullSubDirPath.size(); j++) {
79  if (verbosity_ > 1)
80  edm::LogVerbatim("HGCalValidation") << "fullSubPath: " << fullSubDirPath.at(j);
81  std::string nameDirectory = "HGCAL/HGCalRecHitsV/" + nameDetector_;
82  if (strcmp(fullSubDirPath.at(j).c_str(), nameDirectory.c_str()) == 0) {
83  hgcalMEs = ig.getContents(fullSubDirPath.at(j));
84  if (verbosity_ > 1)
85  edm::LogVerbatim("HGCalValidation") << "hgcalMES size : " << hgcalMEs.size();
86  if (!recHitsEndjob(hgcalMEs))
87  edm::LogWarning("HGCalValidation") << "\nError in RecHitsEndjob!";
88  }
89  }
90  }
91 }
int recHitsEndjob(const std::vector< MonitorElement * > &hcalMEs)

Member Data Documentation

unsigned int HGCalRecHitsClient::layers_
private

Definition at line 32 of file HGCalRecHitsClient.cc.

Referenced by beginRun(), and recHitsEndjob().

std::string HGCalRecHitsClient::nameDetector_
private

Definition at line 30 of file HGCalRecHitsClient.cc.

Referenced by beginRun(), and runClient_().

int HGCalRecHitsClient::verbosity_
private

Definition at line 31 of file HGCalRecHitsClient.cc.

Referenced by runClient_().