00001 // TNaiDetector.cxx. 00011 #include <iostream> 00012 00013 #include "TNaiDetector.h" 00014 #include "TSubEvent.h" 00015 #include "THit.h" 00016 00017 using std::cout; 00018 using std::endl; 00019 00020 TNaiDetector::TNaiDetector(const Char_t *name, UInt_t channels) 00021 : THiDetector(name, channels) 00022 { 00030 } 00031 00032 TNaiDetector::~TNaiDetector() 00033 { 00036 } 00037 00038 void TNaiDetector::Print(const Char_t *option) const 00039 { 00046 cout << "NaI detector:" << endl; 00047 THiDetector::Print(option); 00048 } 00049 00050 void TNaiDetector::SetSignals(const TSubEvent &subEvent) 00051 { 00060 const vector<TDataItem<UShort_t> > &adcs = subEvent.GetAdcs(); 00061 00062 for (UInt_t i = 0; i < adcs.size(); i++) 00063 if (fCalib.GetAdc().TestChannel(adcs[i].GetChannel())) { 00064 fAdcs.push_back(&adcs[i]); 00065 fHit = true; 00066 } 00067 } 00068 00069 void TNaiDetector::FindHits(vector<THit> *hits) const 00070 { 00079 // 00080 // we only rebuild 1 hit here 00081 // 00082 THit p; 00083 00084 if (fEnergies.size() && fEnergies[0]->GetValue() > 0) { 00085 p.SetEnergy(fEnergies[0]->GetValue()); 00086 if (fTimes.size()) 00087 p.SetTime(fTimes[0]->GetValue()); 00088 p.SetDetector(GetName()); 00089 p.SetPosition(fCoordinates.X(), fCoordinates.Y(), fCoordinates.Z()); 00090 hits->push_back(p); 00091 } 00092 } 00093