StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TrsWrite.C
1 //
2 // $Id: TrsWrite.C,v 1.6 2006/08/15 21:43:06 jeromel Exp $
3 //
4 // $Log: TrsWrite.C,v $
5 // Revision 1.6 2006/08/15 21:43:06 jeromel
6 // Fix rhic -> rhic.bnl.gov
7 //
8 // Revision 1.5 2000/01/25 16:06:37 fisyak
9 // g2r -> g2t
10 //
11 // Revision 1.4 2000/01/20 18:18:16 calderon
12 // fixed for current TRS in dev. Current DB in dev is ROOT DB, because
13 // Electronics DB from MySQL is not accessible. When it is, just comment out
14 // ROOT DB part and uncomment MySQL DB part.
15 //
16 // Revision 1.3 2000/01/10 21:49:07 kathy
17 // put owner statement in macros
18 //
19 // Revision 1.2 1999/11/16 22:31:02 calderon
20 // Version using ROOT Database (Hopefully soon we'll switch to
21 // the TPC Db).
22 //
23 // Revision 1.1 1999/11/09 19:12:04 calderon
24 // Initial Commit.
25 // Example to write a .trs file from a muon processed through TRS.
27 //
28 // owner: Manuel Calderon
29 //
30 // Description:
31 // Write a .trs file from a muon track.
32 //
34 TBrowser *b = 0;
35 class StChain;
36 StChain *chain=0;
37 class St_geant_Maker;
38 St_geant_Maker *geant=0;
39 void Load(){
40  gSystem->Load("St_base");
41  gSystem->Load("libm");
42  gSystem->Load("StUtilities");
43  gSystem->Load("StChain");
44  gSystem->Load("xdf2root");
45  gSystem->Load("St_Tables");
46  gSystem->Load("StDbLib");
47  gSystem->Load("StDbBroker");
48  gSystem->Load("St_db_Maker");
49  gSystem->Load("StarClassLibrary");
50  gSystem->Load("geometry");
51  gSystem->Load("St_g2t");
52  gSystem->Load("St_geant_Maker");
53  gSystem->Load("StTrsMaker");
54 }
55 void TrsWrite(const Int_t Nevents=1)
56 {
57  if (gClassTable->GetID("StChain") < 0) Load();
58  chain = new StChain("trs");
59  chain->SetDebug();
60  chain->SetInput("EvtHddr",".make/geant/.const/EvtHddr");
61 
62  // Create the makers to be called by the current chain
63 
64  // ROOT Db
65  const char* mainDB = "$STAR/StDb";
66  St_db_Maker *dbMk = new St_db_Maker("db",mainDB);
67  dbMk->SetDebug();
68  chain->SetInput("params","db:StDb/params");
69 
70  const char* calibDB = "$STAR_ROOT/calib";
71  St_db_Maker *calibMk = new St_db_Maker("calib",calibDB);
72  chain->SetInput("calib","calib:calib");
73  calibMk->SetDebug();
74 
75  // MySQL DB
76 // const char *mainDB = "MySQL:Geometry";
77 // St_db_Maker *dbMk = new St_db_Maker("Geometry",mainDB);
78 // dbMk->SetDebug();
79 // dbMk->Init();
80 // dbMk->GetDataBase("Geometry/tpc");
81 
82 // const char *calibDB = "MySQL:Calib";
83 // St_db_Maker *calibMk = new St_db_Maker("Calib",calibDB);
84 // calibMk->SetDebug();
85 // calibMk->Init();
86 // calibMk->GetDataBase("Calibrations/tpc");
87 // StTpcDbMaker *tpcDbMk = new StTpcDbMaker("tpcDb");
88 // tpcDbMk->Init();
89 // tpcDbMk->Make();
90 // cout << "The Db: " << gStTpcDb << endl;
91 
92  // Geant
93  geant = new St_geant_Maker("geant");
94  geant->SetNwGEANT(10 000 000);
95  geant->SetDebug();
96  geant->SetIwtype(1);
97  TString InFile("/afs/rhic.bnl.gov/star/tpc/trstest/trs_muon_10cmdrift_good.fzd");
98  geant->SetInputFile(InFile.Data());
99  chain->SetInput("geom","geant:geom");
100 
101  // TRS
102  StTrsMaker *tpc_raw = new StTrsMaker("Trs");
103  tpc_raw->writeFile("test.trs",Nevents);
104 
105  // Init the main chain and all its makers
106  int iInit = chain->Init();
107 
108  if (iInit) chain->Fatal(iInit,"on init");
109  gBenchmark->Start("trs");
110 
111  for (Int_t i =1; i <= Nevents; i++){
112  if (chain->Make(i)) break;
113  if (i != Nevents) chain->Clear();
114  printf ("===========================================\n");
115  printf ("=========================================== Done with Event no. %d\n",i);
116  printf ("===========================================\n");
117  }
118  if (Nevents > 1) {
119  chain->Finish();
120  gBenchmark->Print("trs");
121  }
122  else b = new TBrowser;
123 }
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