]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Changes for report #68168: Request for committing bug fix to trunk/STEER (Markus)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Jun 2010 09:08:30 +0000 (09:08 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Jun 2010 09:08:30 +0000 (09:08 +0000)
STEER/AliTRDPIDResponse.cxx
STEER/AliTRDPIDResponse.h

index 95f9c7e77b6b6df91eca7c115a7c994d868216e4..40f8d2d1046d7f5052c158800d53ae662139900e 100644 (file)
@@ -51,8 +51,6 @@ AliTRDPIDResponse::AliTRDPIDResponse(const Char_t * filename):
  //
  // Default constructor
  //
-  Int_t size  = (AliPID::kSPECIES)*(kNPBins);
-  //memset(fMapRefHists, 0, sizeof(Int_t) * size);
   for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++)
     for(Int_t ipbin = 0; ipbin < kNPBins; ipbin++)
       fMapRefHists[ispec][ipbin] = -1;
@@ -148,6 +146,7 @@ Bool_t AliTRDPIDResponse::Load(const Char_t * filename){
      species = AliPID::kPion;
    }
    pbin = histname.Atoi() - 1;
+   AliDebug(1, Form("Species %d, Histname %s, Pbin %d, Position in container %d", species, histname.Data(), pbin, arrayPos));
    fMapRefHists[species][pbin] = arrayPos;
    fReferences->AddAt(new TH1F(*dynamic_cast<TH1F *>(tmp)), arrayPos);
    arrayPos++;
@@ -188,14 +187,14 @@ Bool_t AliTRDPIDResponse::GetResponse(Int_t n, Double_t *dedx, Float_t *p, Doubl
 
  for(Int_t is(AliPID::kSPECIES); is--;) prob[is]=.2;
  Double_t prLayer[AliPID::kSPECIES];
- memset(prLayer, 0, AliPID::kSPECIES*sizeof(Double_t));
  Double_t DE[10], s(0.);
  for(Int_t il(kNlayer); il--;){
+   memset(prLayer, 0, AliPID::kSPECIES*sizeof(Double_t));
    if(!CookdEdx(&dedx[il*n], &DE[0])) continue;
 
    s=0.;
    for(Int_t is(AliPID::kSPECIES); is--;){
-     prLayer[is] = GetProbabilitySingleLayer(is, p[il], DE[0]);
+     if((DE[0] > 0.) && (p[il] > 0.)) prLayer[is] = GetProbabilitySingleLayer(is, p[il], DE[0]);
      AliDebug(3, Form("Probability for Species %d in Layer %d: %f", is, il, prLayer[is]));
      s+=prLayer[is];
    }
@@ -229,15 +228,17 @@ Double_t AliTRDPIDResponse::GetProbabilitySingleLayer(Int_t species, Double_t pl
  // Interpolation between momentum bins
  //
  AliDebug(1, Form("Make Probability for Species %d with Momentum %f", species, plocal));
- Int_t pbin = GetLowerMomentumBin(plocal);
+ Int_t pbin = GetLowerMomentumBin(plocal);  
+ AliDebug(1, Form("Bin %d", pbin));
  Double_t pLayer = 0.;
  // Do Interpolation exept for underflow and overflow
  if(pbin >= 0 && pbin < kNPBins-1){
    TH1 *refHistUpper = NULL, *refHistLower = NULL;
-   if(fMapRefHists[species][pbin] > 0)
+   if(fMapRefHists[species][pbin] >= 0)
     refHistLower = dynamic_cast<TH1 *>(fReferences->UncheckedAt(fMapRefHists[species][pbin]));
-   if(fMapRefHists[species][pbin+1] > 0)
+   if(fMapRefHists[species][pbin+1] >= 0)
     refHistUpper = dynamic_cast<TH1 *>(fReferences->UncheckedAt(fMapRefHists[species][pbin+1]));
+   AliDebug(1, Form("Reference Histos (Upper/Lower): [%p|%p]", refHistUpper, refHistLower));
 
    if (refHistLower && refHistUpper ) {
      Double_t pLower = refHistLower->GetBinContent(refHistLower->GetXaxis()->FindBin(dEdx));
index 44e720a7ba1cc31a3f7a209240bbb4551c4cc594..69d95329c74879802c5d3a47e522c5dd120ec9bf 100644 (file)
@@ -53,21 +53,20 @@ public:
  void      SetPIDmethod(Int_t m) {fPIDmethod=m;}
  void      SetGainNormalisationFactor(Double_t gainFactor) { fGainNormalisationFactor = gainFactor; }
 
-
 private:
  Bool_t    CookdEdx(Double_t *in, Double_t *out) const;
  Int_t     GetLowerMomentumBin(Double_t p) const;
- Double_t  GetProbabilitySingleLayer(Int_t species, Double_t dEdx, Double_t p) const;
+ Double_t  GetProbabilitySingleLayer(Int_t species, Double_t plocal, Double_t dEdx) const;
  Bool_t    Load(const Char_t *filename = NULL);
 
  static const Double_t fgkPBins[kNPBins];
  TObjArray *fReferences; // Container for reference distributions
- Int_t     fMapRefHists[AliPID::kSPECIES+1][kNPBins+1];     
+ Int_t     fMapRefHists[AliPID::kSPECIES][kNPBins];     
                          // Map for the position of a given historgam in the container 
  Double_t  fGainNormalisationFactor;  // Gain normalisation factor
  UChar_t   fPIDmethod;   // PID method selector  
 
- ClassDef(AliTRDPIDResponse, 1)    // Tool for TRD PID
+ ClassDef(AliTRDPIDResponse, 2)    // Tool for TRD PID
 };
 #endif