CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/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           kHasSwitchToGain6,         // at least one data frame is in G6
00035           kHasSwitchToGain1,         // at least one data frame is in G1
00036                                      //
00037           kUnknown                   // to ease the interface with functions returning flags. 
00038   };
00039 
00040   // ES recHit flags
00041   enum ESFlags {
00042           kESGood,
00043           kESDead,
00044           kESHot,
00045           kESPassBX,
00046           kESTwoGoodRatios,
00047           kESBadRatioFor12,
00048           kESBadRatioFor23Upper,
00049           kESBadRatioFor23Lower,
00050           kESTS1Largest,
00051           kESTS3Largest,
00052           kESTS3Negative,
00053           kESSaturated,
00054           kESTS2Saturated,
00055           kESTS3Saturated,
00056           kESTS13Sigmas,
00057           kESTS15Sigmas
00058   };
00059 
00071   EcalRecHit();
00072   // by default a recHit is greated with no flag
00073   EcalRecHit(const DetId& id, float energy, float time, uint32_t flags = 0, uint32_t flagBits = 0);
00075   // For the moment not returning a specific id for subdetector
00076   DetId id() const { return DetId(detid());}
00077   bool isRecovered() const;
00078   bool isTimeValid() const;
00079   bool isTimeErrorValid() const;
00080 
00081 
00082   float chi2() const;
00083   float outOfTimeChi2() const;
00084 
00085   // set the energy for out of time events
00086   // (only energy >= 0 will be stored)
00087   float outOfTimeEnergy() const;
00088   float timeError() const;
00089 
00090   void setChi2( float chi2 );
00091   void setOutOfTimeChi2( float chi2 );
00092   void setOutOfTimeEnergy( float energy );
00093 
00094   void setTimeError( uint8_t timeErrBits );
00095 
00096   
00098   void setFlag(int flag) {flagBits_|= (0x1 << flag);}
00099   void unsetFlag(int flag) {flagBits_ &= ~(0x1 << flag);}
00100 
00102   bool checkFlag(int flag) const{return flagBits_ & ( 0x1<<flag);}
00103 
00105   bool checkFlagMask(uint32_t mask) const { return flagBits_&mask; }
00106 
00108   Flags recoFlag() const ;
00109 
00110 private:
00111 
00113   uint32_t flagBits_;
00114 };
00115 
00116 std::ostream& operator<<(std::ostream& s, const EcalRecHit& hit);
00117 
00118 #endif