]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/RESONANCES/AliRsnCutPIDTPC.cxx
Patch for the tracker
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutPIDTPC.cxx
index 5e9aa7e52e8e5643b755707d6130c840963f04be..94bbe01175ed9dd7f4b3371f7d9e76f9563233ca 100644 (file)
@@ -25,14 +25,14 @@ ClassImp(AliRsnCutPIDTPC)
 //_________________________________________________________________________________________________
 AliRsnCutPIDTPC::AliRsnCutPIDTPC
 (const char *name, AliPID::EParticleType type, Double_t min, Double_t max, Bool_t rejectOutside) :
-  AliRsnCut(name, AliRsnCut::kDaughter, min, max),
-  fInitialized(kFALSE),
-  fRejectOutside(rejectOutside),
-  fMomMin(0.0),
-  fMomMax(1E+20),
-  fRefType(type),
-  fESDpid(),
-  fAODpid()
+   AliRsnCut(name, AliRsnCut::kDaughter, min, max),
+   fInitialized(kFALSE),
+   fRejectOutside(rejectOutside),
+   fMomMin(0.0),
+   fMomMax(1E+20),
+   fRefType(type),
+   fESDpid(),
+   fAODpid()
 {
 //
 // Main constructor.
@@ -42,14 +42,14 @@ AliRsnCutPIDTPC::AliRsnCutPIDTPC
 //_________________________________________________________________________________________________
 AliRsnCutPIDTPC::AliRsnCutPIDTPC
 (const AliRsnCutPIDTPC& copy) :
-  AliRsnCut(copy),
-  fInitialized(kFALSE),
-  fRejectOutside(copy.fRejectOutside),
-  fMomMin(copy.fMomMin),
-  fMomMax(copy.fMomMax),
-  fRefType(copy.fRefType),
-  fESDpid(copy.fESDpid),
-  fAODpid(copy.fAODpid)
+   AliRsnCut(copy),
+   fInitialized(kFALSE),
+   fRejectOutside(copy.fRejectOutside),
+   fMomMin(copy.fMomMin),
+   fMomMax(copy.fMomMax),
+   fRefType(copy.fRefType),
+   fESDpid(copy.fESDpid),
+   fAODpid(copy.fAODpid)
 {
 //
 // Copy constructor.
@@ -63,17 +63,17 @@ AliRsnCutPIDTPC& AliRsnCutPIDTPC::operator=(const AliRsnCutPIDTPC& copy)
 // Assignment operator
 //
 
-  AliRsnCut::operator=(copy);
+   AliRsnCut::operator=(copy);
 
-  fInitialized   = kFALSE;
-  fRejectOutside = copy.fRejectOutside;
-  fMomMin        = copy.fMomMin;
-  fMomMax        = copy.fMomMax;
-  fRefType       = copy.fRefType;
-  fESDpid        = copy.fESDpid;
-  fAODpid        = copy.fAODpid;
-  
-  return (*this);
+   fInitialized   = kFALSE;
+   fRejectOutside = copy.fRejectOutside;
+   fMomMin        = copy.fMomMin;
+   fMomMax        = copy.fMomMax;
+   fRefType       = copy.fRefType;
+   fESDpid        = copy.fESDpid;
+   fAODpid        = copy.fAODpid;
+
+   return (*this);
 }
 
 //_________________________________________________________________________________________________
@@ -83,8 +83,8 @@ void AliRsnCutPIDTPC::SetBBParam(Double_t p0, Double_t p1, Double_t p2, Double_t
 // Properly set the Bethe-Bloch parameters in all places where it is needed.
 //
 
-  fESDpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4);
-  fAODpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4);
+   fESDpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4);
+   fAODpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4);
 }
 
 //_________________________________________________________________________________________________
@@ -94,52 +94,57 @@ Bool_t AliRsnCutPIDTPC::IsSelected(TObject *object)
 // Cut checker.
 //
 
-  // initialize if needed
-  if (!fInitialized) Initialize();
-
-  // coherence check
-  if (!TargetOK(object)) return kFALSE;
-  
-  // reject not TPC tracks
-  AliVTrack *vtrack = dynamic_cast<AliVTrack*>(fDaughter->GetRef());
-  if (!vtrack) return kFALSE;
-  if (!IsTPC(vtrack))
-  {
-    AliDebug(AliLog::kDebug + 2, "Track is not found in TPC");
-    return kFALSE;
-  }
-  
-  // common evaluation variables
-  Double_t     mom;
-  AliESDtrack *esdTrack = fDaughter->GetRefESDtrack();
-  AliAODTrack *aodTrack = fDaughter->GetRefAODtrack();
-
-  // get inner momentum and check it w.r. to allowed range:
-  // all tracks outside it will pass the cut or not, depending on 'fRejectOutside'
-  if (esdTrack)
-    mom = esdTrack->GetInnerParam()->P();
-  else if (aodTrack)
-    mom = aodTrack->GetDetPid()->GetTPCmomentum();
-  else
-  {
-    AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName()));
-    return kFALSE;
-  }
-  if ((mom < fMomMin || mom > fMomMax))
-  {
-    AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom));
-    return (!fRejectOutside);
-  }
-
-  // assign PID nsigmas to default cut check value
-  // since bad object types are rejected before, here we have an ESD track or AOD track
-  if (esdTrack) 
-    fCutValueD = fESDpid.GetTPCResponse().GetNumberOfSigmas(mom, esdTrack->GetTPCsignal(), esdTrack->GetTPCsignalN(), fRefType);
-  else
-    fCutValueD = fAODpid.NumberOfSigmasTPC(aodTrack, fRefType);
-
-  // use AliRsnCut default method to check cut
-  return OkRangeD();
+   // initialize if needed
+   if (!fInitialized) Initialize();
+
+   // coherence check
+   if (!TargetOK(object)) return kFALSE;
+
+   // reject not TPC tracks
+   AliVTrack *vtrack = dynamic_cast<AliVTrack*>(fDaughter->GetRef());
+   if (!vtrack) return kFALSE;
+   if (!IsTPC(vtrack)) {
+      AliDebug(AliLog::kDebug + 2, "Track is not found in TPC");
+      return kFALSE;
+   }
+
+   // common evaluation variables
+   Double_t     mom;
+   AliESDtrack *esdTrack = fDaughter->GetRefESDtrack();
+   AliAODTrack *aodTrack = fDaughter->GetRefAODtrack();
+
+   // get inner momentum, needed for BB computation
+   if (esdTrack)
+      mom = esdTrack->GetInnerParam()->P();
+   else if (aodTrack)
+      mom = aodTrack->GetDetPid()->GetTPCmomentum();
+   else {
+      AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName()));
+      return kFALSE;
+   }
+
+   // assign PID nsigmas to default cut check value
+   // since bad object types are rejected before, here we have an ESD track or AOD track
+   if (esdTrack)
+      fCutValueD = fESDpid.GetTPCResponse().GetNumberOfSigmas(mom, esdTrack->GetTPCsignal(), esdTrack->GetTPCsignalN(), fRefType);
+   else
+      fCutValueD = fAODpid.NumberOfSigmasTPC(aodTrack, fRefType);
+
+   // use AliRsnCut default method to check cut
+   Bool_t cutCheck = OkRangeD();
+
+   // now check the momentum:
+   // -- if it stays inside the accepted range, track just checked
+   //    with respect to the nsigma band
+   // -- if it stays outside the accepted range and 'fRejectOutside' is kTRUE,
+   //    track is always rejected, while if 'fRejectOutside' is kFALSE,
+   //    track is accepted if it stays inside the nsigma band
+   if ((mom >= fMomMin && mom <= fMomMax))
+      return cutCheck;
+   else {
+      AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom));
+      return ((!fRejectOutside) && cutCheck);
+   }
 }
 
 //_________________________________________________________________________________________________
@@ -149,10 +154,10 @@ void AliRsnCutPIDTPC::Print(const Option_t *) const
 // Print information on this cut
 //
 
-  AliInfo(Form("Cut name                    : %s", GetName()));
-  AliInfo(Form("--> cut range (nsigma)      : %.3f %.3f", fMinD, fMaxD));
-  AliInfo(Form("--> momentum range          : %.3f %.3f", fMomMin, fMomMax));
-  AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted")));
+   AliInfo(Form("Cut name                    : %s", GetName()));
+   AliInfo(Form("--> cut range (nsigma)      : %.3f %.3f", fMinD, fMaxD));
+   AliInfo(Form("--> momentum range          : %.3f %.3f", fMomMin, fMomMax));
+   AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted")));
 }
 
 //_________________________________________________________________________________________________
@@ -162,13 +167,12 @@ void AliRsnCutPIDTPC::Initialize()
 // Initialize ESD pid object from global one
 //
 
-  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-  AliESDInputHandler *handler = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
-  if (handler)
-  {
-    AliESDpid *pid = handler->GetESDpid();
-    fESDpid = (*pid);
-  }
+   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+   AliESDInputHandler *handler = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
+   if (handler) {
+      AliESDpid *pid = handler->GetESDpid();
+      fESDpid = (*pid);
+   }
 
-  fInitialized = kTRUE;
+   fInitialized = kTRUE;
 }