StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
readPrimaries.C
1 {{
2  /* This is an example macro for reading selected branches from the microdst
3  * The aim is to reduce I/O and speed up analysis
4  * More specifically, in this example only primary tracks and
5  * the event information are read
6  * The increase in reading speed is about a factor 2-3 from a simple test
7  */
8  gROOT->Macro("loadMuDst.C");
9 
10  TStopwatch time_all;
11  mudst_mk=new StMuDstMaker(0,0,"/star/data42/reco/production62GeV/ReversedFullField/P04ie/2004/088/","st_physics_5088062_raw_4040003.MuDst.root");
12 
13  mudst_mk->SetStatus("*",0); // First switch off all branches
14  mudst_mk->SetStatus("MuEvent",1); // We need StMuEvent for the chain
15  mudst_mk->SetStatus("PrimaryTracks",1); // Only read primary tracks in addition
16 
17  mudst_mk->Init();
18 
19  TStopwatch time_loop;
20  Int_t n_evt=500;
21  for (Int_t i_evt=0; i_evt<n_evt; i_evt++) {
22  mudst_mk->Make();
23  if (mudst_mk->muDst()==0) {
24  cout << "No event" << endl;
25  continue;
26  }
27  StMuDst *mudst=mudst_mk->muDst();
28  cout << "Event " << mudst->event()->eventId() << ": "
29  << mudst->numberOfPrimaryTracks() << " primary tracks, "
30  << mudst->numberOfGlobalTracks() << " global tracks" << endl;
31  }
32  time_loop.Stop();
33  time_all.Stop();
34  cout << "Total time "; time_all.Print();
35  cout << "loop "; time_loop.Print();
36 }}
StMuDstMaker(const char *name="MuDst")
Default constructor.
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320