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::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator > 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 *> &hgcalMEs)
 
void dqmEndJob (DQMStore::IBooker &ib, DQMStore::IGetter &ig) override
 
 HGCalDigiClient (const edm::ParameterSet &)
 
void runClient_ (DQMStore::IBooker &ib, DQMStore::IGetter &ig)
 
 ~HGCalDigiClient () override=default
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &) override
 
virtual void dqmAnalyze (DQMStore::IBooker &, DQMStore::IGetter &, edm::Event const &, edm::EventSetup const &)
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &es) final
 
void endProcessBlockProduce (edm::ProcessBlock &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &es) final
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

int layers_
 
const std::string nameDetector_
 
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecordtok_hgcal_
 
const 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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenjobmegetter_
 
edm::EDPutTokenT< DQMTokenjobToken_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 19 of file HGCalDigiClient.cc.

Constructor & Destructor Documentation

◆ HGCalDigiClient()

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

Definition at line 36 of file HGCalDigiClient.cc.

References nameDetector_.

37  : nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
38  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)),
39  tok_hgcal_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const int verbosity_
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tok_hgcal_
const std::string nameDetector_

◆ ~HGCalDigiClient()

HGCalDigiClient::~HGCalDigiClient ( )
overridedefault

Member Function Documentation

◆ beginRun()

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

Definition at line 42 of file HGCalDigiClient.cc.

References edm::EventSetup::getData(), HGCalDDDConstants::layers(), layers_, and tok_hgcal_.

42  {
43  const HGCalDDDConstants *hgcons = &iSetup.getData(tok_hgcal_);
44  layers_ = hgcons->layers(true);
45 }
unsigned int layers(bool reco) const
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tok_hgcal_

◆ digisEndjob()

int HGCalDigiClient::digisEndjob ( const std::vector< MonitorElement *> &  hgcalMEs)

Definition at line 77 of file HGCalDigiClient.cc.

References ForwardName::getName(), mps_fire::i, dqmiolumiharvest::j, layers_, Skims_PA_cff::name, totemT2DQMSource_cfi::nbinsx, totemT2DQMSource_cfi::nbinsy, and nevent.

Referenced by runClient_().

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

◆ dqmEndJob()

void HGCalDigiClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 47 of file HGCalDigiClient.cc.

References cuy::ib, and runClient_().

47 { runClient_(ib, ig); }
void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
ib
Definition: cuy.py:661

◆ runClient_()

void HGCalDigiClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)

Definition at line 49 of file HGCalDigiClient.cc.

References digisEndjob(), dqm::implementation::IGetter::getContents(), dqm::implementation::IGetter::getSubdirs(), mps_fire::i, dqmiolumiharvest::j, nameDetector_, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

Referenced by dqmEndJob().

49  {
50  ig.setCurrentFolder("/");
51  if (verbosity_)
52  edm::LogVerbatim("HGCalValidation") << "\nrunClient";
53  std::vector<MonitorElement *> hgcalMEs;
54  std::vector<std::string> fullDirPath = ig.getSubdirs();
55 
56  for (unsigned int i = 0; i < fullDirPath.size(); i++) {
57  if (verbosity_)
58  edm::LogVerbatim("HGCalValidation") << "\nfullPath: " << fullDirPath.at(i);
59  ig.setCurrentFolder(fullDirPath.at(i));
60  std::vector<std::string> fullSubDirPath = ig.getSubdirs();
61 
62  for (unsigned int j = 0; j < fullSubDirPath.size(); j++) {
63  if (verbosity_)
64  edm::LogVerbatim("HGCalValidation") << "fullSubPath: " << fullSubDirPath.at(j);
65  std::string nameDirectory = "HGCAL/HGCalDigisV/" + nameDetector_;
66  if (strcmp(fullSubDirPath.at(j).c_str(), nameDirectory.c_str()) == 0) {
67  hgcalMEs = ig.getContents(fullSubDirPath.at(j));
68  if (verbosity_)
69  edm::LogVerbatim("HGCalValidation") << "hgcalMES size : " << hgcalMEs.size();
70  if (!digisEndjob(hgcalMEs))
71  edm::LogVerbatim("HGCalValidation") << "\nError in DigisEndjob!";
72  }
73  }
74  }
75 }
Log< level::Info, true > LogVerbatim
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
const int verbosity_
const std::string nameDetector_
int digisEndjob(const std::vector< MonitorElement *> &hgcalMEs)
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
Definition: DQMStore.cc:625
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:739

Member Data Documentation

◆ layers_

int HGCalDigiClient::layers_
private

Definition at line 24 of file HGCalDigiClient.cc.

Referenced by beginRun(), and digisEndjob().

◆ nameDetector_

const std::string HGCalDigiClient::nameDetector_
private

Definition at line 21 of file HGCalDigiClient.cc.

Referenced by HGCalDigiClient(), and runClient_().

◆ tok_hgcal_

const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> HGCalDigiClient::tok_hgcal_
private

Definition at line 23 of file HGCalDigiClient.cc.

Referenced by beginRun().

◆ verbosity_

const int HGCalDigiClient::verbosity_
private

Definition at line 22 of file HGCalDigiClient.cc.

Referenced by runClient_().