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