18 : g4InfoLabel(ps.getParameter<std::
string>(
"moduleLabelG4")),
19 EEHitsCollection(ps.getParameter<std::
string>(
"EEHitsCollection")),
20 ValidationCollection(ps.getParameter<std::
string>(
"ValidationCollection")) {
29 for (
int myStep = 0; myStep < 26; myStep++) {
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";
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 E22 = themap[0] + themap[1] + themap[3] + themap[4];
378 else if ((e012 > e678 || e012 == e678) && (e036 < e258 || e036 == e258))
379 E22 = themap[1] + themap[2] + themap[4] + themap[5];
380 else if ((e012 < e678 || e012 == e678) && (e036 > e258 || e036 == e258))
381 E22 = themap[3] + themap[4] + themap[6] + themap[7];
382 else if ((e012 < e678 || e012 == e678) && (e036 < e258 || e036 == e258))
383 E22 = themap[4] + themap[5] + themap[7] + themap[8];
390 float e0_4 = themap[0] + themap[1] + themap[2] + themap[3] + themap[4];
391 float e0_20 = themap[0] + themap[5] + themap[10] + themap[15] + themap[20];
392 float e4_24 = themap[4] + themap[9] + themap[14] + themap[19] + themap[24];
393 float e0_24 = themap[20] + themap[21] + themap[22] + themap[23] + themap[24];
395 if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
396 E44 = e33 + themap[0] + themap[1] + themap[2] + themap[3] + themap[5] + themap[10] + themap[15];
397 else if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
398 E44 = e33 + themap[1] + themap[2] + themap[3] + themap[4] + themap[9] + themap[14] + themap[19];
399 else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
400 E44 = e33 + themap[5] + themap[10] + themap[15] + themap[20] + themap[21] + themap[22] + themap[23];
401 else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
402 E44 = e33 + themap[21] + themap[22] + themap[23] + themap[24] + themap[9] + themap[14] + themap[19];
409 uint32_t unitWithMaxEnergy = 0;
410 float maxEnergy = 0.;
412 MapType::iterator iter;
413 for (iter = themap.begin(); iter != themap.end(); iter++) {
414 if (maxEnergy < (*iter).second) {
415 maxEnergy = (*iter).second;
416 unitWithMaxEnergy = (*iter).first;
420 LogDebug(
"GeomInfo") <<
" max energy of " << maxEnergy <<
" GeV in Unit id " << unitWithMaxEnergy;
421 return unitWithMaxEnergy;
EventNumber_t event() const
MonitorElement * meEEe9oe16_
T getUntrackedParameter(std::string const &, T const &) const
const edm::EventSetup & c
void bookHistograms(DQMStore::IBooker &ib, edm::Run const &, edm::EventSetup const &c) override
MonitorElement * meEEzpCrystals_
virtual void setCurrentFolder(std::string const &fullpath)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
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
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
MonitorElement * meEEcrystalEnergy_
MonitorElement * meEEe4oe9_
MonitorElement * meEEzpOccupancy_
MonitorElement * meEEe16oe25_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
float eCluster4x4(float e33, MapType &themap)
std::string EEHitsCollection
MonitorElement * meEELongitudinalShower_
std::string ValidationCollection
MonitorElement * meEEe9oe25_
MonitorElement * meEEzmCrystals_
MonitorElement * meEEhitLog10Energy25Norm_
bool fillEEMatrix(int nCellInX, int nCellInY, int CentralX, int CentralY, int CentralZ, MapType &fillmap, MapType &themap)
MonitorElement * meEEcrystalEnergy2_
MonitorElement * meEEHitEnergy_
MonitorElement * meEEzpHits_
Log< level::Info, false > LogInfo
MonitorElement * meEEe1oe9_
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * meEEe1oe25_
edm::EDGetTokenT< edm::PCaloHitContainer > EEHitsToken
uint32_t getUnitWithMaxEnergy(MapType &themap)
MonitorElement * meEEe25_
MonitorElement * meEEhitLog10Energy_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
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.