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"){
17 if (!strcmp(file,
"your_root_file")) { Plot3Dtracks_usage();
return;}
18 gROOT->Macro(
"Load.C");
19 gROOT->LoadMacro(
"bfc.C");
20 bfc(0,
"in,StEvent",file);
23 int MyEventId=eventNumber;
24 int MyTrackId=trackId;
25 printf(
" Look up the file %s to find the track %d from the event %d \n"
26 , file,MyTrackId,MyEventId);
28 bool trackWasFound =
false;
29 bool eventWasFound =
false;
31 while (!eventWasFound && !chain->MakeEvent() ) {
33 event = (
StEvent *)chain->GetDataSet(
"StEvent");
34 if (chain->GetEventNumber() == MyEventId) { eventWasFound =
true;
break; }
35 printf(
" ----- Current event %d keep moving towards event %d\n"
36 ,chain->GetEventNumber(), MyEventId);
41 const StSPtrVecTrackNode& theNodes =
event->trackNodes();
43 for (
unsigned int i=0; i<sz; i++) {
44 track = theNodes[i]->track(global);
45 printf(
" - current track - %d ---looking for %d \n", track->key(),MyTrackId);
47 if (track && (track->key() == MyTrackId)) { trackWasFound =
true;
break; }
49 if (trackWasFound) gEventDisplay->
Track(*track);
51 printf(
"ATTENTION: No track %d was found in %d event from file <%s>\n"
52 , MyTrackId, MyEventId, file);
56 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.