CMS 3D CMS Logo

EcalSimHitsValidProducer.cc
Go to the documentation of this file.
4 
11 
12 #include "G4PrimaryParticle.hh"
13 #include "G4PrimaryVertex.hh"
14 #include "G4SDManager.hh"
15 #include "G4Step.hh"
16 
17 #include <iostream>
18 
20  : ee1(0.0),
21  ee4(0.0),
22  ee9(0.0),
23  ee16(0.0),
24  ee25(0.0),
25  eb1(0.0),
26  eb4(0.0),
27  eb9(0.0),
28  eb16(0.0),
29  eb25(0.0),
30  totalEInEE(0.0),
31  totalEInEB(0),
32  totalEInES(0.0),
33  totalEInEEzp(0.0),
34  totalEInEEzm(0.0),
35  totalEInESzp(0.0),
36  totalEInESzm(0.0),
37  totalHits(0),
38  nHitsInEE(0),
39  nHitsInEB(0),
40  nHitsInES(0),
41  nHitsIn1ES(0),
42  nHitsIn2ES(0),
43  nCrystalInEB(0),
44  nCrystalInEEzp(0),
45  nCrystalInEEzm(0),
46  nHitsIn1ESzp(0),
47  nHitsIn1ESzm(0),
48  nHitsIn2ESzp(0),
49  nHitsIn2ESzm(0),
50  thePID(0),
51  label(iPSet.getUntrackedParameter<std::string>("instanceLabel", "EcalValidInfo")) {
52  produces<PEcalValidInfo>(label);
53 
54  for (int i = 0; i < 26; i++) {
55  eBX0[i] = 0.0;
56  eEX0[i] = 0.0;
57  }
58 }
59 
61 
63  std::unique_ptr<PEcalValidInfo> product(new PEcalValidInfo);
64  fillEventInfo(*product);
65  e.put(std::move(product), label);
66 }
67 
69  if (ee1 != 0) {
70  product.ee1 = ee1;
71  product.ee4 = ee4;
72  product.ee9 = ee9;
73  product.ee16 = ee16;
74  product.ee25 = ee25;
75  for (int i = 0; i < 26; i++) {
76  product.eEX0.push_back(eEX0[i]);
77  }
78  }
79 
80  if (eb1 != 0) {
81  product.eb1 = eb1;
82  product.eb4 = eb4;
83  product.eb9 = eb9;
84  product.eb16 = eb16;
85  product.eb25 = eb25;
86  for (int i = 0; i < 26; i++) {
87  product.eBX0.push_back(eBX0[i]);
88  }
89  }
90 
91  product.totalEInEE = totalEInEE;
92  product.totalEInEB = totalEInEB;
93  product.totalEInES = totalEInES;
94 
95  product.totalEInEEzp = totalEInEEzp;
96  product.totalEInEEzm = totalEInEEzm;
97 
98  product.totalEInESzp = totalEInESzp;
99  product.totalEInESzm = totalEInESzm;
100 
101  product.totalHits = totalHits;
102  product.nHitsInEE = nHitsInEE;
103  product.nHitsInEB = nHitsInEB;
104  product.nHitsInES = nHitsInES;
105  product.nHitsIn1ES = nHitsIn1ES;
106  product.nHitsIn2ES = nHitsIn2ES;
107  product.nCrystalInEB = nCrystalInEB;
108  product.nCrystalInEEzp = nCrystalInEEzp;
109  product.nCrystalInEEzm = nCrystalInEEzm;
110 
111  product.nHitsIn1ESzp = nHitsIn1ESzp;
112  product.nHitsIn1ESzm = nHitsIn1ESzm;
113  product.nHitsIn2ESzp = nHitsIn2ESzp;
114  product.nHitsIn2ESzm = nHitsIn2ESzm;
115 
116  product.eOf1ES = eOf1ES;
117  product.eOf2ES = eOf2ES;
118  product.zOfES = zOfES;
119 
120  product.eOf1ESzp = eOf1ESzp;
121  product.eOf1ESzm = eOf1ESzm;
122  product.eOf2ESzp = eOf2ESzp;
123  product.eOf2ESzm = eOf2ESzm;
124 
127  product.eOfEECaloG4Hit = eOfEECaloG4Hit;
130  product.tOfEECaloG4Hit = tOfEECaloG4Hit;
131 
134  product.eOfESCaloG4Hit = eOfESCaloG4Hit;
135  product.tOfESCaloG4Hit = tOfESCaloG4Hit;
136 
139  product.eOfEBCaloG4Hit = eOfEBCaloG4Hit;
140  product.tOfEBCaloG4Hit = tOfEBCaloG4Hit;
141 
142  product.theMomentum = theMomentum;
143  product.theVertex = theVertex;
144  product.thePID = thePID;
145 }
146 
148  ee1 = 0.0;
149  ee4 = 0.0;
150  ee9 = 0.0;
151  ee16 = 0.0;
152  ee25 = 0.0;
153 
154  eb1 = 0.0;
155  eb4 = 0.0;
156  eb9 = 0.0;
157  eb16 = 0.0;
158  eb25 = 0.0;
159 
160  totalEInEE = 0.0;
161  totalEInEB = 0.0;
162  totalEInES = 0.0;
163 
164  totalEInEEzp = 0.0;
165  totalEInEEzm = 0.0;
166  totalEInESzp = 0.0;
167  totalEInESzm = 0.0;
168 
169  totalHits = 0;
170  nHitsInEE = 0;
171  nHitsInEB = 0;
172  nHitsInES = 0;
173  nHitsIn1ES = 0;
174  nHitsIn2ES = 0;
175  nCrystalInEB = 0;
176  nCrystalInEEzp = 0;
177  nCrystalInEEzm = 0;
178 
179  nHitsIn1ESzp = 0;
180  nHitsIn1ESzm = 0;
181  nHitsIn2ESzp = 0;
182  nHitsIn2ESzm = 0;
183 
184  for (int i = 0; i < 26; i++) {
185  eBX0[i] = 0.0;
186  eEX0[i] = 0.0;
187  }
188 
189  eOf1ES.clear();
190  eOf2ES.clear();
191  zOfES.clear();
192 
193  eOf1ESzp.clear();
194  eOf1ESzm.clear();
195  eOf2ESzp.clear();
196  eOf2ESzm.clear();
197 
198  phiOfEECaloG4Hit.clear();
199  etaOfEECaloG4Hit.clear();
200  tOfEECaloG4Hit.clear();
201  eOfEECaloG4Hit.clear();
202  eOfEEPlusCaloG4Hit.clear();
203  eOfEEMinusCaloG4Hit.clear();
204 
205  phiOfESCaloG4Hit.clear();
206  etaOfESCaloG4Hit.clear();
207  tOfESCaloG4Hit.clear();
208  eOfESCaloG4Hit.clear();
209 
210  phiOfEBCaloG4Hit.clear();
211  etaOfEBCaloG4Hit.clear();
212  tOfEBCaloG4Hit.clear();
213  eOfEBCaloG4Hit.clear();
214 }
215 
217  int trackID = 0;
218  G4PrimaryParticle *thePrim = nullptr;
219  int nvertex = (*evt)()->GetNumberOfPrimaryVertex();
220  if (nvertex <= 0) {
221  edm::LogWarning("EcalSimHitsValidProducer") << " No Vertex in this Event!";
222  } else {
223  for (int i = 0; i < nvertex; i++) {
224  G4PrimaryVertex *avertex = (*evt)()->GetPrimaryVertex(i);
225  if (avertex == nullptr)
226  edm::LogWarning("EcalSimHitsValidProducer") << " Pointer to vertex is NULL!";
227  else {
228  float x0 = avertex->GetX0();
229  float y0 = avertex->GetY0();
230  float z0 = avertex->GetZ0();
231  float t0 = avertex->GetT0();
232  theVertex.SetCoordinates(x0, y0, z0, t0);
233 
234  int npart = avertex->GetNumberOfParticle();
235  if (npart == 0)
236  edm::LogWarning("EcalSimHitsValidProducer") << " No primary particle in this event";
237  else {
238  if (thePrim == nullptr)
239  thePrim = avertex->GetPrimary(trackID);
240  }
241  }
242  }
243 
244  // the direction of momentum of primary particles
245  double pInit = 0; // etaInit =0, phiInit =0, // UNUSED
246  if (thePrim != nullptr) {
247  double px = thePrim->GetPx();
248  double py = thePrim->GetPy();
249  double pz = thePrim->GetPz();
250  theMomentum.SetCoordinates(px, py, pz, 0.);
251 
252  pInit = sqrt(pow(px, 2.) + pow(py, 2.) + pow(pz, 2.));
253  if (pInit == 0)
254  edm::LogWarning("EcalSimHitsValidProducer") << " Primary has p = 0 ; ";
255  else {
256  theMomentum.SetE(pInit);
257  // double costheta = pz/pInit; // UNUSED
258  // double theta = acos(std::min(std::max(costheta, -1.),1.)); // UNUSED
259  // etaInit = -log(tan(theta/2)); // UNUSED
260 
261  // if ( px != 0 || py != 0) phiInit = atan2(py,px); // UNUSED
262  }
263 
264  thePID = thePrim->GetPDGcode();
265  } else {
266  edm::LogWarning("EcalSimHitsValidProducer") << " Could not find the primary particle!!";
267  }
268  }
269  // hit map for EB for matrices
270  G4HCofThisEvent *allHC = (*evt)()->GetHCofThisEvent();
271  int EBHCid = G4SDManager::GetSDMpointer()->GetCollectionID("EcalHitsEB");
272  int EEHCid = G4SDManager::GetSDMpointer()->GetCollectionID("EcalHitsEE");
273  int SEHCid = G4SDManager::GetSDMpointer()->GetCollectionID("EcalHitsES");
274 
275  CaloG4HitCollection *theEBHC = (CaloG4HitCollection *)allHC->GetHC(EBHCid);
276  CaloG4HitCollection *theEEHC = (CaloG4HitCollection *)allHC->GetHC(EEHCid);
277  CaloG4HitCollection *theSEHC = (CaloG4HitCollection *)allHC->GetHC(SEHCid);
278 
279  nHitsInEE = theEEHC->entries();
280  nHitsInEB = theEBHC->entries();
281  nHitsInES = theSEHC->entries();
283 
284  // EB Hit collection start
285  MapType ebmap;
286  int theebhc_entries = theEBHC->entries();
287  for (int j = 0; j < theebhc_entries; j++) {
288  CaloG4Hit *aHit = (*theEBHC)[j];
289  totalEInEB += aHit->getEnergyDeposit();
290  float he = aHit->getEnergyDeposit();
291  float htime = aHit->getTimeSlice();
292 
293  math::XYZPoint hpos = aHit->getEntry();
294  float htheta = hpos.theta();
295  float heta = -log(tan(htheta * 0.5));
296  float hphi = hpos.phi();
297 
298  phiOfEBCaloG4Hit.push_back(hphi);
299  etaOfEBCaloG4Hit.push_back(heta);
300  tOfEBCaloG4Hit.push_back(htime);
301  eOfEBCaloG4Hit.push_back(he);
302  uint32_t crystid = aHit->getUnitID();
303  ebmap[crystid] += aHit->getEnergyDeposit();
304  }
305 
306  nCrystalInEB = ebmap.size();
307 
308  // EE Hit collection start
309  MapType eemap, eezpmap, eezmmap;
310  int theeehc_entries = theEEHC->entries();
311  for (int j = 0; j < theeehc_entries; j++) {
312  CaloG4Hit *aHit = (*theEEHC)[j];
313  totalEInEE += aHit->getEnergyDeposit();
314  float he = aHit->getEnergyDeposit();
315  float htime = aHit->getTimeSlice();
316 
317  math::XYZPoint hpos = aHit->getEntry();
318  float htheta = hpos.theta();
319  float heta = -log(tan(htheta * 0.5));
320  float hphi = hpos.phi();
321  phiOfEECaloG4Hit.push_back(hphi);
322  etaOfEECaloG4Hit.push_back(heta);
323  tOfEECaloG4Hit.push_back(htime);
324  eOfEECaloG4Hit.push_back(he);
325 
326  uint32_t crystid = aHit->getUnitID();
327  EEDetId myEEid(crystid);
328  if (myEEid.zside() == -1) {
329  totalEInEEzm += aHit->getEnergyDeposit();
330  eOfEEMinusCaloG4Hit.push_back(he);
331  eezmmap[crystid] += aHit->getEnergyDeposit();
332  }
333  if (myEEid.zside() == 1) {
334  totalEInEEzp += aHit->getEnergyDeposit();
335  eOfEEPlusCaloG4Hit.push_back(he);
336  eezpmap[crystid] += aHit->getEnergyDeposit();
337  }
338 
339  eemap[crystid] += aHit->getEnergyDeposit();
340  }
341 
342  nCrystalInEEzm = eezmmap.size();
343  nCrystalInEEzp = eezpmap.size();
344 
345  // Hits from ES
346  int thesehc_entries = theSEHC->entries();
347  for (int j = 0; j < thesehc_entries; j++) {
348  CaloG4Hit *aHit = (*theSEHC)[j];
349  totalEInES += aHit->getEnergyDeposit();
350  ESDetId esid = ESDetId(aHit->getUnitID());
351 
352  if (esid.zside() == -1) {
353  totalEInESzm += aHit->getEnergyDeposit();
354 
355  if (esid.plane() == 1) {
356  nHitsIn1ESzm++;
357  eOf1ESzm.push_back(aHit->getEnergyDeposit());
358  } else if (esid.plane() == 2) {
359  nHitsIn2ESzm++;
360  eOf2ESzm.push_back(aHit->getEnergyDeposit());
361  }
362  }
363  if (esid.zside() == 1) {
364  totalEInESzp += aHit->getEnergyDeposit();
365 
366  if (esid.plane() == 1) {
367  nHitsIn1ESzp++;
368  eOf1ESzp.push_back(aHit->getEnergyDeposit());
369  } else if (esid.plane() == 2) {
370  nHitsIn2ESzp++;
371  eOf2ESzp.push_back(aHit->getEnergyDeposit());
372  }
373  }
374  }
375 
376  uint32_t eemaxid = getUnitWithMaxEnergy(eemap);
377  uint32_t ebmaxid = getUnitWithMaxEnergy(ebmap);
378  if (eemap[eemaxid] > ebmap[ebmaxid]) {
379  uint32_t centerid = getUnitWithMaxEnergy(eemap);
380  EEDetId myEEid(centerid);
381  int ix = myEEid.ix();
382  int iy = myEEid.iy();
383  int iz = myEEid.zside();
384 
385  ee1 = energyInEEMatrix(1, 1, ix, iy, iz, eemap);
386  ee9 = energyInEEMatrix(3, 3, ix, iy, iz, eemap);
387  ee25 = energyInEEMatrix(5, 5, ix, iy, iz, eemap);
388  MapType neweemap;
389  if (fillEEMatrix(3, 3, ix, iy, iz, neweemap, eemap)) {
390  ee4 = eCluster2x2(neweemap);
391  }
392  if (fillEEMatrix(5, 5, ix, iy, iz, neweemap, eemap)) {
393  ee16 = eCluster4x4(ee9, neweemap);
394  }
395  } else {
396  uint32_t ebcenterid = getUnitWithMaxEnergy(ebmap);
397  EBDetId myEBid(ebcenterid);
398  int bx = myEBid.ietaAbs();
399  int by = myEBid.iphi();
400  int bz = myEBid.zside();
401  eb1 = energyInEBMatrix(1, 1, bx, by, bz, ebmap);
402  eb9 = energyInEBMatrix(3, 3, bx, by, bz, ebmap);
403  eb25 = energyInEBMatrix(5, 5, bx, by, bz, ebmap);
404 
405  MapType newebmap;
406  if (fillEBMatrix(3, 3, bx, by, bz, newebmap, ebmap)) {
407  eb4 = eCluster2x2(newebmap);
408  }
409  if (fillEBMatrix(5, 5, bx, by, bz, newebmap, ebmap)) {
410  eb16 = eCluster4x4(eb9, newebmap);
411  }
412  }
413 }
414 
415 void EcalSimHitsValidProducer::update(const G4Step *aStep) {
416  G4StepPoint *preStepPoint = aStep->GetPreStepPoint();
417  const G4ThreeVector &hitPoint = preStepPoint->GetPosition();
418  G4VPhysicalVolume *currentPV = preStepPoint->GetPhysicalVolume();
419  const G4String &name = currentPV->GetName();
420  std::string crystal;
421  crystal.assign(name, 0, 4);
422 
423  float Edeposit = aStep->GetTotalEnergyDeposit();
424  if (crystal == "EFRY" && Edeposit > 0.0) {
425  float z = hitPoint.z();
426  float detz = fabs(fabs(z) - 3200);
427  int x0 = (int)floor(detz / 8.9);
428  if (x0 < 26) {
429  eEX0[x0] += Edeposit;
430  }
431  }
432  if (crystal == "EBRY" && Edeposit > 0.0) {
433  float x = hitPoint.x();
434  float y = hitPoint.y();
435  float r = sqrt(x * x + y * y);
436  float detr = r - 1290;
437  int x0 = (int)floor(detr / 8.9);
438  eBX0[x0] += Edeposit;
439  }
440 }
441 
443  int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap) {
444  int goBackInEta = nCellInEta / 2;
445  int goBackInPhi = nCellInPhi / 2;
446 
447  int startEta = CentralEta - goBackInEta;
448  int startPhi = CentralPhi - goBackInPhi;
449 
450  int i = 0;
451  for (int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
452  for (int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
453  uint32_t index;
454 
455  if (EEDetId::validDetId(ieta, iphi, CentralZ)) {
456  index = EEDetId(ieta, iphi, CentralZ).rawId();
457  } else {
458  continue;
459  }
460 
461  fillmap[i++] = themap[index];
462  }
463  }
464  uint32_t centerid = getUnitWithMaxEnergy(themap);
465 
466  if (fillmap[i / 2] == themap[centerid])
467  return true;
468  else
469  return false;
470 }
471 
473  int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap) {
474  int goBackInEta = nCellInEta / 2;
475  int goBackInPhi = nCellInPhi / 2;
476 
477  int startEta = CentralZ * CentralEta - goBackInEta;
478  int startPhi = CentralPhi - goBackInPhi;
479 
480  int i = 0;
481  for (int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
482  for (int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
483  uint32_t index;
484  if (abs(ieta) > 85 || abs(ieta) < 1) {
485  continue;
486  }
487  if (iphi < 1) {
488  index = EBDetId(ieta, iphi + 360).rawId();
489  } else if (iphi > 360) {
490  index = EBDetId(ieta, iphi - 360).rawId();
491  } else {
492  index = EBDetId(ieta, iphi).rawId();
493  }
494  fillmap[i++] = themap[index];
495  }
496  }
497 
498  uint32_t ebcenterid = getUnitWithMaxEnergy(themap);
499 
500  if (fillmap[i / 2] == themap[ebcenterid])
501  return true;
502  else
503  return false;
504 }
505 
507  float E22 = 0.;
508  float e012 = themap[0] + themap[1] + themap[2];
509  float e036 = themap[0] + themap[3] + themap[6];
510  float e678 = themap[6] + themap[7] + themap[8];
511  float e258 = themap[2] + themap[5] + themap[8];
512 
513  if ((e012 > e678 || e012 == e678) && (e036 > e258 || e036 == e258))
514  return E22 = themap[0] + themap[1] + themap[3] + themap[4];
515  else if ((e012 > e678 || e012 == e678) && (e036 < e258 || e036 == e258))
516  return E22 = themap[1] + themap[2] + themap[4] + themap[5];
517  else if ((e012 < e678 || e012 == e678) && (e036 > e258 || e036 == e258))
518  return E22 = themap[3] + themap[4] + themap[6] + themap[7];
519  else if ((e012 < e678 || e012 == e678) && (e036 < e258 || e036 == e258))
520  return E22 = themap[4] + themap[5] + themap[7] + themap[8];
521  else {
522  return E22;
523  }
524 }
525 
527  float E44 = 0.;
528  float e0_4 = themap[0] + themap[1] + themap[2] + themap[3] + themap[4];
529  float e0_20 = themap[0] + themap[5] + themap[10] + themap[15] + themap[20];
530  float e4_24 = themap[4] + themap[9] + themap[14] + themap[19] + themap[24];
531  float e0_24 = themap[20] + themap[21] + themap[22] + themap[23] + themap[24];
532 
533  if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
534  return E44 = e33 + themap[0] + themap[1] + themap[2] + themap[3] + themap[5] + themap[10] + themap[15];
535  else if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
536  return E44 = e33 + themap[1] + themap[2] + themap[3] + themap[4] + themap[9] + themap[14] + themap[19];
537  else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
538  return E44 = e33 + themap[5] + themap[10] + themap[15] + themap[20] + themap[21] + themap[22] + themap[23];
539  else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
540  return E44 = e33 + themap[21] + themap[22] + themap[23] + themap[24] + themap[9] + themap[14] + themap[19];
541  else {
542  return E44;
543  }
544 }
545 
547  int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap) {
548  int ncristals = 0;
549  float totalEnergy = 0.;
550 
551  int goBackInX = nCellInX / 2;
552  int goBackInY = nCellInY / 2;
553  int startX = centralX - goBackInX;
554  int startY = centralY - goBackInY;
555 
556  for (int ix = startX; ix < startX + nCellInX; ix++) {
557  for (int iy = startY; iy < startY + nCellInY; iy++) {
558  uint32_t index;
559  if (EEDetId::validDetId(ix, iy, centralZ)) {
560  index = EEDetId(ix, iy, centralZ).rawId();
561  } else {
562  continue;
563  }
564 
565  totalEnergy += themap[index];
566  ncristals += 1;
567 
568  LogDebug("EcalSimHitsValidProducer")
569  << " EnergyInEEMatrix: ix - iy - E = " << ix << " " << iy << " " << themap[index];
570  }
571  }
572 
573  LogDebug("EcalSimHitsValidProducer") << " EnergyInEEMatrix: energy in " << nCellInX << " cells in x times "
574  << nCellInY << " cells in y matrix = " << totalEnergy << " for " << ncristals
575  << " crystals";
576 
577  return totalEnergy;
578 }
579 
581  int nCellInEta, int nCellInPhi, int centralEta, int centralPhi, int centralZ, MapType &themap) {
582  int ncristals = 0;
583  float totalEnergy = 0.;
584 
585  int goBackInEta = nCellInEta / 2;
586  int goBackInPhi = nCellInPhi / 2;
587  int startEta = centralZ * centralEta - goBackInEta;
588  int startPhi = centralPhi - goBackInPhi;
589 
590  for (int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
591  for (int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
592  uint32_t index;
593  if (abs(ieta) > 85 || abs(ieta) < 1) {
594  continue;
595  }
596  if (iphi < 1) {
597  index = EBDetId(ieta, iphi + 360).rawId();
598  } else if (iphi > 360) {
599  index = EBDetId(ieta, iphi - 360).rawId();
600  } else {
601  index = EBDetId(ieta, iphi).rawId();
602  }
603 
604  totalEnergy += themap[index];
605  ncristals += 1;
606 
607  LogDebug("EcalSimHitsValidProducer")
608  << " EnergyInEBMatrix: ieta - iphi - E = " << ieta << " " << iphi << " " << themap[index];
609  }
610  }
611 
612  LogDebug("EcalSimHitsValidProducer") << " EnergyInEBMatrix: energy in " << nCellInEta << " cells in eta times "
613  << nCellInPhi << " cells in phi matrix = " << totalEnergy << " for " << ncristals
614  << " crystals";
615 
616  return totalEnergy;
617 }
618 
620  uint32_t unitWithMaxEnergy = 0;
621  float maxEnergy = 0.;
622 
623  MapType::iterator iter;
624  for (iter = themap.begin(); iter != themap.end(); iter++) {
625  if (maxEnergy < (*iter).second) {
626  maxEnergy = (*iter).second;
627  unitWithMaxEnergy = (*iter).first;
628  }
629  }
630 
631  LogDebug("EcalSimHitsValidProducer") << " Max energy of " << maxEnergy << " MeV was found in Unit id 0x" << std::hex
632  << unitWithMaxEnergy << std::dec;
633 
634  return unitWithMaxEnergy;
635 }
DDAxes::y
EcalSimHitsValidProducer::eCluster4x4
float eCluster4x4(float e33, MapType &themap)
Definition: EcalSimHitsValidProducer.cc:526
PEcalValidInfo::etaOfEECaloG4Hit
FloatVector etaOfEECaloG4Hit
Definition: PValidationFormats.h:1219
EcalSimHitsValidProducer::totalEInEB
float totalEInEB
Definition: EcalSimHitsValidProducer.h:77
mps_fire.i
i
Definition: mps_fire.py:355
EcalSimHitsValidProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: EcalSimHitsValidProducer.cc:62
EcalSimHitsValidProducer::eCluster2x2
float eCluster2x2(MapType &themap)
Definition: EcalSimHitsValidProducer.cc:506
PEcalValidInfo::eOfEEPlusCaloG4Hit
FloatVector eOfEEPlusCaloG4Hit
Definition: PValidationFormats.h:1222
EcalSimHitsValidProducer::totalEInESzp
float totalEInESzp
Definition: EcalSimHitsValidProducer.h:82
PEcalValidInfo::nHitsIn2ESzm
int nHitsIn2ESzm
Definition: PValidationFormats.h:1200
PEcalValidInfo::eOfEECaloG4Hit
FloatVector eOfEECaloG4Hit
Definition: PValidationFormats.h:1221
CaloG4HitCollection.h
CaloG4Hit::getUnitID
uint32_t getUnitID() const
Definition: CaloG4Hit.h:65
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
EBDetId
Definition: EBDetId.h:17
EcalSimHitsValidProducer::fillEBMatrix
bool fillEBMatrix(int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap)
Definition: EcalSimHitsValidProducer.cc:472
PEcalValidInfo::eOfEEMinusCaloG4Hit
FloatVector eOfEEMinusCaloG4Hit
Definition: PValidationFormats.h:1223
EcalSimHitsValidProducer::phiOfESCaloG4Hit
FloatVector phiOfESCaloG4Hit
Definition: EcalSimHitsValidProducer.h:123
EcalSimHitsValidProducer::nCrystalInEB
int nCrystalInEB
Definition: EcalSimHitsValidProducer.h:91
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
PEcalValidInfo::eOf1ES
FloatVector eOf1ES
Definition: PValidationFormats.h:1209
EcalSimHitsValidProducer::eOfEECaloG4Hit
FloatVector eOfEECaloG4Hit
Definition: EcalSimHitsValidProducer.h:114
EcalSimHitsValidProducer::totalEInEE
float totalEInEE
Definition: EcalSimHitsValidProducer.h:76
PEcalValidInfo::nCrystalInEB
int nCrystalInEB
Definition: PValidationFormats.h:1202
EcalSimHitsValidProducer::theMomentum
math::XYZTLorentzVector theMomentum
Definition: EcalSimHitsValidProducer.h:128
EcalSimHitsValidProducer::nHitsIn1ESzm
int nHitsIn1ESzm
Definition: EcalSimHitsValidProducer.h:96
EndOfEvent.h
PEcalValidInfo::etaOfEBCaloG4Hit
FloatVector etaOfEBCaloG4Hit
Definition: PValidationFormats.h:1231
EcalSimHitsValidProducer::nCrystalInEEzm
int nCrystalInEEzm
Definition: EcalSimHitsValidProducer.h:93
ESDetId
Definition: ESDetId.h:15
DDAxes::x
PEcalValidInfo::totalEInEEzm
float totalEInEEzm
Definition: PValidationFormats.h:1186
EcalSimHitsValidProducer::energyInEEMatrix
float energyInEEMatrix(int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap)
Definition: EcalSimHitsValidProducer.cc:546
PEcalValidInfo::nHitsIn1ES
int nHitsIn1ES
Definition: PValidationFormats.h:1194
EcalSimHitsValidProducer::nHitsInEB
int nHitsInEB
Definition: EcalSimHitsValidProducer.h:87
PEcalValidInfo::ee25
float ee25
Definition: PValidationFormats.h:1173
EcalSimHitsValidProducer::totalEInEEzm
float totalEInEEzm
Definition: EcalSimHitsValidProducer.h:81
EEDetId::ix
int ix() const
Definition: EEDetId.h:77
CaloG4Hit::getTimeSlice
double getTimeSlice() const
Definition: CaloG4Hit.h:66
EcalSimHitsValidProducer::ee9
float ee9
Definition: EcalSimHitsValidProducer.h:66
EcalSimHitsValidProducer::~EcalSimHitsValidProducer
~EcalSimHitsValidProducer() override
Definition: EcalSimHitsValidProducer.cc:60
EcalSimHitsValidProducer::totalEInESzm
float totalEInESzm
Definition: EcalSimHitsValidProducer.h:83
npart
double npart
Definition: HydjetWrapper.h:46
PEcalValidInfo::eb9
float eb9
Definition: PValidationFormats.h:1177
PEcalValidInfo::phiOfEECaloG4Hit
FloatVector phiOfEECaloG4Hit
Definition: PValidationFormats.h:1218
BeginOfTrack.h
EcalSimHitsValidProducer::eb1
float eb1
Definition: EcalSimHitsValidProducer.h:70
EcalSimHitsValidProducer::nHitsIn1ESzp
int nHitsIn1ESzp
Definition: EcalSimHitsValidProducer.h:95
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
PEcalValidInfo
Definition: PValidationFormats.h:1063
EcalSimHitsValidProducer::etaOfESCaloG4Hit
FloatVector etaOfESCaloG4Hit
Definition: EcalSimHitsValidProducer.h:124
PEcalValidInfo::nHitsIn1ESzm
int nHitsIn1ESzm
Definition: PValidationFormats.h:1198
EBDetId::zside
int zside() const
get the z-side of the crystal (1/-1)
Definition: EBDetId.h:45
EcalSimHitsValidProducer::totalHits
int totalHits
Definition: EcalSimHitsValidProducer.h:85
PEcalValidInfo::eBX0
FloatVector eBX0
Definition: PValidationFormats.h:1206
EcalSimHitsValidProducer::theVertex
math::XYZTLorentzVector theVertex
Definition: EcalSimHitsValidProducer.h:129
PEcalValidInfo::totalEInESzp
float totalEInESzp
Definition: PValidationFormats.h:1187
PEcalValidInfo::eb25
float eb25
Definition: PValidationFormats.h:1179
EcalSimHitsValidProducer::thePID
int thePID
Definition: EcalSimHitsValidProducer.h:131
EcalSimHitsValidProducer::energyInEBMatrix
float energyInEBMatrix(int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap)
Definition: EcalSimHitsValidProducer.cc:580
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition: FrontierCondition_GT_autoExpress_cfi.py:148
PEcalValidInfo::eOf2ESzp
FloatVector eOf2ESzp
Definition: PValidationFormats.h:1215
EcalSimHitsValidProducer::getUnitWithMaxEnergy
uint32_t getUnitWithMaxEnergy(MapType &themap)
Definition: EcalSimHitsValidProducer.cc:619
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CaloG4Hit::getEnergyDeposit
double getEnergyDeposit() const
Definition: CaloG4Hit.h:77
PEcalValidInfo::eOf2ES
FloatVector eOf2ES
Definition: PValidationFormats.h:1210
DDAxes::z
EcalSimHitsValidProducer::totalEInES
float totalEInES
Definition: EcalSimHitsValidProducer.h:78
EcalSimHitsValidProducer::phiOfEECaloG4Hit
FloatVector phiOfEECaloG4Hit
Definition: EcalSimHitsValidProducer.h:111
EcalSimHitsValidProducer::eOf1ESzm
FloatVector eOf1ESzm
Definition: EcalSimHitsValidProducer.h:106
PEcalValidInfo::theVertex
math::XYZTLorentzVector theVertex
Definition: PValidationFormats.h:1237
EcalSimHitsValidProducer::eb25
float eb25
Definition: EcalSimHitsValidProducer.h:74
EcalSimHitsValidProducer::MapType
std::map< uint32_t, float, std::less< uint32_t > > MapType
Definition: EcalSimHitsValidProducer.h:30
PEcalValidInfo::ee16
float ee16
Definition: PValidationFormats.h:1172
PEcalValidInfo::zOfES
FloatVector zOfES
Definition: PValidationFormats.h:1211
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition: HLTMuonOfflineAnalyzer_cfi.py:98
EEDetId::zside
int zside() const
Definition: EEDetId.h:71
EcalSimHitsValidProducer::update
void update(const BeginOfEvent *) override
This routine will be called when the appropriate signal arrives.
Definition: EcalSimHitsValidProducer.cc:147
EndOfEvent
Definition: EndOfEvent.h:6
EcalSimHitsValidProducer::zOfES
FloatVector zOfES
Definition: EcalSimHitsValidProducer.h:110
EEDetId
Definition: EEDetId.h:14
PEcalValidInfo::thePID
int thePID
Definition: PValidationFormats.h:1235
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PEcalValidInfo::eOfEBCaloG4Hit
FloatVector eOfEBCaloG4Hit
Definition: PValidationFormats.h:1233
edm::LogWarning
Definition: MessageLogger.h:141
PEcalValidInfo::eOf1ESzm
FloatVector eOf1ESzm
Definition: PValidationFormats.h:1214
EcalSimHitsValidProducer::EcalSimHitsValidProducer
EcalSimHitsValidProducer(const edm::ParameterSet &)
Definition: EcalSimHitsValidProducer.cc:19
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
EcalSimHitsValidProducer::tOfEBCaloG4Hit
FloatVector tOfEBCaloG4Hit
Definition: EcalSimHitsValidProducer.h:120
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
Event.h
EcalSimHitsValidProducer::eOf2ESzp
FloatVector eOf2ESzp
Definition: EcalSimHitsValidProducer.h:107
EcalSimHitsValidProducer::label
std::string label
Definition: EcalSimHitsValidProducer.h:132
EcalSimHitsValidProducer::nHitsInES
int nHitsInES
Definition: EcalSimHitsValidProducer.h:88
EcalSimHitsValidProducer::eOf1ES
FloatVector eOf1ES
Definition: EcalSimHitsValidProducer.h:103
EcalSimHitsValidProducer::eOf2ES
FloatVector eOf2ES
Definition: EcalSimHitsValidProducer.h:104
PEcalValidInfo::phiOfESCaloG4Hit
FloatVector phiOfESCaloG4Hit
Definition: PValidationFormats.h:1225
PEcalValidInfo::eEX0
FloatVector eEX0
Definition: PValidationFormats.h:1207
PEcalValidInfo::totalEInEE
float totalEInEE
Definition: PValidationFormats.h:1181
PEcalValidInfo::nHitsInES
int nHitsInES
Definition: PValidationFormats.h:1193
PEcalValidInfo::nHitsIn2ES
int nHitsIn2ES
Definition: PValidationFormats.h:1195
EcalSimHitsValidProducer::ee1
float ee1
Definition: EcalSimHitsValidProducer.h:64
PEcalValidInfo::eOf2ESzm
FloatVector eOf2ESzm
Definition: PValidationFormats.h:1216
BeginOfEvent.h
PEcalValidInfo::totalEInEB
float totalEInEB
Definition: PValidationFormats.h:1182
EcalSimHitsValidProducer::eb16
float eb16
Definition: EcalSimHitsValidProducer.h:73
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
EcalSimHitsValidProducer::eOfESCaloG4Hit
FloatVector eOfESCaloG4Hit
Definition: EcalSimHitsValidProducer.h:126
createfilelist.int
int
Definition: createfilelist.py:10
PEcalValidInfo::totalHits
int totalHits
Definition: PValidationFormats.h:1190
PEcalValidInfo::eb1
float eb1
Definition: PValidationFormats.h:1175
EcalSimHitsValidProducer::eb4
float eb4
Definition: EcalSimHitsValidProducer.h:71
PEcalValidInfo::nHitsIn2ESzp
int nHitsIn2ESzp
Definition: PValidationFormats.h:1199
EcalSimHitsValidProducer::eOf1ESzp
FloatVector eOf1ESzp
Definition: EcalSimHitsValidProducer.h:105
BeginOfEvent
Definition: BeginOfEvent.h:6
PEcalValidInfo::nCrystalInEEzp
int nCrystalInEEzp
Definition: PValidationFormats.h:1203
EcalSimHitsValidProducer::nHitsIn1ES
int nHitsIn1ES
Definition: EcalSimHitsValidProducer.h:89
edm::EventSetup
Definition: EventSetup.h:57
particleFlowClusterECALTimeSelected_cfi.maxEnergy
maxEnergy
Definition: particleFlowClusterECALTimeSelected_cfi.py:10
CaloG4Hit
Definition: CaloG4Hit.h:32
EEDetId::iy
int iy() const
Definition: EEDetId.h:83
EcalSimHitsValidProducer::nHitsInEE
int nHitsInEE
Definition: EcalSimHitsValidProducer.h:86
EcalSimHitsValidProducer::tOfESCaloG4Hit
FloatVector tOfESCaloG4Hit
Definition: EcalSimHitsValidProducer.h:125
PEcalValidInfo::nHitsInEB
int nHitsInEB
Definition: PValidationFormats.h:1192
PEcalValidInfo::totalEInES
float totalEInES
Definition: PValidationFormats.h:1183
alignCSCRings.r
r
Definition: alignCSCRings.py:93
EcalSimHitsValidProducer::ee25
float ee25
Definition: EcalSimHitsValidProducer.h:68
PEcalValidInfo::eOf1ESzp
FloatVector eOf1ESzp
Definition: PValidationFormats.h:1213
ESDetId::plane
int plane() const
Definition: ESDetId.h:41
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
PEcalValidInfo::theMomentum
math::XYZTLorentzVector theMomentum
Definition: PValidationFormats.h:1236
EcalSimHitsValidProducer::tOfEECaloG4Hit
FloatVector tOfEECaloG4Hit
Definition: EcalSimHitsValidProducer.h:113
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalSimHitsValidProducer::ee4
float ee4
Definition: EcalSimHitsValidProducer.h:65
EcalSimHitsValidProducer::nCrystalInEEzp
int nCrystalInEEzp
Definition: EcalSimHitsValidProducer.h:92
hcalSimParameters_cfi.he
he
Definition: hcalSimParameters_cfi.py:75
PEcalValidInfo::nCrystalInEEzm
int nCrystalInEEzm
Definition: PValidationFormats.h:1204
EcalSimHitsValidProducer::nHitsIn2ESzp
int nHitsIn2ESzp
Definition: EcalSimHitsValidProducer.h:97
EcalSimHitsValidProducer::etaOfEBCaloG4Hit
FloatVector etaOfEBCaloG4Hit
Definition: EcalSimHitsValidProducer.h:119
PEcalValidInfo::nHitsInEE
int nHitsInEE
Definition: PValidationFormats.h:1191
PEcalValidInfo::eb4
float eb4
Definition: PValidationFormats.h:1176
EBDetId::ietaAbs
int ietaAbs() const
get the absolute value of the crystal ieta
Definition: EBDetId.h:47
PEcalValidInfo::phiOfEBCaloG4Hit
FloatVector phiOfEBCaloG4Hit
Definition: PValidationFormats.h:1230
EcalSimHitsValidProducer::nHitsIn2ES
int nHitsIn2ES
Definition: EcalSimHitsValidProducer.h:90
Point3D.h
EcalSimHitsValidProducer::eb9
float eb9
Definition: EcalSimHitsValidProducer.h:72
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EcalSimHitsValidProducer::eOfEEMinusCaloG4Hit
FloatVector eOfEEMinusCaloG4Hit
Definition: EcalSimHitsValidProducer.h:116
EcalSimHitsValidProducer::phiOfEBCaloG4Hit
FloatVector phiOfEBCaloG4Hit
Definition: EcalSimHitsValidProducer.h:118
CaloG4HitCollection
G4THitsCollection< CaloG4Hit > CaloG4HitCollection
Definition: CaloG4HitCollection.h:11
PEcalValidInfo::tOfEBCaloG4Hit
FloatVector tOfEBCaloG4Hit
Definition: PValidationFormats.h:1232
EcalSimHitsValidProducer::ee16
float ee16
Definition: EcalSimHitsValidProducer.h:67
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
PEcalValidInfo::nHitsIn1ESzp
int nHitsIn1ESzp
Definition: PValidationFormats.h:1197
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
PEcalValidInfo::eOfESCaloG4Hit
FloatVector eOfESCaloG4Hit
Definition: PValidationFormats.h:1228
EcalSimHitsValidProducer::nHitsIn2ESzm
int nHitsIn2ESzm
Definition: EcalSimHitsValidProducer.h:98
PEcalValidInfo::totalEInEEzp
float totalEInEEzp
Definition: PValidationFormats.h:1185
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
EBDetId::iphi
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
PEcalValidInfo::ee4
float ee4
Definition: PValidationFormats.h:1170
PEcalValidInfo::etaOfESCaloG4Hit
FloatVector etaOfESCaloG4Hit
Definition: PValidationFormats.h:1226
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PEcalValidInfo::tOfESCaloG4Hit
FloatVector tOfESCaloG4Hit
Definition: PValidationFormats.h:1227
ParameterSet.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
PEcalValidInfo::totalEInESzm
float totalEInESzm
Definition: PValidationFormats.h:1188
EcalSimHitsValidProducer::fillEventInfo
void fillEventInfo(PEcalValidInfo &)
Definition: EcalSimHitsValidProducer.cc:68
edm::Event
Definition: Event.h:73
PEcalValidInfo::ee1
float ee1
Definition: PValidationFormats.h:1169
PEcalValidInfo::tOfEECaloG4Hit
FloatVector tOfEECaloG4Hit
Definition: PValidationFormats.h:1220
EcalSimHitsValidProducer::fillEEMatrix
bool fillEEMatrix(int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap)
Definition: EcalSimHitsValidProducer.cc:442
PEcalValidInfo::ee9
float ee9
Definition: PValidationFormats.h:1171
EcalSimHitsValidProducer.h
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
EcalSimHitsValidProducer::etaOfEECaloG4Hit
FloatVector etaOfEECaloG4Hit
Definition: EcalSimHitsValidProducer.h:112
label
const char * label
Definition: PFTauDecayModeTools.cc:11
ESDetId::zside
int zside() const
Definition: ESDetId.h:39
EcalSimHitsValidProducer::eOf2ESzm
FloatVector eOf2ESzm
Definition: EcalSimHitsValidProducer.h:108
PValidationFormats.h
EcalSimHitsValidProducer::eOfEEPlusCaloG4Hit
FloatVector eOfEEPlusCaloG4Hit
Definition: EcalSimHitsValidProducer.h:115
CaloG4Hit::getEntry
math::XYZPoint getEntry() const
Definition: CaloG4Hit.h:46
EcalSimHitsValidProducer::eBX0
float eBX0[26]
Definition: EcalSimHitsValidProducer.h:100
PEcalValidInfo::eb16
float eb16
Definition: PValidationFormats.h:1178
EcalSimHitsValidProducer::eEX0
float eEX0[26]
Definition: EcalSimHitsValidProducer.h:101
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
EcalSimHitsValidProducer::totalEInEEzp
float totalEInEEzp
Definition: EcalSimHitsValidProducer.h:80
EcalSimHitsValidProducer::eOfEBCaloG4Hit
FloatVector eOfEBCaloG4Hit
Definition: EcalSimHitsValidProducer.h:121