00001 // TSbDetector.cxx. 00013 #include <iostream> 00014 00015 #include "TSbDetector.h" 00016 #include "TSubEvent.h" 00017 #include "THit.h" 00018 00019 using std::cout; 00020 using std::endl; 00021 00022 TSbDetector::TSbDetector(const Char_t *name, UInt_t channels) 00023 : THiDetector(name, channels) 00024 { 00032 } 00033 00034 TSbDetector::~TSbDetector() 00035 { 00038 } 00039 00040 void TSbDetector::Print(const Char_t *option) const 00041 { 00048 cout << "SB detector:" << endl; 00049 THiDetector::Print(option); 00050 } 00051 00052 void TSbDetector::SetSignals(const TSubEvent &subEvent) 00053 { 00062 const vector<TDataItem<UShort_t> > &adcs = subEvent.GetAdcs(); 00063 const vector<TDataItem<UShort_t> > &tdcs = subEvent.GetTdcs(); 00064 00065 for (UInt_t i = 0; i < adcs.size(); i++) 00066 if (fCalib.GetAdc().TestChannel(adcs[i].GetChannel())) { 00067 fAdcs.push_back(&adcs[i]); 00068 fHit = true; 00069 } 00070 for (UInt_t i = 0; i < tdcs.size(); i++) 00071 if (fCalib.GetTdc().TestChannel(tdcs[i].GetChannel())) { 00072 fTdcs.push_back(&tdcs[i]); 00073 } 00074 } 00075 00076 void TSbDetector::FindHits(vector<THit> *hits) const 00077 { 00086 // 00087 // we only rebuild 1 hit here 00088 // 00089 THit p; 00090 00091 if (fEnergies.size() && fEnergies[0]->GetValue() > 0) { 00092 p.SetEnergy(fEnergies[0]->GetValue()); 00093 if (fTimes.size()) 00094 p.SetTime(fTimes[0]->GetValue()); 00095 p.SetDetector(GetName()); 00096 p.SetPosition(fCoordinates.X(), fCoordinates.Y(), fCoordinates.Z()); 00097 hits->push_back(p); 00098 } 00099 }