CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorRecHitMonitor.cc
Go to the documentation of this file.
4 
5 //***************************************************//
6 //********** CastorRecHitMonitor: *******************//
7 //********** Author: Dmytro Volyanskyy ************//
8 //********** Date : 23.09.2008 (first version) ******//
11 //***************************************************//
12 //---- critical revision 26.06.2014 (Vladimir Popov)
13 //==================================================================//
14 //======================= Constructor ==============================//
16 {
18  ps.getUntrackedParameter<std::string>("subSystemFolder","Castor");
19  ievt_=0;
20 }
21 
22 //======================= Destructor ==============================//
24 
25 //=================== setup ===============//
26 
28 {
29 // CastorBaseMonitor::setup(ps);
30  return;
31 }
32 
33 
34 //============== boolHistograms ==============//
36  const edm::Run& iRun, const edm::EventSetup& iSetup)
37 {
38  char s[60];
39  if(fVerbosity>0)
40  std::cout<<"CastorRecHitMonitor::bookHistograms"<<std::endl;
41  ibooker.setCurrentFolder(subsystemname + "/CastorRecHitMonitor");
42 
43  sprintf(s,"CastorRecHitSumInSectors");
44  //h2RHvsSec = ibooker.book2D(s,s, 16, 0,16, 20000, 0.,200000.);
45  //h2RHvsSec->getTH2F()->GetXaxis()->SetTitle("sectorPhi");
46  //h2RHvsSec->getTH2F()->GetYaxis()->SetTitle("RecHit");
47  //h2RHvsSec->getTH2F()->SetOption("colz");
48 
49  sprintf(s,"CastorTileRecHit");
50  //h2RHchan = ibooker.book2D(s,s, 224, 0,224, 5100, -1000,50000.);
51  //h2RHchan->getTH2F()->GetXaxis()->SetTitle("sector*14+module");
52  //h2RHchan->getTH2F()->GetYaxis()->SetTitle("RecHit");
53  //h2RHchan->getTH2F()->SetOption("colz");
54 
55  sprintf(s,"CastorRecHitMap(cumulative)");
56  h2RHmap = ibooker.book2D(s,s,14, 0,14, 16, 0,16);
57  h2RHmap->getTH2F()->GetXaxis()->SetTitle("moduleZ");
58  h2RHmap->getTH2F()->GetYaxis()->SetTitle("sectorPhi");
59  h2RHmap->getTH2F()->SetOption("colz");
60 
61  sprintf(s,"CastorRecHitOccMap");
62  h2RHoccmap = ibooker.book2D(s,s,14, 0,14, 16, 0,16);
63  h2RHoccmap->getTH2F()->GetXaxis()->SetTitle("moduleZ");
64  h2RHoccmap->getTH2F()->GetYaxis()->SetTitle("sectorPhi");
65  h2RHoccmap->getTH2F()->SetOption("colz");
66 
67  sprintf(s,"CastorRecHitEntriesMap");
68  h2RHentriesMap = ibooker.book2D(s,s,14, 0,14, 16, 0,16);
69  h2RHentriesMap->getTH2F()->GetXaxis()->SetTitle("moduleZ");
70  h2RHentriesMap->getTH2F()->GetYaxis()->SetTitle("sectorPhi");
71  h2RHentriesMap->getTH2F()->SetOption("colz");
72 
73  sprintf(s,"CastorRecHitTime");
74  hRHtime = ibooker.book1D(s,s,301, -101.,200.);
75 
76  sprintf(s,"Reco all tiles");
77  hallchan = ibooker.book1D(s,s,22000,-20000.,200000.);
78 
79  if(fVerbosity>0)
80  std::cout<<"CastorRecHitMonitor::bookHistograms(end)"<<std::endl;
81  return;
82 }
83 
84 //================== processEvent ==========================//
86 {
87  if(fVerbosity>0) std::cout << "CastorRecHitMonitor::processEvent (begin)"<< std::endl;
88  ievt_++;
89  for (int z=0; z<14; z++) for (int phi=0; phi<16; phi++)
90  energyInEachChannel[z][phi] = 0.;
91 
93  if (showTiming) { cpu_timer.reset(); cpu_timer.start(); }
94 
95  if(castorHits.size() <= 0) return;
96 
97  for(CASTORiter=castorHits.begin(); CASTORiter!=castorHits.end(); ++CASTORiter)
98  {
99  float energy = CASTORiter->energy();
100  float time = CASTORiter->time();
101  float time2 = time;
102  if(time < -100.) time2 = -100.;
103  hRHtime->Fill(time2);
104 
105  HcalCastorDetId id(CASTORiter->detid().rawId());
106  //float zside = id.zside();
107  int module = (int)id.module(); //-- get module
108  int sector = (int)id.sector(); //-- get sector
109 
110  energyInEachChannel[module-1][sector-1] += energy;
111 
112  h2RHentriesMap->Fill(module-1,sector-1);
113  } // end for(CASTORiter=castorHits.begin(); CASTORiter!= ...
114 
115  for(int phi=0; phi<16; phi++) {
116  double es = 0.;
117  for (int z=0; z<14; z++) {
118  //int ind = phi*14 + z +1;
119  float rh = energyInEachChannel[z][phi];
120  //h2RHchan->Fill(ind,rh);
121  hallchan->Fill(rh);
122  if(rh < 0.) continue;
123  h2RHmap->Fill(z,phi,rh);
124  es += rh;
125  }
126  //h2RHvsSec->Fill(phi,es);
127  } // end for(int phi=0;
128 
129  if(ievt_ %100 == 0)
130  for(int mod=1; mod<=14; mod++) for(int sec=1; sec<=16;sec++) {
131  double a= h2RHmap->getTH2F()->GetBinContent(mod,sec);
132  h2RHoccmap->getTH2F()->SetBinContent(mod,sec,a/double(ievt_));
133  }
134 
135  if(fVerbosity>0) std::cout << "CastorRecHitMonitor::processEvent (end)"<< std::endl;
136  return;
137 }
T getUntrackedParameter(std::string const &, T const &) const
edm::CPUTimer cpu_timer
void start()
Definition: CPUTimer.cc:74
float energyInEachChannel[14][16]
void setup(const edm::ParameterSet &ps)
std::vector< CastorRecHit >::const_iterator const_iterator
void reset()
Definition: CPUTimer.cc:107
MonitorElement * hallchan
float float float z
MonitorElement * h2RHentriesMap
void Fill(long long x)
CastorRecHitMonitor(const edm::ParameterSet &ps)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * hRHtime
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
const_iterator end() const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * h2RHoccmap
size_type size() const
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
void processEvent(const CastorRecHitCollection &castorHits)
TH2F * getTH2F(void) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
Definition: vlib.h:208
const_iterator begin() const
Definition: Run.h:41
Definition: DDAxes.h:10
MonitorElement * h2RHmap