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 = "StRoot/StTofPool/macros/test.lis",
10  const Char_t *histname = "test.hist.root",
11  const Char_t *ntuplename = "test.ntuple.root");
12 // ------------------ Here is the actual method -----------------------------------------
13 void doMuDstEvents(const Char_t *fileList, const Char_t *histname, const Char_t *ntuplename)
14 {
15  Int_t nEvents = 100;
16  Int_t nfiles = 100;
17 
18  //
19  // First load some shared libraries we need
20  //
21  if (gClassTable->GetID("TTable") < 0) {
22  gSystem->Load("libStar");
23  gSystem->Load("libPhysics");
24  }
25  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
26  loadSharedLibraries();
27  gSystem->Load("StarMagField");
28  gSystem->Load("StMagF");
29  gSystem->Load("StTpcDb");
30 // gSystem->Load("StDbUtilities");
31  gSystem->Load("StDaqLib");
32  gSystem->Load("StDbBroker");
33  gSystem->Load("StDetectorDbMaker");
34  gSystem->Load("StDbUtilities");
35  gSystem->Load("St_db_Maker");
36 
37  gSystem->Load("StEvent");
38  gSystem->Load("StEventMaker");
39  gSystem->Load("StarMagField");
40  gSystem->Load("StTofUtil");
41  gSystem->Load("StTofMaker");
42 
43  gSystem->Load("libtpc_Tables");
44  gSystem->Load("libGeom");
45  gSystem->Load("St_g2t");
46  gSystem->Load("geometry");
47  gSystem->Load("St_geant_Maker");
48 
49  gSystem->Load("StTofrMatchMaker");
50  // gSystem->Load("StTofpMatchMaker");
51  // gSystem->Load("StTofCalibMaker");
52  // gSystem->Load("StTofFlowMaker");
53  gSystem->Load("StTofrNtupleMaker");
54 
55  // Handling depends on whether file is a ROOT file or XDF file
56  //
57  chain = new StChain("StChain");
58 /*
59  StIOMaker* ioMaker = new StIOMaker();
60  ioMaker->SetFile(inname);
61  ioMaker->SetIOMode("r");
62  ioMaker->SetBranch("*",0,"0");
63  ioMaker->SetBranch("eventBranch",0,"r");
64  ioMaker->SetDebug(0);
65 */
66  int NwGeant=5000000, IwType=0, NwPaw=0;
67  St_geant_Maker *geantMk = new St_geant_Maker("geant",NwGeant,NwPaw,IwType);
68  geantMk->LoadGeometry("detp geometry y2008");
69  geantMk->SetActive(kFALSE);
70 
71  StMuDstMaker *muDstMaker = new StMuDstMaker(0,0,"",fileList,"MuDst.root",nfiles);
72 
73  StMuDst2StEventMaker *muDst2StEventMaker = new StMuDst2StEventMaker();
74 
75  cout<<endl<<"============ Data Base ========="<<endl;
76  dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
77 
78  StTofrMatchMaker *matchMaker = new StTofrMatchMaker("tofrMatch");
79  matchMaker->SetDebug(1);
80  matchMaker->SetMode(1);
81  matchMaker->setSaveGeometry(kTRUE);
82  matchMaker->setCreateHistoFlag(kTRUE);
83  matchMaker->setCreateTreeFlag(kFALSE);
84  matchMaker->setHistoFileName(histname);
85  //matchMaker->setNtupleFileName("test2.root");
86  //
87 // StTofCalibMaker *tofCalib = new StTofCalibMaker("tofCalib");
88 // tofCalib->SetDebug(1);
89 
90  StTofrNtupleMaker *tofrNtuple = new StTofrNtupleMaker("tofrNtuple", ntuplename);
91  tofrNtuple->SetDebug(0);
92  tofrNtuple->setInitGeomFromOther(kTRUE);
93 
94  // Initialize chain
95  //
96  Int_t iInit = chain->Init();
97  if (iInit) chain->Fatal(iInit,"on init");
98  chain->PrintInfo();
99  //
100  // Event loop
101  //
102  int istat = 0, i = 1;
103 EventLoop: if (i <= nEvents && istat != 2) {
104 
105  cout << endl << "============================ Event " << i
106  << " start ============================" << endl;
107 
108  chain->Clear();
109  istat = chain->Make(i);
110  if (istat == 2)
111  {cout << "Last event processed. Status = " << istat << endl;}
112  if (istat == 3)
113  {cout << "Error event processed. Status = " << istat << endl;}
114 
115  // gObjectTable->Print();
116  i++;
117  goto EventLoop;
118  }
119 
120  i--;
121  cout<<endl<<"============================ Event "<<i<<" finish ============================"<<endl;
122 
123  //
124  // Chain Finish
125  //
126  if (nEvents > 1) {
127  chain->Finish();
128  }
129 
130 
131 }
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
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.