StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DoMatch.C
1 //******************************************************************************
2 
3 class StChain;
4 StChain *chain=0;
5 
6 void DoMatch(Int_t nevents=110){
7  // char *fname="/star/data16/reco/dAuMinBias/FullField/P03ia/2003/026/st_physics_4026006_raw_0040*.event.root";
8  char *fname="/star/data22/MC/balewski/dAu_MC/rcf1197_95_5899evts-a*.event.root";
9  TString miniF="dAu1K.eeTree";
10 
11  //
12  // First load some shared libraries we need
13  //
14  gSystem->Load("St_base");
15  gSystem->Load("StChain");
16  gSystem->Load("libglobal_Tables");
17  gSystem->Load("libsim_Tables");
18  gSystem->Load("libgen_Tables");
19  gSystem->Load("St_Tables");
20  gSystem->Load("StDbLib");
21  gSystem->Load("StDbBroker");
22  gSystem->Load("St_db_Maker");
23  gSystem->Load("StUtilities");
24  gSystem->Load("StIOMaker");
25  gSystem->Load("StMagF");
26  gSystem->Load("StarClassLibrary");
27  gSystem->Load("StAnalysisUtilities");
28  gSystem->Load("StEvent");
29  gSystem->Load("StTpcDb");
30  gSystem->Load("StEventMaker");
31  gSystem->Load("StMcEvent");
32  gSystem->Load("StMcEventMaker");
33  gSystem->Load("libgeometry_Tables");
34  gSystem->Load("StEmcUtil");
35 
36 
37  // Load my makers
38  gSystem->Load("StEEmcUtil");
39 
40  // Now we add Makers to the chain...
41 
42  TFile *f = new TFile(miniF+".root");
43  assert(f->IsOpen());
44  TTree *t4 = (TTree*)f->Get("EEtree");
45  assert(t4);
46  // create a pointer to an event object. This will be used
47  // to read the branch values.
48  EEeventDst *event = new EEeventDst();
49 
50  //if (gROOT->IsBatch()) return; new TBrowser(); t4->StartViewer(); return;
51  TBranch *br = t4->GetBranch("EEdst");
52  br->SetAddress(&event);
53  Int_t nevent = (Int_t)t4->GetEntries();
54 
55  printf("\n\n XXXXXXXXXXXXXXXXXXXXXXXXXX eeTree - events XXXXXXXXXX\n");
56 
57  for (Int_t ie=0;ie<nevent;ie++) {
58  if(ie>=nevents) break;
59  //read this branch only
60  br->GetEntry(ie);
61  // event->print();
62  printf("\niEve=%d ---------- ID=%d token=%d timeSTamp=%d\n",ie,event->ID,event->token,event->timeStamp);
63 
64  }
65  printf("XXXXXXXXXXXXXXXXXXXXXXXXXX eeTree - done XXXXXXXXXX\n\n");
66  // create chain
67  chain = new StChain("bfc");
68  //chain->SetDebug();
69  StIOMaker* ioMaker = new StIOMaker();
70  ioMaker->SetFile(fname);
71 
72  ioMaker->SetIOMode("r");
73  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
74  ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch
75  ioMaker->SetBranch("eventBranch",0,"r"); //activate Event Branch
76  ioMaker->SetIOMode("r");
77 
78  St_db_Maker *dbMk = new St_db_Maker("StarDb","MySQL:StarDb");
79 
80  chain->PrintInfo();
81  chain->ls(3);
82  Int_t initStat = chain->Init(); // This should call the Init() method in ALL makers
83  if (initStat) chain->Fatal(initStat, "during Init()");
84 
85  int istat=0,iev=1;
86 
87  printf(" XXXXXXXXXXXXXXXXXXXXXXXXXX StEvent - events XXXXXXXXXX\n");
88  // Do the event loop
89  EventLoop:
90  if (iev<=nevents && istat!=2)
91  {
92  chain->Clear();
93  cout << "---------------------- Processing Event : " << iev << " ----------------------" << endl;
94  istat = chain->Make(iev); // This should call the Make() method in ALL makers
95  StEvent *stEvent= (StEvent *) chain->GetInputDS("StEvent");
96  printf("StEvent time=%d, ID=%d, runID=%d\n",(int)stEvent->time(),(int)stEvent->id(),(int)stEvent->runId());
97 
98  StEvtHddr* fEvtHddr = (StEvtHddr*)chain->GetDataSet("EvtHddr");
99  printf("EvtHddr actual event time stamp= %d, yyyy/mm/dd=%d hh/mm/ss=%d\n",
100  (int)fEvtHddr->GetUTime(),fEvtHddr->GetDate(),fEvtHddr->GetTime());
101  StL0Trigger* L0=(StL0Trigger*)stEvent->l0Trigger();
102 
103  StTriggerId* trg=(StTriggerId*) stEvent->triggerIdCollection()->nominal();
104 
105  //printf("L0 token=%d trig: is(2003)=%d nominal=%d version=%d\n",L0->triggerToken(),trg->isTrigger(2003),trg->version(2003));
106 
107  if (istat == 2) { cout << "Last Event Processed. Status = " << istat << endl; }
108  if (istat == 3) { cout << "Error Event Processed. Status = " << istat << endl; }
109  iev++;
110  goto EventLoop;
111  } // Event Loop
112  chain->Finish();
113 
114 
115 }
116 //******************************************************************************
117 
118 
119 
120 
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
virtual Int_t Make()
Definition: StChain.cxx:110