]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TRD/AliHLTTRDTrackerV1Component.cxx
- fix error message in TRD clusterizer and tracker (Theodor)
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDTrackerV1Component.cxx
1 // $Id: AliHLTTRDTrackerV1Component.cxx 23618 2008-01-29 13:07:38Z hristov $
2
3 /**************************************************************************
4  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  *                                                                        *
6  * Authors: Matthias Richter <Matthias.Richter@ift.uib.no>                *
7  *          Timm Steinbeck <timm@kip.uni-heidelberg.de>                   *
8  *          for The ALICE Off-line 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 Timm Steinbeck, Matthias Richter
21     @date   
22     @brief  A TRDTrackerV1 processing component for the HLT. */
23
24 #if __GNUC__ >= 3
25 using namespace std;
26 #endif
27
28 #include "AliHLTTRDTrackerV1Component.h"
29 #include "AliHLTTRDDefinitions.h"
30 #include "AliHLTTRDCluster.h"
31 #include "AliHLTTRDTrack.h"
32 #include "AliHLTTRDUtils.h"
33
34 #include "TFile.h"
35 #include "TChain.h"
36
37 #include "AliGeomManager.h"
38 #include "AliCDBManager.h"
39 #include "AliCDBStorage.h"
40 #include "AliCDBEntry.h"
41 #include "AliESDEvent.h"
42 #include "AliMagF.h"
43 #include "AliESDfriend.h"
44
45 #include "AliTRDcalibDB.h"
46 #include "AliTRDReconstructor.h"
47 #include "AliTRDtrackerV1.h"
48 #include "AliTRDrecoParam.h"
49
50 #include <cstdlib>
51 #include <cerrno>
52 #include <string>
53
54 #ifdef HAVE_VALGRIND_CALLGRIND_H
55 #include <valgrind/callgrind.h>
56 #else
57 #define CALLGRIND_START_INSTRUMENTATION do { } while (0)
58 #define CALLGRIND_STOP_INSTRUMENTATION do { } while (0)
59 #endif
60
61 ClassImp(AliHLTTRDTrackerV1Component)
62     
63 AliHLTTRDTrackerV1Component::AliHLTTRDTrackerV1Component():
64   AliHLTProcessor(),
65   fOutputPercentage(100), // By default we copy to the output exactly what we got as input 
66   fTracker(NULL),
67   fRecoParam(NULL),
68   fReconstructor(NULL),
69   fESD(NULL),
70   fRecoParamType(-1),
71   fNtimeBins(-1),
72   fMagneticField(-1),
73   fPIDmethod(1),
74   fgeometryFileName(""),
75   fieldStrength(-101),
76   fSlowTracking(kFALSE),
77   fOfflineMode(kFALSE)
78 {
79   // Default constructor
80
81 }
82
83 AliHLTTRDTrackerV1Component::~AliHLTTRDTrackerV1Component()
84 {
85   // Destructor
86 }
87
88 const char* AliHLTTRDTrackerV1Component::GetComponentID()
89 {
90   // Return the component ID const char *
91   return "TRDTrackerV1"; // The ID of this component
92 }
93
94 void AliHLTTRDTrackerV1Component::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
95 {
96   // Get the list of input data  
97   list.clear(); // We do not have any requirements for our input data type(s).
98   list.push_back( AliHLTTRDDefinitions::fgkClusterDataType );
99 }
100
101 AliHLTComponent_DataType AliHLTTRDTrackerV1Component::GetOutputDataType()
102 {
103   // Get the output data type
104   //return AliHLTTRDDefinitions::fgkClusterDataType;
105   return  kAliHLTDataTypeTrack | kAliHLTDataOriginTRD;
106 }
107
108 void AliHLTTRDTrackerV1Component::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
109 {
110   // Get the output data size
111   constBase = 0;
112   inputMultiplier = ((double)fOutputPercentage)/100.0;
113 }
114
115 // Spawn function, return new instance of this class
116 AliHLTComponent* AliHLTTRDTrackerV1Component::Spawn()
117 {
118   return new AliHLTTRDTrackerV1Component;
119 };
120
121
122 int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv )
123 {
124   // perform initialization. We check whether our relative output size is specified in the arguments.
125   int iResult=0;
126
127   fReconstructor = new AliTRDReconstructor();
128   HLTDebug("TRDReconstructor at 0x%x", fReconstructor);
129
130   fESD = new AliESDEvent;
131   fESD->CreateStdContent();
132   
133   TString configuration="";
134   TString argument="";
135   for (int i=0; i<argc && iResult>=0; i++) {
136     argument=argv[i];
137     if (!configuration.IsNull()) configuration+=" ";
138     configuration+=argument;
139   }
140
141   if (!configuration.IsNull()) {
142     iResult=Configure(configuration.Data());
143   } else {
144     iResult=Reconfigure(NULL, NULL);
145   }
146
147   fTracker = new AliTRDtrackerV1();
148   HLTDebug("TRDTracker at 0x%x", fTracker);
149   fTracker->SetReconstructor(fReconstructor);
150
151   return iResult;
152 }
153
154 int AliHLTTRDTrackerV1Component::DoDeinit()
155 {
156   // Deinitialization of the component
157
158   fTracker->SetClustersOwner(kFALSE);
159   delete fTracker;
160   fTracker = 0x0;
161   
162   // We need to set clusters in Reconstructor to null to prevent from 
163   // double deleting, since we delete TClonesArray by ourself in DoEvent.
164   fReconstructor->SetClusters(0x0);
165   delete fReconstructor;
166   fReconstructor = 0x0;
167   delete fESD;
168   fESD=NULL;
169   
170   AliTRDcalibDB::Terminate();
171
172   return 0;
173 }
174
175 int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtData, 
176                                           const AliHLTComponentBlockData* blocks, 
177                                           AliHLTComponent_TriggerData& /*trigData*/, 
178                                           AliHLTUInt8_t* outputPtr, 
179                                           AliHLTUInt32_t& size, 
180                                           vector<AliHLTComponent_BlockData>& outputBlocks )
181 {
182   // Process an event
183
184   if (evtData.fEventID == 1)
185     CALLGRIND_START_INSTRUMENTATION;
186
187   HLTDebug("NofBlocks %i", evtData.fBlockCnt );
188   
189   fESD->Reset();
190   //fESD->SetMagneticField(fSolenoidBz);
191
192   AliHLTUInt32_t totalSize = 0, offset = 0;
193   AliHLTUInt32_t dBlockSpecification = 0;
194
195   vector<AliHLTComponent_DataType> expectedDataTypes;
196   GetInputDataTypes(expectedDataTypes);
197   for ( unsigned long iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ ) 
198     {
199       const AliHLTComponentBlockData &block = blocks[iBlock];
200       AliHLTComponentDataType inputDataType = block.fDataType;
201       Bool_t correctDataType = kFALSE;
202
203       for(UInt_t i = 0; i < expectedDataTypes.size(); i++){
204         if( expectedDataTypes.at(i) == inputDataType)
205           correctDataType = kTRUE;
206       }
207       if (!correctDataType)
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         }
215       else {
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);
221       }
222       
223       
224       TClonesArray* clusterArray = new TClonesArray("AliTRDcluster"); // would be nice to allocate memory for all clusters here.
225       AliHLTTRDUtils::ReadClusters(clusterArray, block.fPtr, block.fSize);
226       HLTDebug("TClonesArray of clusters: nbEntries = %i", clusterArray->GetEntriesFast());
227       fTracker->LoadClusters(clusterArray);
228
229       fTracker->Clusters2Tracks(fESD);
230
231       Int_t nTracks = fESD->GetNumberOfTracks();
232       HLTInfo("Number of tracks  == %d ==", nTracks);  
233
234       TClonesArray* trdTracks = 0x0;
235       //trdTracks = fTracker->GetListOfTracks();
236       
237       if(nTracks>0){
238         HLTDebug("We have an output ESDEvent: 0x%x with %i tracks", fESD, nTracks);
239         AliHLTUInt32_t addedSize = AliHLTTRDUtils::AddESDToOutput(fESD, (AliHLTUInt8_t*)(outputPtr+offset));
240         totalSize += addedSize;
241           
242         // Fill block 
243         AliHLTComponentBlockData bd;
244         FillBlockData( bd );
245         //bd.fPtr = outputPtr;
246         bd.fOffset = offset;
247         bd.fSize = addedSize;
248         bd.fSpecification = dBlockSpecification;
249         bd.fDataType = kAliHLTDataTypeTrack | kAliHLTDataOriginTRD;
250         outputBlocks.push_back( bd );
251         HLTDebug("BD fPtr 0x%x, fOffset %i, fSize %i, fSpec 0x%x", bd.fPtr, bd.fOffset, bd.fSize, bd.fSpecification);
252         offset = totalSize;
253
254         if (trdTracks){
255           //Int_t nbTracks=trdTracks->GetEntriesFast();
256           //if (nbTracks>0){
257           HLTDebug("We have an output array: pointer to trdTracks = 0x%x, nbEntries = %i", trdTracks, trdTracks->GetEntriesFast());
258           
259           addedSize = AliHLTTRDUtils::AddTracksToOutput(trdTracks, (AliHLTUInt8_t*)(outputPtr+offset));
260           totalSize += addedSize;
261           
262           // Fill block 
263           FillBlockData( bd );
264           //bd.fPtr = outputPtr;
265           bd.fOffset = offset;
266           bd.fSize = addedSize;
267           bd.fSpecification = dBlockSpecification;
268           bd.fDataType = AliHLTTRDDefinitions::fgkTRDSATracksDataType;
269           outputBlocks.push_back( bd );
270           HLTDebug("BD fPtr 0x%x, fOffset %i, fSize %i, fSpec 0x%x", bd.fPtr, bd.fOffset, bd.fSize, bd.fSpecification);
271           offset = totalSize;
272         }
273       }
274       
275       
276       // if (trdTracks)
277       //        totalSize += TransportTracks(trdTracks, outputPtr, outputBlocks, offset, dBlockSpecification);
278       // else {
279       //          HLTDebug("Bad array trdTracks = 0x%x", trdTracks);
280       // }
281       
282       HLTDebug("totalSize: %i", totalSize);
283       
284 //       if ( totalSize > allocSize )
285 //      {
286 //        HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
287 //        totalSize, size );
288 //        return EMSGSIZE;
289 //      }
290
291       //here we are deleting clusters (but not the TClonesArray itself)
292       fTracker->UnloadClusters();
293       AliTRDReconstructor::SetClusters(0x0);
294       clusterArray->Delete();
295       delete clusterArray;
296       
297       }
298       
299   size = totalSize;
300   HLTDebug("Event is done. size written to the output is %i", size);
301   return 0;
302 }
303
304 int AliHLTTRDTrackerV1Component::Configure(const char* arguments){
305   int iResult=0;
306   if (!arguments) return iResult;
307   
308   TString allArgs=arguments;
309   TString argument;
310   int bMissingParam=0;
311
312   TObjArray* pTokens=allArgs.Tokenize(" ");
313   if (pTokens) {
314     for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
315       argument=((TObjString*)pTokens->At(i))->GetString();
316       if (argument.IsNull()) continue;
317       
318       if (argument.CompareTo("-OFFLINE")==0) {
319         fOfflineMode = kTRUE;
320         HLTFatal("You have selected OFFLINE mode!");
321         HLTFatal("This program shall NOT run on the HLT cluster like this!");
322         continue;
323       }
324       else if (argument.CompareTo("output_percentage")==0) {
325         if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
326         HLTInfo("Setting output percentage to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
327         fOutputPercentage=((TObjString*)pTokens->At(i))->GetString().Atoi();
328         continue;
329       } 
330       else if (argument.CompareTo("-solenoidBz")==0) {
331         if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
332         fieldStrength=((TObjString*)pTokens->At(i))->GetString().Atof();
333         HLTInfo("Setting Magnetic field to %.1f KGauss", fieldStrength);
334         continue;
335       } 
336       else if (argument.CompareTo("-NTimeBins")==0) {
337         if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
338         HLTInfo("Setting number of time bins to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
339         fNtimeBins=((TObjString*)pTokens->At(i))->GetString().Atoi();
340         continue;
341       } 
342       else if (argument.CompareTo("-geometry")==0) {
343         if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
344         HLTInfo("Setting geometry to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
345         fgeometryFileName=((TObjString*)pTokens->At(i))->GetString();
346         continue;
347       } 
348       if (argument.CompareTo("-lowflux")==0) {
349         fRecoParamType = 0;
350         HLTInfo("Low flux reconstruction selected");
351         continue;
352       }
353       if (argument.CompareTo("-highflux")==0) {
354         fRecoParamType = 1;
355         HLTInfo("High flux reconstruction selected");
356         continue;
357       }
358       if (argument.CompareTo("-cosmics")==0) {
359         fRecoParamType = 2;
360         HLTInfo("Cosmics reconstruction selected");
361         continue;
362       }
363       if (argument.CompareTo("-magnetic_field_ON")==0) {
364         fMagneticField = 1;
365         HLTInfo("Reconstructon with magnetic field");
366         continue;
367       }
368       if (argument.CompareTo("-magnetic_field_OFF")==0) {
369         fMagneticField = 0;
370         HLTInfo("Reconstructon without magnetic field");
371         continue;
372       }
373       if (argument.CompareTo("-slowTracking")==0) {
374         fSlowTracking = kTRUE;
375         HLTInfo("Using slow tracking");
376         continue;
377       }
378       else if (argument.CompareTo("-PIDmethod")==0) {
379         if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
380         TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
381         if (toCompareTo.CompareTo("LH")==0){
382           HLTInfo("Setting PID method to: %s", toCompareTo.Data());
383           fPIDmethod=0;
384         }
385         else if (toCompareTo.CompareTo("NN")==0){
386           HLTInfo("Setting PID method to: %s", toCompareTo.Data());
387           fPIDmethod=1;
388         }
389         else if (toCompareTo.CompareTo("TM")==0){
390           HLTInfo("Setting PID method to: %s", toCompareTo.Data());
391           fPIDmethod=2;
392         }
393         else {
394           HLTError("unknown argument for PID method: %s", toCompareTo.Data());
395           iResult=-EINVAL;
396           break;
397         }
398         continue;
399       } 
400       
401       else {
402         HLTError("unknown argument: %s", argument.Data());
403         iResult=-EINVAL;
404         break;
405       }
406     }
407     delete pTokens;
408   }
409   if (bMissingParam) {
410     HLTError("missing parameter for argument %s", argument.Data());
411     iResult=-EINVAL;
412   }
413   if(iResult>=0){
414     if(fOfflineMode)SetOfflineParams();
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("Cannot 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 void AliHLTTRDTrackerV1Component::SetOfflineParams(){
532   HLTFatal("You have entered the OFFLINE configuration!");
533   if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
534     HLTFatal("You are resetting the Default Storage of the CDBManager!");
535     HLTFatal("Let's hope that this program is NOT running on the HLT cluster!");
536     AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
537   }else{
538     HLTError("DefaultStorage was already set!");
539   }
540   if(AliCDBManager::Instance()->GetRun()<0){
541     HLTFatal("You are resetting the CDB run number to 0!");
542     HLTFatal("Let's hope that this program is NOT running on the HLT cluster!");
543     AliCDBManager::Instance()->SetRun(0);
544   }else{
545     HLTError("Run Number was already set!");
546   }
547 }
548
549 int AliHLTTRDTrackerV1Component::ReconfigureField()
550 {
551   int iResult=0;
552   if(fieldStrength<-100){
553     const char* pathBField=kAliHLTCDBSolenoidBz;
554
555     if (pathBField) {
556       HLTInfo("reconfigure B-Field from entry %s", pathBField);
557       AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField/*,GetRunNo()*/);
558       if (pEntry) {
559         TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
560         if (pString) {
561           HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
562           TObjArray* pTokens=pString->GetString().Tokenize(" ");
563           TString argument;
564           int bMissingParam=0;
565           if (pTokens) {
566             for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
567               argument=((TObjString*)pTokens->At(i))->GetString();
568               if (argument.IsNull()) continue;
569       
570               if (argument.CompareTo("-solenoidBz")==0) {
571                 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
572                 HLTDebug("Magnetic field in CDB: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
573                 fieldStrength=((TObjString*)pTokens->At(i))->GetString().Atof();
574                 continue;
575               } else {
576                 HLTError("unknown argument %s", argument.Data());
577                 iResult=-EINVAL;
578                 break;
579               }
580             }
581             delete pTokens;
582           }
583         } else {
584           HLTError("configuration object \"%s\" has wrong type, required TObjString", pathBField);
585         }
586       } else {
587         HLTError("cannot fetch object \"%s\" from CDB", pathBField);
588       }
589     }
590   }
591   if(fieldStrength>=-100){
592     AliMagF* field = (AliMagF *) TGeoGlobalMagField::Instance()->GetField();
593     field->SetFactorSol(1);
594     Double_t initialFieldStrengh=field->SolenoidField();
595     HLTDebug("Magnetic field was: %f KGauss", initialFieldStrengh);
596     field->SetFactorSol(fieldStrength/initialFieldStrengh);
597     HLTDebug("Magnetic field reset to %f KGauss.", field->SolenoidField());
598   }
599   return iResult;
600 }
601
602 int AliHLTTRDTrackerV1Component::Reconfigure(const char* cdbEntry, const char* chainId)
603 {
604   // see header file for class documentation
605
606   int iResult=0;
607   const char* path="HLT/ConfigTRD/TrackerV1Component";
608   const char* defaultNotify="";
609   if (cdbEntry) {
610     path=cdbEntry;
611     defaultNotify=" (default)";
612   }
613   if (path) {
614     HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
615     AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
616     if (pEntry) {
617       TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
618       if (pString) {
619         HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
620         iResult=Configure(pString->GetString().Data());
621       } else {
622         HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
623       }
624     } else {
625       HLTError("cannot fetch object \"%s\" from CDB", path);
626     }
627   }
628
629   const char* pathBField=kAliHLTCDBSolenoidBz;
630
631   if (pathBField) {
632     HLTInfo("reconfigure B-Field from entry %s, chain id %s", pathBField,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
633     AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField/*,GetRunNo()*/);
634     if (pEntry) {
635       TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
636       if (pString) {
637         HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
638         iResult=Configure(pString->GetString().Data());
639       } else {
640         HLTError("configuration object \"%s\" has wrong type, required TObjString", pathBField);
641       }
642     } else {
643       HLTError("cannot fetch object \"%s\" from CDB", pathBField);
644     }
645   }
646   
647   return iResult;
648
649 }
650
651 int AliHLTTRDTrackerV1Component::ReadPreprocessorValues(const char* modules)
652 {
653   // see header file for class documentation
654   
655   int iResult = 0;
656   TString str(modules);
657   if(str.Contains("HLT") || str.Contains("TRD") || str.Contains("GRP")){
658   
659     const char* pathBField=kAliHLTCDBSolenoidBz;
660     if (pathBField) {
661
662       HLTInfo("reconfigure B-Field from entry %s, modules %s", pathBField,(modules!=NULL && modules[0]!=0)?modules:"<none>");
663       //AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField/*,GetRunNo()*/);
664       
665       AliCDBPath path(pathBField);
666       
667       AliCDBStorage *stor = AliCDBManager::Instance()->GetDefaultStorage();
668       Int_t version    = stor->GetLatestVersion(pathBField, GetRunNo());
669       Int_t subVersion = stor->GetLatestSubVersion(pathBField, GetRunNo(), version);
670       AliCDBEntry *pEntry = stor->Get(path,GetRunNo(), version, subVersion);
671       
672       HLTImportant("RunNo %d, Version %d, subversion %d", GetRunNo(), version, subVersion);
673       
674       if (pEntry) {
675         TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
676         if (pString) {
677           HLTImportant("received configuration object string: \'%s\'", pString->GetString().Data());
678           iResult=Configure(pString->GetString().Data());
679         } else {
680           HLTError("configuration object \"%s\" has wrong type, required TObjString", pathBField);
681         }
682       } else {
683         HLTError("cannot fetch object \"%s\" from CDB", pathBField);
684       }
685     }
686   }  
687   return iResult;
688 }