File indexing completed on 2024-04-06 12:32:07
0001
0002
0003
0004
0005
0006
0007
0008 #include "DQMServices/Core/interface/DQMStore.h"
0009 #include <DataFormats/EcalDetId/interface/EEDetId.h>
0010 #include <DataFormats/EcalDetId/interface/ESDetId.h>
0011 #include <Validation/EcalRecHits/interface/EcalPreshowerRecHitsValidation.h>
0012
0013 using namespace cms;
0014 using namespace edm;
0015 using namespace std;
0016
0017 EcalPreshowerRecHitsValidation::EcalPreshowerRecHitsValidation(const ParameterSet &ps) {
0018
0019 EEuncalibrechitCollection_token_ =
0020 consumes<EEUncalibratedRecHitCollection>(ps.getParameter<edm::InputTag>("EEuncalibrechitCollection"));
0021 EErechitCollection_token_ = consumes<EERecHitCollection>(ps.getParameter<edm::InputTag>("EErechitCollection"));
0022 ESrechitCollection_token_ = consumes<ESRecHitCollection>(ps.getParameter<edm::InputTag>("ESrechitCollection"));
0023
0024
0025
0026 verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
0027
0028
0029 meESRecHitsEnergy_ = nullptr;
0030 meESRecHitsEnergy_zp1st_ = nullptr;
0031 meESRecHitsEnergy_zp2nd_ = nullptr;
0032 meESRecHitsEnergy_zm1st_ = nullptr;
0033 meESRecHitsEnergy_zm2nd_ = nullptr;
0034 meESRecHitsMultip_ = nullptr;
0035 meESRecHitsMultip_zp1st_ = nullptr;
0036 meESRecHitsMultip_zp2nd_ = nullptr;
0037 meESRecHitsMultip_zm1st_ = nullptr;
0038 meESRecHitsMultip_zm2nd_ = nullptr;
0039 meESEERecHitsEnergy_zp_ = nullptr;
0040 meESEERecHitsEnergy_zm_ = nullptr;
0041
0042 for (int kk = 0; kk < 32; kk++) {
0043 meESRecHitsStripOccupancy_zp1st_[kk] = nullptr;
0044 meESRecHitsStripOccupancy_zm1st_[kk] = nullptr;
0045 meESRecHitsStripOccupancy_zp2nd_[kk] = nullptr;
0046 meESRecHitsStripOccupancy_zm2nd_[kk] = nullptr;
0047 }
0048 }
0049
0050 EcalPreshowerRecHitsValidation::~EcalPreshowerRecHitsValidation() {}
0051
0052 void EcalPreshowerRecHitsValidation::bookHistograms(DQMStore::IBooker &ibooker,
0053 edm::Run const &,
0054 edm::EventSetup const &) {
0055 Char_t histo[200];
0056
0057 ibooker.setCurrentFolder("EcalRecHitsV/EcalPreshowerRecHitsTask");
0058
0059 sprintf(histo, "ES Energy");
0060 meESRecHitsEnergy_ = ibooker.book1D(histo, histo, 210, -0.0005, 0.01);
0061
0062 sprintf(histo, "ES Energy Plane1 Side+");
0063 meESRecHitsEnergy_zp1st_ = ibooker.book1D(histo, histo, 210, -0.0005, 0.01);
0064
0065 sprintf(histo, "ES Energy Plane2 Side+");
0066 meESRecHitsEnergy_zp2nd_ = ibooker.book1D(histo, histo, 210, -0.0005, 0.01);
0067
0068 sprintf(histo, "ES Energy Plane1 Side-");
0069 meESRecHitsEnergy_zm1st_ = ibooker.book1D(histo, histo, 210, -0.0005, 0.01);
0070
0071 sprintf(histo, "ES Energy Plane2 Side-");
0072 meESRecHitsEnergy_zm2nd_ = ibooker.book1D(histo, histo, 210, -0.0005, 0.01);
0073
0074 sprintf(histo, "ES Multiplicity");
0075 meESRecHitsMultip_ = ibooker.book1D(histo, histo, 100, 0., 700.);
0076
0077 sprintf(histo, "ES Multiplicity Plane1 Side+");
0078 meESRecHitsMultip_zp1st_ = ibooker.book1D(histo, histo, 100, 0., 700.);
0079
0080 sprintf(histo, "ES Multiplicity Plane2 Side+");
0081 meESRecHitsMultip_zp2nd_ = ibooker.book1D(histo, histo, 100, 0., 700.);
0082
0083 sprintf(histo, "ES Multiplicity Plane1 Side-");
0084 meESRecHitsMultip_zm1st_ = ibooker.book1D(histo, histo, 100, 0., 700.);
0085
0086 sprintf(histo, "ES Multiplicity Plane2 Side-");
0087 meESRecHitsMultip_zm2nd_ = ibooker.book1D(histo, histo, 100, 0., 700.);
0088
0089 sprintf(histo, "Preshower EE vs ES energy Side+");
0090 meESEERecHitsEnergy_zp_ = ibooker.book2D(histo, histo, 100, 0., 0.2, 100, 0., 150.);
0091
0092 sprintf(histo, "Preshower EE vs ES energy Side-");
0093 meESEERecHitsEnergy_zm_ = ibooker.book2D(histo, histo, 100, 0., 0.2, 100, 0., 150.);
0094
0095 for (int kk = 0; kk < 32; kk++) {
0096 sprintf(histo, "ES Occupancy Plane1 Side+ Strip%02d", kk + 1);
0097 meESRecHitsStripOccupancy_zp1st_[kk] = ibooker.book2D(histo, histo, 40, 0., 40., 40, 0., 40.);
0098
0099 sprintf(histo, "ES Occupancy Plane2 Side+ Strip%02d", kk + 1);
0100 meESRecHitsStripOccupancy_zp2nd_[kk] = ibooker.book2D(histo, histo, 40, 0., 40., 40, 0., 40.);
0101
0102 sprintf(histo, "ES Occupancy Plane1 Side- Strip%02d", kk + 1);
0103 meESRecHitsStripOccupancy_zm1st_[kk] = ibooker.book2D(histo, histo, 40, 0., 40., 40, 0., 40.);
0104
0105 sprintf(histo, "ES Occupancy Plane2 Side- Strip%02d", kk + 1);
0106 meESRecHitsStripOccupancy_zm2nd_[kk] = ibooker.book2D(histo, histo, 40, 0., 40., 40, 0., 40.);
0107 }
0108 }
0109
0110 void EcalPreshowerRecHitsValidation::analyze(const Event &e, const EventSetup &c) {
0111 const ESRecHitCollection *ESRecHit = nullptr;
0112 Handle<ESRecHitCollection> EcalRecHitES;
0113 e.getByToken(ESrechitCollection_token_, EcalRecHitES);
0114 if (EcalRecHitES.isValid()) {
0115 ESRecHit = EcalRecHitES.product();
0116 } else {
0117 return;
0118 }
0119
0120 bool skipEE = false;
0121 const EERecHitCollection *EERecHit = nullptr;
0122 Handle<EERecHitCollection> EcalRecHitEE;
0123 e.getByToken(EErechitCollection_token_, EcalRecHitEE);
0124 if (EcalRecHitEE.isValid()) {
0125 EERecHit = EcalRecHitEE.product();
0126 } else {
0127 skipEE = true;
0128 }
0129
0130 const EEUncalibratedRecHitCollection *EEUncalibRecHit = nullptr;
0131 Handle<EEUncalibratedRecHitCollection> EcalUncalibRecHitEE;
0132 e.getByToken(EEuncalibrechitCollection_token_, EcalUncalibRecHitEE);
0133 if (EcalUncalibRecHitEE.isValid()) {
0134 EEUncalibRecHit = EcalUncalibRecHitEE.product();
0135 } else {
0136 skipEE = true;
0137 }
0138
0139
0140
0141
0142 int mult_tot = 0;
0143 int mult_zp1st = 0;
0144 int mult_zp2nd = 0;
0145 int mult_zm1st = 0;
0146 int mult_zm2nd = 0;
0147
0148
0149 float ene_zp1st = 0.;
0150 float ene_zp2nd = 0.;
0151 float ene_zm1st = 0.;
0152 float ene_zm2nd = 0.;
0153
0154
0155 for (ESRecHitCollection::const_iterator recHit = ESRecHit->begin(); recHit != ESRecHit->end(); ++recHit) {
0156 ESDetId ESid = ESDetId(recHit->id());
0157
0158 int zside = ESid.zside();
0159 int plane = ESid.plane();
0160 int six = ESid.six();
0161 int siy = ESid.siy();
0162 int strip = ESid.strip();
0163
0164
0165 mult_tot++;
0166 if (meESRecHitsEnergy_)
0167 meESRecHitsEnergy_->Fill(recHit->energy());
0168
0169
0170 if ((zside == +1) && (plane == 1)) {
0171 mult_zp1st++;
0172 ene_zp1st += recHit->energy();
0173 if (meESRecHitsEnergy_zp1st_) {
0174 meESRecHitsEnergy_zp1st_->Fill(recHit->energy());
0175 }
0176 if (meESRecHitsStripOccupancy_zp1st_[strip - 1]) {
0177 meESRecHitsStripOccupancy_zp1st_[strip - 1]->Fill(six, siy);
0178 }
0179 }
0180
0181
0182 if ((zside == +1) && (plane == 2)) {
0183 mult_zp2nd++;
0184 ene_zp2nd += recHit->energy();
0185 if (meESRecHitsEnergy_zp2nd_) {
0186 meESRecHitsEnergy_zp2nd_->Fill(recHit->energy());
0187 }
0188 if (meESRecHitsStripOccupancy_zp2nd_[strip - 1]) {
0189 meESRecHitsStripOccupancy_zp2nd_[strip - 1]->Fill(six, siy);
0190 }
0191 }
0192
0193
0194 if ((zside == -1) && (plane == 1)) {
0195 mult_zm1st++;
0196 ene_zm1st += recHit->energy();
0197 if (meESRecHitsEnergy_zm1st_) {
0198 meESRecHitsEnergy_zm1st_->Fill(recHit->energy());
0199 }
0200 if (meESRecHitsStripOccupancy_zm1st_[strip - 1]) {
0201 meESRecHitsStripOccupancy_zm1st_[strip - 1]->Fill(six, siy);
0202 }
0203 }
0204
0205
0206 if ((zside == -1) && (plane == 2)) {
0207 mult_zm2nd++;
0208 ene_zm2nd += recHit->energy();
0209 if (meESRecHitsEnergy_zm2nd_) {
0210 meESRecHitsEnergy_zm2nd_->Fill(recHit->energy());
0211 }
0212 if (meESRecHitsStripOccupancy_zm2nd_[strip - 1]) {
0213 meESRecHitsStripOccupancy_zm2nd_[strip - 1]->Fill(six, siy);
0214 }
0215 }
0216
0217 }
0218
0219
0220 double zpEE = 0.;
0221 double zmEE = 0.;
0222 if (!skipEE) {
0223 for (EcalUncalibratedRecHitCollection::const_iterator uncalibRecHit = EEUncalibRecHit->begin();
0224 uncalibRecHit != EEUncalibRecHit->end();
0225 ++uncalibRecHit) {
0226 EEDetId EEid = EEDetId(uncalibRecHit->id());
0227 int mySide = EEid.zside();
0228
0229
0230 EcalRecHitCollection::const_iterator myRecHit = EERecHit->find(EEid);
0231
0232 if (myRecHit != EERecHit->end()) {
0233 if (mySide > 0) {
0234 zpEE = zpEE + myRecHit->energy();
0235 }
0236 if (mySide < 0) {
0237 zmEE = zmEE + myRecHit->energy();
0238 }
0239 }
0240 }
0241 }
0242
0243
0244 if (meESRecHitsMultip_) {
0245 meESRecHitsMultip_->Fill(mult_tot);
0246 }
0247 if (meESRecHitsMultip_zp1st_) {
0248 meESRecHitsMultip_zp1st_->Fill(mult_zp1st);
0249 }
0250 if (meESRecHitsMultip_zp2nd_) {
0251 meESRecHitsMultip_zp2nd_->Fill(mult_zp2nd);
0252 }
0253 if (meESRecHitsMultip_zm1st_) {
0254 meESRecHitsMultip_zm1st_->Fill(mult_zm1st);
0255 }
0256 if (meESRecHitsMultip_zm2nd_) {
0257 meESRecHitsMultip_zm2nd_->Fill(mult_zm2nd);
0258 }
0259 if (meESEERecHitsEnergy_zp_) {
0260 meESEERecHitsEnergy_zp_->Fill((ene_zp1st + 0.7 * ene_zp2nd) / 0.09, zpEE);
0261 }
0262 if (meESEERecHitsEnergy_zm_) {
0263 meESEERecHitsEnergy_zm_->Fill((ene_zm1st + 0.7 * ene_zm2nd) / 0.09, zmEE);
0264 }
0265 }