]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HBTAN/AliHBTReaderESD.cxx
Using TMath instead of math.h
[u/mrichter/AliRoot.git] / HBTAN / AliHBTReaderESD.cxx
index 9ea9657f0fcfced4a19279ad664c803c981b4cb5..03f18847f9c161374c8af15d113fbc416ee755e8 100644 (file)
@@ -1,4 +1,14 @@
 #include "AliHBTReaderESD.h"
+//____________________________________________________________________
+//////////////////////////////////////////////////////////////////////
+//                                                                  //
+// class AliHBTReaderESD                                            //
+//                                                                  //
+// reader for ALICE Event Summary Data (ESD).                       //
+//                                                                  //
+// Piotr.Skowronski@cern.ch                                         //
+//                                                                  //
+//////////////////////////////////////////////////////////////////////
 
 #include <TPDGCode.h>
 #include <TString.h>
@@ -49,8 +59,8 @@ AliHBTReaderESD::AliHBTReaderESD(TObjArray* dirs,const Char_t* esdfilename, cons
 AliHBTReaderESD::~AliHBTReaderESD()
 {
  //desctructor
-  delete fFile;
   delete fRunLoader;
+  delete fFile;
 }
 /**********************************************************/
 Int_t AliHBTReaderESD::ReadNext()
@@ -109,6 +119,7 @@ Int_t AliHBTReaderESD::ReadNext()
         delete fFile;//we have to assume there is no more ESD objects in the fFile
         delete fRunLoader;
         fFile = 0x0;
+        fRunLoader = 0x0;
         continue;
       }
      AliStack* stack = 0x0;
@@ -129,16 +140,24 @@ Int_t AliHBTReaderESD::ReadNext()
            Error("Next","Can not get track %d", i);
            continue;
          }
+        
+        if (esdtrack->HasVertexParameters() == kFALSE)
+         {
+           if (AliHBTParticle::fgDebug > 2) 
+             Info("ReadNext","Particle skipped: Data at vertex not available.");
+           continue;
+         }
+         
         if ((esdtrack->GetStatus()&AliESDtrack::kESDpid) == kFALSE) 
          {
            if (AliHBTParticle::fgDebug > 2) 
              Info("ReadNext","Particle skipped: PID BIT is not set.");
            continue;
          }
-
+       
         esdtrack->GetESDpid(pidtable);
-        esdtrack->GetPxPyPz(mom);
-        esdtrack->GetXYZ(pos);
+        esdtrack->GetVertexPxPyPz(mom[0],mom[1],mom[2]);
+        esdtrack->GetVertexXYZ(pos[0],pos[1],pos[2]);
         
         Double_t extx;
         Double_t extp[5];
@@ -198,7 +217,8 @@ Int_t AliHBTReaderESD::ReadNext()
 
         for (Int_t s = 0; s<kNSpecies; s++)
          {
-           if (w[s] == 0.0) continue;
+           Float_t pp = w[s];
+           if (pp == 0.0) continue;
 
            Int_t pdgcode = charge*GetSpeciesPdgCode((ESpecies)s);
            if(Pass(pdgcode)) continue; //check if we are intersted with particles of this type 
@@ -239,7 +259,7 @@ Int_t AliHBTReaderESD::ReadNext()
       }//for (Int_t i = 0;i<ntr; i++)  -- loop over tracks
      
      Info("ReadNext","Read %d tracks and %d particles from event %d (event %d in dir %d).",
-            fParticlesEvent->GetNumberOfParticles(), fTracksEvent->GetNumberOfParticles(),
+            fTracksEvent->GetNumberOfParticles(), fParticlesEvent->GetNumberOfParticles(),
             fNEventsRead,fCurrentEvent,fCurrentDir);
       
      fCurrentEvent++;
@@ -253,13 +273,13 @@ Int_t AliHBTReaderESD::ReadNext()
 /**********************************************************/
 void AliHBTReaderESD::Rewind()
 {
+  //rewinds reading 
   delete fFile;
   fFile = 0;
   delete fRunLoader;
   fCurrentDir = 0;
   fNEventsRead = 0;
   fCurrentEvent++;
-  
 }
 /**********************************************************/