// Macro created by Radoslaw Karabowicz // This macro takes the digis and find hits Int_t gem_tracks(char* type="local",Int_t nFiles = 11, Int_t sleep=0) { if ( nFiles < 1 || nFiles > 16 ) { cout << "nFiles set to " << nFiles << ", should be in range (1,11)" << endl; } Int_t nEvents = 0; for ( Int_t iev = 1000 ; iev <= 900+nFiles*100 ; iev+=100 ) { nEvents += iev; } cout << "RUNNING \"" << type << "\" FOR " << nEvents << " EVENTS" << endl; TStopwatch* timer = new TStopwatch(); timer->Start(); TString ddd = "adg"; Int_t nStations = 3; Double_t momentum = 15.; int verboseLevel = 0; if ( nStations != 3 && nStations != 4 ) { cout << "WRONG number of stations, only 3 or 4 allowed." << endl; return; } // ---- Load libraries ------------------------------------------------- gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C"); TString sysFile = gSystem->Getenv("VMCWORKDIR"); TString parFile = Form("/misc/karabowi/pandaroot_13510/trunk/macro/proof/Gem_%dStations_%gGeV_n1000_par.root",nStations,momentum,nEvents,type); TString outFile = Form("/misc/karabowi/pandaroot_13510/trunk/macro/proof/Gem_%dStations_%gGeV_n%d_tracks_%s.root",nStations,momentum,nEvents,type); // ----- Reconstruction run ------------------------------------------- FairRunAna *fRun= new FairRunAna(); fRun->SetOutputFile(outFile.Data()); fRun->SetInputFile(Form("/misc/karabowi/pandaroot_13510/trunk/macro/proof/Gem_%dStations_%gGeV_n1000_digi.root",nStations,momentum)); for ( Int_t ifile = 1 ; ifile < nFiles ; ifile++ ) { cout << "adding file with " << 1000+ifile*100 << " events" << endl; fRun->AddFile(Form("/misc/karabowi/pandaroot_13510/trunk/macro/proof/Gem_%dStations_%gGeV_n%d_digi.root",nStations,momentum,1000+ifile*100)); } // ----- Parameter database -------------------------------------------- TString allDigiFile = sysFile+"/macro/params/gem_3Stations.digi.par"; if ( nStations == 4 ) allDigiFile = sysFile+"/macro/params/gem_4Stations.digi.par"; FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(parFile.Data()); FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo(); parIo1->open(allDigiFile.Data(),"in"); rtdb->setFirstInput(parInput1); rtdb->setSecondInput(parIo1); // ------------------------------------------------------------------------ // ----- GEM Hit Finder ----------------------------------------------- PndGemFindHits* gemFindHits = new PndGemFindHits("GEM Hit Finder", verboseLevel); gemFindHits->SetSleep(sleep); fRun->AddTask(gemFindHits); //------ Track finder ------------------------------ //Create and add finder task PndGemFindTracks* finderTask = new PndGemFindTracks("PndGemFindTracks"); finderTask->SetUseHitOrDigi("hit"); // hit = (default), digi fRun->AddTask(finderTask); //------ Realistic Track finder -------------------- //PndGemTrackFinderDummy* mcTrackFinder = new PndGemTrackFinderDummy(); PndGemTrackFinderOnHits* mcTrackFinder = new PndGemTrackFinderOnHits(); mcTrackFinder->SetVerbose(verboseLevel); // verbosity level finderTask->UseFinder(mcTrackFinder); //-------------------------------------------------- // ----- Intialise and run -------------------------------------------- fRun->Init(); // timer.Stop(); // timer.Print(); // timer.Continue(); TString typeString = type; if ( typeString.Contains("lllll") ) fRun->Run(0,nEvents); else fRun->Run(type,0,nEvents); // ----- Finish ------------------------------------------------------- timer->Stop(); Double_t rtime = timer->RealTime(); Double_t ctime = timer->CpuTime(); cout << "Macro finished succesfully." << endl; cout << "Output file is " << outFile << endl; cout << "Parameter file is " << parFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl; cout << endl; }