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

#include <CaloTowersDQMClient.h>

Inheritance diagram for CaloTowersDQMClient:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob (void)
 
virtual void beginRun (const edm::Run &run, const edm::EventSetup &c)
 
 CaloTowersDQMClient (const edm::ParameterSet &)
 
int CaloTowersEndjob (const std::vector< MonitorElement * > &hcalMEs)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
 
virtual void endRun (const edm::Run &run, const edm::EventSetup &c)
 
virtual void runClient_ ()
 
virtual ~CaloTowersDQMClient ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

edm::ParameterSet conf_
 
DQMStoredbe_
 
bool debug_
 
std::string dirName_
 
std::string dirNameJet_
 
std::string dirNameMET_
 
std::string outputFile_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 36 of file CaloTowersDQMClient.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file CaloTowersDQMClient.cc.

References dbe_, debug_, dirName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), cppFunctionSkipper::operator, outputFile_, and verbose_.

12  :conf_(iConfig)
13 {
14 
15  outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile", "myfile.root");
16 
18  if (!dbe_) {
19  edm::LogError("CaloTowersDQMClient") << "unable to get DQMStore service, upshot is no client histograms will be made";
20  }
21  if(iConfig.getUntrackedParameter<bool>("DQMStore", false)) {
22  if(dbe_) dbe_->setVerbose(0);
23  }
24 
25  debug_ = false;
26  verbose_ = false;
27 
28  dirName_=iConfig.getParameter<std::string>("DQMDirName");
30 
31 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet conf_
void setVerbose(unsigned level)
Definition: DQMStore.cc:393
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
CaloTowersDQMClient::~CaloTowersDQMClient ( )
virtual

Definition at line 34 of file CaloTowersDQMClient.cc.

35 {
36 
37 }

Member Function Documentation

void CaloTowersDQMClient::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 62 of file CaloTowersDQMClient.cc.

63 {
64 
65 }
void CaloTowersDQMClient::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 39 of file CaloTowersDQMClient.cc.

40 {
41 
42 
43 }
void CaloTowersDQMClient::beginRun ( const edm::Run run,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 50 of file CaloTowersDQMClient.cc.

51 {
52 
53 }
int CaloTowersDQMClient::CaloTowersEndjob ( const std::vector< MonitorElement * > &  hcalMEs)

Definition at line 108 of file CaloTowersDQMClient.cc.

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

Referenced by runClient_().

108  {
109 
110  int useAllHistos = 0;
111  MonitorElement* Ntowers_vs_ieta =0;
112  MonitorElement* mapEnergy_N =0, *mapEnergy_E =0, *mapEnergy_H =0, *mapEnergy_EH =0;
113  MonitorElement* occupancy_map =0, *occupancy_vs_ieta =0;
114  for(unsigned int ih=0; ih<hcalMEs.size(); ih++){
115  if( strcmp(hcalMEs[ih]->getName().c_str(), "Ntowers_per_event_vs_ieta") ==0 ){
116  Ntowers_vs_ieta = hcalMEs[ih];
117  }
118  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_Nentries") ==0 ){
119  mapEnergy_N = hcalMEs[ih];
120  }
121  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_H") ==0 ){
122  useAllHistos++; mapEnergy_H = hcalMEs[ih];
123  }
124  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_E") ==0 ){
125  useAllHistos++; mapEnergy_E = hcalMEs[ih];
126  }
127  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_energy_EH") ==0 ){
128  useAllHistos++; mapEnergy_EH = hcalMEs[ih];
129  }
130  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_map_occupancy") ==0 ){
131  occupancy_map = hcalMEs[ih];
132  }
133  if( strcmp(hcalMEs[ih]->getName().c_str(), "CaloTowersTask_occupancy_vs_ieta") ==0 ){
134  occupancy_vs_ieta = hcalMEs[ih];
135  }
136 
137  }
138  if( useAllHistos !=0 && useAllHistos !=3 ) return 0;
139 
140  double nevent = mapEnergy_N->getEntries();
141  if(verbose_) std::cout<<"nevent : "<<nevent<<std::endl;
142 
143  // mean number of towers per ieta
144  int nx = Ntowers_vs_ieta->getNbinsX();
145  float cont;
146  float fev = float(nevent);
147 
148  for (int i = 1; i <= nx; i++) {
149  cont = Ntowers_vs_ieta -> getBinContent(i) / fev ;
150  Ntowers_vs_ieta -> setBinContent(i,cont);
151  }
152 
153  // mean energies & occupancies evaluation
154 
155  nx = mapEnergy_N->getNbinsX();
156  int ny = mapEnergy_N->getNbinsY();
157  float cnorm;
158  float phi_factor;
159 
160  for (int i = 1; i <= nx; i++) {
161  float sumphi = 0.;
162 
163  for (int j = 1; j <= ny; j++) {
164 
165  // Emean
166  cnorm = mapEnergy_N -> getBinContent(i,j);
167  //Phi histos are not used in the macros
168  if(cnorm > 0.000001 && useAllHistos) {
169 
170  cont = mapEnergy_E -> getBinContent(i,j) / cnorm ;
171  mapEnergy_E -> setBinContent(i,j,cont);
172 
173  cont = mapEnergy_H -> getBinContent(i,j) / cnorm ;
174  mapEnergy_H -> setBinContent(i,j,cont);
175 
176  cont = mapEnergy_EH -> getBinContent(i,j) / cnorm ;
177  mapEnergy_EH -> setBinContent(i,j,cont);
178  }
179 
180  // Occupancy (needed for occupancy vs ieta)
181  cnorm = occupancy_map -> getBinContent(i,j) / fev;
182  if(cnorm > 1.e-30) occupancy_map -> setBinContent(i,j,cnorm);
183 
184  sumphi += cnorm;
185 
186  } // end of iphy cycle (j)
187 
188  //Occupancy vs ieta histo is drawn
189  // phi-factor evaluation for occupancy_vs_ieta calculation
190  int ieta = i - 42; // -41 -1, 0 40
191  if(ieta >=0 ) ieta +=1; // -41 -1, 1 41 - to make it detector-like
192 
193  if(ieta >= -20 && ieta <= 20 )
194  {phi_factor = 72.;}
195  else {
196  if(ieta >= 40 || ieta <= -40 ) {phi_factor = 18.;}
197  else
198  phi_factor = 36.;
199  }
200  if(ieta >= 0) ieta -= 1; // -41 -1, 0 40 - to bring back to histo num
201 
202  cnorm = sumphi / phi_factor;
203  occupancy_vs_ieta->Fill(double(ieta), cnorm);
204 
205  } // end of ieta cycle (i)
206 
207  return 1;
208 
209 }
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
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
int cont
int getNbinsX(void) const
get # of bins in X-axis
tuple cout
Definition: gather_cfg.py:121
void CaloTowersDQMClient::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 45 of file CaloTowersDQMClient.cc.

