#ifndef __KRATTA_FADC_EVENT_CLASS__ #define __KRATTA_FADC_EVENT_CLASS__ #include #include "TFile.h" #include "TProfile.h" #include "TH1F.h" #include "TH1.h" #include "TH2F.h" #include "TRandom.h" #include "TNtuple.h" #include "TCanvas.h" #include "TTree.h" #include "TStyle.h" #include "TSystem.h" #include "TChain.h" #include "TF1.h" #include "TLatex.h" #include "TBranch.h" #include "TCutG.h" #include "TROOT.h" #include "TLine.h" #include "TLegend.h" #include "TChainElement.h" #include "TSpectrum.h" #include "TMarker.h" #include "TMath.h" #include "TControlBar.h" #include "TApplication.h" #include "TMatrixD.h" #include "TVector3.h" #include "TVectorD.h" #include "TClonesArray.h" #include "TVirtualFitter.h" //#include "TFitResult.h" //#include "TFitResultPtr.h" #include #include #include #include //#include "mktreeraw.hxx" using namespace std; /////////////////////////////////////////////////////////////////////////////// struct PeakData{ Int_t mod; Int_t n_sample[3]; Int_t evt[3]; Double_t pds[3]; Double_t pdr[3]; Double_t tls[3]; Double_t tlo[3]; Double_t tm[3]; Double_t am[3]; Double_t at[3]; Double_t sam[3]; //amplitude Double_t sat[3]; //position of maximum - absolute - wrt 0 Double_t s1[3]; //absolute time at 10% of maximum on the rising slope Double_t s2[3]; //absolute time at 20% of maximum on the rising slope Double_t s3[3]; //absolute time at 30% of maximum on the rising slope Double_t s4[3]; //absolute time at 40% of maximum on the rising slope Double_t s5[3]; //absolute time at 50% of maximum on the rising slope Double_t s6[3]; //absolute time at 60% of maximum on the rising slope Double_t s7[3]; //absolute time at 70% of maximum on the rising slope Double_t s8[3]; //absolute time at 80% of maximum on the rising slope Double_t s9[3]; //absolute time at 90% of maximum on the rising slope Double_t s9f[3]; //absolute time at 90% of maximum on the falling slope Double_t sf0[3]; //ampl at 10% time from max to the end on the falling slope Double_t sf1[3]; //ampl at 20% time from max to the end on the falling slope Double_t sf2[3]; //ampl at 30% time from max to the end on the falling slope Double_t sf3[3]; //ampl at 40% time from max to the end on the falling slope Double_t sf4[3]; //ampl at 50% time from max to the end on the falling slope Double_t sf5[3]; //ampl at 60% time from max to the end on the falling slope Double_t sf6[3]; //ampl at 70% time from max to the end on the falling slope Double_t sf7[3]; //ampl at 80% time from max to the end on the falling slope Double_t sf8[3]; //ampl at 90% time from max to the end on the falling slope Double_t sf9[3]; //ampl at the end Double_t m0[3]; //raw 0-th moment Double_t m1[3]; //1-st moment/TMAX^1/m0 Double_t m2[3]; //2-nd moment/TMAX^2/m0 Double_t m3[3]; //3-rd moment/TMAX^3/m0 Double_t m4[3]; //4-th moment/TMAX^4/m0 Double_t m5[3]; //5-th moment/TMAX^5/m0 Double_t m6[3]; //6-th moment/TMAX^6/m0 Double_t m7[3]; //7-th moment/TMAX^7/m0 Double_t m8[3]; //8-th moment/TMAX^8/m0 Double_t m9[3]; //9-th moment/TMAX^9/m0 Double_t mx[3]; //position of maximum Double_t my[3]; //maximum o moment distr. Double_t mz[3]; //z of dx^2+ex+z fit Double_t ma[3]; //a of ax^3+bx^2+cx fit Double_t mb[3]; //b of ax^3+bx^2+cx fit Double_t mc[3]; //c of ax^3+bx^2+cx fit Double_t p0[3]; Double_t p1[3]; Double_t p2[3]; Double_t p3[3]; Double_t p4[3]; Double_t p5[3]; Double_t p6[3]; Double_t p7[3]; Double_t p8[3]; Double_t p9[3]; Double_t p10[3]; Double_t rc[3]; Double_t chi2[3]; Double_t dfadc[3][1024]; PeakData(){ Clear(); //printf("new PeakData\n"); } // ~PeakData(){ // // printf("del PeakData\n"); // } void Clear(Option_t *option=""); }; class ASYFadcPeak : public TNamed{ public: Int_t mod; //module number [0-34] Float_t pds0; //baseline Float_t pdr0; //baseline rms Float_t tls0; //=tail inv. slope -> from fit of exp(-t/tail+offset) to the tail of the waveform Float_t tlo0; //=tail offset Float_t tm0; //raw time offset, beginning of the pulse (for PD0) Float_t am0; //raw amplitude for PD0 Float_t at0; //raw position of maximum Float_t pds1; //baseline Float_t pdr1; //baseline rms Float_t tls1; //=tail inv. slope -> from fit of exp(-t/tail+offset) to the tail of the waveform Float_t tlo1; //=tail offset Float_t tm1; //raw time offset, beginning of the pulse (for PD0) Float_t am1; //raw amplitude for PD0 Float_t at1; //raw position of maximum Float_t pds2; //baseline Float_t pdr2; //baseline rms Float_t tls2; //=tail inv. slope -> from fit of exp(-t/tail+offset) to the tail of the waveform Float_t tlo2; //=tail offset Float_t tm2; //raw time offset, beginning of the pulse (for PD0) Float_t am2; //raw amplitude for PD0 Float_t at2; //raw position of maximum //smooth values Float_t sam0; //amplitude Float_t sat0; //position of maximum - absolute - wrt 0 Float_t s01; //absolute time at 10% of maximum on the rising slope Float_t s02; //absolute time at 20% of maximum on the rising slope Float_t s03; //absolute time at 30% of maximum on the rising slope Float_t s04; //absolute time at 40% of maximum on the rising slope Float_t s05; //absolute time at 50% of maximum on the rising slope Float_t s06; //absolute time at 60% of maximum on the rising slope Float_t s07; //absolute time at 70% of maximum on the rising slope Float_t s08; //absolute time at 80% of maximum on the rising slope Float_t s09; //absolute time at 90% of maximum on the rising slope Float_t s09f; //absolute time at 90% of maximum on the falling slope Float_t sam1; //amplitude Float_t sat1; //position of maximum - absolute - wrt 0 Float_t s11; //absolute time at 10% of maximum on the rising slope Float_t s12; //absolute time at 20% of maximum on the rising slope Float_t s13; //absolute time at 30% of maximum on the rising slope Float_t s14; //absolute time at 40% of maximum on the rising slope Float_t s15; //absolute time at 50% of maximum on the rising slope Float_t s16; //absolute time at 60% of maximum on the rising slope Float_t s17; //absolute time at 70% of maximum on the rising slope Float_t s18; //absolute time at 80% of maximum on the rising slope Float_t s19; //absolute time at 90% of maximum on the rising slope Float_t s19f; //absolute time at 90% of maximum on the falling slope Float_t sam2; //amplitude Float_t sat2; //position of maximum - absolute - wrt 0 Float_t s21; //absolute time at 10% of maximum on the rising slope Float_t s22; //absolute time at 20% of maximum on the rising slope Float_t s23; //absolute time at 30% of maximum on the rising slope Float_t s24; //absolute time at 40% of maximum on the rising slope Float_t s25; //absolute time at 50% of maximum on the rising slope Float_t s26; //absolute time at 60% of maximum on the rising slope Float_t s27; //absolute time at 70% of maximum on the rising slope Float_t s28; //absolute time at 80% of maximum on the rising slope Float_t s29; //absolute time at 90% of maximum on the rising slope Float_t s29f; //absolute time at 90% of maximum on the falling slope //falling slope Float_t sf00; //ampl at 10% time from max to the end on the falling slope Float_t sf01; //ampl at 20% time from max to the end on the falling slope Float_t sf02; //ampl at 30% time from max to the end on the falling slope Float_t sf03; //ampl at 40% time from max to the end on the falling slope Float_t sf04; //ampl at 50% time from max to the end on the falling slope Float_t sf05; //ampl at 60% time from max to the end on the falling slope Float_t sf06; //ampl at 70% time from max to the end on the falling slope Float_t sf07; //ampl at 80% time from max to the end on the falling slope Float_t sf08; //ampl at 90% time from max to the end on the falling slope Float_t sf09; //ampl at the end Float_t sf10; //ampl at 10% time from max to the end on the falling slope Float_t sf11; //ampl at 20% time from max to the end on the falling slope Float_t sf12; //ampl at 30% time from max to the end on the falling slope Float_t sf13; //ampl at 40% time from max to the end on the falling slope Float_t sf14; //ampl at 50% time from max to the end on the falling slope Float_t sf15; //ampl at 60% time from max to the end on the falling slope Float_t sf16; //ampl at 70% time from max to the end on the falling slope Float_t sf17; //ampl at 80% time from max to the end on the falling slope Float_t sf18; //ampl at 90% time from max to the end on the falling slope Float_t sf19; //ampl at the end Float_t sf20; //ampl at 10% time from max to the end on the falling slope Float_t sf21; //ampl at 20% time from max to the end on the falling slope Float_t sf22; //ampl at 30% time from max to the end on the falling slope Float_t sf23; //ampl at 40% time from max to the end on the falling slope Float_t sf24; //ampl at 50% time from max to the end on the falling slope Float_t sf25; //ampl at 60% time from max to the end on the falling slope Float_t sf26; //ampl at 70% time from max to the end on the falling slope Float_t sf27; //ampl at 80% time from max to the end on the falling slope Float_t sf28; //ampl at 90% time from max to the end on the falling slope Float_t sf29; //ampl at the end // moments for TMAX=800 channels (8 us) Float_t m00; //raw 0-th moment Float_t m01; //1-st moment/TMAX^1/m00 Float_t m02; //2-nd moment/TMAX^2/m00 Float_t m03; //3-rd moment/TMAX^3/m00 Float_t m04; //4-th moment/TMAX^4/m00 Float_t m05; //5-th moment/TMAX^5/m00 Float_t m06; //6-th moment/TMAX^6/m00 Float_t m07; //7-th moment/TMAX^7/m00 Float_t m08; //8-th moment/TMAX^8/m00 Float_t m09; //9-th moment/TMAX^9/m00 Float_t mx0; //position of maximum Float_t my0; //maximum o moment distr. Float_t mz0; //z of dx^2+ex+z fit Float_t ma0; //a of ax^3+bx^2+cx fit Float_t mb0; //b of ax^3+bx^2+cx fit Float_t mc0; //c of ax^3+bx^2+cx fit Float_t m10; //raw 0-th moment Float_t m11; //1-st moment/TMAX^1/m00 Float_t m12; //2-nd moment/TMAX^2/m00 Float_t m13; //3-rd moment/TMAX^3/m00 Float_t m14; //4-th moment/TMAX^4/m00 Float_t m15; //5-th moment/TMAX^5/m00 Float_t m16; //6-th moment/TMAX^6/m00 Float_t m17; //7-th moment/TMAX^7/m00 Float_t m18; //8-th moment/TMAX^8/m00 Float_t m19; //9-th moment/TMAX^9/m00 Float_t mx1; //position of maximum Float_t my1; //maximum o moment distr. Float_t mz1; //z of dx^2+ex+z fit Float_t ma1; //a of ax^3+bx^2+cx fit Float_t mb1; //b of ax^3+bx^2+cx fit Float_t mc1; //c of ax^3+bx^2+cx fit Float_t m20; //raw 0-th moment Float_t m21; //1-st moment/TMAX^1/m00 Float_t m22; //2-nd moment/TMAX^2/m00 Float_t m23; //3-rd moment/TMAX^3/m00 Float_t m24; //4-th moment/TMAX^4/m00 Float_t m25; //5-th moment/TMAX^5/m00 Float_t m26; //6-th moment/TMAX^6/m00 Float_t m27; //7-th moment/TMAX^7/m00 Float_t m28; //8-th moment/TMAX^8/m00 Float_t m29; //9-th moment/TMAX^9/m00 Float_t mx2; //position of maximum Float_t my2; //maximum o moment distr. Float_t mz2; //z of dx^2+ex+z fit Float_t ma2; //a of ax^3+bx^2+cx fit Float_t mb2; //b of ax^3+bx^2+cx fit Float_t mc2; //c of ax^3+bx^2+cx fit //fit parameters Float_t p00; //amplitude of Si component in PD0 Float_t p04; //time offset (from fit) for PD0 Float_t p05; //fall time of Si component in PD0 Float_t p09; //rise time of Si component in PD0 Float_t rc0; //rc in PD0 Float_t p10; //amplitude of Si component in PD1 Float_t p12; //amplitude of Fast CsI(Tl) in PD1 Float_t p13; //amplitude of Slow CsI(Tl) in PD1 Float_t p14; //time offset (from fit) for PD1 Float_t p15; //fall time of Si component in PD1 Float_t p17; //fall time of Fast CsI(Tl) in PD1 Float_t p18; //fall time of Slow CsI(Tl) in PD1 Float_t p19; //rise time of Si component in PD1 Float_t p110; //rise time of CsI(Tl) in PD1 Float_t rc1; //rc in PD1 Float_t p20; //p2* -> same as p1* but for PD2 Float_t p22; Float_t p23; Float_t p24; Float_t p25; Float_t p27; Float_t p28; Float_t p29; Float_t p210; Float_t rc2; Float_t chi20;//chi2 in PD0 Float_t chi21;//chi2 in PD1 Float_t chi22;//chi2 in PD2 ASYFadcPeak(); virtual ~ASYFadcPeak(){Clear();} void Clear(Option_t *option=""); friend std::ostream& operator<<(std::ostream&, const ASYFadcPeak& p); ASYFadcPeak& operator=(const ASYFadcPeak& tc); ClassDef(ASYFadcPeak,2) //A peak segment }; //------------------------------------------------------------------------------ class ASYEvent : public TNamed{ public: Int_t run; // run number Int_t evt; // event number Int_t npeak; // multiplicity of peaks unsigned long int tms; // timestamp TClonesArray *peak; //-> ASYEvent(); virtual ~ASYEvent(); void Clear(Option_t* opt=""); ASYFadcPeak* AddPeak(){return new((*peak)[npeak++]) ASYFadcPeak();} // Setup Peak ASYFadcPeak* Peak(Int_t n) const {return (ASYFadcPeak*)((*peak)[n]);} // Get Peak ASYEvent& operator=(const ASYEvent& tc); friend std::ostream& operator<<(std::ostream&, const ASYEvent& p); ClassDef(ASYEvent,2) //Event structure }; //___________________________________________________________________ //___________________________________________________________________ Double_t Det(const int n, Double_t A[9][9]); Double_t Det2(Double_t A[2][2]); Double_t Det3(Double_t A[3][3]); Double_t Det4(Double_t A[4][4]); //___________________________________________________________________ //double RCGAM8PRIM(Double_t *xx, Double_t *par); double zbr(double eps,int nsig,double &a,double &b,int &maxfn,int &ier, double *xx,double *par); double zbrprim(double eps,int nsig,double &a,double &b,int &maxfn,int &ier, double *xx,double *par); //double parab(TH1D *hfit,int b0,int bl,int br,double &a,double &b,double &c); Double_t getInterpolatedValue(Double_t x, Double_t * ArrayX, Double_t * ArrayY, Int_t ArraySize, Double_t &A_p0, Double_t &A_p1 , Double_t &A_p2 ); vector getPercents ( TH1D * A_hist, Double_t x0, Double_t xmax, Double_t ymax); vector GetSamplesFromTheFallingEdge ( TH1D * A_hist, Double_t x0, Double_t xmax, Double_t ymax, Int_t A_debugLevel = 0 ); #endif /// __KRATTA_FADC_EVENT_CLASS__