CMS 3D CMS Logo

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

#include <HGCalRecHitsClient.h>

Inheritance diagram for HGCalRecHitsClient:
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)
 
 HGCalRecHitsClient (const edm::ParameterSet &)
 
int recHitsEndjob (const std::vector< MonitorElement * > &hcalMEs)
 
virtual void runClient_ (DQMStore::IBooker &ib, DQMStore::IGetter &ig)
 
virtual ~HGCalRecHitsClient ()
 
- 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 & 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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 33 of file HGCalRecHitsClient.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file HGCalRecHitsClient.cc.

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

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

Definition at line 23 of file HGCalRecHitsClient.cc.

23 { }

Member Function Documentation

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

Definition at line 25 of file HGCalRecHitsClient.cc.

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

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(true);
36  }
37 }
int getMaxDepth(const int type) const
unsigned int layers(bool reco) const
void HGCalRecHitsClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Implements DQMEDHarvester.

Definition at line 39 of file HGCalRecHitsClient.cc.

References runClient_().

39  {
40  runClient_(ib, ig);
41 }
virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig)
int HGCalRecHitsClient::recHitsEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

Definition at line 72 of file HGCalRecHitsClient.cc.

References DEFINE_FWK_MODULE, mps_fire::i, createfilelist::int, layers_, dataset::name, and nevent.

Referenced by runClient_().

72  {
73  std::vector<MonitorElement*> energy_;
74  std::vector<MonitorElement*> EtaPhi_Plus_;
75  std::vector<MonitorElement*> EtaPhi_Minus_;
76  std::vector<MonitorElement*> HitOccupancy_Plus_;
77  std::vector<MonitorElement*> HitOccupancy_Minus_;
78  std::vector<MonitorElement*> MeanHitOccupancy_Plus_;
79  std::vector<MonitorElement*> MeanHitOccupancy_Minus_;
80 
81  std::ostringstream name;
82  double nevent;
83  int nbinsx, nbinsy;
84 
85  for (unsigned int ilayer = 0; ilayer < layers_; ilayer++ ){
86  name.str(""); name << "energy_layer_" << ilayer;
87  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
88  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
89  energy_.push_back(hgcalMEs[ih]);
90  }
91  }
92 
93  //normalization
94  nevent = energy_.at(ilayer)->getEntries();
95  nbinsx = energy_.at(ilayer)->getNbinsX();
96  for(int i=1; i <= nbinsx; i++) {
97  double binValue = energy_.at(ilayer)->getBinContent(i)/nevent;
98  energy_.at(ilayer)->setBinContent(i,binValue);
99  }
100 
101  //EtaPhi 2d plots
102  name.str(""); name << "EtaPhi_Plus_" << "layer_" << ilayer;
103  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
104  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
105  EtaPhi_Plus_.push_back(hgcalMEs[ih]);
106  }
107  }
108 
109  name.str(""); name << "EtaPhi_Minus_" << "layer_" << ilayer;
110  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
111  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
112  EtaPhi_Minus_.push_back(hgcalMEs[ih]);
113  }
114  }
115 
116  //normalization EtaPhi
117  nevent = EtaPhi_Plus_.at(ilayer)->getEntries();
118  nbinsx = EtaPhi_Plus_.at(ilayer)->getNbinsX();
119  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
120  for(int i=1; i<= nbinsx; ++i) {
121  for(int j=1; j<= nbinsy; ++j) {
122  double binValue = EtaPhi_Plus_.at(ilayer)->getBinContent(i, j)/nevent;
123  EtaPhi_Plus_.at(ilayer)->setBinContent(i, j, binValue);
124  }
125  }
126 
127  nevent = EtaPhi_Minus_.at(ilayer)->getEntries();
128  nbinsx = EtaPhi_Minus_.at(ilayer)->getNbinsX();
129  nbinsy = EtaPhi_Plus_.at(ilayer)->getNbinsY();
130  for(int i=1; i<= nbinsx; ++i) {
131  for(int j=1; j<= nbinsy; ++j) {
132  double binValue = EtaPhi_Minus_.at(ilayer)->getBinContent(i, j)/nevent;
133  EtaPhi_Minus_.at(ilayer)->setBinContent(i, j, binValue);
134  }
135  }
136 
137  //HitOccupancy
138  name.str(""); name << "HitOccupancy_Plus_layer_" << ilayer;
139  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
140  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
141  HitOccupancy_Plus_.push_back(hgcalMEs[ih]);
142  }
143  }
144 
145  name.str(""); name << "HitOccupancy_Minus_layer_" << ilayer;
146  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
147  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
148  HitOccupancy_Minus_.push_back(hgcalMEs[ih]);
149  }
150  }
151 
152  //normalization of hit occupancy histos
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 << "SUMOfRecHitOccupancy_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_.push_back(hgcalMEs[ih]);
173  unsigned int indx = MeanHitOccupancy_Plus_.size()-1;
174  for (int ilayer=0; ilayer < (int)layers_; ++ilayer) {
175  double meanVal = HitOccupancy_Plus_.at(ilayer)->getMean();
176  MeanHitOccupancy_Plus_[indx]->setBinContent(ilayer+1, meanVal);
177  }
178  break;
179  }
180  }
181 
182  name.str(""); name << "SUMOfRecHitOccupancy_Plus";
183  for(unsigned int ih=0; ih<hgcalMEs.size(); ih++){
184  if (strcmp(hgcalMEs[ih]->getName().c_str(), name.str().c_str()) == 0){
185  MeanHitOccupancy_Minus_.push_back(hgcalMEs[ih]);
186  unsigned indx = MeanHitOccupancy_Minus_.size()-1;
187  for (int ilayer=0; ilayer < (int)layers_; ++ilayer) {
188  double meanVal = HitOccupancy_Minus_.at(ilayer)->getMean();
189  MeanHitOccupancy_Minus_[indx]->setBinContent(ilayer+1, meanVal);
190  }
191  break;
192  }
193  }
194 
195  return 1;
196 }
int nevent
Definition: AMPTWrapper.h:74
void HGCalRecHitsClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Definition at line 43 of file HGCalRecHitsClient.cc.

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

Referenced by dqmEndJob().

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

Member Data Documentation

unsigned int HGCalRecHitsClient::layers_
private

Definition at line 39 of file HGCalRecHitsClient.h.

Referenced by beginRun(), and recHitsEndjob().

std::string HGCalRecHitsClient::nameDetector_
private

Definition at line 38 of file HGCalRecHitsClient.h.

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

int HGCalRecHitsClient::verbosity_
private

Definition at line 37 of file HGCalRecHitsClient.h.

Referenced by HGCalRecHitsClient(), and runClient_().