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   // Init auxiliar variables and read functions from file
00030   // it will look for functions named polly in files filename%02d.root, where %02d stands for the channel number
00031   void Init(std::string funcfilename);
00032 
00033   void Init_RD(std::string rdfuncfilename);
00034 
00035   // Fill tree from variables
00036   void SetTree();
00037   
00038 
00039   // Fill tree from variables
00040   void FillTree();
00041 
00042   // Read tree from file
00043   //void ReadTreeFromFile(char * fileName, char * treeName); 
00044   void ReadTreeFromFile(char * fileName, std::string treeName); 
00045   void SetBranchAddresses();
00046 
00047   // Main method. Fill slices and do the fit.
00048   void Do();
00049 
00050   // Get flag for entry entry
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   // Write tree with flag
00059   void WriteFlagTree(char * filename);
00060 
00061 
00062 
00063   // Setters and Getters
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   //void SetMult(int v) {mult = v;}
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   //void SetMaxMult(int v) {maxMult = v;}
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   // Tree variables
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   //int mult;
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   //int maxMult; 
00119 
00120   TF1 ** func;
00121   TF1 ** func_rt;
00122   TF1 ** func_dt;
00123 
00124   std::map<int,bool> check; 
00125 
00126   // Auxiliar
00127   TFile * fAux;
00128   std::string fAuxiliarName;
00129   bool dynamicTree;
00130 
00131 };
00132 
00133 #endif

Generated on Tue Nov 16 10:49:58 2010 for CUORE Software by  doxygen 1.5.6