CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

EcalRecHit Class Reference

#include <EcalRecHit.h>

Inheritance diagram for EcalRecHit:
CaloRecHit

List of all members.

Public Types

enum  ESFlags {
  kESGood, kESDead, kESHot, kESPassBX,
  kESTwoGoodRatios, kESBadRatioFor12, kESBadRatioFor23Upper, kESBadRatioFor23Lower,
  kESTS1Largest, kESTS3Largest, kESTS3Negative, kESSaturated,
  kESTS2Saturated, kESTS3Saturated, kESTS13Sigmas, kESTS15Sigmas
}
enum  Flags {
  kGood = 0, kPoorReco, kOutOfTime, kFaultyHardware,
  kNoisy, kPoorCalib, kSaturated, kLeadingEdgeRecovered,
  kNeighboursRecovered, kTowerRecovered, kFake, kFakeNeighbours,
  kDead, kKilled, kTPSaturated, kL1SpikeFlag,
  kUnknown
}
typedef DetId key_type

Public Member Functions

float chi2 () const
float chi2Prob () const
 EcalRecHit (const DetId &id, float energy, float time, uint32_t flags=0, uint32_t flagBits=0)
 EcalRecHit ()
uint32_t flagBits () const
DetId id () const
 get the id
bool isRecovered () const
bool isTimeErrorValid () const
bool isTimeValid () const
float outOfTimeChi2 () const
float outOfTimeChi2Prob () const
float outOfTimeEnergy () const
uint32_t recoFlag () const
void setChi2 (float chi2)
void setChi2Prob (float chi2Prob)
void setFlagBits (uint32_t flagBits)
void setOutOfTimeChi2 (float chi2)
void setOutOfTimeChi2Prob (float chi2Prob)
void setOutOfTimeEnergy (float energy)
void setRecoFlag (uint32_t flag)
void setTimeError (uint8_t timeErrBits)
float timeError () const

Private Attributes

uint32_t flagBits_

Detailed Description

id:
Author:
P. Meridiani INFN Roma1

Definition at line 12 of file EcalRecHit.h.


Member Typedef Documentation

Definition at line 14 of file EcalRecHit.h.


Member Enumeration Documentation

Enumerator:
kESGood 
kESDead 
kESHot 
kESPassBX 
kESTwoGoodRatios 
kESBadRatioFor12 
kESBadRatioFor23Upper 
kESBadRatioFor23Lower 
kESTS1Largest 
kESTS3Largest 
kESTS3Negative 
kESSaturated 
kESTS2Saturated 
kESTS3Saturated 
kESTS13Sigmas 
kESTS15Sigmas 

Definition at line 40 of file EcalRecHit.h.

Enumerator:
kGood 
kPoorReco 
kOutOfTime 
kFaultyHardware 
kNoisy 
kPoorCalib 
kSaturated 
kLeadingEdgeRecovered 
kNeighboursRecovered 
kTowerRecovered 
kFake 
kFakeNeighbours 
kDead 
kKilled 
kTPSaturated 
kL1SpikeFlag 
kUnknown 

Definition at line 17 of file EcalRecHit.h.

             { 
          kGood=0,                   // channel ok, the energy and time measurement are reliable
          kPoorReco,                 // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2)
          kOutOfTime,                // the energy is available from the UncalibRecHit (sync reco), but the event is out of time
          kFaultyHardware,           // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy)
          kNoisy,                    // the channel is very noisy
          kPoorCalib,                // the energy is available from the UncalibRecHit, but the calibration of the channel is poor
          kSaturated,                // saturated channel (recovery not tried)
          kLeadingEdgeRecovered,     // saturated channel: energy estimated from the leading edge before saturation
          kNeighboursRecovered,      // saturated/isolated dead: energy estimated from neighbours
          kTowerRecovered,           // channel in TT with no data link, info retrieved from Trigger Primitive
          kFake,                     // the signal in the channel is a fake (e.g. a so-called spike)
          kFakeNeighbours,           // the signal in the channel is a fake and it is detected by looking at the neighbours
          kDead,                     // channel is dead and any recovery fails
          kKilled,                   // MC only flag: the channel is killed in the real detector
          kTPSaturated,              // only for flagBits_: the channel is in a region with saturated TP
          kL1SpikeFlag,              // only for flagBits_: the channel is in a region with TP with sFGVB = 0
                                     // pro tempore, this will become obsolete when the online protection against spikes will be activated
                                     //
          kUnknown                   // to easy the interface with functions returning flags
  };

Constructor & Destructor Documentation

EcalRecHit::EcalRecHit ( )

bit structure of CaloRecHit::flags_ used in EcalRecHit:

| 32 | 31...25 | 24...12 | 11...5 | 4...1 | | | | | | | | | | +--> reco flags ( 4 bits) | | | +--> chi2 for in time events ( 7 bits) | | +--> energy for out-of-time events (13 bits) | +--> chi2 for out-of-time events ( 7 bits) +--> spare ( 1 bit )

