]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TRD/AliHLTTRDTrackerV1Component.cxx
style modifications (Markus)
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDTrackerV1Component.cxx
index 2769b874608ba89b9cccd9b43aec7392448b93e8..293ec6ae84c3e2626eaf556cfbbfee6c4fe443b7 100644 (file)
@@ -1,25 +1,26 @@
-// $Id: AliHLTTRDTrackerV1Component.cxx 23618 2008-01-29 13:07:38Z hristov $
-
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Authors: Matthias Richter <Matthias.Richter@ift.uib.no>                *
- *          Timm Steinbeck <timm@kip.uni-heidelberg.de>                   *
- *          for The ALICE Off-line Project.                               *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors:                                                       *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
 
 /** @file   AliHLTTRDTrackerV1Component.cxx
-    @author Timm Steinbeck, Matthias Richter
+    @author Theodor Rascanu
     @date   
-    @brief  A TRDTrackerV1 processing component for the HLT. */
+    @brief  A TRDTrackerV1 processing component for the HLT.
+*/
 
 #if __GNUC__ >= 3
 using namespace std;
@@ -27,7 +28,6 @@ using namespace std;
 
 #include "AliHLTTRDTrackerV1Component.h"
 #include "AliHLTTRDDefinitions.h"
-#include "AliHLTTRDCluster.h"
 #include "AliHLTTRDTrack.h"
 #include "AliHLTTRDUtils.h"
 
@@ -39,7 +39,6 @@ using namespace std;
 #include "AliCDBStorage.h"
 #include "AliCDBEntry.h"
 #include "AliESDEvent.h"
-#include "AliMagF.h"
 #include "AliESDfriend.h"
 
 #include "AliTRDcalibDB.h"
@@ -51,15 +50,21 @@ using namespace std;
 #include <cerrno>
 #include <string>
 
-#ifdef HAVE_VALGRIND_CALLGRIND_H
-#include <valgrind/callgrind.h>
-#else
-#define CALLGRIND_START_INSTRUMENTATION do { } while (0)
-#define CALLGRIND_STOP_INSTRUMENTATION do { } while (0)
-#endif
-
 ClassImp(AliHLTTRDTrackerV1Component)
-    
+
+void AliHLTTRDTrackerV1Component::AliHLTTRDESDEvent::CreateStdContent()
+{
+  TClonesArray* tracksArray = new TClonesArray("AliESDtrack",0);
+  tracksArray->SetName(AliESDEvent::fgkESDListName[AliESDEvent::kTracks]);
+  AddObject(tracksArray);
+  GetStdContent();
+}
+
+void AliHLTTRDTrackerV1Component::AliHLTTRDESDEvent::Streamer(TBuffer &/*R__b*/)
+{
+  AliFatal("class is for internal us only and not for streaming");
+}
+
 AliHLTTRDTrackerV1Component::AliHLTTRDTrackerV1Component():
   AliHLTProcessor(),
   fOutputPercentage(100), // By default we copy to the output exactly what we got as input 
@@ -67,14 +72,16 @@ AliHLTTRDTrackerV1Component::AliHLTTRDTrackerV1Component():
   fRecoParam(NULL),
   fReconstructor(NULL),
   fESD(NULL),
+  fClusterArray(NULL),
   fRecoParamType(-1),
   fNtimeBins(-1),
-  fMagneticField(-1),
   fPIDmethod(1),
   fgeometryFileName(""),
