pmtbaseline.hh

Go to the documentation of this file.
00001 
00015 #ifndef PMTBASELINE_HH
00016 #define PMTBASELINE_HH
00017 #include <map>
00018 #include <vector>
00019 #include "ana_base.hh"
00020 #include <TH1D.h>
00021 #include <TH2D.h>
00022 #include <math.h>
00023 #include <TGraph.h>
00024 #include <TGraphErrors.h>
00029 class pmtbaseline : public ana_base{
00030 
00031 public:
00032   
00034   pmtbaseline();
00035   
00037   virtual ~pmtbaseline(){};  
00038 
00040   virtual bool initialize();
00041 
00043   virtual bool analyze(storage_manager* storage);
00044 
00046   virtual bool finalize();
00047 
00052   void set_nsample_ped(UInt_t n){_bgpoints=n;};
00053 
00060   void set_nsample_ped_tail(UInt_t n){_rdpoints=n;};
00061 
00063   void set_nsigma_threshold(double thres){_nsigma=thres;};
00064 
00066   void set_adc_threshold(double thres){_min_peak=thres;};
00067 
00069   void set_use_tail(bool use){_use_tail=use;};
00070 
00071 private:
00072   //Clear for each new run
00073   void clear_event();
00074   
00075   //Functions
00077   double mean(std::vector<UShort_t>,UInt_t);
00079   double rms (std::vector<UShort_t>,UInt_t,double);
00081   double tailmean(std::vector<UShort_t>,UInt_t);
00083   double tailrms (std::vector<UShort_t>,UInt_t,double);
00085   double time_reconstructor(double, PMT::ch_waveform_t::const_iterator);
00086 
00087   //Histogram preparation
00088   void histosetup();
00089 
00090   //Histograms and graphs 
00091   TH2D *pedMean;   
00092   TH2D *pedRMS;    
00093   TH2D *tailstudy; 
00094 
00095   TH1D *tailMean;  
00096   TH1D *tailRMS;   
00097   TH1D *channels;  
00098   TH1D *pedMeanAll;
00099   TH1D *pedRMSAll; 
00100 
00101   TH1D *tailMeanCutrms; 
00102   TH1D *tailRMSCutrms;  
00103 
00104   TH1D *pedMeanCutrms;  
00105   TH1D *pedRMSCutrms;   
00106 
00107   /*  
00108   TH1D *peakheights; ///< 1D histogram of pulse amplitude
00109   TH1D *peakareas;   ///< 1D histogram of pulse charge
00110   TH1D *nptstaken;   
00111   */
00112   TH1D *reco_time;
00113   TH1D *reco_time_diff;
00114   
00115   TGraphErrors *rdbadwaveforms;
00116   TGraphErrors *bgbadwaveforms;
00117 
00118   //Private vars
00119   bool _use_tail;
00120   bool _study_tail;
00121   
00122   UInt_t _bgpoints;   //Beam gate points
00123   UInt_t _rdpoints;   //Random tail points
00124   
00125   double _ftailmean;    //Random ped mean
00126   double _ftailrms;     //Random ped rms
00127   double _fpedmean;     //Beamgate ped mean
00128   double _fpedrms;      //Beamgate ped rms
00129  
00130   double _nsigma;       // number of sigma offset from baseline to claim a pulse
00131   double _min_peak;     // absolute adc count threshold (baseline subtracted) to claim a pulse
00132   int _max;             // maximum amplitude of a pulse
00133 
00134   
00135   //Vectors for TGraphs
00136   std::vector<double> rd_waveforms;
00137   std::vector<double> rdticks;
00138   
00139   std::vector<double> bg_waveforms;
00140   std::vector<double> bgticks;
00141   
00142 };
00143   
00144 #endif
00145    // end of doxygen group 
00147   

Generated on Mon Apr 7 15:35:12 2014 for MyProject by  doxygen 1.4.7