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  for (int j = 0; j < theEBHC->entries(); j++) {
287  CaloG4Hit *aHit = (*theEBHC)[j];
288  totalEInEB += aHit->getEnergyDeposit();
289  float he = aHit->getEnergyDeposit();
290  float htime = aHit->getTimeSlice();
291 
292  math::XYZPoint hpos = aHit->getEntry();
293  float htheta = hpos.theta();
294  float heta = -log(tan(htheta * 0.5));
295  float hphi = hpos.phi();
296 
297  phiOfEBCaloG4Hit.push_back(hphi);
298  etaOfEBCaloG4Hit.push_back(heta);
299  tOfEBCaloG4Hit.push_back(htime);
300  eOfEBCaloG4Hit.push_back(he);
301  uint32_t crystid = aHit->getUnitID();
302  ebmap[crystid] += aHit->getEnergyDeposit();
303  }
304 
305  nCrystalInEB = ebmap.size();
306 
307  // EE Hit collection start
308  MapType eemap, eezpmap, eezmmap;
309 
310  for (int j = 0; j < theEEHC->entries(); j++) {
311  CaloG4Hit *aHit = (*theEEHC)[j];
312  totalEInEE += aHit->getEnergyDeposit();
313  float he = aHit->getEnergyDeposit();
314  float htime = aHit->getTimeSlice();
315 
316  math::XYZPoint hpos = aHit->getEntry();
317  float htheta = hpos.theta();
318  float heta = -log(tan(htheta * 0.5));
319  float hphi = hpos.phi();
320  phiOfEECaloG4Hit.push_back(hphi);
321  etaOfEECaloG4Hit.push_back(heta);
322  tOfEECaloG4Hit.push_back(htime);
323  eOfEECaloG4Hit.push_back(he);
324 
325  uint32_t crystid = aHit->getUnitID();
326  EEDetId myEEid(crystid);
327  if (myEEid.zside() == -1) {
328  totalEInEEzm += aHit->getEnergyDeposit();
329  eOfEEMinusCaloG4Hit.push_back(he);
330  eezmmap[crystid] += aHit->getEnergyDeposit();
331  }
332  if (myEEid.zside() == 1) {
333  totalEInEEzp += aHit->getEnergyDeposit();
334  eOfEEPlusCaloG4Hit.push_back(he);
335  eezpmap[crystid] += aHit->getEnergyDeposit();
336  }
337 
338  eemap[crystid] += aHit->getEnergyDeposit();
339  }
340 
341  nCrystalInEEzm = eezmmap.size();
342  nCrystalInEEzp = eezpmap.size();
343 
344  // Hits from ES
345  for (int j = 0; j < theSEHC->entries(); j++) {
346  CaloG4Hit *aHit = (*theSEHC)[j];
347  totalEInES += aHit->getEnergyDeposit();
348  ESDetId esid = ESDetId(aHit->getUnitID());
349 
350  if (esid.zside() == -1) {
351  totalEInESzm += aHit->getEnergyDeposit();
352 
353  if (esid.plane() == 1) {
354  nHitsIn1ESzm++;
355  eOf1ESzm.push_back(aHit->getEnergyDeposit());
356  } else if (esid.plane() == 2) {
357  nHitsIn2ESzm++;
358  eOf2ESzm.push_back(aHit->getEnergyDeposit());
359  }
360  }
361  if (esid.zside() == 1) {
362  totalEInESzp += aHit->getEnergyDeposit();
363 
364  if (esid.plane() == 1) {
365  nHitsIn1ESzp++;
366  eOf1ESzp.push_back(aHit->getEnergyDeposit());
367  } else if (esid.plane() == 2) {
368  nHitsIn2ESzp++;
369  eOf2ESzp.push_back(aHit->getEnergyDeposit());
370  }
371  }
372  }
373 
374  uint32_t eemaxid = getUnitWithMaxEnergy(eemap);
375  uint32_t ebmaxid = getUnitWithMaxEnergy(ebmap);
376  if (eemap[eemaxid] > ebmap[ebmaxid]) {
377  uint32_t centerid = getUnitWithMaxEnergy(eemap);
378  EEDetId myEEid(centerid);
379  int ix = myEEid.ix();
380  int iy = myEEid.iy();
381  int iz = myEEid.zside();
382 
383  ee1 = energyInEEMatrix(1, 1, ix, iy, iz, eemap);
384  ee9 = energyInEEMatrix(3, 3, ix, iy, iz, eemap);
385  ee25 = energyInEEMatrix(5, 5, ix, iy, iz, eemap);
386  MapType neweemap;
387  if (fillEEMatrix(3, 3, ix, iy, iz, neweemap, eemap)) {
388  ee4 = eCluster2x2(neweemap);
389  }
390  if (fillEEMatrix(5, 5, ix, iy, iz, neweemap, eemap)) {
391  ee16 = eCluster4x4(ee9, neweemap);
392  }
393  } else {
394  uint32_t ebcenterid = getUnitWithMaxEnergy(ebmap);
395  EBDetId myEBid(ebcenterid);
396  int bx = myEBid.ietaAbs();
397  int by = myEBid.iphi();
398  int bz = myEBid.zside();
399  eb1 = energyInEBMatrix(1, 1, bx, by, bz, ebmap);
400  eb9 = energyInEBMatrix(3, 3, bx, by, bz, ebmap);
401  eb25 = energyInEBMatrix(5, 5, bx, by, bz, ebmap);
402 
403  MapType newebmap;
404  if (fillEBMatrix(3, 3, bx, by, bz, newebmap, ebmap)) {
405  eb4 = eCluster2x2(newebmap);
406  }
407  if (fillEBMatrix(5, 5, bx, by, bz, newebmap, ebmap)) {
408  eb16 = eCluster4x4(eb9, newebmap);
409  }
410  }
411 }
412 
413 void EcalSimHitsValidProducer::update(const G4Step *aStep) {
414  G4StepPoint *preStepPoint = aStep->GetPreStepPoint();
415  const G4ThreeVector &hitPoint = preStepPoint->GetPosition();
416  G4VPhysicalVolume *currentPV = preStepPoint->GetPhysicalVolume();
417  const G4String &name = currentPV->GetName();
418  std::string crystal;
419  crystal.assign(name, 0, 4);
420 
421  float Edeposit = aStep->GetTotalEnergyDeposit();
422  if (crystal == "EFRY" && Edeposit > 0.0) {
423  float z = hitPoint.z();
424  float detz = fabs(fabs(z) - 3200);
425  int x0 = (int)floor(detz / 8.9);
426  if (x0 < 26) {
427  eEX0[x0] += Edeposit;
428  }
429  }
430  if (crystal == "EBRY" && Edeposit > 0.0) {
431  float x = hitPoint.x();
432  float y = hitPoint.y();
433  float r = sqrt(x * x + y * y);
434  float detr = r - 1290;
435  int x0 = (int)floor(detr / 8.9);
436  eBX0[x0] += Edeposit;
437  }
438 }
439 
441  int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap) {
442  int goBackInEta = nCellInEta / 2;
443  int goBackInPhi = nCellInPhi / 2;
444 
445  int startEta = CentralEta - goBackInEta;
446  int startPhi = CentralPhi - goBackInPhi;
447 
448  int i = 0;
449  for (int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
450  for (int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
451  uint32_t index;
452 
453  if (EEDetId::validDetId(ieta, iphi, CentralZ)) {
454  index = EEDetId(ieta, iphi, CentralZ).rawId();
455  } else {
456  continue;
457  }
458 
459  fillmap[i++] = themap[index];
460  }
461  }
462  uint32_t centerid = getUnitWithMaxEnergy(themap);
463 
464  if (fillmap[i / 2] == themap[centerid])
465  return true;
466  else
467  return false;
468 }
469 
471  int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap) {
472  int goBackInEta = nCellInEta / 2;
473  int goBackInPhi = nCellInPhi / 2;
474 
475  int startEta = CentralZ * CentralEta - goBackInEta;
476  int startPhi = CentralPhi - goBackInPhi;
477 
478  int i = 0;
479  for (int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
480  for (int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
481  uint32_t index;
482  if (abs(ieta) > 85 || abs(ieta) < 1) {
483  continue;
484  }
485  if (iphi < 1) {
486  index = EBDetId(ieta, iphi + 360).rawId();
487  } else if (iphi > 360) {
488  index = EBDetId(ieta, iphi - 360).rawId();
489  } else {
490  index = EBDetId(ieta, iphi).rawId();
491  }
492  fillmap[i++] = themap[index];
493  }
494  }
495 
496  uint32_t ebcenterid = getUnitWithMaxEnergy(themap);
497 
498  if (fillmap[i / 2] == themap[ebcenterid])
499  return true;
500  else
501  return false;
502 }
503 
505  float E22 = 0.;
506  float e012 = themap[0] + themap[1] + themap[2];
507  float e036 = themap[0] + themap[3] + themap[6];
508  float e678 = themap[6] + themap[7] + themap[8];
509  float e258 = themap[2] + themap[5] + themap[8];
510 
511  if ((e012 > e678 || e012 == e678) && (e036 > e258 || e036 == e258))
512  return E22 = themap[0] + themap[1] + themap[3] + themap[4];
513  else if ((e012 > e678 || e012 == e678) && (e036 < e258 || e036 == e258))
514  return E22 = themap[1] + themap[2] + themap[4] + themap[5];
515  else if ((e012 < e678 || e012 == e678) && (e036 > e258 || e036 == e258))
516  return E22 = themap[3] + themap[4] + themap[6] + themap[7];
517  else if ((e012 < e678 || e012 == e678) && (e036 < e258 || e036 == e258))
518  return E22 = themap[4] + themap[5] + themap[7] + themap[8];
519  else {
520  return E22;
521  }
522 }
523 
525  float E44 = 0.;
526  float e0_4 = themap[0] + themap[1] + themap[2] + themap[3] + themap[4];
527  float e0_20 = themap[0] + themap[5] + themap[10] + themap[15] + themap[20];
528  float e4_24 = themap[4] + themap[9] + themap[14] + themap[19] + themap[24];
529  float e0_24 = themap[20] + themap[21] + themap[22] + themap[23] + themap[24];
530 
531  if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
532  return E44 = e33 + themap[0] + themap[1] + themap[2] + themap[3] + themap[5] + themap[10] + themap[15];
533  else if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
534  return E44 = e33 + themap[1] + themap[2] + themap[3] + themap[4] + themap[9] + themap[14] + themap[19];
535  else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
536  return E44 = e33 + themap[5] + themap[10] + themap[15] + themap[20] + themap[21] + themap[22] + themap[23];
537  else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
538  return E44 = e33 + themap[21] + themap[22] + themap[23] + themap[24] + themap[9] + themap[14] + themap[19];
539  else {
540  return E44;
541  }
542 }
543 
545  int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap) {
546  int ncristals = 0;
547  float totalEnergy = 0.;
548 
549  int goBackInX = nCellInX / 2;
550  int goBackInY = nCellInY / 2;
551  int startX = centralX - goBackInX;
552  int startY = centralY - goBackInY;
553 
554  for (int ix = startX; ix < startX + nCellInX; ix++) {
555  for (int iy = startY; iy < startY + nCellInY; iy++) {
556  uint32_t index;
557  if (EEDetId::validDetId(ix, iy, centralZ)) {
558  index = EEDetId(ix, iy, centralZ).rawId();
559  } else {
560  continue;
561  }
562 
563  totalEnergy += themap[index];
564  ncristals += 1;
565 
566  LogDebug("EcalSimHitsValidProducer")
567  << " EnergyInEEMatrix: ix - iy - E = " << ix << " " << iy << " " << themap[index];
568  }
569  }
570 
571  LogDebug("EcalSimHitsValidProducer") << " EnergyInEEMatrix: energy in " << nCellInX << " cells in x times "
572  << nCellInY << " cells in y matrix = " << totalEnergy << " for " << ncristals
573  << " crystals";
574 
575  return totalEnergy;
576 }
577 
579  int nCellInEta, int nCellInPhi, int centralEta, int centralPhi, int centralZ, MapType &themap) {
580  int ncristals = 0;
581  float totalEnergy = 0.;
582 
583  int goBackInEta = nCellInEta / 2;
584  int goBackInPhi = nCellInPhi / 2;
585  int startEta = centralZ * centralEta - goBackInEta;
586  int startPhi = centralPhi - goBackInPhi;
587 
588  for (int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
589  for (int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
590  uint32_t index;
591  if (abs(ieta) > 85 || abs(ieta) < 1) {
592  continue;
593  }
594  if (iphi < 1) {
595  index = EBDetId(ieta, iphi + 360).rawId();
596  } else if (iphi > 360) {
597  index = EBDetId(ieta, iphi - 360).rawId();
598  } else {
599  index = EBDetId(ieta, iphi).rawId();
600  }
601 
602  totalEnergy += themap[index];
603  ncristals += 1;
604 
605  LogDebug("EcalSimHitsValidProducer")
606  << " EnergyInEBMatrix: ieta - iphi - E = " << ieta << " " << iphi << " " << themap[index];
607  }
608  }
609 
610  LogDebug("EcalSimHitsValidProducer") << " EnergyInEBMatrix: energy in " << nCellInEta << " cells in eta times "
611  << nCellInPhi << " cells in phi matrix = " << totalEnergy << " for " << ncristals
612  << " crystals";
613 
614  return totalEnergy;
615 }
616 
618  uint32_t unitWithMaxEnergy = 0;
619  float maxEnergy = 0.;
620 
621  MapType::iterator iter;
622  for (iter = themap.begin(); iter != themap.end(); iter++) {
623  if (maxEnergy < (*iter).second) {
624  maxEnergy = (*iter).second;
625  unitWithMaxEnergy = (*iter).first;
626  }
627  }
628 
629  LogDebug("EcalSimHitsValidProducer") << " Max energy of " << maxEnergy << " MeV was found in Unit id 0x" << std::hex
630  << unitWithMaxEnergy << std::dec;
631 
632  return unitWithMaxEnergy;
633 }
#define LogDebug(id)
FloatVector eOfEEMinusCaloG4Hit
FloatVector eOfESCaloG4Hit
void update(const BeginOfEvent *) override
This routine will be called when the appropriate signal arrives.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
int ix() const
Definition: EEDetId.h:77
FloatVector eOfEEPlusCaloG4Hit
FloatVector phiOfEECaloG4Hit
FloatVector tOfEECaloG4Hit
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
FloatVector etaOfEECaloG4Hit
FloatVector phiOfEBCaloG4Hit
math::XYZTLorentzVector theMomentum
double npart
Definition: HydjetWrapper.h:49
bool fillEEMatrix(int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap)
FloatVector etaOfEBCaloG4Hit
math::XYZTLorentzVector theVertex
math::XYZTLorentzVector theMomentum
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
char const * label
void fillEventInfo(PEcalValidInfo &)
uint32_t getUnitWithMaxEnergy(MapType &themap)
T sqrt(T t)
Definition: SSEVec.h:18
bool fillEBMatrix(int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap)
FloatVector eOfEBCaloG4Hit
float energyInEBMatrix(int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap)
int zside() const
Definition: EEDetId.h:71
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int iy() const
Definition: EEDetId.h:83
FloatVector phiOfESCaloG4Hit
std::map< uint32_t, float, std::less< uint32_t > > MapType
int zside() const
Definition: ESDetId.h:39
float energyInEEMatrix(int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
math::XYZTLorentzVector theVertex
void produce(edm::Event &, const edm::EventSetup &) override
FloatVector etaOfESCaloG4Hit
float eCluster2x2(MapType &themap)
G4THitsCollection< CaloG4Hit > CaloG4HitCollection
int plane() const
Definition: ESDetId.h:41
double getTimeSlice() const
Definition: CaloG4Hit.h:66
math::XYZPoint getEntry() const
Definition: CaloG4Hit.h:46
FloatVector tOfESCaloG4Hit
uint32_t getUnitID() const
Definition: CaloG4Hit.h:65
EcalSimHitsValidProducer(const edm::ParameterSet &)
FloatVector tOfEBCaloG4Hit
FloatVector eOfEECaloG4Hit
int ietaAbs() const
get the absolute value of the crystal ieta
Definition: EBDetId.h:47
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
def move(src, dest)
Definition: eostools.py:511
double getEnergyDeposit() const
Definition: CaloG4Hit.h:77
int zside() const
get the z-side of the crystal (1/-1)
Definition: EBDetId.h:45
float eCluster4x4(float e33, MapType &themap)