]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/AliRICHClusterFinder.cxx
Replacing array of objects by array of pointers
[u/mrichter/AliRoot.git] / RICH / AliRICHClusterFinder.cxx
index 6e5b97ca6fbccddaf3912d486369da5ef18114b7..875cc7a24678a011ccf571c2e1e22af8ee542f8d 100644 (file)
@@ -54,7 +54,7 @@ void AliRICHClusterFinder::Exec(const Option_t *)
     R()->GetLoader()->GetRunLoader()->GetEvent(iEventN);
     
     R()->GetLoader()->MakeTree("R");  R()->MakeBranch("R");
-    R()->ResetDigits();               R()->ClustersReset();
+    R()->DigitsReset();               R()->ClustersReset();
     
     R()->GetLoader()->TreeD()->GetEntry(0);
     for(Int_t iChamber=1;iChamber<=kNchambers;iChamber++){//chambers loop
@@ -63,7 +63,7 @@ void AliRICHClusterFinder::Exec(const Option_t *)
     R()->GetLoader()->TreeR()->Fill();  R()->GetLoader()->WriteRecPoints("OVERWRITE");//write out clusters for current event
   }//events loop  
   
-  R()->ResetDigits();//reset and unload everything
+  R()->DigitsReset();//reset and unload everything
   R()->ClustersReset();
   R()->GetLoader()                ->UnloadDigits(); 
   R()->GetLoader()                ->UnloadRecPoints();  
@@ -134,8 +134,10 @@ void AliRICHClusterFinder::FindClusterContribs(AliRICHCluster *pCluster)
   for(Int_t iDigN=0;iDigN<3*pCluster->Size()-1;iDigN++) {//loop on digits to sort tids
     AliDebug(1,Form("%4i for digit n. %4i",contribs[pindex[iDigN]],iDigN));
     if(contribs[pindex[iDigN]]!=contribs[pindex[iDigN+1]]) {
-      TParticle* particle = pStack->Particle(contribs[pindex[iDigN]]);
-      if (!particle) continue;
+      Int_t thecontrib = contribs[pindex[iDigN]];
+      if (thecontrib>=pStack->GetNtrack()) continue;//PH this should not happen 
+      TParticle* particle = pStack->Particle(thecontrib);
+      if (!particle) continue;//PH this should not happen
       Int_t code   = particle->GetPdgCode();
       Double_t charge = 0;
       if(particle->GetPDG()) charge=particle->GetPDG()->Charge();
@@ -148,15 +150,22 @@ void AliRICHClusterFinder::FindClusterContribs(AliRICHCluster *pCluster)
   }//loop on digits to sort Tid
   
   if (contribs[pindex[3*pCluster->Size()-1]]!=-1) {
+     Int_t thecontrib = contribs[pindex[3*pCluster->Size()-1]];
+     if (thecontrib<pStack->GetNtrack()){
+       //PH the opposite should not happen 
 
-     TParticle* particle = pStack->Particle(contribs[pindex[3*pCluster->Size()-1]]);
-     Int_t code   = particle->GetPdgCode();
-     Double_t charge = 0;
-     if(particle->GetPDG()) charge=particle->GetPDG()->Charge();
-     AliDebug(1,Form(" charge of particle %f",charge));
-     if(code==50000050) iNckovs++;
-     if(code==50000051) iNfeeds++;
-     if(charge!=0) iNmips++;
+       TParticle* particle = pStack->Particle(thecontrib);
+       if (particle) {
+        //PH the opposite should not happen
+        Int_t code   = particle->GetPdgCode();
+        Double_t charge = 0;
+        if(particle->GetPDG()) charge=particle->GetPDG()->Charge();
+        AliDebug(1,Form(" charge of particle %f",charge));
+        if(code==50000050) iNckovs++;
+        if(code==50000051) iNfeeds++;
+        if(charge!=0) iNmips++;
+       }
+     }
   }
     
   pCluster->CFM(iNckovs,iNfeeds,iNmips);
@@ -204,11 +213,13 @@ void AliRICHClusterFinder::FindLocalMaxima()
       }
     }
     if(iNotMax==0) {
-      TVector2 x2=AliRICHParam::Pad2Loc(pad1);
-      fLocalX[fNlocals]=x2.X();fLocalY[fNlocals]=x2.Y();
-      fLocalQ[fNlocals] = (Double_t)padQ1;
-      fLocalC[fNlocals] = padC1;
-      fNlocals++;
+      if (fNlocals<100) {
+       TVector2 x2=AliRICHParam::Pad2Loc(pad1);
+       fLocalX[fNlocals]=x2.X();fLocalY[fNlocals]=x2.Y();
+       fLocalQ[fNlocals] = (Double_t)padQ1;
+       fLocalC[fNlocals] = padC1;
+       fNlocals++;
+      }
     }
   }
   AliDebug(1,Form("Number of local maxima found ---> %i",fNlocals));