void bfcread_hist_extract( const Char_t *MainFile= "/afs/rhic.bnl.gov/star/data/samples/gstar.hist.root", const Char_t *MakerHistDir="EventQA", const Char_t *TopDirTree="bfcTree", Char_t *OutFile=0, const Char_t *PrintList="") { cout << "bfcread_hist_extract.C, input hist file = " << MainFile << endl; cout << "bfcread_hist_extract.C, directory name for hist = " << MakerHistDir << endl; cout << "bfcread_hist_extract.C, top level directory in hist file = " << TopDirTree << endl; // gSystem->Load("St_base"); gSystem->Load("StChain"); gSystem->Load("StIOMaker"); gSystem->Load("StarClassLibrary"); gSystem->Load("StUtilities"); gSystem->Load("StAnalysisUtilities"); gSystem->Load("libglobal_Tables"); // setup chain with IOMaker - can read in .dst.root, .dst.xdf files StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,TopDirTree); IOMk->SetDebug(); IOMk->SetIOMode("r"); IOMk->SetBranch("*",0,"0"); //deactivate all branches IOMk->SetBranch("histBranch",0,"r"); //activate dst Branch // constructor for other maker (not used in chain) StHistUtil *HU = new StHistUtil; // now must set pointer to StMaker so HistUtil can find histograms // with StHistUtil methods // -- input any maker pointer but must cast as type StMaker HU->SetPntrToMaker((StMaker *)IOMk); // ONLY use StIOMaker in chain // --- now execute chain member functions - 1 event (histograms) only IOMk->Init(); IOMk->Clear(); IOMk->Make(); // method to print out list of histograms // - can do this anytime after they're booked // - default is to print out QA hist branch Int_t NoHist=0; //NoHist = HU->ListHists(MakerHistDir); TList* dList = HU->FindHists(MakerHistDir); if (PrintList) HU->SetDefaultPrintList(MakerHistDir,PrintList); NoHist = HU->CopyHists(dList); TH1** nh = HU->getNewHist(); TString name = MainFile; if (!OutFile) { name.Remove(0,name.Last('/')+1); TString name2 = MakerHistDir; name2.Remove(0,name2.Last('/')+1); name.Insert(name.First('.'),"_"); name.Insert(name.First('.'),name2); OutFile = name.Data(); } cout << "Output hist file: " << OutFile << endl; TFile* ofile = new TFile(OutFile,"RECREATE"); for (int i=0; i<NoHist; i++) { printf("Extracting: %d. %s : %s\n", i+1,nh[i]->GetName(),nh[i]->GetTitle()); nh[i]->Write(); } ofile->Close(); }
void Example_read_dst_print_tables( Int_t nevents=1, const char *MainFile= "/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root") { // gSystem->Load("St_base"); gSystem->Load("StChain"); gSystem->Load("libglobal_Tables"); gSystem->Load("libgen_Tables"); gSystem->Load("libsim_Tables"); gSystem->Load("libtpc_Tables"); gSystem->Load("StIOMaker"); gSystem->Load("StarClassLibrary"); cout << " .. Example_read_dst_print_tables.C, have loaded libraries " << endl; // Setup top part of chain chain = new StChain("bfc"); chain->SetDebug(); // // setup chain with IOMaker - can read in .dst.root, .dst.xdf files StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,"bfcTree"); IOMk->SetDebug(); IOMk->SetIOMode("r"); IOMk->SetBranch("*",0,"0"); //deactivate all branches // IOMk->SetBranch("tpc_tracks",0,"r"); //activate tpc_tracks Branch // IOMk->SetBranch("geantBranch",0,"r"); //activate geant Branch IOMk->SetBranch("dstBranch",0,"r"); //activate dst Branch // --- now execute chain member functions chain->Init(); for (int iev=0;iev<nevents; iev++) { chain->Clear(); int iret = chain->Make(); if (iret) break; cout << endl << endl << " !!! Now print info about event # " << iev << endl; // ------ List all tables ----------- // GetDataSet is a member function of St_Maker Event = chain->GetDataSet("dst"); // ls() returns a virtual void, so don't have to set it = to anything if (Event) Event->ls(); // ---------------------- globtrk table --------------------- // get dataset for globtrk TDataSet *ds=chain->GetDataSet("dst/globtrk"); if (ds) { cout << " Now print info about globtrk table " << endl; // create iterator for the dataset TDataSetIter globtrkiter(ds); // Du,Pwd return things, but we choose not to keep the return value globtrkiter.Du(); globtrkiter.Pwd(); // find the table St_dst_track *glob = (St_dst_track *) globtrkiter.Find("globtrk"); // print out info about it // using ls() from TDataSetIter glob->ls(); // Print() is a member function of TTable //glob->Print(9,1); //glob->Print(8,1); //glob->Print(8,2); //glob->Print(1,1); glob->Print(0,5); // can't use this method anymore!!! 5June00 Kathy // get the table header data using member function of TTable //table_head_st *tdt_h = glob->GetHeader(); // cout << " header name = " << tdt_h->name << endl; // cout << " header type = " << tdt_h->type << endl; // cout << " header maxlen = " << tdt_h->maxlen << endl; // cout << " header nok = " << tdt_h->nok << endl; // get the table header data using member functions of TTable cout << " table header info: name = " << glob->GetName() << endl; cout << " table header info: type = " << glob->GetType() << endl; cout << " table header info: #rows used = " << glob->GetNRows() << endl; cout << " table header info: #rows allocated = " << glob->GetTableSize() << endl; cout << " table header info: row size (bytes) = " << glob->GetRowSize() << endl; cout << " table header info: #columns = " << glob->GetNumberOfColumns() << endl; // get the table and print out info about it (it's printing row 0) dst_track_st *sth = glob->GetTable(); cout << " globtrk: row0 " << endl; cout << " r0 = " << sth->r0 << endl; cout << " impact = " << sth->impact << endl; cout << " invpt = " << sth->invpt << endl; cout << " z0 = " << sth->z0 << endl; // now go to next row // - just increment the pointer to do this (probably just STAR-specific // way - can't always increment pointers and get to right place! sth++; cout << " globtrk: row1 " << endl; cout << " r0 = " << sth->r0 << endl; cout << " impact = " << sth->impact << endl; cout << " invpt = " << sth->invpt << endl; cout << " z0 = " << sth->z0 << endl; } //-------------------------------------------------------- } chain->Finish(); }
// ------------------ Here is the actual method ----------------------------------------- void doEvents(const Char_t *inname, const Char_t *histname, const Char_t *ntuplename) { Int_t nEvents = 10; Int_t nfiles = 100; // // First load some shared libraries we need // if (gClassTable->GetID("TTable") < 0) { gSystem->Load("libStar"); gSystem->Load("libPhysics"); } gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); loadSharedLibraries(); gSystem->Load("StarMagField"); gSystem->Load("StMagF"); gSystem->Load("StTpcDb"); // gSystem->Load("StDbUtilities"); gSystem->Load("StDaqLib"); gSystem->Load("StDbBroker"); gSystem->Load("StDetectorDbMaker"); gSystem->Load("StDbUtilities"); gSystem->Load("St_db_Maker"); gSystem->Load("StEvent"); gSystem->Load("StEventMaker"); gSystem->Load("StarMagField"); gSystem->Load("StTofUtil"); gSystem->Load("StTofMaker"); gSystem->Load("libtpc_Tables"); gSystem->Load("libGeom"); gSystem->Load("St_g2t"); gSystem->Load("geometry"); gSystem->Load("St_geant_Maker"); gSystem->Load("StTofrMatchMaker"); // gSystem->Load("StTofpMatchMaker"); // gSystem->Load("StTofCalibMaker"); // gSystem->Load("StTofFlowMaker"); gSystem->Load("StTofrNtupleMaker"); // Handling depends on whether file is a ROOT file or XDF file // chain = new StChain("StChain"); StIOMaker* ioMaker = new StIOMaker(); ioMaker->SetFile(inname); ioMaker->SetIOMode("r"); ioMaker->SetBranch("*",0,"0"); ioMaker->SetBranch("eventBranch",0,"r"); ioMaker->SetDebug(0); int NwGeant=5000000, IwType=0, NwPaw=0; St_geant_Maker *geantMk = new St_geant_Maker("geant",NwGeant,NwPaw,IwType); geantMk->LoadGeometry("detp geometry y2008"); geantMk->SetActive(kFALSE); cout<<endl<<"============ Data Base ========="<<endl; dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb"); StTofrMatchMaker *matchMaker = new StTofrMatchMaker("tofrMatch"); matchMaker->SetDebug(0); matchMaker->SetMode(1); matchMaker->setSaveGeometry(kTRUE); matchMaker->setCreateHistoFlag(kTRUE); matchMaker->setCreateTreeFlag(kTRUE); matchMaker->setHistoFileName(histname); //matchMaker->setNtupleFileName("test2.root"); StTofrNtupleMaker *tofrNtuple = new StTofrNtupleMaker("tofrNtuple", ntuplename); tofrNtuple->SetDebug(0); tofrNtuple->setInitGeomFromOther(kTRUE); // // Initialize chain // Int_t iInit = chain->Init(); if (iInit) chain->Fatal(iInit,"on init"); chain->PrintInfo(); // // Event loop // int istat = 0, i = 1; EventLoop: if (i <= nEvents && istat != 2) { cout << endl << "============================ Event " << i << " start ============================" << endl; chain->Clear(); istat = chain->Make(i); if (istat == 2) {cout << "Last event processed. Status = " << istat << endl;} if (istat == 3) {cout << "Error event processed. Status = " << istat << endl;} // gObjectTable->Print(); i++; goto EventLoop; } i--; cout<<endl<<"============================ Event "<<i<<" finish ============================"<<endl; // // Chain Finish // if (nEvents > 1) { chain->Finish(); } }
void CorrectResolution(Int_t nevents=100) { // Dynamically link needed shared libs gSystem->Load("St_base"); gSystem->Load("StChain"); gSystem->Load("St_Tables"); gSystem->Load("StUtilities"); // new addition 22jul99 gSystem->Load("StAnalysisUtilities"); // needed by V0dstMaker gSystem->Load("StMagF"); gSystem->Load("StIOMaker"); gSystem->Load("StarClassLibrary"); gSystem->Load("StEvent"); gSystem->Load("StEventMaker"); gSystem->Load("StHbtMaker"); cout << "Dynamic loading done" << endl; chain = new StChain("StChain"); chain->SetDebug(); #ifndef USE_MICRODST StIOMaker* ioMaker = new StIOMaker("IO","r","/star/rcf/data07/reco/P00hg/2000/07/st_physics_*dst.root","bfcTree"); ioMaker->SetDebug(); ioMaker->SetIOMode("r"); ioMaker->SetDebug(); ioMaker->SetBranch("*",0,"0"); //deactivate all branches ioMaker->SetBranch("dstBranch",0,"r"); //activate EventBranch StEventMaker* eventMaker = new StEventMaker("events","title"); cout << "Just instantiated StEventMaker... lets go StHbtMaker!" << endl; #endif // Now we add Makers to the chain... StHbtMaker* hbtMaker = new StHbtMaker("HBT","title"); cout << "StHbtMaker instantiated"<<endl; /* -------------- set up of hbt stuff ----- */ cout << "StHbtMaker::Init - setting up Reader and Analyses..." << endl; StHbtManager* TheManager = hbtMaker->HbtManager(); // here, we instantiate the appropriate StHbtEventReader #ifdef USE_MICRODST StHbtBinaryReader* Reader = new StHbtBinaryReader("-","microDst.lis"); #else StStandardHbtEventReader* Reader = new StStandardHbtEventReader; Reader->SetTheEventMaker(eventMaker); // gotta tell the reader where it should read from #endif // here would be the palce to plug in any "front-loaded" Event or Particle Cuts... TheManager->SetEventReader(Reader); StHbtVertexAnalysis* anal; mikesEventCut* FrontLoadedEvcut; mikesStarStandardEventCut* evcut; mikesTrackCut* trkcut; qualityPairCut* qpc; ManyPairCuts* MPC; EntranceSepPairCut* espc; StHbtCoulomb* cc; QinvCorrFctn* QinvCF; BPLCMSFrame3DCorrFctn* BpLcmsCF; char* QinvCF_name; char* BP_name; int MultLo,MultHi; float pTLo,pTHi; int charge; // SPEED IT UP -- FRONT-LOADED EVENT CUT and TRACK CUT FrontLoadedEvcut = new mikesEventCut; FrontLoadedEvcut->SetEventMult(30,100000); FrontLoadedEvcut->SetVertZPos(-75.0,75.0); Reader->SetEventCut(FrontLoadedEvcut); // Removed Front-loaded Track cut cout << "READER SET UP.... " << endl; /* MOST CENTRAL PIMINUS hi-pT (5) */ QinvCF_name = "Qinvmm3hi"; BP_name = "BPLCMSmm3hi"; MultLo = 174; MultHi = 500; pTLo = 0.325; pTHi = 0.45; charge = -1; anal = new StHbtVertexAnalysis(10,-75.0,75.0); // 1) set the Event cuts for the analysis evcut = new mikesStarStandardEventCut; evcut->SetEventMult(MultLo,MultHi); evcut->SetVertZPos(-75.0,75.0); anal->SetEventCut(evcut); // 2) set the Track (particle) cuts for the analysis trkcut = new mikesTrackCut; trkcut->SetNSigmaPion(-3.0,3.0); trkcut->SetNSigmaKaon(-1000.0,1000.0); trkcut->SetNSigmaProton(-1000.0,1000.0); trkcut->SetNHits(5,50); trkcut->SetPt(pTLo,pTHi); trkcut->SetRapidity(-0.5,0.5); trkcut->SetDCA(0.0,3.0); trkcut->SetCharge(charge); trkcut->SetMass(0.139); anal->SetFirstParticleCut(trkcut); anal->SetSecondParticleCut(trkcut); // 3) set the Pair cuts for the analysis - this one uses ManyPairCuts MPC = new ManyPairCuts; qpc = new qualityPairCut; qpc->SetQualityCut(-0.5,0.6); MPC->AddPairCut(qpc); espc = new EntranceSepPairCut; espc->SetEntranceSepRange(2.5,2000.0); MPC->AddPairCut(espc); anal->SetPairCut(MPC); // 4) set the number of events to mix (per event) anal->SetNumEventsToMix(10); // 5) now set up the correlation functions that this analysis will make // QinvCF = new QinvCorrFctn(QinvCF_name,40,0.0,0.20); // anal->AddCorrFctn(QinvCF); BpLcmsCF = new BPLCMSFrame3DCorrFctn(BP_name,40,0.0,0.2); cc = new StHbtCoulomb; cc->SetRadius(5.0); BpLcmsCF->SetCoulombCorrection(cc); // // now set up momentumResolutionCorrection stuff // StHbtSmearPair* smear = new StHbtSmearPair; smear->SetFractionalPtRes(0.02); smear->SetPhiRes_a(0.00112); smear->SetPhiRes_b(0.000563); smear->SetPhiRes_alpha(-1.51); smear->SetThetaRes_a(0.00136); smear->SetThetaRes_b(0.000776); smear->SetThetaRes_alpha(-1.53); BpLcmsCF->SetSmearPair(smear); // BpLcmsCF->SetLambda(0.65); BpLcmsCF->SetRout(4.52); BpLcmsCF->SetRside(5.00); BpLcmsCF->SetRlong(5.43); anal->AddCorrFctn(BpLcmsCF); // 7) add the Analysis to the AnalysisCollection TheManager->AddAnalysis(anal); /* ------------------ end of setting up hbt stuff ------------------ */ // now execute the chain member functions if (chain->Init()){ // This should call the Init() method in ALL makers cout << "Initialization failed \n"; goto TheEnd; } chain->PrintInfo(); // Event loop int istat=0,iev=1; EventLoop: if (iev <= nevents && !istat) { cout << "StHbtExample -- Working on eventNumber " << iev << " of " << nevents << endl; chain->Clear(); istat = chain->Make(iev); if (istat) {cout << "Last event processed. Status = " << istat << endl;} iev++; goto EventLoop; } cout << "StHbtExample -- Done with event loop" << endl; chain->Finish(); // This should call the Finish() method in ALL makers TheEnd: TFile histoOutput("ThreeDHBT.root","recreate"); for (int ia=0; ia<1; ia++){ StHbtVertexAnalysis* Vanal = (StHbtVertexAnalysis*)(hbtMaker->HbtManager()->Analysis(ia)); // QinvCorrFctn* qcf = (QinvCorrFctn*)(Vanal->CorrFctn(0)); // qcf->Numerator()->Write(); // qcf->Denominator()->Write(); // qcf->Ratio()->Write(); BPLCMSFrame3DCorrFctn* bpcf = (BPLCMSFrame3DCorrFctn*)(Vanal->CorrFctn(0)); bpcf->Numerator()->Write(); bpcf->Denominator()->Write(); bpcf->Ratio()->Write(); // bpcf->mIDNumHisto->Write(); bpcf->mIDDenHisto->Write(); bpcf->mIDRatHisto->Write(); bpcf->mSMNumHisto->Write(); bpcf->mSMDenHisto->Write(); bpcf->mSMRatHisto->Write(); bpcf->mCorrectionHisto->Write(); bpcf->mCorrCFHisto->Write(); } histoOutput.Close(); }
void doEventsQQ(const Int_t nevents=999, const Char_t **fileList) { // Dynamically link needed shared libs gSystem->Load("St_base"); gSystem->Load("StChain"); gSystem->Load("libgen_Tables"); gSystem->Load("libsim_Tables"); gSystem->Load("libglobal_Tables"); gSystem->Load("StUtilities"); gSystem->Load("StIOMaker"); gSystem->Load("StarClassLibrary"); gSystem->Load("StarMagField"); gSystem->Load("StMagF"); gSystem->Load("StEvent"); gSystem->Load("StDetectorDbMaker"); gSystem->Load("StTpcDb"); gSystem->Load("StEventMaker"); gSystem->Load("St_geom_Maker"); gSystem->Load("StEventDisplayMaker"); // Handling depends on whether file is a ROOT file or XDF file chain = new StChain("StChain"); StFile *setFiles= new StFile(); for (int ifil=0; fileList[ifil]; ifil++) { setFiles->AddFile(fileList[ifil]);} St_geom_Maker *geom = new St_geom_Maker; // this maker open its own TFile !!! StIOMaker *IOMk = new StIOMaker("IO","r",setFiles,"bfcTree"); IOMk->SetDebug(); // Maker to read events from file or database into StEvent StEventMaker *readerMaker = new StEventMaker ("events","title"); // Sample analysis maker // StAnalysisMaker *analysisMaker = new StAnalysisMaker("analysis"); disp = new StEventDisplayMaker; disp->SetDebug(); // Create an user's custom filter for "Tracks" St_TLA_EventFilter *trackFilter = new St_TLA_EventFilter(); disp->SetFilter(trackFilter,StEventDisplayMaker::kTrack); // Initialize chain Int_t iInit = chain->Init(); if (iInit) chain->Fatal(iInit,"on init"); chain->PrintInfo(); // chain->MakeDoc(); // Event loop int istat; for (Int_t i=1; i<=nevents; i++) { cout << "============================ Event " << i << " start" << endl; chain->Clear(); istat = chain->Make(i); if (istat) { cout << "Last event processed. Status = " << istat << endl; chain->Clear(); break; } St_DataSet *set = chain->DataSet("dst"); if (set) { St_DataSetIter dirt(set); dirt.Du(); } cout << "============================ Event " << i << " finish" << endl; } gROOT->LoadMacro("PadControlPanel.C"); }
void makePicoDst(const Int_t runnumber=999999, const Char_t *inputFile="/star/institutions/lbl_prod/mlomnitz/SSD_Simu/StEvent/hijing_**.MuDst.root", const Char_t *inputGeant="/star/institutions/lbl_prod/mlomnitz/SSD_Simu/StEvent/hijing_**.McEvent.root", TString outfilename="out", const bool creatingPhiWgt = kFALSE, const int prodMod = 0, const int emcMode=0, const bool createMcBranch = kTRUE ){ Int_t nEvents = 10000000; //Int_t nEvents = 50; //Load all the System libraries cout<<inputFile<<endl; gSystem->Load("libTable"); gSystem->Load("libPhysics"); gSystem->Load("St_base"); gSystem->Load("StChain"); gSystem->Load("St_Tables"); gSystem->Load("StUtilities"); // new addition 22jul99 gSystem->Load("StTreeMaker"); gSystem->Load("StIOMaker"); gSystem->Load("StarClassLibrary"); gSystem->Load("StTriggerDataMaker"); // new starting from April 2003 gSystem->Load("StBichsel"); gSystem->Load("StEvent"); gSystem->Load("StEventUtilities"); gSystem->Load("StDbLib"); gSystem->Load("StEmcUtil"); gSystem->Load("StTofUtil"); gSystem->Load("StPmdUtil"); gSystem->Load("StPreEclMaker"); gSystem->Load("StStrangeMuDstMaker"); gSystem->Load("StMuDSTMaker"); if( createMcBranch){ gSystem->Load("StMcEvent"); gSystem->Load("StAssociationMaker"); } if(!creatingPhiWgt&&emcMode) { gSystem->Load("StTpcDb"); gSystem->Load("StMcEvent"); gSystem->Load("StMcEventMaker"); gSystem->Load("StDaqLib"); gSystem->Load("libgen_Tables"); gSystem->Load("libsim_Tables"); gSystem->Load("libglobal_Tables"); gSystem->Load("StEmcTriggerMaker"); gSystem->Load("StEmcUtil");//mine gSystem->Load("StEmcRawMaker"); gSystem->Load("StEmcADCtoEMaker"); gSystem->Load("StPreEclMaker"); gSystem->Load("StEpcMaker"); gSystem->Load("StEmcSimulatorMaker"); gSystem->Load("StEmcUtil"); gSystem->Load("StDbBroker"); gSystem->Load("StDetectorDbMaker"); gSystem->Load("StDbUtilities"); gSystem->Load("StEEmcUtil"); gSystem->Load("StEEmcDbMaker"); gSystem->Load("St_db_Maker"); gSystem->Load("StTriggerUtilities"); } gSystem->Load("StPicoDstMaker"); chain = new StChain(); if( createMcBranch ){ StIOMaker* ioMaker = new StIOMaker("IO","r",inputGeant,"bfcTree"); ioMaker->SetDebug(); ioMaker->SetIOMode("r"); ioMaker->SetBranch("*",0,"0"); //deactivate all branches //ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch ioMaker->SetBranch("McEventBranch",0,"r"); //activate geant Branch ioMaker->SetBranch("eventBranch",0,"r"); //activate geant Branch StAssociationMaker* associator = new StAssociationMaker; cout<<"created new StAssociationMaker"<<endl; associator->useInTracker(); } StMuDstMaker *MuDstMaker = new StMuDstMaker(0,0,"",inputFile,"MuDst",100); MuDstMaker->SetStatus("*",0); MuDstMaker->SetStatus("MuEvent",1); MuDstMaker->SetStatus("PrimaryVertices",1); MuDstMaker->SetStatus("PrimaryTracks",1); MuDstMaker->SetStatus("GlobalTracks",1); MuDstMaker->SetStatus("CovGlobTrack",1); //MuDstMaker->SetStatus("BTof*",1); //MuDstMaker->SetStatus("Emc*",1); if(!creatingPhiWgt&&emcMode) { St_db_Maker *dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb"); // Endcap database StEEmcDbMaker* eemcDb = new StEEmcDbMaker; StEmcADCtoEMaker *adc2e = new StEmcADCtoEMaker(); adc2e->setPrint(false); //adc2e->setFillHisto(false); //adc2e->setDebug(false); //more histograms //adc2e->setSMDRmsCut(0,0); adc2e->saveAllStEvent(true); //adc2e->setRemoveGhostEvent(false); //adc2e->setTallyHist(mTally); //adc2e->setDbName("Calibrations/emc/y3"); StPreEclMaker *pre_ecl=new StPreEclMaker(); pre_ecl->setPrint(kFALSE); StEpcMaker *epc=new StEpcMaker(); epc->setPrint(kFALSE); #if 1 // Trigger simulator StTriggerSimuMaker* trigSimu = new StTriggerSimuMaker; trigSimu->setMC(false); trigSimu->useBemc(); trigSimu->useEemc(); trigSimu->useOnlineDB(); trigSimu->bemc->setConfig(StBemcTriggerSimu::kOffline); #endif } StPicoDstMaker *picoMaker = new StPicoDstMaker(1,Form("st_%i.picoDst.root",runnumber),"picoDst"); picoMaker->setRunNumber(runnumber); picoMaker->setEmcMode(emcMode); // 0-No EMC, 1-EMC ON picoMaker->setMcMode(createMcBranch); chain->Init(); cout<<"chain->Init();"<<endl; int total = 0; cout<<MuDstMaker->chain()->GetEntries()<<endl; if( nEvents > MuDstMaker->chain()->GetEntries() ) nEvents=MuDstMaker->chain()->GetEntries(); for (Int_t i=0; i<nEvents; i++){ if(i%100==0) cout << "Working on eventNumber " << i << endl; chain->Clear(); int iret = chain->Make(i); if (iret) { cout << "Bad return code!" << iret << endl; break;} total++; } cout << "****************************************** " << endl; cout << "Work done... now its time to close up shop!"<< endl; cout << "****************************************** " << endl; chain->Finish(); cout << "****************************************** " << endl; cout << "total number of events " << total << endl; cout << "****************************************** " << endl; delete chain; }
void TestIOMaker(Int_t nevents=3, //This file points to 30 events of 10 neg muons w/ pt=.9 const char* MainFile="/star/data22/ITTF/data/simple_geant/DEV_10_8_01/*.event.root") //This file points to 5 muons /event //const char* MainFile="/star/data22/ITTF/EvalData/MCNtuple/muon_100_neg.event.root") //This file points to 110 events from mevsim (homebrew had. cocktail) //const char* MainFile="/star/data22/ITTF/data/mevsim/10_9_01/*.event.root") //This file points to a nightly low density hadronic cocktail reconstruction. //const char* MainFile="/star/rcf/test/dev/trs_redhat61/Tue/year_2001/hc_lowdensity/*.event.root") { // Dynamically link needed shared libs cout <<"Loading St_base"<<endl; gSystem->Load("St_base"); cout <<"Loading StChain"<<endl; gSystem->Load("StChain"); cout <<"Loading St_Tables"<<endl; gSystem->Load("St_Tables"); cout <<"Loading StUtilities"<<endl; gSystem->Load("StUtilities"); cout <<"Loading StIOMaker"<<endl; gSystem->Load("StIOMaker"); cout <<"Loading StarClassLibrary"<<endl; gSystem->Load("StarClassLibrary"); cout <<"Loading DataBase"<<endl; gSystem->Load("StDbUtilities"); gSystem->Load("StDbLib"); gSystem->Load("StDbBroker"); gSystem->Load("St_db_Maker"); gSystem->Load("StTpcDb"); cout <<"Loading StEvent"<<endl; gSystem->Load("StEvent"); cout <<"Loading StEventMaker"<<endl; gSystem->Load("StEventMaker"); cout <<"Loading StEmcUtil"<<endl; gSystem->Load("StEmcUtil"); cout <<"Loading StMcEvent"<<endl; gSystem->Load("StMcEvent"); cout <<"Loading StMcEventMaker"<<endl; gSystem->Load("StMcEventMaker"); cout <<"Loading AssociationMaker"<<endl; gSystem->Load("StAssociationMaker"); // create a new instance of the chain chain = new StChain("StChain"); chain->SetDebug(); // add makers to the chain StIOMaker* ioMaker = new StIOMaker("IO","r",MainFile,"bfcTree"); ioMaker->SetDebug(); ioMaker->SetIOMode("r"); ioMaker->SetBranch("*",0,"0"); //deactivate all branches ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch ioMaker->SetBranch("dstBranch",0,"r"); //activate Event Branch ioMaker->SetBranch("runcoBranch",0,"r"); //activate runco Branch //Calibration Maker (StarDB,not a real Database!) const char* calibDB = "MySQL:StarDb"; const char* paramsDB = "$STAR/StarDb"; St_db_Maker* calibMk = new St_db_Maker("StarDb",calibDB,paramsDB); calibMk->SetDateTime("year_2b"); //calibMk->SetDateTime("year_1h"); calibMk->SetDebug(); //Read Tpc Database access StTpcDbMaker *tpcDbMk = new StTpcDbMaker("tpcDb"); //StEventMaker StEventMaker* eventReader = new StEventMaker("events","title"); eventReader->doPrintEventInfo = 0; //StMcEventMaker StMcEventMaker* mcEventReader = new StMcEventMaker(); //Association StAssociationMaker* assocMaker = new StAssociationMaker(); cout <<"Calling Init() Methods "<<endl; chain->Init(); cout <<"Starting Event Loop"<<endl; int istat=0,iev=1; EventLoop: if (iev<=nevents && !istat) { chain->Clear(); cout << "---------------------- Processing Event : " << iev << endl; istat = chain->Make(iev); if (istat) { cout << "Last Event Processed. Status = " << istat << endl; } iev++; goto EventLoop; } return; }
void StAssociator(Int_t nevents=1, const char *MainFile="/afs/rhic.bnl.gov/star/data/samples/*.geant.root") { // Dynamically link needed shared libs gSystem->Load("St_base"); gSystem->Load("StChain"); gSystem->Load("StBFChain"); gSystem->Load("St_Tables"); gSystem->Load("StUtilities"); gSystem->Load("StIOMaker"); gSystem->Load("StarClassLibrary"); gSystem->Load("StDetectorDbMaker"); gSystem->Load("StTpcDb"); gSystem->Load("StEvent"); // gSystem->Load("StEventMaker"); //not needed if event.root branch present gSystem->Load("StEmcUtil"); gSystem->Load("StEEmcUtil"); gSystem->Load("StMcEvent"); gSystem->Load("StMcEventMaker"); gSystem->Load("StAssociationMaker"); gSystem->Load("StMcAnalysisMaker"); chain = new StChain("StChain"); chain->SetDebug(); // Now we add Makers to the chain... StIOMaker* ioMaker = new StIOMaker("IO","r",MainFile,"bfcTree"); ioMaker->SetDebug(); ioMaker->SetIOMode("r"); ioMaker->SetBranch("*",0,"0"); //deactivate all branches ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch ioMaker->SetBranch("eventBranch",0,"r"); //activate geant Branch // ioMaker->SetBranch("dstBranch",0,"r"); //activate Event Branch // ioMaker->SetBranch("runcoBranch",0,"r"); //activate runco Branch // Note, the title "events" is used in the Association Maker, so don't change it. // StEventMaker is not needed for event.root files // StEventMaker* eventReader = new StEventMaker("events","title"); // eventReader->doPrintMemoryInfo = kFALSE; StMcEventMaker* mcEventReader = new StMcEventMaker; // Make an instance... StAssociationMaker* associator = new StAssociationMaker; // If you need to use L3 TRIGGER uncomment the line: // associator->useL3Trigger(); //associator->SetDebug(); // For tracks created with the Sti package (ITTF), uncomment the next line: //associator->useInTracker(); // Switch to use the distance or id association. associator->useDistanceAssoc(); //associator->useIdAssoc(); // Note: useDistanceAssoc and useIdAssoc are mutually exclusive // and they set and unset the same flag. // The flag will be set by the call done at the end. //associator->doPrintMemoryInfo = kTRUE; StMcAnalysisMaker* examples = new StMcAnalysisMaker; // Define the cuts for the Associations StMcParameterDB* parameterDB = StMcParameterDB::instance(); // TPC parameterDB->setXCutTpc(.6); // 6 mm parameterDB->setYCutTpc(.6); // 6 mm parameterDB->setZCutTpc(.6); // 6 mm parameterDB->setReqCommonHitsTpc(3); // Require 3 hits in common for tracks to be associated // FTPC parameterDB->setRCutFtpc(.3); // 3 mm parameterDB->setPhiCutFtpc(5*(3.1415927/180.0)); // 5 degrees parameterDB->setReqCommonHitsFtpc(3); // Require 3 hits in common for tracks to be associated // SVT parameterDB->setXCutSvt(.08); // 800 um parameterDB->setYCutSvt(.08); // 800 um parameterDB->setZCutSvt(.08); // 800 um parameterDB->setReqCommonHitsSvt(1); // Require 1 hits in common for tracks to be associated // now execute the chain member functions chain->PrintInfo(); Int_t initStat = chain->Init(); // This should call the Init() method in ALL makers if (initStat) chain->Fatal(initStat, "during Init()"); int istat=0,iev=1; EventLoop: if (iev<=nevents && istat!=2) { chain->Clear(); cout << "---------------------- Processing Event : " << iev << " ----------------------" << endl; istat = chain->Make(iev); // This should call the Make() method in ALL makers if (istat == 2) { cout << "Last Event Processed. Status = " << istat << endl; } if (istat == 3) { cout << "Error Event Processed. Status = " << istat << endl; } iev++; goto EventLoop; } // Event Loop examples->mAssociationCanvas = new TCanvas("mAssociationCanvas", "Histograms",200,10,600,600); TCanvas* myCanvas = examples->mAssociationCanvas; myCanvas->Divide(2,2); myCanvas->cd(1); gPad->SetLogy(0); examples->mTrackNtuple->Draw("(p-prec)/p:commTpcHits","prec!=0"); TList* dList = chain->GetMaker("StMcAnalysisMaker")->Histograms(); TH2F* hitRes = dList->At(0); TH1F* momRes = dList->At(1); TH2F* coordRc = dList->At(2); TH2F* coordMc = dList->At(3); myCanvas->cd(2); gPad->SetLogy(0); hitRes->Draw("box"); myCanvas->cd(3); gPad->SetLogy(0); momRes->Draw(); myCanvas->cd(4); gPad->SetLogy(0); coordRc->SetMarkerStyle(20); coordRc->Draw(); myCanvas->cd(4); gPad->SetLogy(0); coordMc->SetMarkerColor(2); coordMc->SetMarkerStyle(20); coordMc->Draw("same"); if(iev>200) chain->Finish(); // This should call the Finish() method in ALL makers, // comment it out if you want to keep the objects // available at the command line after running // the macro. // To look at the ntuple after the macro has executed: // f1 = new TFile("TrackMapNtuple.root"); //This opens the file, and loads the Ntuple // TrackNtuple->Draw("px:pxrec") //Once loaded, the Ntuple is available by name. // To look at the Histograms once the Macro has executed: // TList* dList = chain->GetMaker("McAnalysis")->Histograms(); // TH2F* hitRes = dList->At(0); //or whatever index from 0 to 3 }
// ------------------ Here is the actual method ----------------------------------------- void RunStiMaker(Int_t nevents, const Char_t **fileList, const Char_t *qaflag, const Int_t wrStEOut) { Int_t theRunNumber=0; bool simulated = true; bool doFit = false; bool optimized = false; char* outfile = "Evaluation.root"; cout << endl << endl <<" doEvents - input # events = " << nevents << endl; Int_t ilist=0; while(fileList[ilist]){ cout << " doEvents - input fileList = " << fileList[ilist] << endl; ilist++; } cout << " doEvents - input qaflag = " << qaflag << endl; cout << " doEvents - input wrStEOut = " << wrStEOut << endl << endl << endl; // // First load some shared libraries we need // gSystem->Load("St_base"); gSystem->Load("StUtilities"); gSystem->Load("StChain"); gSystem->Load("StBFChain"); gSystem->Load("St_Tables"); gSystem->Load("libgen_Tables"); gSystem->Load("libsim_Tables"); gSystem->Load("libglobal_Tables"); gSystem->Load("geometry"); gSystem->Load("St_g2t"); gSystem->Load("St_geant_Maker"); gSystem->Load("StIOMaker"); gSystem->Load("StTreeMaker"); gSystem->Load("StarClassLibrary"); gSystem->Load("St_db_Maker"); gSystem->Load("StDbLib"); gSystem->Load("StDbBroker"); gSystem->Load("StSvtDbMaker"); gSystem->Load("StDbUtilities"); gSystem->Load("StTpcDb"); gSystem->Load("StEvent"); gSystem->Load("StEventMaker"); gSystem->Load("StEmcUtil"); gSystem->Load("StMcEvent"); gSystem->Load("StMcEventMaker"); gSystem->Load("StAssociationMaker"); gSystem->Load("StDaqLib"); gSystem->Load("StDAQMaker"); gSystem->Load("StSvtClassLibrary"); gSystem->Load("StSvtDaqMaker"); gSystem->Load("StSvtSimulationMaker"); gSystem->Load("StSvtCalibMaker"); gSystem->Load("StSvtSeqAdjMaker"); //gSystem->Load("StSvtEvalMaker"); gSystem->Load("StSvtClusterMaker"); //cout <<"Loading StMcEventMaker"<<endl; //gSystem->Load("StMcEventMaker"); //cout <<"Loading AssociationMaker"<<endl; //gSystem->Load("StAssociationMaker"); cout <<"Loading Sti"<<endl; gSystem->Load("Sti"); cout <<"Loading StiGui"<<endl; gSystem->Load("StiGui"); cout <<"Loading StiEvaluator"<<endl; gSystem->Load("StiEvaluator"); cout <<"Loading libGui"<<endl; gSystem->Load("libGui"); cout <<"Loading StiMaker"<<endl; gSystem->Load("StiMaker"); cout <<"Loading StItTestMaker"<<endl; gSystem->Load("StItTestMaker"); // // Handling depends on whether file is a ROOT file or XDF file // chain = new StChain("StChain"); StFileI *setFiles =0; if (fileList) { //Normal case setFiles= new StFile(fileList); } else { //Grand Challenge gSystem->Load("StChallenger"); setFiles = StChallenger::Challenge(); setFiles->SetDebug(); const char *Argv[]= { "-s","daq", // list of components needed "-q","mRunNumber=1228023", // example of user query "-c","/afs/rhic.bnl.gov/star/incoming/GCA/daq/stacs.rc" // pointer to GC servers for daq }; Int_t Argc=sizeof(Argv)/4; setFiles->Init(Argc,Argv); } StIOMaker *IOMk = new StIOMaker("inputStream","r",setFiles); //IOMk->SetBranch("*",0,"0"); //deactivate all branches //IOMk->SetBranch("dstBranch",0,"r"); //IOMk->SetBranch("runcoBranch",0,"r"); IOMk->SetBranch("eventBranch",0,"r"); if (simulated) { //addded by MLM IOMk->SetBranch("geantBranch",0,"r"); } IOMk->SetDebug(); St_geant_Maker *geantMk = new St_geant_Maker("geant"); geantMk->SetActive(kFALSE); // // Maker to read events from file or database into StEvent // //StEventMaker *readerMaker = new StEventMaker("events","title"); // // DB maker // // dbaseMk = new St_db_Maker("svt","$PWD/svtcvs/StarDb"); //dbaseMk = new St_db_Maker("db","StarDb"); dbaseMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb"); //dbaseMk->SetDateTime("year_1h"); //dbaseMk->SetDateTime("year_2a"); dbaseMk-> SetDateTime(20010801,000000); // // TPC Db maker // tpcDbMk = new StTpcDbMaker("tpcDb"); // // SVT Db maker // svtDbMk = new StSvtDbMaker("svtDb"); //StMcEventMaker StMcEventMaker* mcEventReader = 0; //Association StAssociationMaker* assocMaker = 0; if (simulated) { mcEventReader = new StMcEventMaker(); assocMaker = new StAssociationMaker(); } //StiMaker StiMaker* anaMk = StiMaker::instance(); cout <<"\n --- Setup StiIOBroker ---\n"<<endl; //StiIOBroker StiRootIOBroker* stiIO = new StiRootIOBroker(); stiIO->setTPHFMinPadrow(1); stiIO->setTPHFMaxPadrow(45); stiIO->setETSFLowerBound(5); stiIO->setETSFMaxHits(6); stiIO->setDoTrackFit(doFit); //Set Kalman Track Finder (KTF) run-time values: stiIO->setKTFMcsCalculated(false); stiIO->setKTFElossCalculated(false); stiIO->setKTFMaxChi2ForSelection(50); stiIO->setKTFBField(.5); //Tesla stiIO->setKTFMassHypothesis(.1395); //GeV stiIO->setKTFMinContiguousHitCount(2); stiIO->setKTFMaxNullCount(40); stiIO->setKTFMaxContiguousNullCount(25); stiIO->setKTFMinSearchRadius(.5); //cm stiIO->setKTFMaxSearchRadius(4.); //cm stiIO->setKTFSearchWindowScale(5.); //cm //Set Local Track Seed Finder (LTSF) run-time values stiIO->setLTSFZWindow(5.); stiIO->setLTSFYWindow(2.); stiIO->setLTSFSeedLength(2); stiIO->setLTSFDoHelixFit(true); stiIO->setLTSFExtrapYWindow(1.); stiIO->setLTSFExtrapZWindow(2.); stiIO->setLTSFExtrapMaxSkipped(2); stiIO->setLTSFExtrapMinLength(4); stiIO->setLTSFExtrapMaxLength(5); stiIO->setLTSFUseVertex(true); stiIO->setLTMDeltaR(1.); //10% in r //Add sectors: for (unsigned int sector=1; sector<=12; ++sector) { stiIO->addLTSFSector(sector); } //Add padrows; //for (unsigned int padrow=1; padrow<=45; ++padrow) { for (unsigned int padrow=6; padrow<=45; padrow+=1) { stiIO->addLTSFPadrow(padrow); } //This line has to match the corresponding enumeration in StiIOBroker.h enum SeedFinderType {kUndefined=0, kComposite=1, kEvaluable=2}; //stiIO->setSeedFinderType(kEvaluable); stiIO->setSeedFinderType(kComposite); //Set up the track filter (this mas to macth the correspoinding enumeration in StiIOBroker.h) enum FilterType {kPtFilter=0, kEtaFilter=1, kChi2Filter=2, kNptsFilter=3, kNFitPtsFilter=4, kNGapsFilter=5, kFitPointRatioFilter=6, kPrimaryDcaFilter=7}; stiIO->addFilterType(kPtFilter); stiIO->setFilterPtMin(.1); //GeV stiIO->setFilterPtMax(50.); //GeV stiIO->addFilterType(kEtaFilter); stiIO->setFilterEtaMin(-2.); stiIO->setFilterEtaMax(2.); stiIO->addFilterType(kChi2Filter); stiIO->setFilterChi2Max(10.); stiIO->addFilterType(kNptsFilter); stiIO->setFilterNptsMin(8); stiIO->addFilterType(kNFitPtsFilter); stiIO->setFilterNFitPtsMin(5); stiIO->addFilterType(kNGapsFilter); stiIO->setFilterNGapsMax(20); //stiIO->addFilterType(kFitPointRatioFilter); //stiIO->setFilterFitPointRatioMin(.5); stiIO->addFilterType(kPrimaryDcaFilter); stiIO->setFilterPrimaryDcaMax(100.); stiIO->setSimulated(simulated); anaMk->setEvaluationFileName(outfile); if (simulated) { anaMk->setMcEventMaker(mcEventReader); anaMk->setAssociationMaker(assocMaker); } //Make Control Window if not batch MainFrame* sti=0; StiGuiIOBroker* guiIO=0; if (gROOT->IsBatch()==false) { cout <<"No batch option detected. Run Integrated Tracker in Gui Mode."<<endl; sti = new MainFrame(gClient->GetRoot(), 400, 220); sti->setStChain(chain); sti->setIoMaker(IOMk); //we're in batch mode stiIO->setUseGui(true); //Maker io gateway guiIO = StiGuiIOBroker::instance(); //Values for hits not assigned to tracks guiIO->setUnMarkedHitSize(.3); guiIO->setUnMarkedHitColor(4); guiIO->setUnMarkedHitStyle(8); guiIO->setUpdateEachTrack(false); //Values for hits assigned to tracks guiIO->setMarkedHitSize(.3); guiIO->setMarkedHitColor(2); guiIO->setMarkedHitStyle(3); } else { cout <<"Batch option detector. Run Integrated Tracker in non-Gui Mode."<<endl; stiIO->setUseGui(false); } cout <<"\n --- Done setting up StiIOBroker --- \n"<<endl; // WriteOut StEvent if (wrStEOut) { cout << "!!!! doEvents: will write out .event.root file !!" << endl << endl; StIOMaker *outMk = new StIOMaker("EvOut","w","test.event.root","bfcTree"); // outMk->SetBranch("eventBranch","test.event.root","w"); outMk->IntoBranch("evtselBranch","StEvent"); IOMk->SetNotify("CloseFile",outMk); IOMk->SetNotify("OpenFile" ,outMk); } // // test the Ittf tracks in StEvent // StItTestMaker* itTest = new StItTestMaker("StItTestMaker"); /* dbaseMk->Init(); svtDbMk->setSvtDb_Reader(); dbaseMk->Make(); svtDbMk->readSvtConfig(); svtDbMk->readSvtGeometry(); */ // // Initialize chain // Int_t iInit = chain->Init(); if (iInit) chain->Fatal(iInit,"on init"); //chain->PrintInfo(); chain->InitRun(theRunNumber); // // Event loop // int istat=0,i=1; EventLoop: if (i <= nevents && istat!=2) { cout << endl << "============================ Event " << i << " start ============================" << endl; chain->Clear(); istat = chain->Make(i); if (istat==2) {cout << "Last event processed. Status = " << istat << endl;} if (istat==3) {cout << "Error event processed. Status = " << istat << endl;} i++; goto EventLoop; } //chain->Finish(); i--; cout << endl << "============================ Event " << i << " finish ============================" << endl; }
void DoEqualDaq(char* file="daq/*.daq",int nevents = 500000,char* name = "equal1.root") { // // First load some shared libraries we need // gSystem->Load("St_base"); gSystem->Load("StChain"); gSystem->Load("libgen_Tables"); gSystem->Load("libsim_Tables"); gSystem->Load("libglobal_Tables"); gSystem->Load("StUtilities"); gSystem->Load("StIOMaker"); gSystem->Load("StTreeMaker"); gSystem->Load("StarClassLibrary"); gSystem->Load("StEvent"); gSystem->Load("StMagF"); gSystem->Load("libgeometry_Tables"); gSystem->Load("St_Tables"); gSystem->Load("StEmcUtil"); gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); loadSharedLibraries(); gSystem->Load("StDbUtilities"); gSystem->Load("StDbLib"); gSystem->Load("StDbBroker"); gSystem->Load("St_db_Maker"); gSystem->Load("libgeometry_Tables"); gSystem->Load("StDaqLib"); gSystem->Load("StEmcRawMaker"); gSystem->Load("StEmcADCtoEMaker"); gSystem->Load("StPreEclMaker"); gSystem->Load("StEpcMaker"); gSystem->Load("StEmcCalibrationMaker"); chain=new StChain("StChain"); chain->SetDebug(); // // Setup IO maker // StIOMaker *IOMk = new StIOMaker(); IOMk->SetFile(file); IOMk->SetIOMode("r"); IOMk->SetBranch("*",0,"0"); //deactivate all branches IOMk->SetBranch("daqBranch",0,"r"); IOMk->SetDebug(); St_db_Maker *db = new St_db_Maker("StarDb","MySQL:StarDb"); m = new StEmcADCtoEMaker(); m->saveAllStEvent(kTRUE); m->setPrint(kFALSE); // This process the EMC event and fill the tables // necessary for calibration StEmcCalibrationMaker *cal = new StEmcCalibrationMaker(); char outfile[300]; // does equalization sprintf(outfile,"/home/emc/online/emc/pedestal/equal/%s",name); StEmcEqualMaker *equal = new StEmcEqualMaker(); equal->setFile(outfile); // // Initialize chain // Int_t iInit = chain->Init(); if (iInit) chain->Fatal(iInit,"on init"); chain->PrintInfo(); int istat=0,i=1; EventLoop: if (i <= nevents && istat!=2) { cout << endl << "============================ Event " << i<< " start ============================" << endl; chain->Clear(); istat = chain->Make(); if (istat==2) {cout << "Last event processed. Status = " << istat << endl;} if (istat==3) {cout << "Error event processed. Status = " << istat << endl;} i++; goto EventLoop; } i--; cout << endl << "============================ Event " << i << " finish ============================" << endl; }
//========================================================================================== void ProcessQQ(const Int_t mode, const Int_t fsti, const Int_t nevents, const Char_t **fileList, const Char_t* dirName) { cout << "Loading libraries ..." << endl; gSystem->Load("St_base"); gSystem->Load("StChain"); gSystem->Load("StDaqLib"); gSystem->Load("St_Tables"); gSystem->Load("StarMagField"); gSystem->Load("StMagF"); gSystem->Load("StUtilities"); gSystem->Load("StTreeMaker"); gSystem->Load("StIOMaker"); gSystem->Load("StarClassLibrary"); gSystem->Load("StDetectorDbMaker"); gSystem->Load("StTpcDb"); gSystem->Load("StDbUtilities"); gSystem->Load("StBichsel"); gSystem->Load("StTriggerDataMaker"); gSystem->Load("StEvent"); gSystem->Load("StEventUtilities"); gSystem->Load("StMcEvent"); gSystem->Load("StMcEventMaker"); gSystem->Load("StAssociationMaker"); //if( mode & 0x2){ // EMC specific cout << " EMC mode enabled" << endl; gSystem->Load("StEmcUtil"); gSystem->Load("StDbLib"); gSystem->Load("StDbBroker"); gSystem->Load("St_db_Maker"); //} if( mode & 0x4){ // RICH cout << " RICH mode enabled" << endl; gSystem->Load("StRrsMaker"); gSystem->Load("StRchMaker"); gSystem->Load("StRichPIDMaker"); gSystem->Load("StRichSpectraMaker"); } gSystem->Load("StMcAnalysisMaker"); gSystem->Load("StStrangeMuDstMaker"); gSystem->Load("StMuDSTMaker"); if( mode & 0x2 ){ // EMC specific gSystem->Load("StEmcADCtoEMaker"); // analysis maker gSystem->Load("StPreEclMaker"); // analysis maker gSystem->Load("StEpcMaker"); // analysis maker } cout << "Loading done " << endl; chain = new StChain("StChain"); chain->SetDebug(); StFile *setFiles= new StFile(); for (int ifil=0; fileList[ifil]; ifil++) setFiles->AddFile(fileList[ifil]); // ******************************** // Now we add Makers to the chain... // ******************************** // ************* // file handling // ************* StIOMaker* ioMaker = new StIOMaker("IOMaker","r",setFiles,"bfcTree"); ioMaker->SetDebug(); ioMaker->SetIOMode("r"); ioMaker->SetDebug(); ioMaker->SetBranch("*",0,"0"); //deactivate all branches ioMaker->SetBranch("eventBranch",0,"r"); //activate evt.root Branch ioMaker->SetBranch("emcBranch",0,"r"); //activate evt.root Branch ioMaker->SetBranch("runcoBranch",0,"r"); //activate runcoBranch // *********************************************** // MuDstMaker(s) instantiation / chain activation // *********************************************** // Common MuDST part StStrangeMuDstMaker* v0dst = new StStrangeMuDstMaker("strangeMuDst"); v0dst->DoV0(); //Set v0MiniDstMaker to find only v0s v0dst->DoXi(); //Set v0MiniDstMaker to find only v0s v0dst->DoKink(); //Set v0MiniDstMaker to find only v0s v0dst->SetNoKeep(); // RICH part if( mode & 0x4 ){ StRichSpectraMaker* spectraMaker = new StRichSpectraMaker("spectraMaker"); } StAddRunInfoMaker* addRunInfoMaker = new StAddRunInfoMaker(); StMuDstMaker* maker = new StMuDstMaker(1,1,dirName); // You can change the PIDTable map using the above method. //maker->setProbabilityPidFile("Path/PIDTable.root"); maker->setProbabilityPidFile(); StMuL3Filter* l3Filter = new StMuL3Filter(); maker->setL3TrackFilter(l3Filter); StMuFilter* filter = new StMuFilter(); maker->setTrackFilter(filter); // EMC part if( mode & 0x2){ St_db_Maker *dbMk = new St_db_Maker("StarDb","MySQL:StarDb"); StEmcADCtoEMaker *adc = new StEmcADCtoEMaker(); StPreEclMaker *pre = new StPreEclMaker(); StEpcMaker *epc = new StEpcMaker(); StEmcMicroDstMaker *write = new StEmcMicroDstMaker(); write->setOutputDir(dirName); } if ( fsti == 1){ //select for Sti tracks filter->addEncodedMethod(263); } // This should call the Init() method in ALL makers chain->Init(); chain->PrintInfo(); // Event Loop Int_t iev=0; for ( ; iev < nevents ; iev++) { cout << "-----> Working on eventNumber " << iev << endl; chain->Clear(); int iret = chain->Make(iev); // This should call the Make() method in ALL makers if (iret) { cout << "Bad return code!" << endl; break; } } chain->Finish(); // This should call the Finish() method in ALL makers iev--; cout << endl << "******************* Last event processed = " << iev << endl; }
void bfcread_histBranch( Int_t nevents=1, const char *MainFile= "/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root", const char *fname="qa_hist.out") { // cout << " events to process = " << nevents << endl; cout << " Input File Name = " << MainFile << endl; cout << " Output file containing printouts = " << fname << endl; ofstream fout(fname); fout << " Running: bfcread_histBranch.C " << endl; fout << " events to process = " << nevents << endl; fout << " Input File Name = " << MainFile << endl; fout << " Output file containing printouts = " << fname << endl; fout << endl << endl; gSystem->Load("St_base"); gSystem->Load("StChain"); gSystem->Load("StIOMaker"); gSystem->Load("libglobal_Tables"); // Setup top part of chain chain = new StChain("bfc"); chain->SetDebug(); StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,"bfcTree"); IOMk->SetDebug(); IOMk->SetIOMode("r"); IOMk->SetBranch("*",0,"0"); //deactivate all branches IOMk->SetBranch("histBranch",0,"r"); //activate hist Branch // --- now execute chain member functions chain->Init(); TDataSet *ds=0; TDataSet *obj=0; int istat=0; int i=0; int countev=0; int countevhds=0; // Event loop EventLoop: if (i < nevents && !istat) { chain->Clear(); istat = chain->Make(i); // count # times Make is called i++; // Now look at the data in the event: int countObj=0; int countHist=0; if (!istat) { countev++; cout << " start event # " << countev << endl; ds=chain->GetDataSet("hist"); TDataSetIter tabiter(ds); if (ds) { countevhds++; TDataSetIter nextHistList(ds); St_ObjectSet *histContainer = 0; TList *dirList = 0; // loop over directories: while (histContainer = (St_ObjectSet *)nextHistList()) { dirList = (TList *) histContainer->GetObject(); cout << " QAInfo: found directory: " << histContainer->GetName() << endl; fout << " QAInfo: found directory: " << histContainer->GetName() << endl; countObj++; // Notes for future reference (if we want to generalize this...) // dirList is returned 0 for non-histogram file // in that case, use GetList instead of GetObject TIter nextHist(dirList); TObject *o = 0; // loop over histograms in the directory: while (o= nextHist()) { countHist++; cout << " QAInfo: Hist name: " << o->GetName() << " ==> Title: " << o->GetTitle() << endl; fout << " QAInfo: Hist name: " << o->GetName() << " ==> Title: " << o->GetTitle() << endl; } // nextHist } // histContainer } // ds cout << " QAInfo: event # " << countev << ", # directories found = " << countObj << ", # hist found = " << countHist << endl << endl; fout << " QAInfo: event # " << countev << ", # directories found = " << countObj << ", # hist found = " << countHist << endl << endl; } // istat else // if (istat) { cout << "Last event processed. Status = " << istat << endl; } goto EventLoop; } //EventLoop cout << endl; cout << "QAInfo: End of Job " << endl; cout << "QAInfo: # times Make called = " << i << endl; cout << "QAInfo: # events read = " << countev << endl; cout << "QAInfo: # events with hist dataset = " << countevhds << endl; fout << endl; fout << "QAInfo: End of Job " << endl; fout << "QAInfo: # times Make called = " << i << endl; fout << "QAInfo: # events read = " << countev << endl; fout << "QAInfo: # events with hist dataset = " << countevhds << endl; chain->Finish(); }