References dbe_, outputFile_, and DQMStore::save().

46 {
47  if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
48 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
void CaloTowersDQMClient::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file CaloTowersDQMClient.cc.

68 {
69 // runClient_();
70 }
void CaloTowersDQMClient::endRun ( const edm::Run run,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file CaloTowersDQMClient.cc.

References runClient_().

57 {
58  runClient_();
59 }
void CaloTowersDQMClient::runClient_ ( )
virtual

Definition at line 72 of file CaloTowersDQMClient.cc.

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

Referenced by endRun().

73 {
74  if(!dbe_) return; //we dont have the DQMStore so we cant do anything
76 
77  if (verbose_) std::cout << "\nrunClient" << std::endl;
78 
79  std::vector<MonitorElement*> hcalMEs;
80 
81  // Since out folders are fixed to three, we can just go over these three folders
82  // i.e., CaloTowersV/CaloTowersTask, HcalRecHitsV/HcalRecHitTask, NoiseRatesV/NoiseRatesTask.
83  std::vector<std::string> fullPathHLTFolders = dbe_->getSubdirs();
84  for(unsigned int i=0;i<fullPathHLTFolders.size();i++) {
85 
86  if (verbose_) std::cout <<"\nfullPath: "<< fullPathHLTFolders[i] << std::endl;
87  dbe_->setCurrentFolder(fullPathHLTFolders[i]);
88 
89  std::vector<std::string> fullSubPathHLTFolders = dbe_->getSubdirs();
90  for(unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
91 
92  if (verbose_) std::cout <<"fullSub: "<<fullSubPathHLTFolders[j] << std::endl;
93 
94  if( strcmp(fullSubPathHLTFolders[j].c_str(), "CaloTowersV/CaloTowersTask") ==0 ){
95  hcalMEs = dbe_->getContents(fullSubPathHLTFolders[j]);
96  if (verbose_) std::cout <<"hltMES size : "<<hcalMEs.size()<<std::endl;
97  if( !CaloTowersEndjob(hcalMEs) ) std::cout<<"\nError in CaloTowersEndjob!"<<std::endl<<std::endl;
98  }
99 
100  }
101 
102  }
103 
104 }
int i
Definition: DBlmapReader.cc:9
int CaloTowersEndjob(const std::vector< MonitorElement * > &hcalMEs)
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1419
int j
Definition: DBlmapReader.cc:9
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1497
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429

Member Data Documentation

edm::ParameterSet CaloTowersDQMClient::conf_
private

Definition at line 42 of file CaloTowersDQMClient.h.

DQMStore* CaloTowersDQMClient::dbe_
private

Definition at line 39 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient(), endJob(), and runClient_().

bool CaloTowersDQMClient::debug_
private

Definition at line 45 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient().

std::string CaloTowersDQMClient::dirName_
private

Definition at line 47 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient(), and runClient_().

std::string CaloTowersDQMClient::dirNameJet_
private

Definition at line 48 of file CaloTowersDQMClient.h.

std::string CaloTowersDQMClient::dirNameMET_
private

Definition at line 49 of file CaloTowersDQMClient.h.

std::string CaloTowersDQMClient::outputFile_
private

Definition at line 40 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient(), and endJob().

bool CaloTowersDQMClient::verbose_
private

Definition at line 44 of file CaloTowersDQMClient.h.

Referenced by CaloTowersDQMClient(), CaloTowersEndjob(), and runClient_().