]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HBTAN/AliHBTReaderITSv1.cxx
CRAB added
[u/mrichter/AliRoot.git] / HBTAN / AliHBTReaderITSv1.cxx
index da5418ab0c1c39038ed484e8911c7cfac39fde7e..82c3e3360f106a0df221df2905c694fa28f1c704 100644 (file)
@@ -5,7 +5,7 @@
 #include "AliHBTParticle.h"
 #include "AliHBTParticleCut.h"
 
-#include <iostream.h>
+#include <Riostream.h>
 
 #include <TROOT.h>
 #include <TFile.h>
@@ -20,6 +20,7 @@
 #include <AliMagF.h>
 #include <AliKalmanTrack.h>
 #include <AliITSIOTrack.h>
+#include "AliMC.h"
 
 ClassImp(AliHBTReaderITSv1)
 /********************************************************************/
@@ -132,14 +133,6 @@ Int_t AliHBTReaderITSv1::Read(AliHBTRun* particles, AliHBTRun *tracks)
        delete iotrack;
        return 1;
     }
-   TFile *file = OpenTrackFile(currentdir);
-   if(file == 0x0)
-    {
-       Error("Read","Can not open the file with ITS tracks V1");
-       delete iotrack;
-       return 2;
-    }
-   
    if (gAlice->TreeE())//check if tree E exists
      {
       Nevents = (Int_t)gAlice->TreeE()->GetEntries();//if yes get number of events in gAlice
@@ -154,6 +147,14 @@ Int_t AliHBTReaderITSv1::Read(AliHBTRun* particles, AliHBTRun *tracks)
        delete iotrack;
        return 4;
      }
+
+   TFile *file = OpenTrackFile(currentdir);
+   if(file == 0x0)
+    {
+       Error("Read","Can not open the file with ITS tracks V1");
+       delete iotrack;
+       return 2;
+    }
     
    Int_t naccepted = 0;
    char tname[30];
@@ -170,7 +171,7 @@ Int_t AliHBTReaderITSv1::Read(AliHBTRun* particles, AliHBTRun *tracks)
       
       gAliceFile->cd();
       gAlice->GetEvent(currentEvent);
-      gAlice->Particles();
+      gAlice->GetMCApp()->Particles();
 
       Int_t nentr=(Int_t)tracktree->GetEntries();
       
@@ -186,9 +187,9 @@ Int_t AliHBTReaderITSv1::Read(AliHBTRun* particles, AliHBTRun *tracks)
         if (label < 0) 
          {
            continue;
-           delete iotrack;
          }
-        TParticle *p = (TParticle*)gAlice->Particle(label);
+
+        TParticle *p = (TParticle*)gAlice->GetMCApp()->Particle(label);
         if(!p)
          {
            Warning("Read","Can not get particle with label &d",label);
@@ -197,7 +198,7 @@ Int_t AliHBTReaderITSv1::Read(AliHBTRun* particles, AliHBTRun *tracks)
         if(Pass(p->GetPdgCode())) continue; //check if we are intersted with particles of this type
                                            //if not take next partilce
 
-        AliHBTParticle* part = new AliHBTParticle(*p);
+        AliHBTParticle* part = new AliHBTParticle(*p,i);
         if(Pass(part)) { delete part; continue;}//check if meets all criteria of any of our cuts
                                                 //if it does not delete it and take next good track
         
@@ -211,7 +212,7 @@ Int_t AliHBTReaderITSv1::Read(AliHBTRun* particles, AliHBTRun *tracks)
         Double_t y= iotrack->GetY();
         Double_t z= iotrack->GetZ();
         
-        AliHBTParticle* track = new AliHBTParticle(p->GetPdgCode(), px, py , pz, tEtot, x, y, z, 0.);
+        AliHBTParticle* track = new AliHBTParticle(p->GetPdgCode(), i, px, py , pz, tEtot, x, y, z, 0.);
         if(Pass(track)) { delete  track;continue;}//check if meets all criteria of any of our cuts
                                                   //if it does not delete it and take next good track