|
///////////////////////////////////////////////////////////////// // // BrGeantTrack is a BRAHMS data class providing access to momentum, // PID and hit information for a single GBRAHMS track. // ///////////////////////////////////////////////////////////////// // Updates: // April 14 1999 /fv // -Correct error in method P() (Was total energy!!) // -Add method Phi() // -Take math from BrMath class. // April 16 1999 /fv // -Add ostream method << // November 15, 1999 /fv // -insert check for fHitList on copy constructor. // April 25, 2000 /fv // - Use Brunits for setting momenta.. // // $Id: BrGeantTrack.cxx,v 1.3 2002/04/22 12:54:26 staszel Exp $ // $Author: staszel $ // $Date: 2002/04/22 12:54:26 $ // #include "math.h" #include <iostream.h> #include <iomanip.h> #include <BrGeantTrack.h> #include <BrGeantHit.h> #include <BrMath.h> #include <BrUnits.h> #ifndef BRAT_BrVector3D #include "BrVector3D.h" #endif //____________________________________________________________ ClassImp(BrGeantTrack); //____________________________________________________________ BrGeantTrack::BrGeantTrack() { // Constructor. Reset all variables as well as fHitList to NULL. // fHitList = NULL; fVx = 0; fVy = 0; fVz = 0; fMass = 0; fPx = 0; fPy = 0; fPz = 0; fPid = 0; fHitCounter = 0; fStatus = 0; fHitBits = 0; } //____________________________________________________________ BrGeantTrack::BrGeantTrack(GeantStreamTracks& ffTracks) { // Constructor. Set fHitList to NULL. // Fill all relevant vriables with those read from the // stream file. // fHitList = NULL; fVx = ffTracks.vert[0]; fVy = ffTracks.vert[1]; fVz = ffTracks.vert[2]; fCharge = ffTracks.charge; // convert to standard units fPx = ffTracks.pvert[0] * BrUnits::GeV; fPy = ffTracks.pvert[1] * BrUnits::GeV; fPz = ffTracks.pvert[2] * BrUnits::GeV; fPid = ffTracks.pid; fMass = BrGeantHit::Mass(fPid); fNtbeam = ffTracks.ntbeam; fTrackno = ffTracks.trackno; fHitCounter = 0; fStatus = 0; fHitBits = 0; } //______________________________________________________________________________ BrGeantTrack::BrGeantTrack(const BrGeantTrack *track) { // copy constructor. // fStatus = track->fStatus; fVx = track->fVx; fVy = track->fVy; fVz = track->fVz; fMass = track->fMass; fPx = track->fPx; fPy = track->fPy; fPz = track->fPz; fPid = track->fPid; fTrackno = track->fTrackno; fNtbeam = track->fNtbeam; if(track->fHitList){ fHitList = new TObjArray(*track->fHitList); } else fHitList=0; fHitCounter = 0; fHitBits = track->fHitBits; } //____________________________________________ BrGeantTrack::~BrGeantTrack() { // Destructor. Clears fHitList if applicable, but does // not delete BrGeantHit objects. if(fHitList){ fHitList->Clear(); delete fHitList; } //mpd delete polyline // if(fPolyLine) // delete fPolyLine; } //____________________________________________ void BrGeantTrack::AddHit(BrGeantHit *hit) { // Add one hit to fHitList, create fHitList if necessary. // Used only when event display is enabled. Not for normal tracking // purposes. if(!fHitList) fHitList = new TObjArray(); fHitList->Add(hit); } //____________________________________________ void BrGeantTrack::MakeHitList() { // Create fHitList if necessary. if(!fHitList) fHitList = new TObjArray(); } //________________________________________________ Int_t BrGeantTrack::NHits() const { // Get number of hits on the track if applicable if(fHitList) return fHitList->GetEntries(); else return 0; } //____________________________________________ Double_t BrGeantTrack::Energy() const { // return track energy, assuming mass fMass. // return sqrt(Px()*Px()+Py()*Py()+Pz()*Pz()+fMass*fMass); } //____________________________________________ Double_t BrGeantTrack::P() const { // return track energy, assuming mass fMass. // return sqrt(Px()*Px()+Py()*Py()+Pz()*Pz()); } //____________________________________________ Double_t BrGeantTrack::Rap() const { // return track energy, assuming mass given in argument. // Double_t rap; Double_t E; E = sqrt(fMass*fMass + Pz()*Pz()+Px()*Px()+Py()*Py()); rap = 0.5 * log((E+Pz())/(E-Pz())); return rap; } //____________________________________________ Double_t BrGeantTrack::Theta() const { // Calculate polar angle in radians for track. return BrMath::ACos(Pz()/P()); } //____________________________________________ Double_t BrGeantTrack::Phi() const { // Calculate angle in radians for track. return BrMath::ATan2(Py(), Px()); } //____________________________________________ Double_t BrGeantTrack::Dip() const { if(Pz()==0) return 0; else return atan(Py()/Pz()); } //____________________________________________ Double_t BrGeantTrack::Beta() const { // velocity of track in v/c; // Double_t p; Double_t E; p = P(); E = sqrt(p*p + fMass* fMass); return p/E; } //___________________________________________ BrLine3D BrGeantTrack::GetTrackLine() { // Method calculates and returns a global line associated with this track. BrLine3D trackLine; BrVector3D origin(fVx,fVy,fVz); BrVector3D direction(fPx,fPy,fPz); trackLine.SetOrigin(origin); trackLine.SetDirection(direction); return trackLine; } //____________________________________________ BrGeantHit *BrGeantTrack::NextHit() { // Iterator over hits on track. Note that this loop // can NOT be nested. Use the GetHitList() call to // obtain and manipulate the fHitList ObjArray for // more complicated loops. if(fHitList) { return (BrGeantHit *) fHitList->At(fHitCounter++); } else { return NULL; } } //____________________________________________ void BrGeantTrack::ListHits() { // // List hits attached to this track hitlist. // if(fHitList) { TIter NextHit(fHitList); BrGeantHit *hit; while((hit = (BrGeantHit *) NextHit())) { cout << hit << endl; } } } //________________________________________________________ ostream& operator<< (ostream &os, BrGeantTrack *gtrack) { // Formatted output // os<<"Trackno - "<<gtrack->fTrackno<<"n"; os<<" Pid " <<setw(8)<<gtrack->fPid<<"n"; os<<" Pid " <<setw(8)<<gtrack->fPid<<"n"; os<<" P : (" << setw(8)<<setprecision(4)<<gtrack->fPx <<","<<setw(8)<<gtrack->fPy <<","<<setw(8)<<gtrack->fPz<<")n"; os<<" Vertex : (" <<setw(8)<< gtrack->fVx <<","<<setw(8)<<gtrack->fVy <<","<<setw(8)<<gtrack->fVz<<")n"; os<<" Ntbeam : "<< dec<<gtrack->fNtbeam <<"n"; return os; } // $Log: BrGeantTrack.cxx,v $ // Revision 1.3 2002/04/22 12:54:26 staszel // Added method GetTrackLine that returns track line at it's vertex. // // Revision 1.2 2001/10/25 20:25:14 cholm // Changes to the build system: // ---------------------------- // Each library, except the basic libraries, now incremental links to it's // needed ROOT libraries. The basic libraries link to the basic ROOT // libraries, and in addtion also sets the RPATH on linked applications, // to contain the path to the ROOT libraries. In this way, one never // needs to set the environment variable LD_LIBRARY_PATH. The basic BRAT // libraries are: // libBratDataAbc.la // libBratManagers.la // libBratUtil.la // All other libraries requires these libraries (note, that // libBratModuleAbc.la is not a basic library, since it needs the data abc // library). // // For the internal builtsystem of BRAT, this matters little. In fact, it // makes the builtsystem much cleaner. // // For the runtime environment of BRAT it matters a lot - no need to set // environment varaiables. // // For client code (code that uses BRAT libraries) it has the impact that // rather than specifying linking as (old-school linking) // -L<libdir> -lBrat<component> // one can utilise the extra information on required ROOT libraries by // using libtool and linking against with // <libdir>/libBrat<component>.la // However, old-school linking still works perfectly fine. // // Autoconf macros: // ---------------- // Some users have reported problems with the autoconf macro files in the // config subdirectpry. Therefor, I've extracted all those macros and put // them in acinclude.m4 in the top directory. Also, the macro names has // been changed to start with BRAT_. The acinclude.m4 file is install in // <datadir>/aclocal as brat.m4, but that should not give any conflicts, // since the macro names has been changed. That changes is also // propegated to the help subdirectory. // // README file: // ------------ // The contenst, now in The Guide, was removed, and instead, I've put in a // list of interlibrary dependencies - and there are ugly! We need to do // something about that at some point. To help that, I listed some // questions at the end of the file. // // configure.in // ------------ // Revision number bump. // // Revision 1.1.1.1 2001/06/21 14:55:00 hagel // Initial revision of brat2 // // Revision 1.17 2000/11/08 18:14:27 videbaek // Correct mistake in method Theta() // // Revision 1.16 2000/08/29 16:24:34 videbaek // Move CVSlog to end // // Revision 1.15 2000/04/28 21:20:24 videbaek // Use BrUnits to convert from geanthits to dedx intrinsic values. // // Revision 1.14 2000/03/21 21:22:12 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.13 1999/11/26 17:00:40 hehi // Added prototype for put-to operator - Christian Holm // // Revision 1.12 1999/11/19 17:00:53 videbaek // Update for NT and 2.2o // CVf fHitList allocationUpdate for NT and 2.2tructor. // // Revision 1.11 1999/09/22 15:10:59 videbaek // Modified ListHits // // Revision 1.10 1999/05/25 20:39:10 videbaek // Add iostream methods. // // Revision 1.9 1999/04/14 20:10:05 videbaek // Corrected P(). added method Phi() // // Revision 1.8 1999/03/17 21:36:57 videbaek // Added member functions to BrGeantTrack class which are // useful in analysis Pt(). Modiifed the Rap() to take no-argument. // The Mass of the particle in the track has already been set by the // reading routine. // // Revision 1.7 1998/09/27 17:09:44 alv // added copy constructor // make the "get" methods const // In constructors // added fHitBits=0 // // Revision 1.6 1998/09/17 16:16:06 videbaek // Moved Mass() static fct to BrGeantHit class // // Revision 1.5 1998/09/08 15:29:17 alv // Added fStatus=0 in constructors. // // Revision 1.4 1998/07/28 21:31:01 videbaek // Change units to MeV // // Revision 1.3 1998/04/30 17:12:35 videbaek // Added functionality to BrGeantInput // // Revision 1.2 1998/03/09 20:54:19 videbaek // Ensure that pointers are non-NULL before deleting // // 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>
|