123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- #include "TROOT.h"
- #include "TSystem.h"
- #include "TChain.h"
- #include "TFile.h"
- #include "TString.h"
- #include <iostream>
- const Char_t* defaultInFile = "test.list";
- const Char_t *defaultOutFile = "test.root";
- using namespace std;
- class StFemtoDstMaker_StarGen;
- StFemtoDstMaker_StarGen *femtoMaker = NULL;
- void FemtoDstMaker_Pythia8(const Char_t* inFileList = defaultInFile,
- const Char_t* outFileName = defaultOutFile)
- {
- cout << "**************************************" << endl
- << "* FemtoDstMaker for Star Generator *" << endl
- << "* Start *" << endl
- << "**************************************" << endl
- << endl;
- //Constants, cut and initial parameters
- Float_t cParticleMom[2] = {0.1, 2.0};
- Float_t cTrackEta[2] = {-1.1, 1.1};
- //Load libraries
- cout << "Loading libraries..." << endl;
- gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
- loadSharedLibraries();
- gSystem->Load("libMinuit");
- gSystem->Load("StChain");
- gSystem->Load("StRefMultCorr");
- gSystem->Load("StFlowMaker");
- gSystem->Load("StHbtMaker");
- gSystem->Load("StPicoDstMakerRun11");
- gSystem->Load("libgsl");
- gSystem->Load("libgslcblas");
- gSystem->Load("libVMC.so");
- gSystem->Load("libStDb_Tables.so");
- gSystem->Load("libgen_Tables.so");
- gSystem->Load("libgeometry_Tables.so");
- gSystem->Load("libsim_Tables.so");
- gSystem->Load("libStarMagField.so");
- gSystem->Load("libSt_db_Maker.so");
- gSystem->Load("libSt_g2t.so");
- gSystem->Load("libSt_geant_Maker.so");
- gSystem->Load("StarGeneratorUtil.so");
- gSystem->Load("StarGeneratorEvent.so");
- gSystem->Load("StarGeneratorBase.so");
- gSystem->Load("StFemtoDstMakerSph");
- cout << "Libraries have been successfully loaded" << endl;
- //
- // Create chain
- //
- StChain *mChain = new StChain("StChain");
- femtoMaker = new StFemtoDstMaker_StarGen("", inFileList, outFileName, ".", 1e9);
- femtoMaker->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
- femtoMaker->SetTrackEta(cTrackEta[0], cTrackEta[1]);
- femtoMaker->SetPtCut(0.2);
- //
- // Chain initialization and loop over events
- //
- mChain->Init();
- Int_t mNEvents = femtoMaker->GetNEvents();
- Int_t iReturn = 0;
- Int_t mNEventsProcessed = 0;
- Float_t mPerConst = 0.05;
- Float_t mPercentCounter = 0.0;
- Float_t mProgress = 0.;
- unsigned int mSubCounter = 1; // time
- time_t mStartTime, mStopTime, mDiffTime; // time
- float mFrac; // time
- mStartTime = time(0); // time
- for (Int_t iEvent = 0; iEvent < mNEvents; iEvent++)
- {
- mProgress = (Float_t)iEvent/(Float_t)mNEvents;
- mNEventsProcessed++;
- if (mProgress >= mPercentCounter)
- {
- mPercentCounter += mPerConst;
- mStopTime = time(0);
- mDiffTime = difftime(mStopTime, mStartTime);
- mFrac = (float)mDiffTime*(float)(mNEvents - iEvent)/(float)iEvent;
- mSubCounter++;
- cout << Form("Processing progress: %4.2f%%. Time left: %.1 sec", mProgress*100., mFrac)
- << endl;
- }
- mChain->Clear();
- iReturn = mChain->Make(iEvent);
- if (iReturn != 0)
- {
- cout << "Error has been occured. Event processing has been stopped"
- << endl;
- break;
- }
- }
- mChain->Finish();
- delete femtoMaker;
- delete mChain;
- cout << "**************************************" << endl
- << "* FemtoDstMaker for Star Generator *" << endl
- << "* End *" << endl
- << "**************************************" << endl
- << endl;
- }
|