CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
HGCalSimHitsClient Class Reference
Inheritance diagram for HGCalSimHitsClient:
DQMEDHarvester edm::one::EDProducer< T > 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
 
 HGCalSimHitsClient (const edm::ParameterSet &)
 
virtual void runClient_ (DQMStore::IBooker &ib, DQMStore::IGetter &ig)
 
int simHitsEndjob (const std::vector< MonitorElement * > &hgcalMEs)
 
 ~HGCalSimHitsClient () override
 
- 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< T >
 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
 
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
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

unsigned int layers_
 
const std::string nameDetector_
 
const int nTimes_
 
const edm::ESGetToken
< HGCalDDDConstants,
IdealGeometryRecord
tok_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
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
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< B > consumes (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 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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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 24 of file HGCalSimHitsClient.cc.

Constructor & Destructor Documentation

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

Definition at line 42 of file HGCalSimHitsClient.cc.

References nameDetector_.

43  : nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
44  nTimes_(iConfig.getParameter<int>("TimeSlices")),
45  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)),
46  tok_hgcal_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tok_hgcal_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const std::string nameDetector_
HGCalSimHitsClient::~HGCalSimHitsClient ( )
inlineoverride

Definition at line 34 of file HGCalSimHitsClient.cc.

34 {}

Member Function Documentation

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

Definition at line 49 of file HGCalSimHitsClient.cc.

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

49  {
50  const HGCalDDDConstants *hgcons = &iSetup.getData(tok_hgcal_);
51  layers_ = hgcons->layers(true);
52  if (verbosity_ > 0)
53  edm::LogVerbatim("HGCalValidation") << "Initialize HGCalSimHitsClient for " << nameDetector_ << " : " << layers_;
54 }
Log< level::Info, true > LogVerbatim
unsigned int layers(bool reco) const
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tok_hgcal_
const std::string nameDetector_
void HGCalSimHitsClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 56 of file HGCalSimHitsClient.cc.

References runClient_().

56 { runClient_(ib, ig); }
virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
void HGCalSimHitsClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Definition at line 58 of file HGCalSimHitsClient.cc.

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

Referenced by dqmEndJob().

58  {
59  ig.setCurrentFolder("/");
60  if (verbosity_ > 0)
61  edm::LogVerbatim("HGCalValidation") << " runClient";
62  std::vector<MonitorElement *> hgcalMEs;
63  std::vector<std::string> fullDirPath = ig.getSubdirs();
64 
65  for (unsigned int i = 0; i < fullDirPath.size(); i++) {
66  if (verbosity_ > 0)
67  edm::LogVerbatim("HGCalValidation") << "fullPath: " << fullDirPath.at(i);
68  ig.setCurrentFolder(fullDirPath.at(i));
69  std::vector<std::string> fullSubDirPath = ig.getSubdirs();
70 
71  for (unsigned int j = 0; j < fullSubDirPath.size(); j++) {
72  if (verbosity_ > 0)
73  edm::LogVerbatim("HGCalValidation") << "fullSubPath: " << fullSubDirPath.at(j);
74  std::string nameDirectory = "HGCAL/HGCalSimHitsV/" + nameDetector_;
75 
76  if (strcmp(fullSubDirPath.at(j).c_str(), nameDirectory.c_str()) == 0) {
77  hgcalMEs = ig.getContents(fullSubDirPath.at(j));
78  if (verbosity_ > 0)
79  edm::LogVerbatim("HGCalValidation") << "hgcalMES size : " << hgcalMEs.size();
80  if (!simHitsEndjob(hgcalMEs))
81  edm::LogWarning("HGCalValidation") << "\nError in SimhitsEndjob!";
82  }
83  }
84  }
85 }
Log< level::Info, true > LogVerbatim
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:700
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
Definition: DQMStore.cc:593
int simHitsEndjob(const std::vector< MonitorElement * > &hgcalMEs)
const std::string nameDetector_
Log< level::Warning, false > LogWarning
int HGCalSimHitsClient::simHitsEndjob ( const std::vector< MonitorElement * > &  hgcalMEs)

loop over timeslice

Definition at line 87 of file HGCalSimHitsClient.cc.

References dqm::impl::MonitorElement::getMean(), getName(), mps_fire::i, dqmiolumiharvest::j, layers_, mergeVDriftHistosByStation::name, nevent, nTimes_, and dqm::impl::MonitorElement::setBinContent().

Referenced by runClient_().

