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 = 3000000;
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("StDbUtilities");
27  gSystem->Load("StDetectorDbMaker");
28  gSystem->Load("StTpcDb");
29  gSystem->Load("StDaqLib");
30  gSystem->Load("StDbBroker");
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  St_geant_Maker *geantMk = new St_geant_Maker();
53  geantMk->LoadGeometry("detp geometry y2010");
54  geantMk->SetActive(kFALSE);
55  //geantMk->SetDebug(1);
56 
57  StMuDstMaker *muDstMaker = new StMuDstMaker(0,0,"",fileList,"MuDst.root",nfiles);
58  //muDstMaker->SetDebug(1);
59 
60  cout<<endl<<"============ Data Base ========="<<endl;
61  dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
62  //dbMk->SetDebug(1);
63 
64  StBTofMatchMaker *matchMaker = new StBTofMatchMaker("btofMatch");
65  //matchMaker->SetDebug(1);
66  matchMaker->setMuDstIn(kTRUE);
68  matchMaker->setAlignFileName("/star/u/huck/TofAlignment19GeV/geomAlign1.txt");
69  //matchMaker->setIdealGeometry(kTRUE);
70  matchMaker->setCalculateAlign(kTRUE);
71 
72  //
73  StBTofNtupleMaker *btofNtuple = new StBTofNtupleMaker("btofNtuple", ntuplename);
74  btofNtuple->SetDebug(0);
75  btofNtuple->setMuDstIn(kTRUE);
76 
77  // Initialize chain
78  //
79  Int_t iInit = chain->Init();
80  if (iInit) chain->Fatal(iInit,"on init");
81  chain->PrintInfo();
82  //
83  // Event loop
84  //
85  int istat = 0, i = 1;
86 EventLoop: if (i <= nEvents && istat != 2) {
87 
88  cout << endl << "============================ Event " << i
89  << " start ============================" << endl;
90 
91  chain->Clear();
92  istat = chain->Make(i);
93  if (istat == 2)
94  {cout << "Last event processed. Status = " << istat << endl;}
95  if (istat == 3)
96  {cout << "Error event processed. Status = " << istat << endl;}
97 
98  // gObjectTable->Print();
99  i++;
100  goto EventLoop;
101  }
102 
103  i--;
104  cout<<endl<<"============================ Event "<<i<<" finish ============================"<<endl;
105 
106  //
107  // Chain Finish
108  //
109  if (nEvents > 1) {
110  chain->Finish();
111  }
112 
113 }
114 
115 
116 
void setAlignFileName(const Char_t *infile="")
input file for alignment parameters
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
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
void setCalculateAlign(const Bool_t calcAlign=kTRUE)
switch for alignment calculation
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.