StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunFmsTrigOverSimu.C
1 //
2 // Pibero Djawotho <pibero@tamu.edu>
3 // Texas A&M
4 // 14 July 2012
5 //
6 // Macro to run FMS trigger simulator
7 //
8 
9 void RunFmsTrigOverSimu(int nevents = 1000, const char* mudstfile = "test.MuDst.root", const char* geantfile = "test.geant.root")
10 {
11  // Load shared libraries
12  gROOT->Macro("loadMuDst.C");
13  gROOT->Macro("LoadLogger.C");
14  gSystem->Load("StDbBroker");
15  gSystem->Load("St_db_Maker");
16  gSystem->Load("StFmsDbMaker");
17  gSystem->Load("StMcEvent");
18  gSystem->Load("StMcEventMaker");
19  gSystem->Load("StEEmcUtil");
20  gSystem->Load("StFmsSimulatorMaker");
21  gSystem->Load("StFmsTriggerMaker");
22 
23  // Create chain
24  StChain* chain = new StChain;
25 
26  // Instantiate MuDst maker
27  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",mudstfile,".",1000,"MuDst");
28 
29  // STAR database
30  St_db_Maker* stardb = new St_db_Maker("StarDb","MySQL:StarDb","$STAR/StarDb");
31  stardb->SetDateTime(20110417,193427);
32 
33  // FMS database
34  StFmsDbMaker* fmsdb = new StFmsDbMaker;
35 
36  // GEANT reader
37  StIOMaker* ioMaker = new StIOMaker;
38  ioMaker->SetFile(geantfile);
39  ioMaker->SetIOMode("r");
40  ioMaker->SetBranch("*",0,"0"); // Deactivate all branches
41  ioMaker->SetBranch("geantBranch",0,"r"); // Activate geant branch
42 
43  // Monte Carlo event maker
44  StMcEventMaker* mcEventMaker = new StMcEventMaker;
45  mcEventMaker->doPrintEventInfo = false;
46  mcEventMaker->doPrintMemoryInfo = false;
47 
48  // FMS hits simulator
50 
51  // FMS trigger simulator
52  StFmsTriggerMaker* fmstrig = new StFmsTriggerMaker;
53  fmstrig->useStEvent();
54 
55  // Initialize chain
56  chain->Init();
57 
58  // Event loop
59  for (int iEvent = 1; iEvent <= nevents; ++iEvent) {
60  chain->Clear();
61  int status = chain->Make(iEvent);
62  if (status == kStSkip) continue;
63  if (status % 10 == kStEOF || status % 10 == kStFatal) break;
64 
65  // Test FMS dijet trigger
66  if (fmstrig->FmsDijet()) {
67  printf("Run=%d Event=%d - Got FMS dijet trigger\n",chain->GetRunNumber(),chain->GetEventNumber());
68  }
69  } // Event loop
70 }
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
Filling of all StMcEvent classes from g2t tables Transform all the data in the g2t tables into the co...
Definition: Stypes.h:49
Bool_t doPrintMemoryInfo
lots of screen output
Definition: Stypes.h:43
virtual Int_t Make()
Definition: StChain.cxx:110
virtual Int_t GetRunNumber() const
Returns the current RunNumber.
Definition: StMaker.cxx:1054