CMS 3D CMS Logo

Public Member Functions | Protected Attributes

EcalRecHitWorkerSimple Class Reference

#include <EcalRecHitWorkerSimple.h>

Inheritance diagram for EcalRecHitWorkerSimple:
EcalRecHitWorkerBaseClass

List of all members.

Public Member Functions

 EcalRecHitWorkerSimple (const edm::ParameterSet &)
bool run (const edm::Event &evt, const EcalUncalibratedRecHit &uncalibRH, EcalRecHitCollection &result)
void set (const edm::EventSetup &es)
virtual ~EcalRecHitWorkerSimple ()

Protected Attributes

edm::ESHandle
< EcalADCToGeVConstant
agc
edm::ESHandle< EcalChannelStatuschStatus
double EBLaserMAX_
double EBLaserMIN_
double EELaserMAX_
double EELaserMIN_
edm::ESHandle
< EcalIntercalibConstants
ical
edm::ESHandle
< EcalTimeCalibConstants
itime
bool killDeadChannels_
edm::ESHandle< EcalLaserDbServicelaser
bool laserCorrection_
edm::ESHandle
< EcalTimeOffsetConstant
offtime
EcalRecHitSimpleAlgorechitMaker_
std::vector< int > v_chstatus_
std::vector< int > v_DB_reco_flags_

Detailed Description

Definition at line 26 of file EcalRecHitWorkerSimple.h.


Constructor & Destructor Documentation

EcalRecHitWorkerSimple::EcalRecHitWorkerSimple ( const edm::ParameterSet ps)

Definition at line 15 of file EcalRecHitWorkerSimple.cc.

References EBLaserMAX_, EBLaserMIN_, EELaserMAX_, EELaserMIN_, edm::ParameterSet::getParameter(), killDeadChannels_, laserCorrection_, rechitMaker_, v_chstatus_, and v_DB_reco_flags_.

                                                                       :
        EcalRecHitWorkerBaseClass(ps)
{
        rechitMaker_ = new EcalRecHitSimpleAlgo();
        v_chstatus_ = ps.getParameter<std::vector<int> >("ChannelStatusToBeExcluded");
        v_DB_reco_flags_ = ps.getParameter<std::vector<int> >("flagsMapDBReco");
        killDeadChannels_ = ps.getParameter<bool>("killDeadChannels");
        laserCorrection_ = ps.getParameter<bool>("laserCorrection");
        EBLaserMIN_ = ps.getParameter<double>("EBLaserMIN");
        EELaserMIN_ = ps.getParameter<double>("EELaserMIN");
        EBLaserMAX_ = ps.getParameter<double>("EBLaserMAX");
        EELaserMAX_ = ps.getParameter<double>("EELaserMAX");

}
EcalRecHitWorkerSimple::~EcalRecHitWorkerSimple ( ) [virtual]

Definition at line 130 of file EcalRecHitWorkerSimple.cc.

References rechitMaker_.

                                               {

  delete rechitMaker_;
}

Member Function Documentation

bool EcalRecHitWorkerSimple::run ( const edm::Event evt,
const EcalUncalibratedRecHit uncalibRH,
EcalRecHitCollection result 
) [virtual]

Implements EcalRecHitWorkerBaseClass.

Definition at line 44 of file EcalRecHitWorkerSimple.cc.

References agc, chStatus, cond::rpcobgas::detid, EBLaserMAX_, EcalBarrel, EcalEndcap, EELaserMAX_, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), spr::find(), EcalChannelStatusCode::getStatusCode(), ical, EcalUncalibratedRecHit::id(), itime, killDeadChannels_, EcalRecHit::kLeadingEdgeRecovered, EcalRecHit::kPoorCalib, laser, laserCorrection_, EcalRecHitSimpleAlgo::makeRecHit(), offtime, edm::SortedCollection< T, SORT >::push_back(), DetId::rawId(), rechitMaker_, EcalRecHitSimpleAlgo::setADCToGeVConstant(), EcalRecHit::setFlag(), DetId::subdetId(), edm::EventBase::time(), v_chstatus_, and v_DB_reco_flags_.

