3   if ( nStations != 3 && nStations != 4 ) {
 
    4     cout << 
"WRONG number of stations, only 3 or 4 allowed." << endl;
 
   14   OutputFile.Form(
"Gem_%dStations_%gGeV_n%d",nStations,momentum,
nEvents);
 
   15   TString ParOutputFile=OutputFile;
 
   17   ParOutputFile+=
"_par.root";
 
   21   TString  MediaFile      = 
"media_pnd.geo";
 
   26   FairRunSim *
fRun = 
new FairRunSim();
 
   27   fRun->SetName(SimEngine.Data() );
 
   28   fRun->SetOutputFile(OutputFile.Data());
 
   29   fRun->SetBeamMom(BeamMomentum);
 
   30   fRun->SetMaterials(MediaFile.Data());
 
   31   fRun->SetUseFairLinks(kTRUE);
 
   32   FairRuntimeDb *
rtdb=fRun->GetRuntimeDb();
 
   36   FairParRootFileIo* 
output=
new FairParRootFileIo(kParameterMerged);
 
   37   output->open(ParOutputFile.Data());
 
   38   rtdb->setOutput(output);
 
   44   Cave->SetGeometryFileName(
"pndcave.geo");
 
   45   fRun->AddModule(Cave);
 
   48    Pipe->SetGeometryFileName(
"pipebeamtarget.geo");
 
   49    fRun->AddModule(Pipe);
 
   52    Magnet->SetGeometryFileName(
"FullSolenoid.root");
 
   53    fRun->AddModule(Magnet);
 
   55    FairModule *dipole= 
new PndMagnet(
"MAGNET");
 
   56    dipole->SetGeometryFileName(
"dipole.geo");
 
   57    fRun->AddModule(dipole);
 
   61    Gem->SetGeometryFileName(Form(
"gem_%dStations_realistic_v1.root",nStations));
 
   62    Gem->SetVerboseLevel(0);
 
   66   FairPrimaryGenerator* 
primGen = 
new FairPrimaryGenerator();
 
   67   fRun->SetGenerator(primGen);
 
   73   FairBoxGenerator* 
boxGen = 
new FairBoxGenerator(13,1);
 
   74    boxGen->SetThetaRange(0.,30.);
 
   75    boxGen->SetPhiRange  (0.,360.);
 
   76    boxGen->SetPRange    (0.05,10.);
 
   77    primGen->AddGenerator(boxGen);
 
   83   fRun->SetField(fField);
 
   87   fRun->SetStoreTraj(kFALSE);
 
   89   fRun->SetRadLenRegister(kFALSE);
 
  104   printf(
"RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime);
 
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
FairParRootFileIo * output
FairPrimaryGenerator * primGen
FairBoxGenerator * boxGen
Int_t gem_sim(Int_t nStations, Double_t momentum=15., Int_t nEvents=1000, int verboseLevel=0)