4 void Plot3Dtracks_usage()
6 printf(
"\n The \"Plot3Dtracks.C\" macro creates a simple STAR chain to read the \"StEvent\" object \n");
7 printf(
" from ROOT file and draw the track with the \"trackId\" from the \"eventNumber\" event\n");
9 printf(
" USAGE: Plot3Dtracks.C(int eventNumber, int trackId, const char *file)\n");
11 printf(
" see: <http://www.star.bnl.gov/public/comp/vis/StDraw3D> as well\n\n");
14 void Plot3Dtracks(
int eventNumber=22394,
int trackId=425,
const char *file=
"your_root_file"){
18 gROOT->Macro(
"Load.C");
19 gROOT->LoadMacro(
"bfc.C");
20 gSystem->Load(
"StDetectorDbMaker");
21 bfc(0,
"in,StEvent",file);
24 int MyEventId=eventNumber;
25 int MyTrackId=trackId;
26 printf(
" Look up the file %s to find the track %d from the event %d \n"
27 , file,MyTrackId,MyEventId);
29 bool trackWasFound =
false;
30 bool eventWasFound =
false;
32 while (!eventWasFound && !chain->MakeEvent() ) {
34 event = (
StEvent *)chain->GetDataSet(
"StEvent");
35 if (chain->GetEventNumber() == MyEventId) { eventWasFound =
true;
break; }
36 printf(
" ----- Current event %d keep moving towards event %d\n"
37 ,chain->GetEventNumber(), MyEventId);
42 const StSPtrVecTrackNode& theNodes =
event->trackNodes();
44 for (
unsigned int i=0; i<sz; i++) {
45 track = theNodes[i]->track(global);
46 printf(
" - current track - %d ---looking for %d \n", track->key(),MyTrackId);
48 if (track && (track->key() == MyTrackId)) { trackWasFound =
true;
break; }
50 if (trackWasFound) gEventDisplay->
Track(*track);
52 printf(
"ATTENTION: No track %d was found in %d event from file <%s>\n"
53 , MyTrackId, MyEventId, file);
57 printf(
"ATTENTION: No event %d was found from file <%s> !!!\n", MyEventId, file);
virtual void SetBkColor(Color_t newBkColor)
Set the ROOT color as the widget background.
virtual TObject * Track(const StTrack &track, Color_t col, Style_t sty=Style_t(-1), Size_t siz=Size_t(-1))
Add track to the display list with the col color sty and size if provided.