-  fieldStrength(-101),
-  fSlowTracking(kFALSE),
-  fOfflineMode(kFALSE)
+  fHLTflag(kTRUE),
+  fOutputV1Tracks(kTRUE),
+  fHighLevelOutput(kFALSE),
+  fEmulateHLTTracks(kFALSE),
+  fImproveTracklets(kFALSE)
 {
   // Default constructor
 
@@ -95,21 +102,29 @@ void AliHLTTRDTrackerV1Component::GetInputDataTypes( vector<AliHLTComponent_Data
 {
   // Get the list of input data  
   list.clear(); // We do not have any requirements for our input data type(s).
-  list.push_back( AliHLTTRDDefinitions::fgkClusterDataType );
+  list.push_back(AliHLTTRDDefinitions::fgkClusterDataType);
 }
 
-AliHLTComponent_DataType AliHLTTRDTrackerV1Component::GetOutputDataType()
+AliHLTComponentDataType AliHLTTRDTrackerV1Component::GetOutputDataType()
 {
   // Get the output data type
-  //return AliHLTTRDDefinitions::fgkClusterDataType;
-  return  kAliHLTDataTypeTrack | kAliHLTDataOriginTRD;
+  return kAliHLTMultipleDataType;
+}
+
+int AliHLTTRDTrackerV1Component::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
+{
+  // Get the output data types
+  tgtList.clear();
+  tgtList.push_back(kAliHLTDataTypeTrack | kAliHLTDataOriginTRD);
+  tgtList.push_back(AliHLTTRDDefinitions::fgkTracksDataType);
+  return tgtList.size();
 }
 
 void AliHLTTRDTrackerV1Component::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
 {
   // Get the output data size
   constBase = 0;
-  inputMultiplier = ((double)fOutputPercentage)/100.0;
+  inputMultiplier = fOutputV1Tracks ? 2*((double)fOutputPercentage)/100.0 : 0.5*((double)fOutputPercentage)/100.0;
 }
 
 // Spawn function, return new instance of this class
@@ -126,10 +141,9 @@ int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv )
 
   fReconstructor = new AliTRDReconstructor();
   HLTDebug("TRDReconstructor at 0x%x", fReconstructor);
-
-  fESD = new AliESDEvent;
+  fESD = new AliHLTTRDESDEvent();
   fESD->CreateStdContent();
-  
+
   TString configuration="";
   TString argument="";
   for (int i=0; i<argc && iResult>=0; i++) {
@@ -144,10 +158,14 @@ int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv )
     iResult=Reconfigure(NULL, NULL);
   }
 
+  if(iResult<0) return iResult;
+
   fTracker = new AliTRDtrackerV1();
   HLTDebug("TRDTracker at 0x%x", fTracker);
   fTracker->SetReconstructor(fReconstructor);
 
+  fClusterArray = new TClonesArray("AliTRDcluster"); // would be nice to allocate memory for all clusters here.
+
   return iResult;
 }
 
@@ -157,15 +175,19 @@ int AliHLTTRDTrackerV1Component::DoDeinit()
 
   fTracker->SetClustersOwner(kFALSE);
   delete fTracker;
-  fTracker = 0x0;
+  fTracker = NULL;
+
+  fClusterArray->Delete();
+  delete fClusterArray;
+  fClusterArray = NULL;
   
   // We need to set clusters in Reconstructor to null to prevent from 
-  // double deleting, since we delete TClonesArray by ourself in DoEvent.
+  // double deleting, since we delete TClonesArray by ourself.
   fReconstructor->SetClusters(0x0);
   delete fReconstructor;
-  fReconstructor = 0x0;
+  fReconstructor = NULL;
   delete fESD;
-  fESD=NULL;
+  fESD = NULL;
   
   AliTRDcalibDB::Terminate();
 
@@ -181,30 +203,17 @@ int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtDat
 {
   // Process an event
 
-  if (evtData.fEventID == 1)
-    CALLGRIND_START_INSTRUMENTATION;
-
   HLTDebug("NofBlocks %i", evtData.fBlockCnt );
   
-  fESD->Reset();
-  //fESD->SetMagneticField(fSolenoidBz);
-
   AliHLTUInt32_t totalSize = 0, offset = 0;
-  AliHLTUInt32_t dBlockSpecification = 0;
 
-  vector<AliHLTComponent_DataType> expectedDataTypes;
-  GetInputDataTypes(expectedDataTypes);
+  AliHLTComponentDataType expectedDataType = AliHLTTRDDefinitions::fgkClusterDataType;
   for ( unsigned long iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ ) 
     {
       const AliHLTComponentBlockData &block = blocks[iBlock];
       AliHLTComponentDataType inputDataType = block.fDataType;
-      Bool_t correctDataType = kFALSE;
 
-      for(UInt_t i = 0; i < expectedDataTypes.size(); i++){
-       if( expectedDataTypes.at(i) == inputDataType)
-         correctDataType = kTRUE;
-      }
-      if (!correctDataType)
+      if(inputDataType != expectedDataType)
        {
          HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) Wrong received datatype: %s - Skipping",
                    iBlock, evtData.fBlockCnt-1,
@@ -219,24 +228,65 @@ int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtDat
                 DataType2Text(inputDataType).c_str(),
                 block.fSize);
       }