Definition at line 11 of file EcalRecHit.cc.

                       : CaloRecHit(), flagBits_(0) {
}
EcalRecHit::EcalRecHit ( const DetId id,
float  energy,
float  time,
uint32_t  flags = 0,
uint32_t  flagBits = 0 
)

Definition at line 14 of file EcalRecHit.cc.


Member Function Documentation

float EcalRecHit::chi2 ( void  ) const

Definition at line 27 of file EcalRecHit.cc.

References CaloRecHit::flags().

Referenced by BetaCalculatorTK::addInfoToCandidate().

{
        uint32_t rawChi2 = 0x7F & (flags()>>4);
        return (float)rawChi2 / (float)((1<<7)-1) * 64.;
}
float EcalRecHit::chi2Prob ( ) const

Definition at line 33 of file EcalRecHit.cc.

References ExpressReco_HICollisions_FallBack::cerr, and CaloRecHit::flags().

{
        std::cerr << "Please retrieve the chi2 value instead of its probability.\n";
        std::cerr << "Use the method EcalRecHit::chi2() for that purpose.\n";
        std::cerr << "The chi2 is still in a commissioning phase and further\n";
        std::cerr << "actions will be taken in the future. Thanks.\n";
        assert(false);
        uint32_t rawChi2Prob = 0x7F & (flags()>>4);
        return (float)rawChi2Prob / (float)((1<<7)-1);
}
uint32_t EcalRecHit::flagBits ( ) const [inline]

Definition at line 83 of file EcalRecHit.h.

References flagBits_.

Referenced by setFlagBits().

{ return flagBits_; }
DetId EcalRecHit::id ( void  ) const [inline]
bool EcalRecHit::isRecovered ( ) const
bool EcalRecHit::isTimeErrorValid ( ) const

Definition at line 184 of file EcalRecHit.cc.

References isTimeValid(), and timeError().

Referenced by BetaCalculatorTK::addInfoToCandidate().

{
        if(!isTimeValid())
          return false;
        if(timeError() >= 10000)
          return false;

        return true;
}
bool EcalRecHit::isTimeValid ( ) const

Definition at line 175 of file EcalRecHit.cc.

References timeError().

Referenced by BetaCalculatorTK::addInfoToCandidate(), and isTimeErrorValid().

{
        if(timeError() <= 0)
          return false;
        else
          return true;
}
float EcalRecHit::outOfTimeChi2 ( ) const

Definition at line 58 of file EcalRecHit.cc.

References CaloRecHit::flags().

Referenced by BetaCalculatorTK::addInfoToCandidate().

{
        uint32_t rawChi2Prob = 0x7F & (flags()>>24);
        return (float)rawChi2Prob / (float)((1<<7)-1) * 64.;
}
float EcalRecHit::outOfTimeChi2Prob ( ) const

Definition at line 44 of file EcalRecHit.cc.

References ExpressReco_HICollisions_FallBack::cerr.

{
        std::cerr << "Please retrieve the chi2 value instead of its probability.\n";
        std::cerr << "Use the method EcalRecHit::outOfTimeChi2() for that purpose.\n";
        std::cerr << "The chi2 is still in a commissioning phase and further\n";
        std::cerr << "actions will be taken in the future. Thanks.\n";
        assert(false);
        /*
        uint32_t rawChi2Prob = 0x7F & (flags()>>24);
        return (float)rawChi2Prob / (float)((1<<7)-1);
        */
        return -1; // will never get here
}
float EcalRecHit::outOfTimeEnergy ( ) const

Definition at line 64 of file EcalRecHit.cc.

References CaloRecHit::flags(), and funct::pow().

Referenced by BetaCalculatorTK::addInfoToCandidate().

{
        uint32_t rawEnergy = (0x1FFF & flags()>>11);
        uint16_t exponent = rawEnergy>>10;
        uint16_t significand = ~(0xE<<9) & rawEnergy;
        return (float) significand*pow(10,exponent-5);
}
uint32_t EcalRecHit::recoFlag ( ) const [inline]
void EcalRecHit::setChi2 ( float  chi2)

Definition at line 97 of file EcalRecHit.cc.

References CaloRecHit::flags(), and CaloRecHit::setFlags().

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

{
        // bound the max value of the chi2
        if ( chi2 > 64 ) chi2 = 64;
        // use 7 bits
        uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
        // shift by 4 bits (recoFlag)
        setFlags( (~(0x7F<<4) & flags()) | ((rawChi2 & 0x7F)<<4) );
}
void EcalRecHit::setChi2Prob ( float  chi2Prob)

Definition at line 77 of file EcalRecHit.cc.

References ExpressReco_HICollisions_FallBack::cerr.

