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::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
 
void dqmEndJob (DQMStore::IBooker &ib, DQMStore::IGetter &ig) override
 
 HGCalRecHitsClient (const edm::ParameterSet &)
 
int recHitsEndjob (const std::vector< MonitorElement *> &hgcalMEs)
 
virtual void runClient_ (DQMStore::IBooker &ib, DQMStore::IGetter &ig)
 
 ~HGCalRecHitsClient () 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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

const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecordddc_token_
 
unsigned int layers_
 
const std::string nameDetector_
 
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 22 of file HGCalRecHitsClient.cc.

Constructor & Destructor Documentation

◆ HGCalRecHitsClient()

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

Definition at line 41 of file HGCalRecHitsClient.cc.

References nameDetector_.

42  : nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
43  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)),
44  ddc_token_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
T getUntrackedParameter(std::string const &, T const &) const
const std::string nameDetector_
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > ddc_token_

◆ ~HGCalRecHitsClient()

HGCalRecHitsClient::~HGCalRecHitsClient ( )
overridedefault

Member Function Documentation

◆ beginRun()

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

Definition at line 47 of file HGCalRecHitsClient.cc.

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

47  {
48  const HGCalDDDConstants &hgcons_ = iSetup.getData(ddc_token_);
49  layers_ = hgcons_.layers(true);
50 }
unsigned int layers(bool reco) const
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > ddc_token_

◆ dqmEndJob()

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

Implements DQMEDHarvester.

Definition at line 52 of file HGCalRecHitsClient.cc.

References cuy::ib, and runClient_().

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

◆ recHitsEndjob()

int HGCalRecHitsClient::recHitsEndjob ( const std::vector< MonitorElement *> &  hgcalMEs)

Definition at line 82 of file HGCalRecHitsClient.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_().

82  {
83  std::vector<MonitorElement *> energy_;
84  std::vector<MonitorElement *> EtaPhi_Plus_;
85  std::vector<MonitorElement *> EtaPhi_Minus_;
86  std::vector<MonitorElement *> HitOccupancy_Plus_;
87  std::vector<MonitorElement *> HitOccupancy_Minus_;
88  std::vector<MonitorElement *> MeanHitOccupancy_Plus_;
89  std::vector<MonitorElement *> MeanHitOccupancy_Minus_;
90 
91  std::ostringstream name;
92  double nevent;
93  int nbinsx, nbinsy;
94 
95  for (unsigned int ilayer = 0; ilayer < layers_; ilayer++) {
96  name.str("");
97  name << "energy_layer_" << ilayer;
98  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
99  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
100  energy_.push_back(hgcalMEs[ih]);
101  }
102  }
103 
104  //normalization
105  nevent = energy_.at(ilayer)->getEntries();
106  nbinsx = energy_.at(ilayer)->getNbinsX();
107  for (int i = 1; i <= nbinsx; i++) {
108  double binValue = energy_.at(ilayer)->getBinContent(i) / nevent;
109  energy_.at(ilayer)->setBinContent(i, binValue);
110  }
111 
112  //EtaPhi 2d plots
113  name.str("");
114  name << "EtaPhi_Plus_"
115  << "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  EtaPhi_Plus_.push_back(hgcalMEs[ih]);
119  }
120  }
121 
122  name.str("");
123  name << "EtaPhi_Minus_"
124  << "layer_" << ilayer;
125  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
126  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
127  EtaPhi_Minus_.push_back(hgcalMEs[ih]);
128  }
129  }
130 
131  //normalization EtaPhi
132  nevent = EtaPhi_Plus_.at(ilayer)->getEntries();
133  nbinsx = EtaPhi_Plus_.at(ilayer)->getNbinsX();
134  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
135  for (int i = 1; i <= nbinsx; ++i) {
136  for (int j = 1; j <= nbinsy; ++j) {
137  double binValue = EtaPhi_Plus_.at(ilayer)->getBinContent(i, j) / nevent;
138  EtaPhi_Plus_.at(ilayer)->setBinContent(i, j, binValue);
139  }
140  }
141 
142  nevent = EtaPhi_Minus_.at(ilayer)->getEntries();
143  nbinsx = EtaPhi_Minus_.at(ilayer)->getNbinsX();
144  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
145  for (int i = 1; i <= nbinsx; ++i) {
146  for (int j = 1; j <= nbinsy; ++j) {
147  double binValue = EtaPhi_Minus_.at(ilayer)->getBinContent(i, j) / nevent;
148  EtaPhi_Minus_.at(ilayer)->setBinContent(i, j, binValue);
149  }
150  }
151 
152  //HitOccupancy
153  name.str("");
154  name << "HitOccupancy_Plus_layer_" << ilayer;
155  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
156  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
157  HitOccupancy_Plus_.push_back(hgcalMEs[ih]);
158  }
159  }
160 
161  name.str("");
162  name << "HitOccupancy_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  HitOccupancy_Minus_.push_back(hgcalMEs[ih]);
166  }
167  }
168 
169  //normalization of hit occupancy histos
170  nevent = HitOccupancy_Plus_.at(ilayer)->getEntries();
171  nbinsx = HitOccupancy_Plus_.at(ilayer)->getNbinsX();
172  for (int i = 1; i <= nbinsx; ++i) {
173  double binValue = HitOccupancy_Plus_.at(ilayer)->getBinContent(i) / nevent;
174  HitOccupancy_Plus_.at(ilayer)->setBinContent(i, binValue);
175  }
176 
177  nevent = HitOccupancy_Minus_.at(ilayer)->getEntries();
178  nbinsx = HitOccupancy_Minus_.at(ilayer)->getNbinsX();
179  for (int i = 1; i <= nbinsx; ++i) {
180  double binValue = HitOccupancy_Minus_.at(ilayer)->getBinContent(i) / nevent;
181  HitOccupancy_Minus_.at(ilayer)->setBinContent(i, binValue);
182  }
183 
184  } //loop over layers
185 
186  name.str("");
187  name << "SUMOfRecHitOccupancy_Plus";
188  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
189  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
190  MeanHitOccupancy_Plus_.push_back(hgcalMEs[ih]);
191  unsigned int indx = MeanHitOccupancy_Plus_.size() - 1;
192  for (int ilayer = 0; ilayer < static_cast<int>(layers_); ++ilayer) {
193  double meanVal = HitOccupancy_Plus_.at(ilayer)->getMean();
194  MeanHitOccupancy_Plus_[indx]->setBinContent(ilayer + 1, meanVal);
195  }
196  break;
197  }
198  }
199 
200  name.str("");
201  name << "SUMOfRecHitOccupancy_Plus";
202  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
203  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
204  MeanHitOccupancy_Minus_.push_back(hgcalMEs[ih]);
205  unsigned indx = MeanHitOccupancy_Minus_.size() - 1;
206  for (int ilayer = 0; ilayer < static_cast<int>(layers_); ++ilayer) {
207  double meanVal = HitOccupancy_Minus_.at(ilayer)->getMean();
208  MeanHitOccupancy_Minus_[indx]->setBinContent(ilayer + 1, meanVal);
209  }
210  break;
211  }
212  }
213 
214  return 1;
215 }
int nevent
Definition: AMPTWrapper.h:84
std::string getName(const G4String &)
Definition: ForwardName.cc:3