87  {
88  std::vector<MonitorElement *> energy_[6];
89  std::vector<MonitorElement *> EtaPhi_Plus_, EtaPhi_Minus_;
90  std::vector<MonitorElement *> HitOccupancy_Plus_, HitOccupancy_Minus_;
91  MonitorElement *MeanHitOccupancy_Plus_, *MeanHitOccupancy_Minus_;
92 
93  std::ostringstream name;
94  double nevent;
95  int nbinsx, nbinsy;
96  for (unsigned int ilayer = 0; ilayer < layers_; ilayer++) {
97  for (int itimeslice = 0; itimeslice < nTimes_; itimeslice++) {
98  //Energy
99  name.str("");
100  name << "energy_time_" << itimeslice << "_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  energy_[itimeslice].push_back(hgcalMEs[ih]);
104  }
105  }
106  //normalization
107  nevent = energy_[itimeslice].at(ilayer)->getEntries();
108  nbinsx = energy_[itimeslice].at(ilayer)->getNbinsX();
109  for (int i = 1; i <= nbinsx; i++) {
110  double binValue = energy_[itimeslice].at(ilayer)->getBinContent(i) / nevent;
111  energy_[itimeslice].at(ilayer)->setBinContent(i, binValue);
112  }
113  }
114 
115  //EtaPhi 2d plots
116  name.str("");
117  name << "EtaPhi_Plus_"
118  << "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  EtaPhi_Plus_.push_back(hgcalMEs[ih]);
122  }
123  }
124 
125  name.str("");
126  name << "EtaPhi_Minus_"
127  << "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  EtaPhi_Minus_.push_back(hgcalMEs[ih]);
131  }
132  }
133  //normalization EtaPhi
134  nevent = EtaPhi_Plus_.at(ilayer)->getEntries();
135  nbinsx = EtaPhi_Plus_.at(ilayer)->getNbinsX();
136  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
137  for (int i = 1; i <= nbinsx; ++i) {
138  for (int j = 1; j <= nbinsy; ++j) {
139  double binValue = EtaPhi_Plus_.at(ilayer)->getBinContent(i, j) / nevent;
140  EtaPhi_Plus_.at(ilayer)->setBinContent(i, j, binValue);
141  }
142  }
143 
144  nevent = EtaPhi_Minus_.at(ilayer)->getEntries();
145  nbinsx = EtaPhi_Minus_.at(ilayer)->getNbinsX();
146  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
147  for (int i = 1; i <= nbinsx; ++i) {
148  for (int j = 1; j <= nbinsy; ++j) {
149  double binValue = EtaPhi_Minus_.at(ilayer)->getBinContent(i, j) / nevent;
150  EtaPhi_Minus_.at(ilayer)->setBinContent(i, j, binValue);
151  }
152  }
153 
154  //HitOccupancy
155  name.str("");
156  name << "HitOccupancy_Plus_layer_" << ilayer;
157  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
158  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
159  HitOccupancy_Plus_.push_back(hgcalMEs[ih]);
160  }
161  }
162  name.str("");
163  name << "HitOccupancy_Minus_layer_" << ilayer;
164  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
165  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
166  HitOccupancy_Minus_.push_back(hgcalMEs[ih]);
167  }
168  }
169 
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 << "MeanHitOccupancy_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_ = hgcalMEs[ih];
191  for (int ilayer = 0; ilayer < static_cast<int>(layers_); ++ilayer) {
192  double meanVal = HitOccupancy_Plus_.at(ilayer)->getMean();
193  MeanHitOccupancy_Plus_->setBinContent(ilayer + 1, meanVal);
194  }
195  break;
196  }
197  }
198 
199  name.str("");
200  name << "MeanHitOccupancy_Minus";
201  for (unsigned int ih = 0; ih < hgcalMEs.size(); ih++) {
202  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0) {
203  MeanHitOccupancy_Minus_ = hgcalMEs[ih];
204  for (int ilayer = 0; ilayer < static_cast<int>(layers_); ++ilayer) {
205  double meanVal = HitOccupancy_Minus_.at(ilayer)->getMean();
206  MeanHitOccupancy_Minus_->setBinContent(ilayer + 1, meanVal);
207  }
208  break;
209  }
210  }
211 
212  return 1;
213 }
int nevent
Definition: AMPTWrapper.h:84
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:236
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)

Member Data Documentation

unsigned int HGCalSimHitsClient::layers_
private

Definition at line 30 of file HGCalSimHitsClient.cc.

Referenced by beginRun(), and simHitsEndjob().

const std::string HGCalSimHitsClient::nameDetector_
private

Definition at line 27 of file HGCalSimHitsClient.cc.

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

const int HGCalSimHitsClient::nTimes_
private

Definition at line 28 of file HGCalSimHitsClient.cc.

Referenced by simHitsEndjob().

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

Definition at line 29 of file HGCalSimHitsClient.cc.

Referenced by beginRun().

const int HGCalSimHitsClient::verbosity_
private

Definition at line 28 of file HGCalSimHitsClient.cc.

Referenced by beginRun(), and runClient_().