StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunTriggerStudyMaker.C
1 #include <vector>
2 using namespace std;
3 class StChain;
4 StChain *chain;
5 int total=0;
6 
7 void RunTriggerStudyMaker(int nevents=10,
8  const char* file = "test.list",
9  const char* outfile = "triggerstudy.root",
10  //const char* file="st_physics_7156024_raw_1010001.MuDst.root",
11  const char* dir = "./",
12  const char *filter = "",
13  const char* outPath = "./")
14 {
15  cout <<"MuDst chain file:\t"<<file<<endl;
16  //abort();
17  gROOT->Macro("LoadLogger.C");
18  gROOT->Macro("loadMuDst.C");
19  gSystem->Load("StDaqLib");
20  gSystem->Load("StDbBroker");
21  gSystem->Load("StDetectorDbMaker");
22  gSystem->Load("St_db_Maker");
23  gSystem->Load("StEEmcUtil");
24  gSystem->Load("StEEmcDbMaker");
25  gSystem->Load("StTriggerFilterMaker");
26  gSystem->Load("StEmcRawMaker");
27  gSystem->Load("StEmcADCtoEMaker");
28  gSystem->Load("StTriggerUtilities");
29  gSystem->Load("StTriggerStudyMaker");
30 
31 
32  double pi = atan(1.0)*4.0;
33  cout << " loading done " << endl;
34 
35  chain= new StChain("StChain");
36  chain->SetDebug(1);
37 
38 
39 
40  //Instantiate the MuDstReader
42  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,dir,file,filter,1000000,"MuDst");
43 
44  //Database
45  St_db_Maker *dbMk = new St_db_Maker("StarDb", "MySQL:StarDb");
46  StEEmcDbMaker* eemcb = new StEEmcDbMaker("eemcDb");
47 
48  //Block for TriggerSimuMaker
49 
51 
52  StTriggerSimuMaker* trigsim = new StTriggerSimuMaker();
53  trigsim->useBbc();
54  trigsim->useBemc();
55  trigsim->bemc->setConfig(StBemcTriggerSimu::kOffline);
57  assert(simL2Mk);
58  simL2Mk->setSetupPath("/afs/rhic.bnl.gov/star/users/kocolosk/public/StarTrigSimuSetup/");
59  simL2Mk->setOutPath(outPath);
60  trigsim->useL2(simL2Mk);
61 
62  StTriggerStudyMaker* trigstudy = new StTriggerStudyMaker(outfile);
63 
64  //end TriggerSimuMaker block
65 
66  chain->Init();
67 
68  chain->PrintInfo();
69 
70  for (Int_t iev=0;iev<nevents; iev++) {
71  /*
72  cout << "****************************************** " << endl;
73  cout << "Working on eventNumber " << iev << endl;
74  cout << "*************************1***************** " << endl;
75  */
76  chain->Clear();
77  int iret = chain->Make(iev);
78  total++;
79 
80  if (iret && iret!=kStSkip) {
81  cout << "Bad return code!" <<iret<< endl;
82  break;
83  }
84 
85  //Here's where you can do your analysis, for an example look in this method
86  }
87  chain->Finish();
88  cout << "****************************************** " << endl;
89  cout << "total number of events " << total << endl;
90  cout << "****************************************** " << endl;
91 
92 
93 }
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
static void setLevel(unsigned int level)
sets the debug level
Definition: StMuDebug.h:74
virtual Int_t Finish()
Definition: StChain.cxx:85
Definition: Stypes.h:49
virtual Int_t Make()
Definition: StChain.cxx:110