00001 00008 #ifndef EVENTDATA_h 00009 #define EVENTDATA_h 00010 00011 #include <vector> 00012 #include <string> 00013 #include <stdint.h> 00014 #include <iomanip> 00015 00016 #include "Rtypes.h" //has the classdef macro 00017 #include "ChannelData.hh" 00018 #include "SumOfIntegral.hh" 00019 00020 00021 //notice: members with comment starting with ! are not saved 00022 00028 class EventData{ 00029 //interface members 00030 public: 00031 EventData() { Clear(); } 00032 virtual ~EventData() {} //anything need cleaning up? 00034 void Clear(); //inlined below 00035 static const char* GetBranchName(){ return "event"; } 00036 void Print (int verbosity); 00037 public: 00038 00039 enum STATUS_FLAGS { NORMAL=0, ID_MISMATCH=1, /*enter more here*/}; 00040 00041 //data members 00042 int run_id; 00043 int event_id; 00044 uint64_t status; 00045 int trigger_count; 00046 long timestamp; 00047 uint64_t dt; 00048 uint64_t event_time; 00049 int nchans; 00050 bool saturated; 00051 bool pulses_aligned; 00052 std::vector<double> generic; 00053 std::vector<ChannelData> channels; 00054 std::vector<SumOfIntegral> sum_of_int; 00055 std::vector<Roi> roi_sum_of_int; 00056 00057 // Energy parameters 00058 bool s1_valid; 00059 bool s1_fixed_valid; 00060 bool s2_valid; 00061 bool s2_fixed_valid; 00062 bool s1s2_valid; 00063 bool s1s2_fixed_valid; 00064 double s1_start_time; 00065 double s1_end_time; 00066 double s2_start_time; 00067 double s2_end_time; 00068 00069 double drift_time; 00070 00071 double s1_full; 00072 double s2_full; 00073 double s1_fixed; 00074 double s2_fixed; 00075 double max_s1; 00076 double max_s2; 00077 int max_s1_chan; 00078 int max_s2_chan; 00079 double f90_full; 00080 double f90_fixed; 00081 double gatti; 00082 double ll_r; 00083 00084 //position 00085 bool position_valid; 00086 double x; 00087 double y; 00088 double z; 00089 double bary_valid; 00090 double bary_x; 00091 double bary_y; 00092 00094 ChannelData* GetChannelByID(int id){ 00095 std::vector<ChannelData>::iterator it = channels.begin(); 00096 while(it != channels.end() && it->channel_id != id) it++; 00097 return (it == channels.end() ? 0 : &(*it) ); 00098 } 00099 00101 Pulse* GetPulse(size_t pulsenum, int channel_id = ChannelData::CH_SUM){ 00102 ChannelData* ch = GetChannelByID(channel_id); 00103 if(ch && ch->pulses.size() > pulsenum) 00104 return &(ch->pulses[pulsenum]); 00105 return 0; 00106 } 00107 Roi* GetROI(size_t region, int channel_id = ChannelData::CH_SUM){ 00108 ChannelData* ch = GetChannelByID(channel_id); 00109 if(ch && ch->regions.size() > region) 00110 return &(ch->regions[region]); 00111 return 0; 00112 } 00113 00114 ClassDef(EventData,14) 00115 }; 00116 00117 00118 00119 inline void EventData::Clear() 00120 { 00121 run_id = -1; 00122 event_id = -1; 00123 status = NORMAL; 00124 trigger_count = -1; 00125 timestamp = 0; 00126 dt = 0; 00127 event_time = 0; 00128 nchans = -1; 00129 saturated = false; 00130 pulses_aligned = false; 00131 generic.clear(); 00132 s1_valid = false; 00133 s2_valid = false; 00134 s1s2_valid = false; 00135 s1_start_time = 0; 00136 s1_end_time = 0; 00137 s2_start_time = 0; 00138 s2_end_time = 0; 00139 s1_full = 0; 00140 s2_full = 0; 00141 s1_fixed = 0; 00142 s2_fixed = 0; 00143 max_s1 = 0; 00144 max_s2 = 0; 00145 max_s1_chan = -1; 00146 max_s2_chan = -1; 00147 f90_full = 0; 00148 f90_fixed = 0; 00149 gatti = 0; 00150 ll_r = 0; 00151 drift_time = 0; 00152 position_valid = false; 00153 x=0; 00154 y=0; 00155 z=0; 00156 bary_valid = false; 00157 bary_x = 0; 00158 bary_y = 0; 00159 channels.clear(); 00160 } 00161 #endif