Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RecoLocalCalo_HcalRecAlgos_PulseShapeFitOOTPileupCorrection_h
0002 #define RecoLocalCalo_HcalRecAlgos_PulseShapeFitOOTPileupCorrection_h
0003 
0004 #include <typeinfo>
0005 
0006 #include "RecoLocalCalo/HcalRecAlgos/interface/PulseShapeFunctor.h"
0007 
0008 #include "DataFormats/HcalRecHit/interface/HBHEChannelInfo.h"
0009 #include "CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h"
0010 #include "CalibCalorimetry/HcalAlgos/interface/HcalTimeSlew.h"
0011 
0012 #include <TMinuit.h>
0013 
0014 #include <TH1F.h>
0015 #include "Minuit2/FCNBase.h"
0016 #include "Minuit2/Minuit2Minimizer.h"
0017 #include "Math/Functor.h"
0018 
0019 #include "RecoLocalCalo/HcalRecAlgos/interface/HybridMinimizer.h"
0020 
0021 class HcalTimeSlew;
0022 
0023 class PulseShapeFitOOTPileupCorrection {
0024 public:
0025   PulseShapeFitOOTPileupCorrection();
0026   ~PulseShapeFitOOTPileupCorrection();
0027 
0028   void phase1Apply(const HBHEChannelInfo &channelData,
0029                    float &reconstructedEnergy,
0030                    float &reconstructedTime,
0031                    bool &useTriple,
0032                    float &chi2) const;
0033 
0034   void setPUParams(bool iPedestalConstraint,
0035                    bool iTimeConstraint,
0036                    bool iAddPulseJitter,
0037                    bool iApplyTimeSlew,
0038                    double iTS4Min,
0039                    const std::vector<double> &iTS4Max,
0040                    double iPulseJitter,
0041                    double iTimeMean,
0042                    double iTimeSigHPD,
0043                    double iTimeSigSiPM,
0044                    double iPedMean,
0045                    double iTMin,
0046                    double iTMax,
0047                    const std::vector<double> &its4Chi2,
0048                    HcalTimeSlew::BiasSetting slewFlavor,
0049                    int iFitTimes);
0050 
0051   const HcalPulseShapes::Shape *currentPulseShape_ = nullptr;
0052   const HcalTimeSlew *hcalTimeSlewDelay_ = nullptr;
0053   double tsDelay1GeV_ = 0;
0054 
0055   void setPulseShapeTemplate(const HcalPulseShapes::Shape &ps,
0056                              bool isHPD,
0057                              unsigned nSamples,
0058                              const HcalTimeSlew *hcalTimeSlewDelay);
0059   void resetPulseShapeTemplate(const HcalPulseShapes::Shape &ps, unsigned nSamples);
0060 
0061 private:
0062   int pulseShapeFit(const double *energyArr,
0063                     const double *pedenArr,
0064                     const double *chargeArr,
0065                     const double *pedArr,
0066                     const double *gainArr,
0067                     const double tsTOTen,
0068                     std::vector<float> &fitParsVec,
0069                     const double *ADCnoise,
0070                     unsigned int soi) const;
0071   void fit(int iFit,
0072            float &timevalfit,
0073            float &chargevalfit,
0074            float &pedvalfit,
0075            float &chi2,
0076            bool &fitStatus,
0077            double &iTSMax,
0078            const double &iTSTOTen,
0079            double *iEnArr,
0080            unsigned (&iBX)[3]) const;
0081 
0082   PSFitter::HybridMinimizer *hybridfitter;
0083   int cntsetPulseShape;
0084   std::array<double, hcal::constants::maxSamples> iniTimesArr;
0085   double chargeThreshold_;
0086   int fitTimes_;
0087 
0088   std::unique_ptr<FitterFuncs::PulseShapeFunctor> psfPtr_;
0089   std::unique_ptr<ROOT::Math::Functor> spfunctor_;
0090   std::unique_ptr<ROOT::Math::Functor> dpfunctor_;
0091   std::unique_ptr<ROOT::Math::Functor> tpfunctor_;
0092   int TSMin_;
0093   int TSMax_;
0094   mutable double ts4Chi2_;
0095   std::vector<double> vts4Chi2_;
0096   bool pedestalConstraint_;
0097   bool timeConstraint_;
0098   bool addPulseJitter_;
0099   bool unConstrainedFit_;
0100   bool applyTimeSlew_;
0101   double ts4Min_;
0102   mutable double ts4Max_;
0103   std::vector<double> vts4Max_;
0104   double pulseJitter_;
0105   double timeMean_;
0106   double timeSig_;
0107   double timeSigHPD_;
0108   double timeSigSiPM_;
0109   double pedMean_;
0110   double pedSig_;
0111   HcalTimeSlew::BiasSetting slewFlavor_;
0112 
0113   bool isCurrentChannelHPD_;
0114 };
0115 
0116 #endif  // PulseShapeFitOOTPileupCorrection_h