Added file check.
[u/mrichter/AliRoot.git] / JETAN / AliJetParticlesReaderKine.cxx
index d55939c12e8c38e8f6ef9b5f468b67737f7da598..1fb6b9533d74637743b8e935fcf250fdfb0ca44d 100644 (file)
@@ -12,6 +12,7 @@
 /////////////////////////////////////////////////////////////////////////
 
 #include <Riostream.h>
 /////////////////////////////////////////////////////////////////////////
 
 #include <Riostream.h>
+#include <TFile.h>
 #include <TString.h>
 #include <TParticle.h>
 #include <TLorentzVector.h>
 #include <TString.h>
 #include <TParticle.h>
 #include <TLorentzVector.h>
@@ -197,7 +198,7 @@ Int_t AliJetParticlesReaderKine::ReadNext()
            }
          }
        }
            }
          }
        }
-       headdesc+="Run ";
+       headdesc+=" Run ";
        headdesc+=header->GetRun();
        headdesc+=": Ev ";
        headdesc+=header->GetEventNrInRun();
        headdesc+=header->GetRun();
        headdesc+=": Ev ";
        headdesc+=header->GetEventNrInRun();
@@ -230,6 +231,7 @@ Int_t AliJetParticlesReaderKine::ReadNext()
            //}
          } else if(gentype==3){ //Pythia
            if(p->GetStatusCode()!=1) continue;
            //}
          } else if(gentype==3){ //Pythia
            if(p->GetStatusCode()!=1) continue;
+           p->SetWeight(-123); //mark particle
          }
 
          //kinematic cuts
          }
 
          //kinematic cuts
@@ -264,13 +266,14 @@ Int_t AliJetParticlesReaderKine::OpenFile(Int_t n)
     }
 
   TString filename = dirname +"/"+ fFileName;
     }
 
   TString filename = dirname +"/"+ fFileName;
-  fRunLoader = AliRunLoader::Open(filename.Data()); 
-
-  if (fRunLoader == 0)
+  TFile file(filename);
+  if ( file.IsOpen() == 0)
     {
       Error("OpenNextFile","Can't open session from file %s",filename.Data());
       return kFALSE;
     }
     {
       Error("OpenNextFile","Can't open session from file %s",filename.Data());
       return kFALSE;
     }
+  file.Close();
+  fRunLoader = AliRunLoader::Open(filename.Data()); 
   
   if (fRunLoader->GetNumberOfEvents() <= 0)
     {
   
   if (fRunLoader->GetNumberOfEvents() <= 0)
     {