CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Analyzer_minbias.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 #include <string>
4 #include <iostream>
5 
6 // user include files
20 
21 #include "TFile.h"
22 #include "TH1.h"
23 #include "TH2.h"
24 #include <fstream>
25 #include <sstream>
26 
31 using namespace std;
32 using namespace reco;
33 //
34 // constructors and destructor
35 //
36 namespace cms{
37 Analyzer_minbias::Analyzer_minbias(const edm::ParameterSet& iConfig)
38 {
39  // get name of output file with histogramms
40  fOutputFileName = iConfig.getUntrackedParameter<string>("HistOutFile");
41  // get names of modules, producing object collections
42 
43  tok_hbhe_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInputMB"));
44  tok_ho_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInputMB"));
45  tok_hf_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInputMB"));
46 
47  tok_hbheNoise_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInputNoise"));
48  tok_hoNoise_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInputNoise"));
49  tok_hfNoise_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInputNoise"));
50 
51  // this was hardcodded..
52  tok_gtRec_ = consumes<L1GlobalTriggerReadoutRecord>(edm::InputTag("gtDigisAlCaMB"));
53  tok_hbheNorm_ = consumes<HBHERecHitCollection>(edm::InputTag("hbhereco"));
54 
55  theRecalib = iConfig.getParameter<bool>("Recalib");
56 
57 //
58 //
59  for(int i=0; i<73; i++)
60  {
61  for(int j=0; j<43; j++)
62  {
63  noise_min[i][j] = 0.;
64  noise_pl[i][j] = 0.;
65  }
66  }
67 //
68 //
69 
70 }
71 
72 Analyzer_minbias::~Analyzer_minbias()
73 {
74 
75  // do anything here that needs to be done at desctruction time
76  // (e.g. close files, deallocate resources etc.)
77 
78 }
79 
80 void Analyzer_minbias::beginRun( const edm::Run& r, const edm::EventSetup& iSetup)
81 {
82  nevent_run = 0;
83 }
84 void Analyzer_minbias::endRun( const edm::Run& r, const edm::EventSetup& iSetup)
85 {
86  std::cout<<" Runnumber "<<r.run()<<" Nevents "<<nevent_run<<std::endl;
87 }
88 
90 {
91 
92  hOutputFile = new TFile( fOutputFileName.c_str(), "RECREATE" ) ;
93 
94  myTree = new TTree("RecJet","RecJet Tree");
95  myTree->Branch("mydet", &mydet, "mydet/I");
96  myTree->Branch("mysubd", &mysubd, "mysubd/I");
97  myTree->Branch("depth", &depth, "depth/I");
98  myTree->Branch("ieta", &ieta, "ieta/I");
99  myTree->Branch("iphi", &iphi, "iphi/I");
100  myTree->Branch("eta", &eta, "eta/F");
101  myTree->Branch("phi", &phi, "phi/F");
102 
103  myTree->Branch("mom0_MB", &mom0_MB, "mom0_MB/F");
104  myTree->Branch("mom1_MB", &mom1_MB, "mom1_MB/F");
105  myTree->Branch("mom2_MB", &mom2_MB, "mom2_MB/F");
106  myTree->Branch("mom4_MB", &mom4_MB, "mom4_MB/F");
107 
108  myTree->Branch("mom0_Noise", &mom0_Noise, "mom0_Noise/F");
109  myTree->Branch("mom1_Noise", &mom1_Noise, "mom1_Noise/F");
110  myTree->Branch("mom2_Noise", &mom2_Noise, "mom2_Noise/F");
111  myTree->Branch("mom4_Noise", &mom4_Noise, "mom4_Noise/F");
112 
113  myTree->Branch("mom0_Diff", &mom0_Diff, "mom0_Diff/F");
114  myTree->Branch("mom1_Diff", &mom1_Diff, "mom1_Diff/F");
115  myTree->Branch("mom2_Diff", &mom2_Diff, "mom2_Diff/F");
116 
117  myTree->Branch("occup", &occup, "occup/F");
118 
119  std::cout<<" Before ordering Histos "<<std::endl;
120 
121  char str0[15];
122  char str1[15];
123 
124  char str10[15];
125  char str11[15];
126 
127  int k=0;
128  nevent = 0;
129 // Size of collections
130 
131  hHBHEsize_vs_run = new TH2F("hHBHEsize_vs_run","hHBHEsize_vs_run",500,111500.,112000.,6101,-100.5,6000.5);
132  hHFsize_vs_run = new TH2F("hHFsize_vs_run","hHFsize_vs_run",500,111500.,112000.,6101,-100.5,6000.5);
133 
134  for(int i=1;i<73;i++){
135  for(int j=1;j<43;j++){
136 
137  meannoise_pl[i][j] = 0.;
138  meannoise_min[i][j] = 0.;
139 
140 // for(int l=1;l<5;l++){
141  k = i*1000+j;
142  sprintf(str0,"mpl%d",k);
143  sprintf(str1,"mmin%d",k);
144 
145  sprintf(str10,"vpl%d",k);
146  sprintf(str11,"vmin%d",k);
147 // cout<<" "<<i<<" "<<j<<endl;
148  if( j < 30 )
149  {
150 // first order moment
151  hCalo1[i][j] = new TH1F(str0, "h0", 320, -10., 10.);
152  hCalo2[i][j] = new TH1F(str1, "h1", 320, -10., 10.);
153 
154 // second order moment
155  hCalo1mom2[i][j] = new TH1F(str10, "h10", 320, 0., 20.);
156  hCalo2mom2[i][j] = new TH1F(str11, "h11", 320, 0., 20.);
157  }
158  else
159  {
160 // HF
161 // first order moment
162 // cout<<" "<<i<<" "<<j<<" "<<k<<endl;
163  if(j < 40)
164  {
165  hCalo1[i][j] = new TH1F(str0, "h0", 320, -10., 10.);
166  hCalo2[i][j] = new TH1F(str1, "h1", 320, -10., 10.);
167 //
168 // second order moment
169  hCalo1mom2[i][j] = new TH1F(str10, "h10", 320, 0., 40.);
170  hCalo2mom2[i][j] = new TH1F(str11, "h11", 320, 0., 40.);
171  }
172  else
173  {
174  hCalo1[i][j] = new TH1F(str0,"h0" , 320, -10., 10.);
175  hCalo2[i][j] = new TH1F(str1, "h1", 320, -10., 10.);
176 
177 // second order moment
178  hCalo1mom2[i][j] = new TH1F(str10, "h10", 320, 0., 120.);
179  hCalo2mom2[i][j] = new TH1F(str11, "h11", 320, 0., 120.);
180 
181  }
182  } // HE/HF boundary
183 // } // l
184  } // j
185  } // i
186 
187 
188  hbheNoiseE = new TH1F("hbheNoiseE","hbheNoiseE", 320, -10., 10.);
189  hfNoiseE = new TH1F("hfNoiseE","hfNoiseE", 320, -10., 10.);
190  hbheSignalE = new TH1F("hbheSignalE","hbheSignalE", 320, -10., 10.);
191  hfSignalE = new TH1F("hfSignalE","hfSignalE", 320, -10., 10.);
192 
193 
194  std::cout<<" After ordering Histos "<<std::endl;
195 
196  std::string ccc = "noise_0.dat";
197 
198  myout_hcal = new std::ofstream(ccc.c_str());
199  if(!myout_hcal) cout << " Output file not open!!! "<<endl;
200 
201 //
202  for (int i=0; i<5;i++)
203  {
204  for (int j=0; j<5;j++)
205  {
206  for (int k=0; k<73;k++)
207  {
208  for (int l=0; l<43;l++)
209  {
210  theMBFillDetMapPl0[i][j][k][l] = 0.;
211  theMBFillDetMapPl1[i][j][k][l] = 0.;
212  theMBFillDetMapPl2[i][j][k][l] = 0.;
213  theMBFillDetMapPl4[i][j][k][l] = 0.;
214 
215  theMBFillDetMapMin0[i][j][k][l] = 0.;
216  theMBFillDetMapMin1[i][j][k][l] = 0.;
217  theMBFillDetMapMin2[i][j][k][l] = 0.;
218  theMBFillDetMapMin4[i][j][k][l] = 0.;
219 
220 
221  theNSFillDetMapPl0[i][j][k][l] = 0.;
222  theNSFillDetMapPl1[i][j][k][l] = 0.;
223  theNSFillDetMapPl2[i][j][k][l] = 0.;
224  theNSFillDetMapPl4[i][j][k][l] = 0.;
225 
226  theNSFillDetMapMin0[i][j][k][l] = 0.;
227  theNSFillDetMapMin1[i][j][k][l] = 0.;
228  theNSFillDetMapMin2[i][j][k][l] = 0.;
229  theNSFillDetMapMin4[i][j][k][l] = 0.;
230 
231  theDFFillDetMapPl0[i][j][k][l] = 0.;
232  theDFFillDetMapPl1[i][j][k][l] = 0.;
233  theDFFillDetMapPl2[i][j][k][l] = 0.;
234  theDFFillDetMapMin0[i][j][k][l] = 0.;
235  theDFFillDetMapMin1[i][j][k][l] = 0.;
236  theDFFillDetMapMin2[i][j][k][l] = 0.;
237  }
238  }
239  }
240  }
241 
242  return ;
243 }
244 //
245 // EndJob
246 //
247 void Analyzer_minbias::endJob()
248 {
249  int ii=0;
250 
251  for (int i=1; i<5;i++)
252  {
253  for (int j=1; j<5;j++)
254  {
255  for (int k=1; k<73;k++)
256  {
257  for (int l=1; l<43;l++)
258  {
259  if(theMBFillDetMapPl0[i][j][k][l] > 0)
260  {
261  mom0_MB = theMBFillDetMapPl0[i][j][k][l];
262  mom1_MB = theMBFillDetMapPl1[i][j][k][l];
263  mom2_MB = theMBFillDetMapPl2[i][j][k][l];
264  mom4_MB = theMBFillDetMapPl4[i][j][k][l];
265  mom0_Noise = theNSFillDetMapPl0[i][j][k][l];
266  mom1_Noise = theNSFillDetMapPl1[i][j][k][l];
267  mom2_Noise = theNSFillDetMapPl2[i][j][k][l];
268  mom4_Noise = theNSFillDetMapPl4[i][j][k][l];
269  mom0_Diff = theDFFillDetMapPl0[i][j][k][l];
270  mom1_Diff = theDFFillDetMapPl1[i][j][k][l];
271  mom2_Diff = theDFFillDetMapPl2[i][j][k][l];
272 
273  mysubd = i;
274  depth = j;
275  ieta = l;
276  iphi = k;
277  cout<<" Result Plus= "<<mysubd<<" "<<ieta<<" "<<iphi<<" mom0 "<<mom0_MB<<" mom1 "<<mom1_MB<<" mom2 "<<mom2_MB<<endl;
278  myTree->Fill();
279  ii++;
280  } // Pl > 0
281 
282 
283  if(theMBFillDetMapMin0[i][j][k][l] > 0)
284  {
285  mom0_MB = theMBFillDetMapMin0[i][j][k][l];
286  mom1_MB = theMBFillDetMapMin1[i][j][k][l];
287  mom2_MB = theMBFillDetMapMin2[i][j][k][l];
288  mom4_MB = theMBFillDetMapMin4[i][j][k][l];
289  mom0_Noise = theNSFillDetMapMin0[i][j][k][l];
290  mom1_Noise = theNSFillDetMapMin1[i][j][k][l];
291  mom2_Noise = theNSFillDetMapMin2[i][j][k][l];
292  mom4_Noise = theNSFillDetMapMin4[i][j][k][l];
293  mom0_Diff = theDFFillDetMapMin0[i][j][k][l];
294  mom1_Diff = theDFFillDetMapMin1[i][j][k][l];
295  mom2_Diff = theDFFillDetMapMin2[i][j][k][l];
296 
297 
298  mysubd = i;
299  depth = j;
300  ieta = -1*l;
301  iphi = k;
302  cout<<" Result Minus= "<<mysubd<<" "<<ieta<<" "<<iphi<<" mom0 "<<mom0_MB<<" mom1 "<<mom1_MB<<" mom2 "<<mom2_MB<<endl;
303  myTree->Fill();
304  ii++;
305 
306  } // Min>0
307  } // ieta
308  } // iphi
309  } // depth
310  } //subd
311 
312 
313 
314  cout<<" Number of cells "<<ii<<endl;
315 
316  hOutputFile->Write();
317 
318  hOutputFile->cd();
319 
320  myTree->Write();
321 
322  hHBHEsize_vs_run->Write() ;
323  hHFsize_vs_run->Write() ;
324 
325  for(int i=1;i<73;i++){
326  for(int j=1;j<43;j++){
327  hCalo1[i][j]->Write();
328  hCalo2[i][j]->Write();
329  hCalo1mom2[i][j]->Write();
330  hCalo2mom2[i][j]->Write();
331  }
332  }
333 
334  hbheNoiseE->Write() ;
335  hfNoiseE->Write() ;
336  hbheSignalE->Write() ;
337  hfSignalE->Write() ;
338 
339 
340  hOutputFile->Close() ;
341 
342  cout<<" File is closed "<<endl;
343 
344  return ;
345 }
346 
347 
348 //
349 // member functions
350 //
351 
352 // ------------ method called to produce the data ------------
353 void
355 {
356 
357  std::cout<<" Start Analyzer_minbias::analyze "<<nevent<<std::endl;
358  nevent++;
359  nevent_run++;
360  using namespace edm;
361 
362  float rnnum = (float)iEvent.run();
363 /*
364  std::vector<Provenance const*> theProvenance;
365  iEvent.getAllProvenance(theProvenance);
366 
367  for( std::vector<Provenance const*>::const_iterator ip = theProvenance.begin();
368  ip != theProvenance.end(); ip++)
369  {
370  cout<<" Print all module/label names "<<(**ip).moduleName()<<" "<<(**ip).moduleLabel()<<
371  " "<<(**ip).productInstanceName()<<endl;
372  }
373 */
374 
376  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd) ;
377  const L1GtTriggerMenu* menu = menuRcd.product();
378  const AlgorithmMap& bitMap = menu->gtAlgorithmMap();
379 
381  iEvent.getByToken(tok_gtRec_, gtRecord);
382 
383  if (!gtRecord.isValid()) {
384 
385 // LogDebug("L1GlobalTriggerRecordProducer")
386 // << "\n\n Error: no L1GlobalTriggerReadoutRecord found with input tag "
387 // << m_l1GtReadoutRecord
388 // << "\n Returning empty L1GlobalTriggerRecord.\n\n"
389 // << std::endl;
390  cout<<" No L1 trigger record "<<endl;
391  } else {
392 
393  const DecisionWord dWord = gtRecord->decisionWord();
394 
395  for (CItAlgo itAlgo = bitMap.begin(); itAlgo != bitMap.end(); itAlgo++)
396  {
397  bool decision=menu->gtAlgorithmResult(itAlgo->first,dWord);
398  if(decision == 1) std::cout<<" Trigger "<<itAlgo->first<<" "<<decision<<std::endl;
399  }
400 
401  }
402 
403  const HcalRespCorrs* myRecalib=0;
404  if( theRecalib ) {
405 // Radek:
406  edm::ESHandle <HcalRespCorrs> recalibCorrs;
407  iSetup.get<HcalRespCorrsRcd>().get("recalibrate",recalibCorrs);
408  myRecalib = recalibCorrs.product();
409 // end
410  } // theRecalib
411 
412 // Noise part for HB HE
413 
414  double tmpNSFillDetMapPl1[5][5][73][43];
415  double tmpNSFillDetMapMin1[5][5][73][43];
416 
417  for (int i=0; i<5;i++)
418  {
419  for (int j=0; j<5;j++)
420  {
421  for (int k=0; k<73;k++)
422  {
423  for (int l=0; l<43;l++)
424  {
425  tmpNSFillDetMapPl1[i][j][k][l] = 0.;
426  tmpNSFillDetMapMin1[i][j][k][l] = 0.;
427  }
428  }
429  }
430  }
432  iEvent.getByToken(tok_hbheNorm_, hbheNormal);
433  if(!hbheNormal.isValid()){
434  cout<<" hbheNormal failed "<<endl;
435  } else {
436  cout<<" The size of the normal collection "<<hbheNormal->size()<<endl;
437  }
438 
439 
441  iEvent.getByToken(tok_hbheNoise_, hbheNS);
442 
443 
444  if(!hbheNS.isValid()){
445  LogDebug("") << "HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
446  cout<<" No HBHE MS "<<endl;
447  return ;
448  }
449 
450 
451  const HBHERecHitCollection HithbheNS = *(hbheNS.product());
452  cout<<" HBHE NS size of collection "<<HithbheNS.size()<<endl;
453  hHBHEsize_vs_run->Fill(rnnum,(float)HithbheNS.size());
454 
455  if(HithbheNS.size()!= 5184) {
456  cout<<" HBHE problem "<<rnnum<<" "<<HithbheNS.size()<<endl;
457  return;
458  }
460  iEvent.getByToken(tok_hbhe_, hbheMB);
461 
462  if(!hbheMB.isValid()){
463  LogDebug("") << "HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
464  cout<<" No HBHE MB"<<endl;
465  return ;
466  }
467 
468  const HBHERecHitCollection HithbheMB = *(hbheMB.product());
469  cout<<" HBHE MB size of collection "<<HithbheMB.size()<<endl;
470  if(HithbheMB.size()!= 5184) {
471  cout<<" HBHE problem "<<rnnum<<" "<<HithbheMB.size()<<endl;
472  return;
473  }
474 
476  iEvent.getByToken(tok_hfNoise_, hfNS);
477 
478  if(!hfNS.isValid()){
479  LogDebug("") << "HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
480  cout<<" No HF NS "<<endl;
481  return ;
482  }
483 
484  const HFRecHitCollection HithfNS = *(hfNS.product());
485  cout<<" HFE NS size of collection "<<HithfNS.size()<<endl;
486  hHFsize_vs_run->Fill(rnnum,(float)HithfNS.size());
487  if(HithfNS.size()!= 1728) {
488  cout<<" HF problem "<<rnnum<<" "<<HithfNS.size()<<endl;
489  return;
490  }
491 
493  iEvent.getByToken(tok_hf_, hfMB);
494 
495  if(!hfMB.isValid()){
496  LogDebug("") << "HcalCalibAlgos: Error! can't get hbhe product!" << std::endl;
497  cout<<" No HBHE MB"<<endl;
498  return ;
499  }
500 
501  const HFRecHitCollection HithfMB = *(hfMB.product());
502  cout<<" HF MB size of collection "<<HithfMB.size()<<endl;
503  if(HithfMB.size()!= 1728) {
504  cout<<" HF problem "<<rnnum<<" "<<HithfMB.size()<<endl;
505  return;
506  }
507 
508 
509 
510  for(HBHERecHitCollection::const_iterator hbheItr=HithbheNS.begin(); hbheItr!=HithbheNS.end(); hbheItr++)
511  {
512 // Recalibration of energy
513  float icalconst=1.;
514  DetId mydetid = hbheItr->id().rawId();
515  if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
516 
517  HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
518 
519  double energyhit = aHit.energy();
520 
521  DetId id = (*hbheItr).detid();
522  HcalDetId hid=HcalDetId(id);
523 
524 
525 
526  int mysu = ((hid).rawId()>>25)&0x7;
527  if( hid.ieta() > 0 ) {
528  theNSFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theNSFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()]+ 1.;
529  theNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()]+energyhit;
530  theNSFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theNSFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow(energyhit,2);
531  theNSFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theNSFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow(energyhit,4);
532 
533  tmpNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = energyhit;
534 
535 
536  } else {
537  theNSFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theNSFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+ 1.;
538  theNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+energyhit;
539  theNSFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theNSFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+pow(energyhit,2);
540  theNSFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theNSFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+pow(energyhit,4);
541 
542 
543  tmpNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = energyhit;
544 
545  }
546 
547  if(hid.depth() == 1) {
548  hbheNoiseE->Fill(energyhit);
549 
550  if(energyhit<-2.) std::cout<<" Run "<<rnnum<<" ieta,iphi "<<hid.ieta()<<" "<<hid.iphi()<<energyhit<<std::endl;
551 
552  // if( hid.ieta() > 0 ) {
553  // hCalo1[hid.iphi()][hid.ieta()]->Fill(energyhit-noise_pl[hid.iphi()][hid.ieta()]);
554  // hCalo1mom2[hid.iphi()][hid.ieta()]->Fill(pow(energyhit,2));
555  // } else {
556  // hCalo2[hid.iphi()][abs(hid.ieta())]->Fill(energyhit-noise_min[hid.iphi()][abs(hid.ieta())]);
557  // hCalo2mom2[hid.iphi()][abs(hid.ieta())]->Fill(pow(energyhit,2));
558  // } // eta><0
559 
560  } // depth=1
561 
562 
563  } // HBHE_NS
564 
565 
566 // Signal part for HB HE
567 
568 
569  for(HBHERecHitCollection::const_iterator hbheItr=HithbheMB.begin(); hbheItr!=HithbheMB.end(); hbheItr++)
570  {
571 // Recalibration of energy
572  float icalconst=1.;
573  DetId mydetid = hbheItr->id().rawId();
574  if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
575 
576  HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
577 
578  double energyhit = aHit.energy();
579 
580  DetId id = (*hbheItr).detid();
581  HcalDetId hid=HcalDetId(id);
582 
583  int mysu = ((hid).rawId()>>25)&0x7;
584  if( hid.ieta() > 0 ) {
585  theMBFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theMBFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()]+ 1.;
586  theMBFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theMBFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()]+energyhit;
587  theMBFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theMBFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow(energyhit,2);
588  theMBFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theMBFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow(energyhit,4);
589  float mydiff = energyhit - tmpNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()];
590 
591 
592  theDFFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theDFFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()]+mydiff;
593  theDFFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theDFFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow(mydiff,2);
594  } else {
595  theMBFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theMBFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+ 1.;
596  theMBFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theMBFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+energyhit;
597  theMBFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theMBFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+pow(energyhit,2);
598  theMBFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theMBFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+pow(energyhit,4);
599 
600 
601  float mydiff = energyhit - tmpNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()];
602  theDFFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theDFFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()]+mydiff;
603  theDFFillDetMapMin2[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theDFFillDetMapMin2[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow(mydiff,2);
604  }
605 
606 
607  if(hid.depth() == 1) {
608 
609  hbheSignalE->Fill(energyhit);
610 
611  if( hid.ieta() > 0 ) {
612  hCalo1[hid.iphi()][hid.ieta()]->Fill(energyhit);
613  hCalo1mom2[hid.iphi()][hid.ieta()]->Fill(pow(energyhit,2));
614  } else {
615  hCalo2[hid.iphi()][abs(hid.ieta())]->Fill(energyhit);
616  hCalo2mom2[hid.iphi()][abs(hid.ieta())]->Fill(pow(energyhit,2));
617  } // eta><0
618 
619  } // depth=1
620 
621 
622  } // HBHE_MB
623 
624 // HF
625 
626  for(HFRecHitCollection::const_iterator hbheItr=HithfNS.begin(); hbheItr!=HithfNS.end(); hbheItr++)
627  {
628 // Recalibration of energy
629  float icalconst=1.;
630  DetId mydetid = hbheItr->id().rawId();
631  if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
632 
633  HFRecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
634 
635  double energyhit = aHit.energy();
636 //
637 // Remove PMT hits
638 //
639  if(fabs(energyhit) > 40. ) continue;
640 
641  DetId id = (*hbheItr).detid();
642  HcalDetId hid=HcalDetId(id);
643 
644  int mysu = ((hid).rawId()>>25)&0x7;
645  if( hid.ieta() > 0 ) {
646  theNSFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theNSFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()]+ 1.;
647  theNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()]+energyhit;
648  theNSFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theNSFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow(energyhit,2);
649  theNSFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theNSFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow(energyhit,4);
650 
651  tmpNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = energyhit;
652 
653 
654  } else {
655  theNSFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theNSFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+ 1.;
656  theNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+energyhit;
657  theNSFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theNSFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+pow(energyhit,2);
658  theNSFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theNSFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+pow(energyhit,4);
659 
660 
661  tmpNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = energyhit;
662 
663  }
664 
665  if(hid.depth() == 1) {
666  hfNoiseE->Fill(energyhit);
667 
668  //if( hid.ieta() > 0 ) {
669  // hCalo1[hid.iphi()][hid.ieta()]->Fill(energyhit-noise_pl[hid.iphi()][hid.ieta()]);
670  // hCalo1mom2[hid.iphi()][hid.ieta()]->Fill(pow(energyhit,2));
671  //} else {
672  // hCalo2[hid.iphi()][abs(hid.ieta())]->Fill(energyhit-noise_min[hid.iphi()][abs(hid.ieta())]);
673  // hCalo2mom2[hid.iphi()][abs(hid.ieta())]->Fill(pow(energyhit,2));
674  //} // eta><0
675 
676  } // depth=1
677 
678  } // HBHE_NS
679 
680 
681 // Signal part for HB HE
682 
683  for(HFRecHitCollection::const_iterator hbheItr=HithfMB.begin(); hbheItr!=HithfMB.end(); hbheItr++)
684  {
685 // Recalibration of energy
686  float icalconst=1.;
687  DetId mydetid = hbheItr->id().rawId();
688  if( theRecalib ) icalconst=myRecalib->getValues(mydetid)->getValue();
689 
690  HFRecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
691 
692  double energyhit = aHit.energy();
693 //
694 // Remove PMT hits
695 //
696  if(fabs(energyhit) > 40. ) continue;
697 
698  DetId id = (*hbheItr).detid();
699  HcalDetId hid=HcalDetId(id);
700 
701  int mysu = ((hid).rawId()>>25)&0x7;
702  if( hid.ieta() > 0 ) {
703  theMBFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theMBFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()]+ 1.;
704  theMBFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theMBFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()]+energyhit;
705  theMBFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theMBFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow(energyhit,2);
706  theMBFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theMBFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow(energyhit,4);
707 
708 
709  theDFFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theDFFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()]+energyhit-tmpNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()];
710  theDFFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
711  theDFFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow((energyhit-tmpNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()]),2);
712  } else {
713  theMBFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theMBFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+ 1.;
714  theMBFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theMBFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+energyhit;
715  theMBFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theMBFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+pow(energyhit,2);
716  theMBFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] = theMBFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())]+pow(energyhit,4);
717 
718  theDFFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = theDFFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()]+energyhit-tmpNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()];
719  theDFFillDetMapMin2[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
720  theDFFillDetMapMin2[mysu][hid.depth()][hid.iphi()][hid.ieta()]+pow((energyhit-tmpNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()]),2);
721  }
722 
723 
724  if(hid.depth() == 1) {
725  hfSignalE->Fill(energyhit);
726 
727  if( hid.ieta() > 0 )
728  {
729  hCalo1[hid.iphi()][hid.ieta()]->Fill(energyhit);
730  hCalo1mom2[hid.iphi()][hid.ieta()]->Fill(pow(energyhit,2));
731  } else
732  {
733  hCalo2[hid.iphi()][abs(hid.ieta())]->Fill(energyhit);
734  hCalo2mom2[hid.iphi()][abs(hid.ieta())]->Fill(pow(energyhit,2));
735  } // eta><0
736 
737  } // depth=1
738 
739  } // HF_MB
740 
741  std::cout<<" Event is finished "<<std::endl;
742 }
743 }
744 //define this as a plug-in
745 //DEFINE_ANOTHER_FWK_MODULE(Analyzer_minbias)
746 
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
RunNumber_t run() const
Definition: RunBase.h:42
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
std::vector< HBHERecHit >::const_iterator const_iterator
T eta() const
int ii
Definition: cuy.py:588
void beginJob()
Definition: Breakpoints.cc:15
return((rh^lh)&mask)
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int nevent
Definition: AMPTWrapper.h:74
int depth() const
get the tower depth
Definition: HcalDetId.h:40
int iEvent
Definition: GenABIO.cc:230
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::vector< bool > DecisionWord
typedefs
float energy() const
Definition: CaloRecHit.h:17
int ieta() const
get the cell ieta
Definition: HcalDetId.h:36
RunNumber_t run() const
Definition: Event.h:85
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
int iphi() const
get the cell iphi
Definition: HcalDetId.h:38
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
tuple cout
Definition: gather_cfg.py:121
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
Definition: Run.h:41
Definition: DDAxes.h:10