00001 // THit.cxx. 00010 #include <iostream> 00011 00012 #include "THit.h" 00013 00014 // Class implementation tag for ROOT. 00015 // 00016 ClassImp(THit) 00017 00018 using std::cout; 00019 using std::endl; 00020 00021 THit::THit(const Char_t *detName, Float_t e, Float_t t) 00022 : fDetector(detName), fEnergy(e), fTime(t) 00023 { 00026 } 00027 00028 THit::~THit() 00029 { 00032 } 00033 00034 void THit::Print(const Char_t *option) const 00035 { 00039 cout << "energy " << fEnergy << endl 00040 << "time " << fTime << endl 00041 << "detector " << fDetector << endl; 00042 fPosition.Print(); 00043 } 00044 00045 void THit::SetPosition(Float_t x, Float_t y, Float_t z) 00046 { 00052 fPosition.SetXYZ(x, y, z); 00053 } 00054 00055 TVector3 THit::GetMomentum() const 00056 { 00060 return fEnergy * fPosition.Unit(); 00061 } 00062 00063 Double_t THit::DopplerCorrect(Float_t energy, Float_t mass) const 00064 { 00070 return fEnergy * (1 - (TMath::Sqrt(2 * energy / (mass * 931.494)) 00071 * fPosition.CosTheta())); 00072 }