]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TRD/AliHLTTRDTrackerV1Component.cxx
- several small improvements and bug fixes by Theodor (thanks to Jochen)
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDTrackerV1Component.cxx
1 // $Id: AliHLTTRDTrackerV1Component.cxx 23618 2008-01-29 13:07:38Z hristov $
2
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 //**************************************************************************
18
19 /** @file   AliHLTTRDTrackerV1Component.cxx
20     @author 
21     @date   
22     @brief  A TRDTrackerV1 processing component for the HLT.
23 */
24
25 #if __GNUC__ >= 3
26 using namespace std;
27 #endif
28
29 #include "AliHLTTRDTrackerV1Component.h"
30 #include "AliHLTTRDDefinitions.h"
31 #include "AliHLTTRDCluster.h"
32 #include "AliHLTTRDTrack.h"
33 #include "AliHLTTRDUtils.h"
34
35 #include "TFile.h"
36 #include "TChain.h"
37
38 #include "AliGeomManager.h"
39 #include "AliCDBManager.h"
40 #include "AliCDBStorage.h"
41 #include "AliCDBEntry.h"
42 #include "AliESDEvent.h"
43 #include "AliMagF.h"
44 #include "AliESDfriend.h"
45
46 #include "AliTRDcalibDB.h"
47 #include "AliTRDReconstructor.h"
48 #include "AliTRDtrackerV1.h"
49 #include "AliTRDrecoParam.h"
50
51 #include <cstdlib>
52 #include <cerrno>
53 #include <string>
54
55 #ifdef HAVE_VALGRIND_CALLGRIND_H
56 #include <valgrind/callgrind.h>
57 #else
58 #define CALLGRIND_START_INSTRUMENTATION do { } while (0)
59 #define CALLGRIND_STOP_INSTRUMENTATION do { } while (0)
60 #endif
61
62 ClassImp(AliHLTTRDTrackerV1Component)
63     
64 AliHLTTRDTrackerV1Component::AliHLTTRDTrackerV1Component():
65   AliHLTProcessor(),
66   fOutputPercentage(100), // By default we copy to the output exactly what we got as input 
67   fTracker(NULL),
68   fRecoParam(NULL),
69   fReconstructor(NULL),
70   fESD(NULL),
71   fClusterArray(NULL),
72   fRecoParamType(-1),
73   fNtimeBins(-1),
74   fMagneticField(-1),
75   fPIDmethod(1),
76   fgeometryFileName(""),
77   fieldStrength(-101),
78   fSlowTracking(kFALSE)
79 {
80   // Default constructor
81
82 }
83
84 AliHLTTRDTrackerV1Component::~AliHLTTRDTrackerV1Component()
85 {
86   // Destructor
87 }
88
89 const char* AliHLTTRDTrackerV1Component::GetComponentID()
90 {
91   // Return the component ID const char *
92   return "TRDTrackerV1"; // The ID of this component
93 }
94
95 void 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
102 AliHLTComponent_DataType AliHLTTRDTrackerV1Component::GetOutputDataType()
103 {
104   // Get the output data type
105   //return AliHLTTRDDefinitions::fgkClusterDataType;
106   return  kAliHLTDataTypeTrack | kAliHLTDataOriginTRD;
107 }
108
109 void 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
117 AliHLTComponent* AliHLTTRDTrackerV1Component::Spawn()
118 {
119   return new AliHLTTRDTrackerV1Component;
120 };
121
122
123 int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv )
124 {
125   // perform initialization. We check whether our relative output size is specified in the arguments.
126   int iResult=0;
127
128   fReconstructor = new AliTRDReconstructor();
129   HLTDebug("TRDReconstructor at 0x%x", fReconstructor);
130
131   fESD = new AliESDEvent;
132   fESD->CreateStdContent();
133   
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;
140   }
141
142   if (!configuration.IsNull()) {
143     iResult=Configure(configuration.Data());
144   } else {
145     iResult=Reconfigure(NULL, NULL);
146   }
147
148   if(iResult<0) return iResult;
149
150   fTracker = new AliTRDtrackerV1();
151   HLTDebug("TRDTracker at 0x%x", fTracker);
152   fTracker->SetReconstructor(fReconstructor);
153
154   fClusterArray = new TClonesArray("AliTRDcluster"); // would be nice to allocate memory for all clusters here.
155
156   return iResult;
157 }
158
159 int AliHLTTRDTrackerV1Component::DoDeinit()
160 {
161   // Deinitialization of the component
162
163   fTracker->SetClustersOwner(kFALSE);
164   delete fTracker;
165   fTracker = 0x0;
166
167   fClusterArray->Delete();
168   delete fClusterArray;
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);
173   delete fReconstructor;
174   fReconstructor = 0x0;
175   delete fESD;
176   fESD=NULL;
177   
178   AliTRDcalibDB::Terminate();
179
180   return 0;
181 }
182
183 int 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 )
189 {
190   // Process an event
191
192   if (evtData.fEventID == 1)
193     CALLGRIND_START_INSTRUMENTATION;
194
195   HLTDebug("NofBlocks %i", evtData.fBlockCnt );
196   
197   fESD->Reset();
198   //fESD->SetMagneticField(fSolenoidBz);
199
200   AliHLTUInt32_t totalSize = 0, offset = 0;
201   AliHLTUInt32_t dBlockSpecification = 0;
202
203   vector<AliHLTComponent_DataType> expectedDataTypes;
204   GetInputDataTypes(expectedDataTypes);
205   for ( unsigned long iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ ) 
206     {
207       const AliHLTComponentBlockData &block = blocks[iBlock];
208       AliHLTComponentDataType inputDataType = block.fDataType;
209       Bool_t correctDataType = kFALSE;
210
211       for(UInt_t i = 0; i < expectedDataTypes.size(); i++){
212         if( expectedDataTypes.at(i) == inputDataType)
213           correctDataType = kTRUE;
214       }
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         }
223       else {
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);
229       }
230       
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
240       AliHLTTRDUtils::ReadClusters(fClusterArray, block.fPtr, block.fSize);
241       HLTDebug("TClonesArray of clusters: nbEntries = %i", fClusterArray->GetEntriesFast());
242       fTracker->LoadClusters(fClusterArray);
243
244       fTracker->Clusters2Tracks(fESD);
245
246       Int_t nTracks = fESD->GetNumberOfTracks();
247       HLTInfo("Number of tracks  == %d ==", nTracks);  
248
249       TClonesArray* trdTracks = 0x0;
250       //trdTracks = fTracker->GetListOfTracks();
251       
252       if(nTracks>0){
253         HLTDebug("We have an output ESDEvent: 0x%x with %i tracks", fESD, nTracks);
254         AliHLTUInt32_t addedSize = AliHLTTRDUtils::AddESDToOutput(fESD, outputPtr+offset);
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;
263         bd.fSpecification = block.fSpecification;
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           
274           addedSize = AliHLTTRDUtils::AddTracksToOutput(trdTracks, outputPtr+offset);
275           totalSize += addedSize;
276           
277           // Fill block 
278           FillBlockData( bd );
279           //bd.fPtr = outputPtr;
280           bd.fOffset = offset;
281           bd.fSize = addedSize;
282           bd.fSpecification = block.fSpecification;
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         }
288       }
289       
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();
301       AliTRDReconstructor::SetClusters(0x0);
302       fClusterArray->Delete();
303       
304     }
305       
306   size = totalSize;
307   HLTDebug("Event is done. size written to the output is %i", size);
308   return 0;
309 }
310
311 int 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       
325       if (argument.CompareTo("output_percentage")==0) {
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){
415     iResult=SetParams();
416   }
417   return iResult;
418 }
419
420 int AliHLTTRDTrackerV1Component::SetParams()
421 {
422   Int_t iResult=0;
423   if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
424     HLTError("DefaultStorage is not set in CDBManager");
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()){
434     if(fgeometryFileName.CompareTo("")==0 || !TFile::Open(fgeometryFileName.Data())){
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()){
442       HLTError("Could not load geometry");
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;
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
531 int 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   }
573
574   if(fieldStrength>=-100){
575     AliMagF* field = (AliMagF *) TGeoGlobalMagField::Instance()->GetField();
576     HLTDebug("Magnetic field before change: %f KGauss", field->SolenoidField());
577     field->SetFactorSol(1);
578     Double_t initialFieldStrengh=field->SolenoidField();
579     field->SetFactorSol(fieldStrength/initialFieldStrengh);
580     HLTDebug("Magnetic field was changed to %f KGauss.", field->SolenoidField());
581   }
582   return iResult;
583 }
584
585 int 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
634 int 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>");
646       AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField/*,GetRunNo()*/);
647       
648       // AliCDBPath path(pathBField);
649       
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);
654       
655       // HLTInfo("RunNo %d, Version %d, subversion %d", GetRunNo(), version, subVersion);
656       
657       if (pEntry) {
658         TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
659         if (pString) {
660           HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
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 }