StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ed.C
Go to the documentation of this file.
1 
2 // $Id: Ed.C,v 1.15 2010/04/29 19:16:36 fine Exp $
3 // *-- Author : Valery Fine(fine@bnl.gov) 25/02/2009
4 
6 
55 class StEvent;
56 StEvent* event = 0;
57 
59 
68 //__________________________________________
69 void rd(int hits=0, bool clear=false)
70 {
71  // redraw the event
72  if (event) {
73  if (clear) gEventDisplay->Clear();
74  if (hits) {
75  if (hits & 0x1 ) gEventDisplay->Hits(event,1);
76  if (hits & 0x2 ) gEventDisplay->EmcHits(event);
77  if (hits & 0x4 ) gEventDisplay->FtpcHits(event,1);
78  // if (hits & 4) gEventDisplay->EmcHits(event,"eemc");
79  }
80  else gEventDisplay->Tracks(event);
81  // gEventDisplay->Update();
82  }
83 }
84 //__________________________________________
85 void skipe(int nEvents=1) {
86  if(chain) chain->Skip(nEvents);
87 }
88 
89 //__________________________________________
91 
101 //__________________________________________
102 void ae(int tracks=-1, int hits=-1)
103 {
104  // Advance till next "good" event
105  // One may want to replace the "plain" "if" clause below
106  // with the full-fledged filter
107  static int defaultTracks = 0;
108  static int defaultHits = 3;
109 
110  if (tracks != -1 ) defaultTracks = tracks;
111  else tracks = defaultTracks;
112 
113  if (hits != -1 ) defaultHits = hits;
114  else hits = defaultHits;
115  gEventDisplay->Clear();
116  newevent:
117  chain->MakeEvent();
118  event = (StEvent*)chain->GetDataSet("StEvent");
119  if (event && !event->trackNodes().empty())) {
120  if (tracks) rd(); // Draw the tracks
121  if (hits) rd(hits); // Add the hits to the image
122  } else {
123  printf(" event is empty %p\n", event);
124  goto newevent;
125  }
126  }
128 
134 //__________________________________________
135  void Ed(const char* file =
136  "/star/institutions/bnl/fine/testfiles/st_physics_10169042_raw_4030001.event.root"
137  , unsigned int nEvent=1, const char * detectorNames="TPC")
138  {
139  // Start application open the file provided.
140  if ( gSystem->AccessPathName(file)) {
141  cout << endl << endl
142  << "** Error ** : The input file: <"<< file << "> does not exist !!!"
143  << endl << endl
144  << " Please select the existing one and re-call the function: "
145  << endl
146  << endl << " root [0] Ed(\"new file ROOT file name\")"
147  << endl
148  << endl << "To draw the StEvent components with no detector geometry, use: "
149  << endl
150  << endl << " root [0] Ed(\"new file ROOT file name\",0)"
151  << endl
152  << endl;
153  return;
154  }
155  gROOT->Macro("Load.C");
156  gSystem->Load("StDetectorDbMaker");
157  gROOT->Macro(Form("bfc.C(%d,1,\"doevents\",\"%s\")",nEvent,file));
158  delete gEventDisplay; // destroy the built-in display
159  new StuDraw3DEvent(detectorNames); // create our own one (with no detector geometry)
160 // new StuDraw3DEvent("TPC"); // create our own one (with TPC detector)
161  gEventDisplay->SetBkColor(kBlack);
162  printf("\n The display is ready!\n");
163  printf(" call:\n");
164  printf("\t---\n");
165  printf("\tae()\n");
166  printf("\t---\n");
167  printf("method to see the next event\n");
168  ae();
169  printf(" call:\n");
170  printf("\t---\n");
171  printf("\tae() - to draw the default setting\n");
172  printf("\tae(1,1) - to change the default and draw the tracks and its tpc hits\n");
173  printf("\tae(0,2) - to change the default and draw the Bemc towers\n");
174  printf("\t---\n");
175  printf("method to see the next event\n");
176  }
virtual void Tracks(const StEvent *event, StTrackType type=global)
Add all tracks of the given type from the event to the display list.
virtual void SetBkColor(Color_t newBkColor)
Set the ROOT color as the widget background.
Definition: StDraw3D.cxx:447
void rd(int hits=0, bool clear=false)
This function redraws all hits and/or tracks from the current event.
Definition: Ed.C:69
void ae(int tracks=-1, int hits=-1)
This function is to search for the next non-empty event and draw it by looping over StBFChain (readin...
Definition: Ed.C:102
void Ed(const char *file="/star/institutions/bnl/fine/testfiles/st_physics_10169042_raw_4030001.event.root", unsigned int nEvent=1, const char *detectorNames="TPC")
Main entry point to initialize the primitive &quot;Event Display&quot; and the STAR bfc chain.
Definition: Ed.C:135
virtual void EmcHits(const StEvent *event, const char *det="bemc")
Add all emcHits those can pass the internal filter from the given detector detId type from the event ...
Class StuDraw3DEvent - to draw the 3D StEvent primitives like StTrack, StHit, StVertex decorated with...
virtual void Clear(Option_t *opt="update")
Remove all objects from the list and update the screen if opt is &quot;update&quot;.
Definition: StDraw3D.cxx:398