]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Corrected use of TRefArray in CaloClusters (G. Conesa)
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Jul 2008 14:02:22 +0000 (14:02 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Jul 2008 14:02:22 +0000 (14:02 +0000)
STEER/AliAODEvent.cxx

index 1d57193b27f4f46186db02a941451d1d969f5f99..72318e56e9c1ffb341ae4975709a7ae4398f9422 100644 (file)
@@ -26,7 +26,7 @@
 #include <TFriendElement.h>
 #include <TProcessID.h>
 #include <TCollection.h>
-
+#include "Riostream.h"
 #include "AliAODEvent.h"
 #include "AliAODHeader.h"
 #include "AliAODTrack.h"
@@ -348,12 +348,16 @@ Int_t AliAODEvent::GetPHOSClusters(TRefArray *clusters) const
   clusters->Clear();
   
   AliAODCaloCluster *cl = 0;
+  Bool_t first = kTRUE;
   for (Int_t i = 0; i < GetNCaloClusters() ; i++) {
-    
     if ( (cl = GetCaloCluster(i)) ) {
       if (cl->IsPHOSCluster()){
+       if(first) {
+         new (clusters) TRefArray(TProcessID::GetProcessWithUID(cl)); 
+         first=kFALSE;
+       }
        clusters->Add(cl);
-       //AliDebug(1,Form("IsPHOS cluster %d Size: %d \n",i,clusters->GetEntriesFast()));
+       //printf("IsPHOS cluster %d, E %2.3f Size: %d \n",i,cl->E(),clusters->GetEntriesFast());
       }
     }
   }
@@ -366,14 +370,18 @@ Int_t AliAODEvent::GetEMCALClusters(TRefArray *clusters) const
   // fills the provided TRefArray with all found emcal clusters
 
   clusters->Clear();
-
+  cout<<"AOD event 1: nclus "<<GetNCaloClusters()<<endl;
   AliAODCaloCluster *cl = 0;
+  Bool_t first = kTRUE;
   for (Int_t i = 0; i < GetNCaloClusters(); i++) {
-
     if ( (cl = GetCaloCluster(i)) ) {
       if (cl->IsEMCALCluster()){
+       if(first) {
+         new (clusters) TRefArray(TProcessID::GetProcessWithUID(cl)); 
+         first=kFALSE;
+       }
        clusters->Add(cl);
-       //AliDebug(1,Form("IsEMCAL cluster %d Size: %d \n",i,clusters->GetEntriesFast()));
+       //printf("IsEMCal cluster %d, E %2.3f Size: %d \n",i,cl->E(),clusters->GetEntriesFast());
       }
     }
   }