27 #if !defined(__CINT__) || defined(__MAKECINT__)
36 #include "TClonesArray.h"
40 #include "TObjArray.h"
42 #include "StChain/StChain.h"
43 #include "St_db_Maker/St_db_Maker.h"
44 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
45 #include "StGenericVertexMaker/StGenericVertexMaker.h"
52 gROOT->Macro(
"$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
53 gSystem->Load(
"libMinuit");
54 gSystem->Load(
"StDbBroker");
55 gSystem->Load(
"St_db_Maker");
57 gSystem->Load(
"StEEmcUtil");
58 gSystem->Load(
"StBTofUtil");
59 gSystem->Load(
"StGenericVertexMaker");
62 int VtxRecoMuDst(
unsigned int nEventsUser,
char* inputFileName,
char* outputFileName,
const char* options=
"")
68 StMuDstMaker muDstMaker(0, 0,
"", inputFileName,
"st:MuDst.root", 1e9);
78 muDstMaker.
SetStatus(
"PrimaryVertices",0);
81 TChain& muDstChain = *muDstMaker.
chain();
82 unsigned int nEntries = muDstChain.GetEntries();
83 unsigned int nEventsToRead = nEventsUser > 0 ? min(nEventsUser, nEntries) : nEntries;
84 cout << nEntries <<
" events in chain, " << nEventsToRead <<
" will be read." << endl;
87 TClonesArray* verticesRefitted =
new TClonesArray(
"StMuPrimaryVertex", 1000);
88 TFile* outFile =
new TFile(outputFileName,
"RECREATE");
89 TTree* muDstTreeOut = muDstChain.CloneTree(0);
90 muDstTreeOut->Branch(
"PrimaryVertices", &verticesRefitted, 65536, 99);
95 vertexMaker->ToWhiteConst(
"vtxArray",verticesRefitted);
96 vertexMaker->SetAttr(
"useMuDst",1);
99 TString Options = options;
100 TString optDelim =
" ,";
101 TObjArray* tokens = Options.Tokenize(optDelim);
102 for (
int tk=0; tk < tokens->GetEntries(); tk++) {
103 TString& tok = ((TObjString*) (tokens->At(tk)))->String();
104 Ssiz_t delim = tok.First(
':');
106 vertexMaker->SetAttr(tok.Data(),1);
108 TString key(tok(0,delim));
109 TString& val = tok.Remove(0,delim+1);
110 if (val.IsDigit()) { vertexMaker->SetAttr(key.Data(),val.Atoi()); }
111 else if (val.IsFloat()) { vertexMaker->SetAttr(key.Data(),val.Atof()); }
112 else { vertexMaker->SetAttr(key.Data(),val.Data()); }
115 vertexMaker->PrintAttr();
120 for (
unsigned int iEvent = 0; iEvent < nEventsToRead; iEvent++)
122 if ( fullChain.Make() )
break;
123 muDstTreeOut->Fill();
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
void SetStatus(const char *arrType, int status)