-      
-      
-      TClonesArray* clusterArray = new TClonesArray("AliTRDcluster"); // would be nice to allocate memory for all clusters here.
-      AliHLTTRDUtils::ReadClusters(clusterArray, block.fPtr, block.fSize);
-      HLTDebug("TClonesArray of clusters: nbEntries = %i", clusterArray->GetEntriesFast());
-      fTracker->LoadClusters(clusterArray);
+
+#ifndef NDEBUG
+      unsigned long constBase;
+      double inputMultiplier;
+      GetOutputDataSize(constBase,inputMultiplier);
+      if(size<(constBase+block.fSize*inputMultiplier)){
+       HLTWarning("Memory Block given might be too small: %i < %i; Event %Lu", size, constBase+block.fSize*inputMultiplier, evtData.fEventID);
+      }
+#endif      
+
+      fESD->Reset();
+      //fESD->SetMagneticField(GetBz());
+
+      AliHLTTRDUtils::ReadClusters(fClusterArray, block.fPtr, block.fSize, &fNtimeBins);
+      HLTDebug("Reading number of time bins from input block. Setting number of timebins to %d", fNtimeBins);
+      AliTRDtrackerV1::SetNTimeBins(fNtimeBins);
+
+      HLTDebug("TClonesArray of clusters: nbEntries = %i", fClusterArray->GetEntriesFast());
+      fTracker->LoadClusters(fClusterArray);
 
       fTracker->Clusters2Tracks(fESD);
 
       Int_t nTracks = fESD->GetNumberOfTracks();
       HLTInfo("Number of tracks  == %d ==", nTracks);  
 
-      TClonesArray* trdTracks = 0x0;
-      //trdTracks = fTracker->GetListOfTracks();
+      TClonesArray* trdTracks;
+      trdTracks = fTracker->GetListOfTracks();
       
