File indexing completed on 2024-07-16 02:42:25
0001
0002 #include <string>
0003 #include <vector>
0004
0005
0006 #include "TTree.h"
0007
0008 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
0009 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
0010 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
0011
0012 #include "CondFormats/HcalObjects/interface/HcalRespCorrs.h"
0013 #include "CondFormats/DataRecord/interface/HcalRespCorrsRcd.h"
0014
0015 #include "DataFormats/HcalCalibObjects/interface/HcalIsoTrkCalibVariables.h"
0016 #include "DataFormats/HcalCalibObjects/interface/HcalIsoTrkEventVariables.h"
0017
0018 #include "FWCore/Framework/interface/Frameworkfwd.h"
0019 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0020
0021 #include "FWCore/Framework/interface/Event.h"
0022 #include "FWCore/Framework/interface/MakerMacros.h"
0023 #include "FWCore/ServiceRegistry/interface/Service.h"
0024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0025 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0026
0027 #include "Geometry/CaloTopology/interface/HcalTopology.h"
0028 #include "Geometry/Records/interface/HcalRecNumberingRecord.h"
0029
0030
0031
0032 class HcalIsoTrackAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
0033 public:
0034 explicit HcalIsoTrackAnalyzer(edm::ParameterSet const&);
0035 ~HcalIsoTrackAnalyzer() override;
0036
0037 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0038
0039 private:
0040 void analyze(edm::Event const&, edm::EventSetup const&) override;
0041 void beginJob() override;
0042 void beginRun(edm::Run const&, edm::EventSetup const&) override;
0043 void endRun(edm::Run const&, edm::EventSetup const&) override;
0044 double respCorr(const DetId& id);
0045 double gainFactor(const HcalDbService* dbserv, const HcalDetId& id);
0046
0047 const double pTrackLow_, pTrackHigh_;
0048 const int useRaw_, dataType_, unCorrect_;
0049 const bool fillInRange_;
0050 const edm::InputTag labelIsoTkVar_, labelIsoTkEvt_;
0051 const std::vector<int> debEvents_;
0052 const edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> tok_htopo_;
0053 const edm::ESGetToken<HcalRespCorrs, HcalRespCorrsRcd> tok_respcorr_;
0054 const edm::ESGetToken<HcalDbService, HcalDbRecord> tok_dbservice_;
0055 edm::EDGetTokenT<HcalIsoTrkCalibVariablesCollection> tokIsoTrkVar_;
0056 edm::EDGetTokenT<HcalIsoTrkEventVariablesCollection> tokIsoTrkEvt_;
0057 const HcalTopology* theHBHETopology_;
0058 HcalRespCorrs* respCorrs_;
0059
0060 unsigned int nRun_, nRange_, nLow_, nHigh_;
0061
0062 TTree *tree, *tree2;
0063 int t_Run, t_Event, t_DataType, t_ieta, t_iphi;
0064 int t_goodPV, t_nVtx, t_nTrk;
0065 double t_EventWeight, t_p, t_pt, t_phi;
0066 double t_l1pt, t_l1eta, t_l1phi;
0067 double t_l3pt, t_l3eta, t_l3phi;
0068 double t_mindR1, t_mindR2;
0069 double t_eMipDR, t_eMipDR2, t_eMipDR3, t_eMipDR4;
0070 double t_eMipDR5, t_hmaxNearP, t_gentrackP;
0071 double t_emaxNearP, t_eAnnular, t_hAnnular;
0072 double t_eHcal, t_eHcal10, t_eHcal30, t_rhoh;
0073 bool t_selectTk, t_qltyFlag, t_qltyMissFlag, t_qltyPVFlag;
0074 std::vector<unsigned int> t_DetIds, t_DetIds1, t_DetIds3;
0075 std::vector<double> t_HitEnergies, t_HitEnergies1, t_HitEnergies3;
0076 std::vector<bool> t_trgbits;
0077
0078 unsigned int t_RunNo, t_EventNo;
0079 bool t_TrigPass, t_TrigPassSel, t_L1Bit;
0080 int t_Tracks, t_TracksProp, t_TracksSaved;
0081 int t_TracksLoose, t_TracksTight, t_allvertex;
0082 std::vector<int> t_ietaAll, t_ietaGood, t_trackType;
0083 std::vector<bool> t_hltbits;
0084 };
0085
0086 HcalIsoTrackAnalyzer::HcalIsoTrackAnalyzer(const edm::ParameterSet& iConfig)
0087 : pTrackLow_(iConfig.getParameter<double>("momentumLow")),
0088 pTrackHigh_(iConfig.getParameter<double>("momentumHigh")),
0089 useRaw_(iConfig.getUntrackedParameter<int>("useRaw", 0)),
0090 dataType_(iConfig.getUntrackedParameter<int>("dataType", 0)),
0091 unCorrect_(iConfig.getUntrackedParameter<int>("unCorrect", 0)),
0092 fillInRange_(iConfig.getUntrackedParameter<bool>("fillInRange", false)),
0093 labelIsoTkVar_(iConfig.getParameter<edm::InputTag>("isoTrackVarLabel")),
0094 labelIsoTkEvt_(iConfig.getParameter<edm::InputTag>("isoTrackEvtLabel")),
0095 debEvents_(iConfig.getParameter<std::vector<int>>("debugEvents")),
0096 tok_htopo_(esConsumes<HcalTopology, HcalRecNumberingRecord, edm::Transition::BeginRun>()),
0097 tok_respcorr_(esConsumes<HcalRespCorrs, HcalRespCorrsRcd, edm::Transition::BeginRun>()),
0098 tok_dbservice_(esConsumes<HcalDbService, HcalDbRecord>()),
0099 tokIsoTrkVar_(consumes<HcalIsoTrkCalibVariablesCollection>(labelIsoTkVar_)),
0100 tokIsoTrkEvt_(consumes<HcalIsoTrkEventVariablesCollection>(labelIsoTkEvt_)),
0101 theHBHETopology_(nullptr),
0102 respCorrs_(nullptr),
0103 nRun_(0),
0104 nRange_(0),
0105 nLow_(0),
0106 nHigh_(0) {
0107 usesResource(TFileService::kSharedResource);
0108
0109
0110 edm::LogVerbatim("HcalIsoTrack") << "Labels used " << labelIsoTkVar_ << " " << labelIsoTkEvt_;
0111
0112 edm::LogVerbatim("HcalIsoTrack") << "Parameters read from config file \n\t momentumLow_ " << pTrackLow_
0113 << "\t momentumHigh_ " << pTrackHigh_ << "\t useRaw_ " << useRaw_
0114 << "\t dataType_ " << dataType_ << "\t unCorrect " << unCorrect_
0115 << "\t fillInRange " << fillInRange_ << "\t and " << debEvents_.size()
0116 << " events to be debugged";
0117 }
0118
0119 HcalIsoTrackAnalyzer::~HcalIsoTrackAnalyzer() {
0120 if (respCorrs_)
0121 delete respCorrs_;
0122 }
0123
0124 void HcalIsoTrackAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) {
0125 const HcalDbService* conditions = &iSetup.getData(tok_dbservice_);
0126 t_Run = iEvent.id().run();
0127 t_Event = iEvent.id().event();
0128 t_DataType = dataType_;
0129 #ifdef EDM_ML_DEBUG
0130 bool debug = (debEvents_.empty())
0131 ? true
0132 : (std::find(debEvents_.begin(), debEvents_.end(), iEvent.id().event()) != debEvents_.end());
0133 if (debug)
0134 edm::LogVerbatim("HcalIsoTrack") << "Run " << t_Run << " Event " << t_Event << " type " << t_DataType
0135 << " Luminosity " << iEvent.luminosityBlock() << " Bunch "
0136 << iEvent.bunchCrossing();
0137 #endif
0138
0139
0140 auto const& isotrkCalibColl = iEvent.getHandle(tokIsoTrkVar_);
0141 if (isotrkCalibColl.isValid()) {
0142 auto isotrkCalib = *isotrkCalibColl.product();
0143 #ifdef EDM_ML_DEBUG
0144 if (debug)
0145 edm::LogVerbatim("HcalIsoTrack") << "Finds HcalIsoTrkCalibVariablesCollection with " << isotrkCalib.size()
0146 << " entries";
0147 int k(0);
0148 #endif
0149 for (const auto& itr : isotrkCalib) {
0150 t_ieta = itr.ieta_;
0151 t_iphi = itr.iphi_;
0152 t_goodPV = itr.goodPV_;
0153 t_nVtx = itr.nVtx_;
0154 t_nTrk = itr.nTrk_;
0155 t_EventWeight = itr.eventWeight_;
0156 t_p = itr.p_;
0157 t_pt = itr.pt_;
0158 t_phi = itr.phi_;
0159 #ifdef EDM_ML_DEBUG
0160 ++k;
0161 if (debug)
0162 edm::LogVerbatim("HcalIsoTrack") << "Track " << k << " p:pt:phi " << t_p << ":" << t_pt << ":" << t_phi
0163 << " nvtx:ntrk:goodPV:wt " << t_nVtx << ":" << t_nTrk << ":" << t_goodPV << ":"
0164 << t_EventWeight << " ieta:iphi " << t_ieta << ":" << t_iphi;
0165 #endif
0166 t_l1pt = itr.l1pt_;
0167 t_l1eta = itr.l1eta_;
0168 t_l1phi = itr.l1phi_;
0169 t_l3pt = itr.l3pt_;
0170 t_l3eta = itr.l3eta_;
0171 t_l3phi = itr.l3phi_;
0172 t_mindR1 = itr.mindR1_;
0173 t_mindR2 = itr.mindR2_;
0174 #ifdef EDM_ML_DEBUG
0175 if (debug)
0176 edm::LogVerbatim("HcalIsoTrack") << "L1 pt:eta:phi " << t_l1pt << ":" << t_l1eta << ":" << t_l1phi
0177 << " L3 pt:eta:phi " << t_l3pt << ":" << t_l3eta << ":" << t_l3phi << " R1:R2 "
0178 << t_mindR1 << ":" << t_mindR2;
0179 #endif
0180 t_eMipDR = itr.eMipDR_[0];
0181 t_eMipDR2 = itr.eMipDR_[1];
0182 t_eMipDR3 = itr.eMipDR_[2];
0183 t_eMipDR4 = itr.eMipDR_[3];
0184 t_eMipDR5 = itr.eMipDR_[4];
0185 #ifdef EDM_ML_DEBUG
0186 if (debug)
0187 edm::LogVerbatim("HcalIsoTrack") << "eMIPDR 1:2:3:4:5 " << t_eMipDR << ":" << t_eMipDR2 << ":" << t_eMipDR3
0188 << ":" << t_eMipDR4 << ":" << t_eMipDR5;
0189 #endif
0190 t_hmaxNearP = itr.hmaxNearP_;
0191 t_emaxNearP = itr.emaxNearP_;
0192 t_eAnnular = itr.eAnnular_;
0193 t_hAnnular = itr.hAnnular_;
0194 #ifdef EDM_ML_DEBUG
0195 if (debug)
0196 edm::LogVerbatim("HcalIsoTrack") << "emaxNearP:hmaxNearP " << t_emaxNearP << ":" << t_hmaxNearP
0197 << " eAnnlar:hAnnular" << t_eAnnular << ":" << t_hAnnular;
0198 #endif
0199 t_gentrackP = itr.gentrackP_;
0200 t_rhoh = itr.rhoh_;
0201 t_selectTk = itr.selectTk_;
0202 t_qltyFlag = itr.qltyFlag_;
0203 t_qltyMissFlag = itr.qltyMissFlag_;
0204 t_qltyPVFlag = itr.qltyPVFlag_;
0205 #ifdef EDM_ML_DEBUG
0206 if (debug)
0207 edm::LogVerbatim("HcalIsoTrack") << "gentrackP " << t_gentrackP << " rhoh " << t_rhoh
0208 << " qltyFlag:qltyMissFlag:qltyPVFlag:selectTk " << t_qltyFlag << ":"
0209 << t_qltyMissFlag << ":" << t_qltyPVFlag << ":" << t_selectTk;
0210 #endif
0211 t_trgbits = itr.trgbits_;
0212 t_DetIds = itr.detIds_;
0213 t_DetIds1 = itr.detIds1_;
0214 t_DetIds3 = itr.detIds3_;
0215 if (useRaw_ == 1) {
0216 t_eHcal = itr.eHcalAux_;
0217 t_eHcal10 = itr.eHcal10Aux_;
0218 t_eHcal30 = itr.eHcal30Aux_;
0219 t_HitEnergies = itr.hitEnergiesAux_;
0220 t_HitEnergies1 = itr.hitEnergies1Aux_;
0221 t_HitEnergies3 = itr.hitEnergies3Aux_;
0222 } else if (useRaw_ == 2) {
0223 t_eHcal = itr.eHcalRaw_;
0224 t_eHcal10 = itr.eHcal10Raw_;
0225 t_eHcal30 = itr.eHcal30Raw_;
0226 t_HitEnergies = itr.hitEnergiesRaw_;
0227 t_HitEnergies1 = itr.hitEnergies1Raw_;
0228 t_HitEnergies3 = itr.hitEnergies3Raw_;
0229 } else {
0230 t_eHcal = itr.eHcal_;
0231 t_eHcal10 = itr.eHcal10_;
0232 t_eHcal30 = itr.eHcal30_;
0233 t_HitEnergies = itr.hitEnergies_;
0234 t_HitEnergies1 = itr.hitEnergies1_;
0235 t_HitEnergies3 = itr.hitEnergies3_;
0236 if (unCorrect_ > 0) {
0237 t_eHcal = t_eHcal10 = t_eHcal30 = 0;
0238 for (unsigned int k = 0; k < t_DetIds.size(); ++k) {
0239 double corr = (unCorrect_ == 2) ? gainFactor(conditions, HcalDetId(t_DetIds[k])) : respCorr(t_DetIds[k]);
0240 if (corr != 0)
0241 t_HitEnergies[k] /= corr;
0242 t_eHcal += t_HitEnergies[k];
0243 }
0244 for (unsigned int k = 0; k < t_DetIds1.size(); ++k) {
0245 double corr = (unCorrect_ == 2) ? gainFactor(conditions, HcalDetId(t_DetIds1[k])) : respCorr(t_DetIds1[k]);
0246 if (corr != 0)
0247 t_HitEnergies1[k] /= corr;
0248 t_eHcal10 += t_HitEnergies1[k];
0249 }
0250 for (unsigned int k = 0; k < t_DetIds3.size(); ++k) {
0251 double corr = (unCorrect_ == 2) ? gainFactor(conditions, HcalDetId(t_DetIds3[k])) : respCorr(t_DetIds3[k]);
0252 if (corr != 0)
0253 t_HitEnergies3[k] /= corr;
0254 t_eHcal30 += t_HitEnergies3[k];
0255 }
0256 }
0257 }
0258 #ifdef EDM_ML_DEBUG
0259 if (debug)
0260 edm::LogVerbatim("HcalIsoTrack") << "eHcal:eHcal10:eHCal30 " << t_eHcal << ":" << t_eHcal10 << t_eHcal30;
0261 #endif
0262 bool select(true);
0263 if (fillInRange_) {
0264 if ((t_p < pTrackLow_) || (t_p > pTrackHigh_))
0265 select = false;
0266 }
0267 if (select) {
0268 tree->Fill();
0269 edm::LogVerbatim("HcalIsoTrackX") << "Run " << t_Run << " Event " << t_Event << " p " << t_p;
0270 }
0271 if (t_p < pTrackLow_) {
0272 ++nLow_;
0273 } else if (t_p > pTrackHigh_) {
0274 ++nHigh_;
0275 } else {
0276 ++nRange_;
0277 }
0278 }
0279 } else {
0280 edm::LogVerbatim("HcalIsoTrack") << "Cannot find HcalIsoTrkCalibVariablesCollection";
0281 }
0282
0283
0284 auto const& isotrkEventColl = iEvent.getHandle(tokIsoTrkEvt_);
0285 if (isotrkEventColl.isValid()) {
0286 auto isotrkEvent = isotrkEventColl.product();
0287 #ifdef EDM_ML_DEBUG
0288 if (debug)
0289 edm::LogVerbatim("HcalIsoTrack") << "Finds HcalIsoTrkEventVariablesCollection with " << isotrkEvent->size()
0290 << " entries";
0291 #endif
0292 auto itr = isotrkEvent->begin();
0293 if (itr != isotrkEvent->end()) {
0294 t_RunNo = iEvent.id().run();
0295 t_EventNo = iEvent.id().event();
0296 t_TrigPass = itr->trigPass_;
0297 t_TrigPassSel = itr->trigPassSel_;
0298 t_L1Bit = itr->l1Bit_;
0299 t_Tracks = itr->tracks_;
0300 t_TracksProp = itr->tracksProp_;
0301 t_TracksSaved = itr->tracksSaved_;
0302 t_TracksLoose = itr->tracksLoose_;
0303 t_TracksTight = itr->tracksTight_;
0304 t_allvertex = itr->allvertex_;
0305 t_ietaAll = itr->ietaAll_;
0306 t_ietaGood = itr->ietaGood_;
0307 t_trackType = itr->trackType_;
0308 t_hltbits = itr->hltbits_;
0309 tree2->Fill();
0310 }
0311 } else {
0312 edm::LogVerbatim("HcalIsoTrack") << "Cannot find HcalIsoTrkEventVariablesCollections";
0313 }
0314 }
0315
0316 void HcalIsoTrackAnalyzer::beginJob() {
0317 edm::Service<TFileService> fs;
0318 tree = fs->make<TTree>("CalibTree", "CalibTree");
0319
0320 tree->Branch("t_Run", &t_Run, "t_Run/I");
0321 tree->Branch("t_Event", &t_Event, "t_Event/I");
0322 tree->Branch("t_DataType", &t_DataType, "t_DataType/I");
0323 tree->Branch("t_ieta", &t_ieta, "t_ieta/I");
0324 tree->Branch("t_iphi", &t_iphi, "t_iphi/I");
0325 tree->Branch("t_EventWeight", &t_EventWeight, "t_EventWeight/D");
0326 tree->Branch("t_nVtx", &t_nVtx, "t_nVtx/I");
0327 tree->Branch("t_nTrk", &t_nTrk, "t_nTrk/I");
0328 tree->Branch("t_goodPV", &t_goodPV, "t_goodPV/I");
0329 tree->Branch("t_l1pt", &t_l1pt, "t_l1pt/D");
0330 tree->Branch("t_l1eta", &t_l1eta, "t_l1eta/D");
0331 tree->Branch("t_l1phi", &t_l1phi, "t_l1phi/D");
0332 tree->Branch("t_l3pt", &t_l3pt, "t_l3pt/D");
0333 tree->Branch("t_l3eta", &t_l3eta, "t_l3eta/D");
0334 tree->Branch("t_l3phi", &t_l3phi, "t_l3phi/D");
0335 tree->Branch("t_p", &t_p, "t_p/D");
0336 tree->Branch("t_pt", &t_pt, "t_pt/D");
0337 tree->Branch("t_phi", &t_phi, "t_phi/D");
0338 tree->Branch("t_mindR1", &t_mindR1, "t_mindR1/D");
0339 tree->Branch("t_mindR2", &t_mindR2, "t_mindR2/D");
0340 tree->Branch("t_eMipDR", &t_eMipDR, "t_eMipDR/D");
0341 tree->Branch("t_eMipDR2", &t_eMipDR2, "t_eMipDR2/D");
0342 tree->Branch("t_eMipDR3", &t_eMipDR3, "t_eMipDR3/D");
0343 tree->Branch("t_eMipDR4", &t_eMipDR4, "t_eMipDR4/D");
0344 tree->Branch("t_eMipDR5", &t_eMipDR5, "t_eMipDR5/D");
0345 tree->Branch("t_eHcal", &t_eHcal, "t_eHcal/D");
0346 tree->Branch("t_eHcal10", &t_eHcal10, "t_eHcal10/D");
0347 tree->Branch("t_eHcal30", &t_eHcal30, "t_eHcal30/D");
0348 tree->Branch("t_hmaxNearP", &t_hmaxNearP, "t_hmaxNearP/D");
0349 tree->Branch("t_emaxNearP", &t_emaxNearP, "t_emaxNearP/D");
0350 tree->Branch("t_eAnnular", &t_eAnnular, "t_eAnnular/D");
0351 tree->Branch("t_hAnnular", &t_hAnnular, "t_hAnnular/D");
0352 tree->Branch("t_rhoh", &t_rhoh, "t_rhoh/D");
0353 tree->Branch("t_selectTk", &t_selectTk, "t_selectTk/O");
0354 tree->Branch("t_qltyFlag", &t_qltyFlag, "t_qltyFlag/O");
0355 tree->Branch("t_qltyMissFlag", &t_qltyMissFlag, "t_qltyMissFlag/O");
0356 tree->Branch("t_qltyPVFlag", &t_qltyPVFlag, "t_qltyPVFlag/O");
0357 tree->Branch("t_gentrackP", &t_gentrackP, "t_gentrackP/D");
0358
0359 tree->Branch("t_DetIds", &t_DetIds);
0360 tree->Branch("t_HitEnergies", &t_HitEnergies);
0361 tree->Branch("t_trgbits", &t_trgbits);
0362 tree->Branch("t_DetIds1", &t_DetIds1);
0363 tree->Branch("t_DetIds3", &t_DetIds3);
0364 tree->Branch("t_HitEnergies1", &t_HitEnergies1);
0365 tree->Branch("t_HitEnergies3", &t_HitEnergies3);
0366
0367 tree2 = fs->make<TTree>("EventInfo", "Event Information");
0368
0369 tree2->Branch("t_RunNo", &t_RunNo, "t_RunNo/i");
0370 tree2->Branch("t_EventNo", &t_EventNo, "t_EventNo/i");
0371 tree2->Branch("t_Tracks", &t_Tracks, "t_Tracks/I");
0372 tree2->Branch("t_TracksProp", &t_TracksProp, "t_TracksProp/I");
0373 tree2->Branch("t_TracksSaved", &t_TracksSaved, "t_TracksSaved/I");
0374 tree2->Branch("t_TracksLoose", &t_TracksLoose, "t_TracksLoose/I");
0375 tree2->Branch("t_TracksTight", &t_TracksTight, "t_TracksTight/I");
0376 tree2->Branch("t_TrigPass", &t_TrigPass, "t_TrigPass/O");
0377 tree2->Branch("t_TrigPassSel", &t_TrigPassSel, "t_TrigPassSel/O");
0378 tree2->Branch("t_L1Bit", &t_L1Bit, "t_L1Bit/O");
0379 tree2->Branch("t_allvertex", &t_allvertex, "t_allvertex/I");
0380 tree2->Branch("t_ietaAll", &t_ietaAll);
0381 tree2->Branch("t_ietaGood", &t_ietaGood);
0382 tree2->Branch("t_trackType", &t_trackType);
0383 tree2->Branch("t_hltbits", &t_hltbits);
0384 }
0385
0386
0387 void HcalIsoTrackAnalyzer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
0388 theHBHETopology_ = &iSetup.getData(tok_htopo_);
0389 const HcalRespCorrs* resp = &iSetup.getData(tok_respcorr_);
0390 respCorrs_ = new HcalRespCorrs(*resp);
0391 respCorrs_->setTopo(theHBHETopology_);
0392 edm::LogVerbatim("HcalIsoTrack") << "beginRun " << iRun.run() << " get responseCoorection " << respCorrs_;
0393 }
0394
0395
0396 void HcalIsoTrackAnalyzer::endRun(edm::Run const& iRun, edm::EventSetup const&) {
0397 nRun_++;
0398 edm::LogVerbatim("HcalIsoTrack") << "endRun[" << nRun_ << "] " << iRun.run() << " with " << nLow_
0399 << " events with p < " << pTrackLow_ << ", " << nHigh_ << " events with p > "
0400 << pTrackHigh_ << ", and " << nRange_ << " events in the right momentum range";
0401 if (respCorrs_) {
0402 delete respCorrs_;
0403 respCorrs_ = nullptr;
0404 }
0405 }
0406
0407 void HcalIsoTrackAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0408 edm::ParameterSetDescription desc;
0409 desc.add<double>("momentumLow", 40.0);
0410 desc.add<double>("momentumHigh", 60.0);
0411 desc.addUntracked<int>("useRaw", 0);
0412 desc.addUntracked<int>("dataType", 0);
0413 desc.addUntracked<int>("unCorrect", 0);
0414 desc.addUntracked<bool>("fillInRange", false);
0415 desc.add<edm::InputTag>("isoTrackVarLabel", edm::InputTag("alcaHcalIsotrkProducer", "HcalIsoTrack"));
0416 desc.add<edm::InputTag>("isoTrackEvtLabel", edm::InputTag("alcaHcalIsotrkProducer", "HcalIsoTrackEvent"));
0417 std::vector<int> events;
0418 desc.add<std::vector<int>>("debugEvents", events);
0419 descriptions.add("hcalIsoTrackAnalyzer", desc);
0420 }
0421
0422 double HcalIsoTrackAnalyzer::respCorr(const DetId& id) {
0423 double cfac(1.0);
0424 if (respCorrs_ != nullptr)
0425 cfac = (respCorrs_->getValues(id))->getValue();
0426 return cfac;
0427 }
0428
0429 double HcalIsoTrackAnalyzer::gainFactor(const HcalDbService* conditions, const HcalDetId& id) {
0430 double gain(0.0);
0431 const HcalCalibrations& calibs = conditions->getHcalCalibrations(id);
0432 for (int capid = 0; capid < 4; ++capid)
0433 gain += (0.25 * calibs.respcorrgain(capid));
0434 return gain;
0435 }
0436
0437
0438 DEFINE_FWK_MODULE(HcalIsoTrackAnalyzer);