CMS 3D CMS Logo

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