Bug fix to avoid newly created and added headers for each event.
authormarkus <markus@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Apr 2007 13:04:18 +0000 (13:04 +0000)
committermarkus <markus@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 27 Apr 2007 13:04:18 +0000 (13:04 +0000)
STEER/CreateAODfromESD.C
STEER/CreateAODfromKineTree.C

index 4f1e752..25a62fe 100644 (file)
@@ -61,27 +61,30 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
     Int_t nPosTracks = 0;
     for (Int_t iTrack=0; iTrack<nTracks; ++iTrack) 
       if (esd->GetTrack(iTrack)->GetSign()> 0) nPosTracks++;
-
-    // create the header
-    aod->AddHeader(new AliAODHeader(esd->GetRunNumber(),
-                                   esd->GetBunchCrossNumber(),
-                                   esd->GetOrbitNumber(),
-                                   esd->GetPeriodNumber(),
-                                   nTracks,
-                                   nPosTracks,
-                                   nTracks-nPosTracks,
-                                   esd->GetMagneticField(),
-                                   -999., // fill muon magnetic field
-                                   -999., // centrality; to be filled, still
-                                   esd->GetZDCN1Energy(),
-                                   esd->GetZDCP1Energy(),
-                                   esd->GetZDCN2Energy(),
-                                   esd->GetZDCP2Energy(),
-                                   esd->GetZDCEMEnergy(),
-                                   esd->GetTriggerMask(),
-                                   esd->GetTriggerCluster(),
-                                   esd->GetEventType()));
-
+    
+    // Access to the header
+    AliAODHeader *header = aod->GetHeader();
+
+    // fill the header
+    *header = AliAODHeader(esd->GetRunNumber(),
+                          esd->GetBunchCrossNumber(),
+                          esd->GetOrbitNumber(),
+                          esd->GetPeriodNumber(),
+                          nTracks,
+                          nPosTracks,
+                          nTracks-nPosTracks,
+                          esd->GetMagneticField(),
+                          -999., // fill muon magnetic field
+                          -999., // centrality; to be filled, still
+                          esd->GetZDCN1Energy(),
+                          esd->GetZDCP1Energy(),
+                          esd->GetZDCN2Energy(),
+                          esd->GetZDCP2Energy(),
+                          esd->GetZDCEMEnergy(),
+                          esd->GetTriggerMask(),
+                          esd->GetTriggerCluster(),
+                          esd->GetEventType());
+  
     Int_t nV0s      = esd->GetNumberOfV0s();
     Int_t nCascades = esd->GetNumberOfCascades();
     Int_t nKinks    = esd->GetNumberOfKinks();
@@ -90,7 +93,6 @@ void CreateAODfromESD(const char *inFileName = "AliESDs.root",
     aod->ResetStd(nTracks, nVertices);
     AliAODTrack *aodTrack;
     
-
     // Array to take into account the tracks already added to the AOD
     Bool_t * usedTrack = NULL;
     if (nTracks>0) {
index 0e2bb3f..236ee17 100644 (file)
@@ -121,29 +121,29 @@ void CreateAODfromKineTree(const char *inFileName,
     nKPlus = 0;
     nKMinus = 0;
 
-    // create the header
-    aod->AddHeader(new AliAODHeader(aliHeader->GetRun(),
-                                   0, // bunchX number
-                                   0, // orbit number
-                                   0, // period number
-                                   nTracks,
-                                   nPos,
-                                   nNeg,
-                                   -999, // mag. field
-                                   -999., // muon mag. field
-                                   -999., // centrality
-                                   -999, // ZDCN1Energy
-                                   -999, // ZDCP1Energy
-                                   -999, // ZDCN2Energy
-                                   -999, // ZDCP2Energy
-                                   -999, // ZDCEMEnergy
-                                   0, // TriggerMask
-                                   0, // TriggerCluster
-                                   0)); // EventType
-    
     // Access to the header
     AliAODHeader *header = aod->GetHeader();
 
+    // fill the header
+    *header = AliAODHeader(aliHeader->GetRun(),
+                          0, // bunchX number
+                          0, // orbit number
+                          0, // period number
+                          nTracks,
+                          nPos,
+                          nNeg,
+                          -999, // mag. field
+                          -999., // muon mag. field
+                          -999., // centrality
+                          -999, // ZDCN1Energy
+                          -999, // ZDCP1Energy
+                          -999, // ZDCN2Energy
+                          -999, // ZDCP2Energy
+                          -999, // ZDCEMEnergy
+                          0, // TriggerMask
+                          0, // TriggerCluster
+                          0); // EventType
+  
     // Access to the AOD container of vertices
     TClonesArray &vertices = *(aod->GetVertices());
     jVertices=0;