CMS 3D CMS Logo

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

#include <HcalSimHitsClient.h>

Inheritance diagram for HcalSimHitsClient:
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 (edm::Run const &run, edm::EventSetup const &c) override
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
 HcalSimHitsClient (const edm::ParameterSet &)
 
virtual void runClient_ (DQMStore::IBooker &, DQMStore::IGetter &)
 
 ~HcalSimHitsClient () 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 () 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
 
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 Member Functions

std::vector< std::string > getHistogramTypes ()
 
int SimHitsEndjob (const std::vector< MonitorElement * > &hcalMEs)
 

Private Attributes

std::string dirName_
 
const HcalDDDRecConstantshcons
 
int maxDepthHB_
 
int maxDepthHE_
 
int maxDepthHF_
 
int maxDepthHO_
 
bool verbose_
 

Static Private Attributes

static const int nTime = 4
 
static const int nType1 = 4
 

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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, ESInputTag const &tag)
 
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 36 of file HcalSimHitsClient.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file HcalSimHitsClient.cc.

References dirName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

14  {
15 
16  dirName_ = iConfig.getParameter<std::string>("DQMDirName");
17  verbose_ = iConfig.getUntrackedParameter<bool>("Verbosity",false);
18 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
HcalSimHitsClient::~HcalSimHitsClient ( )
override

Definition at line 21 of file HcalSimHitsClient.cc.

21 { }

Member Function Documentation

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

Definition at line 23 of file HcalSimHitsClient.cc.

References edm::EventSetup::get(), HcalDDDRecConstants::getMaxDepth(), hcons, maxDepthHB_, maxDepthHE_, maxDepthHF_, and maxDepthHO_.

23  {
25  c.get<HcalRecNumberingRecord>().get( pHRNDC );
26  hcons = &(*pHRNDC);
31 
32  edm::LogInfo("HitsValidationHcal") << " Maximum Depths HB:"<< maxDepthHB_
33  << " HE:" << maxDepthHE_ << " HO:"
34  << maxDepthHO_ << " HF:" << maxDepthHF_;
35 }
const HcalDDDRecConstants * hcons
int getMaxDepth(const int &type) const
void HcalSimHitsClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 37 of file HcalSimHitsClient.cc.

References runClient_().

37  {
38  runClient_(ib,ig);
39 }
virtual void runClient_(DQMStore::IBooker &, DQMStore::IGetter &)
std::vector< std::string > HcalSimHitsClient::getHistogramTypes ( )
private

Definition at line 177 of file HcalSimHitsClient.cc.

References DEFINE_FWK_MODULE, egammaForCoreTracking_cff::depth, gen::k, SiStripPI::max, CMSBoostedTauSeedingParameters_cfi::maxDepth, maxDepthHB_, maxDepthHE_, maxDepthHF_, maxDepthHO_, AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

Referenced by SimHitsEndjob().

177  {
178 
180  if (verbose_) edm::LogInfo("HitsValidationHcal") << "Max depth 1st step:: "
181  << maxDepth;
182  maxDepth = std::max(maxDepth,maxDepthHF_);
183  if (verbose_) edm::LogInfo("HitsValidationHcal") << "Max depth 2nd step:: "
184  << maxDepth;
185  maxDepth = std::max(maxDepth,maxDepthHO_);
186  if (verbose_) edm::LogInfo("HitsValidationHcal") <<"Max depth 3rd step:: "
187  << maxDepth;
188  std::vector<std::string > divisions;
189  char name1[20];
190 
191  //first overall Hcal
192  for (int depth=0; depth<maxDepth; ++depth) {
193  sprintf (name1, "HC%d", depth);
194  divisions.push_back(std::string(name1));
195  }
196  //HB
197  for (int depth=0; depth<maxDepthHB_; ++depth) {
198  sprintf (name1, "HB%d", depth);
199  divisions.push_back(std::string(name1));
200  }
201  //HE
202  for (int depth=0; depth<maxDepthHE_; ++depth) {
203  sprintf (name1, "HE%d+z", depth);
204  divisions.push_back(std::string(name1));
205  sprintf (name1, "HE%d-z", depth);
206  divisions.push_back(std::string(name1));
207  }
208  //HO
209  {
210  int depth = maxDepthHO_;
211  sprintf (name1, "HO%d", depth);
212  divisions.push_back(std::string(name1));
213  }
214  //HF (first absorber, then different types of abnormal hits)
215  std::string hfty1[4] = {"A","W","B","J"};
216  for (int k=0; k<4; ++k) {
217  for (int depth=0; depth<maxDepthHF_; ++depth) {
218  sprintf (name1, "HF%s%d+z", hfty1[k].c_str(), depth);
219  divisions.push_back(std::string(name1));
220  sprintf (name1, "HF%s%d-z", hfty1[k].c_str(), depth);
221  divisions.push_back(std::string(name1));
222  }
223  }
224  return divisions;
225 }
int k[5][pyjets_maxn]
void HcalSimHitsClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Definition at line 41 of file HcalSimHitsClient.cc.

References dirName_, DQMStore::IGetter::getContents(), DQMStore::IGetter::getSubdirs(), mps_fire::i, DQMStore::IGetter::setCurrentFolder(), SimHitsEndjob(), and verbose_.

Referenced by dqmEndJob().

41  {
42 
44 
45  if (verbose_) edm::LogInfo("HitsValidationHcal") << "runClient";
46 
47  std::vector<MonitorElement*> hcalMEs;
48 
49  std::vector<std::string> fullPathHLTFolders = ig.getSubdirs();
50  for (unsigned int i=0;i<fullPathHLTFolders.size();i++) {
51  if (verbose_)
52  edm::LogInfo("HitsValidationHcal") << "fullPath: " << fullPathHLTFolders[i];
53  ig.setCurrentFolder(fullPathHLTFolders[i]);
54 
55  std::vector<std::string> fullSubPathHLTFolders = ig.getSubdirs();
56  for (unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
57 
58  if (verbose_) edm::LogInfo("HitsValidationHcal") << "fullSub: "<< fullSubPathHLTFolders[j];
59 
60  if (strcmp(fullSubPathHLTFolders[j].c_str(), "HcalHitsV/SimHitsValidationHcal") == 0) {
61  hcalMEs = ig.getContents(fullSubPathHLTFolders[j]);
62  if (verbose_) edm::LogInfo("HitsValidationHcal") << "hltMES size : " << hcalMEs.size();
63  if (!SimHitsEndjob(hcalMEs))
64  edm::LogWarning("HitsValidationHcal") << "Error in SimhitEndjob!";
65  }
66  }
67  }
68 
69 }
int SimHitsEndjob(const std::vector< MonitorElement * > &hcalMEs)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:361
std::vector< MonitorElement * > getContents(Args &&...args)
Definition: DQMStore.h:192
std::vector< std::string > getSubdirs()
Definition: DQMStore.cc:325
int HcalSimHitsClient::SimHitsEndjob ( const std::vector< MonitorElement * > &  hcalMEs)
private

Definition at line 73 of file HcalSimHitsClient.cc.

References objects.autophobj::float, MonitorElement::getBinContent(), MonitorElement::getEntries(), getHistogramTypes(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), mps_fire::i, gen::k, dataset::name, nevent, nTime, nType1, MonitorElement::setBinContent(), AlCaHLTBitMon_QueryRunRegistry::string, ntuplemaker::time, and verbose_.

Referenced by runClient_().

73  {
74 
75  std::vector<std::string> divisions = getHistogramTypes();
76  MonitorElement *Occupancy_map[nTime][divisions.size()];
77  MonitorElement *Energy[nType1], *Time_weighteden[nType1];
78  MonitorElement *HitEnergyvsieta[divisions.size()], *HitTimevsieta[divisions.size()];
79 
80  std::string time[nTime]={"25","50","100","250"};
81  std::string detdivision[nType1]={"HB","HE","HF","HO"};
82  char name[40], name1[40], name2[40], name3[40], name4[40];
83 
84  for (int k=0; k<nType1;k++) {
85  Energy[k] = nullptr;
86  Time_weighteden[k] = nullptr;
87  for (unsigned int ih=0; ih<hcalMEs.size(); ih++) {
88  sprintf (name1, "Energy_%s", detdivision[k].c_str());
89  sprintf (name2, "Time_Enweighted_%s", detdivision[k].c_str());
90  if (strcmp(hcalMEs[ih]->getName().c_str(), name1) == 0) {
91  Energy[k] = hcalMEs[ih];
92  }
93  if (strcmp(hcalMEs[ih]->getName().c_str(), name2) == 0) {
94  Time_weighteden[k] = hcalMEs[ih];
95  }
96  }
97  }
98 
99  for (int i=0; i<nTime; i++) {
100  for (unsigned int j=0; j<divisions.size();j++) {
101  for (unsigned int ih=0; ih<hcalMEs.size(); ih++) {
102  sprintf (name, "HcalHitE%s%s", time[i].c_str(),divisions[j].c_str());
103  if (strcmp(hcalMEs[ih]->getName().c_str(), name) == 0) {
104  Occupancy_map[i][j]= hcalMEs[ih];
105  }
106  }
107  }
108  }
109 
110  for (unsigned int k=0; k<divisions.size();k++) {
111  HitEnergyvsieta[k]= nullptr;
112  HitTimevsieta[k]= nullptr;
113  for (unsigned int ih=0; ih<hcalMEs.size(); ih++) {
114  sprintf (name3, "HcalHitEta%s",divisions[k].c_str());
115  sprintf (name4, "HcalHitTimeAEta%s",divisions[k].c_str());
116  if (strcmp(hcalMEs[ih]->getName().c_str(), name3) == 0) {
117  HitEnergyvsieta[k]= hcalMEs[ih];
118  }
119  if (strcmp(hcalMEs[ih]->getName().c_str(), name4) == 0) {
120  HitTimevsieta[k]= hcalMEs[ih];
121  }
122  }
123  }
124 
125  //mean energy
126 
127  double nevent = Energy[0]->getEntries();
128  if (verbose_) edm::LogInfo("HitsValidationHcal") << "nevent : " << nevent;
129 
130  float cont[nTime][divisions.size()];
131  float en[nType1], tme[nType1];
132  float hitenergy[divisions.size()], hittime[divisions.size()];
133  float fev = float(nevent);
134 
135  for (int dettype=0; dettype<nType1; dettype++) {
136  int nx1=Energy[dettype]->getNbinsX();
137  for (int i=0; i<=nx1; i++) {
138  en[dettype]= Energy[dettype]->getBinContent(i)/fev;
139  Energy[dettype]->setBinContent(i,en[dettype]);
140  }
141  int nx2= Time_weighteden[dettype]->getNbinsX();
142  for (int i=0; i<=nx2; i++) {
143  tme[dettype]= Time_weighteden[dettype]->getBinContent(i)/fev;
144  Time_weighteden[dettype]->setBinContent(i,tme[dettype]);
145  }
146  }
147 
148  for (unsigned int dettype=0; dettype<divisions.size(); dettype++) {
149  int nx1=HitEnergyvsieta[dettype]->getNbinsX();
150  for (int i=0; i<=nx1; i++) {
151  hitenergy[dettype]= HitEnergyvsieta[dettype]->getBinContent(i)/fev;
152  HitEnergyvsieta[dettype]->setBinContent(i,hitenergy[dettype]);
153  }
154  int nx2= HitTimevsieta[dettype]->getNbinsX();
155  for (int i=0; i<=nx2; i++) {
156  hittime[dettype]= HitTimevsieta[dettype]->getBinContent(i)/fev;
157  HitTimevsieta[dettype]->setBinContent(i,hittime[dettype]);
158  }
159  }
160 
161  for (int itime=0; itime<nTime; itime++) {
162  for (unsigned int det=0; det<divisions.size(); det++) {
163  int ny= Occupancy_map[itime][det]->getNbinsY();
164  int nx= Occupancy_map[itime][det]->getNbinsX();
165  for (int i=1; i<nx+1; i++) {
166  for (int j=1; j<ny+1; j++) {
167  cont[itime][det] = Occupancy_map[itime][det]->getBinContent(i,j)/fev;
168  Occupancy_map[itime][det]->setBinContent(i,j,cont[itime][det]);
169  }
170  }
171  }
172  }
173 
174  return 1;
175 }
void setBinContent(int binx, double content)
set content of bin (1-D)
static const int nType1
std::vector< std::string > getHistogramTypes()
int nevent
Definition: AMPTWrapper.h:74
int k[5][pyjets_maxn]
double getEntries() const
get # of entries
static const int nTime
int getNbinsY() const
get # of bins in Y-axis
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX() const
get # of bins in X-axis

Member Data Documentation

std::string HcalSimHitsClient::dirName_
private

Definition at line 42 of file HcalSimHitsClient.h.

Referenced by HcalSimHitsClient(), and runClient_().

const HcalDDDRecConstants* HcalSimHitsClient::hcons
private

Definition at line 46 of file HcalSimHitsClient.h.

Referenced by beginRun().

int HcalSimHitsClient::maxDepthHB_
private

Definition at line 47 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

int HcalSimHitsClient::maxDepthHE_
private

Definition at line 47 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

int HcalSimHitsClient::maxDepthHF_
private

Definition at line 47 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

int HcalSimHitsClient::maxDepthHO_
private

Definition at line 47 of file HcalSimHitsClient.h.

Referenced by beginRun(), and getHistogramTypes().

const int HcalSimHitsClient::nTime = 4
staticprivate

Definition at line 44 of file HcalSimHitsClient.h.

Referenced by SimHitsEndjob().

const int HcalSimHitsClient::nType1 = 4
staticprivate

Definition at line 45 of file HcalSimHitsClient.h.

Referenced by SimHitsEndjob().

bool HcalSimHitsClient::verbose_
private