StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bemcCalibMacro.C
1 // use this macro first to create trees from MuDsts
2 
3 void bemcCalibMacro(const char* name = "test.root",
4  const char* filelist = "test.list",
5  int nFiles = 8,
6  int nEvents = 1e3)
7 {
8  gROOT->Macro("LoadLogger.C");
9  gROOT->Macro("loadMuDst.C");
10  gSystem->Load("StarMagField.so");
11  gSystem->Load("StMagF");
12  gSystem->Load("StDetectorDbMaker");
13  gSystem->Load("StTpcDb");
14  gSystem->Load("St_db_Maker");
15  gSystem->Load("StDbUtilities");
16  gSystem->Load("StMcEvent");
17  gSystem->Load("StMcEventMaker");
18  gSystem->Load("StDaqLib");
19  gSystem->Load("StEmcRawMaker");
20  gSystem->Load("StEmcADCtoEMaker");
21  gSystem->Load("StEpcMaker");
22  gSystem->Load("StTriggerUtilities");
23  gSystem->Load("StDbBroker");
24  gSystem->Load("libgeometry_Tables");
25  gSystem->Load("StEEmcUtil");
26  gSystem->Load("StEEmcDbMaker");
27  gSystem->Load("StEmcOfflineCalibrationMaker");
28 
29  StChain* chain = new StChain("StChain");
30 
31  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",filelist,"",nFiles);
32  St_db_Maker *dbMaker = new St_db_Maker("StarDb","MySQL:StarDb");
33  StEEmcDbMaker* eemcb = new StEEmcDbMaker("eemcDb");
35 
36  //get control table so we can turn off BPRS zero-suppression and save hits from "bad" caps
37  controlADCtoE_st* control_table = adc->getControlTable();
38  control_table->CutOff[1] = -1;
39  control_table->CutOffType[1] = 0;
40  control_table->DeductPedestal[1] = 2;
41  adc->saveAllStEvent(kTRUE);
42 
43  StTriggerSimuMaker* trigsim = new StTriggerSimuMaker();
44  trigsim->useBemc();
45  trigsim->useEemc();
46  trigsim->useOnlineDB();
47  trigsim->bemc->setConfig(StBemcTriggerSimu::kOffline);
48 
49  TString outfile(name);
50  StEmcOfflineCalibrationMaker* bemcCalibMaker = new StEmcOfflineCalibrationMaker("bemcCalibMaker",outfile.Data());
51 
52  //2012 200 GeV triggers
53  //high tower
54  bemcCalibMaker->addHighTowerTrigger(370501); //BHT0*VPD
55  bemcCalibMaker->addHighTowerTrigger(370511); //BHT1*VPD
56  bemcCalibMaker->addHighTowerTrigger(370531); //BHT2
57  bemcCalibMaker->addHighTowerTrigger(370521); //BHT2*BBCMB
58  bemcCalibMaker->addHighTowerTrigger(370522); //BHT2*BBCMB
59 
60  StMemStat memory;
61  memory.PrintMem(NULL);
62 
63  chain->Init();
64  cout<<"chain initialized"<<endl;
65 
66  TStopwatch total;
67  TStopwatch timer;
68 
69  int i=0;
70  while(i<nEvents && chain->Make()==kStOk)
71  {
72  if(i % 500 == 0){
73  cout<<"done with event "<<i;
74  cout<<"\tcpu: "<<timer.CpuTime()<<"\treal: "<<timer.RealTime()<<"\tratio: "<<timer.CpuTime()/timer.RealTime();//<<endl;
75  timer.Start();
76  memory.PrintMem(NULL);
77  }
78  i++;
79  chain->Clear();
80  }
81 
82  chain->ls(3);
83  chain->Finish();
84  printf("my macro processed %i events in %s",i,name);
85  cout<<"\tcpu: "<<total.CpuTime()<<"\treal: "<<total.RealTime()<<"\tratio: "<<total.CpuTime()/total.RealTime()<<endl;
86 
87  cout << endl;
88  cout << "-------------" << endl;
89  cout << "(-: Done :-) " << endl;
90  cout << "-------------" << endl;
91  cout << endl;
92 }
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
static void PrintMem(std::string prefix="")
Definition: StMemStat.cxx:212
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
void useOnlineDB()
Choose DB to access trigger definitions and thresholds.
controlADCtoE_st * getControlTable()
Return Control table (NULL)
void saveAllStEvent(Bool_t a)
Set to kTRUE if all hits are to be saved on StEvent.
Definition: Stypes.h:41