]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDRecon.cxx
Optimized version (Jimmy)
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDRecon.cxx
index ce974bd4a8415a70826b4706350006cb25654922..0e832ebba7efb30e7bef5bbaf514f9e3941aeaed 100644 (file)
@@ -60,7 +60,7 @@ void AliHMPIDRecon::InitVars(Int_t n)
 //..
 //Init some variables
 //..
-  if(n<0) return;
+  if(n<=0) return;
   fPhotFlag = new Int_t[n];
   fPhotCkov = new Double_t[n];
   fPhotPhi  = new Double_t[n];
@@ -73,13 +73,13 @@ void AliHMPIDRecon::DeleteVars()const
 //..
 //Delete variables
 //..
-  delete fPhotFlag;
-  delete fPhotCkov;
-  delete fPhotPhi;
-  delete fPhotWei;
+  delete [] fPhotFlag;
+  delete [] fPhotCkov;
+  delete [] fPhotPhi;
+  delete [] fPhotWei;
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Int_t index,Double_t nmean)
+void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Int_t index,Double_t nmean,Float_t xRa,Float_t yRa)
 {
 // Pattern recognition method based on Hough transform
 // Arguments:   pTrk     - track for which Ckov angle is to be found
@@ -95,8 +95,8 @@ void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Int_t inde
 
   InitVars(nClusTot);
   
-  Float_t xRa,yRa,th,ph;
-  pTrk->GetHMPIDtrk(xRa,yRa,th,ph);        //initialize this track: th and ph angles at middle of RAD 
+  Float_t xPc,yPc,th,ph;
+  pTrk->GetHMPIDtrk(xPc,yPc,th,ph);        //initialize this track: th and ph angles at middle of RAD 
   SetTrack(xRa,yRa,th,ph);
 
   fParam->SetRefIdx(nmean);
@@ -107,8 +107,8 @@ void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Int_t inde
   fPhotCnt=0;
   
   for (Int_t iClu=0; iClu<pCluLst->GetEntriesFast();iClu++){//clusters loop
-    AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu);                     //get pointer to current cluster    
-    if(iClu == index) {                                                                     // this is the MIP! not a photon candidate: just store mip info
+    AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu);                       //get pointer to current cluster    
+    if(iClu == index) {                                                                       // this is the MIP! not a photon candidate: just store mip info
       mipX = pClu->X();
       mipY = pClu->Y();
       mipQ=(Int_t)pClu->Q();
@@ -117,18 +117,18 @@ void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Int_t inde
     }
     chId=pClu->Ch();
     Double_t thetaCer,phiCer;
-    if(FindPhotCkov(pClu->X(),pClu->Y(),thetaCer,phiCer)){                                  //find ckov angle for this  photon candidate
-      fPhotCkov[fPhotCnt]=thetaCer;                                                         //actual theta Cerenkov (in TRS)
-      fPhotPhi [fPhotCnt]=phiCer;                                                           //actual phi   Cerenkov (in TRS): -pi to come back to "unusual" ref system (X,Y,-Z)
-      fPhotCnt++;                                                                           //increment counter of photon candidates
+    if(FindPhotCkov(pClu->X(),pClu->Y(),thetaCer,phiCer)){                                    //find ckov angle for this  photon candidate
+      fPhotCkov[fPhotCnt]=thetaCer;                                                           //actual theta Cerenkov (in TRS)
+      fPhotPhi [fPhotCnt]=phiCer;                                                             //actual phi   Cerenkov (in TRS): -pi to come back to "unusual" ref system (X,Y,-Z)
+      fPhotCnt++;                                                                             //increment counter of photon candidates
     }
   }//clusters loop
 
-  pTrk->SetHMPIDmip(mipX,mipY,mipQ,fPhotCnt);                                                //store mip info in any case 
+  pTrk->SetHMPIDmip(mipX,mipY,mipQ,fPhotCnt);                                                 //store mip info in any case 
+  pTrk->SetHMPIDcluIdx(chId,index+1000*sizeClu);                                              //set index of cluster
   
   if(fPhotCnt<=nMinPhotAcc) {                                                                 //no reconstruction with <=3 photon candidates
     pTrk->SetHMPIDsignal(kNoPhotAccept);                                                      //set the appropriate flag
-    pTrk->SetHMPIDcluIdx(chId,index+1000*sizeClu);                                            //set index of cluster
     return;
   }