File indexing completed on 2024-04-06 12:09:28
0001 #include "DQMOffline/JetMET/interface/ECALRecHitAnalyzer.h"
0002 #include "DQMServices/Core/interface/DQMStore.h"
0003 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0004
0005
0006
0007
0008 #define DEBUG(X) \
0009 { \
0010 if (debug_) { \
0011 std::cout << X << std::endl; \
0012 } \
0013 }
0014
0015 ECALRecHitAnalyzer::ECALRecHitAnalyzer(const edm::ParameterSet& iConfig) {
0016
0017 EBRecHitsLabel_ = consumes<EBRecHitCollection>(iConfig.getParameter<edm::InputTag>("EBRecHitsLabel"));
0018 EERecHitsLabel_ = consumes<EERecHitCollection>(iConfig.getParameter<edm::InputTag>("EERecHitsLabel"));
0019 caloGeomToken_ = esConsumes<edm::Transition::BeginRun>();
0020 FolderName_ = iConfig.getUntrackedParameter<std::string>("FolderName");
0021 debug_ = iConfig.getParameter<bool>("Debug");
0022
0023
0024 }
0025
0026 void ECALRecHitAnalyzer::dqmbeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
0027 CurrentEvent = -1;
0028 caloGeom_ = &iSetup.getData(caloGeomToken_);
0029
0030 FillGeometry(iSetup);
0031 }
0032
0033 void ECALRecHitAnalyzer::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const&) {
0034
0035
0036 ibooker.setCurrentFolder(FolderName_ + "/geometry");
0037
0038
0039 hEB_ieta_iphi_etaMap = ibooker.book2D("hEB_ieta_iphi_etaMap", "", 171, -85, 86, 360, 1, 361);
0040 hEB_ieta_iphi_phiMap = ibooker.book2D("hEB_ieta_iphi_phiMap", "", 171, -85, 86, 360, 1, 361);
0041 hEB_ieta_detaMap = ibooker.book1D("hEB_ieta_detaMap", "", 171, -85, 86);
0042 hEB_ieta_dphiMap = ibooker.book1D("hEB_ieta_dphiMap", "", 171, -85, 86);
0043
0044 hEEpZ_ix_iy_irMap = ibooker.book2D("hEEpZ_ix_iy_irMap", "", 100, 1, 101, 100, 1, 101);
0045 hEEpZ_ix_iy_xMap = ibooker.book2D("hEEpZ_ix_iy_xMap", "", 100, 1, 101, 100, 1, 101);
0046 hEEpZ_ix_iy_yMap = ibooker.book2D("hEEpZ_ix_iy_yMap", "", 100, 1, 101, 100, 1, 101);
0047 hEEpZ_ix_iy_zMap = ibooker.book2D("hEEpZ_ix_iy_zMap", "", 100, 1, 101, 100, 1, 101);
0048 hEEpZ_ix_iy_dxMap = ibooker.book2D("hEEpZ_ix_iy_dxMap", "", 100, 1, 101, 100, 1, 101);
0049 hEEpZ_ix_iy_dyMap = ibooker.book2D("hEEpZ_ix_iy_dyMap", "", 100, 1, 101, 100, 1, 101);
0050
0051 hEEmZ_ix_iy_irMap = ibooker.book2D("hEEmZ_ix_iy_irMap", "", 100, 1, 101, 100, 1, 101);
0052 hEEmZ_ix_iy_xMap = ibooker.book2D("hEEmZ_ix_iy_xMap", "", 100, 1, 101, 100, 1, 101);
0053 hEEmZ_ix_iy_yMap = ibooker.book2D("hEEmZ_ix_iy_yMap", "", 100, 1, 101, 100, 1, 101);
0054 hEEmZ_ix_iy_zMap = ibooker.book2D("hEEmZ_ix_iy_zMap", "", 100, 1, 101, 100, 1, 101);
0055 hEEmZ_ix_iy_dxMap = ibooker.book2D("hEEmZ_ix_iy_dxMap", "", 100, 1, 101, 100, 1, 101);
0056 hEEmZ_ix_iy_dyMap = ibooker.book2D("hEEmZ_ix_iy_dyMap", "", 100, 1, 101, 100, 1, 101);
0057
0058
0059 for (int i = 1; i <= 100; i++)
0060 for (int j = 1; j <= 100; j++) {
0061 hEEpZ_ix_iy_irMap->setBinContent(i, j, -999);
0062 hEEpZ_ix_iy_xMap->setBinContent(i, j, -999);
0063 hEEpZ_ix_iy_yMap->setBinContent(i, j, -999);
0064 hEEpZ_ix_iy_zMap->setBinContent(i, j, -999);
0065 hEEpZ_ix_iy_dxMap->setBinContent(i, j, -999);
0066 hEEpZ_ix_iy_dyMap->setBinContent(i, j, -999);
0067
0068 hEEmZ_ix_iy_irMap->setBinContent(i, j, -999);
0069 hEEmZ_ix_iy_xMap->setBinContent(i, j, -999);
0070 hEEmZ_ix_iy_yMap->setBinContent(i, j, -999);
0071 hEEmZ_ix_iy_zMap->setBinContent(i, j, -999);
0072 hEEmZ_ix_iy_dxMap->setBinContent(i, j, -999);
0073 hEEmZ_ix_iy_dyMap->setBinContent(i, j, -999);
0074 }
0075
0076 for (int i = 1; i <= 171; i++) {
0077 hEB_ieta_detaMap->setBinContent(i, -999);
0078 hEB_ieta_dphiMap->setBinContent(i, -999);
0079 for (int j = 1; j <= 360; j++) {
0080 hEB_ieta_iphi_etaMap->setBinContent(i, j, -999);
0081 hEB_ieta_iphi_phiMap->setBinContent(i, j, -999);
0082 }
0083 }
0084
0085
0086 ibooker.setCurrentFolder(FolderName_);
0087
0088 hECAL_Nevents = ibooker.book1D("hECAL_Nevents", "", 1, 0, 1);
0089
0090
0091 hEEpZ_energy_ix_iy = ibooker.book2D("hEEpZ_energy_ix_iy", "", 100, 1, 101, 100, 1, 101);
0092 hEEmZ_energy_ix_iy = ibooker.book2D("hEEmZ_energy_ix_iy", "", 100, 1, 101, 100, 1, 101);
0093 hEB_energy_ieta_iphi = ibooker.book2D("hEB_energy_ieta_iphi", "", 171, -85, 86, 360, 1, 361);
0094
0095 hEEpZ_Minenergy_ix_iy = ibooker.book2D("hEEpZ_Minenergy_ix_iy", "", 100, 1, 101, 100, 1, 101);
0096 hEEmZ_Minenergy_ix_iy = ibooker.book2D("hEEmZ_Minenergy_ix_iy", "", 100, 1, 101, 100, 1, 101);
0097 hEB_Minenergy_ieta_iphi = ibooker.book2D("hEB_Minenergy_ieta_iphi", "", 171, -85, 86, 360, 1, 361);
0098
0099 hEEpZ_Maxenergy_ix_iy = ibooker.book2D("hEEpZ_Maxenergy_ix_iy", "", 100, 1, 101, 100, 1, 101);
0100 hEEmZ_Maxenergy_ix_iy = ibooker.book2D("hEEmZ_Maxenergy_ix_iy", "", 100, 1, 101, 100, 1, 101);
0101 hEB_Maxenergy_ieta_iphi = ibooker.book2D("hEB_Maxenergy_ieta_iphi", "", 171, -85, 86, 360, 1, 361);
0102
0103
0104 for (int i = 1; i <= 171; i++)
0105 for (int j = 1; j <= 360; j++) {
0106 hEB_Maxenergy_ieta_iphi->setBinContent(i, j, -999);
0107 hEB_Minenergy_ieta_iphi->setBinContent(i, j, 14000);
0108 }
0109 for (int i = 1; i <= 100; i++)
0110 for (int j = 1; j <= 100; j++) {
0111 hEEpZ_Maxenergy_ix_iy->setBinContent(i, j, -999);
0112 hEEpZ_Minenergy_ix_iy->setBinContent(i, j, 14000);
0113 hEEmZ_Maxenergy_ix_iy->setBinContent(i, j, -999);
0114 hEEmZ_Minenergy_ix_iy->setBinContent(i, j, 14000);
0115 }
0116
0117
0118 hEEpZ_Occ_ix_iy = ibooker.book2D("hEEpZ_Occ_ix_iy", "", 100, 1, 101, 100, 1, 101);
0119 hEEmZ_Occ_ix_iy = ibooker.book2D("hEEmZ_Occ_ix_iy", "", 100, 1, 101, 100, 1, 101);
0120 hEB_Occ_ieta_iphi = ibooker.book2D("hEB_Occ_ieta_iphi", "", 171, -85, 86, 360, 1, 361);
0121
0122
0123 if (finebinning_) {
0124 hEEpZ_energyvsir = ibooker.book2D("hEEpZ_energyvsir", "", 100, 1, 101, 20110, -10, 201);
0125 hEEmZ_energyvsir = ibooker.book2D("hEEmZ_energyvsir", "", 100, 1, 101, 20110, -10, 201);
0126 hEB_energyvsieta = ibooker.book2D("hEB_energyvsieta", "", 171, -85, 86, 20110, -10, 201);
0127
0128 hEEpZ_Maxenergyvsir = ibooker.book2D("hEEpZ_Maxenergyvsir", "", 100, 1, 101, 20110, -10, 201);
0129 hEEmZ_Maxenergyvsir = ibooker.book2D("hEEmZ_Maxenergyvsir", "", 100, 1, 101, 20110, -10, 201);
0130 hEB_Maxenergyvsieta = ibooker.book2D("hEB_Maxenergyvsieta", "", 171, -85, 86, 20110, -10, 201);
0131
0132 hEEpZ_Minenergyvsir = ibooker.book2D("hEEpZ_Minenergyvsir", "", 100, 1, 101, 20110, -10, 201);
0133 hEEmZ_Minenergyvsir = ibooker.book2D("hEEmZ_Minenergyvsir", "", 100, 1, 101, 20110, -10, 201);
0134 hEB_Minenergyvsieta = ibooker.book2D("hEB_Minenergyvsieta", "", 171, -85, 86, 20110, -10, 201);
0135
0136 hEEpZ_SETvsir = ibooker.book2D("hEEpZ_SETvsir", "", 50, 1, 51, 20010, 0, 201);
0137 hEEmZ_SETvsir = ibooker.book2D("hEEmZ_SETvsir", "", 50, 1, 51, 20010, 0, 201);
0138 hEB_SETvsieta = ibooker.book2D("hEB_SETvsieta", "", 171, -85, 86, 20010, 0, 201);
0139
0140 hEEpZ_METvsir = ibooker.book2D("hEEpZ_METvsir", "", 50, 1, 51, 20010, 0, 201);
0141 hEEmZ_METvsir = ibooker.book2D("hEEmZ_METvsir", "", 50, 1, 51, 20010, 0, 201);
0142 hEB_METvsieta = ibooker.book2D("hEB_METvsieta", "", 171, -85, 86, 20010, 0, 201);
0143
0144 hEEpZ_METPhivsir = ibooker.book2D("hEEpZ_METPhivsir", "", 50, 1, 51, 80, -4, 4);
0145 hEEmZ_METPhivsir = ibooker.book2D("hEEmZ_METPhivsir", "", 50, 1, 51, 80, -4, 4);
0146 hEB_METPhivsieta = ibooker.book2D("hEB_METPhivsieta", "", 171, -85, 86, 80, -4, 4);
0147
0148 hEEpZ_MExvsir = ibooker.book2D("hEEpZ_MExvsir", "", 50, 1, 51, 10010, -50, 51);
0149 hEEmZ_MExvsir = ibooker.book2D("hEEmZ_MExvsir", "", 50, 1, 51, 10010, -50, 51);
0150 hEB_MExvsieta = ibooker.book2D("hEB_MExvsieta", "", 171, -85, 86, 10010, -50, 51);
0151
0152 hEEpZ_MEyvsir = ibooker.book2D("hEEpZ_MEyvsir", "", 50, 1, 51, 10010, -50, 51);
0153 hEEmZ_MEyvsir = ibooker.book2D("hEEmZ_MEyvsir", "", 50, 1, 51, 10010, -50, 51);
0154 hEB_MEyvsieta = ibooker.book2D("hEB_MEyvsieta", "", 171, -85, 86, 10010, -50, 51);
0155
0156 hEEpZ_Occvsir = ibooker.book2D("hEEpZ_Occvsir", "", 50, 1, 51, 1000, 0, 1000);
0157 hEEmZ_Occvsir = ibooker.book2D("hEEmZ_Occvsir", "", 50, 1, 51, 1000, 0, 1000);
0158 hEB_Occvsieta = ibooker.book2D("hEB_Occvsieta", "", 171, -85, 86, 400, 0, 400);
0159 } else {
0160 hEEpZ_energyvsir = ibooker.book2D("hEEpZ_energyvsir", "", 100, 1, 101, 510, -10, 100);
0161 hEEmZ_energyvsir = ibooker.book2D("hEEmZ_energyvsir", "", 100, 1, 101, 510, -10, 100);
0162 hEB_energyvsieta = ibooker.book2D("hEB_energyvsieta", "", 171, -85, 86, 510, -10, 100);
0163
0164 hEEpZ_Maxenergyvsir = ibooker.book2D("hEEpZ_Maxenergyvsir", "", 100, 1, 101, 510, -10, 100);
0165 hEEmZ_Maxenergyvsir = ibooker.book2D("hEEmZ_Maxenergyvsir", "", 100, 1, 101, 510, -10, 100);
0166 hEB_Maxenergyvsieta = ibooker.book2D("hEB_Maxenergyvsieta", "", 171, -85, 86, 510, -10, 100);
0167
0168 hEEpZ_Minenergyvsir = ibooker.book2D("hEEpZ_Minenergyvsir", "", 100, 1, 101, 510, -10, 100);
0169 hEEmZ_Minenergyvsir = ibooker.book2D("hEEmZ_Minenergyvsir", "", 100, 1, 101, 510, -10, 100);
0170 hEB_Minenergyvsieta = ibooker.book2D("hEB_Minenergyvsieta", "", 171, -85, 86, 510, -10, 100);
0171
0172 hEEpZ_SETvsir = ibooker.book2D("hEEpZ_SETvsir", "", 50, 1, 51, 510, 0, 100);
0173 hEEmZ_SETvsir = ibooker.book2D("hEEmZ_SETvsir", "", 50, 1, 51, 510, 0, 100);
0174 hEB_SETvsieta = ibooker.book2D("hEB_SETvsieta", "", 171, -85, 86, 510, 0, 100);
0175
0176 hEEpZ_METvsir = ibooker.book2D("hEEpZ_METvsir", "", 50, 1, 51, 510, 0, 100);
0177 hEEmZ_METvsir = ibooker.book2D("hEEmZ_METvsir", "", 50, 1, 51, 510, 0, 100);
0178 hEB_METvsieta = ibooker.book2D("hEB_METvsieta", "", 171, -85, 86, 510, 0, 100);
0179
0180 hEEpZ_METPhivsir = ibooker.book2D("hEEpZ_METPhivsir", "", 50, 1, 51, 80, -4, 4);
0181 hEEmZ_METPhivsir = ibooker.book2D("hEEmZ_METPhivsir", "", 50, 1, 51, 80, -4, 4);
0182 hEB_METPhivsieta = ibooker.book2D("hEB_METPhivsieta", "", 171, -85, 86, 80, -4, 4);
0183
0184 hEEpZ_MExvsir = ibooker.book2D("hEEpZ_MExvsir", "", 50, 1, 51, 510, -50, 51);
0185 hEEmZ_MExvsir = ibooker.book2D("hEEmZ_MExvsir", "", 50, 1, 51, 510, -50, 51);
0186 hEB_MExvsieta = ibooker.book2D("hEB_MExvsieta", "", 171, -85, 86, 510, -50, 51);
0187
0188 hEEpZ_MEyvsir = ibooker.book2D("hEEpZ_MEyvsir", "", 50, 1, 51, 510, -50, 51);
0189 hEEmZ_MEyvsir = ibooker.book2D("hEEmZ_MEyvsir", "", 50, 1, 51, 510, -50, 51);
0190 hEB_MEyvsieta = ibooker.book2D("hEB_MEyvsieta", "", 171, -85, 86, 510, -50, 51);
0191
0192 hEEpZ_Occvsir = ibooker.book2D("hEEpZ_Occvsir", "", 50, 1, 51, 1000, 0, 1000);
0193 hEEmZ_Occvsir = ibooker.book2D("hEEmZ_Occvsir", "", 50, 1, 51, 1000, 0, 1000);
0194 hEB_Occvsieta = ibooker.book2D("hEB_Occvsieta", "", 171, -85, 86, 400, 0, 400);
0195 }
0196 }
0197
0198 void ECALRecHitAnalyzer::FillGeometry(const edm::EventSetup& iSetup) {
0199
0200 using namespace edm;
0201
0202
0203 const CaloSubdetectorGeometry* EBgeom = caloGeom_->getSubdetectorGeometry(DetId::Ecal, 1);
0204 int n = 0;
0205 std::vector<DetId> EBids = EBgeom->getValidDetIds(DetId::Ecal, 1);
0206 for (std::vector<DetId>::iterator i = EBids.begin(); i != EBids.end(); i++) {
0207 n++;
0208 auto cell = EBgeom->getGeometry(*i);
0209
0210
0211 EBDetId EcalID(i->rawId());
0212
0213 int Crystal_ieta = EcalID.ieta();
0214 int Crystal_iphi = EcalID.iphi();
0215 double Crystal_eta = cell->getPosition().eta();
0216 double Crystal_phi = cell->getPosition().phi();
0217 hEB_ieta_iphi_etaMap->setBinContent(Crystal_ieta + 86, Crystal_iphi, Crystal_eta);
0218 hEB_ieta_iphi_phiMap->setBinContent(Crystal_ieta + 86, Crystal_iphi, (Crystal_phi * 180 / M_PI));
0219
0220 DEBUG(" Crystal " << n);
0221 DEBUG(" ieta, iphi = " << Crystal_ieta << ", " << Crystal_iphi);
0222 DEBUG(" eta, phi = " << cell->getPosition().eta() << ", " << cell->getPosition().phi());
0223 DEBUG(" ");
0224 }
0225
0226 const CaloSubdetectorGeometry* EEgeom = caloGeom_->getSubdetectorGeometry(DetId::Ecal, 2);
0227 n = 0;
0228 std::vector<DetId> EEids = EEgeom->getValidDetIds(DetId::Ecal, 2);
0229 for (std::vector<DetId>::iterator i = EEids.begin(); i != EEids.end(); i++) {
0230 n++;
0231 auto cell = EEgeom->getGeometry(*i);
0232
0233 EEDetId EcalID(i->rawId());
0234 int Crystal_zside = EcalID.zside();
0235 int Crystal_ix = EcalID.ix();
0236 int Crystal_iy = EcalID.iy();
0237 Float_t ix_ = Crystal_ix - 50.5;
0238 Float_t iy_ = Crystal_iy - 50.5;
0239 Int_t ir = (Int_t)sqrt(ix_ * ix_ + iy_ * iy_);
0240
0241
0242
0243 double Crystal_x = cell->getPosition().x();
0244 double Crystal_y = cell->getPosition().y();
0245 double Crystal_z = cell->getPosition().z();
0246
0247 if (Crystal_zside == -1) {
0248 hEEmZ_ix_iy_irMap->setBinContent(Crystal_ix, Crystal_iy, ir);
0249 hEEmZ_ix_iy_xMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_x);
0250 hEEmZ_ix_iy_yMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_y);
0251 hEEmZ_ix_iy_zMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_z);
0252 }
0253
0254 if (Crystal_zside == 1) {
0255 hEEpZ_ix_iy_irMap->setBinContent(Crystal_ix, Crystal_iy, ir);
0256 hEEpZ_ix_iy_xMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_x);
0257 hEEpZ_ix_iy_yMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_y);
0258 hEEpZ_ix_iy_zMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_z);
0259 }
0260
0261 DEBUG(" Crystal " << n);
0262 DEBUG(" side = " << Crystal_zside);
0263 DEBUG(" ix, iy = " << Crystal_ix << ", " << Crystal_iy);
0264 DEBUG(" x, y = " << Crystal_x << ", " << Crystal_y);
0265 ;
0266 DEBUG(" ");
0267 }
0268
0269
0270
0271 for (int ieta = 1; ieta <= 85; ieta++) {
0272 int ieta_ = 86 + ieta;
0273
0274 double eta = hEB_ieta_iphi_etaMap->getBinContent(ieta_, 1);
0275 double etam1 = -999;
0276
0277 if (ieta == 1)
0278 etam1 = hEB_ieta_iphi_etaMap->getBinContent(85, 1);
0279 else
0280 etam1 = hEB_ieta_iphi_etaMap->getBinContent(ieta_ - 1, 1);
0281
0282
0283 double deta = fabs(eta - etam1);
0284 double dphi = fabs(hEB_ieta_iphi_phiMap->getBinContent(ieta_, 1) - hEB_ieta_iphi_phiMap->getBinContent(ieta_, 2));
0285
0286 hEB_ieta_detaMap->setBinContent(ieta_, deta);
0287 hEB_ieta_dphiMap->setBinContent(ieta_, dphi);
0288 hEB_ieta_detaMap->setBinContent(86 - ieta, deta);
0289 hEB_ieta_dphiMap->setBinContent(86 - ieta, dphi);
0290 }
0291 }
0292
0293 void ECALRecHitAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0294 CurrentEvent++;
0295 DEBUG("Event: " << CurrentEvent);
0296 WriteECALRecHits(iEvent, iSetup);
0297 hECAL_Nevents->Fill(0.5);
0298 }
0299
0300 void ECALRecHitAnalyzer::WriteECALRecHits(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0301 edm::Handle<EBRecHitCollection> EBRecHits;
0302 edm::Handle<EERecHitCollection> EERecHits;
0303 iEvent.getByToken(EBRecHitsLabel_, EBRecHits);
0304 iEvent.getByToken(EERecHitsLabel_, EERecHits);
0305 DEBUG("Got ECALRecHits");
0306
0307
0308
0309 DEBUG("Got Geometry");
0310
0311 TLorentzVector vEBMET_EtaRing[171];
0312 int EBActiveRing[171];
0313 int EBNActiveCells[171];
0314 double EBSET_EtaRing[171];
0315 double EBMaxEnergy_EtaRing[171];
0316 double EBMinEnergy_EtaRing[171];
0317 double EBenergy_EtaRing[171];
0318
0319 for (int i = 0; i < 171; i++) {
0320 EBActiveRing[i] = 0;
0321 EBNActiveCells[i] = 0;
0322 EBSET_EtaRing[i] = 0.0;
0323 EBMaxEnergy_EtaRing[i] = -999;
0324 EBMinEnergy_EtaRing[i] = 14E3;
0325 EBenergy_EtaRing[i] = 0.0;
0326 }
0327
0328 edm::LogInfo("OutputInfo") << "Looping over EB" << std::endl;
0329
0330 EBRecHitCollection::const_iterator ebrechit;
0331
0332
0333 for (ebrechit = EBRecHits->begin(); ebrechit != EBRecHits->end(); ebrechit++) {
0334 EBDetId det = ebrechit->id();
0335 double Energy = ebrechit->energy();
0336 Int_t ieta = det.ieta();
0337 Int_t iphi = det.iphi();
0338 int EtaRing = 85 + ieta;
0339 double eta = hEB_ieta_iphi_etaMap->getBinContent(EtaRing + 1, iphi);
0340 double phi = hEB_ieta_iphi_phiMap->getBinContent(EtaRing + 1, iphi);
0341 double theta = 2 * TMath::ATan(exp(-1 * eta));
0342 double ET = Energy * TMath::Sin(theta);
0343 TLorentzVector v_;
0344
0345 if (Energy > EBMaxEnergy_EtaRing[EtaRing])
0346 EBMaxEnergy_EtaRing[EtaRing] = Energy;
0347 if (Energy < EBMinEnergy_EtaRing[EtaRing])
0348 EBMinEnergy_EtaRing[EtaRing] = Energy;
0349
0350 if (Energy > 0) {
0351 EBActiveRing[EtaRing] = 1;
0352 EBNActiveCells[EtaRing]++;
0353 EBSET_EtaRing[EtaRing] += ET;
0354 v_.SetPtEtaPhiE(ET, 0, phi, ET);
0355 vEBMET_EtaRing[EtaRing] -= v_;
0356 EBenergy_EtaRing[EtaRing] += Energy;
0357 hEB_Occ_ieta_iphi->Fill(ieta, iphi);
0358 }
0359
0360 hEB_energy_ieta_iphi->Fill(ieta, iphi, Energy);
0361 if (Energy > hEB_Maxenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
0362 hEB_Maxenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
0363 if (Energy < hEB_Minenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
0364 hEB_Minenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
0365
0366 }
0367
0368 for (int iEtaRing = 0; iEtaRing < 171; iEtaRing++) {
0369 hEB_Minenergyvsieta->Fill(iEtaRing - 85, EBMinEnergy_EtaRing[iEtaRing]);
0370 hEB_Maxenergyvsieta->Fill(iEtaRing - 85, EBMaxEnergy_EtaRing[iEtaRing]);
0371
0372 if (EBActiveRing[iEtaRing]) {
0373 hEB_METvsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Pt());
0374 hEB_METPhivsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Phi());
0375 hEB_MExvsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Px());
0376 hEB_MEyvsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Py());
0377 hEB_SETvsieta->Fill(iEtaRing - 85, EBSET_EtaRing[iEtaRing]);
0378 hEB_Occvsieta->Fill(iEtaRing - 85, EBNActiveCells[iEtaRing]);
0379 hEB_energyvsieta->Fill(iEtaRing - 85, EBenergy_EtaRing[iEtaRing]);
0380 }
0381 }
0382
0383 TLorentzVector vEEpZMET_EtaRing[101];
0384 int EEpZActiveRing[101];
0385 int EEpZNActiveCells[101];
0386 double EEpZSET_EtaRing[101];
0387 double EEpZMaxEnergy_EtaRing[101];
0388 double EEpZMinEnergy_EtaRing[101];
0389
0390 TLorentzVector vEEmZMET_EtaRing[101];
0391 int EEmZActiveRing[101];
0392 int EEmZNActiveCells[101];
0393 double EEmZSET_EtaRing[101];
0394 double EEmZMaxEnergy_EtaRing[101];
0395 double EEmZMinEnergy_EtaRing[101];
0396
0397 for (int i = 0; i < 101; i++) {
0398 EEpZActiveRing[i] = 0;
0399 EEpZNActiveCells[i] = 0;
0400 EEpZSET_EtaRing[i] = 0.0;
0401 EEpZMaxEnergy_EtaRing[i] = -999;
0402 EEpZMinEnergy_EtaRing[i] = 14E3;
0403
0404 EEmZActiveRing[i] = 0;
0405 EEmZNActiveCells[i] = 0;
0406 EEmZSET_EtaRing[i] = 0.0;
0407 EEmZMaxEnergy_EtaRing[i] = -999;
0408 EEmZMinEnergy_EtaRing[i] = 14E3;
0409 }
0410
0411 edm::LogInfo("OutputInfo") << "Looping over EE" << std::endl;
0412 EERecHitCollection::const_iterator eerechit;
0413
0414 for (eerechit = EERecHits->begin(); eerechit != EERecHits->end(); eerechit++) {
0415 EEDetId det = eerechit->id();
0416 double Energy = eerechit->energy();
0417 Int_t ix = det.ix();
0418 Int_t iy = det.iy();
0419
0420
0421 Int_t ir = -999;
0422
0423
0424 double x = -999;
0425 double y = -999;
0426 double z = -999;
0427 double theta = -999;
0428 double phi = -999;
0429
0430 int Crystal_zside = det.zside();
0431
0432 if (Crystal_zside == -1) {
0433 ir = (Int_t)hEEmZ_ix_iy_irMap->getBinContent(ix, iy);
0434 x = hEEmZ_ix_iy_xMap->getBinContent(ix, iy);
0435 y = hEEmZ_ix_iy_yMap->getBinContent(ix, iy);
0436 z = hEEmZ_ix_iy_zMap->getBinContent(ix, iy);
0437 }
0438 if (Crystal_zside == 1) {
0439 ir = (Int_t)hEEpZ_ix_iy_irMap->getBinContent(ix, iy);
0440 x = hEEpZ_ix_iy_xMap->getBinContent(ix, iy);
0441 y = hEEpZ_ix_iy_yMap->getBinContent(ix, iy);
0442 z = hEEpZ_ix_iy_zMap->getBinContent(ix, iy);
0443 }
0444 TVector3 pos_vector(x, y, z);
0445 phi = pos_vector.Phi();
0446 theta = pos_vector.Theta();
0447 double ET = Energy * TMath::Sin(theta);
0448 TLorentzVector v_;
0449
0450 if (Crystal_zside == -1) {
0451 if (Energy > 0) {
0452 EEmZActiveRing[ir] = 1;
0453 EEmZNActiveCells[ir]++;
0454 EEmZSET_EtaRing[ir] += ET;
0455 v_.SetPtEtaPhiE(ET, 0, phi, ET);
0456 vEEmZMET_EtaRing[ir] -= v_;
0457 hEEmZ_Occ_ix_iy->Fill(ix, iy);
0458 }
0459 hEEmZ_energyvsir->Fill(ir, Energy);
0460 hEEmZ_energy_ix_iy->Fill(ix, iy, Energy);
0461
0462 if (Energy > EEmZMaxEnergy_EtaRing[ir])
0463 EEmZMaxEnergy_EtaRing[ir] = Energy;
0464 if (Energy < EEmZMinEnergy_EtaRing[ir])
0465 EEmZMinEnergy_EtaRing[ir] = Energy;
0466
0467 if (Energy > hEEmZ_Maxenergy_ix_iy->getBinContent(ix, iy))
0468 hEEmZ_Maxenergy_ix_iy->setBinContent(ix, iy, Energy);
0469 if (Energy < hEEmZ_Minenergy_ix_iy->getBinContent(ix, iy))
0470 hEEmZ_Minenergy_ix_iy->setBinContent(ix, iy, Energy);
0471 }
0472 if (Crystal_zside == 1) {
0473 if (Energy > 0) {
0474 EEpZActiveRing[ir] = 1;
0475 EEpZNActiveCells[ir]++;
0476 EEpZSET_EtaRing[ir] += ET;
0477 v_.SetPtEtaPhiE(ET, 0, phi, ET);
0478 vEEpZMET_EtaRing[ir] -= v_;
0479 hEEpZ_Occ_ix_iy->Fill(ix, iy);
0480 }
0481 hEEpZ_energyvsir->Fill(ir, Energy);
0482 hEEpZ_energy_ix_iy->Fill(ix, iy, Energy);
0483
0484 if (Energy > EEpZMaxEnergy_EtaRing[ir])
0485 EEpZMaxEnergy_EtaRing[ir] = Energy;
0486 if (Energy < EEpZMinEnergy_EtaRing[ir])
0487 EEpZMinEnergy_EtaRing[ir] = Energy;
0488 if (Energy > hEEpZ_Maxenergy_ix_iy->getBinContent(ix, iy))
0489 hEEpZ_Maxenergy_ix_iy->setBinContent(ix, iy, Energy);
0490 if (Energy < hEEpZ_Minenergy_ix_iy->getBinContent(ix, iy))
0491 hEEpZ_Minenergy_ix_iy->setBinContent(ix, iy, Energy);
0492 }
0493 }
0494 edm::LogInfo("OutputInfo") << "Done Looping over EE" << std::endl;
0495 for (int iEtaRing = 0; iEtaRing < 101; iEtaRing++) {
0496 hEEpZ_Maxenergyvsir->Fill(iEtaRing, EEpZMaxEnergy_EtaRing[iEtaRing]);
0497 hEEpZ_Minenergyvsir->Fill(iEtaRing, EEpZMinEnergy_EtaRing[iEtaRing]);
0498 hEEmZ_Maxenergyvsir->Fill(iEtaRing, EEmZMaxEnergy_EtaRing[iEtaRing]);
0499 hEEmZ_Minenergyvsir->Fill(iEtaRing, EEmZMinEnergy_EtaRing[iEtaRing]);
0500
0501 if (EEpZActiveRing[iEtaRing]) {
0502 hEEpZ_METvsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Pt());
0503 hEEpZ_METPhivsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Phi());
0504 hEEpZ_MExvsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Px());
0505 hEEpZ_MEyvsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Py());
0506 hEEpZ_SETvsir->Fill(iEtaRing, EEpZSET_EtaRing[iEtaRing]);
0507 hEEpZ_Occvsir->Fill(iEtaRing, EEpZNActiveCells[iEtaRing]);
0508 }
0509
0510 if (EEmZActiveRing[iEtaRing]) {
0511 hEEmZ_METvsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Pt());
0512 hEEmZ_METPhivsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Phi());
0513 hEEmZ_MExvsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Px());
0514 hEEmZ_MEyvsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Py());
0515 hEEmZ_SETvsir->Fill(iEtaRing, EEmZSET_EtaRing[iEtaRing]);
0516 hEEmZ_Occvsir->Fill(iEtaRing, EEmZNActiveCells[iEtaRing]);
0517 }
0518 }
0519 edm::LogInfo("OutputInfo") << "Done ..." << std::endl;
0520 }