CMS 3D CMS Logo

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 
16 {
17  fVerbosity = ps.getUntrackedParameter<int>("debug",0);
18  if(fVerbosity>0)
19  std::cout<<"CastorRecHitMonitor Constructor: "<<this<<std::endl;
21  ps.getUntrackedParameter<std::string>("subSystemFolder","Castor");
22  ievt_=0;
23 }
24 
26 
28  const edm::Run& iRun, const edm::EventSetup& iSetup)
29 {
30  char s[60];
31  if(fVerbosity>0)
32  std::cout<<"CastorRecHitMonitor::bookHistograms"<<std::endl;
33  ibooker.setCurrentFolder(subsystemname + "/CastorRecHitMonitor");
34 
35  const int N_Sec = 16;
36  const int nySec = 20;
37  float ySec[nySec+1];
38  float xSec[N_Sec+1];
39  double E0sec = 1./1024.;
40  ySec[0] = 0.; ySec[1] = E0sec;
41  double lnBsec = log(2.);
42  for(int j=1; j<nySec; j++) ySec[j+1] = E0sec*exp(j*lnBsec);
43  for(int i=0; i<=N_Sec; i++) xSec[i]=i;
44 
45  sprintf(s,"CastorRecHit by Sectors");
46  h2RHvsSec = ibooker.book2D(s,s, N_Sec, xSec, nySec, ySec);
47  h2RHvsSec->getTH2F()->GetXaxis()->SetTitle("sectorPhi");
48  h2RHvsSec->getTH2F()->GetYaxis()->SetTitle("RecHit / GeV");
49  h2RHvsSec->getTH2F()->SetOption("colz");
50 
51 
52  const int nxCh = 224;
53  const int nyE = 18;
54  float xCh[nxCh+1];
55  float yErh[nyE+1];
56  for(int i=0; i<=nxCh; i++) xCh[i]=i;
57  double E0 = 1./1024.;
58  double lnA = log(2.);
59  yErh[0] = 0.; yErh[1] = E0;
60  for(int j=1; j<nyE; j++) yErh[j+1] = E0*exp(j*lnA);
61 
62  sprintf(s,"CastorTileRecHit");
63  h2RHchan = ibooker.book2D(s,s, nxCh, xCh, nyE, yErh);
64  h2RHchan->getTH2F()->GetXaxis()->SetTitle("sector*14+module");
65  h2RHchan->getTH2F()->GetYaxis()->SetTitle("RecHit / GeV");
66  h2RHchan->getTH2F()->SetOption("colz");
67 
68  sprintf(s,"Reco all tiles");
69  hallchan = ibooker.book1D(s,s,nyE,yErh);
70  hallchan->getTH1F()->GetXaxis()->SetTitle("GeV");
71 
72  sprintf(s,"CastorRecHitMap(cumulative)");
73  h2RHmap = ibooker.book2D(s,s,14, 0,14, 16, 0,16);
74  h2RHmap->getTH2F()->GetXaxis()->SetTitle("moduleZ");
75  h2RHmap->getTH2F()->GetYaxis()->SetTitle("sectorPhi");
76  h2RHmap->getTH2F()->SetOption("colz");
77 
78  sprintf(s,"CastorRecHitOccMap");
79  h2RHoccmap = ibooker.book2D(s,s,14, 0,14, 16, 0,16);
80  h2RHoccmap->getTH2F()->GetXaxis()->SetTitle("moduleZ");
81  h2RHoccmap->getTH2F()->GetYaxis()->SetTitle("sectorPhi");
82  h2RHoccmap->getTH2F()->SetOption("colz");
83 
84  sprintf(s,"CastorRecHitEntriesMap");
85  h2RHentriesMap = ibooker.book2D(s,s,14, 0,14, 16, 0,16);
86  h2RHentriesMap->getTH2F()->GetXaxis()->SetTitle("moduleZ");
87  h2RHentriesMap->getTH2F()->GetYaxis()->SetTitle("sectorPhi");
88  h2RHentriesMap->getTH2F()->SetOption("colz");
89 
90  sprintf(s,"CastorRecHitTime");
91  hRHtime = ibooker.book1D(s,s,301, -101.,200.);
92 
93  sprintf(s,"CASTORTowerDepth");
94  hTowerDepth = ibooker.book1D(s,s,130,-15500.,-14200.);
95  hTowerDepth->getTH1F()->GetXaxis()->SetTitle("mm");
96 
97  sprintf(s,"CASTORTowerMultiplicity");
98  hTowerMultipl = ibooker.book1D(s,s,20,0.,20.);
99 
100  const int NEtow = 20;
101  float EhadTow[NEtow+1];
102  float EMTow[NEtow+1];
103  float ETower[NEtow+2];
104  double E0tow = 1./1024.;
105  EMTow[0] = 0.; EMTow[1] = E0tow;
106  EhadTow[0] = 0.; EhadTow[1] = E0tow;
107  ETower[0] = 0.; ETower[1] = E0tow;
108  double lnBtow = log(2.);
109  for(int j=1; j<NEtow; j++) EMTow[j+1] = E0tow*exp(j*lnBtow);
110  for(int j=1; j<NEtow; j++) EhadTow[j+1] = E0tow*exp(j*lnBtow);
111  for(int j=1; j<=NEtow; j++) ETower[j+1] = E0tow*exp(j*lnBtow);
112 
113  sprintf(s,"CASTORTowerEMvsEhad");
114  h2TowerEMhad = ibooker.book2D(s,s, NEtow, EhadTow, NEtow, EMTow);
115  h2TowerEMhad->getTH2F()->GetXaxis()->SetTitle("Ehad / GeV");
116  h2TowerEMhad->getTH2F()->GetYaxis()->SetTitle("EM / GeV");
117  h2TowerEMhad->getTH2F()->SetOption("colz");
118 
119  sprintf(s,"CASTORTowerTotalEnergy");
120  hTowerE = ibooker.book1D(s,s,NEtow+1,ETower);
121  hTowerE->getTH1F()->GetXaxis()->SetTitle("GeV");
122 
123  sprintf(s,"CASTORJetsMultiplicity");
124  hJetsMultipl = ibooker.book1D(s,s,16, 0.,16.);
125 
126  sprintf(s,"CASTORJetEnergy");
127  hJetEnergy = ibooker.book1D(s,s,5000, 0.,500.);
128 
129  sprintf(s,"CASTORJetEta");
130  hJetEta = ibooker.book1D(s,s,126, -6.3, 6.3);
131 
132  sprintf(s,"CASTORJetPhi");
133  hJetPhi = ibooker.book1D(s,s,63, -3.15,3.15);
134 
135  if(fVerbosity>0)
136  std::cout<<"CastorRecHitMonitor::bookHistograms(end)"<<std::endl;
137  return;
138 }
139 
141  const reco::CastorTowerCollection& castorTowers)
142 {
143  if(castorTowers.size() <= 0) return;
144  int nTowers = 0;
145 
146  for(reco::CastorTowerCollection::const_iterator iTower= castorTowers.begin();
147  iTower!= castorTowers.end(); iTower++) {
148 
149  hTowerE->Fill(iTower->energy()*0.001);
150  h2TowerEMhad->Fill(iTower->hadEnergy()*0.001,iTower->emEnergy()*0.001);
151  hTowerDepth->Fill(iTower->depth());
152  nTowers++;
153  }
154  hTowerMultipl->Fill(nTowers);
155 }
156 
158 {
159  if(fVerbosity>0) std::cout << "CastorRecHitMonitor::processEvent (begin)"<< std::endl;
160  ievt_++;
161  for (int z=0; z<14; z++) for (int phi=0; phi<16; phi++)
162  energyInEachChannel[z][phi] = 0.;
163 
165 // if (showTiming) { cpu_timer.reset(); cpu_timer.start(); }
166 
167  if(castorHits.size() <= 0) return;
168 
169  //for(edm::TriggerResults::const_iterator iTrig= hltResults->begin();
170 // iTrig!= hltResults->end(); iTrig++) {;}
171 
172  for(CASTORiter=castorHits.begin(); CASTORiter!=castorHits.end(); ++CASTORiter)
173  {
174  float energy = CASTORiter->energy();
175  float time = CASTORiter->time();
176  float time2 = time;
177  if(time < -100.) time2 = -100.;
178  hRHtime->Fill(time2);
179 
180  HcalCastorDetId id(CASTORiter->detid().rawId());
181  //float zside = id.zside();
182  int module = (int)id.module(); //-- get module
183  int sector = (int)id.sector(); //-- get sector
184 
185  energyInEachChannel[module-1][sector-1] += energy;
186 
187  h2RHentriesMap->Fill(module-1,sector-1);
188  } // end for(CASTORiter=castorHits.begin(); CASTORiter!= ...
189 
190  double etot = 0.;
191  for(int phi=0; phi<16; phi++) {
192  double es = 0.;
193  for (int z=0; z<14; z++) {
194  float rh = energyInEachChannel[z][phi]*0.001;
195  int ind = phi*14 + z +1;
196  h2RHchan->Fill(ind,rh);
197  hallchan->Fill(rh);
198  if(rh < 0.) continue;
199  h2RHmap->Fill(z,phi,rh);
200  es += rh;
201  }
202  h2RHvsSec->Fill(phi,es);
203  etot += es;
204  } // end for(int phi=0;
205 
206  if(ievt_ %100 == 0)
207  for(int mod=1; mod<=14; mod++)
208  for(int sec=1; sec<=16;sec++) {
209  double a= h2RHmap->getTH2F()->GetBinContent(mod,sec);
210  h2RHoccmap->getTH2F()->SetBinContent(mod,sec,a/double(ievt_));
211  }
212 
213  if(fVerbosity>0) std::cout << "CastorRecHitMonitor::processEvent (end)"<< std::endl;
214  return;
215 }
216 
218 {
219  int nJets=0;
220  for(reco::BasicJetCollection::const_iterator ibegin = Jets.begin(),
221  iend = Jets.end(), ijet = ibegin; ijet!= iend; ++ijet) {
222  nJets++;
223  float energy = ijet->energy()*0.001;
224  hJetEnergy->Fill(energy);
225  hJetEta->Fill(ijet->eta());
226  hJetPhi->Fill(ijet->phi());
227  }
228  hJetsMultipl->Fill(nJets);
229 }
230 
T getUntrackedParameter(std::string const &, T const &) const
float energyInEachChannel[14][16]
MonitorElement * hJetEta
std::vector< CastorRecHit >::const_iterator const_iterator
MonitorElement * h2RHvsSec
MonitorElement * h2RHentriesMap
void Fill(long long x)
void processEventJets(const reco::BasicJetCollection &Jets)
MonitorElement * hJetEnergy
MonitorElement * hJetsMultipl
CastorRecHitMonitor(const edm::ParameterSet &ps)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * hRHtime
MonitorElement * hTowerDepth
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
const_iterator end() const
MonitorElement * hTowerE
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * h2RHoccmap
TH1F * getTH1F(void) const
MonitorElement * hJetPhi
void processEventTowers(const reco::CastorTowerCollection &castorTowers)
MonitorElement * h2TowerEMhad
size_type size() const
double a
Definition: hdecay.h:121
MonitorElement * hallchan
void processEvent(const CastorRecHitCollection &castorHits)
MonitorElement * h2RHchan
TH2F * getTH2F(void) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< CastorTower > CastorTowerCollection
collection of CastorTower objects
Definition: CastorTower.h:126
Definition: vlib.h:208
const_iterator begin() const
Definition: Run.h:42
std::vector< BasicJet > BasicJetCollection
collection of BasicJet objects
MonitorElement * h2RHmap
MonitorElement * hTowerMultipl