36 void genDst(
unsigned int Last,
41 void genDst(
unsigned int First,
49 gROOT->Macro(
"$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
50 gSystem->Load(
"StDbBroker");
51 gSystem->Load(
"St_db_Maker");
52 gSystem->Load(
"StEEmcUtil");
57 gSystem->Load(
"libMinuit");
59 gSystem->Load(
"StBTofUtil");
60 gSystem->Load(
"StGenericVertexMaker");
67 gSystem->Load(
"StEmcRawMaker");
68 gSystem->Load(
"StEmcADCtoEMaker");
69 gSystem->Load(
"StPreEclMaker");
70 gSystem->Load(
"StEpcMaker");
71 gSystem->Load(
"StEEmcDbMaker");
72 gSystem->Load(
"StFmsUtil");
73 gSystem->Load(
"StFmsDbMaker");
74 gSystem->Load(
"StTriggerUtilities");
77 gSystem->Load(
"libStPicoEvent");
78 gSystem->Load(
"libStPicoDstMaker");
84 gSystem->Load(
"libStarAgmlUtil");
85 gSystem->Load(
"libStarAgmlLib");
88 gSystem->Load(
"libGeometry");
89 gSystem->Load(
"libStarGeometry");
94 gSystem->Load(
"StDetectorDbMaker");
95 gSystem->Load(
"StarMagField");
96 gSystem->Load(
"StMagF");
97 gSystem->Load(
"StMtdUtil");
98 gSystem->Load(
"StMtdMatchMaker");
99 gSystem->Load(
"StMtdCalibMaker");
104 gSystem->Load(
"StBTofUtil");
105 gSystem->Load(
"StVpdCalibMaker");
106 gSystem->Load(
"StBTofCalibMaker");
107 gSystem->Load(
"StBTofMatchMaker");
112 gSystem->Load(
"StETofUtil");
113 gSystem->Load(
"StETofCalibMaker");
114 gSystem->Load(
"StETofHitMaker");
115 gSystem->Load(
"StETofMatchMaker");
118 void procGeoTag(TObjArray* optionTokens)
120 if (TClass::GetClass(
"AgBlock"))
return;
124 for (
int tk=0; tk < optionTokens->GetEntries(); tk++) {
125 TString& tok = ((TObjString*) (optionTokens->At(tk)))->String();
126 if (tok.BeginsWith(
"y20")){
128 optionTokens->RemoveAt(tk);
129 optionTokens->Compress();
135 AgModule::SetStacker(
new StarTGeoStacker );
140 if ( TClass::GetClass(
"StarGeometry") ) { StarGeometry::Construct( tag ); }
141 else { (
new Geometry() )->ConstructGeometry(tag); }
143 gMessMgr->Warning() <<
"No geometry tag passed! (e.g. y2017a)" << endm;
147 bool findAndRemoveOption(
const char* optionName, TObjArray* optionTokens)
149 TString optName = optionName;
151 TObject* obj = optionTokens->FindObject(optName.Data());
153 optionTokens->Remove(obj);
154 optionTokens->Compress();
160 void genDst(
unsigned int First,
170 StMuDstMaker muDstMaker(0, 0,
"", infile,
"st:MuDst.root", 1e9);
178 TChain& muDstChain = *muDstMaker.
chain();
179 unsigned int nEntries = muDstChain.GetEntries();
180 unsigned int LastToRead = Last > 0 ? min(Last, nEntries) : nEntries;
181 gMessMgr->Info() << nEntries <<
" events in chain, " << LastToRead-First+1 <<
" will be read." << endm;
188 TTree* muDstTreeOut = 0;
191 TString CasedOptions = options;
192 TString Options = options;
194 TString optDelim =
" ,";
195 TObjArray* optionTokens = Options.Tokenize(optDelim);
196 optionTokens->SetOwner(kTRUE);
199 TString flavors =
"ofl";
202 if (findAndRemoveOption(
"Simu",optionTokens) && ! findAndRemoveOption(
"NoSimuDb",optionTokens))
203 flavors.Prepend(
"sim+");
206 TObject* firstFile = muDstChain.GetListOfFiles()->At(0);
208 TString firstFileName = firstFile->GetTitle();
209 firstFileName = firstFileName(firstFileName.Last(
'/')+1,firstFileName.Length());
210 if (firstFileName.BeginsWith(
"st_")) {
211 TString fileStream = firstFileName(3,firstFileName.Index(
'_',3)-3);
212 if (fileStream.Length()>0) flavors.Prepend(fileStream +=
'+');
216 gMessMgr->Info() <<
"Using DB flavors: " << flavors << endm;
217 db->SetFlavor(flavors.Data());
219 if (findAndRemoveOption(
"picodst",optionTokens)) {
228 muDstMaker.
SetStatus(
"PrimaryVertices", 1);
229 muDstMaker.
SetStatus(
"PrimaryTracks", 1);
252 trigSimu->setMC(
false);
255 trigSimu->useOfflineDB();
256 trigSimu->bemc->setConfig(StBemcTriggerSimu::kOffline);
258 if (findAndRemoveOption(
"btofmatch",optionTokens)) {
260 procGeoTag(optionTokens);
271 if (findAndRemoveOption(
"btofstartless",optionTokens)) {
278 if (findAndRemoveOption(
"etofmatch",optionTokens)) {
280 procGeoTag(optionTokens);
290 if (findAndRemoveOption(
"mtdmatch",optionTokens)) {
292 procGeoTag(optionTokens);
303 }
else if (Options.Contains(
"vf")) {
312 muDstMaker.
SetStatus(
"PrimaryVertices",0);
315 TClonesArray* verticesRefitted =
new TClonesArray(
"StMuPrimaryVertex", 1000);
319 outFile =
new TFile(outfile,
"RECREATE");
322 TString fileStr = infile;
323 Ssiz_t dir = fileStr.Last(
'/');
325 gMessMgr->Error() <<
"No specification for output when input is in local directory!" << endm;
328 fileStr.Remove(0,dir+1);
329 outFile =
new TFile(fileStr.Data(),
"RECREATE");
331 muDstTreeOut = muDstChain.CloneTree(0);
332 muDstTreeOut->Branch(
"PrimaryVertices", &verticesRefitted, 65536, 99);
335 processMaker->ToWhiteConst(
"vtxArray",verticesRefitted);
336 processMaker->SetAttr(
"useMuDst",1);
340 gMessMgr->Info() <<
"No processing specified - just reading a MuDst?" << endm;
347 for (
int tk=0; tk < optionTokens->GetEntries(); tk++) {
348 TString& Tag = ((TObjString*) (optionTokens->At(tk)))->String();
351 if (Tag.BeginsWith(
"dbv")) {
353 if (Tag.Length() == 11) (
void) sscanf(Tag.Data(),
"dbv%8d",&FDate);
354 if (Tag.Length() == 18) (
void) sscanf(Tag.Data(),
"dbv%8d.%6d",&FDate,&FTime);
356 db->SetMaxEntryTime(FDate,FTime);
357 gMessMgr->Info() <<
"\tSet DataBase max entry time " << FDate <<
"/" << FTime
358 <<
" for St_db_Maker(\"" << db->
GetName() <<
"\")" << endm;
364 StMaker* attrMaker = processMaker;
365 Ssiz_t delim = Tag.
First(
':');
367 if (delim > 0 && Tag[delim+1] ==
':') {
368 TString altMakerName = Tag(0,delim);
370 Ssiz_t casedMakerNameIdx = CasedOptions.Index(altMakerName,0,TString::ECaseCompare::kIgnoreCase);
371 if (casedMakerNameIdx >= 0) altMakerName = CasedOptions(casedMakerNameIdx,delim);
372 StMaker* altMaker = fullChain.GetMaker(altMakerName.Data());
373 if (!altMaker) altMaker = fullChain.GetMakerInheritsFrom(altMakerName.Data());
375 gMessMgr->Warning() <<
"No maker found with name or class " << altMakerName.Data() << endm;
378 attrMaker = altMaker;
380 delim = Tag.First(
':');
383 attrMaker->SetAttr(Tag.Data(),1);
385 TString key(Tag(0,delim));
386 TString& val = Tag.Remove(0,delim+1);
387 if (val.IsDigit()) { attrMaker->SetAttr(key.Data(),val.Atoi()); }
388 else if (val.IsFloat()) { attrMaker->SetAttr(key.Data(),val.Atof()); }
389 else { attrMaker->SetAttr(key.Data(),val.Data()); }
392 processMaker->PrintAttr();
397 gMessMgr->QAInfo() << Form(
"Run is started at Date/Time %i/%i",t.GetDate(),t.GetTime()) << endm;
399 gMessMgr->QAInfo() << Form(
"Run on %s in %s",gSystem->HostName(),gSystem->WorkingDirectory()) << endm;
400 gMessMgr->QAInfo() << Form(
"with %s", fullChain.GetCVS()) << endm;
404 int iInit = fullChain.Init();
405 if (iInit >=
kStEOF) {fullChain.FatalErr(iInit,
"on init");
return;}
406 if (Last == 0)
return;
409 if (First > 1) fullChain.Skip(First - 1);
410 for (
unsigned int iEvent = First; iEvent <= LastToRead; iEvent++)
412 int iMake = fullChain.Make();
413 if (iMake) {fullChain.FatalErr(iMake,
"on make");
return;}
415 if (muDstTreeOut) muDstTreeOut->Fill();
417 int iClear = fullChain.Clear();
418 if (iClear) {fullChain.FatalErr(iClear,
"on clear");
return;}
429 gMessMgr->QAInfo() <<
"NumberOfEvents= " << eventCount << endm;
430 gMessMgr->QAInfo() <<
"Run completed " << endm;
444 void genDst(
unsigned int Last,
449 genDst(1,Last,options,infile,outfile);
virtual TDataSet * First() const
Return the first object in the list. Returns 0 when list is empty.
Class that converts MuDst into PicoDst.
virtual void Remove(TDataSet *set)
Remiove the "set" from this TDataSet.
virtual TDataSet * Last() const
Return the last object in the list. Returns 0 when list is empty.
void setUseVpdStart(const Bool_t val=kTRUE)
switch to force whether or not to use the VPD as the start time
void setMuDstIn(Bool_t muDstIn=kTRUE)
switch to read in StEvent/MuDst
void setMuDstIn(const bool val=kTRUE)
switch to read in StEvent/MuDst
Muon Telescope Detector (MTD) Match Maker.
virtual const char * GetName() const
special overload
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
void SetStatus(const char *arrType, int status)
void saveAllStEvent(Bool_t a)
Set to kTRUE if all hits are to be saved on StEvent.
void setMuDstIn()
switch to read in StEvent/MuDst