ROOT logo
//
// Class AliRsnCutRange
//
// General implementation of cuts which check a value inside a range.
// This range can be defined by two integers or two doubles.
// A user-friendly enumeration allows to define what is checked.
//
// authors: Martin Vala (martin.vala@cern.ch)
//          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
//

#ifndef ALIRSNCUTPIDTOF_H
#define ALIRSNCUTPIDTOF_H

#include "AliPID.h"
#include "AliVTrack.h"

#include "AliRsnCut.h"

class AliRsnCutPIDTOF : public AliRsnCut {
public:

   AliRsnCutPIDTOF(const char *name            = "cutTOF",
                   EPARTYPE    particle        = AliPID::kKaon,
                   Double_t    nSigmaMin       = -3.,
                   Double_t    nSigmaMax       =  3.,
                   Bool_t      rejectUnmatched = kFALSE);

   AliRsnCutPIDTOF(const AliRsnCutPIDTOF &copy);
   AliRsnCutPIDTOF &operator=(const AliRsnCutPIDTOF &copy);
   virtual ~AliRsnCutPIDTOF() { }

   AliESDpid      *ESDpid()  {return fESDpid;}
   AliAODpidUtil  *AODpid()  {return fAODpid;}

   void            SetRejectUnmatched(Bool_t yn = kTRUE)      {fRejectUnmatched = yn;}
   void            SetNSigmaRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max;}
   void            SetRefType(EPARTYPE type)                  {fRefType = type; fRefMass = AliPID::ParticleMass(type);}

   Bool_t          IsMatched(AliVTrack *vtrack);
   virtual Bool_t  IsSelected(TObject *object);
   virtual void    Print(const Option_t *option = "") const;

private:

   void Initialize();

   Bool_t            fRejectUnmatched;  //  decide if non TOF matched tracks pass the cut or not
   EPARTYPE          fRefType;          //  particle type for which PID is checked
   Double_t          fRefMass;          //  reference mass used for computations
   AliESDpid        *fESDpid;           //! PID utility for ESD
   AliAODpidUtil    *fAODpid;           //! PID utility for AOD

   ClassDef(AliRsnCutPIDTOF, 1)
};

inline Bool_t AliRsnCutPIDTOF::IsMatched(AliVTrack *vtrack)
{
//
// Checks if the track has the status flags required for an ITS standalone track
//

   if (!vtrack) {
      AliWarning("NULL argument: impossible to check status");
      return kFALSE;
   }

   Bool_t isTOFout = ((vtrack->GetStatus() & AliESDtrack::kTOFout) != 0);
   Bool_t isTIME   = ((vtrack->GetStatus() & AliESDtrack::kTIME) != 0);

   // if flags are not set, track is not matched
   if (!isTOFout || !isTIME) return kFALSE;

   // do an additional check on integrated length for ESD tracks
   AliESDtrack *esdTrack = dynamic_cast<AliESDtrack *>(vtrack);
   if (esdTrack) if (esdTrack->GetIntegratedLength() < 350.) return kFALSE;

   // if we are here, flags are OK and length also
   return kTRUE;
}

#endif
 AliRsnCutPIDTOF.h:1
 AliRsnCutPIDTOF.h:2
 AliRsnCutPIDTOF.h:3
 AliRsnCutPIDTOF.h:4
 AliRsnCutPIDTOF.h:5
 AliRsnCutPIDTOF.h:6
 AliRsnCutPIDTOF.h:7
 AliRsnCutPIDTOF.h:8
 AliRsnCutPIDTOF.h:9
 AliRsnCutPIDTOF.h:10
 AliRsnCutPIDTOF.h:11
 AliRsnCutPIDTOF.h:12
 AliRsnCutPIDTOF.h:13
 AliRsnCutPIDTOF.h:14
 AliRsnCutPIDTOF.h:15
 AliRsnCutPIDTOF.h:16
 AliRsnCutPIDTOF.h:17
 AliRsnCutPIDTOF.h:18
 AliRsnCutPIDTOF.h:19
 AliRsnCutPIDTOF.h:20
 AliRsnCutPIDTOF.h:21
 AliRsnCutPIDTOF.h:22
 AliRsnCutPIDTOF.h:23
 AliRsnCutPIDTOF.h:24
 AliRsnCutPIDTOF.h:25
 AliRsnCutPIDTOF.h:26
 AliRsnCutPIDTOF.h:27
 AliRsnCutPIDTOF.h:28
 AliRsnCutPIDTOF.h:29
 AliRsnCutPIDTOF.h:30
 AliRsnCutPIDTOF.h:31
 AliRsnCutPIDTOF.h:32
 AliRsnCutPIDTOF.h:33
 AliRsnCutPIDTOF.h:34
 AliRsnCutPIDTOF.h:35
 AliRsnCutPIDTOF.h:36
 AliRsnCutPIDTOF.h:37
 AliRsnCutPIDTOF.h:38
 AliRsnCutPIDTOF.h:39
 AliRsnCutPIDTOF.h:40
 AliRsnCutPIDTOF.h:41
 AliRsnCutPIDTOF.h:42
 AliRsnCutPIDTOF.h:43
 AliRsnCutPIDTOF.h:44
 AliRsnCutPIDTOF.h:45
 AliRsnCutPIDTOF.h:46
 AliRsnCutPIDTOF.h:47
 AliRsnCutPIDTOF.h:48
 AliRsnCutPIDTOF.h:49
 AliRsnCutPIDTOF.h:50
 AliRsnCutPIDTOF.h:51
 AliRsnCutPIDTOF.h:52
 AliRsnCutPIDTOF.h:53
 AliRsnCutPIDTOF.h:54
 AliRsnCutPIDTOF.h:55
 AliRsnCutPIDTOF.h:56
 AliRsnCutPIDTOF.h:57
 AliRsnCutPIDTOF.h:58
 AliRsnCutPIDTOF.h:59
 AliRsnCutPIDTOF.h:60
 AliRsnCutPIDTOF.h:61
 AliRsnCutPIDTOF.h:62
 AliRsnCutPIDTOF.h:63
 AliRsnCutPIDTOF.h:64
 AliRsnCutPIDTOF.h:65
 AliRsnCutPIDTOF.h:66
 AliRsnCutPIDTOF.h:67
 AliRsnCutPIDTOF.h:68
 AliRsnCutPIDTOF.h:69
 AliRsnCutPIDTOF.h:70
 AliRsnCutPIDTOF.h:71
 AliRsnCutPIDTOF.h:72
 AliRsnCutPIDTOF.h:73
 AliRsnCutPIDTOF.h:74
 AliRsnCutPIDTOF.h:75
 AliRsnCutPIDTOF.h:76
 AliRsnCutPIDTOF.h:77
 AliRsnCutPIDTOF.h:78
 AliRsnCutPIDTOF.h:79
 AliRsnCutPIDTOF.h:80
 AliRsnCutPIDTOF.h:81
 AliRsnCutPIDTOF.h:82