]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HBTAN/AliHBTReaderInternal.cxx
Bug correction
[u/mrichter/AliRoot.git] / HBTAN / AliHBTReaderInternal.cxx
index 5b25c1a2d45ff4370024abebab0c7eca087764e4..49ad66c367df2d8cac8d230c96600997ff6bcd76 100644 (file)
@@ -1,4 +1,19 @@
 #include "AliHBTReaderInternal.h"
+//_________________________________________________________________________
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// class AliHBTReaderInternal                                            //
+//                                                                       //
+// Multi file reader for Internal Data Format                            //
+//                                                                       //
+// This reader reads data created by itself                              //
+//   (method AliHBTReaderInternal::Write)                                //
+// Data are stored in form of tree of TClonesArray of AliHBTParticle's   //
+//                                                                       //
+// Piotr.Skowronski@cern.ch                                              //
+// more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html  //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
 
 #include <TTree.h>
 #include <TFile.h>
@@ -22,7 +37,9 @@ AliHBTReaderInternal::AliHBTReaderInternal():
  fPartBranch(0x0),
  fTrackBranch(0x0),
  fTree(0x0),
- fFile(0x0)
+ fFile(0x0),
+ fPartBuffer(0x0),
+ fTrackBuffer(0x0)
 {
 //Defalut constructor
 }
@@ -33,7 +50,9 @@ AliHBTReaderInternal::AliHBTReaderInternal(const char *filename):
  fPartBranch(0x0),
  fTrackBranch(0x0),
  fTree(0x0),
