void analyse(TString filename="data/test_sim.root", int nevts=0) { TStopwatch timer; timer.Start(); int verbose=0; //int canvasplot=1; //whether to plot into a ps, too. gSystem->Load("libEGPythia6"); // needed for TDatabasePDG gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C"); gSystem->Load("libRho"); gSystem->Load("libPid"); gSystem->Load("libAnalysisTools"); gROOT->LoadMacro("$VMCWORKDIR/macro/mvd/Tools.C"); LoadPandaStyle(); int bins=100; double min=0,max=2.5; // GeV/c double min2=0.13,max2=0.15; double min3=1.,max3=1.5; double max4=0.3;//cm double maxchi = 50; TList* histolist = new TList(); TH1F *hMompip=new TH1F("momppip","P(#pi+);p / GeV/c",bins,min,max); TH1F *hMompim=new TH1F("momppim","P(#pi-);p / GeV/c",bins,min,max); TH1F *hMomKp=new TH1F("mompkp","P(K+);p / GeV/c",bins,min,max); TH1F *hMomKm=new TH1F("mompkm","P(K-);p / GeV/c",bins,min,max); TH1I *hTFStat=new TH1I("tfstat","Track Fit Status Flag",10,-5,5); // Add histogram pointers to a list for iterative saving & plotting //---newpage histolist->Add(hMompip); histolist->Add(hMompim); histolist->Add(hMomKp); histolist->Add(hMomKm); histolist->Add(hTFStat); // Set up the Analysis TString histoFile = InitRun(filename); PndAnalysis* theAnalysis = new PndAnalysis(); // the candidates lists we need TCandList pionp, pionm, kaonp, kaonm ,mctracks; TCandidate *tmpcand=0, *recocand=0, *mccand=0; int evts = theAnalysis->GetEntries(); if (nevts>0 && nevtsGetEvent() && ievt++FillList(mctracks,"McTruth"); theAnalysis->FillList(pionp,"PionLoosePlus"); theAnalysis->FillList(pionm,"PionLooseMinus"); theAnalysis->FillList(kaonp,"KaonLoosePlus"); theAnalysis->FillList(kaonm,"KaonLooseMinus"); if(verbose>0) printf("Event %i: TCandList sizes: pionp:%i, pionm:%i, kaonp:%i, kaonm:%i, mctracks:%i\n",ievt,pionp.GetLength(),pionm.GetLength(),kaonp.GetLength(),kaonm.GetLength(),mctracks.GetLength()); for (j=0;j0) cout<<"############## pionp\n#############"<1) std::cout<<" Pion+: "<<*recocand<GetMicroCandidate().GetFitStatus(); hTFStat->Fill(fitstat); if(fitstatP4(); momentum=tmpMom.P(); hMompip->Fill(momentum); } for (j=0;j0) cout<<"############## pionm\n#############"<1) std::cout<<" Pion-: "<<*recocand<GetMicroCandidate().GetFitStatus(); hTFStat->Fill(fitstat); if(fitstatP4(); momentum=tmpMom.P(); hMompim->Fill(momentum); } for (j=0;j0) cout<<"############## kaonp\n#############"<1) std::cout<<" K+: "<<*recocand<GetMicroCandidate().GetFitStatus(); hTFStat->Fill(fitstat); if(fitstatP4(); momentum=tmpMom.P(); hMomKp->Fill(momentum); } for (j=0;j0) cout<<"############## kaonm\n#############"<1) std::cout<<" K-: "<<*recocand<GetMicroCandidate().GetFitStatus(); hTFStat->Fill(fitstat); if(fitstatP4(); momentum=tmpMom.P(); hMomKm->Fill(momentum); } if(verbose>0) cout << " ----- event done -----"<cd(); TListIter iter(histolist); TH1* tmph=NULL; while( tmph=(TH1*)iter() ) tmph->Write(); histofile->Close(); //if(canvasplot){ //plothistos(histoFile); //} // now take the time... timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime); } TString InitRun(TString filename) { FairRunAna* fRun = new FairRunAna(); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); filename.ReplaceAll("_sim.root",".root"); PndFileNameCreator namecreator(filename.Data()); TString simFile = namecreator.GetSimFileName(); TString parFile = namecreator.GetParFileName(); TString recoFile = namecreator.GetRecoFileName(); TString tracksFile = namecreator.GetCustomFileName("pidtracks"); TString histoFile = namecreator.GetCustomFileName("histos"); TString evrdummy = namecreator.GetCustomFileName("evrdummy"); cout<<"simFile="<AddFriend(tracksFile);//,"trk"); FairParRootFileIo* parIO = new FairParRootFileIo(); parIO->open(parFile.Data()); rtdb->setFirstInput(parIO); rtdb->setOutput(parIO); TString outFile = evrdummy; TString sysFile = gSystem->Getenv("VMCWORKDIR"); fRun->SetOutputFile(outFile.Data()); FairGeane* geane = new FairGeane(); fRun->AddTask(geane); fRun->Init(); return histoFile; }