Skip to content

Commit

Permalink
add option to switch off time calibration
Browse files Browse the repository at this point in the history
  • Loading branch information
argiro committed Jul 5, 2016
1 parent 7829170 commit 295fcdd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
Expand Up @@ -390,6 +390,7 @@ void EcalRecHitProducer::fillDescriptions(edm::ConfigurationDescriptions& descri
desc.add<double>("EELaserMAX",8.0);
desc.add<double>("logWarningEtThreshold_EB_FE",50);
desc.add<bool>("recoverEEIsolatedChannels",false);
desc.add<bool>("skipTimeCalib",false);
descriptions.add("ecalRecHit",desc);
}

Expand Down
37 changes: 23 additions & 14 deletions RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitWorkerSimple.cc
Expand Up @@ -25,7 +25,8 @@ EcalRecHitWorkerSimple::EcalRecHitWorkerSimple(const edm::ParameterSet&ps, edm::
EBLaserMAX_ = ps.getParameter<double>("EBLaserMAX");
EELaserMAX_ = ps.getParameter<double>("EELaserMAX");


skipTimeCalib_=ps.getParameter<bool>("skipTimeCalib");

// Traslate string representation of flagsMapDBReco into enum values
const edm::ParameterSet & p=ps.getParameter< edm::ParameterSet >("flagsMapDBReco");
std::vector<std::string> recoflagbitsStrings = p.getParameterNames();
Expand Down Expand Up @@ -59,8 +60,12 @@ EcalRecHitWorkerSimple::EcalRecHitWorkerSimple(const edm::ParameterSet&ps, edm::
void EcalRecHitWorkerSimple::set(const edm::EventSetup& es)
{
es.get<EcalIntercalibConstantsRcd>().get(ical);
es.get<EcalTimeCalibConstantsRcd>().get(itime);
es.get<EcalTimeOffsetConstantRcd>().get(offtime);

if (!skipTimeCalib_){
es.get<EcalTimeCalibConstantsRcd>().get(itime);
es.get<EcalTimeOffsetConstantRcd>().get(offtime);
}

es.get<EcalADCToGeVConstantRcd>().get(agc);
es.get<EcalChannelStatusRcd>().get(chStatus);
if ( laserCorrection_ ) es.get<EcalLaserDbRecord>().get(laser);
Expand Down Expand Up @@ -92,10 +97,10 @@ EcalRecHitWorkerSimple::run( const edm::Event & evt,
const EcalIntercalibConstantMap& icalMap = ical->getMap();
if ( detid.subdetId() == EcalEndcap ) {
rechitMaker_->setADCToGeVConstant( float(agc->getEEValue()) );
offsetTime = offtime->getEEValue();
if (!skipTimeCalib_) offsetTime = offtime->getEEValue();
} else {
rechitMaker_->setADCToGeVConstant( float(agc->getEBValue()) );
offsetTime = offtime->getEBValue();
if (!skipTimeCalib_) offsetTime = offtime->getEBValue();
}

// first intercalibration constants
Expand All @@ -115,18 +120,22 @@ EcalRecHitWorkerSimple::run( const edm::Event & evt,


// get time calibration coefficient
const EcalTimeCalibConstantMap & itimeMap = itime->getMap();
EcalTimeCalibConstantMap::const_iterator itime = itimeMap.find(detid);
EcalTimeCalibConstant itimeconst = 0;
if( itime!=itimeMap.end() ) {
itimeconst = (*itime);
} else {
edm::LogError("EcalRecHitError") << "No time calib const found for xtal "
<< detid.rawId()
<< "! something wrong with EcalTimeCalibConstants in your DB? ";

if (!skipTimeCalib_){
const EcalTimeCalibConstantMap & itimeMap = itime->getMap();
EcalTimeCalibConstantMap::const_iterator itime = itimeMap.find(detid);

if( itime!=itimeMap.end() ) {
itimeconst = (*itime);
} else {
edm::LogError("EcalRecHitError") << "No time calib const found for xtal "
<< detid.rawId()
<< "! something wrong with EcalTimeCalibConstants in your DB? ";
}


}

// make the rechit and put in the output collection, unless recovery has to take care of it
if (! (flagmask_ & flagBits ) || !killDeadChannels_) {
EcalRecHit myrechit( rechitMaker_->makeRecHit(uncalibRH,
Expand Down
Expand Up @@ -57,7 +57,8 @@ class EcalRecHitWorkerSimple : public EcalRecHitWorkerBaseClass {

bool killDeadChannels_;
bool laserCorrection_;

bool skipTimeCalib_;

EcalRecHitSimpleAlgo * rechitMaker_;

};
Expand Down
2 changes: 2 additions & 0 deletions RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py
Expand Up @@ -30,6 +30,8 @@
EBLaserMAX = cms.double(3.0),
EELaserMAX = cms.double(8.0),

# useful if time is not calculated, as at HLT
skipTimeCalib = cms.bool(False),

# apply laser corrections
laserCorrection = cms.bool(True),
Expand Down

0 comments on commit 295fcdd

Please sign in to comment.