CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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
25 
26 #include "TFile.h"
27 #include "TH1.h"
28 #include "TH2.h"
29 #include <fstream>
30 #include <sstream>
31 
36 
37 //
38 // constructors and destructor
39 //
40 namespace cms {
42  usesResource(TFileService::kSharedResource);
43  // get name of output file with histogramms
44  fOutputFileName = iConfig.getUntrackedParameter<std::string>("HistOutFile");
45  // get names of modules, producing object collections
46 
47  tok_hbhe_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInputMB"));
48  tok_ho_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInputMB"));
49  tok_hf_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInputMB"));
50  tok_data_ = consumes<FEDRawDataCollection>(edm::InputTag(iConfig.getParameter<std::string>("InputLabel")));
51 
52  tok_hbheNoise_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInputNoise"));
53  tok_hoNoise_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInputNoise"));
54  tok_hfNoise_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInputNoise"));
55 
56  // this was hardcodded..
57  tok_gtRec_ = consumes<L1GlobalTriggerReadoutRecord>(edm::InputTag("gtDigisAlCaMB"));
58  tok_hbheNorm_ = consumes<HBHERecHitCollection>(edm::InputTag("hbhereco"));
59 
60  tok_respCorr_ = esConsumes<HcalRespCorrs, HcalRespCorrsRcd>();
61  tok_l1gt_ = esConsumes<L1GtTriggerMenu, L1GtTriggerMenuRcd>();
62 
63  theRecalib = iConfig.getParameter<bool>("Recalib");
64 
65  //
66  for (int i = 0; i < 73; i++) {
67  for (int j = 0; j < 43; j++) {
68  noise_min[i][j] = 0.;
69  noise_pl[i][j] = 0.;
70  }
71  }
72  }
73 
75  // do anything here that needs to be done at desctruction time
76  // (e.g. close files, deallocate resources etc.)
77  }
78 
81  edm::LogVerbatim("AnalyzerMB") << " Runnumber " << r.run() << " Nevents " << nevent_run;
82  }
83 
85  myTree = fs->make<TTree>("RecJet", "RecJet Tree");
86  myTree->Branch("mydet", &mydet, "mydet/I");
87  myTree->Branch("mysubd", &mysubd, "mysubd/I");
88  myTree->Branch("depth", &depth, "depth/I");
89  myTree->Branch("ieta", &ieta, "ieta/I");
90  myTree->Branch("iphi", &iphi, "iphi/I");
91  myTree->Branch("eta", &eta, "eta/F");
92  myTree->Branch("phi", &phi, "phi/F");
93 
94  myTree->Branch("mom0_MB", &mom0_MB, "mom0_MB/F");
95  myTree->Branch("mom1_MB", &mom1_MB, "mom1_MB/F");
96  myTree->Branch("mom2_MB", &mom2_MB, "mom2_MB/F");
97  myTree->Branch("mom4_MB", &mom4_MB, "mom4_MB/F");
98 
99  myTree->Branch("mom0_Noise", &mom0_Noise, "mom0_Noise/F");
100  myTree->Branch("mom1_Noise", &mom1_Noise, "mom1_Noise/F");
101  myTree->Branch("mom2_Noise", &mom2_Noise, "mom2_Noise/F");
102  myTree->Branch("mom4_Noise", &mom4_Noise, "mom4_Noise/F");
103 
104  myTree->Branch("mom0_Diff", &mom0_Diff, "mom0_Diff/F");
105  myTree->Branch("mom1_Diff", &mom1_Diff, "mom1_Diff/F");
106  myTree->Branch("mom2_Diff", &mom2_Diff, "mom2_Diff/F");
107 
108  myTree->Branch("occup", &occup, "occup/F");
109 
110  edm::LogVerbatim("AnalyzerMB") << " Before ordering Histos ";
111 
112  char str0[32];
113  char str1[32];
114 
115  char str10[32];
116  char str11[32];
117 
118  int k = 0;
119  nevent = 0;
120  // Size of collections
121 
123  fs->make<TH2F>("hHBHEsize_vs_run", "hHBHEsize_vs_run", 500, 111500., 112000., 6101, -100.5, 6000.5);
124  hHFsize_vs_run = fs->make<TH2F>("hHFsize_vs_run", "hHFsize_vs_run", 500, 111500., 112000., 6101, -100.5, 6000.5);
125 
126  for (int i = 1; i < 73; i++) {
127  for (int j = 1; j < 43; j++) {
128  meannoise_pl[i][j] = 0.;
129  meannoise_min[i][j] = 0.;
130 
131  k = i * 1000 + j;
132  sprintf(str0, "mpl%d", k);
133  sprintf(str1, "mmin%d", k);
134 
135  sprintf(str10, "vpl%d", k);
136  sprintf(str11, "vmin%d", k);
137  if (j < 30) {
138  // first order moment
139  hCalo1[i][j] = fs->make<TH1F>(str0, "h0", 320, -10., 10.);
140  hCalo2[i][j] = fs->make<TH1F>(str1, "h1", 320, -10., 10.);
141 
142  // second order moment
143  hCalo1mom2[i][j] = fs->make<TH1F>(str10, "h10", 320, 0., 20.);
144  hCalo2mom2[i][j] = fs->make<TH1F>(str11, "h11", 320, 0., 20.);
145  } else {
146  // HF
147  // first order moment
148  if (j < 40) {
149  hCalo1[i][j] = fs->make<TH1F>(str0, "h0", 320, -10., 10.);
150  hCalo2[i][j] = fs->make<TH1F>(str1, "h1", 320, -10., 10.);
151  //
152  // second order moment
153  hCalo1mom2[i][j] = fs->make<TH1F>(str10, "h10", 320, 0., 40.);
154  hCalo2mom2[i][j] = fs->make<TH1F>(str11, "h11", 320, 0., 40.);
155  } else {
156  hCalo1[i][j] = fs->make<TH1F>(str0, "h0", 320, -10., 10.);
157  hCalo2[i][j] = fs->make<TH1F>(str1, "h1", 320, -10., 10.);
158 
159  // second order moment
160  hCalo1mom2[i][j] = fs->make<TH1F>(str10, "h10", 320, 0., 120.);
161  hCalo2mom2[i][j] = fs->make<TH1F>(str11, "h11", 320, 0., 120.);
162  }
163  } // HE/HF boundary
164  } // j
165  } // i
166 
167  hbheNoiseE = fs->make<TH1F>("hbheNoiseE", "hbheNoiseE", 320, -10., 10.);
168  hfNoiseE = fs->make<TH1F>("hfNoiseE", "hfNoiseE", 320, -10., 10.);
169  hbheSignalE = fs->make<TH1F>("hbheSignalE", "hbheSignalE", 320, -10., 10.);
170  hfSignalE = fs->make<TH1F>("hfSignalE", "hfSignalE", 320, -10., 10.);
171 
172  edm::LogVerbatim("AnalyzerMB") << " After ordering Histos ";
173 
174  std::string ccc = "noise_0.dat";
175 
176  myout_hcal = new std::ofstream(ccc.c_str());
177  if (!myout_hcal)
178  edm::LogVerbatim("AnalyzerMB") << " Output file not open!!! ";
179 
180  //
181  for (int i = 0; i < 5; i++) {
182  for (int j = 0; j < 5; j++) {
183  for (int k = 0; k < 73; k++) {
184  for (int l = 0; l < 43; l++) {
185  theMBFillDetMapPl0[i][j][k][l] = 0.;
186  theMBFillDetMapPl1[i][j][k][l] = 0.;
187  theMBFillDetMapPl2[i][j][k][l] = 0.;
188  theMBFillDetMapPl4[i][j][k][l] = 0.;
189 
190  theMBFillDetMapMin0[i][j][k][l] = 0.;
191  theMBFillDetMapMin1[i][j][k][l] = 0.;
192  theMBFillDetMapMin2[i][j][k][l] = 0.;
193  theMBFillDetMapMin4[i][j][k][l] = 0.;
194 
195  theNSFillDetMapPl0[i][j][k][l] = 0.;
196  theNSFillDetMapPl1[i][j][k][l] = 0.;
197  theNSFillDetMapPl2[i][j][k][l] = 0.;
198  theNSFillDetMapPl4[i][j][k][l] = 0.;
199 
200  theNSFillDetMapMin0[i][j][k][l] = 0.;
201  theNSFillDetMapMin1[i][j][k][l] = 0.;
202  theNSFillDetMapMin2[i][j][k][l] = 0.;
203  theNSFillDetMapMin4[i][j][k][l] = 0.;
204 
205  theDFFillDetMapPl0[i][j][k][l] = 0.;
206  theDFFillDetMapPl1[i][j][k][l] = 0.;
207  theDFFillDetMapPl2[i][j][k][l] = 0.;
208  theDFFillDetMapMin0[i][j][k][l] = 0.;
209  theDFFillDetMapMin1[i][j][k][l] = 0.;
210  theDFFillDetMapMin2[i][j][k][l] = 0.;
211  }
212  }
213  }
214  }
215 
216  return;
217  }
218  //
219  // EndJob
220  //
222  int ii = 0;
223 
224  for (int i = 1; i < 5; i++) {
225  for (int j = 1; j < 5; j++) {
226  for (int k = 1; k < 73; k++) {
227  for (int l = 1; l < 43; l++) {
228  if (theMBFillDetMapPl0[i][j][k][l] > 0) {
240 
241  mysubd = i;
242  depth = j;
243  ieta = l;
244  iphi = k;
245  edm::LogVerbatim("AnalyzerMB") << " Result Plus= " << mysubd << " " << ieta << " " << iphi << " mom0 "
246  << mom0_MB << " mom1 " << mom1_MB << " mom2 " << mom2_MB;
247  myTree->Fill();
248  ii++;
249  } // Pl > 0
250 
251  if (theMBFillDetMapMin0[i][j][k][l] > 0) {
263 
264  mysubd = i;
265  depth = j;
266  ieta = -1 * l;
267  iphi = k;
268  edm::LogVerbatim("AnalyzerMB") << " Result Minus= " << mysubd << " " << ieta << " " << iphi << " mom0 "
269  << mom0_MB << " mom1 " << mom1_MB << " mom2 " << mom2_MB;
270  myTree->Fill();
271  ii++;
272 
273  } // Min>0
274  } // ieta
275  } // iphi
276  } // depth
277  } //subd
278 
279  edm::LogVerbatim("AnalyzerMB") << " Number of cells " << ii;
280 
281  for (int i = 1; i < 73; i++) {
282  for (int j = 1; j < 43; j++) {
283  hCalo1[i][j]->Write();
284  hCalo2[i][j]->Write();
285  hCalo1mom2[i][j]->Write();
286  hCalo2mom2[i][j]->Write();
287  }
288  }
289 
290  edm::LogVerbatim("AnalyzerMB") << " File is closed ";
291 
292  return;
293  }
294 
295  //
296  // member functions
297  //
298 
299  // ------------ method called to produce the data ------------
301  edm::LogVerbatim("AnalyzerMB") << " Start Analyzer_minbias::analyze " << nevent;
302  nevent++;
303  nevent_run++;
304 
305  float rnnum = (float)iEvent.run();
306 
307  std::vector<edm::StableProvenance const*> theProvenance;
308  iEvent.getAllStableProvenance(theProvenance);
309 
310  for (auto const& provenance : theProvenance) {
311  edm::LogVerbatim("AnalyzerMB") << " Print all process/modulelabel/product names " << provenance->processName()
312  << " , " << provenance->moduleLabel() << " , "
313  << provenance->productInstanceName();
314  }
315  const HcalRespCorrs* myRecalib = nullptr;
316  if (theRecalib) {
317  myRecalib = &iSetup.getData(tok_respCorr_);
318  } // theRecalib
319 
320  // Noise part for HB HE
321 
322  double tmpNSFillDetMapPl1[5][5][73][43];
323  double tmpNSFillDetMapMin1[5][5][73][43];
324 
325  for (int i = 0; i < 5; i++) {
326  for (int j = 0; j < 5; j++) {
327  for (int k = 0; k < 73; k++) {
328  for (int l = 0; l < 43; l++) {
329  tmpNSFillDetMapPl1[i][j][k][l] = 0.;
330  tmpNSFillDetMapMin1[i][j][k][l] = 0.;
331  }
332  }
333  }
334  }
335 
337  iEvent.getByToken(tok_hbheNorm_, hbheNormal);
338  if (!hbheNormal.isValid()) {
339  edm::LogWarning("AnalyzerMB") << " hbheNormal failed ";
340  } else {
341  edm::LogVerbatim("AnalyzerMB") << " The size of the normal collection " << hbheNormal->size();
342  }
343 
345  iEvent.getByToken(tok_hbheNoise_, hbheNS);
346 
347  if (!hbheNS.isValid()) {
348  edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hbhe"
349  << " product! No HBHE MS ";
350  return;
351  }
352 
353  const HBHERecHitCollection HithbheNS = *(hbheNS.product());
354  edm::LogVerbatim("AnalyzerMB") << " HBHE NS size of collection " << HithbheNS.size();
355  hHBHEsize_vs_run->Fill(rnnum, (float)HithbheNS.size());
356 
357  if (HithbheNS.size() != 5184) {
358  edm::LogWarning("AnalyzerMB") << " HBHE problem " << rnnum << " " << HithbheNS.size();
359  }
361  iEvent.getByToken(tok_hbhe_, hbheMB);
362 
363  if (!hbheMB.isValid()) {
364  edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hbhe"
365  << " product! No HBHE MB";
366  }
367 
368  const HBHERecHitCollection HithbheMB = *(hbheMB.product());
369  edm::LogVerbatim("AnalyzerMB") << " HBHE MB size of collection " << HithbheMB.size();
370  if (HithbheMB.size() != 5184) {
371  edm::LogWarning("AnalyzerMB") << " HBHE problem " << rnnum << " " << HithbheMB.size();
372  }
373 
375  iEvent.getByToken(tok_hfNoise_, hfNS);
376 
377  if (!hfNS.isValid()) {
378  edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hf"
379  << " product! No HF NS ";
380  }
381 
382  const HFRecHitCollection HithfNS = *(hfNS.product());
383  edm::LogVerbatim("AnalyzerMB") << " HFE NS size of collection " << HithfNS.size();
384  hHFsize_vs_run->Fill(rnnum, (float)HithfNS.size());
385  if (HithfNS.size() != 1728) {
386  edm::LogWarning("AnalyzerMB") << " HF problem " << rnnum << " " << HithfNS.size();
387  }
388 
390  iEvent.getByToken(tok_hf_, hfMB);
391 
392  if (!hfMB.isValid()) {
393  edm::LogWarning("AnalyzerMB") << "HcalCalibAlgos: Error! can't get hf"
394  << " product! No HF MB";
395  }
396 
397  const HFRecHitCollection HithfMB = *(hfMB.product());
398  edm::LogVerbatim("AnalyzerMB") << " HF MB size of collection " << HithfMB.size();
399  if (HithfMB.size() != 1728) {
400  edm::LogWarning("AnalyzerMB") << " HF problem " << rnnum << " " << HithfMB.size();
401  }
402 
403  for (HBHERecHitCollection::const_iterator hbheItr = HithbheNS.begin(); hbheItr != HithbheNS.end(); hbheItr++) {
404  // Recalibration of energy
405  float icalconst = 1.;
406  DetId mydetid = hbheItr->id().rawId();
407  if (theRecalib)
408  icalconst = myRecalib->getValues(mydetid)->getValue();
409 
410  HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
411 
412  double energyhit = aHit.energy();
413 
414  DetId id = (*hbheItr).detid();
415  HcalDetId hid = HcalDetId(id);
416 
417  int mysu = ((hid).rawId() >> 25) & 0x7;
418  if (hid.ieta() > 0) {
419  theNSFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
420  theNSFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()] + 1.;
421  theNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
422  theNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] + energyhit;
423  theNSFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
424  theNSFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] + pow(energyhit, 2);
425  theNSFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
426  theNSFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()] + pow(energyhit, 4);
427 
428  tmpNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = energyhit;
429 
430  } else {
431  theNSFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
432  theNSFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + 1.;
433  theNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
434  theNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + energyhit;
435  theNSFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
436  theNSFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + pow(energyhit, 2);
437  theNSFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
438  theNSFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + pow(energyhit, 4);
439 
440  tmpNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = energyhit;
441  }
442 
443  if (hid.depth() == 1) {
444  hbheNoiseE->Fill(energyhit);
445 
446  if (energyhit < -2.)
447  edm::LogVerbatim("AnalyzerMB") << " Run " << rnnum << " ieta,iphi " << hid.ieta() << " " << hid.iphi()
448  << energyhit;
449 
450  } // depth=1
451 
452  } // HBHE_NS
453 
454  // Signal part for HB HE
455 
456  for (HBHERecHitCollection::const_iterator hbheItr = HithbheMB.begin(); hbheItr != HithbheMB.end(); hbheItr++) {
457  // Recalibration of energy
458  float icalconst = 1.;
459  DetId mydetid = hbheItr->id().rawId();
460  if (theRecalib)
461  icalconst = myRecalib->getValues(mydetid)->getValue();
462 
463  HBHERecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
464 
465  double energyhit = aHit.energy();
466 
467  DetId id = (*hbheItr).detid();
468  HcalDetId hid = HcalDetId(id);
469 
470  int mysu = ((hid).rawId() >> 25) & 0x7;
471  if (hid.ieta() > 0) {
472  theMBFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()] += 1.;
473  theMBFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] += energyhit;
474  theMBFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] += pow(energyhit, 2);
475  theMBFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()] += pow(energyhit, 4);
476  float mydiff = energyhit - tmpNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()];
477 
478  theDFFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
479  theDFFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] + mydiff;
480  theDFFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
481  theDFFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] + pow(mydiff, 2);
482  } else {
483  theMBFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
484  theMBFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + 1.;
485  theMBFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
486  theMBFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + energyhit;
487  theMBFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
488  theMBFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + pow(energyhit, 2);
489  theMBFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
490  theMBFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + pow(energyhit, 4);
491 
492  float mydiff = energyhit - tmpNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()];
493  theDFFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
494  theDFFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()] + mydiff;
495  theDFFillDetMapMin2[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
496  theDFFillDetMapMin2[mysu][hid.depth()][hid.iphi()][hid.ieta()] + pow(mydiff, 2);
497  }
498 
499  if (hid.depth() == 1) {
500  hbheSignalE->Fill(energyhit);
501 
502  if (hid.ieta() > 0) {
503  hCalo1[hid.iphi()][hid.ieta()]->Fill(energyhit);
504  hCalo1mom2[hid.iphi()][hid.ieta()]->Fill(pow(energyhit, 2));
505  } else {
506  hCalo2[hid.iphi()][abs(hid.ieta())]->Fill(energyhit);
507  hCalo2mom2[hid.iphi()][abs(hid.ieta())]->Fill(pow(energyhit, 2));
508  } // eta><0
509 
510  } // depth=1
511 
512  } // HBHE_MB
513 
514  // HF
515 
516  for (HFRecHitCollection::const_iterator hbheItr = HithfNS.begin(); hbheItr != HithfNS.end(); hbheItr++) {
517  // Recalibration of energy
518  float icalconst = 1.;
519  DetId mydetid = hbheItr->id().rawId();
520  if (theRecalib)
521  icalconst = myRecalib->getValues(mydetid)->getValue();
522 
523  HFRecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
524 
525  double energyhit = aHit.energy();
526  //
527  // Remove PMT hits
528  //
529  DetId id = (*hbheItr).detid();
530  HcalDetId hid = HcalDetId(id);
531 
532  if (fabs(energyhit) > 40.)
533  continue;
534 
535  int mysu = hid.subdetId();
536  if (hid.ieta() > 0) {
537  theNSFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
538  theNSFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()] + 1.;
539  theNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
540  theNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] + energyhit;
541  theNSFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
542  theNSFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] + pow(energyhit, 2);
543  theNSFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
544  theNSFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()] + pow(energyhit, 4);
545 
546  tmpNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = energyhit;
547 
548  } else {
549  theNSFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
550  theNSFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + 1.;
551  theNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
552  theNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + energyhit;
553  theNSFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
554  theNSFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + pow(energyhit, 2);
555  theNSFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
556  theNSFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + pow(energyhit, 4);
557 
558  tmpNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()] = energyhit;
559  }
560 
561  if (hid.depth() == 1) {
562  hfNoiseE->Fill(energyhit);
563 
564  } // depth=1
565 
566  } // HBHE_NS
567 
568  // Signal part for HB HE
569 
570  for (HFRecHitCollection::const_iterator hbheItr = HithfMB.begin(); hbheItr != HithfMB.end(); hbheItr++) {
571  // Recalibration of energy
572  float icalconst = 1.;
573  DetId mydetid = hbheItr->id().rawId();
574  if (theRecalib)
575  icalconst = myRecalib->getValues(mydetid)->getValue();
576 
577  HFRecHit aHit(hbheItr->id(), hbheItr->energy() * icalconst, hbheItr->time());
578 
579  double energyhit = aHit.energy();
580  //
581  // Remove PMT hits
582  //
583  if (fabs(energyhit) > 40.)
584  continue;
585 
586  DetId id = (*hbheItr).detid();
587  HcalDetId hid = HcalDetId(id);
588 
589  int mysu = ((hid).rawId() >> 25) & 0x7;
590  if (hid.ieta() > 0) {
591  theMBFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
592  theMBFillDetMapPl0[mysu][hid.depth()][hid.iphi()][hid.ieta()] + 1.;
593  theMBFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
594  theMBFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] + energyhit;
595  theMBFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
596  theMBFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] + pow(energyhit, 2);
597  theMBFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
598  theMBFillDetMapPl4[mysu][hid.depth()][hid.iphi()][hid.ieta()] + pow(energyhit, 4);
599 
600  theDFFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
601  theDFFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()] + energyhit -
602  tmpNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()];
603  theDFFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
604  theDFFillDetMapPl2[mysu][hid.depth()][hid.iphi()][hid.ieta()] +
605  pow((energyhit - tmpNSFillDetMapPl1[mysu][hid.depth()][hid.iphi()][hid.ieta()]), 2);
606  } else {
607  theMBFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
608  theMBFillDetMapMin0[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + 1.;
609  theMBFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
610  theMBFillDetMapMin1[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + energyhit;
611  theMBFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
612  theMBFillDetMapMin2[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + pow(energyhit, 2);
613  theMBFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] =
614  theMBFillDetMapMin4[mysu][hid.depth()][hid.iphi()][abs(hid.ieta())] + pow(energyhit, 4);
615 
616  theDFFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
617  theDFFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()] + energyhit -
618  tmpNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()];
619  theDFFillDetMapMin2[mysu][hid.depth()][hid.iphi()][hid.ieta()] =
620  theDFFillDetMapMin2[mysu][hid.depth()][hid.iphi()][hid.ieta()] +
621  pow((energyhit - tmpNSFillDetMapMin1[mysu][hid.depth()][hid.iphi()][hid.ieta()]), 2);
622  }
623 
624  if (hid.depth() == 1) {
625  hfSignalE->Fill(energyhit);
626 
627  if (hid.ieta() > 0) {
628  hCalo1[hid.iphi()][hid.ieta()]->Fill(energyhit);
629  hCalo1mom2[hid.iphi()][hid.ieta()]->Fill(pow(energyhit, 2));
630  } else {
631  hCalo2[hid.iphi()][abs(hid.ieta())]->Fill(energyhit);
632  hCalo2mom2[hid.iphi()][abs(hid.ieta())]->Fill(pow(energyhit, 2));
633  } // eta><0
634 
635  } // depth=1
636 
637  } // HF_MB
638 
639  edm::LogVerbatim("AnalyzerMB") << " Event is finished ";
640  }
641 } // namespace cms
642 
644 
646 
constexpr float energy() const
Definition: CaloRecHit.h:29
static const std::string kSharedResource
Definition: TFileService.h:76
double theMBFillDetMapMin0[5][5][73][43]
double theMBFillDetMapMin2[5][5][73][43]
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
double theDFFillDetMapPl2[5][5][73][43]
double theMBFillDetMapMin1[5][5][73][43]
edm::Service< TFileService > fs
RunNumber_t run() const
Definition: RunBase.h:40
double theNSFillDetMapPl4[5][5][73][43]
void analyze(edm::Event const &, edm::EventSetup const &) override
double theNSFillDetMapPl0[5][5][73][43]
double theNSFillDetMapMin0[5][5][73][43]
double theMBFillDetMapPl0[5][5][73][43]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TH1F * hCalo2mom2[73][43]
edm::EDGetTokenT< HORecHitCollection > tok_hoNoise_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< T >::const_iterator const_iterator
double theDFFillDetMapPl1[5][5][73][43]
std::ofstream * myout_hcal
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > tok_gtRec_
const Item * getValues(DetId fId, bool throwOnFail=true) const
double meannoise_pl[73][43]
int ii
Definition: cuy.py:589
edm::EDGetTokenT< HBHERecHitCollection > tok_hbheNoise_
double theNSFillDetMapPl2[5][5][73][43]
double theDFFillDetMapMin2[5][5][73][43]
double noise_min[73][43]
TH1F * hCalo1mom2[73][43]
edm::EDGetTokenT< HFRecHitCollection > tok_hfNoise_
double theNSFillDetMapPl1[5][5][73][43]
bool getData(T &iHolder) const
Definition: EventSetup.h:128
double theMBFillDetMapPl1[5][5][73][43]
Analyzer_minbias(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:224
void beginRun(edm::Run const &, edm::EventSetup const &) override
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_respCorr_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
double theDFFillDetMapPl0[5][5][73][43]
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
RunNumber_t run() const
Definition: Event.h:109
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
double theMBFillDetMapPl4[5][5][73][43]
double theNSFillDetMapMin1[5][5][73][43]
double theNSFillDetMapMin4[5][5][73][43]
bool isValid() const
Definition: HandleBase.h:70
double theDFFillDetMapMin0[5][5][73][43]
void endRun(edm::Run const &, edm::EventSetup const &) override
double theMBFillDetMapPl2[5][5][73][43]
edm::EDGetTokenT< HBHERecHitCollection > tok_hbheNorm_
const_iterator end() const
void beginJob() override
Definition: DetId.h:17
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< FEDRawDataCollection > tok_data_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
double theMBFillDetMapMin4[5][5][73][43]
double meannoise_min[73][43]
float getValue() const
Definition: HcalRespCorr.h:19
size_type size() const
edm::EDGetTokenT< HORecHitCollection > tok_ho_
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
Log< level::Warning, false > LogWarning
edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > tok_l1gt_
double theNSFillDetMapMin2[5][5][73][43]
double theDFFillDetMapMin1[5][5][73][43]
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
const_iterator begin() const
Definition: Run.h:45
void getAllStableProvenance(std::vector< StableProvenance const * > &provenances) const
Definition: Event.cc:136