18 : g4InfoLabel(ps.getParameter<std::
string>(
"moduleLabelG4")),
19 EBHitsCollection(ps.getParameter<std::
string>(
"EBHitsCollection")),
20 ValidationCollection(ps.getParameter<std::
string>(
"ValidationCollection")) {
29 for (
int myStep = 0; myStep < 26; myStep++) {
36 ib.
setScope(MonitorElementData::Scope::RUN);
41 histo =
"EB crystals multiplicity";
44 histo =
"EB occupancy";
47 histo =
"EB longitudinal shower profile";
50 histo =
"EB hits energy spectrum";
53 histo =
"EB hits log10energy spectrum";
56 histo =
"EB hits log10energy spectrum vs normalized energy";
59 histo =
"EB hits log10energy spectrum vs normalized energy25";
62 histo =
"EB hits energy spectrum 2";
65 histo =
"EB crystal energy spectrum";
68 histo =
"EB crystal energy spectrum 2";
104 histo =
"EB E16oE25";
121 std::vector<PCaloHit> theEBCaloHits;
122 theEBCaloHits.insert(theEBCaloHits.end(), EcalHitsEB->begin(), EcalHitsEB->end());
126 double EBEnergy_ = 0.;
127 std::map<unsigned int, std::vector<PCaloHit *>, std::less<unsigned int>> CaloHitMap;
134 std::vector<double> econtr(140, 0.);
135 std::vector<double> econtr25(140, 0.);
138 uint32_t nEBHits = 0;
140 for (std::vector<PCaloHit>::iterator isim = theEBCaloHits.begin(); isim != theEBCaloHits.end(); ++isim) {
141 if (isim->time() > 500.) {
145 CaloHitMap[isim->id()].push_back(&(*isim));
149 LogDebug(
"HitInfo") <<
" CaloHit " << isim->getName() <<
"\n"
150 <<
" DetID = " << isim->id() <<
" EBDetId = " << ebid.ieta() <<
" " << ebid.iphi() <<
"\n"
151 <<
" Time = " << isim->time() <<
"\n"
152 <<
" Track Id = " << isim->geantTrackId() <<
"\n"
153 <<
" Energy = " << isim->energy();
157 uint32_t crystid = ebid.rawId();
158 ebmap[crystid] += isim->energy();
160 EBEnergy_ += isim->energy();
163 if (isim->energy() > 0) {
165 int log10i = int((log10(isim->energy()) + 10.) * 10.);
166 if (log10i >= 0 && log10i < 140)
167 econtr[log10i] += isim->energy();
174 for (std::map<uint32_t,
float, std::less<uint32_t>>::iterator it = ebmap.begin(); it != ebmap.end(); ++it)
178 for (std::map<uint32_t,
float, std::less<uint32_t>>::iterator it = ebmap.begin(); it != ebmap.end(); ++it)
188 int by = myEBid.
iphi();
189 int bz = myEBid.
zside();
197 std::vector<uint32_t> ids25;
200 for (
unsigned i = 0;
i < 25;
i++) {
201 for (
unsigned int j = 0;
j < CaloHitMap[ids25[
i]].size();
j++) {
202 if (CaloHitMap[ids25[
i]][
j]->
energy() > 0) {
203 int log10i = int((log10(CaloHitMap[ids25[
i]][
j]->
energy()) + 10.) * 10.);
204 if (log10i >= 0 && log10i < 140)
205 econtr25[log10i] += CaloHitMap[ids25[
i]][
j]->energy();
235 if (EBEnergy_ != 0) {
236 for (
int i = 0;
i < 140;
i++) {
242 for (
int i = 0;
i < 140;
i++) {
248 if (MyPEcalValidInfo.
isValid()) {
249 if (MyPEcalValidInfo->eb1x1() > 0.) {
250 std::vector<float> BX0 = MyPEcalValidInfo->bX0();
252 for (
int myStep = 0; myStep < 26; myStep++) {
261 int nCellInEta,
int nCellInPhi,
int centralEta,
int centralPhi,
int centralZ,
MapType &themap) {
263 float totalEnergy = 0.;
265 int goBackInEta = nCellInEta / 2;
266 int goBackInPhi = nCellInPhi / 2;
267 int startEta = centralZ * centralEta - goBackInEta;
268 int startPhi = centralPhi - goBackInPhi;
270 for (
int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
271 for (
int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
273 if (
abs(ieta) > 85 ||
abs(ieta) < 1) {
278 }
else if (iphi > 360) {
284 totalEnergy += themap[
index];
289 LogDebug(
"GeomInfo") << nCellInEta <<
" x " << nCellInPhi <<
" EB matrix energy = " << totalEnergy <<
" for "
290 << ncristals <<
" crystals";
295 int nCellInEta,
int nCellInPhi,
int centralEta,
int centralPhi,
int centralZ,
MapType &themap) {
297 std::vector<uint32_t> ids(nCellInEta * nCellInPhi);
299 int goBackInEta = nCellInEta / 2;
300 int goBackInPhi = nCellInPhi / 2;
301 int startEta = centralZ * centralEta - goBackInEta;
302 int startPhi = centralPhi - goBackInPhi;
304 for (
int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
305 for (
int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
307 if (
abs(ieta) > 85 ||
abs(ieta) < 1) {
312 }
else if (iphi > 360) {
317 ids[ncristals] =
index;
326 int nCellInEta,
int nCellInPhi,
int CentralEta,
int CentralPhi,
int CentralZ,
MapType &fillmap,
MapType &themap) {
327 int goBackInEta = nCellInEta / 2;
328 int goBackInPhi = nCellInPhi / 2;
330 int startEta = CentralZ * CentralEta - goBackInEta;
331 int startPhi = CentralPhi - goBackInPhi;
334 for (
int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
335 for (
int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
337 if (
abs(ieta) > 85 ||
abs(ieta) < 1) {
342 }
else if (iphi > 360) {
347 fillmap[i++] = themap[
index];
353 if (fillmap[i / 2] == themap[ebcenterid])
361 float e012 = themap[0] + themap[1] + themap[2];
362 float e036 = themap[0] + themap[3] + themap[6];
363 float e678 = themap[6] + themap[7] + themap[8];
364 float e258 = themap[2] + themap[5] + themap[8];
366 if ((e012 > e678 || e012 == e678) && (e036 > e258 || e036 == e258))
367 E22 = themap[0] + themap[1] + themap[3] + themap[4];
368 else if ((e012 > e678 || e012 == e678) && (e036 < e258 || e036 == e258))
369 E22 = themap[1] + themap[2] + themap[4] + themap[5];
370 else if ((e012 < e678 || e012 == e678) && (e036 > e258 || e036 == e258))
371 E22 = themap[3] + themap[4] + themap[6] + themap[7];
372 else if ((e012 < e678 || e012 == e678) && (e036 < e258 || e036 == e258))
373 E22 = themap[4] + themap[5] + themap[7] + themap[8];
380 float e0_4 = themap[0] + themap[1] + themap[2] + themap[3] + themap[4];
381 float e0_20 = themap[0] + themap[5] + themap[10] + themap[15] + themap[20];
382 float e4_24 = themap[4] + themap[9] + themap[14] + themap[19] + themap[24];
383 float e0_24 = themap[20] + themap[21] + themap[22] + themap[23] + themap[24];
385 if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
386 E44 = e33 + themap[0] + themap[1] + themap[2] + themap[3] + themap[5] + themap[10] + themap[15];
387 else if ((e0_4 > e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
388 E44 = e33 + themap[1] + themap[2] + themap[3] + themap[4] + themap[9] + themap[14] + themap[19];
389 else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 > e4_24 || e0_20 == e4_24))
390 E44 = e33 + themap[5] + themap[10] + themap[15] + themap[20] + themap[21] + themap[22] + themap[23];
391 else if ((e0_4 < e0_24 || e0_4 == e0_24) && (e0_20 < e4_24 || e0_20 == e4_24))
392 E44 = e33 + themap[21] + themap[22] + themap[23] + themap[24] + themap[9] + themap[14] + themap[19];
399 uint32_t unitWithMaxEnergy = 0;
400 float maxEnergy = 0.;
402 MapType::iterator iter;
403 for (iter = themap.begin(); iter != themap.end(); iter++) {
404 if (maxEnergy < (*iter).second) {
405 maxEnergy = (*iter).second;
406 unitWithMaxEnergy = (*iter).first;
410 LogDebug(
"GeomInfo") <<
" max energy of " << maxEnergy <<
" GeV in Unit id " << unitWithMaxEnergy;
411 return unitWithMaxEnergy;
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
const edm::EventSetup & c
std::vector< uint32_t > getIdsAroundMax(int nCellInEta, int nCellInPhi, int centralEta, int centralPhi, int centralZ, MapType &themap)
MonitorElement * meEBhitLog10Energy_
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * meEBe16oe25_
MonitorElement * meEBe16_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * meEBe9oe16_
MonitorElement * meEBe1oe9_
virtual MonitorElementData::Scope setScope(MonitorElementData::Scope newscope)
constexpr uint32_t rawId() const
get the raw id
MonitorElement * meEBhitLog10EnergyNorm_
MonitorElement * meEBe9oe25_
MonitorElement * menEBCrystals_
MonitorElement * meEBe25_
MonitorElement * meEBhitLog10Energy25Norm_
MonitorElement * menEBHits_
void bookHistograms(DQMStore::IBooker &ib, edm::Run const &, edm::EventSetup const &c) override
int iphi() const
get the crystal iphi
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
float eCluster4x4(float e33, MapType &themap)
MonitorElement * meEBe1oe4_
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())
std::string ValidationCollection
MonitorElement * meEBLongitudinalShower_
std::map< uint32_t, float, std::less< uint32_t > > MapType
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< edm::PCaloHitContainer > EBHitsToken
edm::EDGetTokenT< PEcalValidInfo > ValidationCollectionToken
MonitorElement * meEBe4oe9_
uint32_t getUnitWithMaxEnergy(MapType &themap)
virtual float energyInMatrixEB(int nCellInEta, int nCellInPhi, int centralEta, int centralPhi, int centralZ, MapType &themap)
MonitorElement * meEBcrystalEnergy2_
Log< level::Info, false > LogInfo
std::string EBHitsCollection
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * meEBhitEnergy2_
float eCluster2x2(MapType &themap)
bool fillEBMatrix(int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &fillmap, MapType &themap)
MonitorElement * meEBOccupancy_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
int ietaAbs() const
get the absolute value of the crystal ieta
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
MonitorElement * meEBcrystalEnergy_
MonitorElement * meEBhitEnergy_
int zside() const
get the z-side of the crystal (1/-1)
EcalBarrelSimHitsValidation(const edm::ParameterSet &ps)
Constructor.
MonitorElement * meEBe1oe25_