18 : g4InfoLabel(ps.getParameter<
std::
string>(
"moduleLabelG4")),
41 dbe_->showDirStructure();
74 for (
int myStep = 0; myStep < 26; myStep++) {
81 dbe_->setCurrentFolder(
"EcalHitsV/EcalSimHitsValidation");
83 sprintf(histo,
"EE+ hits multiplicity");
84 meEEzpHits_ = dbe_->book1D(histo, histo, 50, 0., 5000.);
86 sprintf(histo,
"EE- hits multiplicity");
87 meEEzmHits_ = dbe_->book1D(histo, histo, 50, 0., 5000.);
89 sprintf(histo,
"EE+ crystals multiplicity");
92 sprintf(histo,
"EE- crystals multiplicity");
95 sprintf(histo,
"EE+ occupancy");
98 sprintf(histo,
"EE- occupancy");
101 sprintf(histo,
"EE longitudinal shower profile");
104 sprintf(histo,
"EE hits energy spectrum");
107 sprintf(histo,
"EE hits log10energy spectrum");
110 sprintf(histo,
"EE hits log10energy spectrum vs normalized energy");
113 sprintf(histo,
"EE hits log10energy spectrum vs normalized energy25");
116 sprintf(histo,
"EE hits energy spectrum 2");
119 sprintf(histo,
"EE crystal energy spectrum");
122 sprintf(histo,
"EE crystal energy spectrum 2");
125 sprintf(histo,
"EE E1");
126 meEEe1_ = dbe_->book1D(histo, histo, 400, 0., 400.);
128 sprintf(histo,
"EE E4");
129 meEEe4_ = dbe_->book1D(histo, histo, 400, 0., 400.);
131 sprintf(histo,
"EE E9");
132 meEEe9_ = dbe_->book1D(histo, histo, 400, 0., 400.);
134 sprintf(histo,
"EE E16");
135 meEEe16_ = dbe_->book1D(histo, histo, 400, 0., 400.);
137 sprintf(histo,
"EE E25");
138 meEEe25_ = dbe_->book1D(histo, histo, 400, 0., 400.);
140 sprintf(histo,
"EE E1oE4");
141 meEEe1oe4_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
143 sprintf(histo,
"EE E1oE9");
144 meEEe1oe9_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
146 sprintf(histo,
"EE E4oE9");
147 meEEe4oe9_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
149 sprintf(histo,
"EE E9oE16");
150 meEEe9oe16_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
152 sprintf(histo,
"EE E1oE25");
153 meEEe1oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
155 sprintf(histo,
"EE E9oE25");
156 meEEe9oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
158 sprintf(histo,
"EE E16oE25");
159 meEEe16oe25_ = dbe_->book1D(histo, histo, 100, 0.4, 1.1);
187 std::vector<PCaloHit> theEECaloHits;
188 theEECaloHits.insert(theEECaloHits.end(), EcalHitsEE->begin(), EcalHitsEE->end());
192 std::map<unsigned int, std::vector<PCaloHit *>, std::less<unsigned int>> CaloHitMap;
202 std::vector<double> econtr(140, 0.);
203 std::vector<double> econtr25(140, 0.);
208 uint32_t nEEzpHits = 0;
209 uint32_t nEEzmHits = 0;
211 for (std::vector<PCaloHit>::iterator isim = theEECaloHits.begin(); isim != theEECaloHits.end(); ++isim) {
212 if (isim->time() > 500.) {
216 CaloHitMap[isim->id()].push_back(&(*isim));
220 LogDebug(
"HitInfo") <<
" CaloHit " << isim->getName() <<
"\n" 221 <<
" DetID = " << isim->id() <<
" EEDetId = " << eeid.ix() <<
" " << eeid.iy() <<
"\n" 222 <<
" Time = " << isim->time() <<
"\n" 223 <<
" Track Id = " << isim->geantTrackId() <<
"\n" 224 <<
" Energy = " << isim->energy();
226 uint32_t crystid = eeid.rawId();
228 if (eeid.zside() > 0) {
230 EEetzp_ += isim->energy();
231 eemapzp[crystid] += isim->energy();
234 }
else if (eeid.zside() < 0) {
236 EEetzm_ += isim->energy();
237 eemapzm[crystid] += isim->energy();
244 if (isim->energy() > 0) {
247 int log10i =
int((log10(isim->energy()) + 10.) * 10.);
248 if (log10i >= 0 && log10i < 140)
249 econtr[log10i] += isim->energy();
253 eemap[crystid] += isim->energy();
262 for (
std::map<uint32_t,
float, std::less<uint32_t>>::iterator it = eemap.begin(); it != eemap.end(); ++it)
266 for (
std::map<uint32_t,
float, std::less<uint32_t>>::iterator it = eemap.begin(); it != eemap.end(); ++it)
275 int nEEHits = nEEzmHits + nEEzpHits;
279 int bx = myEEid.
ix();
280 int by = myEEid.
iy();
281 int bz = myEEid.
zside();
292 std::vector<uint32_t> ids25;
295 for (
unsigned i = 0;
i < 25;
i++) {
296 for (
unsigned int j = 0; j < CaloHitMap[ids25[
i]].size(); j++) {
297 if (CaloHitMap[ids25[
i]][j]->energy() > 0) {
298 int log10i =
int((log10(CaloHitMap[ids25[
i]][j]->energy()) + 10.) * 10.);
299 if (log10i >= 0 && log10i < 140)
300 econtr25[log10i] += CaloHitMap[ids25[
i]][j]->energy();
333 for (
int i = 0;
i < 140;
i++) {
339 for (
int i = 0;
i < 140;
i++) {
345 if (MyPEcalValidInfo.
isValid()) {
346 if (MyPEcalValidInfo->
ee1x1() > 0.) {
347 std::vector<float> EX0 = MyPEcalValidInfo->
eX0();
350 for (
int myStep = 0; myStep < 26; myStep++) {
360 int nCellInX,
int nCellInY,
int centralX,
int centralY,
int centralZ,
MapType &themap) {
362 float totalEnergy = 0.;
364 int goBackInX = nCellInX / 2;
365 int goBackInY = nCellInY / 2;
366 int startX = centralX - goBackInX;
367 int startY = centralY - goBackInY;
369 for (
int ix = startX; ix < startX + nCellInX; ix++) {
370 for (
int iy = startY; iy < startY + nCellInY; iy++) {
379 totalEnergy += themap[
index];
384 LogDebug(
"GeomInfo") << nCellInX <<
" x " << nCellInY <<
" EE matrix energy = " << totalEnergy <<
" for " << ncristals
390 int nCellInX,
int nCellInY,
int centralX,
int centralY,
int centralZ,
MapType &themap) {
392 std::vector<uint32_t>
ids(nCellInX * nCellInY);
394 int goBackInX = nCellInX / 2;
395 int goBackInY = nCellInY / 2;
396 int startX = centralX - goBackInX;
397 int startY = centralY - goBackInY;
399 for (
int ix = startX; ix < startX + nCellInX; ix++) {
400 for (
int iy = startY; iy < startY + nCellInY; iy++) {
409 ids[ncristals] =
index;
418 int nCellInX,
int nCellInY,
int CentralX,
int CentralY,
int CentralZ,
MapType &fillmap,
MapType &themap) {
419 int goBackInX = nCellInX / 2;
420 int goBackInY = nCellInY / 2;
422 int startX = CentralX - goBackInX;
423 int startY = CentralY - goBackInY;
426 for (
int ix = startX; ix < startX + nCellInX; ix++) {
427 for (
int iy = startY; iy < startY + nCellInY; iy++) {
435 fillmap[i++] = themap[
index];
440 if (fillmap[i / 2] == themap[centerid])
448 float e012 = themap[0] + themap[1] + themap[2];
449 float e036 = themap[0] + themap[3] + themap[6];
450 float e678 = themap[6] + themap[7] + themap[8];
451 float e258 = themap[2] + themap[5] + themap[8];
453 if ((e012 > e678 || e012 == e678) && (e036 > e258 || e036 == e258))
454 return E22 = themap[0] + themap[1] + themap[3] + themap[4];
455 else if ((e012 > e678 || e012 == e678) && (e036 < e258 || e036 == e258))
456 return E22 = themap[1] + themap[2] + themap[4] + themap[5];
457 else if ((e012 < e678 || e012 == e678) && (e036 > e258 || e036 == e258))
458 return E22 = themap[3] + themap[4] + themap[6] + themap[7];
459 else if ((e012 < e678 || e012 == e678) && (e036 < e258 || e036 == e258))
460 return E22 = themap[4] + themap[5] + themap[7] + themap[8];
468 float e0_4 = themap[0] + themap[1] + themap[2] + themap[3] + themap[4];
469 float e0_20 = themap[0] + themap[5] + themap[10] + themap[15] + themap[20];
470 float e4_24 = themap[4] + themap[9] + themap[14] + themap[19] + themap[24];
471 float e0_24 = themap[20] + themap[21] + themap[22] + themap[23] + themap[24];
473 if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
474 return E44 = e33 + themap[0] + themap[1] + themap[2] + themap[3] + themap[5] + themap[10] + themap[15];
475 else if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
476 return E44 = e33 + themap[1] + themap[2] + themap[3] + themap[4] + themap[9] + themap[14] + themap[19];
477 else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
478 return E44 = e33 + themap[5] + themap[10] + themap[15] + themap[20] + themap[21] + themap[22] + themap[23];
479 else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
480 return E44 = e33 + themap[21] + themap[22] + themap[23] + themap[24] + themap[9] + themap[14] + themap[19];
488 uint32_t unitWithMaxEnergy = 0;
491 MapType::iterator iter;
492 for (iter = themap.begin(); iter != themap.end(); iter++) {
493 if (maxEnergy < (*iter).second) {
494 maxEnergy = (*iter).second;
495 unitWithMaxEnergy = (*iter).first;
499 LogDebug(
"GeomInfo") <<
" max energy of " << maxEnergy <<
" GeV in Unit id " << unitWithMaxEnergy;
500 return unitWithMaxEnergy;
EventNumber_t event() const
MonitorElement * meEEe9oe16_
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meEEzpCrystals_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
~EcalEndcapSimHitsValidation() override
Destructor.
constexpr uint32_t rawId() const
get the raw id
edm::EDGetTokenT< PEcalValidInfo > ValidationCollectionToken
virtual float energyInMatrixEE(int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap)
MonitorElement * meEEe16_
MonitorElement * meEEzmHits_
MonitorElement * meEEe1oe4_
MonitorElement * meEEzmOccupancy_
MonitorElement * meEEHitEnergy2_
std::map< uint32_t, float, std::less< uint32_t > > MapType
MonitorElement * meEEcrystalEnergy_
MonitorElement * meEEe4oe9_
MonitorElement * meEEzpOccupancy_
MonitorElement * meEEe16oe25_
float eCluster4x4(float e33, MapType &themap)
std::string EEHitsCollection
MonitorElement * meEELongitudinalShower_
std::string ValidationCollection
MonitorElement * meEEe9oe25_
MonitorElement * meEEzmCrystals_
void Reset()
reset ME (ie. contents, errors, etc)
MonitorElement * meEEhitLog10Energy25Norm_
bool fillEEMatrix(int nCellInX, int nCellInY, int CentralX, int CentralY, int CentralZ, MapType &fillmap, MapType &themap)
MonitorElement * meEEcrystalEnergy2_
MonitorElement * meEEHitEnergy_
Namespace of DDCMS conversion namespace.
MonitorElement * meEEzpHits_
MonitorElement * meEEe1oe9_
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
MonitorElement * meEEe1oe25_
edm::EDGetTokenT< edm::PCaloHitContainer > EEHitsToken
void endJob(void) override
uint32_t getUnitWithMaxEnergy(MapType &themap)
MonitorElement * meEEe25_
MonitorElement * meEEhitLog10Energy_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
MonitorElement * meEEhitLog10EnergyNorm_
std::vector< uint32_t > getIdsAroundMax(int nCellInX, int nCellInY, int centralX, int centralY, int centralZ, MapType &themap)
float eCluster2x2(MapType &themap)
EcalEndcapSimHitsValidation(const edm::ParameterSet &ps)
Constructor.