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 Attributes
HGCalSimHitsClient Class Reference

#include <HGCalSimHitsClient.h>

Inheritance diagram for HGCalSimHitsClient:
DQMEDHarvester edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

virtual void beginRun (const edm::Run &run, const edm::EventSetup &c)
 
void dqmEndJob (DQMStore::IBooker &ib, DQMStore::IGetter &ig)
 
 HGCalSimHitsClient (const edm::ParameterSet &)
 
virtual void runClient_ (DQMStore::IBooker &ib, DQMStore::IGetter &ig)
 
int simHitsEndjob (const std::vector< MonitorElement * > &hcalMEs)
 
virtual ~HGCalSimHitsClient ()
 
- 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 Attributes

unsigned int layers_
 
std::string nameDetector_
 
int verbosity_
 

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 37 of file HGCalSimHitsClient.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file HGCalSimHitsClient.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), nameDetector_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

17  {
18  nameDetector_ = iConfig.getParameter<std::string>("DetectorName");
19  verbosity_ = iConfig.getUntrackedParameter<int>("Verbosity",0);
20 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
HGCalSimHitsClient::~HGCalSimHitsClient ( )
virtual

Definition at line 22 of file HGCalSimHitsClient.cc.

22 { }

Member Function Documentation

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

Reimplemented from DQMEDHarvester.

Definition at line 24 of file HGCalSimHitsClient.cc.

References edm::EventSetup::get(), HcalDDDRecConstants::getMaxDepth(), HGCalDDDConstants::layers(), layers_, nameDetector_, and verbosity_.

24  {
25 
26  if (nameDetector_ == "HCal") {
28  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
29  const HcalDDDRecConstants *hcons = &(*pHRNDC);
30  layers_ = hcons->getMaxDepth(1);
31  } else {
33  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
34  const HGCalDDDConstants & hgcons = (*pHGDC);
35  layers_ = hgcons.layers(false);
36  }
37  if (verbosity_>0)
38  edm::LogInfo("HGCalValidation") << "Initialize HGCalSimHitsClient for "
39  << nameDetector_ << " : " << layers_;
40 }
int getMaxDepth(const int type) const
unsigned int layers(bool reco) const
void HGCalSimHitsClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Implements DQMEDHarvester.

Definition at line 42 of file HGCalSimHitsClient.cc.

References runClient_().

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

Definition at line 46 of file HGCalSimHitsClient.cc.

References DQMStore::IGetter::getContents(), DQMStore::IGetter::getSubdirs(), i, j, nameDetector_, DQMStore::IGetter::setCurrentFolder(), simHitsEndjob(), AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

Referenced by dqmEndJob().

46  {
47 
48  ig.setCurrentFolder("/");
49  if (verbosity_>0) edm::LogInfo("HGCalValidation") << "\nrunClient";
50  std::vector<MonitorElement*> hgcalMEs;
51  std::vector<std::string> fullDirPath = ig.getSubdirs();
52 
53  for (unsigned int i=0; i<fullDirPath.size(); i++) {
54  if (verbosity_>0)
55  edm::LogInfo("HGCalValidation") << "\nfullPath: " << fullDirPath.at(i);
56  ig.setCurrentFolder(fullDirPath.at(i));
57  std::vector<std::string> fullSubDirPath = ig.getSubdirs();
58 
59  for (unsigned int j=0; j<fullSubDirPath.size(); j++) {
60  if (verbosity_>0)
61  edm::LogInfo("HGCalValidation") << "fullSubPath: " << fullSubDirPath.at(j);
62  std::string nameDirectory = "HGCalSimHitsV/"+nameDetector_;
63 
64  if (strcmp(fullSubDirPath.at(j).c_str(), nameDirectory.c_str()) == 0) {
65  hgcalMEs = ig.getContents(fullSubDirPath.at(j));
66  if (verbosity_>0)
67  edm::LogInfo("HGCalValidation") << "hgcalMES size : " << hgcalMEs.size();
68  if (!simHitsEndjob(hgcalMEs))
69  edm::LogWarning("HGCalValidation") << "\nError in SimhitsEndjob!";
70  }
71  }
72  }
73 }
std::vector< MonitorElement * > getContents(Args &&...args)
Definition: DQMStore.h:197
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
std::vector< std::string > getSubdirs(void)
Definition: DQMStore.cc:305
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:329
int simHitsEndjob(const std::vector< MonitorElement * > &hcalMEs)
int HGCalSimHitsClient::simHitsEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

loop over timeslice

Definition at line 75 of file HGCalSimHitsClient.cc.

References i, j, layers_, mergeVDriftHistosByStation::name, and nevent.

Referenced by runClient_().

75  {
76 
77  std::vector<MonitorElement*> energy_[6];
78  std::vector<MonitorElement*> EtaPhi_Plus_;
79  std::vector<MonitorElement*> EtaPhi_Minus_;
80  std::vector<MonitorElement*> HitOccupancy_Plus_[4];
81  std::vector<MonitorElement*> HitOccupancy_Minus_[4];
82  std::vector<MonitorElement*> MeanHitOccupancy_Plus_;
83  std::vector<MonitorElement*> MeanHitOccupancy_Minus_;
84 
85  std::ostringstream name;
86  double nevent;
87  int nbinsx, nbinsy;
88  for (unsigned int ilayer = 0; ilayer < layers_; ilayer++ ){
89  for (int itimeslice = 0; itimeslice < 6 ; itimeslice++ ) {
90  //Energy
91  name.str(""); name << "energy_time_" << itimeslice << "_layer_" << ilayer;
92  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
93  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
94  energy_[itimeslice].push_back(hgcalMEs[ih]);
95  }
96  }
97  //normalization
98  nevent = energy_[itimeslice].at(ilayer)->getEntries();
99  nbinsx = energy_[itimeslice].at(ilayer)->getNbinsX();
100  for(int i=1; i <= nbinsx; i++) {
101  double binValue = energy_[itimeslice].at(ilayer)->getBinContent(i)/nevent;
102  energy_[itimeslice].at(ilayer)->setBinContent(i,binValue);
103  }
104  }
105 
106  //EtaPhi 2d plots
107  name.str(""); name << "EtaPhi_Plus_" << "layer_" << ilayer;
108  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
109  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
110  EtaPhi_Plus_.push_back(hgcalMEs[ih]);
111  }
112  }
113 
114  name.str(""); name << "EtaPhi_Minus_" << "layer_" << ilayer;
115  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
116  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
117  EtaPhi_Minus_.push_back(hgcalMEs[ih]);
118  }
119  }
120  //normalization EtaPhi
121  nevent = EtaPhi_Plus_.at(ilayer)->getEntries();
122  nbinsx = EtaPhi_Plus_.at(ilayer)->getNbinsX();
123  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
124  for(int i=1; i<= nbinsx; ++i) {
125  for(int j=1; j<= nbinsy; ++j) {
126  double binValue = EtaPhi_Plus_.at(ilayer)->getBinContent(i, j)/nevent;
127  EtaPhi_Plus_.at(ilayer)->setBinContent(i, j, binValue);
128  }
129  }
130 
131  nevent = EtaPhi_Minus_.at(ilayer)->getEntries();
132  nbinsx = EtaPhi_Minus_.at(ilayer)->getNbinsX();
133  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
134  for(int i=1; i<= nbinsx; ++i) {
135  for(int j=1; j<= nbinsy; ++j) {
136  double binValue = EtaPhi_Minus_.at(ilayer)->getBinContent(i, j)/nevent;
137  EtaPhi_Minus_.at(ilayer)->setBinContent(i, j, binValue);
138  }
139  }
140 
141  //HitOccupancy
142  for(int indx=0; indx<4; ++indx){
143  name.str(""); name << "HitOccupancy_Plus"<< indx << "_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  HitOccupancy_Plus_[indx].push_back(hgcalMEs[ih]);
147  }
148  }
149 
150  name.str(""); name << "HitOccupancy_Minus"<< indx << "_layer_" << ilayer;
151  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
152  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
153  HitOccupancy_Minus_[indx].push_back(hgcalMEs[ih]);
154  }
155  }
156  }
157  for(int indx=0; indx<4; ++indx){
158  nevent = HitOccupancy_Plus_[indx].at(ilayer)->getEntries();
159  nbinsx = HitOccupancy_Plus_[indx].at(ilayer)->getNbinsX();
160  for(int i=1; i<= nbinsx; ++i) {
161  double binValue = HitOccupancy_Plus_[indx].at(ilayer)->getBinContent(i)/nevent;
162  HitOccupancy_Plus_[indx].at(ilayer)->setBinContent(i, binValue);
163  }
164 
165  nevent = HitOccupancy_Minus_[indx].at(ilayer)->getEntries();
166  nbinsx = HitOccupancy_Minus_[indx].at(ilayer)->getNbinsX();
167  for(int i=1; i<= nbinsx; ++i) {
168  double binValue = HitOccupancy_Minus_[indx].at(ilayer)->getBinContent(i)/nevent;
169  HitOccupancy_Minus_[indx].at(ilayer)->setBinContent(i, binValue);
170  }
171 
172  }
173 
174  }//loop over layers
175 
176  for(int indx=0; indx<4; ++indx) {
177  name.str(""); name << "MeanHitOccupancy_Plus"<< indx ;
178  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
179  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
180  MeanHitOccupancy_Plus_.push_back(hgcalMEs[ih]);
181  unsigned int ind = MeanHitOccupancy_Plus_.size()-1;
182  for(int ilayer=0; ilayer < (int)layers_; ++ilayer) {
183  double meanVal = HitOccupancy_Plus_[indx].at(ilayer)->getMean();
184  MeanHitOccupancy_Plus_[ind]->setBinContent(ilayer+1, meanVal);
185  }
186  break;
187  }
188  }
189 
190  name.str(""); name << "MeanHitOccupancy_Minus"<< indx ;
191  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
192  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
193  MeanHitOccupancy_Minus_.push_back(hgcalMEs[ih]);
194  unsigned int ind = MeanHitOccupancy_Minus_.size()-1;
195  for(int ilayer=0; ilayer < (int)layers_; ++ilayer) {
196  double meanVal = HitOccupancy_Minus_[indx].at(ilayer)->getMean();
197  MeanHitOccupancy_Minus_[ind]->setBinContent(ilayer+1, meanVal);
198  }
199  break;
200  }
201  }
202  }
203 
204  return 1;
205 }
int i
Definition: DBlmapReader.cc:9
int nevent
Definition: AMPTWrapper.h:74
int j
Definition: DBlmapReader.cc:9

Member Data Documentation

unsigned int HGCalSimHitsClient::layers_
private

Definition at line 44 of file HGCalSimHitsClient.h.

Referenced by beginRun(), and simHitsEndjob().

std::string HGCalSimHitsClient::nameDetector_
private

Definition at line 42 of file HGCalSimHitsClient.h.

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

int HGCalSimHitsClient::verbosity_
private

Definition at line 43 of file HGCalSimHitsClient.h.

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