]>
Commit | Line | Data |
---|---|---|
b2a297fa | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /////////////////////////////////////////////////////////////////////////// | |
17 | // Cut class providing cuts for both legs in the AliDielectronPair // | |
18 | // // | |
19 | // // | |
20 | /* | |
21 | Add any number of leg cuts using e.g. for leg 1 | |
22 | GetFilterLeg1().AddCuts(mycut) | |
23 | where mycut has to inherit from AliAnalysisCuts | |
24 | ||
25 | */ | |
26 | // // | |
27 | /////////////////////////////////////////////////////////////////////////// | |
28 | ||
29 | #include <TList.h> | |
30 | ||
31 | #include "AliDielectronPair.h" | |
32 | #include "AliVParticle.h" | |
33 | ||
34 | #include "AliDielectronPairLegCuts.h" | |
35 | ||
36 | ClassImp(AliDielectronPairLegCuts) | |
37 | ||
38 | ||
39 | AliDielectronPairLegCuts::AliDielectronPairLegCuts() : | |
40 | AliAnalysisCuts(), | |
41 | fFilterLeg1("PairFilterLeg1","PairFilterLeg1"), | |
42 | fFilterLeg2("PairFilterLeg2","PairFilterLeg2"), | |
43 | fCutType(kBothLegs) | |
44 | { | |
45 | // | |
46 | // Default contructor | |
47 | // | |
48 | } | |
49 | ||
50 | //________________________________________________________________________ | |
51 | AliDielectronPairLegCuts::AliDielectronPairLegCuts(const char* name, const char* title) : | |
52 | AliAnalysisCuts(name,title), | |
53 | fFilterLeg1("PairFilterLeg1","PairFilterLeg1"), | |
54 | fFilterLeg2("PairFilterLeg2","PairFilterLeg2"), | |
55 | fCutType(kBothLegs) | |
56 | { | |
57 | // | |
58 | // Named contructor | |
59 | // | |
60 | } | |
61 | ||
6a6716b2 | 62 | AliDielectronPairLegCuts::~AliDielectronPairLegCuts() |
63 | { | |
64 | // | |
65 | // Dtor | |
66 | // | |
67 | ||
68 | // remove all cuts in the leg2 filter which are also in the leg1 filter | |
69 | // to avoid doule deletion | |
70 | TIter nextCut(fFilterLeg1.GetCuts()); | |
71 | TObject *o=0x0; | |
72 | while ( (o=nextCut()) ) fFilterLeg2.GetCuts()->Remove(o); | |
73 | } | |
b2a297fa | 74 | |
75 | //________________________________________________________________________ | |
76 | Bool_t AliDielectronPairLegCuts::IsSelected(TObject* track) | |
77 | { | |
78 | // | |
79 | // check if cuts are fulfilled | |
80 | // | |
81 | ||
82 | //check if we have a AliDielectronPair | |
83 | AliDielectronPair *pair=dynamic_cast<AliDielectronPair*>(track); | |
84 | if (!pair) return kFALSE; | |
85 | ||
86 | //get both legs | |
54ce9dc4 | 87 | AliVParticle *leg1=pair->GetFirstDaughterP(); |
88 | AliVParticle *leg2=pair->GetSecondDaughterP(); | |
b2a297fa | 89 | |
90 | //mask used to require that all cuts are fulfilled | |
91 | UInt_t selectedMaskLeg1=(1<<fFilterLeg1.GetCuts()->GetEntries())-1; | |
92 | UInt_t selectedMaskLeg2=(1<<fFilterLeg2.GetCuts()->GetEntries())-1; | |
93 | ||
94 | //test cuts | |
95 | Bool_t isLeg1selected=(fFilterLeg1.IsSelected(leg1)==selectedMaskLeg1); | |
42c76bea | 96 | if(fCutType==kBothLegs && !isLeg1selected) { |
97 | SetSelected(isLeg1selected); | |
98 | return isLeg1selected; | |
99 | } | |
b2a297fa | 100 | Bool_t isLeg2selected=(fFilterLeg2.IsSelected(leg2)==selectedMaskLeg2); |
101 | ||
8df8e382 | 102 | Bool_t isLeg1selectedMirror=(fFilterLeg1.IsSelected(leg2)==selectedMaskLeg1); |
103 | Bool_t isLeg2selectedMirror=(fFilterLeg2.IsSelected(leg1)==selectedMaskLeg2); | |
104 | ||
b2a297fa | 105 | Bool_t isSelected=isLeg1selected&&isLeg2selected; |
106 | if (fCutType==kAnyLeg) | |
107 | isSelected=isLeg1selected||isLeg2selected; | |
8df8e382 | 108 | |
109 | if (fCutType==kMixLegs) | |
110 | isSelected=(isLeg1selected&&isLeg2selected)||(isLeg1selectedMirror&&isLeg2selectedMirror); | |
111 | ||
b2a297fa | 112 | SetSelected(isSelected); |
113 | return isSelected; | |
114 | } | |
115 | ||
116 | ||
117 |