Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 08:35:05

0001 #ifndef CALIB_H
0002 #define CALIB_H
0003 
0004 #include <cstddef>
0005 #include <map>
0006 #include "TTimeStamp.h"
0007 #include "Setup.h"
0008 
0009 struct TileCalib{
0010   double PedestalMeanH  = -1000.;     // pedestal mean HG ADC (CAEN) or first sample ADC (HGCROC)
0011   double PedestalMeanL  = -1000.;     // pedestal mean LG ADC (CAEN) or average pedestal ADC (HGCROC)
0012   double PedestalSigH   = -1000.;     // width of pedest HG ADC (CAEN) or width of first sample ADC distribution (HGCROC)
0013   double PedestalSigL   = -1000.;     // width of pedest LG ADC (CAEN) or width of average pedestal ADC distribution (HGCROC)
0014   double ScaleH         = -1000.;     // Max Mip in HG ADC (CAEN) or ADC (HGCROC) 
0015   double ScaleWidthH    = -1000.;     // FWHM of Mip in HG ADC (CAEN) or ADC (HGCROC) 
0016   double ScaleL         = -1000.;     // Max Mip in LG ADC (CAEN) 
0017   double ScaleWidthL    = -1000.;     // FWHM Mip in LG ADC (CAEN) 
0018   double LGHGCorr       = -64;        // slope of correlation between LG (x axis) & HG (y axis) for CAEN data 
0019   double LGHGCorrOff    = -1000.;     // intercept of correlation between LG (x axis) & HG (y axis) for CAEN data 
0020   double HGLGCorr       = -64;        // slope of correlation between HG (x axis) & LG (y axis) for CAEN data
0021   double HGLGCorrOff    = -1000.;     // intercept of correlation between HG (x axis) & LG (y axis) for CAEN data
0022   short BadChannel      = -64;        // bad channel flag: 0 - off, 1 - bad, 2 - funky, 3 - good
0023 } ;
0024 
0025 class Calib{
0026 
0027  public:
0028   Calib() {}
0029   virtual ~Calib() {}
0030     
0031   double GetPedestalMeanH (int /**/) const;
0032   double GetPedestalMeanL (int /**/) const;
0033   double GetPedestalMeanH (int /**/, int /**/, int /**/, int /**/) const;
0034   double GetPedestalMeanL (int /**/, int /**/, int /**/, int /**/) const;
0035   double GetPedestalSigH (int /**/) const;
0036   double GetPedestalSigL (int /**/) const;
0037   double GetPedestalSigH (int /**/, int /**/, int /**/, int /**/) const;
0038   double GetPedestalSigL (int /**/, int /**/, int /**/, int /**/) const;
0039   double GetScaleHigh(int /**/) const;
0040   double GetScaleHighPerSingleLayer(int /**/) const;
0041   double GetScaleHigh(int /**/, int /**/, int /**/, int /**/) const;
0042   double GetScaleHighPerSingleLayer(int /**/, int /**/, int /**/, int /**/) const;
0043   
0044   double GetScaleWidthHigh(int /**/) const;
0045   double GetScaleWidthHigh(int /**/, int /**/, int /**/, int /**/) const;
0046   double GetCalcScaleLow (int /**/) const;
0047   double GetCalcScaleLow (int /**/, int /**/, int /**/, int /**/) const;
0048   double GetScaleLow (int /**/) const;
0049   double GetScaleLow (int /**/, int /**/, int /**/, int /**/) const;
0050   double GetScaleWidthLow (int /**/) const;
0051   double GetScaleWidthLow (int /**/, int /**/, int /**/, int /**/) const;
0052   double GetLGHGCorr (int /**/) const;
0053   double GetLGHGCorr (int /**/, int /**/, int /**/, int /**/) const;
0054   double GetLGHGCorrOff (int /**/) const;
0055   double GetLGHGCorrOff (int /**/, int /**/, int /**/, int /**/) const;
0056   double GetHGLGCorr (int /**/) const;
0057   double GetHGLGCorr (int /**/, int /**/, int /**/, int /**/) const;
0058   double GetHGLGCorrOff (int /**/) const;
0059   double GetHGLGCorrOff (int /**/, int /**/, int /**/, int /**/) const;
0060   double GetToAOff (int /**/) const;
0061   double GetToAOff (int /**/, int /**/, int /**/, int /**/) const;
0062   
0063   double GetAveragePedestalMeanHigh() const;
0064   double GetAveragePedestalSigHigh() const;
0065   double GetAveragePedestalMeanLow() const;
0066   double GetAveragePedestalSigLow() const;
0067   double GetAverageScaleHigh() const;
0068   double GetAverageScaleHighPerSingleLayer()const;
0069   double GetAverageScaleHigh(int &) const;
0070   double GetAverageScaleHighPerSingleLayer(int &, double &)const;
0071   double GetAverageScaleWidthHigh() const;
0072   double GetAverageScaleLow() const;
0073   double GetAverageScaleWidthLow() const;
0074   double GetAverageHGLGCorr() const;
0075   double GetAverageHGLGCorrOff() const;
0076   double GetAverageLGHGCorr() const;
0077   double GetAverageLGHGCorrOff() const;
0078   
0079   int GetNumberOfChannelsWithBCflag (short ) const;
0080   short GetBadChannel(int /**/) const;
0081   short GetBadChannel(int /**/, int /**/, int /**/, int /**/) const;
0082   
0083   TileCalib* GetTileCalib(int /**/);
0084   TileCalib* GetTileCalib(int /**/, int /**/, int /**/, int /**/);
0085 
0086   void   SetPedestalMeanH (double, int);
0087   void   SetPedestalMeanL (double, int);
0088   void   SetPedestalMeanH (double, int, int, int, int);
0089   void   SetPedestalMeanL (double, int, int, int, int);
0090   void   SetPedestalSigH (double, int);
0091   void   SetPedestalSigL (double, int);
0092   void   SetPedestalSigH (double, int, int, int, int);
0093   void   SetPedestalSigL (double, int, int, int, int);
0094   void   SetScaleHigh(double, int);
0095   void   SetScaleHigh(double, int, int, int, int);
0096   void   SetScaleWidthHigh(double, int);
0097   void   SetScaleWidthHigh(double, int, int, int, int);
0098   void   SetScaleLow (double, int);
0099   void   SetScaleLow (double, int, int, int, int);
0100   void   SetScaleWidthLow (double, int);
0101   void   SetScaleWidthLow (double, int, int, int, int);
0102   void   SetLGHGCorr (double, int);
0103   void   SetLGHGCorr (double, int, int, int, int);
0104   void   SetLGHGCorrOff (double, int);
0105   void   SetLGHGCorrOff (double, int, int, int, int);
0106   void   SetHGLGCorr (double, int);
0107   void   SetHGLGCorr (double, int, int, int, int);
0108   void   SetHGLGCorrOff (double, int);
0109   void   SetHGLGCorrOff (double, int, int, int, int);
0110   void   SetBadChannel (short, int);
0111   void   SetBadChannel (short, int, int, int, int);
0112   void   SetToAOff (double, int);
0113   void   SetToAOff (double, int, int, int, int);
0114   
0115   int GetRunNumber(void);
0116   int GetRunNumberPed(void);
0117   int GetRunNumberMip(void);
0118   const TTimeStamp* GetBeginRunTime(void) const;
0119   const TTimeStamp* GetBeginRunTimePed(void) const;
0120   const TTimeStamp* GetBeginRunTimeMip(void) const;
0121   double GetVov(void);
0122   double GetVop(void);
0123   bool GetBCCalib(void);            // is bad channel map calculated
0124 
0125   void SetRunNumber(int);           // 
0126   void SetRunNumberPed(int);           // 
0127   void SetRunNumberMip(int);           // 
0128   void SetBeginRunTime(TTimeStamp); // 
0129   void SetBeginRunTimePed(TTimeStamp); // 
0130   void SetBeginRunTimeMip(TTimeStamp); // 
0131   void SetVop(double);              // 
0132   void SetVov(double);              // 
0133   void SetBCCalib(bool);            // Bad channel map calculated
0134 
0135   void PrintGlobalInfo();
0136   void PrintDetailedGlobalInfo();
0137   void PrintCalibToFile( TString );
0138   void ReadCalibFromTextFile( TString, int);
0139   void ReadExternalBadChannelMap(TString, int);
0140   void ReadExternalToAOffsets(TString, int);
0141   
0142   bool IsLayerEnabled(int, int) const;
0143   
0144   inline std::map<int, TileCalib>::const_iterator begin() {return CaloCalib.cbegin();};
0145   inline std::map<int, TileCalib>::const_iterator end()   {return CaloCalib.cend();};
0146   inline std::map<int, TileCalib>::const_iterator find(int id)  {return CaloCalib.find(id);};
0147   
0148  private:
0149    
0150   std::map<int, TileCalib> CaloCalib;
0151   int RunNumber    = -1 ;
0152   int RunNumberPed = -1;
0153   int RunNumberMip = -1;
0154   TTimeStamp BeginRunTime;
0155   TTimeStamp BeginRunTimePed;
0156   TTimeStamp BeginRunTimeMip;
0157   double Vop;
0158   double Vov;
0159   bool BCcalc = false;
0160   ClassDef(Calib,5)
0161 };
0162 
0163 
0164 #endif