Skip to content

Instantly share code, notes, and snippets.

@jdbrice
Created December 6, 2021 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdbrice/fd10e03701802d2853d12af7f917fca9 to your computer and use it in GitHub Desktop.
Save jdbrice/fd10e03701802d2853d12af7f917fca9 to your computer and use it in GitHub Desktop.
Read MuDST for testing FTT structures
void read_mudst(char* file="input.MuDst.root",
int ifile=-1, Int_t nevt=-1, char* outdir=".", int readMuDst=1){
gROOT->Macro("Load.C");
gROOT->Macro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
gSystem->Load("StEventMaker");
gSystem->Load("StFcsDbMaker");
gSystem->Load("StFttRawHitMaker");
StChain* chain = new StChain("StChain"); chain->SetDEBUG(1);
StMuDstMaker* muDstMaker = new StMuDstMaker(0, 0, "", file,"MuDst.root", 1000);
muDstMaker->SetDebug(1);
int n=muDstMaker->tree()->GetEntries();
printf("Found %d entries in Mudst\n",n);
int start=0, stop=n;
if(ifile>=0){
int start=ifile*nevt;
int stop=(ifile+1)*nevt-1;
if(n<start) {printf(" No event left. Exiting\n"); return;}
if(n<stop) {printf(" Overwriting end event# stop=%d\n",n); stop=n;}
}else if(nevt>=0 && nevt<n){
stop=nevt;
}else if(nevt==-2){
stop=2000000000;
}
printf("Doing Event=%d to %d\n",start,stop);
St_db_Maker* dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb");
if(dbMk){
dbMk->SetAttr("blacklist", "tpc");
dbMk->SetAttr("blacklist", "svt");
dbMk->SetAttr("blacklist", "ssd");
dbMk->SetAttr("blacklist", "ist");
dbMk->SetAttr("blacklist", "pxl");
dbMk->SetAttr("blacklist", "pp2pp");
dbMk->SetAttr("blacklist", "ftpc");
dbMk->SetAttr("blacklist", "emc");
dbMk->SetAttr("blacklist", "eemc");
dbMk->SetAttr("blacklist", "mtd");
dbMk->SetAttr("blacklist", "pmd");
dbMk->SetAttr("blacklist", "tof");
dbMk->SetAttr("blacklist", "etof");
dbMk->SetAttr("blacklist", "rhicf");
}
chain->Init();
int istat = 0;
int iEvent = 0;
while ( istat == 0 && iEvent < stop ){
chain->Clear();
istat = chain->Make(0);
iEvent++;
if ( muDstMaker->muDst()->muFttCollection()->numberOfRawHits() > 0 ){
cout << "muDstMaker->muDst()->muFttCollection()->numberOfRawHits() = " << muDstMaker->muDst()->muFttCollection()->numberOfRawHits() << endl;
}
}
chain->Finish();
delete chain;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment