]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/RESONANCES/AliRsnCutBetheBloch.cxx
remove option C for Clear for trigger array for the moment, causes malloc error
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutBetheBloch.cxx
index 627281b51a386ea79843da4903bab1e6cf7e0a88..329426f2dab142c7c4a8429cc273e4aa85889418 100644 (file)
@@ -17,8 +17,7 @@
 //
 #include "TMath.h"
 
-#include "AliLog.h"
-#include "AliESDtrack.h"
+#include "AliExternalTrackParam.h"
 
 #include "AliRsnDaughter.h"
 #include "AliRsnCutBetheBloch.h"
@@ -27,7 +26,7 @@ ClassImp(AliRsnCutBetheBloch)
 
 //_________________________________________________________________________________________________
 AliRsnCutBetheBloch::AliRsnCutBetheBloch() :
-  AliRsnCut(),
+  AliRsnCut("dummyBBCut", AliRsnTarget::kDaughter),
   fCorrect(kTRUE),
   fMIP(50.0),
   fType(AliPID::kUnknown)
@@ -42,7 +41,7 @@ AliRsnCutBetheBloch::AliRsnCutBetheBloch() :
 //_________________________________________________________________________________________________
 AliRsnCutBetheBloch::AliRsnCutBetheBloch
 (const char *name, Double_t fractionRange, AliPID::EParticleType type, Double_t mip, Bool_t correct) :
-  AliRsnCut(name, 0.0, fractionRange),
+  AliRsnCut(name, AliRsnCut::kDaughter, 0.0, fractionRange),
   fCorrect(correct),
   fMIP(mip),
   fType(type)
@@ -59,7 +58,7 @@ AliRsnCutBetheBloch::AliRsnCutBetheBloch
 }
 
 //_____________________________________________________________________________
-Double_t AliRsnCutBetheBloch::BetheBloch(AliRsnDaughter *track)
+Double_t AliRsnCutBetheBloch::BetheBloch(AliRsnDaughter * const trackRef)
 {
 //
 // Computes the theoretical dE/dx according to
@@ -75,7 +74,10 @@ Double_t AliRsnCutBetheBloch::BetheBloch(AliRsnDaughter *track)
   AliPID pid;
   Double_t mass = pid.ParticleMass(fType);
 
-  Double_t betaGamma = track->P() / mass;
+  // get the track momentum at the inner wall of TPC: if absent cut is not passed
+  AliExternalTrackParam track(*trackRef->GetRefESDtrack()->GetInnerParam());
+
+  Double_t betaGamma = track.P() / mass;
   Double_t beta = betaGamma / TMath::Sqrt(1.0 + betaGamma * betaGamma);
   Double_t aa = TMath::Power(beta, fConst[3]);
   Double_t bb = TMath::Power(1.0 / betaGamma, fConst[4]);
@@ -84,8 +86,7 @@ Double_t AliRsnCutBetheBloch::BetheBloch(AliRsnDaughter *track)
 
   Double_t out = (fConst[1] - aa - bb) * fConst[0] / aa;
 
-  if (fCorrect)
-  {
+  if (fCorrect) {
     Double_t kMeanCorr = 0.1;
     Double_t meanCorr = (1 + (out - 1) * kMeanCorr);
     out *= meanCorr;
@@ -101,38 +102,36 @@ Double_t AliRsnCutBetheBloch::RelDiff(AliRsnDaughter *track)
 // Relative difference between BB value and TPC signal
 //
 
-  if (!track->GetRefESD()) return -99999.9;
+  if (!track->GetRefESDtrack()) return -99999.9;
 
   // compute Bethe-Bloch with the given mass hypothesis
   Double_t bb = BetheBloch(track);
-  return TMath::Abs((track->GetRefESD()->GetTPCsignal() - bb) / bb);
+  return TMath::Abs((track->GetRefESDtrack()->GetTPCsignal() - bb) / bb);
 }
 
 //_________________________________________________________________________________________________
-Bool_t AliRsnCutBetheBloch::IsSelected(ETarget tgt, AliRsnDaughter *track)
+Bool_t AliRsnCutBetheBloch::IsSelected(TObject *object)
 {
 //
 // Cut checker.
 //
 
-  // coherence check
-  if (tgt != AliRsnCut::kParticle)
-  {
-    AliError(Form("Wrong target. Skipping cut", GetName()));
-    return kTRUE;
-  }
-
-  // if the required PID of the track is not the same as the
-  // reference of the cut, the cut is automatically skipped
-  if (track->RequiredPID() != fType) return kTRUE;
+  // dynamic cast the object into AliRsnDaughter
+  if (!TargetOK(object)) return kFALSE;
 
   // retrieve the TPC signal
-  AliVParticle *vpart = track->GetRef();
-  AliESDtrack *esd = dynamic_cast<AliESDtrack*>(vpart);
+  AliRsnDaughter *track = fDaughter;
+  
+  // if track is meaningful, retrieve its ESD format
+  AliESDtrack    *esd   = track->GetRefESDtrack();
   if (!esd) {
     AliError("ESD information unavailable");
     return kTRUE;
   }
+  if (!track->GetRefESDtrack()->GetInnerParam()) {
+    AliDebug(AliLog::kDebug+2, "Rejecting a track with no info at the TPC inner wall");
+    return kFALSE;
+  }
 
   // the cut range is the relative fraction of the value:
   // BB*(1-fraction) < TPC < BB*(1+fraction)
@@ -142,38 +141,5 @@ Bool_t AliRsnCutBetheBloch::IsSelected(ETarget tgt, AliRsnDaughter *track)
   fCutValueD = RelDiff(track);
 
   // then, this cut is checked inside the range
-  return OkRange();
-}
-
-//_________________________________________________________________________________________________
-Bool_t AliRsnCutBetheBloch::IsSelected(ETarget /*tgt*/, AliRsnPairParticle* /*pair*/)
-{
-//
-// Cut checker
-//
-
-  AliWarning("Cannot apply this cut to pairs");
-  return kTRUE;
-}
-
-//_________________________________________________________________________________________________
-Bool_t AliRsnCutBetheBloch::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*event*/)
-{
-//
-// Cut checker
-//
-
-  AliWarning("Cannot apply this cut to events");
-  return kTRUE;
-}
-
-//_________________________________________________________________________________________________
-Bool_t AliRsnCutBetheBloch::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*ev1*/, AliRsnEvent* /*ev2*/)
-{
-//
-// Cut checker
-//
-
-  AliWarning("Cannot apply this cut to event mixing");
-  return kTRUE;
+  return OkRangeD();
 }