ChannelData.hh

Go to the documentation of this file.
00001 
00008 #ifndef CHANNELDATA_h
00009 #define CHANNELDATA_h
00010 
00011 #include "Rtypes.h" //has the classdef macro
00012 #include <string>
00013 #include <vector>
00014 #include <utility>
00015 #include <stdint.h>
00016 
00017 //subclasses
00018 #include "Pulse.hh"
00019 #include "Baseline.hh"
00020 #include "Spe.hh"
00021 #include "Unspikes.hh"
00022 #include "Roi.hh"
00023 #include "TOF.hh"
00024 
00025 class TGraph;
00026 //notice: members with comment starting with ! are not saved
00032 class ChannelData{
00033   //interface
00034 public:
00035   ChannelData() { Clear(); }
00036   virtual ~ChannelData(){}
00037   void Clear(); 
00038 
00039   TGraph* GetTGraph(bool baseline_subtracted = false, int downsample=1) const; 
00041   void Draw(bool baseline_subtracted = false, int downsample=1,
00042             bool autoscalex=true, bool autoscaley=true, double xmin=0,
00043             double xmax=0, double ymin=0, double ymax=0); 
00045   void Print (int verbosity);  
00047   int TimeToSample(double time, bool checkrange=false);
00049   double SampleToTime(int sample){ return (sample - trigger_index)/sample_rate;}
00051   const double* GetWaveform() const { return &(waveform[0]); }
00053   double* GetWaveform() { return &(waveform[0]); }
00055   const double* GetBaselineSubtractedWaveform() const 
00056   { return &(subtracted_waveform[0]); }
00058   double* GetBaselineSubtractedWaveform()
00059   { return &(subtracted_waveform[0]); }
00061   const double* GetIntegralWaveform() const 
00062   { return &(integral[0]); }
00064   double* GetIntegralWaveform()
00065   { return &(integral[0]); }
00066   
00068   double GetVerticalRange() const { return ((uint64_t)1<<sample_bits) - 1; } 
00069 public:
00071   enum ID_TYPES { CH_INVALID=-1, CH_SUM=-2 };
00072 public:
00073   //data members
00074   //raw-ish information
00075   int board_id;  
00076   int board_num; 
00077   int channel_num; 
00078   int channel_id; 
00079   std::string label; 
00080   uint64_t timestamp; 
00081   int sample_bits; 
00082   double sample_rate; 
00083   int trigger_index; 
00084   int nsamps; 
00085   double smoothed_min; 
00086   double smoothed_max; 
00087   std::vector<double> generic; 
00088   bool saturated; 
00089   double maximum; 
00090   double minimum; 
00091   double max_time; 
00092   double min_time; 
00093   const char* channel_start; 
00094   const char* channel_end;   
00095   double spe_mean;     
00096   double spe_sigma;
00097   //vector waveforms
00098   std::vector<double> waveform; 
00099   std::vector<std::pair<int,int> > unsuppressed_regions; 
00100   
00101   //processed information
00102   
00103   //baseline finding
00104   Baseline baseline;  
00105   std::vector<double> subtracted_waveform; 
00106   //individual pulses
00107   int npulses; 
00108   std::vector<Pulse> pulses; 
00109   std::vector<Roi> regions; 
00110   TOF tof; 
00111 
00112   //differentiator
00113   std::vector<double> derivative; 
00114   //smoothed data
00115   std::vector<double> smoothed_data; 
00116   std::vector<Spe> single_pe; 
00117   std::vector<Unspikes> unspikes; 
00118 
00119   //integrator
00120   std::vector<double> integral; 
00121   double integral_max;      
00122   double integral_min;      
00123   int integral_max_index;   
00124   int integral_min_index;   
00125   double integral_max_time; 
00126   double integral_min_time; 
00127   
00128   //energy variables
00129   double s1_full;    
00130   double s2_full;    
00131   double s1_fixed;   
00132   double s2_fixed;   
00133   ClassDef(ChannelData,14)
00134 };
00135 
00136 inline void ChannelData::Clear()
00137 {
00138   board_id = -1;
00139   board_num = -1;
00140   channel_num = -1;
00141   channel_id = -1;
00142   label = "";
00143   timestamp = 0;
00144   sample_bits = -1;
00145   sample_rate = -1;
00146   trigger_index = -1;
00147   nsamps = -1;
00148   saturated = false;
00149   maximum=-1;
00150   minimum=-1;
00151   generic.clear();
00152   channel_start = NULL;
00153   channel_end = NULL;
00154   spe_mean = 1.;
00155   spe_sigma = 0.;
00156 
00157   baseline.Clear();
00158   tof.Clear();
00159   subtracted_waveform.clear();
00160   npulses=0;
00161   pulses.clear();
00162   single_pe.clear();
00163   derivative.clear();
00164   smoothed_data.clear();
00165   smoothed_min = -1; 
00166   smoothed_max = -1;
00167   integral.clear();
00168   integral_max = -1;
00169   integral_min = -1;
00170   integral_max_index = -1;
00171   integral_min_index = -1;
00172   integral_max_time = -1;
00173   integral_min_time = -1;
00174   s1_full = 0;
00175   s2_full = 0;
00176   s1_fixed = 0;
00177   s2_fixed = 0;
00178 }
00179 
00180 inline int ChannelData::TimeToSample(double time, bool checkrange)
00181 { 
00182   int samp = (int)(time*sample_rate + trigger_index);
00183   if(checkrange){
00184     if(samp < 0) samp = 0;
00185     if(samp > nsamps-1) samp = nsamps-1;
00186   }
00187   return samp;
00188 }
00189 
00190 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 20 Jun 2014 for daqman by  doxygen 1.6.1