CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

virtual void beginRun (edm::Run const &run, edm::EventSetup const &c)
 
virtual void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &)
 
 HcalSimHitsClient (const edm::ParameterSet &)
 
virtual void runClient_ (DQMStore::IBooker &, DQMStore::IGetter &)
 
virtual ~HcalSimHitsClient ()
 
- Public Member Functions inherited from DQMEDHarvester
virtual void analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
 DQMEDHarvester (void)
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
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)
 

Detailed Description

Definition at line 36 of file HcalSimHitsClient.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file HcalSimHitsClient.cc.

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

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

Definition at line 22 of file HcalSimHitsClient.cc.

22 { }

Member Function Documentation

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

Reimplemented from DQMEDHarvester.

Definition at line 24 of file HcalSimHitsClient.cc.

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

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

Implements DQMEDHarvester.

Definition at line 38 of file HcalSimHitsClient.cc.

References runClient_().

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

Definition at line 178 of file HcalSimHitsClient.cc.

References HLT_25ns14e33_v1_cff::depth, relval_steps::k, bookConverter::max, HLT_25ns14e33_v1_cff::maxDepth, maxDepthHB_, maxDepthHE_, maxDepthHF_, maxDepthHO_, AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

Referenced by SimHitsEndjob().

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

Definition at line 42 of file HcalSimHitsClient.cc.

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

Referenced by dqmEndJob().

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

Definition at line 74 of file HcalSimHitsClient.cc.

References generateEDF::cont, MonitorElement::getBinContent(), MonitorElement::getEntries(), getHistogramTypes(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), i, j, relval_steps::k, mergeVDriftHistosByStation::name, nevent, nTime, nType1, MonitorElement::setBinContent(), AlCaHLTBitMon_QueryRunRegistry::string, cond::rpcobgas::time, and verbose_.

Referenced by runClient_().

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