2.1. Data Access ================== In order to access the data we just created a *FairRunAna* object has to be initialized with the output from the previous steps. This is done in the following lines :: // *** the files coming from the simulation TString inPidFile = "signal_pid.root"; // this file contains the PndPidCandidates and McTruth TString inParFile = "signal_par.root"; // *** PID table with selection thresholds; can be modified by the user TString pidParFile = TString(gSystem->Getenv("VMCWORKDIR")) + "/macro/params/all.par"; // *** initialization FairLogger::GetLogger()->SetLogToFile(kFALSE); FairRunAna *fRun = new FairRunAna(); FairRuntimeDb *rtdb = fRun->GetRuntimeDb(); fRun->SetSource(new FairFileSource(inPidFile)); // *** setup parameter database FairParRootFileIo *parIO = new FairParRootFileIo(); parIO->open(inParFile); FairParAsciiFileIo *parIOPid = new FairParAsciiFileIo(); parIOPid->open(pidParFile.Data(), "in"); rtdb->setFirstInput(parIO); rtdb->setSecondInput(parIOPid); rtdb->setOutput(parIO); fRun->SetSink(new FairRootFileSink("out_dummy.root")); // we create our own output .root file later, so we put here a dummy fRun->Init(); In order to actually loop through the events one needs an object ``PndAnalysis`` :: PndAnalysis* theAnalysis = new PndAnalysis (); which provides some nice functionality to access the data, inluding PID selection. You do not need to take care at all about fetching objects from the input files, since all this is done be the FairRootManager through FairRunAna internally. The actual event loop itself then looks like :: while ( theAnalysis->GetEvent() ) { ... // here your analysis code goes ... ... }