In AliMUONGeometryModuleTransformer, AliMUONVGeometryBuilder:
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutDaughterType.cxx
CommitLineData
2dab9030 1//
2// Class AliRsnCutDaughterType
3//
4// General implementation of a single cut strategy, which can be:
5// - a value contained in a given interval [--> IsBetween() ]
6// - a value equal to a given reference [--> MatchesValue()]
7//
8// In all cases, the reference value(s) is (are) given as data members
9// and each kind of cut requires a given value type (Int, UInt, Double),
10// but the cut check procedure is then automatized and chosen thanks to
11// an enumeration of the implemented cut types.
12// At the end, the user (or any other point which uses this object) has
13// to use the method IsSelected() to check if this cut has been passed.
14//
15// authors: Martin Vala (martin.vala@cern.ch)
16// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
17//
18
19#include "AliRsnDaughter.h"
20#include "AliRsnCutDaughterType.h"
21
22ClassImp(AliRsnCutDaughterType)
23
24//_________________________________________________________________________________________________
25AliRsnCutDaughterType::AliRsnCutDaughterType() :
26 AliRsnCut(AliRsnCut::kDaughter),
27 fRefType(kTypes)
28{
29//
30// Default constructor.
31//
32}
33
34//_________________________________________________________________________________________________
35AliRsnCutDaughterType::AliRsnCutDaughterType
36(const char *name, EType type) :
37 AliRsnCut(name, AliRsnCut::kDaughter, 0.0, 0.0),
38 fRefType(type)
39{
40//
41// Main constructor.
42//
43}
44
45//_________________________________________________________________________________________________
46Bool_t AliRsnCutDaughterType::IsSelected(TObject *obj1, TObject* /*obj2*/)
47{
48//
49// Cut checker.
50//
51
52 // coherence check
53 AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(obj1);
54 if (!daughter) return kFALSE;
55
56 // check the daughter according to the selected type
57 // in some cases this means to retrieve the track status
58 AliVTrack *track = dynamic_cast<AliVTrack*>(daughter->GetRef());
59 AliESDtrack *esdT = dynamic_cast<AliESDtrack*>(daughter->GetRef());
60 ULong_t status = 0x0;
61 if (track) status = (ULong_t)track->GetStatus();
62
63 switch (fRefType)
64 {
65 case kTrackTPC:
66 return ((status & AliESDtrack::kTPCin) != 0);
67 case kTrackITSSA:
68 if (esdT)
69 {
70 UChar_t itsCluMap = track->GetITSClusterMap();
71 Int_t k, nITS = 0;
72 for(k = 2; k < 6; k++) if(itsCluMap & (1 << k)) ++nITS;
73 if (nITS < 3) return kFALSE;
74 }
75 return ((status & AliESDtrack::kTPCin) == 0 && (status & AliESDtrack::kITSrefit) != 0 && (status & AliESDtrack::kITSpureSA) == 0 && (status & AliESDtrack::kITSpid) != 0);
76 case kV0:
77 return daughter->IsV0();
78 default:
79 AliError("No good reference type is chosen. Cut skipped");
80 return kTRUE;
81 }
82}