]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TRD/AliHLTTRDTrackerV1Component.cxx
PHOS mapping with 20 objects: one per module per RCU
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDTrackerV1Component.cxx
CommitLineData
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
26using namespace std;
27#endif
28
29#include "AliHLTTRDTrackerV1Component.h"
30#include "AliHLTTRDDefinitions.h"
d679dd6c 31#include "AliHLTTRDCluster.h"
32#include "AliHLTTRDTrack.h"
dc2e6604 33#include "AliHLTTRDUtils.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"
f7a1cc68 43#include "AliMagF.h"
0e339ac7 44#include "AliESDfriend.h"
45
9aea5deb 46#include "AliTRDcalibDB.h"
0e339ac7 47#include "AliTRDReconstructor.h"
48#include "AliTRDtrackerV1.h"
0e339ac7 49#include "AliTRDrecoParam.h"
50
51#include <cstdlib>
52#include <cerrno>
53#include <string>
54
d679dd6c 55#ifdef HAVE_VALGRIND_CALLGRIND_H
56#include <valgrind/callgrind.h>
57#else
e3e5ac39 58#define CALLGRIND_START_INSTRUMENTATION do { } while (0)
59#define CALLGRIND_STOP_INSTRUMENTATION do { } while (0)
d679dd6c 60#endif
0e339ac7 61
18ada816 62ClassImp(AliHLTTRDTrackerV1Component)
0e339ac7 63
d679dd6c 64AliHLTTRDTrackerV1Component::AliHLTTRDTrackerV1Component():
65 AliHLTProcessor(),
775f67d7 66 fOutputPercentage(100), // By default we copy to the output exactly what we got as input
d679dd6c 67 fTracker(NULL),
68 fRecoParam(NULL),
775f67d7 69 fReconstructor(NULL),
b32b76cb 70 fESD(NULL),
ff350753 71 fClusterArray(NULL),
b32b76cb 72 fRecoParamType(-1),
73 fNtimeBins(-1),
74 fMagneticField(-1),
75 fPIDmethod(1),
76 fgeometryFileName(""),
77 fieldStrength(-101),
4de61263 78 fSlowTracking(kFALSE)
0e339ac7 79{
80 // Default constructor
81
0e339ac7 82}
83
84AliHLTTRDTrackerV1Component::~AliHLTTRDTrackerV1Component()
85{
9aea5deb 86 // Destructor
0e339ac7 87}
88
89const char* AliHLTTRDTrackerV1Component::GetComponentID()
90{
91 // Return the component ID const char *
92 return "TRDTrackerV1"; // The ID of this component
93}
94
95void AliHLTTRDTrackerV1Component::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
96{
97 // Get the list of input data
98 list.clear(); // We do not have any requirements for our input data type(s).
99 list.push_back( AliHLTTRDDefinitions::fgkClusterDataType );
100}
101
102AliHLTComponent_DataType AliHLTTRDTrackerV1Component::GetOutputDataType()
103{
104 // Get the output data type
18ada816 105 //return AliHLTTRDDefinitions::fgkClusterDataType;
106 return kAliHLTDataTypeTrack | kAliHLTDataOriginTRD;
0e339ac7 107}
108
109void AliHLTTRDTrackerV1Component::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
110{
111 // Get the output data size
112 constBase = 0;
113 inputMultiplier = ((double)fOutputPercentage)/100.0;
114}
115
116// Spawn function, return new instance of this class
117AliHLTComponent* AliHLTTRDTrackerV1Component::Spawn()
118{
0e339ac7 119 return new AliHLTTRDTrackerV1Component;
120};
121
d679dd6c 122
0e339ac7 123int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv )
124{
125 // perform initialization. We check whether our relative output size is specified in the arguments.
b32b76cb 126 int iResult=0;
18ada816 127
b32b76cb 128 fReconstructor = new AliTRDReconstructor();
129 HLTDebug("TRDReconstructor at 0x%x", fReconstructor);
0e339ac7 130
b32b76cb 131 fESD = new AliESDEvent;
132 fESD->CreateStdContent();
775f67d7 133
b32b76cb 134 TString configuration="";
135 TString argument="";
136 for (int i=0; i<argc && iResult>=0; i++) {
137 argument=argv[i];
138 if (!configuration.IsNull()) configuration+=" ";
139 configuration+=argument;
775f67d7 140 }
0e339ac7 141
b32b76cb 142 if (!configuration.IsNull()) {
143 iResult=Configure(configuration.Data());
144 } else {
145 iResult=Reconfigure(NULL, NULL);
f7a1cc68 146 }
18ada816 147
4de61263 148 if(iResult<0) return iResult;
149
9aea5deb 150 fTracker = new AliTRDtrackerV1();
0e339ac7 151 HLTDebug("TRDTracker at 0x%x", fTracker);
775f67d7 152 fTracker->SetReconstructor(fReconstructor);
0e339ac7 153
ff350753 154 fClusterArray = new TClonesArray("AliTRDcluster"); // would be nice to allocate memory for all clusters here.
155
b32b76cb 156 return iResult;
0e339ac7 157}
158
159int AliHLTTRDTrackerV1Component::DoDeinit()
160{
161 // Deinitialization of the component
0e339ac7 162
d679dd6c 163 fTracker->SetClustersOwner(kFALSE);
0e339ac7 164 delete fTracker;
886e8d3d 165 fTracker = 0x0;
ff350753 166
167 fClusterArray->Delete();
168 delete fClusterArray;
9aea5deb 169
170 // We need to set clusters in Reconstructor to null to prevent from
171 // double deleting, since we delete TClonesArray by ourself in DoEvent.
172 fReconstructor->SetClusters(0x0);
0d66dbf5 173 delete fReconstructor;
174 fReconstructor = 0x0;
775f67d7 175 delete fESD;
176 fESD=NULL;
886e8d3d 177
9aea5deb 178 AliTRDcalibDB::Terminate();
179
0e339ac7 180 return 0;
181}
182
d679dd6c 183int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtData,
184 const AliHLTComponentBlockData* blocks,
185 AliHLTComponent_TriggerData& /*trigData*/,
186 AliHLTUInt8_t* outputPtr,
187 AliHLTUInt32_t& size,
188 vector<AliHLTComponent_BlockData>& outputBlocks )
0e339ac7 189{
190 // Process an event
775f67d7 191
192 if (evtData.fEventID == 1)
193 CALLGRIND_START_INSTRUMENTATION;
194
195 HLTDebug("NofBlocks %i", evtData.fBlockCnt );
dc2e6604 196
775f67d7 197 fESD->Reset();
198 //fESD->SetMagneticField(fSolenoidBz);
199
d679dd6c 200 AliHLTUInt32_t totalSize = 0, offset = 0;
0e339ac7 201 AliHLTUInt32_t dBlockSpecification = 0;
202
d679dd6c 203 vector<AliHLTComponent_DataType> expectedDataTypes;
204 GetInputDataTypes(expectedDataTypes);
d679dd6c 205 for ( unsigned long iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ )
0e339ac7 206 {
d679dd6c 207 const AliHLTComponentBlockData &block = blocks[iBlock];
d679dd6c 208 AliHLTComponentDataType inputDataType = block.fDataType;
209 Bool_t correctDataType = kFALSE;
18ada816 210
211 for(UInt_t i = 0; i < expectedDataTypes.size(); i++){
d679dd6c 212 if( expectedDataTypes.at(i) == inputDataType)
213 correctDataType = kTRUE;
18ada816 214 }
d679dd6c 215 if (!correctDataType)
216 {
217 HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) Wrong received datatype: %s - Skipping",
218 iBlock, evtData.fBlockCnt-1,
219 evtData.fEventID, evtData.fEventID,
220 DataType2Text(inputDataType).c_str());
221 continue;
222 }
c702bc56 223 else {
18ada816 224 HLTDebug("We get the right data type: Block # %i/%i; Event 0x%08LX (%Lu) Received datatype: %s; Block Size: %i",
225 iBlock, evtData.fBlockCnt-1,
226 evtData.fEventID, evtData.fEventID,
227 DataType2Text(inputDataType).c_str(),
228 block.fSize);
c702bc56 229 }
d679dd6c 230
4de61263 231#ifndef NDEBUG
232 unsigned long constBase;
233 double inputMultiplier;
234 GetOutputDataSize(constBase,inputMultiplier);
235 if(size<(constBase+block.fSize*inputMultiplier)){
236 HLTWarning("Memory Block given might be too small: %i < %i; Event %Lu", size, constBase+block.fSize*inputMultiplier, evtData.fEventID);
237 }
238#endif
239
ff350753 240 AliHLTTRDUtils::ReadClusters(fClusterArray, block.fPtr, block.fSize);
241 HLTDebug("TClonesArray of clusters: nbEntries = %i", fClusterArray->GetEntriesFast());
242 fTracker->LoadClusters(fClusterArray);
dc2e6604 243
775f67d7 244 fTracker->Clusters2Tracks(fESD);
d679dd6c 245
775f67d7 246 Int_t nTracks = fESD->GetNumberOfTracks();
dc2e6604 247 HLTInfo("Number of tracks == %d ==", nTracks);
d679dd6c 248
18ada816 249 TClonesArray* trdTracks = 0x0;
250 //trdTracks = fTracker->GetListOfTracks();
251
252 if(nTracks>0){
775f67d7 253 HLTDebug("We have an output ESDEvent: 0x%x with %i tracks", fESD, nTracks);
ff350753 254 AliHLTUInt32_t addedSize = AliHLTTRDUtils::AddESDToOutput(fESD, outputPtr+offset);
18ada816 255 totalSize += addedSize;
256
257 // Fill block
258 AliHLTComponentBlockData bd;
259 FillBlockData( bd );
260 //bd.fPtr = outputPtr;
261 bd.fOffset = offset;
262 bd.fSize = addedSize;
ff350753 263 bd.fSpecification = block.fSpecification;
18ada816 264 bd.fDataType = kAliHLTDataTypeTrack | kAliHLTDataOriginTRD;
265 outputBlocks.push_back( bd );
266 HLTDebug("BD fPtr 0x%x, fOffset %i, fSize %i, fSpec 0x%x", bd.fPtr, bd.fOffset, bd.fSize, bd.fSpecification);
267 offset = totalSize;
268
269 if (trdTracks){
270 //Int_t nbTracks=trdTracks->GetEntriesFast();
271 //if (nbTracks>0){
272 HLTDebug("We have an output array: pointer to trdTracks = 0x%x, nbEntries = %i", trdTracks, trdTracks->GetEntriesFast());
273
ff350753 274 addedSize = AliHLTTRDUtils::AddTracksToOutput(trdTracks, outputPtr+offset);
18ada816 275 totalSize += addedSize;
276
277 // Fill block
18ada816 278 FillBlockData( bd );
279 //bd.fPtr = outputPtr;
280 bd.fOffset = offset;
281 bd.fSize = addedSize;
ff350753 282 bd.fSpecification = block.fSpecification;
18ada816 283 bd.fDataType = AliHLTTRDDefinitions::fgkTRDSATracksDataType;
284 outputBlocks.push_back( bd );
285 HLTDebug("BD fPtr 0x%x, fOffset %i, fSize %i, fSpec 0x%x", bd.fPtr, bd.fOffset, bd.fSize, bd.fSpecification);
286 offset = totalSize;
287 }
c702bc56 288 }
289
d679dd6c 290 HLTDebug("totalSize: %i", totalSize);
291
292// if ( totalSize > allocSize )
293// {
294// HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
295// totalSize, size );
296// return EMSGSIZE;
297// }
298
299 //here we are deleting clusters (but not the TClonesArray itself)
300 fTracker->UnloadClusters();
d679dd6c 301 AliTRDReconstructor::SetClusters(0x0);
ff350753 302 fClusterArray->Delete();
5a9a2eb5 303
4de61263 304 }
d679dd6c 305
d679dd6c 306 size = totalSize;
307 HLTDebug("Event is done. size written to the output is %i", size);
d679dd6c 308 return 0;
309}
b32b76cb 310
311int AliHLTTRDTrackerV1Component::Configure(const char* arguments){
312 int iResult=0;
313 if (!arguments) return iResult;
314
315 TString allArgs=arguments;
316 TString argument;
317 int bMissingParam=0;
318
319 TObjArray* pTokens=allArgs.Tokenize(" ");
320 if (pTokens) {
321 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
322 argument=((TObjString*)pTokens->At(i))->GetString();
323 if (argument.IsNull()) continue;
324
4de61263 325 if (argument.CompareTo("output_percentage")==0) {
b32b76cb 326 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
327 HLTInfo("Setting output percentage to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
328 fOutputPercentage=((TObjString*)pTokens->At(i))->GetString().Atoi();
329 continue;
330 }
331 else if (argument.CompareTo("-solenoidBz")==0) {
332 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
333 fieldStrength=((TObjString*)pTokens->At(i))->GetString().Atof();
334 HLTInfo("Setting Magnetic field to %.1f KGauss", fieldStrength);
335 continue;
336 }
337 else if (argument.CompareTo("-NTimeBins")==0) {
338 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
339 HLTInfo("Setting number of time bins to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
340 fNtimeBins=((TObjString*)pTokens->At(i))->GetString().Atoi();
341 continue;
342 }
343 else if (argument.CompareTo("-geometry")==0) {
344 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
345 HLTInfo("Setting geometry to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
346 fgeometryFileName=((TObjString*)pTokens->At(i))->GetString();
347 continue;
348 }
349 if (argument.CompareTo("-lowflux")==0) {
350 fRecoParamType = 0;
351 HLTInfo("Low flux reconstruction selected");
352 continue;
353 }
354 if (argument.CompareTo("-highflux")==0) {
355 fRecoParamType = 1;
356 HLTInfo("High flux reconstruction selected");
357 continue;
358 }
359 if (argument.CompareTo("-cosmics")==0) {
360 fRecoParamType = 2;
361 HLTInfo("Cosmics reconstruction selected");
362 continue;
363 }
364 if (argument.CompareTo("-magnetic_field_ON")==0) {
365 fMagneticField = 1;
366 HLTInfo("Reconstructon with magnetic field");
367 continue;
368 }
369 if (argument.CompareTo("-magnetic_field_OFF")==0) {
370 fMagneticField = 0;
371 HLTInfo("Reconstructon without magnetic field");
372 continue;
373 }
374 if (argument.CompareTo("-slowTracking")==0) {
375 fSlowTracking = kTRUE;
376 HLTInfo("Using slow tracking");
377 continue;
378 }
379 else if (argument.CompareTo("-PIDmethod")==0) {
380 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
381 TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
382 if (toCompareTo.CompareTo("LH")==0){
383 HLTInfo("Setting PID method to: %s", toCompareTo.Data());
384 fPIDmethod=0;
385 }
386 else if (toCompareTo.CompareTo("NN")==0){
387 HLTInfo("Setting PID method to: %s", toCompareTo.Data());
388 fPIDmethod=1;
389 }
390 else if (toCompareTo.CompareTo("TM")==0){
391 HLTInfo("Setting PID method to: %s", toCompareTo.Data());
392 fPIDmethod=2;
393 }
394 else {
395 HLTError("unknown argument for PID method: %s", toCompareTo.Data());
396 iResult=-EINVAL;
397 break;
398 }
399 continue;
400 }
401
402 else {
403 HLTError("unknown argument: %s", argument.Data());
404 iResult=-EINVAL;
405 break;
406 }
407 }
408 delete pTokens;
409 }
410 if (bMissingParam) {
411 HLTError("missing parameter for argument %s", argument.Data());
412 iResult=-EINVAL;
413 }
414 if(iResult>=0){
b32b76cb 415 iResult=SetParams();
416 }
417 return iResult;
418}
419
420int AliHLTTRDTrackerV1Component::SetParams()
421{
422 Int_t iResult=0;
423 if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
4de61263 424 HLTError("DefaultStorage is not set in CDBManager");
b32b76cb 425 return -EINVAL;
426 }
427 if(AliCDBManager::Instance()->GetRun()<0){
428 HLTError("Run Number is not set in CDBManager");
429 return -EINVAL;
430 }
431 HLTInfo("CDB default storage: %s; RunNo: %i", (AliCDBManager::Instance()->GetDefaultStorage()->GetBaseFolder()).Data(), AliCDBManager::Instance()->GetRun());
432
433 if(!AliGeomManager::GetGeometry()){
1eedaf94 434 if(fgeometryFileName.CompareTo("")==0 || !TFile::Open(fgeometryFileName.Data())){
b32b76cb 435 HLTInfo("Loading standard geometry file");
436 AliGeomManager::LoadGeometry();
437 }else{
438 HLTWarning("Loading NON-standard geometry file");
439 AliGeomManager::LoadGeometry(fgeometryFileName.Data());
440 }
441 if(!AliGeomManager::GetGeometry()){
4de61263 442 HLTError("Could not load geometry");
b32b76cb 443 return -EINVAL;
444 }
445 }
446 else{
447 HLTInfo("Geometry Already Loaded!");
448 }
449
450 if (fNtimeBins <= 0)
451 {
452 HLTError("Sorry. Tracker needs number of time bins. At the moment you have to provide it with -NTimeBins <value>. The simulation always had 24 and the real data 30. Take your pick. Make sure the information is correct. Ask offline to implement how to propagate this information into clusters/cluster tree.");
453 return -EINVAL;
454 }
455 if (fNtimeBins < 24 || fNtimeBins > 30)
456 {
457 HLTWarning("The number of time bins seems to be strange = %d. But okay. Let's try it...", fNtimeBins);
458 }
459 if (fNtimeBins != 24)
460 {
461 HLTWarning("All PID methods eagerly await 24 time bins, so PID will NOT work!", fNtimeBins);
462 }
463 HLTDebug("Setting number of time bins of the tracker to: %i", fNtimeBins);
464 AliTRDtrackerV1::SetNTimeBins(fNtimeBins);
465
466 TString recoOptions="sa,sl_tr_0,!cw";
467
468 if(!fSlowTracking)
469 recoOptions += ",hlt";
470
471 switch(fPIDmethod){
472 case 0: recoOptions += ",!nn"; break;
473 case 1: recoOptions += ",nn"; break;
474 case 2: recoOptions += ",!nn"; break;
475 }
476
477 if (fRecoParamType == 0)
478 {
479 HLTDebug("Low flux params init.");
480 fRecoParam = AliTRDrecoParam::GetLowFluxParam();
481 }
482
483 if (fRecoParamType == 1)
484 {
485 HLTDebug("High flux params init.");
486 fRecoParam = AliTRDrecoParam::GetHighFluxParam();
487 }
488
489 if (fRecoParamType == 2)
490 {
491 HLTDebug("Cosmic Test params init.");
492 fRecoParam = AliTRDrecoParam::GetCosmicTestParam();
493 }
494
495 if (fRecoParam == 0)
496 {
497 HLTError("No reco params initialized. Sniffing big trouble!");
498 return -EINVAL;
499 }
500
501 fReconstructor->SetRecoParam(fRecoParam);
502
503 HLTDebug("Reconstructor options are: %s",recoOptions.Data());
504 fReconstructor->SetOption(recoOptions.Data());
505
506 if (fMagneticField >= 0)
507 {
508 HLTWarning("Setting magnetic field by hand!");
509 }
510 if (!TGeoGlobalMagField::Instance()->IsLocked()) {
511 AliMagF* field;
b32b76cb 512 if (fMagneticField == 0){
513 // magnetic field OFF
514 field = new AliMagF("Maps","Maps",2,0.,0., 10.,AliMagF::k5kGUniform);
515 TGeoGlobalMagField::Instance()->SetField(field);
516 HLTDebug("Magnetic field is OFF.");
517 }else{
518 // magnetic field ON
519 field = new AliMagF("Maps","Maps",2,1.,1., 10.,AliMagF::k5kG);
520 TGeoGlobalMagField::Instance()->SetField(field);
521 HLTDebug("Magnetic field is ON.");
522 if( fMagneticField < 0 )
523 iResult=ReconfigureField();
524 }
525 }else{
526 HLTError("Magnetic field is already set and locked, cannot redefine it." );
527 }
528 return iResult;
529}
530
b32b76cb 531int AliHLTTRDTrackerV1Component::ReconfigureField()
532{
533 int iResult=0;
534 if(fieldStrength<-100){
535 const char* pathBField=kAliHLTCDBSolenoidBz;
536
537 if (pathBField) {
538 HLTInfo("reconfigure B-Field from entry %s", pathBField);
539 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField/*,GetRunNo()*/);
540 if (pEntry) {
541 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
542 if (pString) {
543 HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
544 TObjArray* pTokens=pString->GetString().Tokenize(" ");
545 TString argument;
546 int bMissingParam=0;
547 if (pTokens) {
548 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
549 argument=((TObjString*)pTokens->At(i))->GetString();
550 if (argument.IsNull()) continue;
551
552 if (argument.CompareTo("-solenoidBz")==0) {
553 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
554 HLTDebug("Magnetic field in CDB: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
555 fieldStrength=((TObjString*)pTokens->At(i))->GetString().Atof();
556 continue;
557 } else {
558 HLTError("unknown argument %s", argument.Data());
559 iResult=-EINVAL;
560 break;
561 }
562 }
563 delete pTokens;
564 }
565 } else {
566 HLTError("configuration object \"%s\" has wrong type, required TObjString", pathBField);
567 }
568 } else {
569 HLTError("cannot fetch object \"%s\" from CDB", pathBField);
570 }
571 }
572 }
4de61263 573
b32b76cb 574 if(fieldStrength>=-100){
575 AliMagF* field = (AliMagF *) TGeoGlobalMagField::Instance()->GetField();
4de61263 576 HLTDebug("Magnetic field before change: %f KGauss", field->SolenoidField());
b32b76cb 577 field->SetFactorSol(1);
578 Double_t initialFieldStrengh=field->SolenoidField();
b32b76cb 579 field->SetFactorSol(fieldStrength/initialFieldStrengh);
4de61263 580 HLTDebug("Magnetic field was changed to %f KGauss.", field->SolenoidField());
b32b76cb 581 }
582 return iResult;
583}
584
585int AliHLTTRDTrackerV1Component::Reconfigure(const char* cdbEntry, const char* chainId)
586{
587 // see header file for class documentation
588
589 int iResult=0;
590 const char* path="HLT/ConfigTRD/TrackerV1Component";
591 const char* defaultNotify="";
592 if (cdbEntry) {
593 path=cdbEntry;
594 defaultNotify=" (default)";
595 }
596 if (path) {
597 HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
598 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
599 if (pEntry) {
600 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
601 if (pString) {
602 HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
603 iResult=Configure(pString->GetString().Data());
604 } else {
605 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
606 }
607 } else {
608 HLTError("cannot fetch object \"%s\" from CDB", path);
609 }
610 }
611
612 const char* pathBField=kAliHLTCDBSolenoidBz;
613
614 if (pathBField) {
615 HLTInfo("reconfigure B-Field from entry %s, chain id %s", pathBField,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
616 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField/*,GetRunNo()*/);
617 if (pEntry) {
618 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
619 if (pString) {
620 HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
621 iResult=Configure(pString->GetString().Data());
622 } else {
623 HLTError("configuration object \"%s\" has wrong type, required TObjString", pathBField);
624 }
625 } else {
626 HLTError("cannot fetch object \"%s\" from CDB", pathBField);
627 }
628 }
629
630 return iResult;
631
632}
633
634int AliHLTTRDTrackerV1Component::ReadPreprocessorValues(const char* modules)
635{
636 // see header file for class documentation
637
638 int iResult = 0;
639 TString str(modules);
640 if(str.Contains("HLT") || str.Contains("TRD") || str.Contains("GRP")){
641
642 const char* pathBField=kAliHLTCDBSolenoidBz;
643 if (pathBField) {
644
645 HLTInfo("reconfigure B-Field from entry %s, modules %s", pathBField,(modules!=NULL && modules[0]!=0)?modules:"<none>");
4de61263 646 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField/*,GetRunNo()*/);
b32b76cb 647
4de61263 648 // AliCDBPath path(pathBField);
b32b76cb 649
4de61263 650 // AliCDBStorage *stor = AliCDBManager::Instance()->GetDefaultStorage();
651 // Int_t version = stor->GetLatestVersion(pathBField, GetRunNo());
652 // Int_t subVersion = stor->GetLatestSubVersion(pathBField, GetRunNo(), version);
653 // AliCDBEntry *pEntry = stor->Get(path,GetRunNo(), version, subVersion);
b32b76cb 654
4de61263 655 // HLTInfo("RunNo %d, Version %d, subversion %d", GetRunNo(), version, subVersion);
b32b76cb 656
657 if (pEntry) {
658 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
659 if (pString) {
4de61263 660 HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
b32b76cb 661 iResult=Configure(pString->GetString().Data());
662 } else {
663 HLTError("configuration object \"%s\" has wrong type, required TObjString", pathBField);
664 }
665 } else {
666 HLTError("cannot fetch object \"%s\" from CDB", pathBField);
667 }
668 }
669 }
670 return iResult;
671}