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