]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnCutTOFMatch.cxx
Added generalisation of y-cut for pairs
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnCutTOFMatch.cxx
1 #include "AliRsnCutTOFMatch.h"
2
3 ClassImp(AliRsnCutTOFMatch)
4
5 AliRsnCutTOFMatch::AliRsnCutTOFMatch() :
6    AliRsnCut("cut", AliRsnTarget::kDaughter)
7 {
8    //Default constructor
9 }
10
11 //_________________________________________________________________________________________________
12 AliRsnCutTOFMatch::AliRsnCutTOFMatch(const char *name) :
13    AliRsnCut(name, AliRsnTarget::kDaughter)
14 {
15    //main constructor
16 }
17
18 //_________________________________________________________________________________________________
19 Bool_t AliRsnCutTOFMatch::IsSelected(TObject *object)
20 {
21 //
22 // Checks if the track has the status flags required for the TPC-TOF matching
23 //
24    Bool_t accept = kFALSE;
25    if (!TargetOK(object)) return accept;
26
27    AliVTrack *vtrack = fDaughter->Ref2Vtrack();
28    if (!vtrack) {
29       AliError("Referenced daughter is not a track");
30       return accept;
31    }
32    if (MatchTOF(vtrack)) accept = kTRUE;
33    return accept;
34 }
35
36 //-----------------------------------------------------
37 inline Bool_t AliRsnCutTOFMatch::MatchTOF(const AliVTrack *vtrack) const
38 {
39 //
40 // Checks if the track has matched the TOF detector
41 //
42    if (!vtrack) {
43       AliWarning("NULL argument: impossible to check status");
44       return kFALSE;
45    }
46    if ((vtrack->GetStatus() & AliESDtrack::kTOFout) == 0) return kFALSE;
47    if ((vtrack->GetStatus() & AliESDtrack::kTIME  ) == 0) return kFALSE;
48    return kTRUE;
49 }