CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HGCalDigiClient Class Reference

#include <HGCalDigiClient.h>

Inheritance diagram for HGCalDigiClient:
DQMEDHarvester edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &run, const edm::EventSetup &c)
 
int digisEndjob (const std::vector< MonitorElement * > &hcalMEs)
 
void dqmEndJob (DQMStore::IBooker &ib, DQMStore::IGetter &ig)
 
 HGCalDigiClient (const edm::ParameterSet &)
 
void runClient_ (DQMStore::IBooker &ib, DQMStore::IGetter &ig)
 
virtual ~HGCalDigiClient ()
 
- Public Member Functions inherited from DQMEDHarvester
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester (void)
 
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 endRun (edm::Run const &, edm::EventSetup const &) override
 
void produce (edm::Event &, edm::EventSetup const &) final
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () 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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

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 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)
 

Detailed Description

Definition at line 31 of file HGCalDigiClient.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file HGCalDigiClient.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), nameDetector_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

15  {
16 
17  nameDetector_ = iConfig.getParameter<std::string>("DetectorName");
18  verbosity_ = iConfig.getUntrackedParameter<int>("Verbosity",0);
19 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string nameDetector_
HGCalDigiClient::~HGCalDigiClient ( )
virtual

Definition at line 21 of file HGCalDigiClient.cc.

21 { }

Member Function Documentation

void HGCalDigiClient::beginRun ( const edm::Run run,
const edm::EventSetup c 
)
virtual

Definition at line 23 of file HGCalDigiClient.cc.

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

23  {
24 
25  if (nameDetector_ == "HCal") {
27  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
28  const HcalDDDRecConstants *hcons = &(*pHRNDC);
29  layers_ = hcons->getMaxDepth(1);
30  } else {
32  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
33  const HGCalDDDConstants & hgcons_ = (*pHGDC);
34  layers_ = hgcons_.layers(true);
35  }
36 }
unsigned int layers(bool reco) const
int getMaxDepth(const int &type) const
std::string nameDetector_
int HGCalDigiClient::digisEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

Definition at line 71 of file HGCalDigiClient.cc.

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

Referenced by runClient_().

71  {
72 
73  std::vector<MonitorElement*> charge_;
74  std::vector<MonitorElement*> DigiOccupancy_XY_;
75  std::vector<MonitorElement*> ADC_;
76  std::vector<MonitorElement*> DigiOccupancy_Plus_;
77  std::vector<MonitorElement*> DigiOccupancy_Minus_;
78  std::vector<MonitorElement*> MeanDigiOccupancy_Plus_;
79  std::vector<MonitorElement*> MeanDigiOccupancy_Minus_;
80  std::ostringstream name;
81  double nevent;
82  int nbinsx, nbinsy;
83 
84  for (int ilayer = 0; ilayer < layers_; ilayer++ ){
85  //charge
86  name.str(""); name << "charge_layer_" << ilayer;
87  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
88  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0)
89  charge_.push_back(hgcalMEs[ih]);
90  }
91  //normalization
92  nevent = charge_.at(ilayer)->getEntries();
93  nbinsx = charge_.at(ilayer)->getNbinsX();
94  for(int i=1; i <= nbinsx; i++) {
95  double binValue = charge_.at(ilayer)->getBinContent(i)/nevent;
96  charge_.at(ilayer)->setBinContent(i,binValue);
97  }
98 
99  //XY 2d plots
100  name.str(""); name << "DigiOccupancy_XY_" << "layer_" << ilayer;
101  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
102  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0)
103  DigiOccupancy_XY_.push_back(hgcalMEs[ih]);
104  }
105 
106  //normalization of XY 2d
107  nevent = DigiOccupancy_XY_.at(ilayer)->getEntries();
108  nbinsx = DigiOccupancy_XY_.at(ilayer)->getNbinsX();
109  nbinsy = DigiOccupancy_XY_.at(ilayer)->getNbinsY();
110  for(int i=1; i<= nbinsx; ++i) {
111  for(int j=1; j<= nbinsy; ++j) {
112  double binValue = DigiOccupancy_XY_.at(ilayer)->getBinContent(i, j)/nevent;
113  DigiOccupancy_XY_.at(ilayer)->setBinContent(i, j, binValue);
114  }
115  }
116 
117  //ADC
118  name.str(""); name << "ADC_layer_" << ilayer;
119  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
120  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0)
121  ADC_.push_back(hgcalMEs[ih]);
122  }
123 
124  //normalization of ADC Histos
125  nevent = ADC_.at(ilayer)->getEntries();
126  nbinsx = ADC_.at(ilayer)->getNbinsX();
127  for(int i=1; i<= nbinsx; ++i) {
128  double binValue = ADC_.at(ilayer)->getBinContent(i)/nevent;
129  ADC_.at(ilayer)->setBinContent(i, binValue);
130  }
131 
132  //Digi Occupancy
133  name.str(""); name << "DigiOccupancy_Plus_layer_" << ilayer;
134  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
135  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
136  DigiOccupancy_Plus_.push_back(hgcalMEs[ih]);
137  }
138  }
139 
140  name.str(""); name << "DigiOccupancy_Minus_layer_" << ilayer;
141  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
142  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
143  DigiOccupancy_Minus_.push_back(hgcalMEs[ih]);
144  }
145  }
146 
147  //normalization of Digi Occupancy histos
148  nevent = DigiOccupancy_Plus_.at(ilayer)->getEntries();
149  nbinsx = DigiOccupancy_Plus_.at(ilayer)->getNbinsX();
150  for(int i=1; i<= nbinsx; ++i) {
151  double binValue = DigiOccupancy_Plus_.at(ilayer)->getBinContent(i)/nevent;
152  DigiOccupancy_Plus_.at(ilayer)->setBinContent(i, binValue);
153  }
154 
155  nevent = DigiOccupancy_Minus_.at(ilayer)->getEntries();
156  nbinsx = DigiOccupancy_Minus_.at(ilayer)->getNbinsX();
157  for(int i=1; i<= nbinsx; ++i) {
158  double binValue = DigiOccupancy_Minus_.at(ilayer)->getBinContent(i)/nevent;
159  DigiOccupancy_Minus_.at(ilayer)->setBinContent(i, binValue);
160  }
161 
162  }//loop over layers
163 
164  name.str(""); name << "SUMOfDigiOccupancy_Plus";
165  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
166  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
167  MeanDigiOccupancy_Plus_.push_back(hgcalMEs[ih]);
168  unsigned indx = MeanDigiOccupancy_Plus_.size()-1;
169  for(int ilayer=0; ilayer < (int)layers_; ++ilayer) {
170  double meanVal = DigiOccupancy_Plus_.at(ilayer)->getMean();
171  MeanDigiOccupancy_Plus_[indx]->setBinContent(ilayer+1, meanVal);
172  }
173  break;
174  }
175  }
176 
177  name.str(""); name << "SUMOfDigiOccupancy_Plus";
178  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
179  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
180  MeanDigiOccupancy_Minus_.push_back(hgcalMEs[ih]);
181  unsigned indx = MeanDigiOccupancy_Minus_.size()-1;
182  for(int ilayer=0; ilayer < (int)layers_; ++ilayer) {
183  double meanVal = DigiOccupancy_Minus_.at(ilayer)->getMean();
184  MeanDigiOccupancy_Minus_[indx]->setBinContent(ilayer+1, meanVal);
185  }
186  break;
187  }
188  }
189  return 1;
190 }
int nevent
Definition: AMPTWrapper.h:74
void HGCalDigiClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Implements DQMEDHarvester.

