Protection added.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Aug 2008 16:14:14 +0000 (16:14 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Aug 2008 16:14:14 +0000 (16:14 +0000)
JETAN/AliUA1JetFinderV1.cxx

index b96977fce31dc54385cd16b385967d69b6faaf88..07b6da828c6714f9f23ce48f6d211d3173b797d9 100644 (file)
@@ -166,7 +166,9 @@ void AliUA1JetFinderV1::FindJets()
   Int_t nselectj = 0;
 //  printf("Found %d jets \n", nj);
   
-  TRefArray *refs = fReader->GetReferences();
+  TRefArray *refs = 0;
+  Bool_t fromAod = !strcmp(fReader->ClassName(),"AliJetAODReader");
+  if (fromAod) refs = fReader->GetReferences();
   for(Int_t kj=0; kj<nj; kj++){
      if ((etaJet[kj] > (header->GetJetEtaMax())) ||
           (etaJet[kj] < (header->GetJetEtaMin())) ||
@@ -179,9 +181,11 @@ void AliUA1JetFinderV1::FindJets()
       fJets->AddJet(px, py, pz, en);
       AliAODJet jet(px, py, pz, en);
 
-     for(Int_t jpart = 0; jpart < nIn; jpart++) // loop for all particles in array
-         if (injet[jpart] == kj && fReader->GetCutFlag(jpart) == 1)
-                  jet.AddTrack(refs->At(jpart));  // check if the particle belongs to the jet and add the ref
+      if (fromAod){
+        for(Int_t jpart = 0; jpart < nIn; jpart++) // loop for all particles in array
+          if (injet[jpart] == kj && fReader->GetCutFlag(jpart) == 1)
+                   jet.AddTrack(refs->At(jpart));  // check if the particle belongs to the jet and add the ref
+      }
       
       //jet.Print("");