CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HGCalDigiClient Class Reference
Inheritance diagram for HGCalDigiClient:
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
 
int digisEndjob (const std::vector< MonitorElement * > &hcalMEs)
 
void dqmEndJob (DQMStore::IBooker &ib, DQMStore::IGetter &ig) override
 
 HGCalDigiClient (const edm::ParameterSet &)
 
void runClient_ (DQMStore::IBooker &ib, DQMStore::IGetter &ig)
 
 ~HGCalDigiClient () 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 () 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
 
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)
 
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)
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 25 of file HGCalDigiClient.cc.

Constructor & Destructor Documentation

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

Definition at line 42 of file HGCalDigiClient.cc.

42  :
43  nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
44  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity",0)) { }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string nameDetector_
HGCalDigiClient::~HGCalDigiClient ( )
inlineoverride

Member Function Documentation

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

Definition at line 46 of file HGCalDigiClient.cc.

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

Referenced by ~HGCalDigiClient().

46  {
47 
48  if (nameDetector_ == "HCal") {
50  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
51  const HcalDDDRecConstants *hcons = &(*pHRNDC);
52  layers_ = hcons->getMaxDepth(1);
53  } else {
55  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
56  const HGCalDDDConstants & hgcons_ = (*pHGDC);
57  layers_ = hgcons_.layers(true);
58  }
59 }
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 93 of file HGCalDigiClient.cc.

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

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

93  {
94 
95  std::vector<MonitorElement*> charge_;
96  std::vector<MonitorElement*> DigiOccupancy_XY_;
97  std::vector<MonitorElement*> ADC_;
98  std::vector<MonitorElement*> DigiOccupancy_Plus_;
99  std::vector<MonitorElement*> DigiOccupancy_Minus_;
100  std::vector<MonitorElement*> MeanDigiOccupancy_Plus_;
101  std::vector<MonitorElement*> MeanDigiOccupancy_Minus_;
102  std::ostringstream name;
103  double nevent;
104  int nbinsx, nbinsy;
105 
106  for (int ilayer = 0; ilayer < layers_; ilayer++ ){
107  //charge
108  name.str(""); name << "charge_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  charge_.push_back(hgcalMEs[ih]);
112  }
113  //normalization
114  nevent = charge_.at(ilayer)->getEntries();
115  nbinsx = charge_.at(ilayer)->getNbinsX();
116  for(int i=1; i <= nbinsx; i++) {
117  double binValue = charge_.at(ilayer)->getBinContent(i)/nevent;
118  charge_.at(ilayer)->setBinContent(i,binValue);
119  }
120 
121  //XY 2d plots
122  name.str(""); name << "DigiOccupancy_XY_" << "layer_" << ilayer;
123  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
124  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0)
125  DigiOccupancy_XY_.push_back(hgcalMEs[ih]);
126  }
127 
128  //normalization of XY 2d
129  nevent = DigiOccupancy_XY_.at(ilayer)->getEntries();
130  nbinsx = DigiOccupancy_XY_.at(ilayer)->getNbinsX();
131  nbinsy = DigiOccupancy_XY_.at(ilayer)->getNbinsY();
132  for(int i=1; i<= nbinsx; ++i) {
133  for(int j=1; j<= nbinsy; ++j) {
134  double binValue = DigiOccupancy_XY_.at(ilayer)->getBinContent(i, j)/nevent;
135  DigiOccupancy_XY_.at(ilayer)->setBinContent(i, j, binValue);
136  }
137  }
138 
139  //ADC
140  name.str(""); name << "ADC_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  ADC_.push_back(hgcalMEs[ih]);
144  }
145 
146  //normalization of ADC Histos
147  nevent = ADC_.at(ilayer)->getEntries();
148  nbinsx = ADC_.at(ilayer)->getNbinsX();
149  for(int i=1; i<= nbinsx; ++i) {
150  double binValue = ADC_.at(ilayer)->getBinContent(i)/nevent;
151  ADC_.at(ilayer)->setBinContent(i, binValue);
152  }
153 
154  //Digi Occupancy
155  name.str(""); name << "DigiOccupancy_Plus_layer_" << ilayer;
156  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
157  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
158  DigiOccupancy_Plus_.push_back(hgcalMEs[ih]);
159  }
160  }
161 
162  name.str(""); name << "DigiOccupancy_Minus_layer_" << ilayer;
163  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
164  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
165  DigiOccupancy_Minus_.push_back(hgcalMEs[ih]);
166  }
167  }
168 
169  //normalization of Digi Occupancy histos
170  nevent = DigiOccupancy_Plus_.at(ilayer)->getEntries();
171  nbinsx = DigiOccupancy_Plus_.at(ilayer)->getNbinsX();
172  for(int i=1; i<= nbinsx; ++i) {
173  double binValue = DigiOccupancy_Plus_.at(ilayer)->getBinContent(i)/nevent;
174  DigiOccupancy_Plus_.at(ilayer)->setBinContent(i, binValue);
175  }
176 
177  nevent = DigiOccupancy_Minus_.at(ilayer)->getEntries();
178  nbinsx = DigiOccupancy_Minus_.at(ilayer)->getNbinsX();
179  for(int i=1; i<= nbinsx; ++i) {
180  double binValue = DigiOccupancy_Minus_.at(ilayer)->getBinContent(i)/nevent;
181  DigiOccupancy_Minus_.at(ilayer)->setBinContent(i, binValue);
182  }
183 
184  }//loop over layers
185 
186  name.str(""); name << "SUMOfDigiOccupancy_Plus";
187  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
188  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
189  MeanDigiOccupancy_Plus_.push_back(hgcalMEs[ih]);
190  unsigned indx = MeanDigiOccupancy_Plus_.size()-1;
191  for(int ilayer=0; ilayer < (int)layers_; ++ilayer) {
192  double meanVal = DigiOccupancy_Plus_.at(ilayer)->getMean();
193  MeanDigiOccupancy_Plus_[indx]->setBinContent(ilayer+1, meanVal);
194  }
195  break;
196  }
197  }
198 
199  name.str(""); name << "SUMOfDigiOccupancy_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  MeanDigiOccupancy_Minus_.push_back(hgcalMEs[ih]);
203  unsigned indx = MeanDigiOccupancy_Minus_.size()-1;
204  for(int ilayer=0; ilayer < (int)layers_; ++ilayer) {
205  double meanVal = DigiOccupancy_Minus_.at(ilayer)->getMean();
206  MeanDigiOccupancy_Minus_[indx]->setBinContent(ilayer+1, meanVal);
207  }
208  break;
209  }
210  }
211  return 1;
212 }
int nevent
Definition: AMPTWrapper.h:74
void HGCalDigiClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 61 of file HGCalDigiClient.cc.

