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 | 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 dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &)
 
 HcalSimHitsClient (const edm::ParameterSet &)
 
virtual void runClient_ (DQMStore::IBooker &, DQMStore::IGetter &)
 
int SimHitsEndjob (const std::vector< MonitorElement * > &hcalMEs)
 
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
 
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 ()
 
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 Attributes

edm::ParameterSet conf_
 
bool debug_
 
std::string dirName_
 
std::string outputFile_
 
bool verbose_
 

Static Private Attributes

static const int nTime = 4
 
static const int nType = 25
 
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 35 of file HcalSimHitsClient.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file HcalSimHitsClient.cc.

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

12  :conf_(iConfig) {
13 
14  outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile", "myfile.root");
15 
16 
17  debug_ = false;
18  verbose_ = false;
19 
20  dirName_= iConfig.getParameter<std::string>("DQMDirName");
21 
22 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet conf_
std::string outputFile_
HcalSimHitsClient::~HcalSimHitsClient ( )
virtual

Definition at line 25 of file HcalSimHitsClient.cc.

25 { }

Member Function Documentation

void HcalSimHitsClient::dqmEndJob ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Implements DQMEDHarvester.

Definition at line 34 of file HcalSimHitsClient.cc.

References runClient_().

35 {
36  runClient_(ib,ig);
37 }
virtual void runClient_(DQMStore::IBooker &, DQMStore::IGetter &)
void HcalSimHitsClient::runClient_ ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Definition at line 42 of file HcalSimHitsClient.cc.

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

Referenced by dqmEndJob().

42  {
43 
45 
46  if (verbose_) std::cout << "\nrunClient" << std::endl;
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_) std::cout <<"\nfullPath: "<< fullPathHLTFolders[i] << std::endl;
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_) std::cout <<"fullSub: "<<fullSubPathHLTFolders[j] << std::endl;
59 
60  if (strcmp(fullSubPathHLTFolders[j].c_str(), "HcalHitsV/SimHitsValidationHcal") == 0) {
61  hcalMEs = ig.getContents(fullSubPathHLTFolders[j]);
62  if (verbose_) std::cout <<"hltMES size : "<<hcalMEs.size()<<std::endl;
63  if( !SimHitsEndjob(hcalMEs) ) std::cout<<"\nError in SimhitEndjob!"<<std::endl<<std::endl;
64  }
65 
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
tuple cout
Definition: gather_cfg.py:121
int HcalSimHitsClient::SimHitsEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

Definition at line 74 of file HcalSimHitsClient.cc.

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

Referenced by runClient_().

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

Member Data Documentation

edm::ParameterSet HcalSimHitsClient::conf_
private

Definition at line 40 of file HcalSimHitsClient.h.

bool HcalSimHitsClient::debug_
private

Definition at line 43 of file HcalSimHitsClient.h.

Referenced by HcalSimHitsClient().

std::string HcalSimHitsClient::dirName_
private

Definition at line 48 of file HcalSimHitsClient.h.

Referenced by HcalSimHitsClient(), and runClient_().

const int HcalSimHitsClient::nTime = 4
staticprivate

Definition at line 45 of file HcalSimHitsClient.h.

Referenced by SimHitsEndjob().

const int HcalSimHitsClient::nType = 25
staticprivate

Definition at line 44 of file HcalSimHitsClient.h.

Referenced by SimHitsEndjob().

const int HcalSimHitsClient::nType1 = 4
staticprivate

Definition at line 46 of file HcalSimHitsClient.h.

Referenced by SimHitsEndjob().

std::string HcalSimHitsClient::outputFile_
private

Definition at line 38 of file HcalSimHitsClient.h.

Referenced by HcalSimHitsClient().

bool HcalSimHitsClient::verbose_
private

Definition at line 42 of file HcalSimHitsClient.h.

Referenced by HcalSimHitsClient(), runClient_(), and SimHitsEndjob().