]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/STEERBase/AliEMCALPIDResponse.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliEMCALPIDResponse.cxx
index 7efcb58b4e6786801ac52e77031db95df18e50ee..91c06189a99700656a62f3af1b295de266dfd1e2 100644 (file)
@@ -61,6 +61,7 @@ ClassImp(AliEMCALPIDResponse)
 AliEMCALPIDResponse::AliEMCALPIDResponse():
   TObject(),
   fNorm(NULL),
+  fCurrCentrality(-1.),
   fkPIDParams(NULL)
 {
   //
@@ -74,6 +75,7 @@ AliEMCALPIDResponse::AliEMCALPIDResponse():
 AliEMCALPIDResponse::AliEMCALPIDResponse(const AliEMCALPIDResponse &other):
   TObject(other),
   fNorm(other.fNorm),
+  fCurrCentrality(other.fCurrCentrality),
   fkPIDParams(other.fkPIDParams)
 {
   //
@@ -93,6 +95,7 @@ AliEMCALPIDResponse & AliEMCALPIDResponse::operator=( const AliEMCALPIDResponse&
   // Make copy
   TObject::operator=(other);
   fNorm = other.fNorm;
+  fCurrCentrality = other.fCurrCentrality;
   fkPIDParams = other.fkPIDParams;
 
  
@@ -264,6 +267,12 @@ const TVectorD* AliEMCALPIDResponse::GetParams(Int_t nParticle, Float_t fPt, Int
   // 6 = probLow  (not used for electrons)
   // 7 = probHigh (not used for electrons)
   //
+  // for PbPb the parametrization is done centrality dependent (marked by TString "Centrality")
+  // so first the correct centrality bin has to be found
+
+  // **** Centrality bins (hard coded for the moment)
+  const Int_t nCent = 7;
+  Int_t centBins[nCent+1] = {0,10,20,30,40,50,70,90};
 
   if(nParticle > AliPID::kSPECIES || nParticle <0) return NULL;
   if(nParticle == AliPID::kProton && charge == -1) nParticle = AliPID::kSPECIES; // special case for antiprotons
@@ -271,19 +280,53 @@ const TVectorD* AliEMCALPIDResponse::GetParams(Int_t nParticle, Float_t fPt, Int
   TObjArray * particlePar = dynamic_cast<TObjArray *>(fkPIDParams->At(nParticle));
   if(!particlePar) return NULL;
 
-  TIter parIter(particlePar);
   const TVectorD *parameters = NULL;
   Double_t momMin = 0.;
   Double_t momMax = 0.;
 
-  while((parameters = static_cast<const TVectorD *>(parIter()))){
+  // is the centrality dependent parametrization used
+  TString arrayName = particlePar->GetName();
+
+  // centrality dependent parametrization
+  if(arrayName.Contains("Centrality")){
+    
+    for(Int_t iCent = 0; iCent < nCent; iCent++){
 
-    momMin = (*parameters)[0];
-    momMax = (*parameters)[1];
+      if( fCurrCentrality > centBins[iCent] && fCurrCentrality < centBins[iCent+1] ){
+       
+       TObjArray * centPar = dynamic_cast<TObjArray *>(particlePar->At(iCent));
+       if(!centPar) return NULL;
+       
+       TIter centIter(centPar);
+       parameters = NULL;
+       momMin = 0.;
+       momMax = 0.;
+       
+       while((parameters = static_cast<const TVectorD *>(centIter()))){
+         
+         momMin = (*parameters)[0];
+         momMax = (*parameters)[1];
+         
+         if( fPt > momMin && fPt < momMax ) return parameters;
+        
+       } 
+      }
+    }
+  }
 
-    if( fPt > momMin && fPt < momMax ) return parameters;
+  // NO centrality dependent parametrization
+  else{
 
-  }  
+    TIter parIter(particlePar);
+    while((parameters = static_cast<const TVectorD *>(parIter()))){
+      
+      momMin = (*parameters)[0];
+      momMax = (*parameters)[1];
+      
+      if( fPt > momMin && fPt < momMax ) return parameters;
+      
+    }  
+  }
   AliDebug(2, Form("NO params for particle %d and momentum %f \n", nParticle, fPt));
 
   return parameters;