18 : g4InfoLabel(ps.getParameter<
std::
string>(
"moduleLabelG4")),
29 for (
int myStep = 0; myStep < 26; myStep++) {
35 ib.setCurrentFolder(
"EcalHitsV/EcalSimHitsValidation");
36 ib.setScope(MonitorElementData::Scope::RUN);
41 histo =
"EE- hits multiplicity";
44 histo =
"EE+ crystals multiplicity";
47 histo =
"EE- crystals multiplicity";
50 histo =
"EE+ occupancy";
53 histo =
"EE- occupancy";
56 histo =
"EE longitudinal shower profile";
59 histo =
"EE hits energy spectrum";
62 histo =
"EE hits log10energy spectrum";
65 histo =
"EE hits log10energy spectrum vs normalized energy";
68 histo =
"EE hits log10energy spectrum vs normalized energy25";
71 histo =
"EE hits energy spectrum 2";
74 histo =
"EE crystal energy spectrum";
77 histo =
"EE crystal energy spectrum 2";
113 histo =
"EE E16oE25";
118 edm::LogInfo(
"EventInfo") <<
" Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
130 std::vector<PCaloHit> theEECaloHits;
131 theEECaloHits.insert(theEECaloHits.end(), EcalHitsEE->begin(), EcalHitsEE->end());
135 std::map<unsigned int, std::vector<PCaloHit *>, std::less<unsigned int>> CaloHitMap;
145 std::vector<double> econtr(140, 0.);
146 std::vector<double> econtr25(140, 0.);
151 uint32_t nEEzpHits = 0;
152 uint32_t nEEzmHits = 0;
154 for (std::vector<PCaloHit>::iterator isim = theEECaloHits.begin(); isim != theEECaloHits.end(); ++isim) {
155 if (isim->time() > 500.) {
159 CaloHitMap[isim->id()].push_back(&(*isim));
163 LogDebug(
"HitInfo") <<
" CaloHit " << isim->getName() <<
"\n"
164 <<
" DetID = " << isim->id() <<
" EEDetId = " << eeid.ix() <<
" " << eeid.iy() <<
"\n"
165 <<
" Time = " << isim->time() <<
"\n"
166 <<
" Track Id = " << isim->geantTrackId() <<
"\n"
167 <<
" Energy = " << isim->energy();
169 uint32_t crystid = eeid.rawId();
171 if (eeid.zside() > 0) {
173 EEetzp_ += isim->energy();
174 eemapzp[crystid] += isim->energy();
176 }
else if (eeid.zside() < 0) {
178 EEetzm_ += isim->energy();
179 eemapzm[crystid] += isim->energy();
184 if (isim->energy() > 0) {
186 int log10i =
int((log10(isim->energy()) + 10.) * 10.);
187 if (log10i >= 0 && log10i < 140)
188 econtr[log10i] += isim->energy();
191 eemap[crystid] += isim->energy();
197 for (
std::map<uint32_t,
float, std::less<uint32_t>>::iterator it = eemap.begin(); it != eemap.end(); ++it)
199 for (
std::map<uint32_t,
float, std::less<uint32_t>>::iterator it = eemap.begin(); it != eemap.end(); ++it)
205 int nEEHits = nEEzmHits + nEEzpHits;
209 int bx = myEEid.
ix();
210 int by = myEEid.
iy();
211 int bz = myEEid.
zside();
219 std::vector<uint32_t> ids25;
222 for (
unsigned i = 0;
i < 25;
i++) {
223 for (
unsigned int j = 0;
j < CaloHitMap[ids25[
i]].size();
j++) {
224 if (CaloHitMap[ids25[
i]][
j]->
energy() > 0) {
225 int log10i =
int((log10(CaloHitMap[ids25[
i]][
j]->
energy()) + 10.) * 10.);
226 if (log10i >= 0 && log10i < 140)
227 econtr25[log10i] += CaloHitMap[ids25[
i]][
j]->energy();
257 if ((EEetzp_ + EEetzm_) != 0) {
258 for (
int i = 0;
i < 140;
i++) {
264 for (
int i = 0;
i < 140;
i++) {
270 if (MyPEcalValidInfo.
isValid()) {
271 if (MyPEcalValidInfo->
ee1x1() > 0.) {
272 std::vector<float> EX0 = MyPEcalValidInfo->
eX0();
274 for (
int myStep = 0; myStep < 26; myStep++) {
283 int nCellInX,
int nCellInY,
int centralX,
int centralY,
int centralZ,
MapType &themap) {
285 float totalEnergy = 0.;
287 int goBackInX = nCellInX / 2;
288 int goBackInY = nCellInY / 2;
289 int startX = centralX - goBackInX;
290 int startY = centralY - goBackInY;
292 for (
int ix = startX; ix < startX + nCellInX; ix++) {
293 for (
int iy = startY; iy < startY + nCellInY; iy++) {
302 totalEnergy += themap[
index];
307 LogDebug(
"GeomInfo") << nCellInX <<
" x " << nCellInY <<
" EE matrix energy = " << totalEnergy <<
" for " << ncristals
313 int nCellInX,
int nCellInY,
int centralX,
int centralY,
int centralZ,
MapType &themap) {
315 std::vector<uint32_t> ids(nCellInX * nCellInY);
317 int goBackInX = nCellInX / 2;
318 int goBackInY = nCellInY / 2;
319 int startX = centralX - goBackInX;
320 int startY = centralY - goBackInY;
322 for (
int ix = startX; ix < startX + nCellInX; ix++) {
323 for (
int iy = startY; iy < startY + nCellInY; iy++) {
332 ids[ncristals] =
index;
341 int nCellInX,
int nCellInY,
int CentralX,
int CentralY,
int CentralZ,
MapType &fillmap,
MapType &themap) {
342 int goBackInX = nCellInX / 2;
343 int goBackInY = nCellInY / 2;
345 int startX = CentralX - goBackInX;
346 int startY = CentralY - goBackInY;
349 for (
int ix = startX; ix < startX + nCellInX; ix++) {
350 for (
int iy = startY; iy < startY + nCellInY; iy++) {
358 fillmap[
i++] = themap[
index];
363 if (fillmap[
i / 2] == themap[centerid])
371 float e012 = themap[0] + themap[1] + themap[2];
372 float e036 = themap[0] + themap[3] + themap[6];
373 float e678 = themap[6] + themap[7] + themap[8];
374 float e258 = themap[2] + themap[5] + themap[8];
376 if ((e012 > e678 || e012 == e678) && (e036 > e258 || e036 == e258))
377 return E22 = themap[0] + themap[1] + themap[3] + themap[4];
378 else if ((e012 > e678 || e012 == e678) && (e036 < e258 || e036 == e258))
379 return E22 = themap[1] + themap[2] + themap[4] + themap[5];
380 else if ((e012 < e678 || e012 == e678) && (e036 > e258 || e036 == e258))
381 return E22 = themap[3] + themap[4] + themap[6] + themap[7];
382 else if ((e012 < e678 || e012 == e678) && (e036 < e258 || e036 == e258))
383 return E22 = themap[4] + themap[5] + themap[7] + themap[8];
391 float e0_4 = themap[0] + themap[1] + themap[2] + themap[3] + themap[4];
392 float e0_20 = themap[0] + themap[5] + themap[10] + themap[15] + themap[20];
393 float e4_24 = themap[4] + themap[9] + themap[14] + themap[19] + themap[24];
394 float e0_24 = themap[20] + themap[21] + themap[22] + themap[23] + themap[24];
396 if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
397 return E44 = e33 + themap[0] + themap[1] + themap[2] + themap[3] + themap[5] + themap[10] + themap[15];
398 else if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
399 return E44 = e33 + themap[1] + themap[2] + themap[3] + themap[4] + themap[9] + themap[14] + themap[19];
400 else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
401 return E44 = e33 + themap[5] + themap[10] + themap[15] + themap[20] + themap[21] + themap[22] + themap[23];
402 else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
403 return E44 = e33 + themap[21] + themap[22] + themap[23] + themap[24] + themap[9] + themap[14] + themap[19];
411 uint32_t unitWithMaxEnergy = 0;
414 MapType::iterator iter;
415 for (iter = themap.begin(); iter != themap.end(); iter++) {
418 unitWithMaxEnergy = (*iter).first;
422 LogDebug(
"GeomInfo") <<
" max energy of " <<
maxEnergy <<
" GeV in Unit id " << unitWithMaxEnergy;
423 return unitWithMaxEnergy;