#include "hitofcalsim.h" ClassImp(HiTofCalSim) HiTofCalSim::HiTofCalSim(void) { clear(); } void HiTofCalSim::clear(void) { HiTofCal::clear(); fnHits = 0; for(Int_t i = 0; i < MAXHITS; i++) { fnTrack[i] = -1; fGeaTof[i] = -1; } } Int_t HiTofCalSim::findTrack(Int_t n) { // return index of track if found, // otherwise -1 for(Int_t i=0; i < fnHits; i++){ if(n == fnTrack[i] ) return i; } return -1; } Int_t HiTofCalSim::addTrack (Int_t n, Float_t tof) { // add track n to the list if it is not already // inside the list. If the track is alreadu in // the list the shorter tof is stored. Returns // the index of the track in the list Int_t i = findTrack(n); if(i < 0 && fnHits <= MAXHITS) { // new Track fnTrack[fnHits] = n; fGeaTof[fnHits] = tof; i = fnHits; fnHits++; } else { // track already stored if ( fGeaTof[i] > tof) fGeaTof[i] = tof; } return i; } Int_t HiTofCalSim::getTrack(Int_t i) { // return track at index i and -1 if // index is > fnHits-1 if (i >= 0 && i < fnHits) return fnTrack[i]; else return -1; } Float_t HiTofCalSim::getGeaTof(Int_t i) { // return of at index i and -1 if // index is > fnHits-1 if (i >= 0 && i < fnHits) return fGeaTof[i]; else return -1; } void HiTofCalSim::resetTrackData(Int_t val) { for(Int_t i = 0;i < MAXHITS; i++) { fnTrack[i] = val; fGeaTof[i] = val; } fnHits = 0; } void HiTofCalSim::fillTrackData(Int_t i,Int_t n, Float_t tof) { if(i >= 0 && i < MAXHITS) { fnTrack[i] = n; fGeaTof[i] = tof; } }