- fFile(0x0)
+ fFile(0x0),
+ fPartBuffer(0x0),
+ fTrackBuffer(0x0)
 { 
 //constructor 
 //filename - name of file to open
@@ -46,7 +65,9 @@ AliHBTReaderInternal::AliHBTReaderInternal(TObjArray* dirs, const char *filename
  fPartBranch(0x0),
  fTrackBranch(0x0),
  fTree(0x0),
- fFile(0x0)
+ fFile(0x0),
+ fPartBuffer(0x0),
+ fTrackBuffer(0x0)
 { 
 //ctor
 //dirs contains strings with directories to look data in
@@ -127,6 +148,8 @@ Int_t AliHBTReaderInternal::ReadNext()
     counter = 0;  
     if (fPartBranch && fTrackBranch)
      {
+       Info("ReadNext","Found %d tracks in total.",fTrackBuffer->GetEntries());        
+       Info("ReadNext","Found %d particles in total.",fPartBuffer->GetEntries());
        for(i = 0; i < fPartBuffer->GetEntries(); i++)
          {
            tpart = dynamic_cast<AliHBTParticle*>(fPartBuffer->At(i));
@@ -134,30 +157,42 @@ Int_t AliHBTReaderInternal::ReadNext()
 
            if( tpart == 0x0 ) continue; //if returned pointer is NULL
            if( ttrack == 0x0 ) continue; //if returned pointer is NULL
-
+           
+           if (AliHBTParticle::GetDebug() > 9)
+            {
+              Info("ReadNext","Particle:");
+              tpart->Print();
+              Info("ReadNext","Track:");
+              ttrack->Print();
+            }
            if (ttrack->GetUID() != tpart->GetUID())
              {
                Error("ReadNext","Sth. is wrong: Track and Particle has different UID.");
                Error("ReadNext","They probobly do not correspond to each other.");
              }
-
+           
            for (Int_t s = 0; s < ttrack->GetNumberOfPids(); s++)
             {
-              if( pdgdb->GetParticle(ttrack->GetNthPid(s)) == 0x0 ) continue; //if particle has crazy PDG code (not known to our database)
-              if( Pass(ttrack->GetNthPid(s)) ) continue; //check if we are intersted with particles of this type
-                                          //if not take next partilce
-              
-              AliHBTParticle* track = new AliHBTParticle(*ttrack);
-              
-              //apart of setting PDG code of an incarnation
-              //it is necessary tu recalculate energy on the basis of
-              //new PDG code (mass) hypothesis
+              //check if we are intersted with particles of this type
+              //if not take next partilce
+              if( Pass(ttrack->GetNthPid(s)) ) 
+               {
+                 if (AliHBTParticle::GetDebug() > 9)
+                  Info("ReadNext","Track Incarnation %d did not pass PID cut.",ttrack->GetNthPid(s));
+                 continue; 
+               }
               TParticlePDG* pdgp = pdgdb->GetParticle(ttrack->GetNthPid(s));
               if (pdgp == 0x0)//PDG part corresponding to new incarnation
                {
                  Error("ReadNext","Particle code unknown to PDG DB.");
                  continue;
                }
+              
+              AliHBTParticle* track = new AliHBTParticle(*ttrack);
+              
+              //apart of setting PDG code of an incarnation
+              //it is necessary tu recalculate energy on the basis of
+              //new PDG code (mass) hypothesis
               Double_t mass = pdgp->Mass();//mass of new incarnation
               Double_t tEtot = TMath::Sqrt( ttrack->Px()*ttrack->Px() + 
                                             ttrack->Py()*ttrack->Py() + 
@@ -170,6 +205,8 @@ Int_t AliHBTReaderInternal::ReadNext()
               
               if( Pass(track) )
                 {
+                  if (AliHBTParticle::GetDebug() > 9)
+                   Info("ReadNext","Track Incarnation %d did not pass cut.",ttrack->GetNthPid(s));
                   delete track;
                   continue; 
                 }
@@ -214,6 +251,7 @@ Int_t AliHBTReaderInternal::ReadNext()
 
      if (fTrackBranch)
       {
+        Info("ReadNext","Found %d tracks in total.",fTrackBuffer->GetEntries());       
         for(i = 0; i < fTrackBuffer->GetEntries(); i++)
          {
            ttrack =  dynamic_cast<AliHBTParticle*>(fTrackBuffer->At(i));
@@ -221,20 +259,19 @@ Int_t AliHBTReaderInternal::ReadNext()
 
            for (Int_t s = 0; s < ttrack->GetNumberOfPids(); s++)
             {
-              if( pdgdb->GetParticle(ttrack->GetNthPid(s)) == 0x0 ) continue; //if particle has crazy PDG code (not known to our database)
               if( Pass(ttrack->GetNthPid(s)) ) continue; //check if we are intersted with particles of this type
-                                          //if not take next partilce
-              AliHBTParticle* track = new AliHBTParticle(*ttrack);
-              
-              //apart of setting PDG code of an incarnation
-              //it is necessary tu recalculate energy on the basis of
-              //new PDG code (mass) hypothesis
+                                                         //if not take next partilce
               TParticlePDG* pdgp = pdgdb->GetParticle(ttrack->GetNthPid(s));
               if (pdgp == 0x0)//PDG part corresponding to new incarnation
                {
                  Error("ReadNext","Particle code unknown to PDG DB.");
                  continue;
                }
+              AliHBTParticle* track = new AliHBTParticle(*ttrack);
+              
+              //apart of setting PDG code of an incarnation
+              //it is necessary tu recalculate energy on the basis of
+              //new PDG code (mass) hypothesis
               Double_t mass = pdgp->Mass();//mass of new incarnation
               Double_t tEtot = TMath::Sqrt( ttrack->Px()*ttrack->Px() + 
                                             ttrack->Py()*ttrack->Py() + 
@@ -331,7 +368,7 @@ Int_t AliHBTReaderInternal::OpenNextFile()
 
    Info("OpenNextFile","________________________________________________________");
    Info("OpenNextFile","Found %d event(s) in directory %s",
-         (Int_t)fTree->GetEntries(),GetDirName(fCurrentEvent).Data());
+         (Int_t)fTree->GetEntries(),GetDirName(fCurrentDir).Data());
    
    fCurrentEvent = 0;