◆ runClient_()

void HGCalRecHitsClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Definition at line 54 of file HGCalRecHitsClient.cc.

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

Referenced by dqmEndJob().

54  {
55  ig.setCurrentFolder("/");
56  if (verbosity_ > 0)
57  edm::LogVerbatim("HGCalValidation") << "\nrunClient";
58  std::vector<MonitorElement *> hgcalMEs;
59  std::vector<std::string> fullDirPath = ig.getSubdirs();
60 
61  for (unsigned int i = 0; i < fullDirPath.size(); i++) {
62  if (verbosity_ > 0)
63  edm::LogVerbatim("HGCalValidation") << "\nfullPath: " << fullDirPath.at(i);
64  ig.setCurrentFolder(fullDirPath.at(i));
65  std::vector<std::string> fullSubDirPath = ig.getSubdirs();
66 
67  for (unsigned int j = 0; j < fullSubDirPath.size(); j++) {
68  if (verbosity_ > 1)
69  edm::LogVerbatim("HGCalValidation") << "fullSubPath: " << fullSubDirPath.at(j);
70  std::string nameDirectory = "HGCAL/HGCalRecHitsV/" + nameDetector_;
71  if (strcmp(fullSubDirPath.at(j).c_str(), nameDirectory.c_str()) == 0) {
72  hgcalMEs = ig.getContents(fullSubDirPath.at(j));
73  if (verbosity_ > 1)
74  edm::LogVerbatim("HGCalValidation") << "hgcalMES size : " << hgcalMEs.size();
75  if (!recHitsEndjob(hgcalMEs))
76  edm::LogWarning("HGCalValidation") << "\nError in RecHitsEndjob!";
77  }
78  }
79  }
80 }
Log< level::Info, true > LogVerbatim
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
int recHitsEndjob(const std::vector< MonitorElement *> &hgcalMEs)
const std::string nameDetector_
Log< level::Warning, false > LogWarning
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

◆ ddc_token_

const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> HGCalRecHitsClient::ddc_token_
private

Definition at line 27 of file HGCalRecHitsClient.cc.

Referenced by beginRun().

◆ layers_

unsigned int HGCalRecHitsClient::layers_
private

Definition at line 28 of file HGCalRecHitsClient.cc.

Referenced by beginRun(), and recHitsEndjob().

◆ nameDetector_

const std::string HGCalRecHitsClient::nameDetector_
private

Definition at line 25 of file HGCalRecHitsClient.cc.

Referenced by HGCalRecHitsClient(), and runClient_().

◆ verbosity_

const int HGCalRecHitsClient::verbosity_
private

Definition at line 26 of file HGCalRecHitsClient.cc.

Referenced by runClient_().