Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:24:25

0001 #ifndef RecoLocalCalo_HcalRecAlgos_HFSimpleTimeCheck_h_
0002 #define RecoLocalCalo_HcalRecAlgos_HFSimpleTimeCheck_h_
0003 
0004 #include <utility>
0005 
0006 #include "RecoLocalCalo/HcalRecAlgos/interface/AbsHFPhase1Algo.h"
0007 #include "RecoLocalCalo/HcalRecAlgos/interface/HFAnodeStatus.h"
0008 
0009 class HFSimpleTimeCheck : public AbsHFPhase1Algo {
0010 public:
0011   // "tlimits" are the rise time limits for the anode pair.
0012   // The first element of the pair is the min rise time and the
0013   // second element is the max rise time. tlimits[0] is for the
0014   // first anode and tlimits[1] is for the second one.
0015   //
0016   // "energyWeights" is the lookup table for the energy weights
0017   // based on the multi-state decision about anode quality.
0018   // The first index of this array corresponds to the decision
0019   // about the status of the anodes, and the second index corresponds
0020   // to the anode number. Possible status values are given in the
0021   // HFAnodeStatus enum. Mapping of the first index to the possible
0022   // status values is as follows:
0023   //
0024   // Indices 0 to HFAnodeStatus::N_POSSIBLE_STATES-1 correspond to
0025   // the situations in which the first anode has the status "OK"
0026   // and the second anode has the status given by the index.
0027   //
0028   // HFAnodeStatus::N_POSSIBLE_STATES to HFAnodeStatus::N_POSSIBLE_STATES-2
0029   // correspond to the situations in which the second anode has
0030   // the status "OK" and the first anode has the status given
0031   // by index - HFAnodeStatus::N_POSSIBLE_STATES + 1. This excludes
0032   // the state {OK, OK} already covered.
0033   //
0034   // "soiPhase" argument specifies the desired position of the
0035   // sample of interest ADC in the ADC bytes written out into the
0036   // aux words of the HFRecHit. For more detail, see comments
0037   // inside the HFRecHitAuxSetter.h header.
0038   //
0039   // "timeShift" value (in ns) will be added to all valid times
0040   // returned by QIE10 TDCs. This shift is used both for applying
0041   // the timing cuts and for rechit construction.
0042   //
0043   // "triseIfNoTDC" and "tfallIfNoTDC": the rechit rise and
0044   // fall times will be set to these values in case meaningful
0045   // TDC information is not available for any of the PMT anodes
0046   // (time shift is not added to these numbers).
0047   //
0048   // For monitoring purposes, "rejectAllFailures" can be set to
0049   // "false". In this case, for the energy reconstruction purposes,
0050   // all status values indicating that the anode is not passing
0051   // algorithm cuts will be mapped to "OK". However, HFRecHit
0052   // will still be made using proper status flags.
0053   //
0054   // If "alwaysCalculateChargeAsymmetry" is true, charge asymmetry
0055   // status bit will be set whenever the data is available for both
0056   // anodes. If "alwaysCalculateChargeAsymmetry" is false, the bit
0057   // will be set only if the status of both anodes is "OK" (or mapped
0058   // into "OK").
0059   //
0060   HFSimpleTimeCheck(const std::pair<float, float> tlimits[2],
0061                     const float energyWeights[2 * HFAnodeStatus::N_POSSIBLE_STATES - 1][2],
0062                     unsigned soiPhase,
0063                     float timeShift,
0064                     float triseIfNoTDC,
0065                     float tfallIfNoTDC,
0066                     float minChargeForUndershoot,
0067                     float minChargeForOvershoot,
0068                     bool rejectAllFailures = true,
0069                     bool alwaysCalculateChargeAsymmetry = true);
0070 
0071   inline ~HFSimpleTimeCheck() override {}
0072 
0073   inline bool isConfigurable() const override { return false; }
0074 
0075   HFRecHit reconstruct(const HFPreRecHit& prehit,
0076                        const HcalCalibrations& calibs,
0077                        const bool flaggedBadInDB[2],
0078                        bool expectSingleAnodePMT) override;
0079 
0080   inline unsigned soiPhase() const { return soiPhase_; }
0081   inline float timeShift() const { return timeShift_; }
0082   inline float triseIfNoTDC() const { return triseIfNoTDC_; }
0083   inline float tfallIfNoTDC() const { return tfallIfNoTDC_; }
0084   inline float minChargeForUndershoot() const { return minChargeForUndershoot_; }
0085   inline float minChargeForOvershoot() const { return minChargeForOvershoot_; }
0086   inline bool rejectingAllFailures() const { return rejectAllFailures_; }
0087   inline bool alwaysCalculatingQAsym() const { return alwaysQAsym_; }
0088 
0089 protected:
0090   virtual unsigned determineAnodeStatus(unsigned anodeNumber, const HFQIE10Info& anode, bool* isTimingReliable) const;
0091 
0092 private:
0093   // Map possible status values into the first index of "energyWeights_"
0094   unsigned mapStatusIntoIndex(const unsigned states[2]) const;
0095 
0096   std::pair<float, float> tlimits_[2];
0097   float energyWeights_[2 * HFAnodeStatus::N_POSSIBLE_STATES - 1][2];
0098   unsigned soiPhase_;
0099   float timeShift_;
0100   float triseIfNoTDC_;
0101   float tfallIfNoTDC_;
0102   float minChargeForUndershoot_;
0103   float minChargeForOvershoot_;
0104   bool rejectAllFailures_;
0105   bool alwaysQAsym_;
0106 };
0107 
0108 #endif  // RecoLocalCalo_HcalRecAlgos_HFSimpleTimeCheck_h_