-      if(nTracks>0){
+      if(fHighLevelOutput){
+       if(fEmulateHLTTracks && trdTracks){
+         // TClonesArray* oldArr = trdTracks;
+         trdTracks = new TClonesArray(*trdTracks);
+         AliHLTTRDUtils::EmulateHLTTracks(trdTracks);
+         // if(oldArr->At(0)){
+         //   HLTInfo("Old Track:");
+         //   ((AliTRDtrackV1*)oldArr->At(0))->Print("a");
+         //   HLTInfo("\nNew Track:");
+         //   ((AliTRDtrackV1*)trdTracks->At(0))->Print("a");
+         // }
+       }
+
+       TObjString strg;
+       strg.String() += fNtimeBins;
+       if(trdTracks)
+         PushBack(trdTracks, AliHLTTRDDefinitions::fgkHiLvlTracksDataType, block.fSpecification);
+       else{
+         TClonesArray temp("AliTRDtrackV1");
+         PushBack(&temp, AliHLTTRDDefinitions::fgkHiLvlTracksDataType, block.fSpecification);
+       }
+       PushBack(&strg, AliHLTTRDDefinitions::fgkHiLvlTracksDataType, block.fSpecification);
+
+       if(fEmulateHLTTracks && trdTracks){
+         trdTracks->Delete();
+         delete trdTracks;
+       }
+      }
+      else if(nTracks>0){
        HLTDebug("We have an output ESDEvent: 0x%x with %i tracks", fESD, nTracks);
-       AliHLTUInt32_t addedSize = AliHLTTRDUtils::AddESDToOutput(fESD, (AliHLTUInt8_t*)(outputPtr+offset));
+       AliHLTUInt32_t addedSize = AliHLTTRDUtils::AddESDToOutput(fESD, outputPtr+offset);
        totalSize += addedSize;
          
        // Fill block 
@@ -245,18 +295,16 @@ int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtDat
        //bd.fPtr = outputPtr;
        bd.fOffset = offset;
        bd.fSize = addedSize;
-       bd.fSpecification = dBlockSpecification;
+       bd.fSpecification = block.fSpecification;
        bd.fDataType = kAliHLTDataTypeTrack | kAliHLTDataOriginTRD;
        outputBlocks.push_back( bd );
-       HLTDebug("BD fPtr 0x%x, fOffset %i, fSize %i, fSpec 0x%x", bd.fPtr, bd.fOffset, bd.fSize, bd.fSpecification);
+       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);
        offset = totalSize;
 
-       if (trdTracks){
-         //Int_t nbTracks=trdTracks->GetEntriesFast();
-         //if (nbTracks>0){
+       if (fOutputV1Tracks && trdTracks){
          HLTDebug("We have an output array: pointer to trdTracks = 0x%x, nbEntries = %i", trdTracks, trdTracks->GetEntriesFast());
          
-         addedSize = AliHLTTRDUtils::AddTracksToOutput(trdTracks, (AliHLTUInt8_t*)(outputPtr+offset));
+         addedSize = AliHLTTRDUtils::AddTracksToOutput(trdTracks, outputPtr+offset, fNtimeBins);
          totalSize += addedSize;
          
          // Fill block 
@@ -264,21 +312,14 @@ int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtDat
          //bd.fPtr = outputPtr;
          bd.fOffset = offset;
          bd.fSize = addedSize;
-         bd.fSpecification = dBlockSpecification;
-         bd.fDataType = AliHLTTRDDefinitions::fgkTRDSATracksDataType;
+         bd.fSpecification = block.fSpecification;
+         bd.fDataType = AliHLTTRDDefinitions::fgkTracksDataType;
          outputBlocks.push_back( bd );
-         HLTDebug("BD fPtr 0x%x, fOffset %i, fSize %i, fSpec 0x%x", bd.fPtr, bd.fOffset, bd.fSize, bd.fSpecification);
+         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);
          offset = totalSize;
        }
       }
-      
-      
-      // if (trdTracks)
-      //       totalSize += TransportTracks(trdTracks, outputPtr, outputBlocks, offset, dBlockSpecification);
-      // else {
-      //         HLTDebug("Bad array trdTracks = 0x%x", trdTracks);
-      // }
-      
+
       HLTDebug("totalSize: %i", totalSize);
       
 //       if ( totalSize > allocSize )
@@ -291,10 +332,9 @@ int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtDat
       //here we are deleting clusters (but not the TClonesArray itself)
       fTracker->UnloadClusters();
       AliTRDReconstructor::SetClusters(0x0);
-      clusterArray->Delete();
-      delete clusterArray;
+      fClusterArray->Delete();
       
-      }
+    }
       
   size = totalSize;
   HLTDebug("Event is done. size written to the output is %i", size);
