File indexing completed on 2022-02-16 06:12:11
0001 #include <memory>
0002 #include <iostream>
0003 #include <vector>
0004
0005 #include <TTree.h>
0006
0007
0008 #include "FWCore/Framework/interface/Frameworkfwd.h"
0009 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/MakerMacros.h"
0012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0013 #include "FWCore/ServiceRegistry/interface/Service.h"
0014 #include "FWCore/Common/interface/TriggerNames.h"
0015 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0016
0017 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0018 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0019 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0020 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0021 #include "SimDataFormats/Track/interface/SimTrack.h"
0022 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0023 #include "SimDataFormats/Vertex/interface/SimVertex.h"
0024 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0025
0026 #include "Calibration/IsolatedParticles/interface/CaloPropagateTrack.h"
0027 #include "Calibration/IsolatedParticles/interface/eECALMatrix.h"
0028 #include "Calibration/IsolatedParticles/interface/eHCALMatrix.h"
0029
0030 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0031 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0032 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0033 #include "Geometry/Records/interface/CaloTopologyRecord.h"
0034 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0035 #include "Geometry/CaloTopology/interface/HcalTopology.h"
0036 #include "Geometry/CaloTopology/interface/CaloTopology.h"
0037 #include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h"
0038 #include "MagneticField/Engine/interface/MagneticField.h"
0039 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0040
0041
0042
0043 class HcalHBHEMuonSimAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
0044 public:
0045 explicit HcalHBHEMuonSimAnalyzer(const edm::ParameterSet&);
0046 ~HcalHBHEMuonSimAnalyzer() override {}
0047
0048 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0049
0050 private:
0051 void beginJob() override;
0052 void analyze(edm::Event const&, edm::EventSetup const&) override;
0053 void beginRun(edm::Run const&, edm::EventSetup const&) override;
0054 void endRun(edm::Run const&, edm::EventSetup const&) override {}
0055 virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
0056 virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
0057 void clearVectors();
0058 unsigned int matchId(const HcalDetId&, const HcalDetId&);
0059 double activeLength(const DetId&);
0060
0061 const std::string g4Label_, ebLabel_, eeLabel_, hcLabel_;
0062 const int verbosity_, maxDepth_;
0063 const double etaMax_, tMinE_, tMaxE_, tMinH_, tMaxH_;
0064 const edm::EDGetTokenT<edm::SimTrackContainer> tok_SimTk_;
0065 const edm::EDGetTokenT<edm::SimVertexContainer> tok_SimVtx_;
0066 const edm::EDGetTokenT<edm::PCaloHitContainer> tok_caloEB_, tok_caloEE_;
0067 const edm::EDGetTokenT<edm::PCaloHitContainer> tok_caloHH_;
0068
0069 const edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_ddrec_;
0070 const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_geom_;
0071 const edm::ESGetToken<CaloTopology, CaloTopologyRecord> tok_caloTopology_;
0072 const edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> tok_topo_;
0073 const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> tok_magField_;
0074
0075 std::vector<HcalDDDRecConstants::HcalActiveLength> actHB_, actHE_;
0076
0077 const HcalDDDRecConstants* hcons_;
0078
0079 static const int depthMax_ = 7;
0080 const int idMuon_ = 13;
0081 TTree* tree_;
0082 unsigned int runNumber_, eventNumber_, lumiNumber_, bxNumber_;
0083 double ptGlob_, etaGlob_, phiGlob_, pMuon_;
0084 double ecal3x3Energy_, hcal1x1Energy_;
0085 unsigned int ecalDetId_, hcalDetId_, hcalHot_;
0086 double matchedId_;
0087 double hcalDepthEnergy_[depthMax_];
0088 double hcalDepthActiveLength_[depthMax_];
0089 double hcalDepthEnergyHot_[depthMax_];
0090 double hcalDepthActiveLengthHot_[depthMax_];
0091 double hcalActiveLength_, hcalActiveLengthHot_;
0092 };
0093
0094 HcalHBHEMuonSimAnalyzer::HcalHBHEMuonSimAnalyzer(const edm::ParameterSet& iConfig)
0095 : g4Label_(iConfig.getParameter<std::string>("ModuleLabel")),
0096 ebLabel_(iConfig.getParameter<std::string>("EBCollection")),
0097 eeLabel_(iConfig.getParameter<std::string>("EECollection")),
0098 hcLabel_(iConfig.getParameter<std::string>("HCCollection")),
0099 verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)),
0100 maxDepth_(iConfig.getUntrackedParameter<int>("MaxDepth", 4)),
0101 etaMax_(iConfig.getUntrackedParameter<double>("EtaMax", 3.0)),
0102 tMinE_(iConfig.getUntrackedParameter<double>("TimeMinCutECAL", -500.)),
0103 tMaxE_(iConfig.getUntrackedParameter<double>("TimeMaxCutECAL", 500.)),
0104 tMinH_(iConfig.getUntrackedParameter<double>("TimeMinCutHCAL", -500.)),
0105 tMaxH_(iConfig.getUntrackedParameter<double>("TimeMaxCutHCAL", 500.)),
0106 tok_SimTk_(consumes<edm::SimTrackContainer>(edm::InputTag(g4Label_))),
0107 tok_SimVtx_(consumes<edm::SimVertexContainer>(edm::InputTag(g4Label_))),
0108 tok_caloEB_(consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, ebLabel_))),
0109 tok_caloEE_(consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, eeLabel_))),
0110 tok_caloHH_(consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, hcLabel_))),
0111 tok_ddrec_(esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>()),
0112 tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
0113 tok_caloTopology_(esConsumes<CaloTopology, CaloTopologyRecord>()),
0114 tok_topo_(esConsumes<HcalTopology, HcalRecNumberingRecord>()),
0115 tok_magField_(esConsumes<MagneticField, IdealMagneticFieldRecord>()) {
0116
0117 usesResource(TFileService::kSharedResource);
0118
0119 edm::LogVerbatim("HBHEMuon") << "Labels: " << g4Label_ << ":" << ebLabel_ << ":" << eeLabel_ << ":" << hcLabel_
0120 << "\nVerbosity " << verbosity_ << " MaxDepth " << maxDepth_ << " Maximum Eta "
0121 << etaMax_ << " tMin|tMax " << tMinE_ << ":" << tMaxE_ << ":" << tMinH_ << ":" << tMaxH_;
0122 }
0123
0124 void HcalHBHEMuonSimAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0125 clearVectors();
0126 bool debug(false);
0127 #ifdef EDM_ML_DEBUG
0128 debug = ((verbosity_ / 10) > 0);
0129 #endif
0130
0131 runNumber_ = iEvent.id().run();
0132 eventNumber_ = iEvent.id().event();
0133 lumiNumber_ = iEvent.id().luminosityBlock();
0134 bxNumber_ = iEvent.bunchCrossing();
0135
0136
0137 edm::Handle<edm::SimTrackContainer> SimTk = iEvent.getHandle(tok_SimTk_);
0138 edm::Handle<edm::SimVertexContainer> SimVtx = iEvent.getHandle(tok_SimVtx_);
0139
0140
0141 edm::Handle<edm::PCaloHitContainer> pcaloeb = iEvent.getHandle(tok_caloEB_);
0142 edm::Handle<edm::PCaloHitContainer> pcaloee = iEvent.getHandle(tok_caloEE_);
0143 edm::Handle<edm::PCaloHitContainer> pcalohh = iEvent.getHandle(tok_caloHH_);
0144 std::vector<PCaloHit> calohh;
0145 bool testN(false);
0146 for (unsigned int k = 1; k < pcalohh->size(); ++k) {
0147
0148
0149
0150 int det = ((((*pcalohh)[k].id()) >> 28) & 0xF);
0151 if (det != 4) {
0152 testN = true;
0153 break;
0154 }
0155 }
0156 if (testN) {
0157 for (auto hit : (*(pcalohh.product()))) {
0158 DetId newid = HcalHitRelabeller::relabel(hit.id(), hcons_);
0159 #ifdef EDM_ML_DEBUG
0160 edm::LogVerbatim("HBHEMuon") << "Old ID " << std::hex << hit.id() << std::dec << " New " << HcalDetId(newid);
0161 #endif
0162 hit.setID(newid.rawId());
0163 calohh.push_back(hit);
0164 }
0165 } else {
0166 calohh.insert(calohh.end(), pcalohh->begin(), pcalohh->end());
0167 }
0168
0169
0170 const CaloGeometry* geo = &iSetup.getData(tok_geom_);
0171 const MagneticField* bField = &iSetup.getData(tok_magField_);
0172 const CaloTopology* caloTopology = &iSetup.getData(tok_caloTopology_);
0173 const HcalTopology* theHBHETopology = &iSetup.getData(tok_topo_);
0174
0175 std::vector<double> ptGlob, etaGlob, phiGlob, pMuon;
0176 std::vector<double> ecal3x3Energy, hcal1x1Energy;
0177 std::vector<unsigned int> ecalDetId, hcalDetId, hcalHot;
0178 std::vector<double> matchedId;
0179 std::vector<double> hcalDepthEnergy[depthMax_];
0180 std::vector<double> hcalDepthActiveLength[depthMax_];
0181 std::vector<double> hcalDepthEnergyHot[depthMax_];
0182 std::vector<double> hcalDepthActiveLengthHot[depthMax_];
0183 std::vector<double> hcalActiveLength, hcalActiveLengthHot;
0184
0185
0186 for (const auto& simTrkItr : (*(SimTk.product()))) {
0187 if ((std::abs(simTrkItr.type()) == idMuon_) && (simTrkItr.vertIndex() == 0) &&
0188 (std::abs(simTrkItr.momentum().eta()) < etaMax_)) {
0189 unsigned int thisTrk = simTrkItr.trackId();
0190 spr::propagatedTrackDirection trkD = spr::propagateCALO(thisTrk, SimTk, SimVtx, geo, bField, debug);
0191
0192 double eEcal(0), eHcal(0), activeLengthTot(0), activeLengthHotTot(0);
0193 double eHcalDepth[depthMax_], eHcalDepthHot[depthMax_];
0194 double activeL[depthMax_], activeHotL[depthMax_];
0195 unsigned int isHot(0);
0196 bool tmpmatch(false);
0197 for (int i = 0; i < depthMax_; ++i)
0198 eHcalDepth[i] = eHcalDepthHot[i] = activeL[i] = activeHotL[i] = -10000;
0199
0200 #ifdef EDM_ML_DEBUG
0201 if ((verbosity_ % 10) > 0)
0202 edm::LogVerbatim("HBHEMuon") << "Track Type " << simTrkItr.type() << " Vertex " << simTrkItr.vertIndex()
0203 << " Charge " << simTrkItr.charge() << " Momentum " << simTrkItr.momentum().P()
0204 << ":" << simTrkItr.momentum().eta() << ":" << simTrkItr.momentum().phi()
0205 << " ECAL|HCAL " << trkD.okECAL << ":" << trkD.okHCAL << " Point "
0206 << trkD.pointECAL << ":" << trkD.pointHCAL << " Direction "
0207 << trkD.directionECAL.eta() << ":" << trkD.directionECAL.phi() << " | "
0208 << trkD.directionHCAL.eta() << ":" << trkD.directionHCAL.phi();
0209 #endif
0210 bool propageback(false);
0211 spr::propagatedTrackDirection trkD_back = spr::propagateHCALBack(thisTrk, SimTk, SimVtx, geo, bField, debug);
0212 HcalDetId closestCell_back;
0213 if (trkD_back.okHCAL) {
0214 closestCell_back = (HcalDetId)(trkD_back.detIdHCAL);
0215 propageback = true;
0216 }
0217 if (trkD.okHCAL) {
0218
0219 spr::trackAtOrigin tkvx = spr::simTrackAtOrigin(thisTrk, SimTk, SimVtx, debug);
0220 ptGlob.push_back(tkvx.momentum.perp());
0221 etaGlob.push_back(tkvx.momentum.eta());
0222 phiGlob.push_back(tkvx.momentum.phi());
0223 pMuon.push_back(tkvx.momentum.mag());
0224 #ifdef EDM_ML_DEBUG
0225 if ((verbosity_ % 10) > 0)
0226 edm::LogVerbatim("HBHEMuon") << "Track at vertex " << tkvx.ok << " position " << tkvx.position << " Momentum "
0227 << tkvx.momentum.mag() << ":" << tkvx.momentum.eta() << ":"
0228 << tkvx.momentum.phi() << " Charge " << tkvx.charge;
0229 #endif
0230
0231 DetId isoCell;
0232 if (trkD.okECAL) {
0233 isoCell = trkD.detIdECAL;
0234 eEcal = spr::eECALmatrix(
0235 isoCell, pcaloeb, pcaloee, geo, caloTopology, 1, 1, -100.0, -100.0, tMinE_, tMaxE_, debug);
0236 }
0237
0238
0239 const DetId closestCell(trkD.detIdHCAL);
0240 if ((propageback) && (HcalDetId(closestCell).ieta() == HcalDetId(closestCell_back).ieta()) &&
0241 (HcalDetId(closestCell).iphi() == HcalDetId(closestCell_back).iphi()))
0242 tmpmatch = true;
0243
0244 eHcal = spr::eHCALmatrix(
0245 theHBHETopology, closestCell, calohh, 0, 0, false, -100.0, -100.0, -100.0, -100.0, tMinH_, tMaxH_, debug);
0246 #ifdef EDM_ML_DEBUG
0247 if ((verbosity_ % 10) > 0)
0248 edm::LogVerbatim("HBHEMuon") << "eEcal " << trkD.okECAL << ":" << eEcal << " eHcal " << eHcal;
0249 #endif
0250 HcalSubdetector subdet = HcalDetId(closestCell).subdet();
0251 int ieta = HcalDetId(closestCell).ieta();
0252 int iphi = HcalDetId(closestCell).iphi();
0253 int zside = HcalDetId(closestCell).zside();
0254 bool hbhe = (std::abs(ieta) == 16);
0255 int depthHE = hcons_->getMinDepth(1, 16, iphi, zside);
0256 std::vector<std::pair<double, int> > ehdepth;
0257 spr::energyHCALCell((HcalDetId)closestCell,
0258 calohh,
0259 ehdepth,
0260 maxDepth_,
0261 -100.0,
0262 -100.0,
0263 -100.0,
0264 -100.0,
0265 -500.0,
0266 500.0,
0267 depthHE,
0268 debug);
0269 for (unsigned int i = 0; i < ehdepth.size(); ++i) {
0270 eHcalDepth[ehdepth[i].second - 1] = ehdepth[i].first;
0271 HcalSubdetector subdet0 = (hbhe) ? ((ehdepth[i].second >= depthHE) ? HcalEndcap : HcalBarrel) : subdet;
0272 HcalDetId hcid0(subdet0, ieta, iphi, ehdepth[i].second);
0273 double actL = activeLength(DetId(hcid0));
0274 activeL[ehdepth[i].second - 1] = actL;
0275 activeLengthTot += actL;
0276 #ifdef EDM_ML_DEBUG
0277 if ((verbosity_ % 10) > 0)
0278 edm::LogVerbatim("HBHEMuon") << hcid0 << " E " << ehdepth[i].first << " L " << actL;
0279 #endif
0280 }
0281
0282 HcalDetId hotCell;
0283 double h3x3 = spr::eHCALmatrix(geo, theHBHETopology, closestCell, calohh, 1, 1, hotCell, debug);
0284 isHot = matchId(closestCell, hotCell);
0285 if ((verbosity_ % 10) > 0)
0286 edm::LogVerbatim("HBHEMuon") << "hcal 3X3 < " << h3x3 << "> ClosestCell <" << (HcalDetId)(closestCell)
0287 << "> hotCell id < " << hotCell << "> isHot" << isHot;
0288 if (hotCell != HcalDetId()) {
0289 subdet = HcalDetId(hotCell).subdet();
0290 ieta = HcalDetId(hotCell).ieta();
0291 iphi = HcalDetId(hotCell).iphi();
0292 zside = HcalDetId(hotCell).zside();
0293 hbhe = (std::abs(ieta) == 16);
0294 depthHE = hcons_->getMinDepth(1, 16, iphi, zside);
0295 std::vector<std::pair<double, int> > ehdepth;
0296 spr::energyHCALCell(
0297 hotCell, calohh, ehdepth, maxDepth_, -100.0, -100.0, -100.0, -100.0, tMinH_, tMaxH_, depthHE, debug);
0298 for (unsigned int i = 0; i < ehdepth.size(); ++i) {
0299 eHcalDepthHot[ehdepth[i].second - 1] = ehdepth[i].first;
0300 HcalSubdetector subdet0 = (hbhe) ? ((ehdepth[i].second >= depthHE) ? HcalEndcap : HcalBarrel) : subdet;
0301 HcalDetId hcid0(subdet0, ieta, iphi, ehdepth[i].second);
0302 double actL = activeLength(DetId(hcid0));
0303 activeHotL[ehdepth[i].second - 1] = actL;
0304 activeLengthHotTot += actL;
0305 #ifdef EDM_ML_DEBUG
0306 if ((verbosity_ % 10) > 0)
0307 edm::LogVerbatim("HBHEMuon") << hcid0 << " E " << ehdepth[i].first << " L " << actL;
0308 #endif
0309 }
0310 }
0311 #ifdef EDM_ML_DEBUG
0312 if ((verbosity_ % 10) > 0) {
0313 for (int k = 0; k < depthMax_; ++k)
0314 edm::LogVerbatim("HBHEMuon") << "Depth " << k << " E " << eHcalDepth[k] << ":" << eHcalDepthHot[k];
0315 }
0316 #endif
0317 matchedId.push_back(tmpmatch);
0318 ecal3x3Energy.push_back(eEcal);
0319 ecalDetId.push_back(isoCell.rawId());
0320 hcal1x1Energy.push_back(eHcal);
0321 hcalDetId.push_back(closestCell.rawId());
0322 for (int k = 0; k < depthMax_; ++k) {
0323 hcalDepthEnergy[k].push_back(eHcalDepth[k]);
0324 hcalDepthActiveLength[k].push_back(activeL[k]);
0325 hcalDepthEnergyHot[k].push_back(eHcalDepthHot[k]);
0326 hcalDepthActiveLengthHot[k].push_back(activeHotL[k]);
0327 }
0328 hcalHot.push_back(isHot);
0329 hcalActiveLengthHot.push_back(activeLengthHotTot);
0330 }
0331 }
0332 }
0333 for (unsigned int k = 0; k < hcalHot.size(); ++k) {
0334 ptGlob_ = ptGlob[k];
0335 etaGlob_ = etaGlob[k];
0336 phiGlob_ = phiGlob[k];
0337 pMuon_ = pMuon[k];
0338 ecal3x3Energy_ = ecal3x3Energy[k];
0339 hcal1x1Energy_ = hcal1x1Energy[k];
0340 ecalDetId_ = ecalDetId[k];
0341 hcalDetId_ = hcalDetId[k];
0342 hcalHot_ = hcalHot[k];
0343 matchedId_ = matchedId[k];
0344 for (int i = 0; i < depthMax_; ++i) {
0345 hcalDepthEnergy_[i] = hcalDepthEnergy[k][i];
0346 hcalDepthActiveLength_[i] = hcalDepthActiveLength[k][i];
0347 hcalDepthEnergyHot_[i] = hcalDepthEnergyHot[k][i];
0348 hcalDepthActiveLengthHot_[i] = hcalDepthActiveLengthHot[k][i];
0349 }
0350 hcalActiveLength_ = hcalActiveLength[k];
0351 hcalActiveLengthHot_ = hcalActiveLengthHot[k];
0352 tree_->Fill();
0353 }
0354 }
0355
0356 void HcalHBHEMuonSimAnalyzer::beginJob() {
0357 edm::Service<TFileService> fs;
0358 tree_ = fs->make<TTree>("TREE", "TREE");
0359 tree_->Branch("Run_No", &runNumber_);
0360 tree_->Branch("Event_No", &eventNumber_);
0361 tree_->Branch("LumiNumber", &lumiNumber_);
0362 tree_->Branch("BXNumber", &bxNumber_);
0363 tree_->Branch("pt_of_muon", &ptGlob_);
0364 tree_->Branch("eta_of_muon", &etaGlob_);
0365 tree_->Branch("phi_of_muon", &phiGlob_);
0366 tree_->Branch("p_of_muon", &pMuon_);
0367 tree_->Branch("matchedId", &matchedId_);
0368
0369 tree_->Branch("ecal_3x3", &ecal3x3Energy_);
0370 tree_->Branch("ecal_detID", &ecalDetId_);
0371 tree_->Branch("hcal_1x1", &hcal1x1Energy_);
0372 tree_->Branch("hcal_detID", &hcalDetId_);
0373 tree_->Branch("hcal_cellHot", &hcalHot_);
0374 tree_->Branch("activeLength", &hcalActiveLength_);
0375 tree_->Branch("activeLengthHot", &hcalActiveLengthHot_);
0376 char name[100];
0377 for (int k = 0; k < maxDepth_; ++k) {
0378 sprintf(name, "hcal_edepth%d", (k + 1));
0379 tree_->Branch(name, &hcalDepthEnergy_[k]);
0380 sprintf(name, "hcal_activeL%d", (k + 1));
0381 tree_->Branch(name, &hcalDepthActiveLength_[k]);
0382 sprintf(name, "hcal_edepthHot%d", (k + 1));
0383 tree_->Branch(name, &hcalDepthEnergyHot_[k]);
0384 sprintf(name, "hcal_activeHotL%d", (k + 1));
0385 tree_->Branch(name, &hcalDepthActiveLength_[k]);
0386 }
0387 }
0388
0389 void HcalHBHEMuonSimAnalyzer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
0390 hcons_ = &iSetup.getData(tok_ddrec_);
0391 actHB_.clear();
0392 actHE_.clear();
0393 actHB_ = hcons_->getThickActive(0);
0394 actHE_ = hcons_->getThickActive(1);
0395 }
0396
0397 void HcalHBHEMuonSimAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0398 edm::ParameterSetDescription desc;
0399 desc.add<std::string>("ModuleLabel", "g4SimHits");
0400 desc.add<std::string>("EBCollection", "EcalHitsEB");
0401 desc.add<std::string>("EECollection", "EcalHitsEE");
0402 desc.add<std::string>("HCCollection", "HcalHits");
0403 desc.addUntracked<int>("Verbosity", 0);
0404 desc.addUntracked<int>("MaxDepth", 4);
0405 desc.addUntracked<double>("EtaMax", 3.0);
0406 desc.addUntracked<double>("TimeMinCutECAL", -500.);
0407 desc.addUntracked<double>("TimeMaxCutECAL", 500.);
0408 desc.addUntracked<double>("TimeMinCutHCAL", -500.);
0409 desc.addUntracked<double>("TimeMaxCutHCAL", 500.);
0410 descriptions.add("hcalHBHEMuonSim", desc);
0411 }
0412
0413 void HcalHBHEMuonSimAnalyzer::clearVectors() {
0414
0415 runNumber_ = -99999;
0416 eventNumber_ = -99999;
0417 lumiNumber_ = -99999;
0418 bxNumber_ = -99999;
0419 }
0420
0421 unsigned int HcalHBHEMuonSimAnalyzer::matchId(const HcalDetId& id1, const HcalDetId& id2) {
0422 HcalDetId kd1(id1.subdet(), id1.ieta(), id1.iphi(), 1);
0423 HcalDetId kd2(id2.subdet(), id2.ieta(), id2.iphi(), 1);
0424 unsigned int match = ((kd1 == kd2) ? 1 : 0);
0425 return match;
0426 }
0427
0428 double HcalHBHEMuonSimAnalyzer::activeLength(const DetId& id_) {
0429 HcalDetId id(id_);
0430 int ieta = id.ietaAbs();
0431 int depth = id.depth();
0432 double lx(0);
0433 if (id.subdet() == HcalBarrel) {
0434 for (unsigned int i = 0; i < actHB_.size(); ++i) {
0435 if (ieta == actHB_[i].ieta && depth == actHB_[i].depth) {
0436 lx = actHB_[i].thick;
0437 break;
0438 }
0439 }
0440 } else {
0441 for (unsigned int i = 0; i < actHE_.size(); ++i) {
0442 if (ieta == actHE_[i].ieta && depth == actHE_[i].depth) {
0443 lx = actHE_[i].thick;
0444 break;
0445 }
0446 }
0447 }
0448 return lx;
0449 }
0450
0451
0452 DEFINE_FWK_MODULE(HcalHBHEMuonSimAnalyzer);