CMS 3D CMS Logo

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
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
 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 ()
 
 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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

unsigned int layers_
 
std::string nameDetector_
 
int nTimes_
 
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_, nTimes_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

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

Definition at line 23 of file HGCalSimHitsClient.cc.

23 { }

Member Function Documentation

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

Definition at line 25 of file HGCalSimHitsClient.cc.

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

25  {
26 
27  if (nameDetector_ == "HCal") {
29  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
30  const HcalDDDRecConstants *hcons = &(*pHRNDC);
31  layers_ = hcons->getMaxDepth(1);
32  } else {
34  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
35  const HGCalDDDConstants & hgcons = (*pHGDC);
36  layers_ = hgcons.layers(false);
37  }
38  if (verbosity_>0)
39  edm::LogInfo("HGCalValidation") << "Initialize HGCalSimHitsClient for "
40  << nameDetector_ << " : " << layers_ <<"\n";
41 }
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 43 of file HGCalSimHitsClient.cc.

References runClient_().

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

Definition at line 47 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().

47  {
48 
49  ig.setCurrentFolder("/");
50  if (verbosity_>0) edm::LogInfo("HGCalValidation") << " runClient\n";
51  std::vector<MonitorElement*> hgcalMEs;
52  std::vector<std::string> fullDirPath = ig.getSubdirs();
53 
54  for (unsigned int i=0; i<fullDirPath.size(); i++) {
55  if (verbosity_>0)
56  edm::LogInfo("HGCalValidation") << "fullPath: " << fullDirPath.at(i) << "\n";
57  ig.setCurrentFolder(fullDirPath.at(i));
58  std::vector<std::string> fullSubDirPath = ig.getSubdirs();
59 
60  for (unsigned int j=0; j<fullSubDirPath.size(); j++) {
61  if (verbosity_>0)
62  edm::LogInfo("HGCalValidation") << "fullSubPath: " << fullSubDirPath.at(j) << "\n";
63  std::string nameDirectory = "HGCalSimHitsV/"+nameDetector_;
64 
65  if (strcmp(fullSubDirPath.at(j).c_str(), nameDirectory.c_str()) == 0) {
66  hgcalMEs = ig.getContents(fullSubDirPath.at(j));
67  if (verbosity_>0)
68  edm::LogInfo("HGCalValidation") << "hgcalMES size : " << hgcalMEs.size() << "\n";
69  if (!simHitsEndjob(hgcalMEs))
70  edm::LogWarning("HGCalValidation") << "\nError in SimhitsEndjob!";
71  }
72  }
73  }
74 }
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:323
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:347
int simHitsEndjob(const std::vector< MonitorElement * > &hcalMEs)
int HGCalSimHitsClient::simHitsEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

loop over timeslice

Definition at line 76 of file HGCalSimHitsClient.cc.

References DEFINE_FWK_MODULE, MonitorElement::getMean(), i, createfilelist::int, j, layers_, dataset::name, nevent, nTimes_, and MonitorElement::setBinContent().

Referenced by runClient_().

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

Definition at line 43 of file HGCalSimHitsClient.h.

Referenced by HGCalSimHitsClient(), and simHitsEndjob().

int HGCalSimHitsClient::verbosity_
private

Definition at line 43 of file HGCalSimHitsClient.h.

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