CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalUncalibRecHitWorkerAnalFit Class Reference

#include <EcalUncalibRecHitWorkerAnalFit.h>

Inheritance diagram for EcalUncalibRecHitWorkerAnalFit:
EcalUncalibRecHitWorkerBaseClass

List of all members.

Public Member Functions

 EcalUncalibRecHitWorkerAnalFit (const edm::ParameterSet &ps)
bool run (const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result)
void set (const edm::EventSetup &es)
 ~EcalUncalibRecHitWorkerAnalFit ()

Private Attributes

EcalUncalibRecHitRecAnalFitAlgo
< EBDataFrame
algoEB_
EcalUncalibRecHitRecAnalFitAlgo
< EEDataFrame
algoEE_
edm::ESHandle< EcalPedestalspedHandle
edm::ESHandle< EcalGainRatiospRatio

Detailed Description

produce ECAL uncalibrated rechits from dataframes with the analytical fit method

Id:
EcalUncalibRecHitWorkerAnalFit.cc,v 1.1 2008/12/10 01:52:42 ferriff Exp
Date:
2008/12/10 01:52:42
Revision:
1.1
Author:
Shahram Rahatlou, University of Rome & INFN, Sept 2005

Definition at line 26 of file EcalUncalibRecHitWorkerAnalFit.h.


Constructor & Destructor Documentation

EcalUncalibRecHitWorkerAnalFit::EcalUncalibRecHitWorkerAnalFit ( const edm::ParameterSet ps)
EcalUncalibRecHitWorkerAnalFit::~EcalUncalibRecHitWorkerAnalFit ( ) [inline]

Definition at line 30 of file EcalUncalibRecHitWorkerAnalFit.h.

{};

Member Function Documentation

bool EcalUncalibRecHitWorkerAnalFit::run ( const edm::Event evt,
const EcalDigiCollection::const_iterator digi,
EcalUncalibratedRecHitCollection result 
) [virtual]

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 61 of file EcalUncalibRecHitWorkerAnalFit.cc.

References algoEB_, algoEE_, EcalUncalibratedRecHit::amplitude(), cond::rpcobgas::detid, EcalBarrel, LogDebug, EcalUncalibRecHitRecAnalFitAlgo< C >::makeRecHit(), pedHandle, pRatio, edm::ESHandle< T >::product(), and edm::SortedCollection< T, SORT >::push_back().

{
        using namespace edm;

        const EcalGainRatioMap & gainMap = pRatio.product()->getMap(); // map of gain ratios
        const EcalPedestalsMap & pedMap = pedHandle.product()->getMap(); // map of pedestals

        EcalPedestalsMapIterator pedIter; // pedestal iterator
        EcalPedestals::Item aped; // pedestal object for a single xtal

        EcalGainRatioMap::const_iterator gainIter; // gain iterator
        EcalMGPAGainRatio aGain; // gain object for a single xtal

        DetId detid( itdg->id() );

        // find pedestals for this channel
        //LogDebug("EcalUncalibRecHitDebug") << "looking up pedestal for crystal: " << itdg->id(); // FIXME
        pedIter = pedMap.find( detid );
        if( pedIter != pedMap.end() ) {
                aped = (*pedIter);
        } else {
                edm::LogError("EcalUncalibRecHitWorkerAnalFit") << "error!! could not find pedestals for channel: ";
                if ( detid.subdetId() == EcalBarrel ) {
                        edm::LogError("EcalUncalibRecHitWorkerAnalFit") << EBDetId( detid );
                } else {
                        edm::LogError("EcalUncalibRecHitWorkerAnalFit") << EEDetId( detid );
                }
                edm::LogError("EcalUncalibRecHitWorkerAnalFit") << "\n  no uncalib rechit will be made for this digi!";
                return false;
        }
        double pedVec[3];
        pedVec[0] = aped.mean_x12;
        pedVec[1] = aped.mean_x6;
        pedVec[2] = aped.mean_x1;


        // find gain ratios
        //LogDebug("EcalUncalibRecHitDebug") << "looking up gainRatios for crystal: " << itdg->id(); // FIXME
        gainIter = gainMap.find( detid );
        if( gainIter != gainMap.end() ) {
                aGain = (*gainIter);
        } else {
                edm::LogError("EcalUncalibRecHitWorkerAnalFit") << "error!! could not find gain ratios for channel: ";
                if ( detid.subdetId() == EcalBarrel ) {
                        edm::LogError("EcalUncalibRecHitWorkerAnalFit") << EBDetId( detid );
                } else {
                        edm::LogError("EcalUncalibRecHitWorkerAnalFit") << EEDetId( detid );
                }
                edm::LogError("EcalUncalibRecHitWorkerAnalFit") << "\n  no uncalib rechit will be made for this digi!";
                return false;
        }
        double gainRatios[3];
        gainRatios[0] = 1.;
        gainRatios[1] = aGain.gain12Over6();
        gainRatios[2] = aGain.gain6Over1()*aGain.gain12Over6();

        if ( detid.subdetId() == EcalBarrel ) {
                EcalUncalibratedRecHit aHit = algoEB_.makeRecHit(*itdg, pedVec, gainRatios, 0 ,0);
                result.push_back( aHit );
                if(aHit.amplitude()>0.) {
                        LogDebug("EcalUncalibRecHitInfo") << "EcalUncalibRecHitWorkerAnalFit: processed EBDataFrame with id: "
                                << EBDetId( detid )
                                << "\n" << "uncalib rechit amplitude: " << aHit.amplitude();
                }
        } else {
                EcalUncalibratedRecHit aHit = algoEE_.makeRecHit(*itdg, pedVec, gainRatios, 0, 0);
                result.push_back( aHit );
                if(aHit.amplitude()>0.) {
                        LogDebug("EcalUncalibRecHitInfo") << "EcalUncalibRecHitWorkerAnalFit: processed EEDataFrame with id: "
                                << EEDetId( detid ) << "\n"
                                << "uncalib rechit amplitude: " << aHit.amplitude();
                }
        }
        return true;
}
void EcalUncalibRecHitWorkerAnalFit::set ( const edm::EventSetup es) [virtual]

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 47 of file EcalUncalibRecHitWorkerAnalFit.cc.

References edm::EventSetup::get(), LogDebug, pedHandle, and pRatio.

{
        // Gain Ratios
        LogDebug("EcalUncalibRecHitDebug") << "fetching gainRatios....";
        es.get<EcalGainRatiosRcd>().get(pRatio);
        LogDebug("EcalUncalibRecHitDebug") << "done." ;

        // fetch the pedestals from the cond DB via EventSetup
        LogDebug("EcalUncalibRecHitDebug") << "fetching pedestals....";
        es.get<EcalPedestalsRcd>().get( pedHandle );
        LogDebug("EcalUncalibRecHitDebug") << "done." ;
}

Member Data Documentation

Definition at line 36 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run().

Definition at line 37 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run().

Definition at line 41 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run(), and set().

Definition at line 40 of file EcalUncalibRecHitWorkerAnalFit.h.

Referenced by run(), and set().