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

#include <CastorRecHitMonitor.h>

Inheritance diagram for CastorRecHitMonitor:
CastorBaseMonitor

Public Member Functions

 CastorRecHitMonitor ()
 
void processEvent (const CastorRecHitCollection &castorHits)
 
void reset ()
 
void setup (const edm::ParameterSet &ps, DQMStore *dbe)
 
 ~CastorRecHitMonitor ()
 
- Public Member Functions inherited from CastorBaseMonitor
 CastorBaseMonitor ()
 
virtual void clearME ()
 
virtual void done ()
 
bool getDiagnostics () const
 
int getVerbosity () const
 
void setDiagnostics (bool myval)
 
void setVerbosity (int verb)
 
bool vetoCell (HcalCastorDetId id)
 
virtual ~CastorBaseMonitor ()
 

Private Attributes

float allEnergyModule [14]
 
float allEnergySector [16]
 
struct {
   MonitorElement *   meCastorRecHitsOccupancy
 
   std::map< HcalCastorDetId,
MonitorElement * >   meRECHIT_E
 
   MonitorElement *   meRECHIT_E_all
 
   MonitorElement *   meRECHIT_E_modules
 
   MonitorElement *   meRECHIT_E_relative_modules
 
   MonitorElement *   meRECHIT_E_relative_sectors
 
   MonitorElement *   meRECHIT_E_sectors
 
   MonitorElement *   meRECHIT_MAP_CHAN_E
 
   MonitorElement *   meRECHIT_N_event
 
   MonitorElement *   meRECHIT_N_modules
 
   MonitorElement *   meRECHIT_N_sectors
 
   std::map< HcalCastorDetId,
MonitorElement * >   meRECHIT_T
 
