f6f84c8e |
1 | // $Id$ |
fc2b0c6d |
2 | //************************************************************************** |
3 | //* This file is property of and copyright by the ALICE HLT Project * |
4 | //* ALICE Experiment at CERN, All rights reserved. * |
5 | //* * |
6 | //* Primary Authors: Kenneth Aamodt <kenneth.aamodt@cern.ch> * |
7 | //* for The ALICE HLT Project. * |
8 | //* * |
9 | //* Permission to use, copy, modify and distribute this software and its * |
10 | //* documentation strictly for non-commercial purposes is hereby granted * |
11 | //* without fee, provided that the above copyright notice appears in all * |
12 | //* copies and that both the copyright notice and this permission notice * |
13 | //* appear in the supporting documentation. The authors make no claims * |
14 | //* about the suitability of this software for any purpose. It is * |
15 | //* provided "as is" without express or implied warranty. * |
16 | //************************************************************************** |
17 | |
18 | /// @file AliHLTTriggerGammaConversion.cxx |
19 | /// @author Kenneth Aamodt |
20 | /// @date 2009-11-01 |
21 | /// @brief HLT trigger component for gamma conversions. |
22 | /// |
23 | |
24 | // see header file for class documentation |
25 | // or |
26 | // refer to README to build package |
27 | // or |
28 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt |
29 | |
30 | #include "AliHLTTriggerGammaConversion.h" |
31 | #include "AliESDEvent.h" |
32 | #include "AliESDv0.h" |
33 | #include "AliHLTTriggerDecision.h" |
34 | #include "AliHLTDomainEntry.h" |
35 | #include "AliHLTGlobalBarrelTrack.h" |
36 | #include "AliKFParticle.h" |
37 | #include "AliKFVertex.h" |
38 | #include "TObjArray.h" |
39 | #include "TObjString.h" |
40 | |
41 | /** ROOT macro for the implementation of ROOT specific class methods */ |
42 | ClassImp(AliHLTTriggerGammaConversion) |
43 | |
44 | AliHLTTriggerGammaConversion::AliHLTTriggerGammaConversion() |
45 | : AliHLTTrigger() |
93fd278f |
46 | , fMaxInvMass(0.05) |
fc2b0c6d |
47 | , fPtMax(0.0) |
48 | , fPtMin(0.0) |
93fd278f |
49 | , fMaxDca(10.0) |
50 | , fMaxR(200) |
fc2b0c6d |
51 | , fNReconstructedGammas(0) |
52 | { |
53 | // see header file for class documentation |
54 | // or |
55 | // refer to README to build package |
56 | // or |
57 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt |
58 | } |
59 | |
60 | const char* AliHLTTriggerGammaConversion::fgkOCDBEntry="HLT/ConfigHLT/GammaConversionTrigger"; |
61 | |
62 | AliHLTTriggerGammaConversion::~AliHLTTriggerGammaConversion() |
63 | { |
64 | // see header file for class documentation |
65 | } |
66 | |
67 | const char* AliHLTTriggerGammaConversion::GetTriggerName() const |
68 | { |
69 | // see header file for class documentation |
70 | return "GammaConversionTrigger"; |
71 | } |
72 | |
73 | AliHLTComponent* AliHLTTriggerGammaConversion::Spawn() |
74 | { |
75 | // see header file for class documentation |
76 | return new AliHLTTriggerGammaConversion; |
77 | } |
78 | |
79 | int AliHLTTriggerGammaConversion::DoTrigger() |
80 | { |
81 | // see header file for class documentation |
82 | int iResult=0; |
83 | fNReconstructedGammas=0; |
84 | |
85 | if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) ) |
86 | return 0; |
87 | |
88 | for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) { |
89 | |
90 | AliESDEvent *event = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) ); |
91 | event->GetStdContent(); |
92 | Int_t nV0 = event->GetNumberOfV0s(); |
93 | if(nV0<=0){ |
94 | continue; |
95 | } |
96 | AliKFParticle::SetField( event->GetMagneticField() ); |
97 | |
98 | for (Int_t iv=0; iv<nV0; iv++) { |
99 | |
100 | AliESDtrack *t1=event->GetTrack( event->GetV0(iv)->GetNindex()); |
101 | AliESDtrack *t2=event->GetTrack( event->GetV0(iv)->GetPindex()); |
102 | |
103 | AliKFParticle kf1( *t1->GetInnerParam(), 11 ); |
104 | AliKFParticle kf2( *t2->GetInnerParam(), 11 ); |
105 | |
106 | AliKFVertex primVtx( *event->GetPrimaryVertexTracks() ); |
107 | |
108 | AliKFParticle v0( kf1, kf2 ); |
109 | primVtx+=v0; |
110 | v0.SetProductionVertex( primVtx ); |
111 | |
112 | if(kf1.GetDistanceFromParticle(kf2)>fMaxDca){ |
113 | continue; |
114 | } |
115 | |
116 | double mass, error; |
117 | v0.GetMass(mass,error); |
118 | if( TMath::Abs(mass)>fMaxInvMass ){ |
119 | continue; |
120 | } |
121 | |
122 | AliKFParticle gamma = v0; |
123 | gamma.SetMassConstraint(0); |
124 | |
125 | double r= sqrt(gamma.GetX()*gamma.GetX()+gamma.GetY()*gamma.GetY()); |
126 | if(r>fMaxR){ |
127 | continue; |
128 | } |
129 | if(gamma.GetPt()<fPtMin){ |
130 | continue; |
131 | } |
132 | |
133 | if (fPtMax>0.){ |
134 | if(gamma.GetPt()>fPtMax){ |
135 | continue; |
136 | } |
137 | } |
138 | |
139 | fNReconstructedGammas++; |
140 | } |
141 | } |
142 | TString description; |
143 | TString maxInvMass, ptcut, maxDca, maxR; |
144 | maxInvMass.Form(" mass < %.03f GeV ,",fMaxInvMass); |
145 | if (fPtMax>fPtMin) { |
146 | ptcut.Form(" %.02f GeV/c <= pt <= %.02f GeV/c ,", fPtMin, fPtMax); |
147 | } else { |
148 | ptcut.Form(" pt >= %.02f GeV/c ,", fPtMin); |
149 | } |
150 | maxDca.Form(" dca <= %.04fcm ,",fMaxDca); |
f6f84c8e |
151 | maxR.Form(" r <= %.02cm", fMaxR); |
fc2b0c6d |
152 | |
153 | if(fNReconstructedGammas>0){ |
154 | description.Form("Event contains %d gamma conversions,", fNReconstructedGammas); |
155 | description += ptcut; |
156 | description += maxDca; |
157 | description += maxR; |
158 | |
159 | SetDescription(description.Data()); |
160 | |
161 | GetReadoutList().Enable( |
162 | AliHLTReadoutList::kITSSPD | |
163 | AliHLTReadoutList::kITSSDD | |
164 | AliHLTReadoutList::kITSSSD | |
165 | AliHLTReadoutList::kTPC | |
166 | AliHLTReadoutList::kTRD | |
167 | AliHLTReadoutList::kTOF | |
168 | AliHLTReadoutList::kHMPID | |
169 | AliHLTReadoutList::kPHOS |
170 | ); |
171 | // Add the available HLT information for readout too. |
172 | TriggerEvent(true); |
173 | return 0; |
174 | } |
175 | else{ |
176 | description.Form("No Gamma Conversions reconstructed that satisfy:"); |
177 | description += ptcut; |
178 | description += maxDca; |
179 | description += maxR; |
180 | } |
181 | SetDescription(description.Data()); |
182 | TriggerEvent(false); |
183 | return iResult; |
184 | } |
185 | |
186 | int AliHLTTriggerGammaConversion::DoInit(int argc, const char** argv) |
187 | { |
188 | // see header file for class documentation |
189 | |
190 | // first configure the default |
191 | int iResult=0; |
192 | iResult=ConfigureFromCDBTObjString(fgkOCDBEntry); |
193 | |
194 | // configure from the command line parameters if specified |
195 | if (iResult>=0 && argc>0) |
196 | iResult=ConfigureFromArgumentString(argc, argv); |
197 | return iResult; |
198 | } |
199 | |
200 | int AliHLTTriggerGammaConversion::DoDeinit() |
201 | { |
202 | // see header file for class documentation |
203 | return 0; |
204 | } |
205 | |
206 | int AliHLTTriggerGammaConversion::Reconfigure(const char* cdbEntry, const char* /*chainId*/) |
207 | { |
208 | // see header file for class documentation |
209 | |
210 | // configure from the specified antry or the default one |
211 | const char* entry=cdbEntry; |
212 | if (!entry || entry[0]==0) { |
213 | entry=fgkOCDBEntry; |
214 | } |
215 | |
216 | return ConfigureFromCDBTObjString(entry); |
217 | } |
218 | |
219 | int AliHLTTriggerGammaConversion::ScanConfigurationArgument(int argc, const char** argv) |
220 | { |
221 | // see header file for class documentation |
222 | if (argc<=0) return 0; |
223 | int i=0; |
224 | TString argument=argv[i]; |
225 | |
226 | // -max-invmass |
227 | if (argument.CompareTo("-max-invmass")==0) { |
228 | if (++i>=argc) return -EPROTO; |
229 | argument=argv[i]; |
230 | fMaxInvMass=argument.Atof(); |
231 | return 2; |
232 | } |
233 | |
234 | // -max-pt |
235 | if (argument.CompareTo("-max-pt")==0) { |
236 | if (++i>=argc) return -EPROTO; |
237 | argument=argv[i]; |
238 | fPtMax=argument.Atof(); |
239 | return 2; |
240 | } |
241 | |
242 | // -min-pt |
243 | if (argument.CompareTo("-min-pt")==0) { |
244 | if (++i>=argc) return -EPROTO; |
245 | argument=argv[i]; |
246 | fPtMin=argument.Atof(); |
247 | return 2; |
248 | } |
249 | |
250 | // -max-dca |
251 | // maximum dca of v0 |
252 | if (argument.CompareTo("-max-dca")==0) { |
253 | if (++i>=argc) return -EPROTO; |
254 | argument=argv[i]; |
255 | fMaxDca=argument.Atof(); |
256 | return 2; |
257 | } |
258 | |
259 | // -max-r |
260 | // maximum radius of v0 in xy-plane |
261 | if (argument.CompareTo("-max-r")==0) { |
262 | if (++i>=argc) return -EPROTO; |
263 | argument=argv[i]; |
264 | fMaxR=argument.Atof(); |
265 | return 2; |
266 | } |
267 | |
268 | // unknown argument |
269 | return -EINVAL; |
270 | } |