File indexing completed on 2025-01-18 09:15:46
0001 #ifndef TILESPECTRA_H
0002 #define TILESPECTRA_H
0003
0004 #include "TObject.h"
0005 #include "TString.h"
0006 #include "TH1D.h"
0007 #include "TH2D.h"
0008 #include "TProfile.h"
0009 #include "TF1.h"
0010 #include "TPad.h"
0011 #include "TCanvas.h"
0012 #include "TLegend.h"
0013 #include "Calib.h"
0014
0015 class TileSpectra: public TObject{
0016
0017 public:
0018 TileSpectra():TObject(){}
0019 TileSpectra(TString name, int id, TileCalib* cal, int deb=0):TObject()
0020 {
0021 TileName = name;
0022 cellID = id;
0023 calib = cal;
0024 debug = deb;
0025 bpedHG = false;
0026 bpedLG = false;
0027 bmipHG = false;
0028 bmipLG = false;
0029 bcorrHGLG = false;
0030 bcorrLGHG = false;
0031 hspectraHG = TH1D(Form("hspectra%sHGCellID%d",name.Data(),id),Form("ADC spectrum High Gain CellID %d; HG ADC (arb. units); counts ",id),4200,-200,4000);
0032 hspectraHG.SetDirectory(0);
0033 hspectraLG = TH1D(Form("hspectra%sLGCellID%d",name.Data(),id),Form("ADC spectrum Low Gain CellID %d; LG ADC (arb. units); counts",id),4200,-200,4000);
0034 hspectraLG.SetDirectory(0);
0035 hTriggPrim = TH1D(Form("hTriggerPrimitive%sCellID%d",name.Data(),id),Form("Trigger primitive CellID %d; HG ADC (arb. units); counts ",id),500,0,4000);
0036 hTriggPrim.SetDirectory(0);
0037 hspectraLGHG = TProfile(Form("hCoorspectra%sLGHGCellID%d",name.Data(),id),Form("ADC Low Gain/High Gain correlation CellID %d; LG ADC (arb. units); HG ADC (arb. units)",id),800,0,800);
0038 hspectraLGHG.SetDirectory(0);
0039 hspectraHGLG = TProfile(Form("hCoorspectra%sHGLGCellID%d",name.Data(),id),Form("ADC High Gain/Low Gain correlation CellID %d; HG ADC (arb. units); LG ADC (arb. units)",id),4100,-100,4000);
0040 hspectraHGLG.SetDirectory(0);
0041 }
0042 ~TileSpectra(){}
0043
0044 bool Fill(double, double);
0045 bool FillSpectra(double, double);
0046 bool FillCorr(double, double);
0047 bool FillTrigger(double);
0048
0049 bool FitNoise(double*, int, bool);
0050 void FitFixedNoise();
0051 bool FitMipHG(double*, double*, int, int, bool, double, double );
0052 bool FitMipLG(double*, double*, int, int, bool, double );
0053 bool FitCorr(int);
0054 bool FitNoiseWithBG(double*);
0055 short DetermineBadChannel();
0056
0057 int GetCellID();
0058 void SetBadChannelInCalib(short);
0059
0060 double GetMaxXInRangeLG(double, double);
0061 double GetMaxXInRangeHG(double, double);
0062
0063 TH1D* GetHG();
0064 TH1D* GetLG();
0065 TH1D* GetTriggPrim();
0066 TH1D* GetHGLGcomb();
0067 TProfile* GetLGHGcorr();
0068 TProfile* GetHGLGcorr();
0069
0070 TF1* GetBackModel(int);
0071 TF1* GetSignalModel(int);
0072 TF1* GetCorrModel(int);
0073 TileCalib* GetCalib();
0074
0075 void Write(bool);
0076 protected:
0077 TString TileName;
0078 int cellID;
0079 TileCalib* calib;
0080 int debug;
0081 bool bpedHG;
0082 bool bpedLG;
0083 bool bmipHG;
0084 bool bmipLG;
0085 bool bcorrHGLG;
0086 bool bcorrLGHG;
0087 bool bTriggPrim;
0088 TF1 BackgroundLG;
0089 TF1 BackgroundHG;
0090 TF1 SignalLG;
0091 TF1 SignalHG;
0092 TF1 HGLGcorr;
0093 TF1 LGHGcorr;
0094 TH1D hspectraHG;
0095 TH1D hspectraLG;
0096 TH1D hTriggPrim;
0097 TH1D hcombined;
0098 TProfile hspectraLGHG;
0099 TProfile hspectraHGLG;
0100 static double langaufun(double *, double *);
0101 static int langaupro(double *, double &, double &);
0102
0103 ClassDef(TileSpectra,2);
0104 };
0105
0106
0107 #endif