Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:17

0001 #ifndef DATAFORMATS_ECALUNCALIBRATEDRECHIT
0002 #define DATAFORMATS_ECALUNCALIBRATEDRECHIT
0003 
0004 #include <vector>
0005 #include "DataFormats/DetId/interface/DetId.h"
0006 #include "DataFormats/EcalDigi/interface/EcalDataFrame.h"
0007 
0008 class EcalUncalibratedRecHit {
0009 public:
0010   typedef DetId key_type;
0011 
0012   enum Flags {
0013     kGood = -1,  // channel is good (mutually exclusive with other states)  setFlagBit(kGood) reset flags_ to zero
0014     kPoorReco,   // channel has been badly reconstructed (e.g. bad shape, bad chi2 etc.)
0015     kSaturated,  // saturated channel
0016     kOutOfTime,  // channel out of time
0017     kLeadingEdgeRecovered,  // saturated channel: energy estimated from the leading edge before saturation
0018     kHasSwitchToGain6,      // at least one data frame is in G6
0019     kHasSwitchToGain1       // at least one data frame is in G1
0020 
0021   };
0022 
0023   EcalUncalibratedRecHit();
0024 
0025   EcalUncalibratedRecHit(
0026       const DetId& id, float ampl, float ped, float jit, float chi2, uint32_t flags = 0, uint32_t aux = 0);
0027 
0028   float amplitude() const { return amplitude_; }
0029   float amplitudeError() const { return amplitudeError_; }
0030   float pedestal() const { return pedestal_; }
0031   float jitter() const { return jitter_; }
0032   float chi2() const { return chi2_; }
0033   float outOfTimeAmplitude(int bx) const { return OOTamplitudes_[bx]; }
0034 
0035   uint32_t flags() const { return flags_; }
0036   float jitterError() const;
0037   uint8_t jitterErrorBits() const;
0038   DetId id() const { return id_; }
0039 
0040   void setAmplitude(float amplitude) { amplitude_ = amplitude; }
0041   void setAmplitudeError(float amplitudeerror) { amplitudeError_ = amplitudeerror; }
0042   void setPedestal(float pedestal) { pedestal_ = pedestal; }
0043   void setJitter(float jitter) { jitter_ = jitter; }
0044   void setChi2(float chi2) { chi2_ = chi2; }
0045   void setOutOfTimeAmplitude(int bx, float amplitude) { OOTamplitudes_[bx] = amplitude; }
0046 
0047   void setJitterError(float jitterErr);
0048   void setFlags(uint32_t flags) { flags_ = flags; }
0049   void setId(DetId id) { id_ = id; }
0050   void setAux(uint32_t aux) { aux_ = aux; }
0051   void setFlagBit(Flags flag);
0052   bool checkFlag(Flags flag) const;
0053 
0054   bool isSaturated() const;
0055   bool isJitterValid() const;
0056   bool isJitterErrorValid() const;
0057 
0058 private:
0059   float amplitude_;       //< Reconstructed amplitude
0060   float amplitudeError_;  //< Reconstructed amplitude uncertainty
0061   float pedestal_;        //< Reconstructed pedestal
0062   float jitter_;          //< Reconstructed time jitter
0063   float chi2_;            //< Chi2 of the pulse
0064   //< Out-Of-Time reconstructed amplitude, one for each active BX, from readout sample 0 to 9
0065   float OOTamplitudes_[EcalDataFrame::MAXSAMPLES];
0066   float OOTchi2_;   //< Out-Of-Time Chi2
0067   uint32_t flags_;  //< flag to be propagated to RecHit
0068   uint32_t aux_;    //< aux word; first 8 bits contain time (jitter) error
0069   DetId id_;        //< Detector ID
0070 };
0071 
0072 #endif