]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliV0Comparison.C
ALICE interface to Pythia8
[u/mrichter/AliRoot.git] / STEER / AliV0Comparison.C
index 392463bcf2f5714d1e8ff78f94e52eb4af788934..a06558add3e6dc34db5797de670c1cbc760267c4 100644 (file)
@@ -4,6 +4,10 @@
  *                  Creates list of "findable" V0s,                         *
  *             calculates efficiency, resolutions etc.                      *
  *                                                                          *
+ *   To get the list of the "findable" V0s, you should first get the list   *
+ *   of "findable" tracks, which can be done by running                     *
+ *   TPC/AliTPCComparison.C and ITS/AliITSComparisonV2.C macros.            *
+ *                                                                          *
  *   Origin: I.Belikov, IReS, Strasbourg, Jouri.Belikov@cern.ch             *
  ****************************************************************************/
 
@@ -14,6 +18,7 @@
   #include <TH1F.h>
   #include <TTree.h>
   #include <TParticle.h>
+  #include <TPDGCode.h>
   #include <TCanvas.h>
   #include <TLine.h>
   #include <TText.h>
@@ -27,7 +32,8 @@
   #include "AliTrackReference.h"
   #include "AliRunLoader.h"
   #include "AliRun.h"
-  #include "AliESD.h"
+  #include "AliESDEvent.h"
+  #include "AliESDv0.h"
 #endif
 
 Int_t GoodV0s(const Char_t *dir=".");
@@ -164,13 +170,13 @@ Int_t AliV0Comparison(Int_t code=310, const Char_t *dir=".") {
          return 5;
       }
    }
-   AliESD* event = new AliESD;
+   AliESDEvent* event = new AliESDEvent();
    TTree* esdTree = (TTree*) ef->Get("esdTree");
    if (!esdTree) {
       ::Error("AliV0Comparison.C", "no ESD tree found");
       return 6;
    }
-   esdTree->SetBranchAddress("ESD", &event);
+   event->ReadFromTree(esdTree);
 
 
    //******* Loop over events *********
@@ -194,6 +200,8 @@ Int_t AliV0Comparison(Int_t code=310, const Char_t *dir=".") {
       for (i=0; i<nentr; i++) {
           AliESDv0 *vertex=event->GetV0(i);
 
+          if (vertex->GetOnFlyStatus()) continue;
+
           Int_t nidx=TMath::Abs(vertex->GetNindex());
           Int_t pidx=TMath::Abs(vertex->GetPindex());
 
@@ -280,6 +288,7 @@ Int_t AliV0Comparison(Int_t code=310, const Char_t *dir=".") {
    } //**** End of the loop over events
 
    delete event;
+   delete esdTree;
    ef->Close();
    
    delete v0Tree;
@@ -474,9 +483,13 @@ Int_t GoodV0s(const Char_t *dir) {
          if (nlab<0) continue;
          if (plab<0) continue;
          Int_t i;
-         if (stack->Particle(plab)->GetPDG()->Charge() < 0.) {
-            i=plab; plab=nlab; nlab=i;
-         }
+        TParticle * part = stack->Particle(plab);
+        if (part) {
+          TParticlePDG * partPDG = part->GetPDG();
+            if (partPDG && partPDG->Charge() < 0.) {
+              i=plab; plab=nlab; nlab=i;
+            }
+        }
 
          for (i=0; i<nk; i++) {
             nref=(AliTrackReference*)itsRefs->UncheckedAt(i);