00001 #ifndef HIT_CC
00002 #define HIT_CC
00003
00004 #include "hit.hh"
00005
00006 namespace larlight {
00007
00008
00009 hit::hit(DATA::DATA_TYPE type) : data_base(type),
00010 fHitSignal()
00011
00012 {
00013 if( _type != DATA::Hit &&
00014 _type != DATA::CrawlerHit &&
00015 _type != DATA::GausHit &&
00016 _type != DATA::APAHit &&
00017 _type != DATA::FFTHit &&
00018 _type != DATA::RFFHit ) {
00019
00020 Message::send(MSG::ERROR,__FUNCTION__,
00021 Form("Provided data type (%s) not supported! Reset to default.",DATA::DATA_TREE_NAME[_type].c_str()));
00022
00023 _type = DATA::Hit;
00024 }
00025 clear_data();
00026 }
00027
00028
00029 hit::hit(const hit &original) : data_base(original),
00030 fHitSignal(original.fHitSignal),
00031 fStartTime(original.fStartTime),
00032 fSigmaStartTime(original.fSigmaStartTime),
00033 fPeakTime(original.fPeakTime),
00034 fSigmaPeakTime(original.fSigmaPeakTime),
00035 fEndTime(original.fEndTime),
00036 fSigmaEndTime(original.fSigmaEndTime),
00037 fCharge(original.fCharge),
00038 fSigmaCharge(original.fSigmaCharge),
00039 fMaxCharge(original.fMaxCharge),
00040 fSigmaMaxCharge(original.fSigmaMaxCharge),
00041 fMultiplicity(original.fMultiplicity),
00042 fGoodnessOfFit(original.fGoodnessOfFit),
00043 fView(original.fView),
00044 fSignalType(original.fSignalType),
00045 fChannel(original.fChannel),
00046 fWire(original.fWire)
00047
00048 {};
00049
00050
00051 void hit::clear_data()
00052
00053 {
00054 data_base::clear_data();
00055 fHitSignal.clear();
00056 fStartTime = fPeakTime = fEndTime = -1;
00057 fSigmaStartTime = fSigmaPeakTime = fSigmaEndTime = -1;
00058 fCharge = fMaxCharge = -1;
00059 fSigmaCharge = fSigmaMaxCharge = -1;
00060 fMultiplicity = -1;
00061 fGoodnessOfFit = -1;
00062 fView = GEO::kUnknown;
00063 fSignalType = GEO::kMysteryType;
00064 fChannel = 0xffffffff;
00065 fWire = 0xffffffff;
00066 }
00067
00068
00069 event_hit::event_hit(DATA::DATA_TYPE type) : std::vector<larlight::hit>(),
00070 event_base(type)
00071
00072 {
00073 if( _type != DATA::Hit &&
00074 _type != DATA::CrawlerHit &&
00075 _type != DATA::GausHit &&
00076 _type != DATA::APAHit &&
00077 _type != DATA::FFTHit &&
00078 _type != DATA::RFFHit ) {
00079
00080 Message::send(MSG::ERROR,__FUNCTION__,
00081 Form("Provided data type (%s) not supported! Reset to default.",DATA::DATA_TREE_NAME[_type].c_str()));
00082
00083 _type = DATA::Hit;
00084 }
00085
00086 clear_data();
00087
00088 }
00089
00090
00091
00092 void event_hit::get_axis_range(std::vector<Double_t> &chmax,
00093 std::vector<Double_t> &chmin,
00094 std::vector<Double_t> &wiremax,
00095 std::vector<Double_t> &wiremin,
00096 std::vector<Double_t> &timemax,
00097 std::vector<Double_t> &timemin) const
00098
00099 {
00100
00101
00102 chmax.resize((GEO::kW+1),-1);
00103 wiremax.resize((GEO::kW+1),-1);
00104 timemax.resize((GEO::kW+1),-1);
00105 chmin.resize((GEO::kW+1),-1);
00106 wiremin.resize((GEO::kW+1),-1);
00107 timemin.resize((GEO::kW+1),-1);
00108
00109
00110 for(event_hit::const_iterator iter(this->begin()); iter!=this->end(); ++iter) {
00111
00112 GEO::View_t view = (*iter).View();
00113 Double_t wire = (Double_t)((*iter).Wire());
00114 Double_t ch = (Double_t)((*iter).Channel());
00115 Double_t tstart = (*iter).StartTime();
00116 Double_t tend = (*iter).EndTime();
00117
00118 if( wiremax[view] < 0 || wiremax[view] < wire ) wiremax[view] = wire;
00119 if( chmax[view] < 0 || chmax[view] < ch ) chmax[view] = ch;
00120 if( timemax[view] < 0 || timemax[view] < tend ) timemax[view] = tend;
00121
00122 if( wiremin[view] < 0 || wiremin[view] > wire ) wiremin[view] = wire;
00123 if( chmin[view] < 0 || chmin[view] > ch ) chmin[view] = ch;
00124 if( timemin[view] < 0 || timemin[view] > tstart ) timemin[view] = tstart;
00125
00126 }
00127
00128 return;
00129 }
00130
00131
00132 void event_hit::get_axis_range(std::vector<Double_t> &chmax,
00133 std::vector<Double_t> &chmin,
00134 std::vector<Double_t> &wiremax,
00135 std::vector<Double_t> &wiremin,
00136 std::vector<Double_t> &timemax,
00137 std::vector<Double_t> &timemin,
00138 const std::vector<unsigned short>& hit_index) const
00139
00140 {
00141
00142
00143 chmax.resize((GEO::kW+1),-1);
00144 wiremax.resize((GEO::kW+1),-1);
00145 timemax.resize((GEO::kW+1),-1);
00146 chmin.resize((GEO::kW+1),-1);
00147 wiremin.resize((GEO::kW+1),-1);
00148 timemin.resize((GEO::kW+1),-1);
00149
00150
00151 for(std::vector<unsigned short>::const_iterator iter(hit_index.begin());
00152 iter!=hit_index.end();
00153 ++iter) {
00154
00155 unsigned short index = (*iter);
00156
00157 if( index < this->size() ) {
00158
00159 GEO::View_t view = (this->at(index)).View();
00160 Double_t wire = (Double_t)((this->at(index)).Wire());
00161 Double_t ch = (Double_t)((this->at(index)).Channel());
00162 Double_t tstart = (this->at(index)).StartTime();
00163 Double_t tend = (this->at(index)).EndTime();
00164
00165 if( wiremax[view] < 0 || wiremax[view] < wire ) wiremax[view] = wire;
00166 if( chmax[view] < 0 || chmax[view] < ch ) chmax[view] = ch;
00167 if( timemax[view] < 0 || timemax[view] < tend ) timemax[view] = tend;
00168
00169 if( wiremin[view] < 0 || wiremin[view] > wire ) wiremin[view] = wire;
00170 if( chmin[view] < 0 || chmin[view] > ch ) chmin[view] = ch;
00171 if( timemin[view] < 0 || timemin[view] > tstart ) timemin[view] = tstart;
00172 }else{
00173
00174 Message::send(MSG::ERROR,__FUNCTION__,
00175 Form("Hit index %d does not exist!",index));
00176 continue;
00177 }
00178 }
00179
00180 return;
00181 }
00182
00183 }
00184 #endif
00185