]>
Commit | Line | Data |
---|---|---|
70da6c5a | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | // Cut step class | |
17 | // Select all tracks surviving cuts in one special cut step | |
18 | // Used in AliHFEtrackFilter | |
19 | // | |
20 | // Author: | |
21 | // Markus Fasel <M.Fasel@gsi.de> | |
22 | // | |
23 | #include <TObjArray.h> | |
24 | ||
25 | #include "AliAnalysisCuts.h" | |
26 | #include "AliCFCutBase.h" | |
27 | #include "AliHFEcutStep.h" | |
28 | #include "AliLog.h" | |
29 | #include "AliMCEvent.h" | |
30 | ||
31 | ClassImp(AliHFEcutStep) | |
32 | ||
33 | //__________________________________________________________________ | |
34 | AliHFEcutStep::AliHFEcutStep(const Char_t *name): | |
35 | TNamed(name, ""), | |
36 | fCuts(NULL) | |
37 | { | |
38 | // | |
39 | // Default Constructor | |
40 | // | |
41 | fCuts = new TObjArray; | |
42 | } | |
43 | ||
44 | //__________________________________________________________________ | |
45 | AliHFEcutStep::AliHFEcutStep(const AliHFEcutStep &o): | |
46 | TNamed(o), | |
47 | fCuts(NULL) | |
48 | { | |
49 | // | |
50 | // Copy constructor | |
51 | // | |
52 | o.Copy(*this); | |
53 | } | |
54 | ||
55 | //__________________________________________________________________ | |
56 | AliHFEcutStep &AliHFEcutStep::operator=(const AliHFEcutStep &o){ | |
57 | // | |
58 | // Assignment operator | |
59 | // | |
60 | if(this != &o) | |
61 | o.Copy(*this); | |
62 | return *this; | |
63 | } | |
64 | ||
65 | //__________________________________________________________________ | |
66 | AliHFEcutStep::~AliHFEcutStep(){ | |
67 | // | |
68 | // destructor | |
69 | // | |
70 | delete fCuts; | |
71 | } | |
72 | ||
73 | //__________________________________________________________________ | |
74 | void AliHFEcutStep::Copy(TObject &o) const{ | |
75 | // | |
76 | // Copy into content into object o | |
77 | // | |
78 | TNamed::Copy(o); | |
79 | AliHFEcutStep &target = dynamic_cast<AliHFEcutStep &>(o); | |
80 | ||
81 | // Make copy | |
82 | target.fCuts = dynamic_cast<TObjArray *>(fCuts->Clone()); | |
83 | } | |
84 | ||
85 | //__________________________________________________________________ | |
86 | Bool_t AliHFEcutStep::IsSelected(TObject *o){ | |
87 | // | |
88 | // Filter tracks in the given cut step | |
89 | // Apply all cut objects | |
90 | // | |
91 | AliInfo(Form("Cut Step %s: Number of cut objects: %d", GetName(), fCuts->GetEntriesFast())); | |
92 | if(!fCuts->GetEntriesFast()) return kTRUE; | |
93 | Bool_t isSelected = kTRUE; | |
94 | for(Int_t iCut = 0; iCut < fCuts->GetEntriesFast(); iCut++){ | |
95 | if(!(dynamic_cast<AliAnalysisCuts *>(fCuts->UncheckedAt(iCut)))->IsSelected(o)) isSelected = kFALSE; | |
96 | } | |
97 | AliInfo(Form("Accepted: %s", isSelected ? "yes" : "no")); | |
98 | return isSelected; | |
99 | } | |
100 | ||
101 | //__________________________________________________________________ | |
102 | AliAnalysisCuts *AliHFEcutStep::GetCut(const Char_t *cutName){ | |
103 | // | |
104 | // return cut object | |
105 | // | |
106 | return dynamic_cast<AliAnalysisCuts *>(fCuts->FindObject(cutName)); | |
107 | } | |
108 | ||
109 | //__________________________________________________________________ | |
110 | void AliHFEcutStep::AddCut(AliAnalysisCuts *cut){ | |
111 | // | |
112 | // Add cut object to the cut step | |
113 | // | |
114 | fCuts->Add(cut); | |
115 | } | |
116 | ||
117 | //__________________________________________________________________ | |
118 | void AliHFEcutStep::SetMC(AliMCEvent *mc){ | |
119 | // | |
120 | // Set MC information to the cuts in the cut step | |
121 | // | |
122 | for(Int_t icut = 0; icut < fCuts->GetEntriesFast(); icut++){ | |
123 | if(fCuts->UncheckedAt(icut)->InheritsFrom("AliCFCutBase")) | |
124 | (dynamic_cast<AliCFCutBase *>(fCuts->UncheckedAt(icut)))->SetMCEventInfo(mc); | |
125 | } | |
126 | } | |
127 | ||
128 | //__________________________________________________________________ | |
129 | void AliHFEcutStep::SetRecEvent(AliVEvent *rec){ | |
130 | // | |
131 | // Publish rec event to the cut step | |
132 | // | |
133 | for(Int_t icut = 0; icut < fCuts->GetEntriesFast(); icut++){ | |
134 | if(fCuts->UncheckedAt(icut)->InheritsFrom("AliCFCutBase")) | |
135 | (dynamic_cast<AliCFCutBase *>(fCuts->UncheckedAt(icut)))->SetRecEventInfo(rec); | |
136 | } | |
137 | } | |
138 |