]>
Commit | Line | Data |
---|---|---|
0e339ac7 | 1 | // $Id: AliHLTTRDTrackerV1Component.cxx 23618 2008-01-29 13:07:38Z hristov $ |
2 | ||
4de61263 | 3 | //************************************************************************** |
4 | //* This file is property of and copyright by the ALICE HLT Project * | |
5 | //* ALICE Experiment at CERN, All rights reserved. * | |
6 | //* * | |
7 | //* Primary Authors: * | |
8 | //* for The ALICE HLT Project. * | |
9 | //* * | |
10 | //* Permission to use, copy, modify and distribute this software and its * | |
11 | //* documentation strictly for non-commercial purposes is hereby granted * | |
12 | //* without fee, provided that the above copyright notice appears in all * | |
13 | //* copies and that both the copyright notice and this permission notice * | |
14 | //* appear in the supporting documentation. The authors make no claims * | |
15 | //* about the suitability of this software for any purpose. It is * | |
16 | //* provided "as is" without express or implied warranty. * | |
17 | //************************************************************************** | |
0e339ac7 | 18 | |
19 | /** @file AliHLTTRDTrackerV1Component.cxx | |
4de61263 | 20 | @author |
0e339ac7 | 21 | @date |
4de61263 | 22 | @brief A TRDTrackerV1 processing component for the HLT. |
23 | */ | |
0e339ac7 | 24 | |
25 | #if __GNUC__ >= 3 | |
26 | using namespace std; | |
27 | #endif | |
28 | ||
29 | #include "AliHLTTRDTrackerV1Component.h" | |
30 | #include "AliHLTTRDDefinitions.h" | |
d679dd6c | 31 | #include "AliHLTTRDTrack.h" |
dc2e6604 | 32 | #include "AliHLTTRDUtils.h" |
0e339ac7 | 33 | |
34 | #include "TFile.h" | |
35 | #include "TChain.h" | |
36 | ||
886e8d3d | 37 | #include "AliGeomManager.h" |
0e339ac7 | 38 | #include "AliCDBManager.h" |
775f67d7 | 39 | #include "AliCDBStorage.h" |
b32b76cb | 40 | #include "AliCDBEntry.h" |
0e339ac7 | 41 | #include "AliESDEvent.h" |
0e339ac7 | 42 | #include "AliESDfriend.h" |
43 | ||
9aea5deb | 44 | #include "AliTRDcalibDB.h" |
0e339ac7 | 45 | #include "AliTRDReconstructor.h" |
46 | #include "AliTRDtrackerV1.h" | |
0e339ac7 | 47 | #include "AliTRDrecoParam.h" |
48 | ||
49 | #include <cstdlib> | |
50 | #include <cerrno> | |
51 | #include <string> | |
52 | ||
18ada816 | 53 | ClassImp(AliHLTTRDTrackerV1Component) |
0e339ac7 | 54 | |
d679dd6c | 55 | AliHLTTRDTrackerV1Component::AliHLTTRDTrackerV1Component(): |
56 | AliHLTProcessor(), | |
775f67d7 | 57 | fOutputPercentage(100), // By default we copy to the output exactly what we got as input |
d679dd6c | 58 | fTracker(NULL), |
59 | fRecoParam(NULL), | |
775f67d7 | 60 | fReconstructor(NULL), |
b32b76cb | 61 | fESD(NULL), |
ff350753 | 62 | fClusterArray(NULL), |
b32b76cb | 63 | fRecoParamType(-1), |
64 | fNtimeBins(-1), | |
b32b76cb | 65 | fPIDmethod(1), |
66 | fgeometryFileName(""), | |
c1c0ed93 | 67 | fHLTflag(kTRUE), |
2359a6ef | 68 | fOutputV1Tracks(kTRUE), |
c1c0ed93 | 69 | fHighLevelOutput(kFALSE), |
70 | fEmulateHLTTracks(kFALSE), | |
71 | fImproveTracklets(kTRUE) | |
0e339ac7 | 72 | { |
73 | // Default constructor | |
74 | ||
0e339ac7 | 75 | } |
76 | ||
77 | AliHLTTRDTrackerV1Component::~AliHLTTRDTrackerV1Component() | |
78 | { | |
9aea5deb | 79 | // Destructor |
0e339ac7 | 80 | } |
81 | ||
82 | const char* AliHLTTRDTrackerV1Component::GetComponentID() | |
83 | { | |
84 | // Return the component ID const char * | |
85 | return "TRDTrackerV1"; // The ID of this component | |
86 | } | |
87 | ||
88 | void AliHLTTRDTrackerV1Component::GetInputDataTypes( vector<AliHLTComponent_DataType>& list) | |
89 | { | |
90 | // Get the list of input data | |
91 | list.clear(); // We do not have any requirements for our input data type(s). | |
93ce7d1b | 92 | list.push_back(AliHLTTRDDefinitions::fgkClusterDataType); |
0e339ac7 | 93 | } |
94 | ||
93ce7d1b | 95 | AliHLTComponentDataType AliHLTTRDTrackerV1Component::GetOutputDataType() |
0e339ac7 | 96 | { |
97 | // Get the output data type | |
93ce7d1b | 98 | return kAliHLTMultipleDataType; |
99 | } | |
100 | ||
101 | int AliHLTTRDTrackerV1Component::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) | |
102 | { | |
103 | // Get the output data types | |
104 | tgtList.clear(); | |
93ce7d1b | 105 | tgtList.push_back(kAliHLTDataTypeTrack | kAliHLTDataOriginTRD); |
07f31c0e | 106 | tgtList.push_back(AliHLTTRDDefinitions::fgkTracksDataType); |
93ce7d1b | 107 | return tgtList.size(); |
0e339ac7 | 108 | } |
109 | ||
110 | void AliHLTTRDTrackerV1Component::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
111 | { | |
112 | // Get the output data size | |
113 | constBase = 0; | |
353b0b8d | 114 | inputMultiplier = fOutputV1Tracks ? 2*((double)fOutputPercentage)/100.0 : 0.5*((double)fOutputPercentage)/100.0; |
0e339ac7 | 115 | } |
116 | ||
117 | // Spawn function, return new instance of this class | |
118 | AliHLTComponent* AliHLTTRDTrackerV1Component::Spawn() | |
119 | { | |
0e339ac7 | 120 | return new AliHLTTRDTrackerV1Component; |
121 | }; | |
122 | ||
d679dd6c | 123 | |
0e339ac7 | 124 | int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv ) |
125 | { | |
126 | // perform initialization. We check whether our relative output size is specified in the arguments. | |
b32b76cb | 127 | int iResult=0; |
18ada816 | 128 | |
b32b76cb | 129 | fReconstructor = new AliTRDReconstructor(); |
130 | HLTDebug("TRDReconstructor at 0x%x", fReconstructor); | |
0e339ac7 | 131 | |
b32b76cb | 132 | fESD = new AliESDEvent; |
133 | fESD->CreateStdContent(); | |
775f67d7 | 134 | |
b32b76cb | 135 | TString configuration=""; |
136 | TString argument=""; | |
137 | for (int i=0; i<argc && iResult>=0; i++) { | |
138 | argument=argv[i]; | |
139 | if (!configuration.IsNull()) configuration+=" "; | |
140 | configuration+=argument; | |
775f67d7 | 141 | } |
0e339ac7 | 142 | |
b32b76cb | 143 | if (!configuration.IsNull()) { |
144 | iResult=Configure(configuration.Data()); | |
145 | } else { | |
146 | iResult=Reconfigure(NULL, NULL); | |
f7a1cc68 | 147 | } |
18ada816 | 148 | |
4de61263 | 149 | if(iResult<0) return iResult; |
150 | ||
9aea5deb | 151 | fTracker = new AliTRDtrackerV1(); |
0e339ac7 | 152 | HLTDebug("TRDTracker at 0x%x", fTracker); |
775f67d7 | 153 | fTracker->SetReconstructor(fReconstructor); |
0e339ac7 | 154 | |
ff350753 | 155 | fClusterArray = new TClonesArray("AliTRDcluster"); // would be nice to allocate memory for all clusters here. |
156 | ||
b32b76cb | 157 | return iResult; |
0e339ac7 | 158 | } |
159 | ||
160 | int AliHLTTRDTrackerV1Component::DoDeinit() | |
161 | { | |
162 | // Deinitialization of the component | |
0e339ac7 | 163 | |
d679dd6c | 164 | fTracker->SetClustersOwner(kFALSE); |
0e339ac7 | 165 | delete fTracker; |
93ce7d1b | 166 | fTracker = NULL; |
ff350753 | 167 | |
168 | fClusterArray->Delete(); | |
169 | delete fClusterArray; | |
93ce7d1b | 170 | fClusterArray = NULL; |
9aea5deb | 171 | |
172 | // We need to set clusters in Reconstructor to null to prevent from | |
93ce7d1b | 173 | // double deleting, since we delete TClonesArray by ourself. |
9aea5deb | 174 | fReconstructor->SetClusters(0x0); |
0d66dbf5 | 175 | delete fReconstructor; |
93ce7d1b | 176 | fReconstructor = NULL; |
775f67d7 | 177 | delete fESD; |
93ce7d1b | 178 | fESD = NULL; |
886e8d3d | 179 | |
9aea5deb | 180 | AliTRDcalibDB::Terminate(); |
181 | ||
0e339ac7 | 182 | return 0; |
183 | } | |
184 | ||
d679dd6c | 185 | int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtData, |
186 | const AliHLTComponentBlockData* blocks, | |
187 | AliHLTComponent_TriggerData& /*trigData*/, | |
188 | AliHLTUInt8_t* outputPtr, | |
189 | AliHLTUInt32_t& size, | |
190 | vector<AliHLTComponent_BlockData>& outputBlocks ) | |
0e339ac7 | 191 | { |
192 | // Process an event | |
775f67d7 | 193 | |
775f67d7 | 194 | HLTDebug("NofBlocks %i", evtData.fBlockCnt ); |
dc2e6604 | 195 | |
775f67d7 | 196 | fESD->Reset(); |
75970b8d | 197 | //fESD->SetMagneticField(GetBz()); |
775f67d7 | 198 | |
d679dd6c | 199 | AliHLTUInt32_t totalSize = 0, offset = 0; |
0e339ac7 | 200 | |
c1c0ed93 | 201 | AliHLTComponentDataType expectedDataType = AliHLTTRDDefinitions::fgkClusterDataType; |
d679dd6c | 202 | for ( unsigned long iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ ) |
0e339ac7 | 203 | { |
d679dd6c | 204 | const AliHLTComponentBlockData &block = blocks[iBlock]; |
d679dd6c | 205 | AliHLTComponentDataType inputDataType = block.fDataType; |
18ada816 | 206 | |
c1c0ed93 | 207 | if(inputDataType != expectedDataType) |
d679dd6c | 208 | { |
209 | HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) Wrong received datatype: %s - Skipping", | |
210 | iBlock, evtData.fBlockCnt-1, | |
211 | evtData.fEventID, evtData.fEventID, | |
212 | DataType2Text(inputDataType).c_str()); | |
213 | continue; | |
214 | } | |
c702bc56 | 215 | else { |
18ada816 | 216 | HLTDebug("We get the right data type: Block # %i/%i; Event 0x%08LX (%Lu) Received datatype: %s; Block Size: %i", |
217 | iBlock, evtData.fBlockCnt-1, | |
218 | evtData.fEventID, evtData.fEventID, | |
219 | DataType2Text(inputDataType).c_str(), | |
220 | block.fSize); | |
c702bc56 | 221 | } |
93ce7d1b | 222 | |
4de61263 | 223 | #ifndef NDEBUG |
224 | unsigned long constBase; | |
225 | double inputMultiplier; | |
226 | GetOutputDataSize(constBase,inputMultiplier); | |
227 | if(size<(constBase+block.fSize*inputMultiplier)){ | |
228 | HLTWarning("Memory Block given might be too small: %i < %i; Event %Lu", size, constBase+block.fSize*inputMultiplier, evtData.fEventID); | |
229 | } | |
230 | #endif | |
231 | ||
93ce7d1b | 232 | AliHLTTRDUtils::ReadClusters(fClusterArray, block.fPtr, block.fSize, &fNtimeBins); |
a8277796 | 233 | HLTDebug("Reading number of time bins from input block. Setting number of timebins to %d", fNtimeBins); |
93ce7d1b | 234 | AliTRDtrackerV1::SetNTimeBins(fNtimeBins); |
235 | ||
ff350753 | 236 | HLTDebug("TClonesArray of clusters: nbEntries = %i", fClusterArray->GetEntriesFast()); |
237 | fTracker->LoadClusters(fClusterArray); | |
dc2e6604 | 238 | |
775f67d7 | 239 | fTracker->Clusters2Tracks(fESD); |
d679dd6c | 240 | |
775f67d7 | 241 | Int_t nTracks = fESD->GetNumberOfTracks(); |
dc2e6604 | 242 | HLTInfo("Number of tracks == %d ==", nTracks); |
d679dd6c | 243 | |
93ce7d1b | 244 | TClonesArray* trdTracks; |
245 | trdTracks = fTracker->GetListOfTracks(); | |
18ada816 | 246 | |
c1c0ed93 | 247 | if(fHighLevelOutput){ |
248 | if(fEmulateHLTTracks && trdTracks){ | |
249 | // TClonesArray* oldArr = trdTracks; | |
250 | trdTracks = new TClonesArray(*trdTracks); | |
251 | AliHLTTRDUtils::EmulateHLTTracks(trdTracks); | |
252 | // if(oldArr->At(0)){ | |
253 | // HLTInfo("Old Track:"); | |
254 | // ((AliTRDtrackV1*)oldArr->At(0))->Print("a"); | |
255 | // HLTInfo("\nNew Track:"); | |
256 | // ((AliTRDtrackV1*)trdTracks->At(0))->Print("a"); | |
257 | // } | |
258 | } | |
259 | ||
260 | TObjString strg; | |
261 | strg.String() += fNtimeBins; | |
262 | PushBack(trdTracks, AliHLTTRDDefinitions::fgkHiLvlTracksDataType, 0); | |
263 | PushBack(&strg, AliHLTTRDDefinitions::fgkHiLvlTracksDataType, 0); | |
264 | ||
265 | if(fEmulateHLTTracks && trdTracks){ | |
266 | trdTracks->Delete(); | |
267 | delete trdTracks; | |
268 | } | |
269 | } | |
270 | else if(nTracks>0){ | |
775f67d7 | 271 | HLTDebug("We have an output ESDEvent: 0x%x with %i tracks", fESD, nTracks); |
ff350753 | 272 | AliHLTUInt32_t addedSize = AliHLTTRDUtils::AddESDToOutput(fESD, outputPtr+offset); |
18ada816 | 273 | totalSize += addedSize; |
274 | ||
275 | // Fill block | |
276 | AliHLTComponentBlockData bd; | |
277 | FillBlockData( bd ); | |
278 | //bd.fPtr = outputPtr; | |
279 | bd.fOffset = offset; | |
280 | bd.fSize = addedSize; | |
ff350753 | 281 | bd.fSpecification = block.fSpecification; |
18ada816 | 282 | bd.fDataType = kAliHLTDataTypeTrack | kAliHLTDataOriginTRD; |
283 | outputBlocks.push_back( bd ); | |
93ce7d1b | 284 | HLTDebug("BD ptr 0x%x, offset %i, size %i, datav1Type %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), bd.fSpecification); |
18ada816 | 285 | offset = totalSize; |
286 | ||
93ce7d1b | 287 | if (fOutputV1Tracks && trdTracks){ |
18ada816 | 288 | HLTDebug("We have an output array: pointer to trdTracks = 0x%x, nbEntries = %i", trdTracks, trdTracks->GetEntriesFast()); |
289 | ||
93ce7d1b | 290 | addedSize = AliHLTTRDUtils::AddTracksToOutput(trdTracks, outputPtr+offset, fNtimeBins); |
18ada816 | 291 | totalSize += addedSize; |
292 | ||
293 | // Fill block | |
18ada816 | 294 | FillBlockData( bd ); |
295 | //bd.fPtr = outputPtr; | |
296 | bd.fOffset = offset; | |
297 | bd.fSize = addedSize; | |
ff350753 | 298 | bd.fSpecification = block.fSpecification; |
07f31c0e | 299 | bd.fDataType = AliHLTTRDDefinitions::fgkTracksDataType; |
18ada816 | 300 | outputBlocks.push_back( bd ); |
93ce7d1b | 301 | HLTDebug("BD ptr 0x%x, offset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), bd.fSpecification); |
18ada816 | 302 | offset = totalSize; |
303 | } | |
c702bc56 | 304 | } |
2359a6ef | 305 | |
d679dd6c | 306 | HLTDebug("totalSize: %i", totalSize); |
307 | ||
308 | // if ( totalSize > allocSize ) | |
309 | // { | |
310 | // HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", | |
311 | // totalSize, size ); | |
312 | // return EMSGSIZE; | |
313 | // } | |
314 | ||
315 | //here we are deleting clusters (but not the TClonesArray itself) | |
316 | fTracker->UnloadClusters(); | |
d679dd6c | 317 | AliTRDReconstructor::SetClusters(0x0); |
ff350753 | 318 | fClusterArray->Delete(); |
5a9a2eb5 | 319 | |
4de61263 | 320 | } |
d679dd6c | 321 | |
d679dd6c | 322 | size = totalSize; |
323 | HLTDebug("Event is done. size written to the output is %i", size); | |
d679dd6c | 324 | return 0; |
325 | } | |
b32b76cb | 326 | |
327 | int AliHLTTRDTrackerV1Component::Configure(const char* arguments){ | |
328 | int iResult=0; | |
329 | if (!arguments) return iResult; | |
330 | ||
331 | TString allArgs=arguments; | |
332 | TString argument; | |
333 | int bMissingParam=0; | |
334 | ||
335 | TObjArray* pTokens=allArgs.Tokenize(" "); | |
336 | if (pTokens) { | |
337 | for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) { | |
338 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
339 | if (argument.IsNull()) continue; | |
340 | ||
4de61263 | 341 | if (argument.CompareTo("output_percentage")==0) { |
b32b76cb | 342 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; |
343 | HLTInfo("Setting output percentage to: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
344 | fOutputPercentage=((TObjString*)pTokens->At(i))->GetString().Atoi(); | |
345 | continue; | |
346 | } | |
347 | else if (argument.CompareTo("-solenoidBz")==0) { | |
348 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
75970b8d | 349 | HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz()); |
b32b76cb | 350 | continue; |
351 | } | |
b32b76cb | 352 | else if (argument.CompareTo("-geometry")==0) { |
353 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
354 | HLTInfo("Setting geometry to: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); | |
355 | fgeometryFileName=((TObjString*)pTokens->At(i))->GetString(); | |
356 | continue; | |
357 | } | |
93ce7d1b | 358 | else if (argument.CompareTo("-lowflux")==0) { |
b32b76cb | 359 | fRecoParamType = 0; |
360 | HLTInfo("Low flux reconstruction selected"); | |
361 | continue; | |
362 | } | |
93ce7d1b | 363 | else if (argument.CompareTo("-highflux")==0) { |
b32b76cb | 364 | fRecoParamType = 1; |
365 | HLTInfo("High flux reconstruction selected"); | |
366 | continue; | |
367 | } | |
93ce7d1b | 368 | else if (argument.CompareTo("-cosmics")==0) { |
b32b76cb | 369 | fRecoParamType = 2; |
370 | HLTInfo("Cosmics reconstruction selected"); | |
371 | continue; | |
372 | } | |
c1c0ed93 | 373 | else if (argument.CompareTo("-HLTflag")==0) { |
374 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
375 | TString toCompareTo=((TObjString*)pTokens->At(i))->GetString(); | |
376 | if (toCompareTo.CompareTo("yes")==0){ | |
377 | HLTInfo("Setting HLTflag to: %s", toCompareTo.Data()); | |
378 | fHLTflag=kTRUE; | |
379 | } | |
380 | else if (toCompareTo.CompareTo("no")==0){ | |
381 | HLTInfo("Setting HLTflag to: %s", toCompareTo.Data()); | |
382 | fHLTflag=kFALSE; | |
383 | } | |
384 | else { | |
385 | HLTError("unknown argument for HLTflag: %s", toCompareTo.Data()); | |
386 | iResult=-EINVAL; | |
387 | break; | |
388 | } | |
b32b76cb | 389 | continue; |
390 | } | |
93ce7d1b | 391 | else if (argument.CompareTo("-outputV1Tracks")==0) { |
392 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
393 | TString toCompareTo=((TObjString*)pTokens->At(i))->GetString(); | |
394 | if (toCompareTo.CompareTo("yes")==0){ | |
395 | HLTInfo("Setting OutputV1Tracks to: %s", toCompareTo.Data()); | |
396 | fOutputV1Tracks=kTRUE; | |
397 | } | |
398 | else if (toCompareTo.CompareTo("no")==0){ | |
399 | HLTInfo("Setting OutputV1Tracks to: %s", toCompareTo.Data()); | |
400 | fOutputV1Tracks=kFALSE; | |
401 | } | |
402 | else { | |
403 | HLTError("unknown argument for OutputV1Tracks: %s", toCompareTo.Data()); | |
404 | iResult=-EINVAL; | |
405 | break; | |
406 | } | |
407 | continue; | |
c1c0ed93 | 408 | } |
409 | else if (argument.CompareTo("-highLevelOutput")==0) { | |
410 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
411 | TString toCompareTo=((TObjString*)pTokens->At(i))->GetString(); | |
412 | if (toCompareTo.CompareTo("yes")==0){ | |
413 | HLTWarning("Setting highLevelOutput to: %s", toCompareTo.Data()); | |
414 | fHighLevelOutput=kTRUE; | |
415 | } | |
416 | else if (toCompareTo.CompareTo("no")==0){ | |
417 | HLTInfo("Setting highLevelOutput to: %s", toCompareTo.Data()); | |
418 | fHighLevelOutput=kFALSE; | |
419 | } | |
420 | else { | |
421 | HLTError("unknown argument for highLevelOutput: %s", toCompareTo.Data()); | |
422 | iResult=-EINVAL; | |
423 | break; | |
424 | } | |
425 | continue; | |
426 | } | |
427 | else if (argument.CompareTo("-emulateHLTTracks")==0) { | |
428 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
429 | TString toCompareTo=((TObjString*)pTokens->At(i))->GetString(); | |
430 | if (toCompareTo.CompareTo("yes")==0){ | |
431 | HLTWarning("Setting emulateHLTTracks to: %s", toCompareTo.Data()); | |
432 | fEmulateHLTTracks=kTRUE; | |
433 | } | |
434 | else if (toCompareTo.CompareTo("no")==0){ | |
435 | HLTInfo("Setting emulateHLTTracks to: %s", toCompareTo.Data()); | |
436 | fEmulateHLTTracks=kFALSE; | |
437 | } | |
438 | else { | |
439 | HLTError("unknown argument for emulateHLTTracks: %s", toCompareTo.Data()); | |
440 | iResult=-EINVAL; | |
441 | break; | |
442 | } | |
443 | continue; | |
444 | } | |
b32b76cb | 445 | else if (argument.CompareTo("-PIDmethod")==0) { |
446 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
447 | TString toCompareTo=((TObjString*)pTokens->At(i))->GetString(); | |
448 | if (toCompareTo.CompareTo("LH")==0){ | |
449 | HLTInfo("Setting PID method to: %s", toCompareTo.Data()); | |
450 | fPIDmethod=0; | |
451 | } | |
452 | else if (toCompareTo.CompareTo("NN")==0){ | |
453 | HLTInfo("Setting PID method to: %s", toCompareTo.Data()); | |
454 | fPIDmethod=1; | |
455 | } | |
456 | else if (toCompareTo.CompareTo("TM")==0){ | |
457 | HLTInfo("Setting PID method to: %s", toCompareTo.Data()); | |
458 | fPIDmethod=2; | |
459 | } | |
460 | else { | |
461 | HLTError("unknown argument for PID method: %s", toCompareTo.Data()); | |
462 | iResult=-EINVAL; | |
463 | break; | |
464 | } | |
465 | continue; | |
466 | } | |
467 | ||
468 | else { | |
469 | HLTError("unknown argument: %s", argument.Data()); | |
470 | iResult=-EINVAL; | |
471 | break; | |
472 | } | |
473 | } | |
474 | delete pTokens; | |
475 | } | |
476 | if (bMissingParam) { | |
477 | HLTError("missing parameter for argument %s", argument.Data()); | |
478 | iResult=-EINVAL; | |
479 | } | |
480 | if(iResult>=0){ | |
b32b76cb | 481 | iResult=SetParams(); |
482 | } | |
483 | return iResult; | |
484 | } | |
485 | ||
486 | int AliHLTTRDTrackerV1Component::SetParams() | |
487 | { | |
488 | Int_t iResult=0; | |
489 | if(!AliCDBManager::Instance()->IsDefaultStorageSet()){ | |
4de61263 | 490 | HLTError("DefaultStorage is not set in CDBManager"); |
b32b76cb | 491 | return -EINVAL; |
492 | } | |
493 | if(AliCDBManager::Instance()->GetRun()<0){ | |
494 | HLTError("Run Number is not set in CDBManager"); | |
495 | return -EINVAL; | |
496 | } | |
497 | HLTInfo("CDB default storage: %s; RunNo: %i", (AliCDBManager::Instance()->GetDefaultStorage()->GetBaseFolder()).Data(), AliCDBManager::Instance()->GetRun()); | |
498 | ||
499 | if(!AliGeomManager::GetGeometry()){ | |
1eedaf94 | 500 | if(fgeometryFileName.CompareTo("")==0 || !TFile::Open(fgeometryFileName.Data())){ |
b32b76cb | 501 | HLTInfo("Loading standard geometry file"); |
502 | AliGeomManager::LoadGeometry(); | |
503 | }else{ | |
504 | HLTWarning("Loading NON-standard geometry file"); | |
505 | AliGeomManager::LoadGeometry(fgeometryFileName.Data()); | |
506 | } | |
507 | if(!AliGeomManager::GetGeometry()){ | |
4de61263 | 508 | HLTError("Could not load geometry"); |
b32b76cb | 509 | return -EINVAL; |
510 | } | |
ba9a8c85 | 511 | HLTInfo("Applying Alignment from CDB object"); |
512 | AliGeomManager::ApplyAlignObjsFromCDB("TRD"); | |
b32b76cb | 513 | } |
514 | else{ | |
515 | HLTInfo("Geometry Already Loaded!"); | |
516 | } | |
b32b76cb | 517 | |
c1c0ed93 | 518 | if(fReconstructor->GetRecoParam()){ |
519 | fRecoParam = new AliTRDrecoParam(*fReconstructor->GetRecoParam()); | |
520 | HLTInfo("RecoParam already set!"); | |
521 | }else{ | |
522 | if(fRecoParamType == 0){ | |
b32b76cb | 523 | HLTDebug("Low flux params init."); |
524 | fRecoParam = AliTRDrecoParam::GetLowFluxParam(); | |
525 | } | |
c1c0ed93 | 526 | if(fRecoParamType == 1){ |
b32b76cb | 527 | HLTDebug("High flux params init."); |
528 | fRecoParam = AliTRDrecoParam::GetHighFluxParam(); | |
529 | } | |
c1c0ed93 | 530 | if(fRecoParamType == 2){ |
b32b76cb | 531 | HLTDebug("Cosmic Test params init."); |
532 | fRecoParam = AliTRDrecoParam::GetCosmicTestParam(); | |
533 | } | |
c1c0ed93 | 534 | } |
b32b76cb | 535 | |
c1c0ed93 | 536 | if(!fRecoParam) |
b32b76cb | 537 | { |
538 | HLTError("No reco params initialized. Sniffing big trouble!"); | |
539 | return -EINVAL; | |
540 | } | |
541 | ||
2fc8c061 | 542 | // backward compatibility to AliTRDrecoParam < r34995 |
543 | # ifndef HAVE_NOT_ALITRDRECOPARAM_r34995 | |
544 | # define AliTRDRecoParamSetPIDNeuralNetwork(b) fRecoParam->SetPIDNeuralNetwork(b) | |
545 | # else | |
546 | # define AliTRDRecoParamSetPIDNeuralNetwork(b) fRecoParam->SetPIDNeuralNetwork() | |
547 | # endif | |
548 | ||
9cafabed | 549 | switch(fPIDmethod){ |
2fc8c061 | 550 | case 0: AliTRDRecoParamSetPIDNeuralNetwork(kFALSE); break; |
551 | case 1: AliTRDRecoParamSetPIDNeuralNetwork(kTRUE); break; | |
552 | case 2: AliTRDRecoParamSetPIDNeuralNetwork(kFALSE); break; | |
9cafabed | 553 | } |
554 | ||
c1c0ed93 | 555 | fRecoParam->SetImproveTracklets(fImproveTracklets); |
556 | ||
9cafabed | 557 | fRecoParam->SetStreamLevel(AliTRDrecoParam::kTracker, 0); |
b32b76cb | 558 | fReconstructor->SetRecoParam(fRecoParam); |
559 | ||
9cafabed | 560 | TString recoOptions="sa,!cw"; |
561 | ||
c1c0ed93 | 562 | if(fHLTflag) |
9cafabed | 563 | recoOptions += ",hlt"; |
564 | ||
b32b76cb | 565 | HLTDebug("Reconstructor options are: %s",recoOptions.Data()); |
566 | fReconstructor->SetOption(recoOptions.Data()); | |
567 | ||
b32b76cb | 568 | return iResult; |
569 | } | |
570 | ||
571 | int AliHLTTRDTrackerV1Component::Reconfigure(const char* cdbEntry, const char* chainId) | |
572 | { | |
573 | // see header file for class documentation | |
574 | ||
575 | int iResult=0; | |
576 | const char* path="HLT/ConfigTRD/TrackerV1Component"; | |
577 | const char* defaultNotify=""; | |
578 | if (cdbEntry) { | |
579 | path=cdbEntry; | |
580 | defaultNotify=" (default)"; | |
581 | } | |
582 | if (path) { | |
583 | HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>"); | |
584 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); | |
585 | if (pEntry) { | |
586 | TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject()); | |
587 | if (pString) { | |
588 | HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data()); | |
589 | iResult=Configure(pString->GetString().Data()); | |
590 | } else { | |
591 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
592 | } | |
593 | } else { | |
594 | HLTError("cannot fetch object \"%s\" from CDB", path); | |
595 | } | |
596 | } | |
597 | ||
b32b76cb | 598 | return iResult; |
599 | ||
600 | } | |
601 | ||
602 | int AliHLTTRDTrackerV1Component::ReadPreprocessorValues(const char* modules) | |
603 | { | |
604 | // see header file for class documentation | |
605 | ||
606 | int iResult = 0; | |
607 | TString str(modules); | |
608 | if(str.Contains("HLT") || str.Contains("TRD") || str.Contains("GRP")){ | |
609 | ||
b32b76cb | 610 | } |
611 | return iResult; | |
612 | } |