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
CaloTowersClient Class Reference

#include <CaloTowersClient.h>

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

Public Member Functions

virtual void beginJob (void)
 
 CaloTowersClient (const edm::ParameterSet &)
 
int CaloTowersEndjob (const std::vector< MonitorElement * > &hcalMEs)
 
virtual void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
virtual ~CaloTowersClient ()
 
- 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
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 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
 
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 dirNameJet_
 
std::string dirNameMET_
 
std::string outputFile_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- 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::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 CaloTowersClient.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file CaloTowersClient.cc.

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

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

Definition at line 22 of file CaloTowersClient.cc.

23 {
24 
25 }

Member Function Documentation

void CaloTowersClient::beginJob ( void  )
virtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 27 of file CaloTowersClient.cc.

28 {
29 
30 
31 }
int CaloTowersClient::CaloTowersEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

Definition at line 69 of file CaloTowersClient.cc.

References cont, gather_cfg::cout, alignCSCRings::e, MonitorElement::getEntries(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), i, j, nevent, and verbose_.

Referenced by dqmEndJob().

69  {
70 
71  int useAllHistos = 0;
72  MonitorElement* Ntowers_vs_ieta =0;
73  MonitorElement* mapEnergy_N =0, *mapEnergy_E =0, *mapEnergy_H =0, *mapEnergy_EH =0;
74  MonitorElement* occupancy_map =0, *occupancy_vs_ieta =0;
75  for(unsigned int ih=0; ih<hcalMEs.size(); ih++){
76  if( strcmp(hcalMEs[ih]->getName().c_str(), "Ntowers_per_event_vs_ieta") ==0 ){
77  Ntowers_vs_ieta = hcalMEs[ih];
78  }
79  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_Nentries") ==0 ){
80  mapEnergy_N = hcalMEs[ih];
81  }
82  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_H") ==0 ){
83  useAllHistos++; mapEnergy_H = hcalMEs[ih];
84  }
85  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_E") ==0 ){
86  useAllHistos++; mapEnergy_E = hcalMEs[ih];
87  }
88  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_EH") ==0 ){
89  useAllHistos++; mapEnergy_EH = hcalMEs[ih];
90  }
91  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_occupancy") ==0 ){
92  occupancy_map = hcalMEs[ih];
93  }
94  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_occupancy_vs_ieta") ==0 ){
95  occupancy_vs_ieta = hcalMEs[ih];
96  }
97 
98  }
99  if( useAllHistos !=0 && useAllHistos !=3 ) return 0;
100 
101  double nevent = mapEnergy_N->getEntries();
102  if(verbose_) std::cout<<"nevent : "<<nevent<<std::endl;
103 
104  // mean number of towers per ieta
105  int nx = Ntowers_vs_ieta->getNbinsX();
106  float cont;
107  float fev = float(nevent);
108 
109  for (int i = 1; i <= nx; i++) {
110  cont = Ntowers_vs_ieta -> getBinContent(i) / fev ;
111  Ntowers_vs_ieta -> setBinContent(i,cont);
112  }
113 
114  // mean energies & occupancies evaluation
115 
116  nx = mapEnergy_N->getNbinsX();
117  int ny = mapEnergy_N->getNbinsY();
118  float cnorm;
119  float phi_factor;
120 
121  for (int i = 1; i <= nx; i++) {
122  float sumphi = 0.;
123 
124  for (int j = 1; j <= ny; j++) {
125 
126  // Emean
127  cnorm = mapEnergy_N -> getBinContent(i,j);
128  //Phi histos are not used in the macros
129  if(cnorm > 0.000001 && useAllHistos) {
130 
131  cont = mapEnergy_E -> getBinContent(i,j) / cnorm ;
132  mapEnergy_E -> setBinContent(i,j,cont);
133 
134  cont = mapEnergy_H -> getBinContent(i,j) / cnorm ;
135  mapEnergy_H -> setBinContent(i,j,cont);
136 
137  cont = mapEnergy_EH -> getBinContent(i,j) / cnorm ;
138  mapEnergy_EH -> setBinContent(i,j,cont);
139  }
140 
141  // Occupancy (needed for occupancy vs ieta)
142  cnorm = occupancy_map -> getBinContent(i,j) / fev;
143  if(cnorm > 1.e-30) occupancy_map -> setBinContent(i,j,cnorm);
144 
145  sumphi += cnorm;
146 
147  } // end of iphy cycle (j)
148 
149  //Occupancy vs ieta histo is drawn
150  // phi-factor evaluation for occupancy_vs_ieta calculation
151  int ieta = i - 42; // -41 -1, 0 40
152  if(ieta >=0 ) ieta +=1; // -41 -1, 1 41 - to make it detector-like
153 
154  if(ieta >= -20 && ieta <= 20 )
155  {phi_factor = 72.;}
156  else {
157  if(ieta >= 40 || ieta <= -40 ) {phi_factor = 18.;}
158  else
159  phi_factor = 36.;
160  }
161  if(ieta >= 0) ieta -= 1; // -41 -1, 0 40 - to bring back to histo num
162 
163  cnorm = sumphi / phi_factor;
164  occupancy_vs_ieta->Fill(double(ieta), cnorm);
165 
166  } // end of ieta cycle (i)
167 
168  return 1;
169 
170 }
int i
Definition: DBlmapReader.cc:9
double getEntries(void) const
get # of entries
int getNbinsY(void) const
get # of bins in Y-axis
int nevent
Definition: AMPTWrapper.h:74
int j
Definition: DBlmapReader.cc:9
int cont
int getNbinsX(void) const
get # of bins in X-axis
tuple cout
Definition: gather_cfg.py:121
void CaloTowersClient::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 34 of file CaloTowersClient.cc.

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