{
        /* not used - store the raw chi2 instead */
        std::cerr << "Please store the chi2 value instead of its probability.\n";
        std::cerr << "Use the method EcalRecHit::setChi2() for that purpose.\n";
        std::cerr << "The chi2 is still in a commissioning phase and further\n";
        std::cerr << "actions will be taken in the future. Thanks.\n";
        assert(false);
        /*
        if ( chi2Prob < 0 || chi2Prob > 1 ) {
                edm::LogWarning("EcalRecHit::setChi2Prob") << "chi2Prob outside limits [0, 1] : " << chi2Prob;
        } else {
                // use 7 bits
                uint32_t rawChi2Prob = lround( chi2Prob * ((1<<7)-1) );
                // shift by 4 bits (recoFlag)
                setFlags( (~(0x7F<<4) & flags()) | ((rawChi2Prob & 0x7F)<<4) );
        }
        */
}
void EcalRecHit::setFlagBits ( uint32_t  flagBits) [inline]

Definition at line 94 of file EcalRecHit.h.

References flagBits(), and flagBits_.

Referenced by EcalRecHitWorkerRecover::run().

void EcalRecHit::setOutOfTimeChi2 ( float  chi2)

Definition at line 140 of file EcalRecHit.cc.

References CaloRecHit::flags(), and CaloRecHit::setFlags().

{
        // bound the max value of chi2
        if ( chi2 > 64 ) chi2 = 64;
        // use 7 bits
        uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
        // shift by 24 bits (recoFlag + chi2 + outOfTimeEnergy)
        setFlags( (~(0x7F<<24) & flags()) | ((rawChi2 & 0x7F)<<24) );
}
void EcalRecHit::setOutOfTimeChi2Prob ( float  chi2Prob)

Definition at line 119 of file EcalRecHit.cc.

References ExpressReco_HICollisions_FallBack::cerr.

{
        /* not used - store the raw chi2 instead */
        std::cerr << "Please store the chi2 value instead of its probability.\n";
        std::cerr << "Use the method EcalRecHit::setOutOfTimeChi2() for that purpose.\n";
        std::cerr << "The chi2 is still in a commissioning phase and further\n";
        std::cerr << "actions will be taken in the future. Thanks.\n";
        assert(false);
        /*
        if ( chi2Prob < 0 || chi2Prob > 1 ) {
                edm::LogWarning("EcalRecHit::setOutOfTimeChi2Prob") << "chi2Prob outside limits [0, 1] : " << chi2Prob;
        } else {
                // use 7 bits
                uint32_t rawChi2Prob = lround( chi2Prob * ((1<<7)-1) );
                // shift by 24 bits (recoFlag + chi2 + outOfTimeEnergy)
                setFlags( (~(0x7F<<24) & flags()) | ((rawChi2Prob & 0x7F)<<24) );
        }
        */
}
void EcalRecHit::setOutOfTimeEnergy ( float  energy)

Definition at line 107 of file EcalRecHit.cc.

References CaloRecHit::flags(), funct::pow(), and CaloRecHit::setFlags().

Referenced by ESRecHitSimAlgo::reconstruct().

{
        if ( energy > 0.001 ) {
                uint16_t exponent = lround(floor(log10(energy)))+3;
                uint16_t significand = lround(energy/pow(10,exponent-5));
                // use 13 bits (3 exponent, 10 significand)
                uint32_t rawEnergy = exponent<<10 | significand;
                // shift by 11 bits (recoFlag + chi2)
                setFlags( ( ~(0x1FFF<<11) & flags()) | ((rawEnergy & 0x1FFF)<<11) );
        }
}
void EcalRecHit::setRecoFlag ( uint32_t  flag)

Definition at line 72 of file EcalRecHit.cc.

References CaloRecHit::flags(), and CaloRecHit::setFlags().

Referenced by ESRecHitAnalyticAlgo::reconstruct(), and ESRecHitFitAlgo::reconstruct().

{
        setFlags( (~0xF & flags()) | (flag & 0xF) );
}
void EcalRecHit::setTimeError ( uint8_t  timeErrBits)

Definition at line 151 of file EcalRecHit.cc.

References CaloRecHit::aux(), and CaloRecHit::setAux().

{
        // take the bits and put them in the right spot
        setAux( (~0xFF & aux()) | timeErrBits );
}
float EcalRecHit::timeError ( ) const

Definition at line 158 of file EcalRecHit.cc.

References CaloRecHit::aux(), and funct::pow().

Referenced by BetaCalculatorTK::addInfoToCandidate(), isTimeErrorValid(), and isTimeValid().

{
        uint32_t timeErrorBits = 0xFF & aux();
        // all bits off --> time reco bailed out (return negative value)
        if( (0xFF & timeErrorBits) == 0x00 )
                return -1;
        // all bits on  --> time error over 5 ns (return large value)
        if( (0xFF & timeErrorBits) == 0xFF )
                return 10000;

        float LSB = 1.26008;
        uint8_t exponent = timeErrorBits>>5;
        uint8_t significand = timeErrorBits & ~(0x7<<5);
        return pow(2.,exponent)*significand*LSB/1000.;
}

Member Data Documentation

uint32_t EcalRecHit::flagBits_ [private]

Definition at line 98 of file EcalRecHit.h.

Referenced by flagBits(), and setFlagBits().