   MonitorElement *   meRECHIT_T_all
 
castorHists
 
float channel
 
bool doPerChannel_
 
float energy
 
float energyInEachChannel [14][16]
 
int ievt_
 
MonitorElementmeEVT_
 
int module
 
int sector
 
float time
 
float totEnergy
 
int zside
 

Additional Inherited Members

- Protected Attributes inherited from CastorBaseMonitor
std::string baseFolder_
 
edm::CPUTimer cpu_timer
 
int fVerbosity
 
DQMStorem_dbe
 
bool makeDiagnostics
 
std::string rootFolder_
 
bool showTiming
 

Detailed Description

Definition at line 9 of file CastorRecHitMonitor.h.

Constructor & Destructor Documentation

CastorRecHitMonitor::CastorRecHitMonitor ( )

Definition at line 16 of file CastorRecHitMonitor.cc.

References doPerChannel_, and ievt_.

16  {
17  doPerChannel_ = true;
18  // occThresh_ = 1;
19  ievt_=0;
20 }
CastorRecHitMonitor::~CastorRecHitMonitor ( )

Definition at line 25 of file CastorRecHitMonitor.cc.

25  {
26 }

Member Function Documentation

void CastorRecHitMonitor::processEvent ( const CastorRecHitCollection castorHits)

Definition at line 172 of file CastorRecHitMonitor.cc.

References allEnergyModule, allEnergySector, CastorBaseMonitor::baseFolder_, edm::SortedCollection< T, SORT >::begin(), castorHists, channel, gather_cfg::cout, CastorBaseMonitor::cpu_timer, edm::CPUTimer::cpuTime(), doPerChannel_, edm::SortedCollection< T, SORT >::end(), energy, energyInEachChannel, MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, ievt_, CastorBaseMonitor::m_dbe, meEVT_, mod(), module, edm::CPUTimer::reset(), sector, CastorBaseMonitor::showTiming, edm::SortedCollection< T, SORT >::size(), edm::CPUTimer::start(), edm::CPUTimer::stop(), time, and totEnergy.

Referenced by CastorMonitorModule::analyze().

172  {
173 
174  if(fVerbosity>0) std::cout << "==>CastorRecHitMonitor::processEvent !!!"<< std::endl;
175 
176 
178  ievt_++; totEnergy=0.;
179 
181  meEVT_->Fill(ievt_);
182 
183 
184 
185  if(!m_dbe) {
186  if(fVerbosity>0) std::cout <<"CastorRecHitMonitor::processEvent => DQMStore is not instantiated !!!"<<std::endl;
187  return;
188  }
189 
191  if (showTiming) { cpu_timer.reset(); cpu_timer.start(); }
192 
193  //castorHists.meRECHIT_N_event->Fill(castorHits.size());
194  int iHit=0;
195 
196  if(castorHits.size()>0)
197  {
198  if(fVerbosity>0) std::cout << "==>CastorRecHitMonitor::processEvent: castorHits.size()>0 !!!" << std::endl;
199 
201  for (CASTORiter=castorHits.begin(); CASTORiter!=castorHits.end(); ++CASTORiter) {
202 
204  energy = CASTORiter->energy();
205  time = CASTORiter->time();
206 
208  HcalCastorDetId id(CASTORiter->detid().rawId());
209  //float zside = id.zside();
210  module = (int)id.module(); //-- get module
211  sector = (int)id.sector(); //-- get sector
212  channel = 16*(module-1)+sector; //-- define channel
213 
214  if (energy>0.) {
216  castorHists.meRECHIT_E_all->Fill(energy);
217  castorHists.meRECHIT_T_all->Fill(time);
219  castorHists.meRECHIT_MAP_CHAN_E->Fill(channel,energy);
221  castorHists.meRECHIT_E_modules->Fill(module-1, energy);
223  castorHists.meRECHIT_E_sectors->Fill(sector-1, energy);
225  castorHists.meRECHIT_N_modules->Fill(module-1);
227  castorHists.meRECHIT_N_sectors->Fill(sector-1);
228  iHit++;
229  }
230 
232  if(energy<0) energy=0;
233 
235  energyInEachChannel[module-1][sector-1] += energy;
236 
238  castorHists.meCastorRecHitsOccupancy->Fill(module-1,sector-1, energy);
239 
241  castorHists.meRECHIT_N_event->Fill(iHit);
242 
244  if( doPerChannel_)
245  CastorRecHitPerChan::perChanHists<CastorRecHit>(*CASTORiter, castorHists.meRECHIT_E, castorHists.meRECHIT_T, m_dbe, baseFolder_);
246  }
247 
249  for(int mod=0; mod<14;mod++)
250  for(int sec=0; sec<16;sec++)
252 
254  for(int mod=0; mod<14;mod++)
259 
261  for(int sec=0; sec<16;sec++)
265  energyInEachChannel[12][sec]+energyInEachChannel[13][sec];
266 
267 
269  for(int mod=0; mod<14;mod++)
270  castorHists.meRECHIT_E_relative_modules->getTH1F()->SetBinContent(mod+1,allEnergyModule[mod]/totEnergy);
271  for(int sec=0; sec<16;sec++)
272  castorHists.meRECHIT_E_relative_sectors->getTH1F()->SetBinContent(sec+1,allEnergySector[sec]/totEnergy);
273 
274 
275 
276  }
277 
278  else { if(fVerbosity>0) std::cout<<"CastorRecHitMonitor::processEvent NO Castor RecHits !!!"<<std::endl; }
279 
280  if (showTiming) {
281  cpu_timer.stop(); std::cout << " TIMER::CastorRecHit -> " << cpu_timer.cpuTime() << std::endl;
283  }
284 
285 
286  return;
287 }
edm::CPUTimer cpu_timer
void start()
Definition: CPUTimer.cc:74
float energyInEachChannel[14][16]
MonitorElement * meEVT_
std::vector< T >::const_iterator const_iterator
struct CastorRecHitMonitor::@252 castorHists
void reset()
Definition: CPUTimer.cc:107
void Fill(long long x)
std::string baseFolder_
Times stop()
Definition: CPUTimer.cc:94
const_iterator end() const
double cpuTime() const
Definition: CPUTimer.cc:158
size_type size() const
tuple cout
Definition: gather_cfg.py:121
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
Definition: vlib.h:209
const_iterator begin() const
void CastorRecHitMonitor::reset ( void  )

Definition at line 28 of file CastorRecHitMonitor.cc.

Referenced by CastorMonitorModule::reset().

28  {
29 }
void CastorRecHitMonitor::setup ( const edm::ParameterSet ps,
DQMStore dbe 
)
virtual

Reimplemented from CastorBaseMonitor.

Definition at line 36 of file CastorRecHitMonitor.cc.

References allEnergyModule, allEnergySector, CastorBaseMonitor::baseFolder_, DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookInt(), castorHists, gather_cfg::cout, doPerChannel_, energyInEachChannel, CastorBaseMonitor::fVerbosity, edm::ParameterSet::getUntrackedParameter(), ievt_, CastorBaseMonitor::m_dbe, meEVT_, mod(), NULL, CastorBaseMonitor::rootFolder_, sector, DQMStore::setCurrentFolder(), CastorBaseMonitor::setup(), totEnergy, and zside.

Referenced by CastorMonitorModule::CastorMonitorModule().

36  {
37 
39  baseFolder_ = rootFolder_+"CastorRecHitMonitor";
40 
41  if(fVerbosity>0) std::cout << "CastorRecHitMonitor::setup (start)" << std::endl;
42 
43  if ( ps.getUntrackedParameter<bool>("RecHitsPerChannel", false) ){
44  doPerChannel_ = true;
45  }
46 
47  ievt_=0; module=0; sector=0; zside=0; totEnergy=0.;
48 
49 
51  for (int mod=0; mod<14; mod++){
52  for (int sec=0; sec<16; sec++){
53  energyInEachChannel[mod][sec] = 0.;
55  allEnergySector[sec]=0;
56  }
57  }
58 
59  if ( m_dbe !=NULL ) {
62 meEVT_ = m_dbe->bookInt("RecHit Event Number"); // meEVT_->Fill(ievt_);
64 castorHists.meRECHIT_E_all = m_dbe->book1D("CastorRecHit Energies- above threshold on RecHitEnergy","CastorRecHit Energies- above threshold on RecHitEnergy",150,0,150);
65 castorHists.meRECHIT_T_all = m_dbe->book1D("CastorRecHit Times- above threshold on RecHitEnergy","CastorRecHit Times- above threshold on RecHitEnergy",300,-100,100);
67 castorHists.meRECHIT_MAP_CHAN_E = m_dbe->book1D("CastorRecHit Energy in each channel- above threshold","CastorRecHit Energy in each channel- above threshold",224,0,224);
69 castorHists.meRECHIT_E_modules = m_dbe->book1D("CastorRecHit Energy in modules- above threshold","CastorRecHit Energy in modules- above threshold", 14, 0, 14);
71 castorHists.meRECHIT_E_sectors = m_dbe->book1D("CastorRecHit Energy in sectors- above threshold","CastorRecHit Energy in sectors- above threshold", 16, 0, 16);
72 
74 castorHists.meRECHIT_N_modules = m_dbe->book1D("Number of CastorRecHits in modules- above threshold","Number of CastorRecHits in modules- above threshold", 14, 0, 14);
76 castorHists.meRECHIT_N_sectors = m_dbe->book1D("Number of CastorRecHits in sectors- above threshold","Number of CastorRecHits in sectors- above threshold", 16, 0, 16);
78 castorHists.meCastorRecHitsOccupancy = m_dbe->book2D("CastorRecHits Occupancy Map", "CastorRecHits Occupancy Map", 14, 0,14, 16, 0,16);
80 castorHists.meRECHIT_N_event = m_dbe->book1D("Number of CASTOR RecHits per event- above threshold","Number of CASTOR RecHits per event- above threshold", 23, 0, 230);
81 
82  m_dbe->setCurrentFolder(baseFolder_+"/EnergyFraction");
84 castorHists.meRECHIT_E_relative_modules = m_dbe->book1D("Fraction of the total energy in CASTOR modules","Fraction of the total energy in CASTOR modules", 14, 0, 14);
86 castorHists.meRECHIT_E_relative_sectors = m_dbe->book1D("Fraction of the total energy in CASTOR sectors","Fraction of the total energy in CASTOR sectors", 16, 0, 16);
87 /*
88 castorHists.meRECHIT_E_relative_modules->getTH1F()->GetYaxis()->SetTitle("fraction of the total energy");
89 castorHists.meRECHIT_E_relative_sectors->getTH1F()->GetYaxis()->SetTitle("fraction of the total energy");
90 
91  char ibin1[1024];
92  for(int i=0; i<14; i++){
93  sprintf(ibin1,"%i", i+1);
94  castorHists.meRECHIT_E_relative_modules->getTH1F()->GetXaxis()->SetBinLabel(i+1,ibin1);
95  }
96  char ibin2[1024];
97  for(int i=0; i<16; i++){
98  sprintf(ibin2,"%i", i+1);
99  castorHists.meRECHIT_E_relative_sectors->getTH1F()->GetXaxis()->SetBinLabel(i+1,ibin2);
100  }
101 */
102 
103  }
104 
105 
106 
107  else{
108  if(fVerbosity>0) std::cout << "CastorRecHitMonitor::setup - NO DQMStore service" << std::endl;
109  }
110 
111  if(fVerbosity>0) std::cout << "CastorRecHitMonitor::setup (end)" << std::endl;
112 
113  return;
114 }
T getUntrackedParameter(std::string const &, T const &) const
virtual void setup(const edm::ParameterSet &ps, DQMStore *dbe)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
float energyInEachChannel[14][16]
MonitorElement * meEVT_
struct CastorRecHitMonitor::@252 castorHists
#define NULL
Definition: scimark2.h:8
std::string baseFolder_
std::string rootFolder_
tuple cout
Definition: gather_cfg.py:121
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:629
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:850
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
Definition: vlib.h:209
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434

Member Data Documentation

float CastorRecHitMonitor::allEnergyModule[14]
private

Definition at line 37 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and setup().

float CastorRecHitMonitor::allEnergySector[16]
private

Definition at line 38 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and setup().

struct { ... } CastorRecHitMonitor::castorHists

Referenced by processEvent(), and setup().

float CastorRecHitMonitor::channel
private

Definition at line 28 of file CastorRecHitMonitor.h.

Referenced by processEvent().

bool CastorRecHitMonitor::doPerChannel_
private

Definition at line 20 of file CastorRecHitMonitor.h.

Referenced by CastorRecHitMonitor(), processEvent(), and setup().

float CastorRecHitMonitor::energy
private

Definition at line 31 of file CastorRecHitMonitor.h.

Referenced by processEvent().

float CastorRecHitMonitor::energyInEachChannel[14][16]
private

Definition at line 33 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and setup().

int CastorRecHitMonitor::ievt_
private

Definition at line 22 of file CastorRecHitMonitor.h.

Referenced by CastorRecHitMonitor(), processEvent(), and setup().

MonitorElement* CastorRecHitMonitor::meCastorRecHitsOccupancy

Definition at line 51 of file CastorRecHitMonitor.h.

MonitorElement* CastorRecHitMonitor::meEVT_
private

Definition at line 56 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and setup().

std::map<HcalCastorDetId, MonitorElement*> CastorRecHitMonitor::meRECHIT_E

Definition at line 53 of file CastorRecHitMonitor.h.

MonitorElement* CastorRecHitMonitor::meRECHIT_E_all

Definition at line 42 of file CastorRecHitMonitor.h.

MonitorElement* CastorRecHitMonitor::meRECHIT_E_modules

Definition at line 45 of file CastorRecHitMonitor.h.

MonitorElement* CastorRecHitMonitor::meRECHIT_E_relative_modules

Definition at line 47 of file CastorRecHitMonitor.h.

MonitorElement* CastorRecHitMonitor::meRECHIT_E_relative_sectors

Definition at line 48 of file CastorRecHitMonitor.h.

MonitorElement* CastorRecHitMonitor::meRECHIT_E_sectors

Definition at line 46 of file CastorRecHitMonitor.h.

MonitorElement* CastorRecHitMonitor::meRECHIT_MAP_CHAN_E

Definition at line 44 of file CastorRecHitMonitor.h.

MonitorElement* CastorRecHitMonitor::meRECHIT_N_event

Definition at line 52 of file CastorRecHitMonitor.h.

MonitorElement* CastorRecHitMonitor::meRECHIT_N_modules

Definition at line 49 of file CastorRecHitMonitor.h.

MonitorElement* CastorRecHitMonitor::meRECHIT_N_sectors

Definition at line 50 of file CastorRecHitMonitor.h.

std::map<HcalCastorDetId, MonitorElement*> CastorRecHitMonitor::meRECHIT_T

Definition at line 53 of file CastorRecHitMonitor.h.

MonitorElement* CastorRecHitMonitor::meRECHIT_T_all

Definition at line 43 of file CastorRecHitMonitor.h.

int CastorRecHitMonitor::module
private

Definition at line 25 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and TreeCrawler.Package::search().

int CastorRecHitMonitor::sector
private

Definition at line 26 of file CastorRecHitMonitor.h.

Referenced by geometryXMLparser.DTAlignable::index(), processEvent(), and setup().

float CastorRecHitMonitor::time
private

Definition at line 32 of file CastorRecHitMonitor.h.

Referenced by processEvent().

float CastorRecHitMonitor::totEnergy
private

Definition at line 34 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and setup().

int CastorRecHitMonitor::zside
private

Definition at line 27 of file CastorRecHitMonitor.h.

Referenced by setup().