References runClient_().

Referenced by ~HGCalDigiClient().

61  {
62  runClient_(ib, ig);
63 }
void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
void HGCalDigiClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)

Definition at line 65 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(), and ~HGCalDigiClient().

65  {
66 
67  ig.setCurrentFolder("/");
68  if (verbosity_) 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_)
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_)
80  edm::LogVerbatim("HGCalValidation") << "fullSubPath: " << fullSubDirPath.at(j);
81  std::string nameDirectory = "HGCalDigiV/"+nameDetector_;
82  if (strcmp(fullSubDirPath.at(j).c_str(), nameDirectory.c_str()) == 0) {
83  hgcalMEs = ig.getContents(fullSubDirPath.at(j));
84  if (verbosity_)
85  edm::LogVerbatim("HGCalValidation") << "hgcalMES size : " << hgcalMEs.size();
86  if (!digisEndjob(hgcalMEs))
87  edm::LogVerbatim("HGCalValidation") << "\nError in DigisEndjob!";
88  }
89  }
90  }
91 }
std::vector< MonitorElement * > getContents(Args &&...args)
Definition: DQMStore.h:305
int digisEndjob(const std::vector< MonitorElement * > &hcalMEs)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:349
std::vector< std::string > getSubdirs()
Definition: DQMStore.cc:325
std::string nameDetector_

Member Data Documentation

int HGCalDigiClient::layers_
private

Definition at line 30 of file HGCalDigiClient.cc.

Referenced by beginRun(), and digisEndjob().

std::string HGCalDigiClient::nameDetector_
private

Definition at line 28 of file HGCalDigiClient.cc.

Referenced by beginRun(), and runClient_().

int HGCalDigiClient::verbosity_
private

Definition at line 29 of file HGCalDigiClient.cc.

Referenced by runClient_().