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 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 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 28 of file HGCalRecHitsClient.cc.

Constructor & Destructor Documentation

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

Definition at line 47 of file HGCalRecHitsClient.cc.

47  :
48  nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
49  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 51 of file HGCalRecHitsClient.cc.

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

Referenced by ~HGCalRecHitsClient().

51  {
52  if (nameDetector_ == "HCal") {
54  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
55  const HcalDDDRecConstants *hcons = &(*pHRNDC);
56  layers_ = hcons->getMaxDepth(1);
57  } else {
59  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
60  const HGCalDDDConstants & hgcons_ = (*pHGDC);
61  layers_ = hgcons_.layers(true);
62  }
63 }
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 65 of file HGCalRecHitsClient.cc.

References runClient_().

Referenced by ~HGCalRecHitsClient().

65  {
66  runClient_(ib, ig);
67 }
virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
int HGCalRecHitsClient::recHitsEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

Definition at line 101 of file HGCalRecHitsClient.cc.

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

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

101  {
102  std::vector<MonitorElement*> energy_;
103  std::vector<MonitorElement*> EtaPhi_Plus_;
104  std::vector<MonitorElement*> EtaPhi_Minus_;
105  std::vector<MonitorElement*> HitOccupancy_Plus_;
106  std::vector<MonitorElement*> HitOccupancy_Minus_;
107  std::vector<MonitorElement*> MeanHitOccupancy_Plus_;
108  std::vector<MonitorElement*> MeanHitOccupancy_Minus_;
109 
110  std::ostringstream name;
111  double nevent;
112  int nbinsx, nbinsy;
113 
114  for (unsigned int ilayer = 0; ilayer < layers_; ilayer++ ){
115  name.str(""); name << "energy_layer_" << ilayer;
116  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
117  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
118  energy_.push_back(hgcalMEs[ih]);
119  }
120  }
121 
122  //normalization
123  nevent = energy_.at(ilayer)->getEntries();
124  nbinsx = energy_.at(ilayer)->getNbinsX();
125  for(int i=1; i <= nbinsx; i++) {
126  double binValue = energy_.at(ilayer)->getBinContent(i)/nevent;
127  energy_.at(ilayer)->setBinContent(i,binValue);
128  }
129 
130  //EtaPhi 2d plots
131  name.str(""); name << "EtaPhi_Plus_" << "layer_" << ilayer;
132  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
133  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
134  EtaPhi_Plus_.push_back(hgcalMEs[ih]);
135  }
136  }
137 
138  name.str(""); name << "EtaPhi_Minus_" << "layer_" << ilayer;
139  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
140  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
141  EtaPhi_Minus_.push_back(hgcalMEs[ih]);
142  }
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(""); name << "HitOccupancy_Plus_layer_" << ilayer;
168  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
169  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
170  HitOccupancy_Plus_.push_back(hgcalMEs[ih]);
171  }
172  }
173 
174  name.str(""); name << "HitOccupancy_Minus_layer_" << ilayer;
175  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
176  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
177  HitOccupancy_Minus_.push_back(hgcalMEs[ih]);
178  }
179  }
180 
181  //normalization of hit occupancy histos
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(""); 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(""); name << "SUMOfRecHitOccupancy_Plus";
212  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
213  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
214  MeanHitOccupancy_Minus_.push_back(hgcalMEs[ih]);
215  unsigned indx = MeanHitOccupancy_Minus_.size()-1;
216  for (int ilayer=0; ilayer < (int)layers_; ++ilayer) {
217  double meanVal = HitOccupancy_Minus_.at(ilayer)->getMean();
218  MeanHitOccupancy_Minus_[indx]->setBinContent(ilayer+1, meanVal);
219  }
220  break;
221  }
222  }
223 
224  return 1;
225 }
int nevent
Definition: AMPTWrapper.h:74
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:167
void HGCalRecHitsClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Definition at line 69 of file HGCalRecHitsClient.cc.

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

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

69  {
70 
71  ig.setCurrentFolder("/");
72  if (verbosity_>0) edm::LogVerbatim("HGCalValidation") << "\nrunClient";
73  std::vector<MonitorElement*> hgcalMEs;
74  std::vector<std::string> fullDirPath = ig.getSubdirs();
75 
76  for (unsigned int i=0; i<fullDirPath.size(); i++) {
77  if (verbosity_>0)
78  edm::LogVerbatim("HGCalValidation") << "\nfullPath: "
79  << 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_>1)
85  edm::LogVerbatim("HGCalValidation") << "fullSubPath: "
86  << fullSubDirPath.at(j);
87  std::string nameDirectory = "HGCAL/HGCalRecHitsV/"+nameDetector_;
88  if (strcmp(fullSubDirPath.at(j).c_str(), nameDirectory.c_str()) == 0) {
89  hgcalMEs = ig.getContents(fullSubDirPath.at(j));
90  if (verbosity_>1)
91  edm::LogVerbatim("HGCalValidation") << "hgcalMES size : "
92  << hgcalMEs.size();
93  if (!recHitsEndjob(hgcalMEs))
94  edm::LogWarning("HGCalValidation") << "\nError in RecHitsEndjob!";
95  }
96  }
97 
98  }
99 }
int recHitsEndjob(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

Member Data Documentation

unsigned int HGCalRecHitsClient::layers_
private

Definition at line 34 of file HGCalRecHitsClient.cc.

Referenced by beginRun(), and recHitsEndjob().

std::string HGCalRecHitsClient::nameDetector_
private

Definition at line 32 of file HGCalRecHitsClient.cc.

Referenced by beginRun(), and runClient_().

int HGCalRecHitsClient::verbosity_
private

Definition at line 33 of file HGCalRecHitsClient.cc.

Referenced by runClient_().