]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/CreateAODfromESD.C
Some more classes moved from libSTEER to libSTEERBase.
[u/mrichter/AliRoot.git] / STEER / CreateAODfromESD.C
index bd75e41d107103d34755b566b727511546eabfc6..26c5fa933878f43a81c12cf8deffd5e00eba3ba6 100644 (file)
@@ -10,8 +10,9 @@
 #include "AliAODVertex.h"
 #include "AliAODTrack.h"
 #include "AliAODCluster.h"
+#include "AliAODTracklets.h"
 
-#include "AliESD.h"
+#include "AliESDEvent.h"
 #include "AliESDtrack.h"
 #include "AliESDMuonTrack.h"
 #include "AliESDVertex.h"
@@ -32,13 +33,13 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
   TFile *outFile = TFile::Open(outFileName, "RECREATE");
 
   // create the tree
-  TTree *aodTree = new TTree("AOD", "AliAOD tree");
+  TTree *aodTree = new TTree("aodTree", "AliAOD tree");
   aodTree->Branch(aod->GetList());
 
   // connect to ESD
   TFile *inFile = TFile::Open(inFileName, "READ");
   TTree *t = (TTree*) inFile->Get("esdTree");
-  AliESD *esd = new AliESD();
+  AliESDEvent *esd = new AliESDEvent();
   esd->ReadFromTree(t);
 
   Int_t nEvents = t->GetEntries();
@@ -59,7 +60,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
     Int_t nTracks   = esd->GetNumberOfTracks();
     Int_t nPosTracks = 0;
     for (Int_t iTrack=0; iTrack<nTracks; ++iTrack) 
-      if (esd->GetTrack(iTrack)->GetSign()> 0) nPosTracks++;
+      if (esd->GetTrack(iTrack)->Charge()> 0) nPosTracks++;
     
     // Access to the header
     AliAODHeader *header = aod->GetHeader();
@@ -224,7 +225,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
                                           pos,
                                           kFALSE,
                                           covTr, 
-                                          (Short_t)esdTrack->GetSign(),
+                                          (Short_t)esdTrack->Charge(),
                                           esdTrack->GetITSClusterMap(), 
                                           pid,
                                           vV0FromCascade,
@@ -259,7 +260,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
                                           pos,
                                           kFALSE,
                                           covTr, 
-                                          (Short_t)esdTrack->GetSign(),
+                                          (Short_t)esdTrack->Charge(),
                                           esdTrack->GetITSClusterMap(), 
                                           pid,
                                           vV0FromCascade,
@@ -296,7 +297,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
                                           pos,
                                           kFALSE,
                                           covTr, 
-                                          (Short_t)esdTrack->GetSign(),
+                                          (Short_t)esdTrack->Charge(),
                                           esdTrack->GetITSClusterMap(), 
                                           pid,
                                           vcascade,
@@ -357,7 +358,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
                                           pos,
                                           kFALSE,
                                           covTr, 
-                                          (Short_t)esdTrack->GetSign(),
+                                          (Short_t)esdTrack->Charge(),
                                           esdTrack->GetITSClusterMap(), 
                                           pid,
                                           vV0,
@@ -392,7 +393,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
                                           pos,
                                           kFALSE,
                                           covTr, 
-                                          (Short_t)esdTrack->GetSign(),
+                                          (Short_t)esdTrack->Charge(),
                                           esdTrack->GetITSClusterMap(), 
                                           pid,
                                           vV0,
@@ -478,7 +479,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
                                           pos,
                                           kFALSE,
                                           covTr, 
-                                          (Short_t)esdTrack->GetSign(),
+                                          (Short_t)esdTrack->Charge(),
                                           esdTrack->GetITSClusterMap(), 
                                           pid,
                                           primary,
@@ -524,7 +525,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
                                           pos,
                                           kFALSE,
                                           covTr, 
-                                          (Short_t)esdTrack->GetSign(),
+                                          (Short_t)esdTrack->Charge(),
                                           esdTrack->GetITSClusterMap(), 
                                           pid,
                                           vkink,
@@ -576,7 +577,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
                                         pos,
                                         kFALSE,
                                         covTr, 
-                                        (Short_t)esdTrack->GetSign(),
+                                        (Short_t)esdTrack->Charge(),
                                         esdTrack->GetITSClusterMap(), 
                                         pid,
                                         primary,
@@ -596,7 +597,7 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
                                         pos,
                                         kFALSE,
                                         covTr, 
-                                        (Short_t)esdTrack->GetSign(),
+                                        (Short_t)esdTrack->Charge(),
                                         esdTrack->GetITSClusterMap(), 
                                         pid,
                                         NULL,
@@ -630,12 +631,12 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
                                             pos,
                                             kFALSE,
                                             NULL, // no covariance matrix provided
-                                            (Short_t)-99, // no charge provided
-                                            0, // no ITSClusterMap
+                                            esdMuTrack->Charge(),
+                                            0, // ITSClusterMap is set below
                                             pid,
                                             primary,
-                                            kTRUE,  // check if this is right
-                                            kTRUE,  // not used for vertex fit
+                                            kFALSE,  // muon tracks are not used to fit the primary vtx
+                                            kFALSE,  // not used for vertex fit
                                             AliAODTrack::kPrimary)
          );
        aodTrack->SetHitsPatternInTrigCh(esdMuTrack->GetHitsPatternInTrigCh());
@@ -688,6 +689,20 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
 
     } // end of loop on calo clusters
 
+    // tracklets
+    const AliMultiplicity *mult = esd->GetMultiplicity();
+    if (mult) {
+      if (mult->GetNumberOfTracklets()>0) {
+       aod->GetTracklets()->CreateContainer(mult->GetNumberOfTracklets());
+
+       for (Int_t n=0; n<mult->GetNumberOfTracklets(); n++) {
+         aod->GetTracklets()->SetTracklet(n, mult->GetTheta(n), mult->GetPhi(n), mult->GetDeltaPhi(n), mult->GetLabel(n));
+       }
+      }
+    } else {
+      Printf("ERROR: AliMultiplicity could not be retrieved from ESD");
+    }
+
     delete [] usedTrack;
     delete [] usedV0;
     delete [] usedKink;