]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HBTAN/AliHBTReaderESD.cxx
AliHBTParticle::fgDebug --> AliHBTParticle::GetDebug()
[u/mrichter/AliRoot.git] / HBTAN / AliHBTReaderESD.cxx
index 232b67e82329ce68d8d7c9cab797734771a2c3f3..8b9a1b5734f71e0f57369c3cabc583e5f89f732a 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()
@@ -65,7 +75,7 @@ Int_t AliHBTReaderESD::ReadNext()
   Double_t mom[3];//momentum
   Double_t pos[3];//position
   
-  if (AliHBTParticle::fgDebug)
+  if (AliHBTParticle::GetDebug())
     Info("ReadNext","Entered");
     
   TDatabasePDG* pdgdb = TDatabasePDG::Instance();
@@ -101,7 +111,7 @@ Int_t AliHBTReaderESD::ReadNext()
      AliESD* esd = dynamic_cast<AliESD*>(fFile->Get(esdname));
      if (esd == 0x0)
       {
-        if (AliHBTParticle::fgDebug > 2 )
+        if (AliHBTParticle::GetDebug() > 2 )
           {
             Info("ReadNext","Can not find ESD object named %s.",esdname.Data());
           }
@@ -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,15 +140,26 @@ Int_t AliHBTReaderESD::ReadNext()
            Error("Next","Can not get track %d", i);
            continue;
          }
+        
+        //if (esdtrack->HasVertexParameters() == kFALSE) 
+        if ((esdtrack->GetStatus() & AliESDtrack::kITSrefit) == kFALSE)
+         {
+           if (AliHBTParticle::GetDebug() > 2) 
+             Info("ReadNext","Particle skipped: Data at vertex not available.");
+           continue;
+         }
+         
         if ((esdtrack->GetStatus()&AliESDtrack::kESDpid) == kFALSE) 
          {
-           if (AliHBTParticle::fgDebug > 2) 
+           if (AliHBTParticle::GetDebug() > 2) 
              Info("ReadNext","Particle skipped: PID BIT is not set.");
            continue;
          }
-
+       
         esdtrack->GetESDpid(pidtable);
+        //esdtrack->GetVertexPxPyPz(mom[0],mom[1],mom[2]); 
         esdtrack->GetPxPyPz(mom);
+        //esdtrack->GetVertexXYZ(pos[0],pos[1],pos[2]);
         esdtrack->GetXYZ(pos);
         
         Double_t extx;
@@ -168,14 +190,14 @@ Int_t AliHBTReaderESD::ReadNext()
         for (Int_t s=0; s<AliESDtrack::kSPECIES; s++) rc+=concentr[s]*pidtable[s];
         if (rc==0.0) 
          {
-           if (AliHBTParticle::fgDebug > 2) 
+           if (AliHBTParticle::GetDebug() > 2) 
              Info("ReadNext","Particle rejected since total bayessian PID probab. is zero.");
            continue;
          }
 
         for (Int_t s=0; s<AliESDtrack::kSPECIES; s++) w[s]=concentr[s]*pidtable[s]/rc;
 
-        if (AliHBTParticle::fgDebug > 4)
+        if (AliHBTParticle::GetDebug() > 4)
          { 
            Info("ReadNext","###########################################################################");
            Info("ReadNext","Momentum: %f %f %f",mom[0],mom[1],mom[2]);
@@ -194,7 +216,7 @@ Int_t AliHBTReaderESD::ReadNext()
               msg+=")";
             }
            Info("ReadNext","%s",msg.Data());
-         }//if (AliHBTParticle::fgDebug>4)
+         }//if (AliHBTParticle::GetDebug()>4)
 
         for (Int_t s = 0; s<kNSpecies; s++)
          {
@@ -228,7 +250,7 @@ Int_t AliHBTReaderESD::ReadNext()
            if (particle) fParticlesEvent->AddParticle(particle);
            keeppart = kTRUE;
                
-           if (AliHBTParticle::fgDebug > 4 )
+           if (AliHBTParticle::GetDebug() > 4 )
             {
               Info("ReadNext","\n\nAdding Particle with incarnation %d",pdgcode);
               track->Print();
@@ -254,13 +276,13 @@ Int_t AliHBTReaderESD::ReadNext()
 /**********************************************************/
 void AliHBTReaderESD::Rewind()
 {
+  //rewinds reading 
   delete fFile;
   fFile = 0;
   delete fRunLoader;
   fCurrentDir = 0;
   fNEventsRead = 0;
   fCurrentEvent++;
-  
 }
 /**********************************************************/