CMS 3D CMS Logo

Public Member Functions | Protected Attributes

EcalUncalibRecHitWorkerWeights Class Reference

#include <EcalUncalibRecHitWorkerWeights.h>

Inheritance diagram for EcalUncalibRecHitWorkerWeights:
EcalUncalibRecHitWorkerBaseClass

List of all members.

Public Member Functions

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

Protected Attributes

const
EcalWeightSet::EcalChi2WeightMatrix
chi2mat [2]
double gainRatios [3]
edm::ESHandle< EcalGainRatiosgains
edm::ESHandle
< EcalWeightXtalGroups
grps
double pedRMSVec [3]
edm::ESHandle< EcalPedestalspeds
double pedVec [3]
const EBShape testbeamEBShape
const EEShape testbeamEEShape
EcalUncalibRecHitRecWeightsAlgo
< EBDataFrame
uncalibMaker_barrel_
EcalUncalibRecHitRecWeightsAlgo
< EEDataFrame
uncalibMaker_endcap_
const
EcalWeightSet::EcalWeightMatrix
weights [2]
edm::ESHandle< EcalTBWeightswgts

Detailed Description

Definition at line 33 of file EcalUncalibRecHitWorkerWeights.h.


Constructor & Destructor Documentation

EcalUncalibRecHitWorkerWeights::EcalUncalibRecHitWorkerWeights ( const edm::ParameterSet ps)
virtual EcalUncalibRecHitWorkerWeights::~EcalUncalibRecHitWorkerWeights ( ) [inline, virtual]

Definition at line 37 of file EcalUncalibRecHitWorkerWeights.h.

{};

Member Function Documentation

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

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 28 of file EcalUncalibRecHitWorkerWeights.cc.

References cond::rpcobgas::detid, EcalEndcap, EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), gainRatios, gains, EcalWeightSet::getWeightsAfterGainSwitch(), EcalWeightSet::getWeightsBeforeGainSwitch(), grps, EEDetId::hashedIndex(), ecalpyutils::hashedIndex(), EBDetId::hashedIndex(), EcalXtalGroupId::id(), EcalUncalibRecHitRecWeightsAlgo< C >::makeRecHit(), pedRMSVec, peds, pedVec, edm::SortedCollection< T, SORT >::push_back(), testbeamEBShape, testbeamEEShape, uncalibMaker_barrel_, uncalibMaker_endcap_, weights, and wgts.

{
        DetId detid(itdg->id());

        const EcalPedestals::Item * aped = 0;
        const EcalMGPAGainRatio * aGain = 0;
        const EcalXtalGroupId * gid = 0;
        EcalTBWeights::EcalTDCId tdcid(1);

        if (detid.subdetId()==EcalEndcap) {
                unsigned int hashedIndex = EEDetId(detid).hashedIndex();
                aped  = &peds->endcap(hashedIndex);
                aGain = &gains->endcap(hashedIndex);
                gid   = &grps->endcap(hashedIndex);
        } else {
                unsigned int hashedIndex = EBDetId(detid).hashedIndex();
                aped  = &peds->barrel(hashedIndex);
                aGain = &gains->barrel(hashedIndex);
                gid   = &grps->barrel(hashedIndex);
        }

        pedVec[0] = aped->mean_x12;
        pedVec[1] = aped->mean_x6;
        pedVec[2] = aped->mean_x1;
        pedRMSVec[0] = aped->rms_x12;
        pedRMSVec[1] = aped->rms_x6;
        pedRMSVec[2] = aped->rms_x1;
        gainRatios[0] = 1.;
        gainRatios[1] = aGain->gain12Over6();
        gainRatios[2] = aGain->gain6Over1()*aGain->gain12Over6();

        // now lookup the correct weights in the map
        EcalTBWeights::EcalTBWeightMap const & wgtsMap = wgts->getMap();
        EcalTBWeights::EcalTBWeightMap::const_iterator wit;
        wit = wgtsMap.find( std::make_pair(*gid,tdcid) );
        if( wit == wgtsMap.end() ) {
                edm::LogError("EcalUncalibRecHitError") << "No weights found for EcalGroupId: " 
                        << gid->id() << " and  EcalTDCId: " << tdcid
                        << "\n  skipping digi with id: " << detid.rawId();

                return false;
        }
        const EcalWeightSet& wset = wit->second; // this is the EcalWeightSet

        const EcalWeightSet::EcalWeightMatrix& mat1 = wset.getWeightsBeforeGainSwitch();
        const EcalWeightSet::EcalWeightMatrix& mat2 = wset.getWeightsAfterGainSwitch();
//        const EcalWeightSet::EcalChi2WeightMatrix& mat3 = wset.getChi2WeightsBeforeGainSwitch();
//        const EcalWeightSet::EcalChi2WeightMatrix& mat4 = wset.getChi2WeightsAfterGainSwitch();

        weights[0] = &mat1;
        weights[1] = &mat2;

//        chi2mat[0] = &mat3;
//        chi2mat[1] = &mat4;
/*
        if (detid.subdetId()==EcalEndcap) {
                result.push_back(uncalibMaker_endcap_.makeRecHit(*itdg, pedVec, gainRatios, weights, chi2mat));
        } else {
                result.push_back(uncalibMaker_barrel_.makeRecHit(*itdg, pedVec, gainRatios, weights, chi2mat));
        }
*/
        if (detid.subdetId()==EcalEndcap) {
                result.push_back(uncalibMaker_endcap_.makeRecHit(*itdg, pedVec, pedRMSVec, gainRatios, weights, testbeamEEShape));
        } else {
                result.push_back(uncalibMaker_barrel_.makeRecHit(*itdg, pedVec, pedRMSVec, gainRatios, weights, testbeamEBShape));
        }
        return true;
}
void EcalUncalibRecHitWorkerWeights::set ( const edm::EventSetup es) [virtual]

Member Data Documentation

Definition at line 54 of file EcalUncalibRecHitWorkerWeights.h.

Definition at line 51 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

Definition at line 45 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

Definition at line 46 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

Definition at line 50 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

Definition at line 44 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().

Definition at line 49 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

Definition at line 60 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

Definition at line 59 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

Definition at line 56 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

Definition at line 57 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

Definition at line 53 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run().

Definition at line 47 of file EcalUncalibRecHitWorkerWeights.h.

Referenced by run(), and set().