|
// $Id: BrGeantHit.cxx,v 1.3 2002/04/22 13:03:23 staszel Exp $ #include <BrGeantHit.h> #include <BrUnits.h> #ifndef BRAT_BrVector3D #include "BrVector3D.h" #endif ClassImp(BrGeantHit); //////////////////////////////////////////////////////////////////////// // // BrGeantHit is a BRAHMS data class for storing information for // one detector GEANT hit. The class is derived from TObject and can // as such be manipulated by ROOT. // /////////////////////////////////////////////////////////////////////// //_________________________________________________________________________ BrGeantHit::BrGeantHit() { // // Dummy constructor. All object members are reset // fDetectorID = 0; for( Int_t i=0;i<3;i++) { fLocalPosIn[i] = (float)0.0; fLocalPosOut[i] = (float)0.0; fGlobalPosIn[i] = (float)0.0; fGlobalPosOut[i] = (float)0.0; } fTof = (float)0.0; fDedx = (float)0.0; fPdet = (float)0.0; fIsub = 0; fPid = 0; fTrackp = 0; } //_________________________________________________________________________ BrGeantHit::BrGeantHit(GeantStreamHits& fHits) { // // Constructor. The member objects are filled with the values as // gotten from the input structure GeantStreamHits. // fTrackNo = fHits.trackno; fDetectorID = fHits.DetectorId; for( Int_t i=0;i<3;i++) { fLocalPosIn[i] = fHits.LocalPositionIn[i]; fLocalPosOut[i] = fHits.LocalPositionOut[i]; fGlobalPosIn[i] = fHits.GlobalPositionIn[i]; fGlobalPosOut[i] = fHits.GlobalPositionOut[i]; } fTof = fHits.Tof * BrUnits::second; fDedx = fHits.dedx * BrUnits::GeV; fPdet = fHits.Etot * BrUnits::GeV; fIsub = fHits.Isub; fPid = fHits.Pid; fTrackp = 0; } //_________________________________________________________________________ BrGeantHit::BrGeantHit(const BrGeantHit* hit) { // // Copy Constructor. The membeer objects are filled with the values // as gotten from the input structure GeantStreamHits. // fTrackNo = hit->fTrackNo; fDetectorID = hit->fDetectorID; for( Int_t i=0;i<3;i++) { fLocalPosIn[i] = hit->fLocalPosIn[i]; fLocalPosOut[i] = hit->fLocalPosOut[i]; fGlobalPosIn[i] = hit->fGlobalPosIn[i]; fGlobalPosOut[i] = hit->fGlobalPosOut[i]; } fTof = hit->fTof; fDedx = hit->fDedx; fPdet = hit->fPdet; fIsub = hit->fIsub; fPid = hit->fPid; fTrackp = 0; } //_________________________________________________________________________ BrLine3D BrGeantHit::GetGlobalLine() { // This method calculates and returns global line // associated with 'this' hit BrVector3D origin(fGlobalPosIn[0],fGlobalPosIn[1],fGlobalPosIn[2]); BrVector3D direction(fGlobalPosOut[0]-fGlobalPosIn[0], fGlobalPosOut[1]-fGlobalPosIn[1], fGlobalPosOut[2]-fGlobalPosIn[2]); BrLine3D globalLine(origin,direction); return globalLine; } //_________________________________________________________________________ BrLine3D BrGeantHit::GetLocalLine() { // This method calculates and returns global line // associated with 'this' hit BrVector3D origin(fLocalPosIn[0],fLocalPosIn[1],fLocalPosIn[2]); BrVector3D direction(fLocalPosOut[0]-fLocalPosIn[0], fLocalPosOut[1]-fLocalPosIn[1], fLocalPosOut[2]-fLocalPosIn[2]); BrLine3D localLine(origin,direction); return localLine; } //_________________________________________________________________________ ostream& operator<< (ostream & os,BrGeantHit *ghit) { os<<"Trackno,DetectorID, SubID, DeDx = "<<ghit->TrackNo()<<"," <<ghit->DetectorID()<<","<<ghit->Isub()<<","<<ghit->Dedx()<<endl; os<<" Local (x,y,z) In = "<<ghit->LocalPosIn()[0]; os<<","<<ghit->LocalPosIn()[1]; os<<","<<ghit->LocalPosIn()[2]; os<<" "<<" Out = "<<ghit->LocalPosOut()[0]; os<<","<<ghit->LocalPosOut()[1]; os<<","<<ghit->LocalPosOut()[2]; os<<endl; return os; } //_________________________________________________________________________ Double_t BrGeantHit::Mass(Int_t pid){ // // static function to evaluate mass based on pid // float mass; switch(pid){ case 2: case 3: mass =.511*BrUnits::MeV; break; case 5: case 6: mass =105.7*BrUnits::MeV; break; case 8: case 9: mass = 139.6*BrUnits::MeV; break; case 11: case 12: mass = 493.7*BrUnits::MeV; break; case 14: case 15: mass = 938.3*BrUnits::MeV; break; case 16: mass = 497.7*BrUnits::MeV; break; case 18: case 26: mass = 1116.0*BrUnits::MeV; break; case 45: mass = 1876.1*BrUnits::MeV; break; case 46: mass = 2809.0*BrUnits::MeV; break; case 47: mass = 3727.0*BrUnits::MeV; break; case 49: mass = 2809.0*BrUnits::MeV; break; default: mass = 0.*BrUnits::MeV; } return mass; } //_________________________________________________________________________ Double_t BrGeantHit::Charge(Int_t pid){ // // static function to evaluate mass based on pid // float charge; switch(pid){ case 2: charge = 1; break; case 3: charge = -1; break; case 5: charge = 1; break; case 6: charge = -1; break; case 8: charge = 1; break; case 9: charge = -1; break; case 11: charge = 1; break; case 12: charge = -1; break; case 14: charge = 1; break; case 15: charge = -1; break; case 19: charge = 1; break; case 21: charge = -1; break; case 23: charge = -1; break; case 24: charge = -1; break; case 27: charge = -1; break; case 29: charge = 1; break; case 31: charge = 1; break; case 32: charge = 1; break; case 45: charge = 1; break; case 46: charge = 1; break; case 47: charge = 2; break; case 49: charge = 2; break; default: charge = 0; } return charge; } ///////////////////////////////////////////////////////////////////////////// // CVSLOG // // $Log: BrGeantHit.cxx,v $ // Revision 1.3 2002/04/22 13:03:23 staszel // Added two methods GetLocalLine and GetGlobalLine which return respectively, // local and global line associated with a given hit. // // Revision 1.2 2001/08/24 18:48:41 cholm // Fixed the initialisation of pointers. Thanks to Rene Brun for // pointing this out. // // Revision 1.1.1.1 2001/06/21 14:55:00 hagel // Initial revision of brat2 // // Revision 1.18 2000/09/14 16:13:10 hito // Hiro added charge info to geant hit. // // Revision 1.17 2000/08/29 16:24:33 videbaek // Move CVSlog to end // // Revision 1.16 2000/04/28 21:20:24 videbaek // Use BrUnits to convert from geanthits to dedx intrinsic values. // // Revision 1.15 2000/03/21 21:22:11 cholm // Several changes: A few hacks where needed to compile on Digital Unix, noticably in my - Christian Holm - classes for the DB and Exceptions. Proberly still need to do something to some of Konstantins stuff. Also, I removed a lot of warnings fromt the compiler, by teddying up the code. Several places, old C-style indecies in for loops were assumed. Corrected. Unused variables have been commented out. // // Revision 1.14 1999/11/30 22:21:44 videbaek // Added copyconstructor // // Revision 1.13 1999/07/09 14:22:23 videbaek // fixed mass errors and added more. Thanks to Renate // // Revision 1.12 1999/04/09 19:37:16 videbaek // Add proper include guards. // // Revision 1.11 1998/12/21 20:30:57 videbaek // Update ostream <<. mods in makeNT // // Revision 1.10 1998/12/04 21:33:57 videbaek // Fix type SHLIB->$(SHLIB) .. // Changed units to be proper MeV (again) // // Revision 1.7 1998/09/17 16:16:06 videbaek // Moved Mass() static fct to BrGeantHit class // // Revision 1.6 1998/07/28 21:31:00 videbaek // Change units to MeV // // Revision 1.5 1998/07/20 17:42:57 videbaek // Added Pid hit to hit structure. Needed for effecient handling // of detector response. // // Revision 1.4 1998/06/21 14:34:51 hagel // Correct problem in BrDigitizeDC; clean up tests // // Revision 1.3 1998/06/06 21:45:10 hagel // Add ostream capabilities to some objects // // Revision 1.2 1998/04/30 17:12:34 videbaek // Added functionality to BrGeantInput // // Revision 1.1.1.1 1998/03/04 21:33:10 brahmlib // Brat geant // // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|