StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
makePicoDst.C
1 
2 //
3 // Example:
4 // makePicoDst.C("st_zerobias_adc_14117015_raw_7770001.MuDst.root")
5 //
6 
7 
8 class StMaker;
9 class StChain;
10 class StPicoDstMaker;
11 class StMuDstMaker;
12 
13 
14 void loadLibs()
15 {
16  gSystem->Load("libTable");
17  gSystem->Load("libPhysics");
18  gSystem->Load("St_base");
19  gSystem->Load("StChain");
20  gSystem->Load("St_Tables");
21  gSystem->Load("StUtilities"); // new addition 22jul99
22  gSystem->Load("StTreeMaker");
23  gSystem->Load("StIOMaker");
24  gSystem->Load("StarClassLibrary");
25  gSystem->Load("StTriggerDataMaker"); // new starting from April 2003
26  gSystem->Load("StBichsel");
27  gSystem->Load("StEvent");
28  gSystem->Load("StTpcDb");
29  gSystem->Load("StEventUtilities");
30  gSystem->Load("StDbLib");
31  gSystem->Load("StEmcUtil");
32  gSystem->Load("StTofUtil");
33  gSystem->Load("StPmdUtil");
34  gSystem->Load("StPreEclMaker");
35  gSystem->Load("StStrangeMuDstMaker");
36  gSystem->Load("StMuDSTMaker");
37  gSystem->Load("libStarAgmlUtil");
38 
39  gSystem->Load("StMcEvent");
40  gSystem->Load("StMcEventMaker");
41  gSystem->Load("StDaqLib");
42  gSystem->Load("libgen_Tables");
43  gSystem->Load("libsim_Tables");
44  gSystem->Load("libglobal_Tables");
45  gSystem->Load("StEmcTriggerMaker");
46  gSystem->Load("StEmcRawMaker");
47  gSystem->Load("StEmcADCtoEMaker");
48  gSystem->Load("StPreEclMaker");
49  gSystem->Load("StEpcMaker");
50  gSystem->Load("StEmcSimulatorMaker");
51  gSystem->Load("StDbBroker");
52  gSystem->Load("StDetectorDbMaker");
53  gSystem->Load("StDbUtilities");
54  gSystem->Load("StEEmcUtil");
55  gSystem->Load("StEEmcDbMaker");
56  gSystem->Load("St_db_Maker");
57  gSystem->Load("StTriggerUtilities");
58 
59  gSystem->Load("StMagF");
60  gSystem->Load("StMtdUtil");
61  gSystem->Load("StMtdMatchMaker");
62  gSystem->Load("StMtdCalibMaker");
63 
64  gSystem->Load("libStPicoEvent");
65  gSystem->Load("libStPicoDstMaker");
66 
67  gSystem->ListLibraries();
68 }
69 
70 
71 void loadAgML( const char* name=0 )
72 {
73  gROOT->LoadMacro("bfc.C");
74  bfc(0,"agml nodefault mysql");
75 
76  AgModule::SetStacker( new StarTGeoStacker() );
77 
78  if (name) StarGeometry::Construct(name);
79 }
80 
81 
82 void makePicoDst(const Char_t *inputFile, int nEvents = 100000)
83 {
84  loadLibs();
85 
86  StChain* chain = new StChain();
87 
88  StMuDstMaker* MuDstMaker = new StMuDstMaker(0, 0, "", inputFile, "MuDst", 100);
89  MuDstMaker->SetStatus("*", 0);
90  MuDstMaker->SetStatus("MuEvent", 1);
91  MuDstMaker->SetStatus("PrimaryVertices", 1);
92  MuDstMaker->SetStatus("PrimaryTracks", 1);
93  MuDstMaker->SetStatus("GlobalTracks", 1);
94  MuDstMaker->SetStatus("CovGlobTrack", 1);
95  MuDstMaker->SetStatus("BTof*", 1);
96  MuDstMaker->SetStatus("Emc*", 1);
97  MuDstMaker->SetStatus("MTD*", 1);
98 
99  St_db_Maker* dbMk = new St_db_Maker("db", "MySQL:StarDb", "$STAR/StarDb", "StarDb");
100 
101  // Endcap database
102  StEEmcDbMaker* eemcDb = new StEEmcDbMaker;
103 
104  StEmcADCtoEMaker* adc2e = new StEmcADCtoEMaker();
105  adc2e->setPrint(false);
106  adc2e->saveAllStEvent(true);
107 
108  StPreEclMaker* pre_ecl = new StPreEclMaker();
109  pre_ecl->setPrint(kFALSE);
110  StEpcMaker* epc = new StEpcMaker();
111  epc->setPrint(kFALSE);
112 
113  // Trigger simulator
114  StTriggerSimuMaker* trigSimu = new StTriggerSimuMaker;
115  trigSimu->setMC(false);
116  trigSimu->useBemc();
117  trigSimu->useEemc();
118  trigSimu->useOfflineDB();
119  trigSimu->bemc->setConfig(StBemcTriggerSimu::kOffline);
120 
121  StMagFMaker* magfMk = new StMagFMaker;
122  StMtdMatchMaker* mtdMatchMaker = new StMtdMatchMaker();
123  StMtdCalibMaker* mtdCalibMaker = new StMtdCalibMaker("mtdcalib");
124 
125  StPicoDstMaker* picoMaker = new StPicoDstMaker(StPicoDstMaker::IoWrite, inputFile, "picoDst");
126  picoMaker->setVtxMode((int)(StPicoDstMaker::PicoVtxMode::Default));
127 
128  chain->Init();
129  cout << "chain->Init();" << endl;
130 
131  loadAgML("y2017");
132 
133  int total = 0;
134  for (Int_t i = 0; i < nEvents; i++)
135  {
136  if (i % 100 == 0)
137  cout << "Working on eventNumber " << i << endl;
138 
139  chain->Clear();
140  int iret = chain->Make(i);
141 
142  if (iret)
143  {
144  cout << "Bad return code!" << iret << endl;
145  break;
146  }
147 
148  total++;
149  }
150 
151  cout << "****************************************** " << endl;
152  cout << "Work done... now its time to close up shop!" << endl;
153  cout << "****************************************** " << endl;
154  chain->Finish();
155  cout << "****************************************** " << endl;
156  cout << "total number of events " << total << endl;
157  cout << "****************************************** " << endl;
158 
159  delete chain;
160 }
Class that converts MuDst into PicoDst.
StMuDstMaker(const char *name="MuDst")
Default constructor.
void setPrint(Bool_t)
Obsolete function; users can control messages with logger config file.
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void setPrint(Bool_t a)
Obsolete function; users can control messages with logger config file.
Definition: StPreEclMaker.h:36
virtual Int_t Finish()
Definition: StChain.cxx:85
void setVtxMode(const PicoVtxMode vtxMode)
Set vertex selection mode.
Muon Telescope Detector (MTD) Match Maker.
virtual Int_t Make()
Definition: StChain.cxx:110
void setPrint(Bool_t a)
Obsolete function; users can control messages with logger config file.
Definition: StEpcMaker.h:89
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
Definition: StMuDstMaker.h:426
void SetStatus(const char *arrType, int status)
void saveAllStEvent(Bool_t a)
Set to kTRUE if all hits are to be saved on StEvent.