Definition at line 38 of file HGCalDigiClient.cc.

References runClient_().

38  {
39  runClient_(ib, ig);
40 }
void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
void HGCalDigiClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)

Definition at line 42 of file HGCalDigiClient.cc.

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

Referenced by dqmEndJob().

42  {
43 
44  ig.setCurrentFolder("/");
45  if (verbosity_) edm::LogInfo("HGCalValidation") << "\nrunClient";
46  std::vector<MonitorElement*> hgcalMEs;
47  std::vector<std::string> fullDirPath = ig.getSubdirs();
48 
49  for (unsigned int i=0; i<fullDirPath.size(); i++) {
50  if (verbosity_)
51  edm::LogInfo("HGCalValidation") << "\nfullPath: " << fullDirPath.at(i);
52  ig.setCurrentFolder(fullDirPath.at(i));
53  std::vector<std::string> fullSubDirPath = ig.getSubdirs();
54 
55  for (unsigned int j=0; j<fullSubDirPath.size(); j++) {
56  if (verbosity_)
57  edm::LogInfo("HGCalValidation") << "fullSubPath: " << fullSubDirPath.at(j);
58  std::string nameDirectory = "HGCalDigiV/"+nameDetector_;
59  if (strcmp(fullSubDirPath.at(j).c_str(), nameDirectory.c_str()) == 0) {
60  hgcalMEs = ig.getContents(fullSubDirPath.at(j));
61  if (verbosity_)
62  edm::LogInfo("HGCalValidation") << "hgcalMES size : " << hgcalMEs.size();
63  if (!digisEndjob(hgcalMEs))
64  edm::LogInfo("HGCalValidation") << "\nError in DigisEndjob!";
65  }
66  }
67 
68  }
69 }
std::vector< MonitorElement * > getContents(Args &&...args)
Definition: DQMStore.h:197
int digisEndjob(const std::vector< MonitorElement * > &hcalMEs)
std::vector< std::string > getSubdirs(void)
Definition: DQMStore.cc:323
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:347
std::string nameDetector_

Member Data Documentation

int HGCalDigiClient::layers_
private

Definition at line 36 of file HGCalDigiClient.h.

Referenced by beginRun(), and digisEndjob().

std::string HGCalDigiClient::nameDetector_
private

Definition at line 34 of file HGCalDigiClient.h.

Referenced by beginRun(), HGCalDigiClient(), and runClient_().

int HGCalDigiClient::verbosity_
private

Definition at line 35 of file HGCalDigiClient.h.

Referenced by HGCalDigiClient(), and runClient_().