{
        DetId detid=uncalibRH.id();

        EcalChannelStatusMap::const_iterator chit = chStatus->find(detid);
        EcalChannelStatusCode chStatusCode = 1;
        if ( chit != chStatus->end() ) {
                chStatusCode = *chit;
        } else {
                edm::LogError("EcalRecHitError") << "No channel status found for xtal " 
                        << detid.rawId() 
                        << "! something wrong with EcalChannelStatus in your DB? ";
        }
        if ( v_chstatus_.size() > 0) {
                uint16_t code = chStatusCode.getStatusCode() & 0x001F;
                std::vector<int>::const_iterator res = std::find( v_chstatus_.begin(), v_chstatus_.end(), code );
                if ( res != v_chstatus_.end() ) {
                        return false;
                }
        }

        // find the proper flag for the recHit
        // from a configurable vector
        // (see cfg file for the association)
        uint32_t recoFlag = 0;
        uint16_t statusCode = chStatusCode.getStatusCode() & 0x001F;
        if ( statusCode < v_DB_reco_flags_.size() ) {
                // not very nice...
                recoFlag = v_DB_reco_flags_[ statusCode ];  
        } else {
                edm::LogError("EcalRecHitError") << "Flag " << statusCode 
                        << " in DB exceed the allowed range of " << v_DB_reco_flags_.size();
        }

        float offsetTime = 0; // the global time phase
        const EcalIntercalibConstantMap& icalMap = ical->getMap();  
        if ( detid.subdetId() == EcalEndcap ) {
                rechitMaker_->setADCToGeVConstant( float(agc->getEEValue()) );
                offsetTime = offtime->getEEValue();
        } else {
                rechitMaker_->setADCToGeVConstant( float(agc->getEBValue()) );
                offsetTime = offtime->getEBValue();
        }

        // first intercalibration constants
        EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(detid);
        EcalIntercalibConstant icalconst = 1;
        if( icalit!=icalMap.end() ) {
                icalconst = (*icalit);
        } else {
                edm::LogError("EcalRecHitError") << "No intercalib const found for xtal "
                        << detid.rawId()
                        << "! something wrong with EcalIntercalibConstants in your DB? ";
        }

        // get laser coefficient
        float lasercalib = 1.;
        if ( laserCorrection_ ) lasercalib = laser->getLaserCorrection( detid, evt.time());
        

        // 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? ";
        }
          
         
        // make the rechit and put in the output collection
        if (recoFlag<=EcalRecHit::kLeadingEdgeRecovered || !killDeadChannels_) {
          EcalRecHit myrechit( rechitMaker_->makeRecHit(uncalibRH, icalconst * lasercalib, (itimeconst + offsetTime), /*recoflags_*/ 0) );      
          if (detid.subdetId() == EcalBarrel && (lasercalib < EBLaserMIN_ || lasercalib > EBLaserMAX_)) myrechit.setFlag(EcalRecHit::kPoorCalib);
          if (detid.subdetId() == EcalEndcap && (lasercalib < EELaserMIN_ || lasercalib > EELaserMAX_)) myrechit.setFlag(EcalRecHit::kPoorCalib);
          result.push_back(myrechit);
        }

        return true;
}
void EcalRecHitWorkerSimple::set ( const edm::EventSetup es) [virtual]

Member Data Documentation

Definition at line 47 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

Definition at line 48 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

Definition at line 40 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

Definition at line 38 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple().

Definition at line 41 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

Definition at line 39 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple().

Definition at line 44 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

Definition at line 45 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

Definition at line 54 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

Definition at line 50 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

Definition at line 55 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), run(), and set().

Definition at line 46 of file EcalRecHitWorkerSimple.h.

Referenced by run(), and set().

Definition at line 57 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), run(), and ~EcalRecHitWorkerSimple().

std::vector<int> EcalRecHitWorkerSimple::v_chstatus_ [protected]

Definition at line 49 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().

std::vector<int> EcalRecHitWorkerSimple::v_DB_reco_flags_ [protected]

Definition at line 52 of file EcalRecHitWorkerSimple.h.

Referenced by EcalRecHitWorkerSimple(), and run().