35 {
36  igetter.setCurrentFolder(dirName_);
37 
38  if (verbose_) std::cout << "\nrunClient" << std::endl;
39 
40  std::vector<MonitorElement*> hcalMEs;
41 
42  // Since out folders are fixed to three, we can just go over these three folders
43  // i.e., CaloTowersV/CaloTowersTask, HcalRecHitsV/HcalRecHitTask, NoiseRatesV/NoiseRatesTask.
44  std::vector<std::string> fullPathHLTFolders = igetter.getSubdirs();
45  for(unsigned int i=0;i<fullPathHLTFolders.size();i++) {
46 
47  if (verbose_) std::cout <<"\nfullPath: "<< fullPathHLTFolders[i] << std::endl;
48  igetter.setCurrentFolder(fullPathHLTFolders[i]);
49 
50  std::vector<std::string> fullSubPathHLTFolders = igetter.getSubdirs();
51  for(unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
52 
53  if (verbose_) std::cout <<"fullSub: "<<fullSubPathHLTFolders[j] << std::endl;
54 
55  if( strcmp(fullSubPathHLTFolders[j].c_str(), "CaloTowersV/CaloTowersTask") ==0 ){
56  hcalMEs = igetter.getContents(fullSubPathHLTFolders[j]);
57  if (verbose_) std::cout <<"hltMES size : "<<hcalMEs.size()<<std::endl;
58  if( !CaloTowersEndjob(hcalMEs) ) std::cout<<"\nError in CaloTowersEndjob!"<<std::endl<<std::endl;
59  }
60 
61  }
62 
63  }
64 
65 }
std::vector< MonitorElement * > getContents(Args &&...args)
Definition: DQMStore.h:196
int i
Definition: DBlmapReader.cc:9
int CaloTowersEndjob(const std::vector< MonitorElement * > &hcalMEs)
int j
Definition: DBlmapReader.cc:9
std::string dirName_
std::vector< std::string > getSubdirs(void)
Definition: DQMStore.cc:302
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:326
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

edm::ParameterSet CaloTowersClient::conf_
private

Definition at line 42 of file CaloTowersClient.h.

bool CaloTowersClient::debug_
private

Definition at line 45 of file CaloTowersClient.h.

Referenced by CaloTowersClient().

std::string CaloTowersClient::dirName_
private

Definition at line 47 of file CaloTowersClient.h.

Referenced by CaloTowersClient(), and dqmEndJob().

std::string CaloTowersClient::dirNameJet_
private

Definition at line 48 of file CaloTowersClient.h.

std::string CaloTowersClient::dirNameMET_
private

Definition at line 49 of file CaloTowersClient.h.

std::string CaloTowersClient::outputFile_
private

Definition at line 40 of file CaloTowersClient.h.

Referenced by CaloTowersClient().

bool CaloTowersClient::verbose_
private

Definition at line 44 of file CaloTowersClient.h.

Referenced by CaloTowersClient(), CaloTowersEndjob(), and dqmEndJob().