CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ElectronEPcombinator Class Reference

#include <ElectronEPcombinator.h>

List of all members.

Public Member Functions

void combine (SimpleElectron &electron)
 ElectronEPcombinator ()
void setCombinationMode (int mode)

Private Member Functions

void computeEPcombination ()

Private Attributes

double combinedMomentum_
double combinedMomentumError_
int elClass_
SimpleElectron electron_
int mode_
double scEnergy_
double scEnergyError_
double trackerMomentum_
double trackerMomentumError_

Detailed Description

Definition at line 8 of file ElectronEPcombinator.h.


Constructor & Destructor Documentation

ElectronEPcombinator::ElectronEPcombinator ( ) [inline]

Definition at line 11 of file ElectronEPcombinator.h.

{} 

Member Function Documentation

void ElectronEPcombinator::combine ( SimpleElectron electron)
void ElectronEPcombinator::computeEPcombination ( ) [private]

Definition at line 14 of file ElectronEPcombinator.cc.

References combinedMomentum_, combinedMomentumError_, elClass_, electron_, SimpleElectron::getElClass(), SimpleElectron::getNewEnergy(), SimpleElectron::getNewEnergyError(), SimpleElectron::getRegEnergy(), SimpleElectron::getRegEnergyError(), SimpleElectron::getTrackerMomentum(), SimpleElectron::getTrackerMomentumError(), mode_, scEnergy_, scEnergyError_, mathSSE::sqrt(), trackerMomentum_, and trackerMomentumError_.

Referenced by combine().

{
    if ( mode_==1 )
    {
        scEnergy_ = electron_.getNewEnergy();
        scEnergyError_ = electron_.getNewEnergyError();
    }
    if ( mode_==2 )
    {
        scEnergy_ = electron_.getRegEnergy();
        scEnergyError_ = electron_.getRegEnergyError();
    }
    trackerMomentum_ = electron_.getTrackerMomentum();
    trackerMomentumError_ = electron_.getTrackerMomentumError();
    elClass_ = electron_.getElClass();
    
    combinedMomentum_ = scEnergy_; // initial
    combinedMomentumError_ = 999.;
    
    // first check for large errors
    
    if ( trackerMomentumError_/trackerMomentum_ > 0.5 
        && scEnergyError_/scEnergy_ <= 0.5 ) 
    {
      combinedMomentum_ = scEnergy_;    
      combinedMomentumError_ = scEnergyError_;
    }
    else if ( trackerMomentumError_/trackerMomentum_ <= 0.5 
            && scEnergyError_/scEnergy_ > 0.5 )
    {
      combinedMomentum_ = trackerMomentum_;  
      combinedMomentumError_ = trackerMomentumError_;
    }
    else if ( trackerMomentumError_/trackerMomentum_ > 0.5 
            && scEnergyError_/scEnergy_ > 0.5 )
    {
        if ( trackerMomentumError_/trackerMomentum_ < scEnergyError_/scEnergy_ ) 
        {
            combinedMomentum_ = trackerMomentum_; 
            combinedMomentumError_ = trackerMomentumError_;
        }
        else
        {
            combinedMomentum_ = scEnergy_; 
            combinedMomentumError_ = scEnergyError_;
        }
    }
    
    // then apply the combination algorithm
    else 
    {
        // calculate E/p and corresponding error
        float eOverP = scEnergy_ / trackerMomentum_;
        float errorEOverP = sqrt(
                             (scEnergyError_/trackerMomentum_)*(scEnergyError_/trackerMomentum_) +
                             (scEnergy_*trackerMomentumError_/trackerMomentum_/trackerMomentum_) *
                             (scEnergy_*trackerMomentumError_/trackerMomentum_/trackerMomentum_) );
        
        bool eleIsNotInCombination = false;
        if ( ( eOverP  > 1 + 2.5*errorEOverP ) 
                 || ( eOverP  < 1 - 2.5*errorEOverP ) 
                 || ( eOverP < 0.8 ) || ( eOverP > 1.3 ) )
        { 
            eleIsNotInCombination = true; 
        }

        if ( eleIsNotInCombination )
        {
            if ( eOverP > 1 )
            { 
                combinedMomentum_ = scEnergy_; 
                combinedMomentumError_ = scEnergyError_; 
            }
            else
            {
                if ( elClass_ == 0 ) // == reco::GsfElectron::GOLDEN)
                { 
                    combinedMomentum_ = scEnergy_; 
                    combinedMomentumError_ = scEnergyError_; 
                }
                if ( elClass_ == 1 ) //reco::GsfElectron::BIGBREM)
                {
                    if ( scEnergy_ < 36 )
                    { 
                        combinedMomentum_ = trackerMomentum_; 
                        combinedMomentumError_ = trackerMomentumError_; 
                    } else
                    { 
                        combinedMomentum_ = scEnergy_; 
                        combinedMomentumError_ = scEnergyError_; 
                    }
                }
                if ( elClass_ == 2 ) // == reco::GsfElectron::BADTRACK)
                { 
                    combinedMomentum_ = scEnergy_; 
                    combinedMomentumError_ = scEnergyError_; 
                }
                if ( elClass_ == 3 ) //reco::GsfElectron::SHOWERING)
                {
                    if ( scEnergy_ < 30 )
                    { 
                        combinedMomentum_ = trackerMomentum_; 
                        combinedMomentumError_ = trackerMomentumError_; 
                    } else
                    { 
                        combinedMomentum_ = scEnergy_; 
                        combinedMomentumError_ = scEnergyError_;
                    }
                }
                if ( elClass_ == 4 ) //reco::GsfElectron::GAP)
                {
                    if ( scEnergy_ < 60 )
                    { 
                        combinedMomentum_ = trackerMomentum_; 
                        combinedMomentumError_ = trackerMomentumError_; 
                    } else
                    { 
                        combinedMomentum_ = scEnergy_; 
                        combinedMomentumError_ = scEnergyError_; 
                    }
                }
            }
        } else
        {
         // combination
         combinedMomentum_ = (scEnergy_/scEnergyError_/scEnergyError_ 
                            + trackerMomentum_/trackerMomentumError_/trackerMomentumError_) /
                            (1/scEnergyError_/scEnergyError_ + 1/trackerMomentumError_/trackerMomentumError_);
         float combinedMomentum_Variance = 1 / (1/scEnergyError_/scEnergyError_ + 1/trackerMomentumError_/trackerMomentumError_);
         combinedMomentumError_ = sqrt(combinedMomentum_Variance);
        }
    } 
}
void ElectronEPcombinator::setCombinationMode ( int  mode) [inline]

Definition at line 13 of file ElectronEPcombinator.h.

References alignBH_cfg::mode, and mode_.

{mode_ = mode;}

Member Data Documentation

Definition at line 18 of file ElectronEPcombinator.h.

Referenced by combine(), and computeEPcombination().

Definition at line 19 of file ElectronEPcombinator.h.

Referenced by combine(), and computeEPcombination().

Definition at line 24 of file ElectronEPcombinator.h.

Referenced by computeEPcombination().

Definition at line 16 of file ElectronEPcombinator.h.

Referenced by combine(), and computeEPcombination().

Definition at line 25 of file ElectronEPcombinator.h.

Referenced by computeEPcombination(), and setCombinationMode().

Definition at line 20 of file ElectronEPcombinator.h.

Referenced by computeEPcombination().

Definition at line 21 of file ElectronEPcombinator.h.

Referenced by computeEPcombination().

Definition at line 22 of file ElectronEPcombinator.h.

Referenced by computeEPcombination().

Definition at line 23 of file ElectronEPcombinator.h.

Referenced by computeEPcombination().