Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:21

0001 #ifndef DATAFORMATS_HGCRECHIT_H
0002 #define DATAFORMATS_HGCRECHIT_H 1
0003 
0004 #include "DataFormats/CaloRecHit/interface/CaloRecHit.h"
0005 #include <vector>
0006 
0007 /** \class HGCRecHit
0008  *  
0009  * based on EcalRecHit
0010  *
0011  * \author Valeri Andreev
0012  */
0013 
0014 class HGCRecHit : public CaloRecHit {
0015 public:
0016   typedef DetId key_type;
0017 
0018   // HGCEE recHit flags
0019   enum Flags {
0020     kGood = 0,   // channel ok, the energy and time measurement are reliable
0021     kPoorReco,   // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2)
0022     kOutOfTime,  // the energy is available from the UncalibRecHit (sync reco), but the event is out of time
0023     kFaultyHardware,  // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy)
0024     kNoisy,           // the channel is very noisy
0025     kPoorCalib,  // the energy is available from the UncalibRecHit, but the calibration of the channel is poor
0026     kSaturated,  // saturated channel (recovery not tried)
0027     kDead,       // channel is dead and any recovery fails
0028     kKilled,     // MC only flag: the channel is killed in the real detector
0029     kWeird,      // the signal is believed to originate from an anomalous deposit (spike)
0030     kDiWeird,    // the signal is anomalous, and neighbors another anomalous signal
0031                  //
0032     kUnknown     // to ease the interface with functions returning flags.
0033   };
0034 
0035   //  HGCfhe recHit flags
0036   enum HGCfheFlags { kHGCfheGood, kHGCfheDead, kHGCfheHot, kHGCfhePassBX, kHGCfheSaturated };
0037 
0038   //  HGCbhe recHit flags
0039   enum HGCbheFlags { kHGCbheGood, kHGCbheDead, kHGCbheHot, kHGCbhePassBX, kHGCbheSaturated };
0040 
0041   //   HFnose rechit flags
0042   enum HFNoseFlags {
0043     kHFNoseGood,
0044     kHFNosePoorReco,
0045     kHFNoseOutOfTime,
0046     kHFNoseFaultyHardware,
0047     kHFNoseNoisy,
0048     kHFNosePoorCalib,
0049     kHFNoseSaturated,
0050     kHFNoseDead,
0051     kHFNoseKilled,
0052     kHFNoseWeird,
0053     kHFNoseDiWeird,
0054     kHFNoseUnknown
0055   };
0056 
0057   /** bit structure of CaloRecHit::flags_ used in EcalRecHit:
0058    *
0059    *  | 32 | 31...25 | 24...12 | 11...5 | 4...1 |
0060    *     |      |         |         |       |
0061    *     |      |         |         |       +--> reco flags       ( 4 bits)
0062    *     |      |         |         +--> chi2 for in time events  ( 7 bits)
0063    *     |      |         +--> energy for out-of-time events      (13 bits)
0064    *     |      +--> chi2 for out-of-time events                  ( 7 bits)
0065    *     +--> spare                                               ( 1 bit )
0066    */
0067 
0068   HGCRecHit();
0069   // by default a recHit is greated with no flag
0070   HGCRecHit(const DetId& id,
0071             float energy,
0072             float time,
0073             uint32_t flags = 0,
0074             uint32_t flagBits = 0,
0075             uint8_t son = 0,
0076             float timeError = 0.f);
0077   /// get the id
0078   // For the moment not returning a specific id for subdetector
0079   DetId id() const { return DetId(detid()); }
0080   /////  bool isRecovered() const;
0081   bool isTimeValid() const;
0082   bool isTimeErrorValid() const;
0083 
0084   float chi2() const;
0085   float outOfTimeChi2() const;
0086   float signalOverSigmaNoise() const;
0087 
0088   // set the energy for out of time events
0089   // (only energy >= 0 will be stored)
0090   float outOfTimeEnergy() const;
0091   float timeError() const;
0092 
0093   void setChi2(float chi2);
0094   void setOutOfTimeChi2(float chi2);
0095   void setOutOfTimeEnergy(float energy);
0096   void setSignalOverSigmaNoise(float sOverNoise);
0097 
0098   void setTimeError(float timeErr);
0099 
0100   /// set the flags (from Flags or ESFlags)
0101   void setFlag(int flag) { flagBits_ |= (0x1 << flag); }
0102   void unsetFlag(int flag) { flagBits_ &= ~(0x1 << flag); }
0103 
0104   /// check if the flag is true
0105   bool checkFlag(int flag) const { return flagBits_ & (0x1 << flag); }
0106 
0107   /// check if one of the flags in a set is true
0108   bool checkFlags(const std::vector<int>& flagsvec) const;
0109 
0110   //added for validation
0111   uint32_t flagBits() const { return flagBits_; }
0112 
0113 private:
0114   /// store rechit condition (see Flags enum) in a bit-wise way
0115   uint32_t flagBits_;
0116   uint8_t signalOverSigmaNoise_;
0117   float timeError_;
0118 };
0119 
0120 std::ostream& operator<<(std::ostream& s, const HGCRecHit& hit);
0121 
0122 #endif