]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDCluster.cxx
Merge branch 'TPCdev' of https://git.cern.ch/reps/AliRoot into TPCdev
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDCluster.cxx
index 6e9d6b3e5e880cb1a052ca0e5cd351faba3e76ca..0265c5b619d04491933f0f341fa79e5c243fde95 100644 (file)
@@ -32,6 +32,13 @@ void AliHMPIDCluster::SetClusterParams(Double_t xL,Double_t yL,Int_t iCh  )
   //Set the cluster properties for the AliCluster3D part
   //------------------------------------------------------------------------
 
+  fParam = AliHMPIDParam::Instance();
+    
+  if(!fParam->GetInstType())               //if there is no geometry we cannot retrieve the volId (only for monitoring)
+  {
+    new(this) AliCluster3D(); return;
+  }
+  
   //Get the volume ID from the previously set PNEntry
   UShort_t volId=AliGeomManager::LayerToVolUID(AliGeomManager::kHMPID,iCh);
 
@@ -39,11 +46,7 @@ void AliHMPIDCluster::SetClusterParams(Double_t xL,Double_t yL,Int_t iCh  )
   //get L->T cs matrix for a given chamber
   const TGeoHMatrix *t2l= AliGeomManager::GetTracking2LocalMatrix(volId);
 
-  if(!fParam->GetInstType())               //if there is no geometry we cannot retrieve the volId (only for monitoring)
-  {
-    new(this) AliCluster3D(); return;
-  }
-  
+  fParam = AliHMPIDParam::Instance();
 
   //transformation from the pad cs to local
   xL -= 0.5*fParam->SizeAllX();      //size of all pads with dead zones included
@@ -74,12 +77,12 @@ void AliHMPIDCluster::SetClusterParams(Double_t xL,Double_t yL,Int_t iCh  )
                       covT[8], 
                          0x0);            // No MC labels ?
 }
-
-
-AliHMPIDCluster::~AliHMPIDCluster(){
-  if(fDigs) delete fDigs; fDigs=0;
-  }
-
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+AliHMPIDCluster::~AliHMPIDCluster()
+{
+  if(fDigs)  delete fDigs; fDigs=0;
+  //PH  if(fParam) delete fParam; fParam=0;
+}
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDCluster::CoG()
 {
@@ -119,7 +122,7 @@ void AliHMPIDCluster::CoG()
   fNlocMax=0;                                               // proper status from this method
   fSt=kCoG;
   
-  if(fParam->GetInstType()) SetClusterParams(fXX,fYY,fCh);                              //need to fill the AliCluster3D part
+  SetClusterParams(fXX,fYY,fCh);                              //need to fill the AliCluster3D part
  
 }//CoG()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -273,7 +276,7 @@ Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Int_t *pSigmaCut, Bool_t isTr
   
   if(rawSize>100 || isTryUnfold==kFALSE || rawSize==1) {                                 //No deconv if: 1 - big cluster (also avoid no zero suppression!)
                                                                                          //              2 - flag is set to FALSE
-    if(fParam->GetInstType()) SetClusterParams(fXX,fYY,fCh);                             //              3 - size = 1
+    SetClusterParams(fXX,fYY,fCh);                                                       //              3 - size = 1
     new ((*pCluLst)[iCluCnt++]) AliHMPIDCluster(*this);  //add this raw cluster 
     return 1;
     
@@ -282,11 +285,8 @@ Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Int_t *pSigmaCut, Bool_t isTr
 //Phase 0. Initialise Fitter  
   Double_t arglist[10];
   Int_t ierflg = 0;
-  TVirtualFitter *fitter = TVirtualFitter::Fitter(this,3*6);                            //initialize Fitter
-
-  delete fitter;                                                                        //temporary solution to avoid the inteference with previous instances
-  fitter = TVirtualFitter::Fitter(this,3*6);                                            //initialize Fitter
-
+  TVirtualFitter* fitter = TVirtualFitter::Fitter(this,3*6);                       //initialize Fitter
+  //
   arglist[0] = -1;
   ierflg = fitter->ExecuteCommand("SET PRI", arglist, 1);                               // no printout
   ierflg = fitter->ExecuteCommand("SET NOW", arglist, 0);                               //no warning messages
@@ -340,17 +340,16 @@ Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Int_t *pSigmaCut, Bool_t isTr
  if ( fNlocMax == 0) {                                                                       // case of no local maxima found: pads with same charge...
    fNlocMax = 1;
    fSt=kNoLoc;
-   if(fParam->GetInstType()) SetClusterParams(fXX,fYY,fCh);                                                      //need to fill the AliCluster3D part
+   SetClusterParams(fXX,fYY,fCh);                                                          //need to fill the AliCluster3D part
    new ((*pCluLst)[iCluCnt++]) AliHMPIDCluster(*this);                                    //add new unfolded cluster
-   
    return fNlocMax;
  }
 
 // case 2 -> loc max found. Check # of loc maxima 
  if ( fNlocMax >= kMaxLocMax)  { 
if(fParam->GetInstType()) SetClusterParams(fXX,fYY,fCh);                                                           // if # of local maxima exceeds kMaxLocMax...
  SetClusterParams(fXX,fYY,fCh);                                                           // if # of local maxima exceeds kMaxLocMax...
    fSt = kMax;   new ((*pCluLst)[iCluCnt++]) AliHMPIDCluster(*this);                      //...add this raw cluster  
  } else {                                                                               //or resonable number of local maxima to fit and user requested it
+ } else {                                                                               //or resonable number of local maxima to fit and user requested it
   // Now ready for minimization step
    arglist[0] = 500;                                                                      //number of steps and sigma on pads charges
    arglist[1] = 1.;                                                                       //
@@ -387,7 +386,7 @@ Int_t AliHMPIDCluster::Solve(TClonesArray *pCluLst,Int_t *pSigmaCut, Bool_t isTr
       if ( !IsInPc()) fSt = kEdg;                                                        // if Out of Pc
       if(fSt==kNoLoc) fNlocMax=0;                                                        // if with no loc max (pads with same charge..)
      }
-     if(fParam->GetInstType()) SetClusterParams(fXX,fYY,fCh);                            //need to fill the AliCluster3D part
+     SetClusterParams(fXX,fYY,fCh);                                                      //need to fill the AliCluster3D part
      new ((*pCluLst)[iCluCnt++]) AliHMPIDCluster(*this);                                //add new unfolded cluster
      if(fNlocMax>1)SetSize(rawSize);                                                     //Original raw size is set again to its proper value
    }