StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
doMuDstEvents.C
1 #include "iostream.h"
2 
3 class StChain;
4 StChain *chain=0;
5 class St_db_Maker;
6 St_db_Maker *dbMk =0;
7 
8 Int_t iEvt=0,istat=0,nEvents=0;
9 void doMuDstEvents(const Char_t *fileList = "test.lis",
10  const Char_t *ntuplename = "test.ntuple.root")
11 {
12  Int_t nEvents = 100; //1000000;
13  Int_t nfiles = 1000;
14 
15  //
16  // First load some shared libraries we need
17  //
18  if (gClassTable->GetID("TTable") < 0) {
19  gSystem->Load("libStar");
20  gSystem->Load("libPhysics");
21  }
22  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
23  loadSharedLibraries();
24  gSystem->Load("StarMagField");
25  gSystem->Load("StMagF");
26  gSystem->Load("StTpcDb");
27 // gSystem->Load("StDbUtilities");
28  gSystem->Load("StDaqLib");
29  gSystem->Load("StDbBroker");
30  gSystem->Load("StDetectorDbMaker");
31  gSystem->Load("StDbUtilities");
32  gSystem->Load("St_db_Maker");
33 
34  gSystem->Load("StEvent");
35  gSystem->Load("StEventMaker");
36  gSystem->Load("StarMagField");
37 
38  gSystem->Load("libtpc_Tables");
39  gSystem->Load("libGeom");
40  gSystem->Load("St_g2t");
41  gSystem->Load("geometry");
42  gSystem->Load("St_geant_Maker");
43 
44  gSystem->Load("StBTofUtil");
45  gSystem->Load("StBTofMatchMaker");
46  gSystem->Load("StBTofNtupleMaker");
47 
48  // Handling depends on whether file is a ROOT file or XDF file
49  //
50  chain = new StChain("StChain");
51 
52 //----------------------------------------------------------------
53 // If you want to run matchMaker, include geant maker here
54 //----------------------------------------------------------------
55  St_geant_Maker *geantMk = new St_geant_Maker();
56  geantMk->LoadGeometry("detp geometry y2010");
57  geantMk->SetActive(kFALSE);
58 
59  StMuDstMaker *muDstMaker = new StMuDstMaker(0,0,"",fileList,"MuDst.root",nfiles);
60 
61  cout<<endl<<"============ Data Base ========="<<endl;
62  dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
63 
64 //----------------------------------------------------------------
65 // If you want to run matchMaker, here is an example
66 //----------------------------------------------------------------
67  StBTofMatchMaker *matchMaker = new StBTofMatchMaker("btofMatch");
68  matchMaker->setMuDstIn(kTRUE);
69  // matchMaker->SetDebug(0);
70  // matchMaker->SetMode(1);
71  // matchMaker->setMinHitsPerTrack(23);
72  // matchMaker->setSaveGeometry(kTRUE);
73  // matchMaker->setCreateHistoFlag(kTRUE);
74  // matchMaker->setCreateTreeFlag(kFALSE);
75  // matchMaker->setHistoFileName(histname);
76  // matchMaker->doPrintMemoryInfo = kTRUE;
77  // matchMaker->doPrintCpuInfo = kTRUE;
78  // matchMaker->setNtupleFileName("test2.root");
79 
80  //
81  StBTofNtupleMaker *btofNtuple = new StBTofNtupleMaker("btofNtuple", ntuplename);
82  btofNtuple->SetDebug(1);
83  btofNtuple->setMuDstIn(kTRUE);
84  btofNtuple->setUseEventVertex(kTRUE);
85 
86  // Initialize chain
87  //
88  Int_t iInit = chain->Init();
89  if (iInit) chain->Fatal(iInit,"on init");
90  chain->PrintInfo();
91  //
92  // Event loop
93  //
94  int istat = 0, i = 1;
95 EventLoop: if (i <= nEvents && istat != 2) {
96 
97  cout << endl << "============================ Event " << i
98  << " start ============================" << endl;
99 
100  chain->Clear();
101  istat = chain->Make(i);
102  if (istat == 2)
103  {cout << "Last event processed. Status = " << istat << endl;}
104  if (istat == 3)
105  {cout << "Error event processed. Status = " << istat << endl;}
106 
107  // gObjectTable->Print();
108  i++;
109  goto EventLoop;
110  }
111 
112  i--;
113  cout<<endl<<"============================ Event "<<i<<" finish ============================"<<endl;
114 
115  //
116  // Chain Finish
117  //
118  if (nEvents > 1) {
119  chain->Finish();
120  }
121 
122 }
123 
124 
125 
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void setUseEventVertex(const Bool_t val=kTRUE)
switch to turn on the use of event vertex for dca
void setMuDstIn(Bool_t muDstIn=kTRUE)
switch to read in StEvent/MuDst
virtual Int_t Finish()
Definition: StChain.cxx:85
Barrel TOF Match Maker.
void setMuDstIn(const Bool_t muDstIn=kTRUE)
switch to read in StEvent/MuDst
virtual Int_t Make()
Definition: StChain.cxx:110
virtual void SetActive(Bool_t k=kTRUE)
Setters for flags and switches.
Definition: StMaker.h:208
virtual void LoadGeometry(const Char_t *option="detp geometry field_only")
Specifies GEANT3 geometry command.