StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TrsRead.C
1 //
2 // $Id: TrsRead.C,v 1.4 2000/05/09 20:15:43 kathy Exp $
3 //
4 // $Log: TrsRead.C,v $
5 // Revision 1.4 2000/05/09 20:15:43 kathy
6 // transfer obsolete macros to /macros/obsolete; update other macros so that they use standard default inputs plus only few events by default so they'll be easy to run in autoQA macro testing
7 //
8 // Revision 1.3 2000/01/20 18:18:16 calderon
9 // fixed for current TRS in dev. Current DB in dev is ROOT DB, because
10 // Electronics DB from MySQL is not accessible. When it is, just comment out
11 // ROOT DB part and uncomment MySQL DB part.
12 //
13 // Revision 1.2 2000/01/10 21:49:07 kathy
14 // put owner statement in macros
15 //
16 // Revision 1.1 1999/11/09 19:10:47 calderon
17 // Initial Commit
18 // Example macro to read .trs file.
20 // owner: Manuel Calderon
21 //
22 // Description:
23 // Read in a .trs file created with TrsWrite.C
24 //
25 //
27 TBrowser *b = 0;
28 class StChain;
29 StChain *chain=0;
30 void Load(){
31  gSystem->Load("St_base");
32  gSystem->Load("libm");
33  gSystem->Load("StUtilities");
34  gSystem->Load("StChain");
35  gSystem->Load("xdf2root");
36  gSystem->Load("St_Tables");
37  gSystem->Load("StDbLib");
38  gSystem->Load("StDbBroker");
39  gSystem->Load("St_db_Maker");
40  gSystem->Load("StarClassLibrary");
41  gSystem->Load("StTrsMaker");
42 }
43 void TrsRead(const Int_t Nevents=1)
44 {
45  if (gClassTable->GetID("StChain") < 0) Load();
46  chain = new StChain("trs");
47  chain->SetDebug();
48 
49  // Create the makers to be called by the current chain
50  // ROOT Db
51  const char* mainDB = "$STAR/StDb";
52  St_db_Maker *dbMk = new St_db_Maker("db",mainDB);
53  dbMk->SetDebug();
54  chain->SetInput("params","db:StDb/params");
55 
56  const char* calibDB = "$STAR_ROOT/calib";
57  St_db_Maker *calibMk = new St_db_Maker("calib",calibDB);
58  chain->SetInput("calib","calib:calib");
59  calibMk->SetDebug();
60  StTrsMaker *tpc_raw = new StTrsMaker("Trs");
61 
62  // MySQL DB
63 // const char *mainDB = "MySQL:Geometry";
64 // St_db_Maker *dbMk = new St_db_Maker("Geometry",mainDB);
65 // dbMk->SetDebug();
66 // dbMk->Init();
67 // dbMk->GetDataBase("Geometry/tpc");
68 
69 // const char *calibDB = "MySQL:Calib";
70 // St_db_Maker *calibMk = new St_db_Maker("Calib",calibDB);
71 // calibMk->SetDebug();
72 // calibMk->Init();
73 // calibMk->GetDataBase("Calibrations/tpc");
74 // StTpcDbMaker *tpcDbMk = new StTpcDbMaker("tpcDb");
75 // tpcDbMk->Init();
76 // tpcDbMk->Make();
77 // cout << "The Db: " << gStTpcDb << endl;
78 
79  // Tell TRS to read the file.
80  tpc_raw->readFile("test.trs");
81 
82  // Init the main chain and all its makers
83  int iInit = chain->Init();
84  if (iInit) chain->Fatal(iInit,"on init");
85  gBenchmark->Start("trs");
86 
87  for (Int_t i =1; i <= Nevents; i++){
88  if (chain->Make(i)) break;
89 
90  if (i != Nevents) chain->Clear();
91  printf ("===========================================\n");
92  printf ("=========================================== Done with Event no. %d\n",i);
93  printf ("===========================================\n");
94  }
95  if (Nevents > 1) {
96  chain->Finish();
97  gBenchmark->Print("trs");
98  }
99  else b = new TBrowser;
100 
101 }
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