@@ -315,13 +355,7 @@ int AliHLTTRDTrackerV1Component::Configure(const char* arguments){
       argument=((TObjString*)pTokens->At(i))->GetString();
       if (argument.IsNull()) continue;
       
-      if (argument.CompareTo("-OFFLINE")==0) {
-       fOfflineMode = kTRUE;
-       HLTFatal("You have selected OFFLINE mode!");
-       HLTFatal("This program shall NOT run on the HLT cluster like this!");
-       continue;
-      }
-      else if (argument.CompareTo("output_percentage")==0) {
+      if (argument.CompareTo("output_percentage")==0) {
        if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
        HLTInfo("Setting output percentage to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
        fOutputPercentage=((TObjString*)pTokens->At(i))->GetString().Atoi();
@@ -329,14 +363,7 @@ int AliHLTTRDTrackerV1Component::Configure(const char* arguments){
       } 
       else if (argument.CompareTo("-solenoidBz")==0) {
        if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
-       fieldStrength=((TObjString*)pTokens->At(i))->GetString().Atof();
-       HLTInfo("Setting Magnetic field to %.1f KGauss", fieldStrength);
-       continue;
-      } 
-      else if (argument.CompareTo("-NTimeBins")==0) {
-       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
-       HLTInfo("Setting number of time bins to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
-       fNtimeBins=((TObjString*)pTokens->At(i))->GetString().Atoi();
+       HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
        continue;
       } 
       else if (argument.CompareTo("-geometry")==0) {
@@ -345,34 +372,91 @@ int AliHLTTRDTrackerV1Component::Configure(const char* arguments){
        fgeometryFileName=((TObjString*)pTokens->At(i))->GetString();
        continue;
       } 
-      if (argument.CompareTo("-lowflux")==0) {
+      else if (argument.CompareTo("-lowflux")==0) {
        fRecoParamType = 0;
        HLTInfo("Low flux reconstruction selected");
        continue;
       }
-      if (argument.CompareTo("-highflux")==0) {
+      else if (argument.CompareTo("-highflux")==0) {
        fRecoParamType = 1;
        HLTInfo("High flux reconstruction selected");
        continue;
       }
-      if (argument.CompareTo("-cosmics")==0) {
+      else if (argument.CompareTo("-cosmics")==0) {
        fRecoParamType = 2;
        HLTInfo("Cosmics reconstruction selected");
        continue;
       }
-      if (argument.CompareTo("-magnetic_field_ON")==0) {
-       fMagneticField = 1;
-       HLTInfo("Reconstructon with magnetic field");
+      else if (argument.CompareTo("-HLTflag")==0) {
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
+       if (toCompareTo.CompareTo("yes")==0){
+         HLTInfo("Setting HLTflag to: %s", toCompareTo.Data());
+         fHLTflag=kTRUE;
+       }
+       else if (toCompareTo.CompareTo("no")==0){
+         HLTInfo("Setting HLTflag to: %s", toCompareTo.Data());
+         fHLTflag=kFALSE;
+       }
+       else {
+         HLTError("unknown argument for HLTflag: %s", toCompareTo.Data());
+         iResult=-EINVAL;
+         break;
+       }
        continue;
       }
-      if (argument.CompareTo("-magnetic_field_OFF")==0) {
-       fMagneticField = 0;
-       HLTInfo("Reconstructon without magnetic field");
+      else if (argument.CompareTo("-outputV1Tracks")==0) {
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
+       if (toCompareTo.CompareTo("yes")==0){
+         HLTInfo("Setting OutputV1Tracks to: %s", toCompareTo.Data());
+         fOutputV1Tracks=kTRUE;
+       }
+       else if (toCompareTo.CompareTo("no")==0){
+         HLTInfo("Setting OutputV1Tracks to: %s", toCompareTo.Data());
+         fOutputV1Tracks=kFALSE;
+       }
+       else {
+         HLTError("unknown argument for OutputV1Tracks: %s", toCompareTo.Data());
+         iResult=-EINVAL;
+         break;
+       }
        continue;
       }
-      if (argument.CompareTo("-slowTracking")==0) {
-       fSlowTracking = kTRUE;
-       HLTInfo("Using slow tracking");
+      else if (argument.CompareTo("-highLevelOutput")==0) {
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
+       if (toCompareTo.CompareTo("yes")==0){
+         HLTWarning("Setting highLevelOutput to: %s", toCompareTo.Data());
+         fHighLevelOutput=kTRUE;
+       }
+       else if (toCompareTo.CompareTo("no")==0){
+         HLTInfo("Setting highLevelOutput to: %s", toCompareTo.Data());
+         fHighLevelOutput=kFALSE;
+       }
+       else {
+         HLTError("unknown argument for highLevelOutput: %s", toCompareTo.Data());
+         iResult=-EINVAL;
+         break;
+       }
+       continue;
+      }
+      else if (argument.CompareTo("-emulateHLToutput")==0) {
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       TString toCompareTo=((TObjString*)pTokens->At(i))->GetString();
+       if (toCompareTo.CompareTo("yes")==0){
+         HLTWarning("Setting emulateHLToutput to: %s", toCompareTo.Data());
+         fEmulateHLTTracks=kTRUE;
+       }
+       else if (toCompareTo.CompareTo("no")==0){
+         HLTInfo("Setting emulateHLToutput to: %s", toCompareTo.Data());
+         fEmulateHLTTracks=kFALSE;
+       }
+       else {
+         HLTError("unknown argument for emulateHLToutput: %s", toCompareTo.Data());
+         iResult=-EINVAL;
+         break;
+       }
        continue;
       }
       else if (argument.CompareTo("-PIDmethod")==0) {
@@ -411,7 +495,6 @@ int AliHLTTRDTrackerV1Component::Configure(const char* arguments){
     iResult=-EINVAL;
   }
   if(iResult>=0){
-    if(fOfflineMode)SetOfflineParams();
     iResult=SetParams();
   }
   return iResult;
@@ -421,7 +504,7 @@ int AliHLTTRDTrackerV1Component::SetParams()
 {
   Int_t iResult=0;
   if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
-    HLTError("DefaultStorage is not Set in CDBManager");
+    HLTError("DefaultStorage is not set in CDBManager");
     return -EINVAL;
   }
   if(AliCDBManager::Instance()->GetRun()<0){
@@ -439,163 +522,59 @@ int AliHLTTRDTrackerV1Component::SetParams()
       AliGeomManager::LoadGeometry(fgeometryFileName.Data());
     }
     if(!AliGeomManager::GetGeometry()){
-      HLTError("Cannot load geometry");
+      HLTError("Could not load geometry");
       return -EINVAL;
     }
+    HLTInfo("Applying Alignment from CDB object");
+    AliGeomManager::ApplyAlignObjsFromCDB("TRD");
   }
   else{
     HLTInfo("Geometry Already Loaded!");
   }
-
-  if (fNtimeBins <= 0)
-    {
-      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.");
-      return -EINVAL;
-    }
-  if (fNtimeBins < 24 || fNtimeBins > 30)
-    {
-      HLTWarning("The number of time bins seems to be strange = %d. But okay. Let's try it...", fNtimeBins);
-    }
-  if (fNtimeBins != 24)
-    {
-      HLTWarning("All PID methods eagerly await 24 time bins, so PID will NOT work!", fNtimeBins);
-    }
-  HLTDebug("Setting number of time bins of the tracker to: %i", fNtimeBins);
-  AliTRDtrackerV1::SetNTimeBins(fNtimeBins);
   
-  TString recoOptions="sa,sl_tr_0,!cw";
-  
-  if(!fSlowTracking)
-    recoOptions += ",hlt";
-
-  switch(fPIDmethod){
-  case 0: recoOptions += ",!nn"; break;
-  case 1: recoOptions += ",nn"; break;
-  case 2: recoOptions += ",!nn"; break;
-  }
-
-  if (fRecoParamType == 0)
-    {
+  if(fReconstructor->GetRecoParam()){
+    fRecoParam = new AliTRDrecoParam(*fReconstructor->GetRecoParam());
+    HLTInfo("RecoParam already set!");
+  }else{
+    if(fRecoParamType == 0){
       HLTDebug("Low flux params init.");
       fRecoParam = AliTRDrecoParam::GetLowFluxParam();
     }
-
-  if (fRecoParamType == 1)
-    {
+    if(fRecoParamType == 1){
       HLTDebug("High flux params init.");
       fRecoParam = AliTRDrecoParam::GetHighFluxParam();
     }
-  
-  if (fRecoParamType == 2)
-    {
+    if(fRecoParamType == 2){
       HLTDebug("Cosmic Test params init.");
       fRecoParam = AliTRDrecoParam::GetCosmicTestParam();
     }
+  }
 
-  if (fRecoParam == 0)
+  if(!fRecoParam)
     {
       HLTError("No reco params initialized. Sniffing big trouble!");
       return -EINVAL;
     }
 
+  switch(fPIDmethod){
+  case 0: fRecoParam->SetPIDNeuralNetwork(kFALSE); break;
+  case 1: fRecoParam->SetPIDNeuralNetwork(kTRUE); break;
+  case 2: fRecoParam->SetPIDNeuralNetwork(kFALSE); break;
+  }
+
+  fRecoParam->SetImproveTracklets(fImproveTracklets);
+
+  fRecoParam->SetStreamLevel(AliTRDrecoParam::kTracker, 0);
   fReconstructor->SetRecoParam(fRecoParam);
 
+  TString recoOptions="sa,!cw";
+  
+  if(fHLTflag)
+    recoOptions += ",hlt";
+
   HLTDebug("Reconstructor options are: %s",recoOptions.Data());
   fReconstructor->SetOption(recoOptions.Data());
 
-  if (fMagneticField >= 0)
-    {
-      HLTWarning("Setting magnetic field by hand!");
-    }
-  if (!TGeoGlobalMagField::Instance()->IsLocked()) {
-    AliMagF* field;
-    if (fMagneticField == 0){
-      // magnetic field OFF
-      field = new AliMagF("Maps","Maps",2,0.,0., 10.,AliMagF::k5kGUniform);
-      TGeoGlobalMagField::Instance()->SetField(field);
-      HLTDebug("Magnetic field is OFF.");
-    }else{
-      // magnetic field ON
-      field = new AliMagF("Maps","Maps",2,1.,1., 10.,AliMagF::k5kG);
-      TGeoGlobalMagField::Instance()->SetField(field);
-      HLTDebug("Magnetic field is ON.");
-      if( fMagneticField < 0 )
-       iResult=ReconfigureField();
-    }
-  }else{
-    HLTError("Magnetic field is already set and locked, cannot redefine it." );
-  }
-  return iResult;
-}
-
-void AliHLTTRDTrackerV1Component::SetOfflineParams(){
-  HLTFatal("You have entered the OFFLINE configuration!");
-  if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
-    HLTFatal("You are resetting the Default Storage of the CDBManager!");
-    HLTFatal("Let's hope that this program is NOT running on the HLT cluster!");
-    AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
-  }else{
-    HLTError("DefaultStorage was already set!");
-  }
-  if(AliCDBManager::Instance()->GetRun()<0){
-    HLTFatal("You are resetting the CDB run number to 0!");
-    HLTFatal("Let's hope that this program is NOT running on the HLT cluster!");
-    AliCDBManager::Instance()->SetRun(0);
-  }else{
-    HLTError("Run Number was already set!");
-  }
-}
-
-int AliHLTTRDTrackerV1Component::ReconfigureField()
-{
-  int iResult=0;
-  if(fieldStrength<-100){
-    const char* pathBField=kAliHLTCDBSolenoidBz;
-
-    if (pathBField) {
-      HLTInfo("reconfigure B-Field from entry %s", pathBField);
-      AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField/*,GetRunNo()*/);
-      if (pEntry) {
-       TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
-       if (pString) {
-         HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
-         TObjArray* pTokens=pString->GetString().Tokenize(" ");
-         TString argument;
-         int bMissingParam=0;
-         if (pTokens) {
-           for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
-             argument=((TObjString*)pTokens->At(i))->GetString();
-             if (argument.IsNull()) continue;
-      
-             if (argument.CompareTo("-solenoidBz")==0) {
-               if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
-               HLTDebug("Magnetic field in CDB: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
-               fieldStrength=((TObjString*)pTokens->At(i))->GetString().Atof();
-               continue;
-             } else {
-               HLTError("unknown argument %s", argument.Data());
-               iResult=-EINVAL;
-               break;
-             }
-           }
-           delete pTokens;
-         }
-       } else {
-         HLTError("configuration object \"%s\" has wrong type, required TObjString", pathBField);
-       }
-      } else {
-       HLTError("cannot fetch object \"%s\" from CDB", pathBField);
-      }
-    }
-  }
-  if(fieldStrength>=-100){
-    AliMagF* field = (AliMagF *) TGeoGlobalMagField::Instance()->GetField();
-    field->SetFactorSol(1);
-    Double_t initialFieldStrengh=field->SolenoidField();
-    HLTDebug("Magnetic field was: %f KGauss", initialFieldStrengh);
-    field->SetFactorSol(fieldStrength/initialFieldStrengh);
-    HLTDebug("Magnetic field reset to %f KGauss.", field->SolenoidField());
-  }
   return iResult;
 }
 
@@ -626,24 +605,6 @@ int AliHLTTRDTrackerV1Component::Reconfigure(const char* cdbEntry, const char* c
     }
   }
 
-  const char* pathBField=kAliHLTCDBSolenoidBz;
-
-  if (pathBField) {
-    HLTInfo("reconfigure B-Field from entry %s, chain id %s", pathBField,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
-    AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField/*,GetRunNo()*/);
-    if (pEntry) {
-      TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
-      if (pString) {
-       HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
-       iResult=Configure(pString->GetString().Data());
-      } else {
-       HLTError("configuration object \"%s\" has wrong type, required TObjString", pathBField);
-      }
-    } else {
-      HLTError("cannot fetch object \"%s\" from CDB", pathBField);
-    }
-  }
-  
   return iResult;
 
 }
@@ -656,33 +617,26 @@ int AliHLTTRDTrackerV1Component::ReadPreprocessorValues(const char* modules)
   TString str(modules);
   if(str.Contains("HLT") || str.Contains("TRD") || str.Contains("GRP")){
   
-    const char* pathBField=kAliHLTCDBSolenoidBz;
-    if (pathBField) {
-
-      HLTInfo("reconfigure B-Field from entry %s, modules %s", pathBField,(modules!=NULL && modules[0]!=0)?modules:"<none>");
-      //AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(pathBField/*,GetRunNo()*/);
-      
-      AliCDBPath path(pathBField);
-      
-      AliCDBStorage *stor = AliCDBManager::Instance()->GetDefaultStorage();
-      Int_t version    = stor->GetLatestVersion(pathBField, GetRunNo());
-      Int_t subVersion = stor->GetLatestSubVersion(pathBField, GetRunNo(), version);
-      AliCDBEntry *pEntry = stor->Get(path,GetRunNo(), version, subVersion);
-      
-      HLTImportant("RunNo %d, Version %d, subversion %d", GetRunNo(), version, subVersion);
-      
-      if (pEntry) {
-       TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
-       if (pString) {
-         HLTImportant("received configuration object string: \'%s\'", pString->GetString().Data());
-         iResult=Configure(pString->GetString().Data());
-       } else {
-         HLTError("configuration object \"%s\" has wrong type, required TObjString", pathBField);
-       }
-      } else {
-       HLTError("cannot fetch object \"%s\" from CDB", pathBField);
-      }
-    }
   }  
   return iResult;
 }
+
+void AliHLTTRDTrackerV1Component::GetOCDBObjectDescription(TMap* const targetMap){
+  // Get a list of OCDB object description needed for the particular component
+  if (!targetMap) return;
+  targetMap->Add(new TObjString("HLT/ConfigTRD/TrackerV1Component"), new TObjString("component arguments"));
+  targetMap->Add(new TObjString("TRD/Calib/ChamberGainFactor"), new TObjString("gain factor of chambers"));
+  targetMap->Add(new TObjString("TRD/Calib/ChamberT0"), new TObjString("T0 of chambers"));
+  targetMap->Add(new TObjString("TRD/Calib/ChamberVdrift"), new TObjString("drift velocity of chambers"));
+  targetMap->Add(new TObjString("TRD/Calib/DetNoise"), new TObjString("noise of chambers"));
+  targetMap->Add(new TObjString("TRD/Calib/LocalGainFactor"), new TObjString("per pad gain factor"));
+  targetMap->Add(new TObjString("TRD/Calib/LocalT0"), new TObjString("per pad T0"));
+  targetMap->Add(new TObjString("TRD/Calib/LocalVdrift"), new TObjString("per pad drift velocity"));
+  targetMap->Add(new TObjString("TRD/Calib/PadNoise"), new TObjString("per pad noise"));
+  targetMap->Add(new TObjString("TRD/Calib/PadStatus"), new TObjString("pad status"));
+  targetMap->Add(new TObjString("TRD/Calib/PRFWidth"), new TObjString("pad response function"));
+  targetMap->Add(new TObjString("TRD/Calib/ChamberStatus"), new TObjString("status of chambers"));
+  targetMap->Add(new TObjString("TRD/Calib/PIDLQ"), new TObjString("likelyhood PID"));
+  targetMap->Add(new TObjString("TRD/Calib/PIDNN"), new TObjString("neuronal network PID"));
+  targetMap->Add(new TObjString("TRD/Calib/PIDThresholds"), new TObjString("threshold for PID"));
+}