diff --git a/Calibration/HcalCalibAlgos/macros/CalibCorr.C b/Calibration/HcalCalibAlgos/macros/CalibCorr.C index 99b00bb36c169..0085982d19c80 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibCorr.C +++ b/Calibration/HcalCalibAlgos/macros/CalibCorr.C @@ -74,6 +74,30 @@ void unpackDetId(unsigned int detId, int& subdet, int& zside, int& ieta, int& ip } } +unsigned int packDetId(int subdet, int ieta, int iphi, int depth) { + // The maskings are defined in DataFormats/DetId/interface/DetId.h + // and in DataFormats/HcalDetId/interface/HcalDetId.h + // The macro does not invoke the classes there and use them + const int det(4); + unsigned int id = (((det & 0xF) << 28) | ((subdet & 0x7) << 25)); + id |= ((0x1000000) | ((depth & 0xF) << 20) | ((ieta > 0) ? (0x80000 | (ieta << 10)) : ((-ieta) << 10)) | + (iphi & 0x3FF)); + return id; +} + +unsigned int matchDetId(unsigned int detId) { + if ((detId & 0x1000000) == 0) { + int subdet = ((detId >> 25) & (0x7)); + int ieta = ((detId >> 7) & 0x3F); + int zside = (detId & 0x2000) ? (1) : (-1); + int depth = ((detId >> 14) & 0x1F); + int iphi = (detId & 0x3F); + return packDetId(subdet, (ieta * zside), iphi, depth); + } else { + return detId; + } +} + unsigned int truncateId(unsigned int detId, int truncateFlag, bool debug = false) { //Truncate depth information of DetId's unsigned int id(detId); @@ -453,14 +477,17 @@ public: float getCorr(int run, unsigned int id); double getCorr(const Long64_t& entry); double getTrueCorr(const Long64_t& entry); + double getPhiCorr(unsigned int id); bool absent(const Long64_t& entry); + bool absent() { return (good_ == 0); } bool present(const Long64_t& entry); private: - void readCorrRun(const char* infile); - void readCorrDepth(const char* infile); - void readCorrResp(const char* infile); - void readCorrPU(const char* infile); + unsigned int readCorrRun(const char* infile); + unsigned int readCorrDepth(const char* infile); + unsigned int readCorrResp(const char* infile); + unsigned int readCorrPU(const char* infile); + unsigned int readCorrPhi(const char* infile); unsigned int getDetIdHE(int ieta, int iphi, int depth); unsigned int getDetId(int subdet, int ieta, int iphi, int depth); unsigned int correctDetId(const unsigned int& detId); @@ -468,9 +495,11 @@ private: static const unsigned int nmax_ = 10; int flag_; bool debug_; + unsigned int good_; std::map corrFac_[nmax_], corrFacDepth_, corrFacResp_; std::map cfactors_; std::vector runlow_; + std::map corrPhiSym_; }; class CalibSelectRBX { @@ -510,17 +539,19 @@ CalibCorrFactor::CalibCorrFactor(const char* infile, int useScale, double scale, double CalibCorrFactor::getCorr(unsigned int id) { double cfac(1.0); if (corrE_) { - int subdet, zside, ieta, iphi, depth; - unpackDetId(id, subdet, zside, ieta, iphi, depth); - std::map, double>::const_iterator itr = - cfactors_.find(std::pair(zside * ieta, depth)); - if (itr != cfactors_.end()) { - cfac = itr->second; - } else if (etaMax_) { - if (zside > 0 && ieta > etamp_) - cfac = (depth < depMax_) ? cfacmp_[depth] : cfacmp_[depMax_ - 1]; - if (zside < 0 && ieta > -etamn_) - cfac = (depth < depMax_) ? cfacmn_[depth] : cfacmn_[depMax_ - 1]; + if (cfactors_.size() > 0) { + int subdet, zside, ieta, iphi, depth; + unpackDetId(id, subdet, zside, ieta, iphi, depth); + std::map, double>::const_iterator itr = + cfactors_.find(std::pair(zside * ieta, depth)); + if (itr != cfactors_.end()) { + cfac = itr->second; + } else if (etaMax_) { + if (zside > 0 && ieta > etamp_) + cfac = (depth < depMax_) ? cfacmp_[depth] : cfacmp_[depMax_ - 1]; + if (zside < 0 && ieta > -etamn_) + cfac = (depth < depMax_) ? cfacmn_[depth] : cfacmn_[depMax_ - 1]; + } } } else if (useScale_ != 0) { int subdet, zside, ieta, iphi, depth; @@ -590,17 +621,21 @@ double CalibCorrFactor::getFactor(const int& ieta) { CalibCorr::CalibCorr(const char* infile, int flag, bool debug) : flag_(flag), debug_(debug) { std::cout << "CalibCorr is created with flag " << flag << ":" << flag_ << " for i/p file " << infile << std::endl; if (flag == 1) - readCorrDepth(infile); + good_ = readCorrDepth(infile); else if (flag == 2) - readCorrResp(infile); + good_ = readCorrResp(infile); else if (flag == 3) - readCorrPU(infile); + good_ = readCorrPU(infile); + else if (flag == 3) + good_ = readCorrPhi(infile); else - readCorrRun(infile); + good_ = readCorrRun(infile); } float CalibCorr::getCorr(int run, unsigned int id) { float cfac(1.0); + if (good_ == 0) + return cfac; unsigned idx = correctDetId(id); if (flag_ == 1) { std::map::iterator itr = corrFacDepth_.find(idx); @@ -610,6 +645,10 @@ float CalibCorr::getCorr(int run, unsigned int id) { std::map::iterator itr = corrFacResp_.find(idx); if (itr != corrFacResp_.end()) cfac = itr->second; + } else if (flag_ == 4) { + std::map::iterator itr = corrPhiSym_.find(idx); + if (itr != corrPhiSym_.end()) + cfac = itr->second; } else { int ip(-1); for (unsigned int k = 0; k < runlow_.size(); ++k) { @@ -638,6 +677,8 @@ float CalibCorr::getCorr(int run, unsigned int id) { } double CalibCorr::getCorr(const Long64_t& entry) { + if (good_ == 0) + return 1.0; double cfac(0.0); std::map::iterator itr = cfactors_.find(entry); if (itr != cfactors_.end()) @@ -646,6 +687,8 @@ double CalibCorr::getCorr(const Long64_t& entry) { } double CalibCorr::getTrueCorr(const Long64_t& entry) { + if (good_ == 0) + return 1.0; double cfac(0.0); std::map::iterator itr = cfactors_.find(entry); if (itr != cfactors_.end()) @@ -653,19 +696,34 @@ double CalibCorr::getTrueCorr(const Long64_t& entry) { return cfac; } +double CalibCorr::getPhiCorr(unsigned int idx) { + double cfac(1.0); + if (good_ == 0) + return cfac; + std::map::iterator itr = corrPhiSym_.find(idx); + if (itr != corrPhiSym_.end()) + cfac = itr->second; + if (debug_) { + int subdet, zside, ieta, iphi, depth; + unpackDetId(idx, subdet, zside, ieta, iphi, depth); + std::cout << "ID " << std::hex << idx << std::dec << " (Sub " << subdet << " eta " << zside * ieta << " phi " + << iphi << " depth " << depth << ") Factor " << cfac << std::endl; + } + return cfac; +} + bool CalibCorr::absent(const Long64_t& entry) { return (cfactors_.find(entry) == cfactors_.end()); } bool CalibCorr::present(const Long64_t& entry) { return (cfactors_.find(entry) != cfactors_.end()); } -void CalibCorr::readCorrRun(const char* infile) { +unsigned int CalibCorr::readCorrRun(const char* infile) { std::cout << "Enters readCorrRun for " << infile << std::endl; std::ifstream fInput(infile); - unsigned int ncorr(0); + unsigned int all(0), good(0), ncorr(0); if (!fInput.good()) { std::cout << "Cannot open file " << infile << std::endl; } else { char buffer[1024]; - unsigned int all(0), good(0); while (fInput.getline(buffer, 1024)) { ++all; std::string bufferString(buffer); @@ -711,16 +769,17 @@ void CalibCorr::readCorrRun(const char* infile) { std::cout << "Reads total of " << all << " and " << good << " good records of run dependent corrections from " << infile << std::endl; } + return good; } -void CalibCorr::readCorrDepth(const char* infile) { +unsigned int CalibCorr::readCorrDepth(const char* infile) { std::cout << "Enters readCorrDepth for " << infile << std::endl; + unsigned int all(0), good(0); std::ifstream fInput(infile); if (!fInput.good()) { std::cout << "Cannot open file " << infile << std::endl; } else { char buffer[1024]; - unsigned int all(0), good(0); while (fInput.getline(buffer, 1024)) { ++all; std::string bufferString(buffer); @@ -755,16 +814,17 @@ void CalibCorr::readCorrDepth(const char* infile) { std::cout << "Reads total of " << all << " and " << good << " good records of depth dependent factors from " << infile << std::endl; } + return good; } -void CalibCorr::readCorrResp(const char* infile) { +unsigned int CalibCorr::readCorrResp(const char* infile) { std::cout << "Enters readCorrResp for " << infile << std::endl; + unsigned int all(0), good(0), other(0); std::ifstream fInput(infile); if (!fInput.good()) { std::cout << "Cannot open file " << infile << std::endl; } else { char buffer[1024]; - unsigned int all(0), good(0), other(0); while (fInput.getline(buffer, 1024)) { ++all; std::string bufferString(buffer); @@ -800,9 +860,10 @@ void CalibCorr::readCorrResp(const char* infile) { std::cout << "Reads total of " << all << " and " << good << " good and " << other << " detector records of depth dependent factors from " << infile << std::endl; } + return good; } -void CalibCorr::readCorrPU(const char* infile) { +unsigned int CalibCorr::readCorrPU(const char* infile) { if (std::string(infile) != "") { std::ifstream fInput(infile); if (!fInput.good()) { @@ -821,6 +882,49 @@ void CalibCorr::readCorrPU(const char* infile) { } } std::cout << "Reads " << cfactors_.size() << " PU correction factors from " << infile << std::endl; + return cfactors_.size(); +} + +unsigned int CalibCorr::readCorrPhi(const char* infile) { + std::cout << "Enters readCorrPhi for " << infile << std::endl; + unsigned int all(0), good(0); + std::ifstream fInput(infile); + if (!fInput.good()) { + std::cout << "Cannot open file " << infile << std::endl; + } else { + char buffer[1024]; + while (fInput.getline(buffer, 1024)) { + ++all; + std::string bufferString(buffer); + if (bufferString.substr(0, 1) == "#") { + continue; //ignore other comments + } else { + std::vector items = splitString(bufferString); + if (items.size() < 5) { + std::cout << "Ignore line: " << buffer << " Size " << items.size(); + for (unsigned int k = 0; k < items.size(); ++k) + std::cout << " [" << k << "] : " << items[k]; + std::cout << std::endl; + } else { + ++good; + int subdet = std::atoi(items[0].c_str()); + int ieta = std::atoi(items[1].c_str()); + int iphi = std::atoi(items[2].c_str()); + int depth = std::atoi(items[3].c_str()); + double corrf = std::atof(items[4].c_str()); + unsigned int id = packDetId(subdet, ieta, iphi, depth); + corrPhiSym_[id] = corrf; + if (debug_) + std::cout << "ID " << std::hex << id << std::dec << ":" << id << " (subdet " << subdet << " eta " << ieta + << " phi " << iphi << " depth " << depth << ") " << corrPhiSym_[id] << std::endl; + } + } + } + fInput.close(); + std::cout << "Reads total of " << all << " and " << good << " good records of phi-symmetry factors from " << infile + << std::endl; + } + return good; } unsigned int CalibCorr::getDetIdHE(int ieta, int iphi, int depth) { return getDetId(2, ieta, iphi, depth); } diff --git a/Calibration/HcalCalibAlgos/macros/CalibMonitor.C b/Calibration/HcalCalibAlgos/macros/CalibMonitor.C index d19405ecc2e6e..3968ed6272e45 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibMonitor.C +++ b/Calibration/HcalCalibAlgos/macros/CalibMonitor.C @@ -39,8 +39,8 @@ // rcorFileName (char*) = name of the text file having the correction // factors as a function of run numbers or depth // or entry number to be used for raddam/depth/ -// pileup dependent correction (default="", -// no corr.) +// pileup/phisym dependent correction +// (default="", no correction) // puCorr (int) = PU correction to be applied or not: 0 no // correction; < 0 use eDelta; > 0 rho dependent // correction (-8) @@ -48,7 +48,8 @@ // information (x=3/2/1/0 for having 1000/500/50/ // 100 bins for response distribution in (0:5); // m=1/0 for (not) making plots for each RBX; -// l=3/2/1/0 for type of rcorFileName (3 for +// l=4/3/2/1/0 for type of rcorFileName (4 for +// using results from phi-symmetry; 3 for // pileup correction using machine learning // method; 2 for overall response corrections; // 1 for depth dependence corrections; @@ -396,8 +397,10 @@ CalibMonitor::CalibMonitor(const char *fname, Init(chain, dupFileName, comFileName, outFName); if (std::string(rcorFileName) != "") { cFactor_ = new CalibCorr(rcorFileName, ifDepth_, false); + if (cFactor_->absent()) + ifDepth_ = -1; } else { - ifDepth_ = 0; + ifDepth_ = -1; } if (rbx != 0) cSelect_ = new CalibSelectRBX(rbx, false); @@ -1118,7 +1121,7 @@ void CalibMonitor::Loop(Long64_t nmax) { unsigned int id = truncateId((*t_DetIds)[k], truncateFlag_, false); cfac = corrFactor_->getCorr(id); } - if ((cFactor_ != nullptr) && (ifDepth_ != 3)) + if ((cFactor_ != nullptr) && (ifDepth_ != 3) && (ifDepth_ > 0)) cfac *= cFactor_->getCorr(t_Run, (*t_DetIds)[k]); eHcal += (cfac * ((*t_HitEnergies)[k])); if (debug) { @@ -1698,7 +1701,7 @@ void CalibMonitor::correctEnergy(double &eHcal, const Long64_t &entry) { for (unsigned int idet = 0; idet < (*t_DetIds1).size(); idet++) { unsigned int id = truncateId((*t_DetIds1)[idet], truncateFlag_, false); double cfac = corrFactor_->getCorr(id); - if (cFactor_ != 0) + if ((cFactor_ != 0) && (ifDepth_ != 3) && (ifDepth_ > 0)) cfac *= cFactor_->getCorr(t_Run, (*t_DetIds1)[idet]); double hitEn = cfac * (*t_HitEnergies1)[idet]; Etot1 += hitEn; @@ -1706,7 +1709,7 @@ void CalibMonitor::correctEnergy(double &eHcal, const Long64_t &entry) { for (unsigned int idet = 0; idet < (*t_DetIds3).size(); idet++) { unsigned int id = truncateId((*t_DetIds3)[idet], truncateFlag_, false); double cfac = corrFactor_->getCorr(id); - if (cFactor_ != 0) + if ((cFactor_ != 0) && (ifDepth_ != 3) && (ifDepth_ > 0)) cfac *= cFactor_->getCorr(t_Run, (*t_DetIds3)[idet]); double hitEn = cfac * (*t_HitEnergies3)[idet]; Etot3 += hitEn; diff --git a/Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C b/Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C index 9827a1561667b..6b1cb34aef931 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C +++ b/Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C @@ -35,17 +35,20 @@ // factors to be used (default="", no corr.) // rcorFileName (const char*)= name of the text file having the correction // factors as a function of run numbers or depth -// to be used for raddam/depth dependent -// correction (default="", no corr.) +// to be used for raddam/depth/pileup/phisym +// dependent correction (default="", no corr.) // puCorr (int) = PU correction to be applied or not: 0 no // correction; < 0 use eDelta; > 0 rho dependent // correction (-8) // flag (int) = 6 digit integer (mlthdo) with control // information (m=0/1 for controlling creation // of depth depedendent histograms; -// l=2/1/0 for type of rcorFileName (2 for overall -// response corrections; 1 for depth dependence -// corrections; 0 for raddam corrections); +// l=4/3/2/1/0 for type of rcorFileName (4 for +// using results from phi-symmetry; 3 for +// pileup correction using machine learning +// method; 2 for overall response corrections; +// 1 for depth dependence corrections; 0 for +// raddam corrections); // t = bit information (lower bit set will // apply a cut on L1 closeness; and higher bit // set read correction file with Marina format); @@ -295,7 +298,7 @@ private: const int phimin_, phimax_, zside_, nvxlo_, nvxhi_, rbx_; bool exclude_, corrE_, cutL1T_; bool includeRun_, getHist_; - int flexibleSelect_; + int flexibleSelect_, ifDepth_; bool plotBasic_, plotEnergy_, plotHists_; double log2by18_; std::ofstream fileout_; @@ -372,7 +375,7 @@ CalibPlotProperties::CalibPlotProperties(const char *fname, int oneplace = ((flag_ / 1000) % 10); cutL1T_ = (oneplace % 2); bool marina = ((oneplace / 2) % 2); - bool ifDepth = (((flag_ / 10000) % 10) > 0); + ifDepth_ = ((flag_ / 10000) % 10); plotHists_ = (((flag_ / 100000) % 10) > 0); log2by18_ = std::log(2.5) / 18.0; if (runlo_ < 0 || runhi_ < 0) { @@ -394,8 +397,13 @@ CalibPlotProperties::CalibPlotProperties(const char *fname, } else { std::cout << "Proceed with a tree chain with " << chain->GetEntries() << " entries" << std::endl; Init(chain, dupFileName); - if (std::string(rcorFileName) != "") - cFactor_ = new CalibCorr(rcorFileName, ifDepth, false); + if (std::string(rcorFileName) != "") { + cFactor_ = new CalibCorr(rcorFileName, ifDepth_, false); + if (cFactor_->absent()) + ifDepth_ = -1; + } else { + ifDepth_ = -1; + } if (rbx != 0) cSelect_ = new CalibSelectRBX(rbx, false); } @@ -884,7 +892,7 @@ void CalibPlotProperties::Loop(Long64_t nentries) { // The masks are defined in DataFormats/HcalDetId/interface/HcalDetId.h unsigned int id = truncateId((*t_DetIds)[k], truncateFlag_, false); double cfac = corrFactor_->getCorr(id); - if (cFactor_ != 0) + if ((cFactor_ != 0) && (ifDepth_ != 3) && (ifDepth_ > 0)) cfac *= cFactor_->getCorr(t_Run, (*t_DetIds)[k]); eHcal += (cfac * ((*t_HitEnergies)[k])); if (debug) { @@ -973,7 +981,7 @@ void CalibPlotProperties::Loop(Long64_t nentries) { for (unsigned int k = 0; k < t_HitEnergies->size(); ++k) { unsigned int id = truncateId((*t_DetIds)[k], truncateFlag_, false); double cfac = corrFactor_->getCorr(id); - if (cFactor_ != 0) + if ((cFactor_ != 0) && (ifDepth_ != 3) && (ifDepth_ > 0)) cfac *= cFactor_->getCorr(t_Run, (*t_DetIds)[k]); double ener = cfac * (*t_HitEnergies)[k]; if (corrPU_) @@ -1192,7 +1200,7 @@ void CalibPlotProperties::correctEnergy(double &eHcal) { for (unsigned int idet = 0; idet < (*t_DetIds1).size(); idet++) { unsigned int id = truncateId((*t_DetIds1)[idet], truncateFlag_, false); double cfac = corrFactor_->getCorr(id); - if (cFactor_ != 0) + if ((cFactor_ != 0) && (ifDepth_ != 3) && (ifDepth_ > 0)) cfac *= cFactor_->getCorr(t_Run, (*t_DetIds1)[idet]); double hitEn = cfac * (*t_HitEnergies1)[idet]; Etot1 += hitEn; @@ -1200,7 +1208,7 @@ void CalibPlotProperties::correctEnergy(double &eHcal) { for (unsigned int idet = 0; idet < (*t_DetIds3).size(); idet++) { unsigned int id = truncateId((*t_DetIds3)[idet], truncateFlag_, false); double cfac = corrFactor_->getCorr(id); - if (cFactor_ != 0) + if ((cFactor_ != 0) && (ifDepth_ != 3) && (ifDepth_ > 0)) cfac *= cFactor_->getCorr(t_Run, (*t_DetIds3)[idet]); double hitEn = cfac * (*t_HitEnergies3)[idet]; Etot3 += hitEn; diff --git a/Calibration/HcalCalibAlgos/macros/CalibRho.C b/Calibration/HcalCalibAlgos/macros/CalibRho.C index dff047355ca98..e0d972c4e0a72 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibRho.C +++ b/Calibration/HcalCalibAlgos/macros/CalibRho.C @@ -265,7 +265,7 @@ void EHcalVsRho::Init(TChain *tree, const char *dupFile) { fChain->SetBranchAddress("t_HitEnergies3", &t_HitEnergies3, &b_t_HitEnergies3); Notify(); - if (std::string(dupFileName) != "") { + if (std::string(dupFile) != "") { ifstream infile(dupFile); if (!infile.is_open()) { std::cout << "Cannot open " << dupFile << std::endl; diff --git a/Calibration/HcalCalibAlgos/macros/CalibTree.C b/Calibration/HcalCalibAlgos/macros/CalibTree.C index aec8b9caa0c8a..c38fc90939b0e 100644 --- a/Calibration/HcalCalibAlgos/macros/CalibTree.C +++ b/Calibration/HcalCalibAlgos/macros/CalibTree.C @@ -24,8 +24,8 @@ // numbers of duplicate entry ("events_DXS2.txt") // rcorFileName (const char*)= name of the text file having the correction // factors as a function of run numbers or depth -// to be used for raddam/depth dependent -// correction (default="", no corr.) +// to be used for raddam/depth/pileup/phisym +// dependent correction (default="", no corr.) // useIter (bool) = Flag to use iterative process or minimization // (true) // useweight (bool) = Flag to use event weight (true) @@ -61,7 +61,8 @@ // rcorForm (int) = type of rcorFileName: (0) for Raddam correction, // (1) for depth dependent corrections; (2) for // RespCorr corrections; (3) use machine learning -// method for pileup correction. (Default 0) +// method for pileup correction; (4) use results +// from phi-symmetry. (Default 0) // useGen (bool) = use generator level momentum information (false) // runlo (int) = lower value of run number to be included (+ve) // or excluded (-ve) (default 0) @@ -136,7 +137,7 @@ void Run(const char *inFileName = "Silver.root", double l1Cut = 0.5, int truncateFlag = 0, int maxIter = 30, - int rcorForm = 0, + int rcorForm = -1, bool useGen = false, int runlo = 0, int runhi = 99999999, @@ -562,8 +563,10 @@ CalibTree::CalibTree(const char *dupFileName, Init(tree, dupFileName); if (std::string(rcorFileName) != "") { cFactor_ = new CalibCorr(rcorFileName, rcorForm_, false); + if (cFactor_->absent()) + rcorForm_ = -1; } else { - rcorForm_ = 0; + rcorForm_ = -1; } if (rbx != 0) cSelect_ = new CalibSelectRBX(rbx); @@ -804,7 +807,7 @@ Double_t CalibTree::Loop(int loop, hitEn = Cprev[detid].first * (*t_HitEnergies)[idet]; else hitEn = (*t_HitEnergies)[idet]; - if (cFactor_) + if ((rcorForm_ != 3) && (rcorForm_ >= 0) && (cFactor_)) hitEn *= cFactor_->getCorr(t_Run, id); double Wi = evWt * hitEn / en.Etot; double Fac = (inverse) ? (en.ehcal / (pmom - t_eMipDR)) : ((pmom - t_eMipDR) / en.ehcal); @@ -1397,7 +1400,7 @@ CalibTree::energyCalor CalibTree::energyHcal(double pmom, const Long64_t &entry, hitEn = Cprev[detid].first * (*t_HitEnergies)[idet]; else hitEn = (*t_HitEnergies)[idet]; - if (cFactor_) + if ((rcorForm_ != 3) && (rcorForm_ >= 0) && (cFactor_)) hitEn *= cFactor_->getCorr(t_Run, id); etot += hitEn; etot2 += ((*t_HitEnergies)[idet]); @@ -1415,7 +1418,7 @@ CalibTree::energyCalor CalibTree::energyHcal(double pmom, const Long64_t &entry, hitEn = Cprev[detid].first * (*t_HitEnergies1)[idet]; else hitEn = (*t_HitEnergies1)[idet]; - if (cFactor_) + if ((rcorForm_ != 3) && (rcorForm_ >= 0) && (cFactor_)) hitEn *= cFactor_->getCorr(t_Run, id); etot1 += hitEn; } @@ -1429,7 +1432,7 @@ CalibTree::energyCalor CalibTree::energyHcal(double pmom, const Long64_t &entry, hitEn = Cprev[detid].first * (*t_HitEnergies3)[idet]; else hitEn = (*t_HitEnergies3)[idet]; - if (cFactor_) + if ((rcorForm_ != 3) && (rcorForm_ >= 0) && (cFactor_)) hitEn *= cFactor_->getCorr(t_Run, id); etot3 += hitEn; }