]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added better output messaging with regards to loading hepmc file.
authorbthorsbr <brian.peter.thorsbro@cern.ch>
Fri, 18 Jul 2014 15:20:43 +0000 (17:20 +0200)
committerhristov <Peter.Hristov@cern.ch>
Fri, 8 Aug 2014 14:37:53 +0000 (16:37 +0200)
EVGEN/AliGenReaderHepMC.cxx

index 628808f5fa817afb13cbe6c83240d6f1f59659d8..ddc332c8a86bbe1b8abe1f3342b59a1a3b45708a 100644 (file)
@@ -28,6 +28,13 @@ void AliGenReaderHepMC::Copy(TObject&) const
 
 void AliGenReaderHepMC::Init()
 {
+   // check if file exists, using FILE to avoid (the otherwise faster) POSIX dependencies
+   if (FILE *file = fopen(fFileName,"r"))  {
+      printf("File %s opened \n", fFileName);
+      fclose(file);
+   } else {
+      printf("Couldn't open input file: %s \n", fFileName);
+   }
    // Initialisation
    fEventsHandle = new HepMC::IO_GenEvent(fFileName, std::ios::in);
    fParticleArray = new TClonesArray("TParticle");
@@ -67,8 +74,10 @@ Int_t AliGenReaderHepMC::NextEvent()
             pdfHeader.pdf1,
             pdfHeader.pdf2
       );
+      printf("Parsed event with %d particles.\n", fGenEvent->particles_size());
       return fGenEvent->particles_size();
    }
+   printf("No more events in the file.\n");
    return 0;
 }