Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:47

0001 #ifndef RecoLocalCalo_HcalRecAlgos_SimpleHBHEPhase1Algo_h_
0002 #define RecoLocalCalo_HcalRecAlgos_SimpleHBHEPhase1Algo_h_
0003 
0004 #include <memory>
0005 #include <vector>
0006 
0007 // Base class header
0008 #include "RecoLocalCalo/HcalRecAlgos/interface/AbsHBHEPhase1Algo.h"
0009 
0010 // Other headers
0011 #include "CalibCalorimetry/HcalAlgos/interface/HcalPulseContainmentManager.h"
0012 
0013 #include "RecoLocalCalo/HcalRecAlgos/interface/PulseShapeFitOOTPileupCorrection.h"
0014 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalDeterministicFit.h"
0015 #include "RecoLocalCalo/HcalRecAlgos/interface/MahiFit.h"
0016 #include "CalibCalorimetry/HcalAlgos/interface/HcalTimeSlew.h"
0017 
0018 class SimpleHBHEPhase1Algo : public AbsHBHEPhase1Algo {
0019 public:
0020   // Constructor arguments:
0021   //
0022   //   firstSampleShift -- first TS w.r.t. SOI to use for "Method 0"
0023   //                       reconstruction.
0024   //
0025   //   samplesToAdd     -- default number of samples to add for "Method 0"
0026   //                       reconstruction. If, let say, SOI = 4,
0027   //                       firstSampleShift = -1, and samplesToAdd = 3
0028   //                       then the code will add time slices 3, 4, and 5.
0029   //
0030   //   phaseNS          -- default "phase" parameter for the pulse
0031   //                       containment correction
0032   //
0033   //   timeShift        -- time shift for QIE11 TDC times
0034   //
0035   //   correctForPhaseContainment -- default switch for applying pulse
0036   //                                 containment correction for "Method 0"
0037   //
0038   //   m2               -- "Method 2" object
0039   //
0040   //   detFit           -- "Method 3" (a.k.a. "deterministic fit") object
0041   //
0042   SimpleHBHEPhase1Algo(int firstSampleShift,
0043                        int samplesToAdd,
0044                        float phaseNS,
0045                        float timeShift,
0046                        bool correctForPhaseContainment,
0047                        bool applyLegacyHBMCorrection,
0048                        bool applyFixPCC,
0049                        std::unique_ptr<PulseShapeFitOOTPileupCorrection> m2,
0050                        std::unique_ptr<HcalDeterministicFit> detFit,
0051                        std::unique_ptr<MahiFit> mahi,
0052                        edm::ConsumesCollector iC);
0053 
0054   inline ~SimpleHBHEPhase1Algo() override {}
0055 
0056   // Methods to override from the base class
0057   void beginRun(const edm::Run&, const edm::EventSetup&) override;
0058   void endRun() override;
0059 
0060   inline bool isConfigurable() const override { return false; }
0061 
0062   HBHERecHit reconstruct(const HBHEChannelInfo& info,
0063                          const HcalRecoParam* params,
0064                          const HcalCalibrations& calibs,
0065                          bool isRealData) override;
0066   // Basic accessors
0067   inline int getFirstSampleShift() const { return firstSampleShift_; }
0068   inline int getSamplesToAdd() const { return samplesToAdd_; }
0069   inline float getPhaseNS() const { return phaseNS_; }
0070   inline float getTimeShift() const { return timeShift_; }
0071   inline bool isCorrectingForPhaseContainment() const { return corrFPC_; }
0072   inline int getRunNumber() const { return runnum_; }
0073 
0074   edm::ESGetToken<HcalTimeSlew, HcalTimeSlewRecord> delayToken_;
0075   const HcalTimeSlew* hcalTimeSlew_delay_;
0076 
0077 protected:
0078   // Special HB- correction
0079   float hbminusCorrectionFactor(const HcalDetId& cell, float energy, bool isRealData) const;
0080 
0081   // "Method 0" rechit energy. Calls a non-const member of
0082   // HcalPulseContainmentManager, so no const qualifier here.
0083   // HB- correction is not applied inside this function.
0084   float m0Energy(const HBHEChannelInfo& info,
0085                  double reconstructedCharge,
0086                  bool applyContainmentCorrection,
0087                  double phaseNS,
0088                  int nSamplesToAdd);
0089 
0090   // "Method 0" rechit timing (original low-pileup QIE8 algorithm)
0091   float m0Time(const HBHEChannelInfo& info, double reconstructedCharge, int nSamplesToExamine) const;
0092 
0093 private:
0094   HcalPulseContainmentManager pulseCorr_;
0095 
0096   int firstSampleShift_;
0097   int samplesToAdd_;
0098   float phaseNS_;
0099   float timeShift_;
0100   int runnum_;
0101   bool corrFPC_;
0102   bool applyLegacyHBMCorrection_;
0103 
0104   // "Metod 2" algorithm
0105   std::unique_ptr<PulseShapeFitOOTPileupCorrection> psFitOOTpuCorr_;
0106 
0107   // "Metod 3" algorithm
0108   std::unique_ptr<HcalDeterministicFit> hltOOTpuCorr_;
0109 
0110   // Mahi algorithm
0111   std::unique_ptr<MahiFit> mahiOOTpuCorr_;
0112 
0113   HcalPulseShapes theHcalPulseShapes_;
0114 };
0115 
0116 #endif  // RecoLocalCalo_HcalRecAlgos_SimpleHBHEPhase1Algo_h_