ApplyFitPSA.hh
00001 #ifndef _APPLYFITPSA_HH_
00002 #define _APPLYFITPSA_HH_
00003
00012 #include <map>
00013 #include <vector>
00014 #include <string>
00015
00016 class TF1;
00017 class TChain;
00018 class TTree;
00019 class TH1F;
00020 class TFile;
00021
00022 class ApplyFitPSA
00023 {
00024 public:
00025
00026 ApplyFitPSA();
00027 ~ApplyFitPSA();
00028
00029
00030
00031 void Init(std::string funcfilename);
00032
00033 void Init_RD(std::string rdfuncfilename);
00034
00035
00036 void SetTree();
00037
00038
00039
00040 void FillTree();
00041
00042
00043
00044 void ReadTreeFromFile(char * fileName, std::string treeName);
00045 void SetBranchAddresses();
00046
00047
00048 void Do();
00049
00050
00051 double GetFlag(int entry);
00052
00053 double LinRiseTime(int canale, double rt, double energy );
00054 double LinDecayTime(int canale, double dt, double energy );
00055
00056 double GetFlag();
00057
00058
00059 void WriteFlagTree(char * filename);
00060
00061
00062
00063
00064 void SetAmp (double v) {amp = v;}
00065 void SetFamp (double v) {famp = v;}
00066 void SetSecond_amp (double v) {second_amp = v;}
00067 void SetEnergy (double v) {energy = v;}
00068 void SetTime_until_d (double v) {time_until_d = v;}
00069 void SetChan (int v) {chan = v; }
00070 void SetIsheater (bool v) {isheater = v;}
00071 void SetRise (double v) {rise = v;}
00072 void SetDecay (double v) {decay = v;}
00073
00074 void SetNSigma (double v) {nSigma = v;}
00075
00076 std::map<int,std::vector<double> > & GetThresholds(){return bordery;}
00077 std::map<int,std::vector<double> > & GetMeans(){return media;}
00078
00079 void SetEnergyStep (double estep, double emax) {energy_step = estep; nstep = emax/estep;maxEnergy=emax;}
00080
00081
00082 void SetChannelMaps (std::map<int,std::vector<double> >& thres, std::map<int,std::vector<double> > & mean);
00083
00084 private:
00085
00086 TTree *tree;
00087
00088 TF1 *figauss;
00089
00090 int dataset;
00091
00092
00093 double amp;
00094 double famp;
00095 double second_amp;
00096 double energy;
00097 double time_until_d;
00098 double rise;
00099 double decay;
00100 int chan;
00101 bool isheater;
00102
00103
00104
00105 std::map<int,std::vector<double> > numborder;
00106 std::map<int,std::vector<double> > bordery;
00107 std::map<int,std::vector<double> > erry;
00108 std::map<int,std::vector<double> > errx;
00109 std::map<int,std::vector<double> > media;
00110 std::map<int,std::vector<double> > bb;
00111 std::map<int,TH1F **> tobefitted;
00112
00113
00114 double energy_step;
00115 double maxEnergy;
00116 double nstep;
00117 double nSigma;
00118
00119
00120 TF1 ** func;
00121 TF1 ** func_rt;
00122 TF1 ** func_dt;
00123
00124 std::map<int,bool> check;
00125
00126
00127 TFile * fAux;
00128 std::string fAuxiliarName;
00129 bool dynamicTree;
00130
00131 };
00132
00133 #endif