CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DataFormats/EcalRecHit/interface/EcalRecHit.h

Go to the documentation of this file.
00001 #ifndef DATAFORMATS_ECALRECHIT_H
00002 #define DATAFORMATS_ECALRECHIT_H 1
00003 
00004 #include "DataFormats/CaloRecHit/interface/CaloRecHit.h"
00005 
00012 class EcalRecHit : public CaloRecHit {
00013 public:
00014   typedef DetId key_type;
00015 
00016   // recHit flags
00017     enum Flags { 
00018           kGood=0,                   // channel ok, the energy and time measurement are reliable
00019           kPoorReco,                 // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2)
00020           kOutOfTime,                // the energy is available from the UncalibRecHit (sync reco), but the event is out of time
00021           kFaultyHardware,           // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy)
00022           kNoisy,                    // the channel is very noisy
00023           kPoorCalib,                // the energy is available from the UncalibRecHit, but the calibration of the channel is poor
00024           kSaturated,                // saturated channel (recovery not tried)
00025           kLeadingEdgeRecovered,     // saturated channel: energy estimated from the leading edge before saturation
00026           kNeighboursRecovered,      // saturated/isolated dead: energy estimated from neighbours
00027           kTowerRecovered,           // channel in TT with no data link, info retrieved from Trigger Primitive
00028           kDead,                     // channel is dead and any recovery fails
00029           kKilled,                   // MC only flag: the channel is killed in the real detector
00030           kTPSaturated,              // the channel is in a region with saturated TP
00031           kL1SpikeFlag,              // the channel is in a region with TP with sFGVB = 0
00032           kWeird,                    // the signal is believed to originate from an anomalous deposit (spike) 
00033           kDiWeird,                  // the signal is anomalous, and neighbors another anomalous signal  
00034                                      //
00035           kUnknown                   // to ease the interface with functions returning flags. 
00036   };
00037 
00038   // ES recHit flags
00039   enum ESFlags {
00040           kESGood,
00041           kESDead,
00042           kESHot,
00043           kESPassBX,
00044           kESTwoGoodRatios,
00045           kESBadRatioFor12,
00046           kESBadRatioFor23Upper,
00047           kESBadRatioFor23Lower,
00048           kESTS1Largest,
00049           kESTS3Largest,
00050           kESTS3Negative,
00051           kESSaturated,
00052           kESTS2Saturated,
00053           kESTS3Saturated,
00054           kESTS13Sigmas,
00055           kESTS15Sigmas
00056   };
00057 
00069   EcalRecHit();
00070   // by default a recHit is greated with no flag
00071   EcalRecHit(const DetId& id, float energy, float time, uint32_t flags = 0, uint32_t flagBits = 0);
00073   // For the moment not returning a specific id for subdetector
00074   DetId id() const { return DetId(detid());}
00075   bool isRecovered() const;
00076   bool isTimeValid() const;
00077   bool isTimeErrorValid() const;
00078 
00079 
00080   float chi2() const;
00081   float outOfTimeChi2() const;
00082 
00083   // set the energy for out of time events
00084   // (only energy >= 0 will be stored)
00085   float outOfTimeEnergy() const;
00086   float timeError() const;
00087 
00088   void setChi2( float chi2 );
00089   void setOutOfTimeChi2( float chi2 );
00090   void setOutOfTimeEnergy( float energy );
00091 
00092   void setTimeError( uint8_t timeErrBits );
00093 
00094   
00096   void setFlag(int flag) {flagBits_|= (0x1 << flag);}
00097   void unsetFlag(int flag) {flagBits_ &= ~(0x1 << flag);}
00098 
00100   bool checkFlag(int flag) const{return flagBits_ & ( 0x1<<flag);}
00101 
00103   bool checkFlagMask(uint32_t mask) const { return flagBits_&mask; }
00104 
00106   Flags recoFlag() const ;
00107 
00108 private:
00109 
00111   uint32_t flagBits_;
00112 };
00113 
00114 std::ostream& operator<<(std::ostream& s, const EcalRecHit& hit);
00115 
00116 #endif