]>
Commit | Line | Data |
---|---|---|
5f4502cc | 1 | // $Id: AliHLTD0Trigger.cxx |
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: Gaute Ovrebekk * | |
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 AliHLTD0Trigger.cxx | |
19 | /// @author Gaute Ovrebekk | |
20 | /// @date 2009-10-28 | |
21 | /// @brief HLT trigger component for D0->Kpi | |
22 | ||
23 | // see header file for class documentation | |
24 | // or | |
25 | // refer to README to build package | |
26 | // or | |
27 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
28 | ||
29 | #include "AliHLTD0Trigger.h" | |
30 | #include "AliESDEvent.h" | |
31 | #include "AliESDtrack.h" | |
32 | #include "AliESDv0.h" | |
33 | #include "AliHLTTriggerDecision.h" | |
34 | #include "AliHLTDomainEntry.h" | |
35 | #include "AliHLTGlobalBarrelTrack.h" | |
36 | #include "TObjArray.h" | |
37 | #include "TObjString.h" | |
38 | #include "TDatabasePDG.h" | |
39 | #include "AliESDVertex.h" | |
40 | #include "TH1F.h" | |
41 | #include "AliHLTD0toKpi.h" | |
42 | ||
43 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
44 | ClassImp(AliHLTD0Trigger) | |
45 | ||
46 | AliHLTD0Trigger::AliHLTD0Trigger() | |
47 | : AliHLTTrigger() | |
48 | , fPtMin(0.0) | |
49 | , fdca(0.0) | |
50 | , finvMass(0.0) | |
51 | , fcosThetaStar(0.0) | |
52 | , fd0(0.0) | |
53 | , fd0d0(0.0) | |
54 | , fcosPoint(0.0) | |
55 | ,fplothisto(false) | |
56 | , fD0mass(NULL) | |
57 | { | |
58 | // see header file for class documentation | |
59 | // or | |
60 | // refer to README to build package | |
61 | // or | |
62 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
63 | ||
64 | } | |
65 | ||
66 | const char* AliHLTD0Trigger::fgkOCDBEntry="HLT/ConfigHLT/D0Trigger"; | |
67 | ||
68 | AliHLTD0Trigger::~AliHLTD0Trigger() | |
69 | { | |
70 | // see header file for class documentation | |
71 | //delete fD0mass; | |
72 | } | |
73 | ||
74 | const char* AliHLTD0Trigger::GetTriggerName() const | |
75 | { | |
76 | // see header file for class documentation | |
77 | return "D0Trigger"; | |
78 | } | |
79 | ||
80 | AliHLTComponent* AliHLTD0Trigger::Spawn() | |
81 | { | |
82 | // see header file for class documentation | |
83 | return new AliHLTD0Trigger; | |
84 | } | |
85 | ||
86 | int AliHLTD0Trigger::DoTrigger() | |
87 | { | |
88 | // see header file for class documentation | |
89 | int iResult=0; | |
90 | int nD0=0; | |
91 | Double_t D0,D0bar; | |
92 | Double_t d0[2]; | |
93 | Double_t svpos[3]; | |
94 | Double_t pvpos[3]; | |
95 | TString description; | |
96 | AliHLTD0toKpi *d0calc = new AliHLTD0toKpi(); | |
97 | ||
98 | for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) { | |
99 | ||
100 | AliESDEvent *event = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) ); | |
101 | event->GetStdContent(); | |
102 | Int_t nV0 = event->GetNumberOfV0s(); | |
103 | ||
104 | Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass(); | |
105 | ||
106 | for (Int_t iv=0; iv<nV0; iv++) { | |
107 | ||
108 | AliESDtrack *tN=event->GetTrack( event->GetV0(iv)->GetNindex()); | |
109 | AliESDtrack *tP=event->GetTrack( event->GetV0(iv)->GetPindex()); | |
110 | ||
111 | if(tN->Pt()<fPtMin && tP->Pt()<fPtMin){continue;} | |
112 | ||
113 | const AliESDVertex* pv = event->GetPrimaryVertexTracks(); | |
114 | Double_t field = event->GetMagneticField(); | |
115 | ||
116 | pv->GetXYZ(pvpos); | |
117 | ||
118 | d0[0] = 10000.*tP->GetD(pvpos[0],pvpos[1],field); | |
119 | d0[1] = -10000.*tN->GetD(pvpos[0],pvpos[1],field); | |
120 | ||
121 | if(d0[0]<fd0 && d0[0]<fd0){continue;} // make sure < or> | |
122 | ||
123 | event->GetV0(iv)->GetXYZ(svpos[0],svpos[1],svpos[2]); | |
124 | ||
125 | if(!tN->PropagateTo(svpos[0],field) && !tP->PropagateTo(svpos[0],field)){ | |
126 | HLTInfo("Tracks could not be propagated to secondary vertex"); | |
127 | continue; | |
128 | } | |
129 | ||
130 | Double_t tmp1, tmp2; | |
131 | if(tN->GetDCA(tP,field,tmp1,tmp2) > fdca){continue;} | |
132 | ||
133 | if((d0calc->InvMass(tN,tP) - mD0PDG) > finvMass && (d0calc->InvMass(tP,tN) - mD0PDG) > finvMass){continue;} | |
134 | d0calc->cosThetaStar(tN,tP,D0,D0bar); | |
135 | if(D0 > fcosThetaStar && D0bar > fcosThetaStar){continue;} | |
136 | if((d0[0]*d0[1]) > fd0d0){continue;} | |
137 | if(d0calc->pointingAngle(tN,tP,pvpos,svpos) < fcosPoint){continue;} | |
138 | ||
139 | nD0++; | |
140 | if((d0calc->InvMass(tN,tP) - mD0PDG) > finvMass){ | |
141 | fD0mass->Fill(d0calc->InvMass(tN,tP)); | |
142 | } | |
143 | else{ | |
144 | fD0mass->Fill(d0calc->InvMass(tP,tN)); | |
145 | } | |
146 | } | |
147 | ||
148 | } | |
149 | ||
150 | HLTWarning("Number of D0 found: %d",nD0); | |
151 | ||
152 | if(fplothisto){PushBack( (TObject*) fD0mass, kAliHLTDataTypeHistogram,0);} | |
153 | ||
154 | if (iResult>=0) { | |
155 | ||
156 | if (nD0>=1) { | |
157 | description.Form("Event contains %d D0(s)", nD0); | |
158 | SetDescription(description.Data()); | |
159 | // Enable the central detectors for readout. | |
160 | GetReadoutList().Enable( | |
161 | AliHLTReadoutList::kITSSPD | | |
162 | AliHLTReadoutList::kITSSDD | | |
163 | AliHLTReadoutList::kITSSSD | | |
164 | AliHLTReadoutList::kTPC | | |
165 | AliHLTReadoutList::kTRD | | |
166 | AliHLTReadoutList::kTOF | | |
167 | AliHLTReadoutList::kHMPID | | |
168 | AliHLTReadoutList::kPHOS | |
169 | ); | |
170 | // Add the available HLT information for readout too. | |
171 | GetTriggerDomain().Add("CLUSTERS", "TPC "); | |
172 | TriggerEvent(true); | |
173 | return 0; | |
174 | } | |
175 | description.Form("No D0"); | |
176 | } else { | |
177 | description.Form("No input blocks found"); | |
178 | } | |
179 | SetDescription(description.Data()); | |
180 | TriggerEvent(false); | |
181 | return iResult; | |
182 | } | |
183 | ||
184 | int AliHLTD0Trigger::DoInit(int argc, const char** argv) | |
185 | { | |
186 | fplothisto=false; | |
187 | // see header file for class documentation | |
188 | fD0mass = new TH1F("hD0mass","HLT: D0 inv mass",500,0,50); | |
189 | // first configure the default | |
190 | int iResult=0; | |
191 | if (iResult>=0) iResult=ConfigureFromCDBTObjString(fgkOCDBEntry); | |
192 | ||
193 | // configure from the command line parameters if specified | |
194 | if (iResult>=0 && argc>0) | |
195 | iResult=ConfigureFromArgumentString(argc, argv); | |
196 | return iResult; | |
197 | } | |
198 | ||
199 | int AliHLTD0Trigger::DoDeinit() | |
200 | { | |
201 | // see header file for class documentation | |
202 | delete fD0mass; | |
203 | return 0; | |
204 | } | |
205 | ||
206 | int AliHLTD0Trigger::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 AliHLTD0Trigger::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 | // -minpt for decay | |
226 | if (argument.CompareTo("-pt")==0) { | |
227 | if (++i>=argc) return -EPROTO; | |
228 | argument=argv[i]; | |
229 | fPtMin=argument.Atof(); | |
230 | return 2; | |
231 | } | |
232 | // minimum dca for decay tracks | |
233 | if (argument.CompareTo("-dca")==0) { | |
234 | if (++i>=argc) return -EPROTO; | |
235 | argument=argv[i]; | |
236 | fdca=argument.Atof(); | |
237 | return 2; | |
238 | } | |
239 | // inv. mass half width. | |
240 | if (argument.CompareTo("-invmass")==0) { | |
241 | if (++i>=argc) return -EPROTO; | |
242 | argument=argv[i]; | |
243 | finvMass=argument.Atof(); | |
244 | return 2; | |
245 | } | |
246 | ||
247 | // cos theta for decay angle | |
248 | if (argument.CompareTo("-costhetastar")==0) { | |
249 | if (++i>=argc) return -EPROTO; | |
250 | argument=argv[i]; | |
251 | fcosThetaStar=argument.Atof(); | |
252 | return 2; | |
253 | } | |
254 | ||
255 | // impact parameter for decay | |
256 | if (argument.CompareTo("-d0")==0) { | |
257 | if (++i>=argc) return -EPROTO; | |
258 | argument=argv[i]; | |
259 | fd0=argument.Atof(); | |
260 | return 2; | |
261 | } | |
262 | // product of impact parameter | |
263 | if (argument.CompareTo("-d0d0")==0) { | |
264 | if (++i>=argc) return -EPROTO; | |
265 | argument=argv[i]; | |
266 | fd0d0=argument.Atof(); | |
267 | return 2; | |
268 | } | |
269 | // product of impact parameter | |
270 | if (argument.CompareTo("-cospoint")==0) { | |
271 | if (++i>=argc) return -EPROTO; | |
272 | argument=argv[i]; | |
273 | fcosPoint=argument.Atof(); | |
274 | return 2; | |
275 | } | |
276 | if (argument.CompareTo("-plothistogram")==0) { | |
277 | if (++i>=argc) return -EPROTO; | |
278 | argument=argv[i]; | |
279 | fplothisto=true; | |
280 | return 2; | |
281 | } | |
282 | // unknown argument | |
283 | return -EINVAL; | |
284 | } |