]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Deleted old deprecated macros.
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Jul 2008 15:35:13 +0000 (15:35 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Jul 2008 15:35:13 +0000 (15:35 +0000)
Fixing bugs in reconfiguration from CDB in HitReconstructor component.
Adding CDB entrues for the TriggerReconstructor and MansoTrackerFSM components.
Fixing minor message printing bug in AliHLTMUONProcessor.

22 files changed:
HLT/ConfigMUON/MansoTrackerFSM/Run0_999999999_v0_s0.root [new file with mode: 0644]
HLT/ConfigMUON/TriggerReconstructor/Run0_999999999_v0_s0.root [new file with mode: 0644]
HLT/MUON/AliHLTMUONConstants.cxx
HLT/MUON/AliHLTMUONConstants.h
HLT/MUON/AliHLTMUONProcessor.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONDecisionComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONDecisionComponent.h
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.h
HLT/MUON/OnlineAnalysis/AliHLTMUONMansoTrackerFSMComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONMansoTrackerFSMComponent.h
HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructor.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructor.h
HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.h
HLT/MUON/macros/CreateDefaultCDBEntries.C
HLT/MUON/macros/CreateTriggerRecoLookupTables.C
HLT/MUON/macros/DumpClusterPointFile.C [deleted file]
HLT/MUON/macros/DumpClusterSource.C [deleted file]
HLT/MUON/macros/DumpTrackSink.C [deleted file]
HLT/MUON/macros/DumpTriggerRecordFile.C [deleted file]
HLT/MUON/macros/DumpTriggerSource.C [deleted file]

diff --git a/HLT/ConfigMUON/MansoTrackerFSM/Run0_999999999_v0_s0.root b/HLT/ConfigMUON/MansoTrackerFSM/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..3e1f7bb
Binary files /dev/null and b/HLT/ConfigMUON/MansoTrackerFSM/Run0_999999999_v0_s0.root differ
diff --git a/HLT/ConfigMUON/TriggerReconstructor/Run0_999999999_v0_s0.root b/HLT/ConfigMUON/TriggerReconstructor/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..45b85ce
Binary files /dev/null and b/HLT/ConfigMUON/TriggerReconstructor/Run0_999999999_v0_s0.root differ
index c598307d35d2c43b42598ed67b67cb37662b221e..433aa06bcad6cc8a3ed2fd70b00f2cce100fc227 100644 (file)
@@ -182,6 +182,7 @@ const char* AliHLTMUONConstants::fgkRootifierComponentId = "MUONRootifier";
 const char* AliHLTMUONConstants::fgkEmptyEventFilterComponentId = "MUONEmptyEventFilter";
 const char* AliHLTMUONConstants::fgkDataCheckerComponentId = "MUONDataChecker";
 
 const char* AliHLTMUONConstants::fgkEmptyEventFilterComponentId = "MUONEmptyEventFilter";
 const char* AliHLTMUONConstants::fgkDataCheckerComponentId = "MUONDataChecker";
 
+const char* AliHLTMUONConstants::fgkTriggerReconstructorCDBPath = "HLT/ConfigMUON/TriggerReconstructor";
 const char* AliHLTMUONConstants::fgkHitReconstructorCDBPath = "HLT/ConfigMUON/HitReconstructor";
 const char* AliHLTMUONConstants::fgkMansoTrackerFSMCDBPath = "HLT/ConfigMUON/MansoTrackerFSM";
 const char* AliHLTMUONConstants::fgkDecisionComponentCDBPath = "HLT/ConfigMUON/DecisionComponent";
 const char* AliHLTMUONConstants::fgkHitReconstructorCDBPath = "HLT/ConfigMUON/HitReconstructor";
 const char* AliHLTMUONConstants::fgkMansoTrackerFSMCDBPath = "HLT/ConfigMUON/MansoTrackerFSM";
 const char* AliHLTMUONConstants::fgkDecisionComponentCDBPath = "HLT/ConfigMUON/DecisionComponent";
index dfefa003b0019c5c831fa78a6994ebdbcfb45297..e9da65ea448aa0b547739bff9d5f6a83cded644e 100644 (file)
@@ -221,6 +221,11 @@ public:
                return fgkDataCheckerComponentId;
        }
        
                return fgkDataCheckerComponentId;
        }
        
+       static const char* TriggerReconstructorCDBPath()
+       {
+               return fgkTriggerReconstructorCDBPath;
+       }
+       
        static const char* HitReconstructorCDBPath()
        {
                return fgkHitReconstructorCDBPath;
        static const char* HitReconstructorCDBPath()
        {
                return fgkHitReconstructorCDBPath;
@@ -284,6 +289,7 @@ private:
        static const char* fgkDataCheckerComponentId; // Name of data checking component for debugging.
        
        // CDB path entries to configuration information.
        static const char* fgkDataCheckerComponentId; // Name of data checking component for debugging.
        
        // CDB path entries to configuration information.
+       static const char* fgkTriggerReconstructorCDBPath; // Path to CDB entry for the trigger reconstruction component.
        static const char* fgkHitReconstructorCDBPath; // Path to CDB entry for the hit reconstruction component.
        static const char* fgkMansoTrackerFSMCDBPath; // Path to CDB entry for the Manso FSM tracker component.
        static const char* fgkDecisionComponentCDBPath; // Path to CDB entry for trigger decision component.
        static const char* fgkHitReconstructorCDBPath; // Path to CDB entry for the hit reconstruction component.
        static const char* fgkMansoTrackerFSMCDBPath; // Path to CDB entry for the Manso FSM tracker component.
        static const char* fgkDecisionComponentCDBPath; // Path to CDB entry for trigger decision component.
index cc65cf941923ea6a61ff6e0a60d078281d7baac3..c33a73147d9cc6b779d252ec23fe53c2967accf7 100644 (file)
@@ -245,7 +245,7 @@ int AliHLTMUONProcessor::GetIntFromTMap(
        if (prettyName == NULL) prettyName = paramName;
        
        TString valueStr;
        if (prettyName == NULL) prettyName = paramName;
        
        TString valueStr;
-       int result = GetValueFromTMap(map, paramName, valueStr, prettyName);
+       int result = GetValueFromTMap(map, paramName, valueStr, pathToEntry, prettyName);
        if (result != 0) return result;
        
        if (not valueStr.IsDigit())
        if (result != 0) return result;
        
        if (not valueStr.IsDigit())
@@ -286,7 +286,7 @@ int AliHLTMUONProcessor::GetPositiveIntFromTMap(
        if (prettyName == NULL) prettyName = paramName;
        
        TString valueStr;
        if (prettyName == NULL) prettyName = paramName;
        
        TString valueStr;
-       int result = GetValueFromTMap(map, paramName, valueStr, prettyName);
+       int result = GetValueFromTMap(map, paramName, valueStr, pathToEntry, prettyName);
        if (result != 0) return result;
        
        if (not valueStr.IsDigit())
        if (result != 0) return result;
        
        if (not valueStr.IsDigit())
@@ -336,7 +336,7 @@ int AliHLTMUONProcessor::GetFloatFromTMap(
        if (prettyName == NULL) prettyName = paramName;
        
        TString valueStr;
        if (prettyName == NULL) prettyName = paramName;
        
        TString valueStr;
-       int result = GetValueFromTMap(map, paramName, valueStr, prettyName);
+       int result = GetValueFromTMap(map, paramName, valueStr, pathToEntry, prettyName);
        if (result != 0) return result;
        
        if (not valueStr.IsFloat())
        if (result != 0) return result;
        
        if (not valueStr.IsFloat())
@@ -377,7 +377,7 @@ int AliHLTMUONProcessor::GetPositiveFloatFromTMap(
        if (prettyName == NULL) prettyName = paramName;
        
        TString valueStr;
        if (prettyName == NULL) prettyName = paramName;
        
        TString valueStr;
-       int result = GetValueFromTMap(map, paramName, valueStr, prettyName);
+       int result = GetValueFromTMap(map, paramName, valueStr, pathToEntry, prettyName);
        if (result != 0) return result;
        
        if (not valueStr.IsFloat())
        if (result != 0) return result;
        
        if (not valueStr.IsFloat())
index a9ee2717a8cda18416b319cc987fc2bb5bb7b98a..85961e93dbc4a048fa474264d624edc132d42ff3 100644 (file)
@@ -57,7 +57,12 @@ AliHLTMUONDecisionComponent::AliHLTMUONDecisionComponent() :
        fHighPtCut(2.),  // 2 GeV/c cut
        fLowMassCut(2.5),  // 2.7 GeV/c^2 cut
        fHighMassCut(7.),  // 8 GeV/c^2 cut
        fHighPtCut(2.),  // 2 GeV/c cut
        fLowMassCut(2.5),  // 2.7 GeV/c^2 cut
        fHighMassCut(7.),  // 8 GeV/c^2 cut
-       fWarnForUnexpecedBlock(false)
+       fWarnForUnexpecedBlock(false),
+       fDelaySetup(false),
+       fLowPtCutSet(false),
+       fHighPtCutSet(false),
+       fLowMassCutSet(false),
+       fHighMassCutSet(false)
 {
        ///
        /// Default constructor.
 {
        ///
        /// Default constructor.
@@ -152,17 +157,75 @@ int AliHLTMUONDecisionComponent::DoInit(int argc, const char** argv)
        
        HLTInfo("Initialising dHLT trigger decision component.");
        
        
        HLTInfo("Initialising dHLT trigger decision component.");
        
-       bool lowPtCutSet = false;
-       bool highPtCutSet = false;
-       bool lowMassCutSet = false;
-       bool highMassCutSet = false;
        fWarnForUnexpecedBlock = false;
        fWarnForUnexpecedBlock = false;
+       fDelaySetup = false;
+       fLowPtCutSet = false;
+       fHighPtCutSet = false;
+       fLowMassCutSet = false;
+       fHighMassCutSet = false;
+       
+       const char* cdbPath = NULL;
+       Int_t run = -1;
        
        for (int i = 0; i < argc; i++)
        {
        
        for (int i = 0; i < argc; i++)
        {
+               if (strcmp( argv[i], "-cdbpath" ) == 0)
+               {
+                       if (cdbPath != NULL)
+                       {
+                               HLTWarning("CDB path was already specified."
+                                       " Will replace previous value given by -cdbpath."
+                               );
+                       }
+                       
+                       if ( argc <= i+1 )
+                       {
+                               HLTError("The CDB path was not specified." );
+                               return -EINVAL;
+                       }
+                       cdbPath = argv[i+1];
+                       i++;
+                       continue;
+               }
+       
+               if (strcmp( argv[i], "-run" ) == 0)
+               {
+                       if (run != -1)
+                       {
+                               HLTWarning("Run number was already specified."
+                                       " Will replace previous value given by -run."
+                               );
+                       }
+                       
+                       if ( argc <= i+1 )
+                       {
+                               HLTError("The run number was not specified." );
+                               return -EINVAL;
+                       }
+                       
+                       char* cpErr = NULL;
+                       run = Int_t( strtoul(argv[i+1], &cpErr, 0) );
+                       if (cpErr == NULL or *cpErr != '\0')
+                       {
+                               HLTError("Cannot convert '%s' to a valid run number."
+                                       " Expected a positive integer value.", argv[i+1]
+                               );
+                               return -EINVAL;
+                       }
+                       
+                       i++;
+                       continue;
+               }
+               
+               if (strcmp( argv[i], "-delaysetup" ) == 0)
+               {
+                       fDelaySetup = true;
+                       continue;
+               }
+               
                if (strcmp( argv[i], "-lowptcut" ) == 0)
                {
                if (strcmp( argv[i], "-lowptcut" ) == 0)
                {
-                       if (lowPtCutSet)
+                       if (fLowPtCutSet)
                        {
                                HLTWarning("Low pT cut parameter was already specified."
                                        " Will replace previous value given by -lowptcut."
                        {
                                HLTWarning("Low pT cut parameter was already specified."
                                        " Will replace previous value given by -lowptcut."
@@ -183,7 +246,7 @@ int AliHLTMUONDecisionComponent::DoInit(int argc, const char** argv)
                                return -EINVAL;
                        }
                        fLowPtCut = (AliHLTFloat32_t)num;
                                return -EINVAL;
                        }
                        fLowPtCut = (AliHLTFloat32_t)num;
-                       lowPtCutSet = true;
+                       fLowPtCutSet = true;
                        
                        i++;
                        continue;
                        
                        i++;
                        continue;
@@ -191,7 +254,7 @@ int AliHLTMUONDecisionComponent::DoInit(int argc, const char** argv)
                
                if (strcmp( argv[i], "-highptcut" ) == 0)
                {
                
                if (strcmp( argv[i], "-highptcut" ) == 0)
                {
-                       if (lowPtCutSet)
+                       if (fHighPtCutSet)
                        {
                                HLTWarning("High pT cut parameter was already specified."
                                        " Will replace previous value given by -highptcut."
                        {
                                HLTWarning("High pT cut parameter was already specified."
                                        " Will replace previous value given by -highptcut."
@@ -212,7 +275,7 @@ int AliHLTMUONDecisionComponent::DoInit(int argc, const char** argv)
                                return -EINVAL;
                        }
                        fHighPtCut = (AliHLTFloat32_t)num;
                                return -EINVAL;
                        }
                        fHighPtCut = (AliHLTFloat32_t)num;
-                       highPtCutSet = true;
+                       fHighPtCutSet = true;
                        
                        i++;
                        continue;
                        
                        i++;
                        continue;
@@ -220,7 +283,7 @@ int AliHLTMUONDecisionComponent::DoInit(int argc, const char** argv)
                
                if (strcmp( argv[i], "-lowmasscut" ) == 0)
                {
                
                if (strcmp( argv[i], "-lowmasscut" ) == 0)
                {
-                       if (lowPtCutSet)
+                       if (fLowMassCutSet)
                        {
                                HLTWarning("Low invariant mass cut parameter was already specified."
                                        " Will replace previous value given by -lowmasscut."
                        {
                                HLTWarning("Low invariant mass cut parameter was already specified."
                                        " Will replace previous value given by -lowmasscut."
@@ -241,7 +304,7 @@ int AliHLTMUONDecisionComponent::DoInit(int argc, const char** argv)
                                return -EINVAL;
                        }
                        fLowMassCut = (AliHLTFloat32_t)num;
                                return -EINVAL;
                        }
                        fLowMassCut = (AliHLTFloat32_t)num;
-                       lowMassCutSet = true;
+                       fLowMassCutSet = true;
                        
                        i++;
                        continue;
                        
                        i++;
                        continue;
@@ -249,7 +312,7 @@ int AliHLTMUONDecisionComponent::DoInit(int argc, const char** argv)
                
                if (strcmp( argv[i], "-highmasscut" ) == 0)
                {
                
                if (strcmp( argv[i], "-highmasscut" ) == 0)
                {
-                       if (lowPtCutSet)
+                       if (fHighMassCutSet)
                        {
                                HLTWarning("High invariant mass cut parameter was already specified."
                                        " Will replace previous value given by -highmasscut."
                        {
                                HLTWarning("High invariant mass cut parameter was already specified."
                                        " Will replace previous value given by -highmasscut."
@@ -270,7 +333,7 @@ int AliHLTMUONDecisionComponent::DoInit(int argc, const char** argv)
                                return -EINVAL;
                        }
                        fHighMassCut = (AliHLTFloat32_t)num;
                                return -EINVAL;
                        }
                        fHighMassCut = (AliHLTFloat32_t)num;
-                       highMassCutSet = true;
+                       fHighMassCutSet = true;
                        
                        i++;
                        continue;
                        
                        i++;
                        continue;
@@ -286,22 +349,35 @@ int AliHLTMUONDecisionComponent::DoInit(int argc, const char** argv)
                return -EINVAL;
        }
        
                return -EINVAL;
        }
        
-       // Read cut parameters from CDB if they were not specified on the command line.
-       if (not lowPtCutSet or not highPtCutSet or not lowMassCutSet or not highMassCutSet)
+       if (cdbPath != NULL or run != -1)
        {
        {
-               int result = ReadConfigFromCDB(
-                               NULL,
-                               not lowPtCutSet, not highPtCutSet,
-                               not lowMassCutSet, not highMassCutSet
-                       );
+               int result = SetCDBPathAndRunNo(cdbPath, run);
                if (result != 0) return result;
        }
        
                if (result != 0) return result;
        }
        
-       HLTDebug("Using the following cut parameters:");
-       HLTDebug("              Low pT cut = %f GeV/c", fLowPtCut);
-       HLTDebug("             High pT cut = %f GeV/c", fHighPtCut);
-       HLTDebug("  Low invariant mass cut = %f GeV/c^2", fLowMassCut);
-       HLTDebug(" High invariant mass cut = %f GeV/c^2", fHighMassCut);
+       if (not fDelaySetup)
+       {
+               // Read cut parameters from CDB if they were not specified on the command line.
+               if (not fLowPtCutSet or not fHighPtCutSet or not fLowMassCutSet or not fHighMassCutSet)
+               {
+                       HLTInfo("Loading cut parameters from CDB.");
+                       int result = ReadConfigFromCDB(
+                                       not fLowPtCutSet, not fHighPtCutSet,
+                                       not fLowMassCutSet, not fHighMassCutSet
+                               );
+                       if (result != 0) return result;
+               }
+               else
+               {
+                       // Print the debug messages here since ReadConfigFromCDB does not get called,
+                       // in-which the debug messages would have been printed.
+                       HLTDebug("Using the following cut parameters:");
+                       HLTDebug("              Low pT cut = %f GeV/c", fLowPtCut);
+                       HLTDebug("             High pT cut = %f GeV/c", fHighPtCut);
+                       HLTDebug("  Low invariant mass cut = %f GeV/c^2", fLowMassCut);
+                       HLTDebug(" High invariant mass cut = %f GeV/c^2", fHighMassCut);
+               }
+       }
        
        return 0;
 }
        
        return 0;
 }
@@ -322,19 +398,41 @@ int AliHLTMUONDecisionComponent::Reconfigure(const char* cdbEntry, const char* c
 {
        /// Inherited from AliHLTComponent. Reconfigures the component from CDB.
        
 {
        /// Inherited from AliHLTComponent. Reconfigures the component from CDB.
        
-       if (strcmp(componentId, GetComponentID()) == 0)
+       /// Inherited from AliHLTComponent. This method will reload CDB configuration
+       /// entries for this component from the CDB.
+       /// \param cdbEntry If this is NULL or equals "HLT/ConfigMUON/DecisionComponent"
+       ///     then new configuration parameters are loaded, otherwise nothing is done.
+       /// \param componentId  The name of the component in the current chain.
+       
+       bool givenConfigPath = strcmp(cdbEntry, AliHLTMUONConstants::DecisionComponentCDBPath()) == 0;
+       
+       if (cdbEntry == NULL or givenConfigPath)
        {
        {
-               HLTInfo("Reading new entries for cut parameters from CDB.");
-               int result = ReadConfigFromCDB(cdbEntry);
-               HLTDebug("Using the following new cut parameters:");
-               HLTDebug("              Low pT cut = %f GeV/c", fLowPtCut);
-               HLTDebug("             High pT cut = %f GeV/c", fHighPtCut);
-               HLTDebug("  Low invariant mass cut = %f GeV/c^2", fLowMassCut);
-               HLTDebug(" High invariant mass cut = %f GeV/c^2", fHighMassCut);
-               return result;
+               HLTInfo("Reading new configuration entries from CDB for component '%s'.", componentId);
+               int result = ReadConfigFromCDB();
+               if (result != 0) return result;
        }
        }
-       else
-               return 0;
+       
+       return 0;
+}
+
+
+int AliHLTMUONDecisionComponent::ReadPreprocessorValues(const char* modules)
+{
+       /// Inherited from AliHLTComponent. 
+       /// Updates the configuration of this component if HLT or ALL has been
+       /// specified in the 'modules' list.
+
+       TString mods = modules;
+       if (mods.Contains("ALL"))
+       {
+               return Reconfigure(NULL, GetComponentID());
+       }
+       if (mods.Contains("HLT"))
+       {
+               return Reconfigure(AliHLTMUONConstants::DecisionComponentCDBPath(), GetComponentID());
+       }
+       return 0;
 }
 
 
 }
 
 
@@ -351,6 +449,25 @@ int AliHLTMUONDecisionComponent::DoEvent(
        /// Inherited from AliHLTProcessor. Processes the new event data.
        ///
        
        /// Inherited from AliHLTProcessor. Processes the new event data.
        ///
        
+       // Initialise the cut parameters from CDB if we were requested to
+       // initialise only when the first event was received.
+       if (fDelaySetup)
+       {
+               // Load the cut paramters from CDB if they have not been given
+               // on the command line.
+               if (not fLowPtCutSet or not fHighPtCutSet or not fLowMassCutSet or not fHighMassCutSet)
+               {
+                       HLTInfo("Loading cut parameters from CDB.");
+                       int result = ReadConfigFromCDB(
+                                       not fLowPtCutSet, not fHighPtCutSet,
+                                       not fLowMassCutSet, not fHighMassCutSet
+                               );
+                       if (result != 0) return result;
+               }
+               
+               fDelaySetup = false;
+       }
+       
        AliHLTUInt32_t specification = 0;  // Contains the output data block spec bits.
        
        // Loop over all input blocks in the event with track data and add pointers
        AliHLTUInt32_t specification = 0;  // Contains the output data block spec bits.
        
        // Loop over all input blocks in the event with track data and add pointers
@@ -494,19 +611,20 @@ int AliHLTMUONDecisionComponent::DoEvent(
 
 
 int AliHLTMUONDecisionComponent::ReadConfigFromCDB(
 
 
 int AliHLTMUONDecisionComponent::ReadConfigFromCDB(
-               const char* path,
                bool setLowPtCut, bool setHighPtCut,
                bool setLowMassCut, bool setHighMassCut
        )
 {
        /// Reads the cut parameters from the CDB.
                bool setLowPtCut, bool setHighPtCut,
                bool setLowMassCut, bool setHighMassCut
        )
 {
        /// Reads the cut parameters from the CDB.
-       /// \param path Indicates the partial (or relative) path to the CDB entry.
+       /// \param setLowPtCut  Indicates if the low pT cut should be set (default true).
+       /// \param setHighPtCut  Indicates if the high pT cut should be set (default true).
+       /// \param setLowMassCut  Indicates if the low invariant mass cut should be set (default true).
+       /// \param setHighMassCut  Indicates if the high invariant mass cut should be set (default true).
+       /// \return 0 is returned on success and a non-zero value to indicate failure.
        
        assert(AliCDBManager::Instance() != NULL);
        
        const char* pathToEntry = AliHLTMUONConstants::DecisionComponentCDBPath();
        
        assert(AliCDBManager::Instance() != NULL);
        
        const char* pathToEntry = AliHLTMUONConstants::DecisionComponentCDBPath();
-       if (path != NULL)
-               pathToEntry = path;
        
        TMap* map = NULL;
        int result = FetchTMapFromCDB(pathToEntry, map);
        
        TMap* map = NULL;
        int result = FetchTMapFromCDB(pathToEntry, map);
@@ -544,6 +662,12 @@ int AliHLTMUONDecisionComponent::ReadConfigFromCDB(
                fHighMassCut = (AliHLTFloat32_t) value;
        }
        
                fHighMassCut = (AliHLTFloat32_t) value;
        }
        
+       HLTDebug("Using the following cut parameters:");
+       HLTDebug("              Low pT cut = %f GeV/c", fLowPtCut);
+       HLTDebug("             High pT cut = %f GeV/c", fHighPtCut);
+       HLTDebug("  Low invariant mass cut = %f GeV/c^2", fLowMassCut);
+       HLTDebug(" High invariant mass cut = %f GeV/c^2", fHighMassCut);
+       
        return 0;
 }
 
        return 0;
 }
 
index 1c6961e1c68fd70a92ca1e0f56efe56f6cfa0e66..2a8edb70943429c5a84e0877b7ff9c174b0ef87b 100644 (file)
@@ -68,6 +68,7 @@ protected:
        virtual int DoInit(int argc, const char** argv);
        virtual int DoDeinit();
        virtual int Reconfigure(const char* cdbEntry, const char* componentId);
        virtual int DoInit(int argc, const char** argv);
        virtual int DoDeinit();
        virtual int Reconfigure(const char* cdbEntry, const char* componentId);
+       virtual int ReadPreprocessorValues(const char* modules);
        virtual int DoEvent(
                        const AliHLTComponentEventData& evtData,
                        const AliHLTComponentBlockData* blocks,
        virtual int DoEvent(
                        const AliHLTComponentEventData& evtData,
                        const AliHLTComponentBlockData* blocks,
@@ -87,8 +88,6 @@ private:
        
        /**
         * Reads the cut parameters from the CDB.
        
        /**
         * Reads the cut parameters from the CDB.
-        * \param path  The relative CDB path to use for the CDB entry.
-        *              If NULL the default value is used.
         * \param setLowPtCut  Indicates if the low pT cut should be set (default true).
         * \param setHighPtCut  Indicates if the high pT cut should be set (default true).
         * \param setLowMassCut  Indicates if the low invariant mass cut should be set (default true).
         * \param setLowPtCut  Indicates if the low pT cut should be set (default true).
         * \param setHighPtCut  Indicates if the high pT cut should be set (default true).
         * \param setLowMassCut  Indicates if the low invariant mass cut should be set (default true).
@@ -96,7 +95,6 @@ private:
         * \return 0 is returned on success and a non-zero value to indicate failure.
         */
        int ReadConfigFromCDB(
         * \return 0 is returned on success and a non-zero value to indicate failure.
         */
        int ReadConfigFromCDB(
-                       const char* path = NULL,
                        bool setLowPtCut = true, bool setHighPtCut = true,
                        bool setLowMassCut = true, bool setHighMassCut = true
                );
                        bool setLowPtCut = true, bool setHighPtCut = true,
                        bool setLowMassCut = true, bool setHighMassCut = true
                );
@@ -118,6 +116,11 @@ private:
        AliHLTFloat32_t fLowMassCut;  /// The low invariant mass cut value to apply to tracks. [GeV/c^2]
        AliHLTFloat32_t fHighMassCut;  /// The high invariant mass cut value to apply to tracks. [GeV/c^2]
        bool fWarnForUnexpecedBlock;  /// Flag indicating if we should log a warning if we got a block of an unexpected type.
        AliHLTFloat32_t fLowMassCut;  /// The low invariant mass cut value to apply to tracks. [GeV/c^2]
        AliHLTFloat32_t fHighMassCut;  /// The high invariant mass cut value to apply to tracks. [GeV/c^2]
        bool fWarnForUnexpecedBlock;  /// Flag indicating if we should log a warning if we got a block of an unexpected type.
+       bool fDelaySetup;  ///< Indicates if the component should delay loading and initialising from the CDB to the start of run event.
+       bool fLowPtCutSet; ///< Indicates if the low pT cut parameter was set on the command line.
+       bool fHighPtCutSet; ///< Indicates if the high pT cut parameter was set on the command line.
+       bool fLowMassCutSet; ///< Indicates if the low invariant mass cut parameter was set on the command line.
+       bool fHighMassCutSet; ///< Indicates if the high invariant mass cut parameter was set on the command line.
        
        ClassDef(AliHLTMUONDecisionComponent, 0);  // Trigger decision component for the dimuon HLT.
 };
        
        ClassDef(AliHLTMUONDecisionComponent, 0);  // Trigger decision component for the dimuon HLT.
 };
index 05cfed80efd396d154c0089cbdfd5708466622f6..d4c15d98b9cf7b72b6cec9d5f07f499584f5b225 100644 (file)
@@ -398,6 +398,23 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
        
        } // for loop
        
        
        } // for loop
        
+       if (dccut != -1 and useCDB)
+       {
+               HLTWarning("The -cdb or -cdbpath parameter was specified, which indicates that"
+                       " this component should read from the CDB, but then the -dccut argument"
+                       " was also used. Will override the value from CDB with the command"
+                       " line DC cut parameter given."
+               );
+       }
+       
+       if (lutFileName != NULL and useCDB == true)
+       {
+               HLTWarning("The -cdb or -cdbpath parameter was specified, which indicates that"
+                       " this component should read from the CDB, but then the -lut argument"
+                       " was also used. Will ignore the -lut option and load from CDB anyway."
+               );
+       }
+       
        if (lutFileName == NULL) useCDB = true;
        
        if (fDDL == -1 and not fDelaySetup)
        if (lutFileName == NULL) useCDB = true;
        
        if (fDDL == -1 and not fDelaySetup)
@@ -460,19 +477,16 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
                                FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
                                return result;
                        }
                                FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
                                return result;
                        }
+               }
+               else
+               {
+                       // Print the debug messages here since ReadDCCutFromCDB does not get called,
+                       // in-which the debug messages would have been printed.
                        HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
                }
        }
        else
        {
                        HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
                }
        }
        else
        {
-               if (useCDB)
-               {
-                       HLTWarning("The -cdb or -cdbpath parameter was specified, which indicates that"
-                               " this component should read from the CDB, but then the -dccut value"
-                               " was also used. Will override the value from CDB with the command"
-                               " line DC cut parameter given.");
-               }
-               
                fHitRec->SetDCCut(dccut);
                HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
        }
                fHitRec->SetDCCut(dccut);
                HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
        }
@@ -504,38 +518,38 @@ int AliHLTMUONHitReconstructorComponent::Reconfigure(
        /// \param cdbEntry If this is NULL then it is assumed that all CDB entries should
        ///      be reloaded. Otherwise a particular value for 'cdbEntry' will trigger
        ///      reloading of the LUT if the path contains 'MUON/' and reloading of the DC
        /// \param cdbEntry If this is NULL then it is assumed that all CDB entries should
        ///      be reloaded. Otherwise a particular value for 'cdbEntry' will trigger
        ///      reloading of the LUT if the path contains 'MUON/' and reloading of the DC
-       ///      cut parameter from the given path in all other cases.
-       /// \param componentId  Must be set to the same value as what GetComponentID()
-       ///      returns for this component for this method to have any effect.
+       ///      cut parameter if 'cdbEntry' equals "HLT/ConfigMUON/HitReconstructor".
+       /// \param componentId  The name of the component in the current chain.
+       
+       bool startsWithMUON = TString(cdbEntry).Index("MUON/", 5, 0, TString::kExact) == 0;
+       bool givenConfigPath = strcmp(cdbEntry, AliHLTMUONConstants::HitReconstructorCDBPath()) == 0;
        
        
-       if (strcmp(componentId, GetComponentID()) == 0)
+       if (cdbEntry == NULL or startsWithMUON or givenConfigPath)
        {
        {
-               HLTInfo("Reading new configuration entries from CDB.");
+               HLTInfo("Reading new configuration entries from CDB for component '%s'.", componentId);
+       }
                
                
-               int result = 0;
-               bool startsWithMUON = TString(cdbEntry).Index("MUON/", 5, 0, TString::kExact) == 0;
-               if (cdbEntry == NULL or startsWithMUON)
+       if (cdbEntry == NULL or startsWithMUON)
+       {
+               // First clear the current LUT data and then load in the new values.
+               if (fLut != NULL)
                {
                {
-                       // First clear the current LUT data and then load in the new values.
-                       if (fLut != NULL)
-                       {
-                               delete [] fLut;
-                               fLut = NULL;
-                               fLutSize = 0;
-                       }
-                       
-                       fIdToEntry.clear();
-               
-                       result = ReadLutFromCDB();
-                       if (result != 0) return result;
+                       delete [] fLut;
+                       fLut = NULL;
+                       fLutSize = 0;
                }
                
                }
                
-               if (cdbEntry == NULL or not startsWithMUON)
-               {
-                       result = ReadDCCutFromCDB(cdbEntry);
-                       if (result != 0) return result;
-                       HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
-               }
+               fIdToEntry.clear();
+       
+               int result = ReadLutFromCDB();
+               if (result != 0) return result;
+               fHitRec->SetLookUpTable(fLut, &fIdToEntry);
+       }
+       
+       if (cdbEntry == NULL or not startsWithMUON)
+       {
+               int result = ReadDCCutFromCDB();
+               if (result != 0) return result;
        }
        
        return 0;
        }
        
        return 0;
@@ -628,7 +642,6 @@ int AliHLTMUONHitReconstructorComponent::DoEvent(
                        );
                        int result = ReadDCCutFromCDB();
                        if (result != 0) return result;
                        );
                        int result = ReadDCCutFromCDB();
                        if (result != 0) return result;
-                       HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
                }
                
                fDelaySetup = false;
                }
                
                fDelaySetup = false;
@@ -1063,13 +1076,11 @@ int AliHLTMUONHitReconstructorComponent::ReadLutFromCDB()
 }
 
 
 }
 
 
-int AliHLTMUONHitReconstructorComponent::ReadDCCutFromCDB(const char* path)
+int AliHLTMUONHitReconstructorComponent::ReadDCCutFromCDB()
 {
        /// Reads the DC cut parameter from the CDB.
 
        const char* pathToEntry = AliHLTMUONConstants::HitReconstructorCDBPath();
 {
        /// Reads the DC cut parameter from the CDB.
 
        const char* pathToEntry = AliHLTMUONConstants::HitReconstructorCDBPath();
-       if (path != NULL)
-               pathToEntry = path;
        
        TMap* map = NULL;
        int result = FetchTMapFromCDB(pathToEntry, map);
        
        TMap* map = NULL;
        int result = FetchTMapFromCDB(pathToEntry, map);
@@ -1082,6 +1093,8 @@ int AliHLTMUONHitReconstructorComponent::ReadDCCutFromCDB(const char* path)
        assert(fHitRec != NULL);
        fHitRec->SetDCCut(value);
        
        assert(fHitRec != NULL);
        fHitRec->SetDCCut(value);
        
+       HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
+       
        return 0;
 }
 
        return 0;
 }
 
index 4a496797e610397c95e6f3d0496275524fa94ab2..87329b1bc18f30ad0fe8f05810edc698c5fb8148 100644 (file)
@@ -176,7 +176,7 @@ private:
        void FreeMemory();
        int ReadLookUpTable(const char* lutpath);
        int ReadLutFromCDB();
        void FreeMemory();
        int ReadLookUpTable(const char* lutpath);
        int ReadLutFromCDB();
-       int ReadDCCutFromCDB(const char* path = NULL);
+       int ReadDCCutFromCDB();
        
        AliHLTMUONHitReconstructor* fHitRec;  ///< Internal class instance implementing the hit reconstruction algorithm.
        AliHLTInt32_t fDDL;  ///< DDL number in the range [12..19]. Set to -1 for invalid/unspecified value.
        
        AliHLTMUONHitReconstructor* fHitRec;  ///< Internal class instance implementing the hit reconstruction algorithm.
        AliHLTInt32_t fDDL;  ///< DDL number in the range [12..19]. Set to -1 for invalid/unspecified value.
index 238e3a466deb135d8010542e931bf9e00eedf893..088bdaf8b6fcb5e2ad32eb2d944abca705bcbc3a 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "AliHLTMUONMansoTrackerFSMComponent.h"
 #include "AliHLTMUONConstants.h"
 
 #include "AliHLTMUONMansoTrackerFSMComponent.h"
 #include "AliHLTMUONConstants.h"
+#include "AliHLTMUONCalculations.h"
 #include "AliHLTMUONUtils.h"
 #include "AliHLTMUONMansoTrackerFSM.h"
 #include "AliHLTMUONDataBlockReader.h"
 #include "AliHLTMUONUtils.h"
 #include "AliHLTMUONMansoTrackerFSM.h"
 #include "AliHLTMUONDataBlockReader.h"
@@ -46,17 +47,22 @@ AliHLTMUONMansoTrackerFSMComponent::AliHLTMUONMansoTrackerFSMComponent() :
        fTrackCount(0),
        fBlock(NULL),
        fRecHitBlockArraySize(0),
        fTrackCount(0),
        fBlock(NULL),
        fRecHitBlockArraySize(0),
-       fWarnForUnexpecedBlock(false)
+       fWarnForUnexpecedBlock(false),
+       fDelaySetup(false),
+       fCanLoadZmiddle(true),
+       fCanLoadBL(true)
 {
        ///
        /// Default constructor.
        ///
        
 {
        ///
        /// Default constructor.
        ///
        
-       for (Int_t i = 0; i < 4; i++)
+       for (int i = 0; i < 4; i++)
        {
                fRecHitBlockCount[i] = 0;
                fRecHitBlock[i] = NULL;
        }
        {
                fRecHitBlockCount[i] = 0;
                fRecHitBlock[i] = NULL;
        }
+       
+       ResetCanLoadFlags();
 }
 
 
 }
 
 
@@ -158,9 +164,280 @@ int AliHLTMUONMansoTrackerFSMComponent::DoInit(int argc, const char** argv)
        fTracker->SetCallback(this);
        
        fWarnForUnexpecedBlock = false;
        fTracker->SetCallback(this);
        
        fWarnForUnexpecedBlock = false;
+       fDelaySetup = false;
+       ResetCanLoadFlags();
+       
+       const char* cdbPath = NULL;
+       Int_t run = -1;
+       double zmiddle = 0;
+       double bfieldintegral = 0;
+       double roiA[4] = {0, 0, 0, 0};
+       double roiB[4] = {0, 0, 0, 0};
+       double chamberZ[6] = {0, 0, 0, 0, 0, 0};
        
        for (int i = 0; i < argc; i++)
        {
        
        for (int i = 0; i < argc; i++)
        {
+               if (strcmp( argv[i], "-cdbpath" ) == 0)
+               {
+                       if (cdbPath != NULL)
+                       {
+                               HLTWarning("CDB path was already specified."
+                                       " Will replace previous value given by -cdbpath."
+                               );
+                       }
+                       
+                       if ( argc <= i+1 )
+                       {
+                               HLTError("The CDB path was not specified." );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       cdbPath = argv[i+1];
+                       i++;
+                       continue;
+               }
+       
+               if (strcmp( argv[i], "-run" ) == 0)
+               {
+                       if (run != -1)
+                       {
+                               HLTWarning("Run number was already specified."
+                                       " Will replace previous value given by -run."
+                               );
+                       }
+                       
+                       if ( argc <= i+1 )
+                       {
+                               HLTError("The run number was not specified." );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       char* cpErr = NULL;
+                       run = Int_t( strtoul(argv[i+1], &cpErr, 0) );
+                       if (cpErr == NULL or *cpErr != '\0')
+                       {
+                               HLTError("Cannot convert '%s' to a valid run number."
+                                       " Expected a positive integer value.", argv[i+1]
+                               );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       i++;
+                       continue;
+               }
+       
+               if (strcmp( argv[i], "-zmiddle" ) == 0)
+               {
+                       if (not fCanLoadZmiddle)
+                       {
+                               HLTWarning("The Z coordinate for the middle of the dipole was already specified."
+                                       " Will replace previous value given by -zmiddle."
+                               );
+                       }
+                       
+                       if ( argc <= i+1 )
+                       {
+                               HLTError("The Z coordinate for the middle of the dipole was not specified." );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       char* cpErr = NULL;
+                       zmiddle = strtod(argv[i+1], &cpErr);
+                       if (cpErr == NULL or *cpErr != '\0')
+                       {
+                               HLTError("Cannot convert '%s' to a valid floating point number.",
+                                       argv[i+1]
+                               );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       fCanLoadZmiddle = false;  // Prevent loading from CDB.
+                       i++;
+                       continue;
+               }
+       
+               if (strcmp( argv[i], "-bfieldintegral" ) == 0)
+               {
+                       if (not fCanLoadBL)
+                       {
+                               HLTWarning("The magnetic field integral was already specified."
+                                       " Will replace previous value given by -bfieldintegral."
+                               );
+                       }
+                       
+                       if ( argc <= i+1 )
+                       {
+                               HLTError("The magnetic field integral was not specified." );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       char* cpErr = NULL;
+                       bfieldintegral = strtod(argv[i+1], &cpErr);
+                       if (cpErr == NULL or *cpErr != '\0')
+                       {
+                               HLTError("Cannot convert '%s' to a valid floating point number.",
+                                       argv[i+1]
+                               );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       fCanLoadBL = false;  // Prevent loading from CDB.
+                       i++;
+                       continue;
+               }
+       
+               if (strcmp(argv[i], "-a7") == 0 or strcmp(argv[i], "-a8") == 0 or
+                   strcmp(argv[i], "-a9") == 0 or strcmp(argv[i], "-a10") == 0
+                  )
+               {
+                       int chamber = 7; int chamberIndex = 0;
+                       switch (argv[i][2])
+                       {
+                       case '7': chamber = 7; chamberIndex = 0; break;
+                       case '8': chamber = 8; chamberIndex = 1; break;
+                       case '9': chamber = 9; chamberIndex = 2; break;
+                       case '1': chamber = 10; chamberIndex = 3; break;
+                       }
+                       
+                       if (not fCanLoadA[chamberIndex])
+                       {
+                               HLTWarning("The region of interest parameter 'A' for chamber %d was"
+                                       " already specified. Will replace previous value given by -a%d.",
+                                       chamber, chamber
+                               );
+                       }
+                       
+                       if ( argc <= i+1 )
+                       {
+                               HLTError("The region of interest parameter was not specified." );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       char* cpErr = NULL;
+                       roiA[chamberIndex] = strtod(argv[i+1], &cpErr);
+                       if (cpErr == NULL or *cpErr != '\0')
+                       {
+                               HLTError("Cannot convert '%s' to a valid floating point number.",
+                                       argv[i+1]
+                               );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       fCanLoadA[chamberIndex] = false;  // Prevent loading from CDB.
+                       i++;
+                       continue;
+               }
+       
+               if (strcmp(argv[i], "-b7") == 0 or strcmp(argv[i], "-b8") == 0 or
+                   strcmp(argv[i], "-b9") == 0 or strcmp(argv[i], "-b10") == 0
+                  )
+               {
+                       int chamber = 7; int chamberIndex = 0;
+                       switch (argv[i][2])
+                       {
+                       case '7': chamber = 7; chamberIndex = 0; break;
+                       case '8': chamber = 8; chamberIndex = 1; break;
+                       case '9': chamber = 9; chamberIndex = 2; break;
+                       case '1': chamber = 10; chamberIndex = 3; break;
+                       }
+                       
+                       if (not fCanLoadB[chamberIndex])
+                       {
+                               HLTWarning("The region of interest parameter 'B' for chamber %d was"
+                                       " already specified. Will replace previous value given by -b%d.",
+                                       chamber, chamber
+                               );
+                       }
+                       
+                       if ( argc <= i+1 )
+                       {
+                               HLTError("The region of interest parameter was not specified." );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       char* cpErr = NULL;
+                       roiB[chamberIndex] = strtod(argv[i+1], &cpErr);
+                       if (cpErr == NULL or *cpErr != '\0')
+                       {
+                               HLTError("Cannot convert '%s' to a valid floating point number.",
+                                       argv[i+1]
+                               );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       fCanLoadB[chamberIndex] = false;  // Prevent loading from CDB.
+                       i++;
+                       continue;
+               }
+               
+               if (strcmp(argv[i], "-z7") == 0 or strcmp(argv[i], "-z8") == 0 or
+                   strcmp(argv[i], "-z9") == 0 or strcmp(argv[i], "-z10") == 0 or
+                   strcmp(argv[i], "-z11") == 0 or strcmp(argv[i], "-z13") == 0
+                  )
+               {
+                       int chamber = 7; int chamberIndex = 0;
+                       switch (argv[i][2])
+                       {
+                       case '7': chamber = 7; chamberIndex = 0; break;
+                       case '8': chamber = 8; chamberIndex = 1; break;
+                       case '9': chamber = 9; chamberIndex = 2; break;
+                       case '1':
+                               switch (argv[i][3])
+                               {
+                               case '0': chamber = 10; chamberIndex = 3; break;
+                               case '1': chamber = 11; chamberIndex = 4; break;
+                               case '3': chamber = 13; chamberIndex = 5; break;
+                               }
+                               break;
+                       }
+                       
+                       if (not fCanLoadZ[chamberIndex])
+                       {
+                               HLTWarning("The nominal Z coordinate of chamber %d was already"
+                                       " specified. Will replace previous value given by -z%d.",
+                                       chamber, chamber
+                               );
+                       }
+                       
+                       if ( argc <= i+1 )
+                       {
+                               HLTError("The region of interest parameter was not specified." );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       char* cpErr = NULL;
+                       chamberZ[chamberIndex] = strtod(argv[i+1], &cpErr);
+                       if (cpErr == NULL or *cpErr != '\0')
+                       {
+                               HLTError("Cannot convert '%s' to a valid floating point number.",
+                                       argv[i+1]
+                               );
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return -EINVAL;
+                       }
+                       
+                       fCanLoadZ[chamberIndex] = false;  // Prevent loading from CDB.
+                       i++;
+                       continue;
+               }
+               
+               if (strcmp( argv[i], "-delaysetup" ) == 0)
+               {
+                       fDelaySetup = true;
+                       continue;
+               }
+               
                if (strcmp(argv[i], "-warn_on_unexpected_block") == 0)
                {
                        fWarnForUnexpecedBlock = true;
                if (strcmp(argv[i], "-warn_on_unexpected_block") == 0)
                {
                        fWarnForUnexpecedBlock = true;
@@ -172,6 +449,75 @@ int AliHLTMUONMansoTrackerFSMComponent::DoInit(int argc, const char** argv)
                return -EINVAL;
        }
        
                return -EINVAL;
        }
        
+       if (cdbPath != NULL or run != -1)
+       {
+               int result = SetCDBPathAndRunNo(cdbPath, run);
+               if (result != 0)
+               {
+                       // Error messages already generated in SetCDBPathAndRunNo.
+                       FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                       return result;
+               }
+       }
+       
+       // Set all the parameters that were found on the command line.
+       if (not fCanLoadZmiddle) AliHLTMUONCalculations::Zf(zmiddle);
+       if (not fCanLoadBL) AliHLTMUONCalculations::QBL(bfieldintegral);
+       if (not fCanLoadA[0]) fTracker->SetA7(roiA[0]);
+       if (not fCanLoadA[1]) fTracker->SetA8(roiA[1]);
+       if (not fCanLoadA[2]) fTracker->SetA9(roiA[2]);
+       if (not fCanLoadA[3]) fTracker->SetA10(roiA[3]);
+       if (not fCanLoadB[0]) fTracker->SetB7(roiB[0]);
+       if (not fCanLoadB[1]) fTracker->SetB8(roiB[1]);
+       if (not fCanLoadB[2]) fTracker->SetB9(roiB[2]);
+       if (not fCanLoadB[3]) fTracker->SetB10(roiB[3]);
+       if (not fCanLoadZ[0]) fTracker->SetZ7(chamberZ[0]);
+       if (not fCanLoadZ[1]) fTracker->SetZ8(chamberZ[1]);
+       if (not fCanLoadZ[2]) fTracker->SetZ9(chamberZ[2]);
+       if (not fCanLoadZ[3]) fTracker->SetZ10(chamberZ[3]);
+       if (not fCanLoadZ[4]) fTracker->SetZ11(chamberZ[4]);
+       if (not fCanLoadZ[5]) fTracker->SetZ13(chamberZ[5]);
+       
+       if (not fDelaySetup)
+       {
+               if (AtLeastOneCanLoadFlagsIsSet())
+               {
+                       HLTInfo("Loading configuration parameters from CDB.");
+                       
+                       int result = ReadConfigFromCDB();
+                       if (result != 0)
+                       {
+                               // Error messages already generated in ReadConfigFromCDB.
+                               FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+                               return result;
+                       }
+               }
+               else
+               {
+                       // Print the debug messages here since ReadConfigFromCDB does not get called,
+                       // in-which the debug messages would have been printed.
+                       HLTDebug("Using the following configuration parameters:");
+                       HLTDebug("                    Middle of dipole Z coordinate = %f cm", AliHLTMUONCalculations::Zf());
+                       HLTDebug("                          Magnetic field integral = %f T.m", AliHLTMUONCalculations::QBL());
+                       HLTDebug("   Region of interest parameter 'A' for chamber 7 = %f",    fTracker->GetA7());
+                       HLTDebug("   Region of interest parameter 'B' for chamber 7 = %f cm", fTracker->GetB7());
+                       HLTDebug("   Region of interest parameter 'A' for chamber 8 = %f",    fTracker->GetA8());
+                       HLTDebug("   Region of interest parameter 'B' for chamber 8 = %f cm", fTracker->GetB8());
+                       HLTDebug("   Region of interest parameter 'A' for chamber 9 = %f",    fTracker->GetA9());
+                       HLTDebug("   Region of interest parameter 'B' for chamber 9 = %f cm", fTracker->GetB9());
+                       HLTDebug("  Region of interest parameter 'A' for chamber 10 = %f",    fTracker->GetA10());
+                       HLTDebug("  Region of interest parameter 'B' for chamber 10 = %f cm", fTracker->GetB10());
+                       HLTDebug("               Nominal Z coordinate for chamber 7 = %f cm", fTracker->GetZ7());
+                       HLTDebug("               Nominal Z coordinate for chamber 8 = %f cm", fTracker->GetZ8());
+                       HLTDebug("               Nominal Z coordinate for chamber 9 = %f cm", fTracker->GetZ9());
+                       HLTDebug("              Nominal Z coordinate for chamber 10 = %f cm", fTracker->GetZ10());
+                       HLTDebug("              Nominal Z coordinate for chamber 11 = %f cm", fTracker->GetZ11());
+                       HLTDebug("              Nominal Z coordinate for chamber 13 = %f cm", fTracker->GetZ13());
+               }
+               
+               ResetCanLoadFlags();  // From this point read all parameters from CDB.
+       }
+       
        const int initArraySize = 10;
        // Allocate some initial memory for the reconstructed hit arrays.
        try
        const int initArraySize = 10;
        // Allocate some initial memory for the reconstructed hit arrays.
        try
@@ -201,6 +547,192 @@ int AliHLTMUONMansoTrackerFSMComponent::DoInit(int argc, const char** argv)
 }
 
 
 }
 
 
+int AliHLTMUONMansoTrackerFSMComponent::Reconfigure(
+               const char* cdbEntry, const char* componentId
+       )
+{
+       /// Inherited from AliHLTComponent. This method will reload CDB configuration
+       /// entries for this component from the CDB.
+       /// \param cdbEntry If this is NULL or equals "HLT/ConfigMUON/MansoTrackerFSM"
+       ///     then new configuration parameters are loaded, otherwise nothing is done.
+       /// \param componentId  The name of the component in the current chain.
+       
+       bool givenConfigPath = strcmp(cdbEntry, AliHLTMUONConstants::MansoTrackerFSMCDBPath()) == 0;
+       
+       if (cdbEntry == NULL or givenConfigPath)
+       {
+               HLTInfo("Reading new configuration entries from CDB for component '%s'.", componentId);
+               ResetCanLoadFlags();  // Make sure to allow reading all values from CDB.
+               int result = ReadConfigFromCDB();
+               if (result != 0) return result;
+       }
+       
+       return 0;
+}
+
+
+int AliHLTMUONMansoTrackerFSMComponent::ReadPreprocessorValues(const char* modules)
+{
+       /// Inherited from AliHLTComponent. 
+       /// Updates the configuration of this component if HLT or ALL has been
+       /// specified in the 'modules' list.
+
+       TString mods = modules;
+       if (mods.Contains("ALL"))
+       {
+               return Reconfigure(NULL, GetComponentID());
+       }
+       if (mods.Contains("HLT"))
+       {
+               return Reconfigure(AliHLTMUONConstants::MansoTrackerFSMCDBPath(), GetComponentID());
+       }
+       return 0;
+}
+
+
+int AliHLTMUONMansoTrackerFSMComponent::ReadConfigFromCDB()
+{
+       /// Reads this component's configuration parameters from the CDB.
+       /// These include the middle of the dipole Z coordinate (zmiddle), the
+       /// integrated magnetic field of the dipole, Z coordinates of the chambers
+       /// and the region of interest parameters used during the tracking.
+       /// \param setZmiddle Indicates if the zmiddle parameter should be set
+       ///       (default true).
+       /// \param setBL Indicates if the integrated magnetic field parameter should
+       ///       be set (default true).
+       /// \return 0 if no errors occured and negative error code compatible with
+       ///       the HLT framework on errors.
+
+       const char* pathToEntry = AliHLTMUONConstants::MansoTrackerFSMCDBPath();
+       
+       TMap* map = NULL;
+       int result = FetchTMapFromCDB(pathToEntry, map);
+       if (result != 0) return result;
+       
+       Double_t value = 0;
+       if (fCanLoadZmiddle)
+       {
+               result = GetFloatFromTMap(map, "zmiddle", value, pathToEntry, "dipole middle Z coordinate");
+               if (result != 0) return result;
+               AliHLTMUONCalculations::Zf(value);
+       }
+       
+       if (fCanLoadBL)
+       {
+               result = GetFloatFromTMap(map, "bfieldintegral", value, pathToEntry, "integrated magnetic field");
+               if (result != 0) return result;
+               AliHLTMUONCalculations::QBL(value);
+       }
+       
+       if (fCanLoadA[0])
+       {
+               result = GetFloatFromTMap(map, "roi_paramA_chamber7", value, pathToEntry, "chamber 7 region of interest 'A'");
+               if (result != 0) return result;
+               fTracker->SetA7(value);
+       }
+       if (fCanLoadA[1])
+       {
+               result = GetFloatFromTMap(map, "roi_paramA_chamber8", value, pathToEntry, "chamber 8 region of interest 'A'");
+               if (result != 0) return result;
+               fTracker->SetA8(value);
+       }
+       if (fCanLoadA[2])
+       {
+               result = GetFloatFromTMap(map, "roi_paramA_chamber9", value, pathToEntry, "chamber 9 region of interest 'A'");
+               if (result != 0) return result;
+               fTracker->SetA9(value);
+       }
+       if (fCanLoadA[3])
+       {
+               result = GetFloatFromTMap(map, "roi_paramA_chamber10", value, pathToEntry, "chamber 10 region of interest 'A'");
+               if (result != 0) return result;
+               fTracker->SetA10(value);
+       }
+       
+       if (fCanLoadB[0])
+       {
+               result = GetFloatFromTMap(map, "roi_paramB_chamber7", value, pathToEntry, "chamber 7 region of interest 'B'");
+               if (result != 0) return result;
+               fTracker->SetB7(value);
+       }
+       if (fCanLoadB[1])
+       {
+               result = GetFloatFromTMap(map, "roi_paramB_chamber8", value, pathToEntry, "chamber 8 region of interest 'B'");
+               if (result != 0) return result;
+               fTracker->SetB8(value);
+       }
+       if (fCanLoadB[2])
+       {
+               result = GetFloatFromTMap(map, "roi_paramB_chamber9", value, pathToEntry, "chamber 9 region of interest 'B'");
+               if (result != 0) return result;
+               fTracker->SetB9(value);
+       }
+       if (fCanLoadB[3])
+       {
+               result = GetFloatFromTMap(map, "roi_paramB_chamber10", value, pathToEntry, "chamber 10 region of interest 'B'");
+               if (result != 0) return result;
+               fTracker->SetB10(value);
+       }
+       
+       if (fCanLoadZ[0])
+       {
+               result = GetFloatFromTMap(map, "chamber7postion", value, pathToEntry, "nominal chamber 7 Z coordinate");
+               if (result != 0) return result;
+               fTracker->SetZ7(value);
+       }
+       if (fCanLoadZ[1])
+       {
+               result = GetFloatFromTMap(map, "chamber8postion", value, pathToEntry, "nominal chamber 8 Z coordinate");
+               if (result != 0) return result;
+               fTracker->SetZ8(value);
+       }
+       if (fCanLoadZ[2])
+       {
+               result = GetFloatFromTMap(map, "chamber9postion", value, pathToEntry, "nominal chamber 9 Z coordinate");
+               if (result != 0) return result;
+               fTracker->SetZ9(value);
+       }
+       if (fCanLoadZ[3])
+       {
+               result = GetFloatFromTMap(map, "chamber10postion", value, pathToEntry, "nominal chamber 10 Z coordinate");
+               if (result != 0) return result;
+               fTracker->SetZ10(value);
+       }
+       if (fCanLoadZ[4])
+       {
+               result = GetFloatFromTMap(map, "chamber11postion", value, pathToEntry, "nominal chamber 11 Z coordinate");
+               if (result != 0) return result;
+               fTracker->SetZ11(value);
+       }
+       if (fCanLoadZ[5])
+       {
+               result = GetFloatFromTMap(map, "chamber13postion", value, pathToEntry, "nominal chamber 13 Z coordinate");
+               if (result != 0) return result;
+               fTracker->SetZ13(value);
+       }
+       
+       HLTDebug("Using the following configuration parameters:");
+       HLTDebug("                    Middle of dipole Z coordinate = %f cm", AliHLTMUONCalculations::Zf());
+       HLTDebug("                          Magnetic field integral = %f T.m", AliHLTMUONCalculations::QBL());
+       HLTDebug("   Region of interest parameter 'A' for chamber 7 = %f",    fTracker->GetA7());
+       HLTDebug("   Region of interest parameter 'B' for chamber 7 = %f cm", fTracker->GetB7());
+       HLTDebug("   Region of interest parameter 'A' for chamber 8 = %f",    fTracker->GetA8());
+       HLTDebug("   Region of interest parameter 'B' for chamber 8 = %f cm", fTracker->GetB8());
+       HLTDebug("   Region of interest parameter 'A' for chamber 9 = %f",    fTracker->GetA9());
+       HLTDebug("   Region of interest parameter 'B' for chamber 9 = %f cm", fTracker->GetB9());
+       HLTDebug("  Region of interest parameter 'A' for chamber 10 = %f",    fTracker->GetA10());
+       HLTDebug("  Region of interest parameter 'B' for chamber 10 = %f cm", fTracker->GetB10());
+       HLTDebug("               Nominal Z coordinate for chamber 7 = %f cm", fTracker->GetZ7());
+       HLTDebug("               Nominal Z coordinate for chamber 8 = %f cm", fTracker->GetZ8());
+       HLTDebug("               Nominal Z coordinate for chamber 9 = %f cm", fTracker->GetZ9());
+       HLTDebug("              Nominal Z coordinate for chamber 10 = %f cm", fTracker->GetZ10());
+       HLTDebug("              Nominal Z coordinate for chamber 11 = %f cm", fTracker->GetZ11());
+       HLTDebug("              Nominal Z coordinate for chamber 13 = %f cm", fTracker->GetZ13());
+       
+       return 0;
+}
+
+
 int AliHLTMUONMansoTrackerFSMComponent::DoDeinit()
 {
        ///
 int AliHLTMUONMansoTrackerFSMComponent::DoDeinit()
 {
        ///
@@ -226,6 +758,23 @@ int AliHLTMUONMansoTrackerFSMComponent::DoEvent(
        /// Inherited from AliHLTProcessor. Processes the new event data.
        ///
        
        /// Inherited from AliHLTProcessor. Processes the new event data.
        ///
        
+       // Initialise the configuration parameters from CDB if we were
+       // requested to initialise only when the first event was received.
+       if (fDelaySetup)
+       {
+               // Load the configuration paramters from CDB if they have not
+               // been given on the command line.
+               if (AtLeastOneCanLoadFlagsIsSet())
+               {
+                       HLTInfo("Loading configuration parameters from CDB.");
+                       int result = ReadConfigFromCDB();
+                       if (result != 0) return result;
+               }
+               
+               fDelaySetup = false;
+               ResetCanLoadFlags();  // From this point read all parameters from CDB.
+       }
+       
        Reset();
        AliHLTUInt32_t specification = 0;  // Contains the output data block spec bits.
        
        Reset();
        AliHLTUInt32_t specification = 0;  // Contains the output data block spec bits.
        
@@ -500,6 +1049,43 @@ void AliHLTMUONMansoTrackerFSMComponent::AddRecHits(
 }
 
 
 }
 
 
+void AliHLTMUONMansoTrackerFSMComponent::ResetCanLoadFlags()
+{
+       /// Resets all the fCanLoad* flags to true. This enables loading of all
+       /// those CDB entries in the method ReadConfigFromCDB.
+       
+       fCanLoadZmiddle = true;
+       fCanLoadBL = true;
+       for (int i = 0; i < 4; i++)
+       {
+               fCanLoadA[i] = true;
+               fCanLoadB[i] = true;
+       }
+       for (int i = 0; i < 6; i++)
+       {
+               fCanLoadZ[i] = true;
+       }
+}
+
+
+bool AliHLTMUONMansoTrackerFSMComponent::AtLeastOneCanLoadFlagsIsSet() const
+{
+       /// Returns true if at least one fCanLoad* flag was true and false otherwise.
+
+       if (fCanLoadZmiddle or fCanLoadBL) return true;
+       for (int i = 0; i < 4; i++)
+       {
+               if (fCanLoadA[i]) return true;
+               if (fCanLoadB[i]) return true;
+       }
+       for (int i = 0; i < 6; i++)
+       {
+               if (fCanLoadZ[i]) return true;
+       }
+       return false;
+}
+
+
 void AliHLTMUONMansoTrackerFSMComponent::RequestClusters(
                AliHLTMUONMansoTrackerFSM* tracker,
                AliHLTFloat32_t left, AliHLTFloat32_t right,
 void AliHLTMUONMansoTrackerFSMComponent::RequestClusters(
                AliHLTMUONMansoTrackerFSM* tracker,
                AliHLTFloat32_t left, AliHLTFloat32_t right,
index 555e83e0b90d251bf6f5696502665f9b16ba02b5..b150d25e4fe716cec80d1b1347555ea28d53ff5c 100644 (file)
@@ -81,6 +81,8 @@ protected:
        // These functions provide initialization as well as the actual processing
        // capabilities of the component. 
        virtual int DoInit(int argc, const char** argv);
        // These functions provide initialization as well as the actual processing
        // capabilities of the component. 
        virtual int DoInit(int argc, const char** argv);
+       virtual int Reconfigure(const char* cdbEntry, const char* componentId);
+       virtual int ReadPreprocessorValues(const char* modules);
        virtual int DoDeinit();
        virtual int DoEvent(
                        const AliHLTComponentEventData& evtData,
        virtual int DoDeinit();
        virtual int DoEvent(
                        const AliHLTComponentEventData& evtData,
@@ -107,6 +109,22 @@ private:
                        const AliHLTMUONRecHitStruct* recHits,
                        AliHLTUInt32_t count
                );
                        const AliHLTMUONRecHitStruct* recHits,
                        AliHLTUInt32_t count
                );
+       
+       void ResetCanLoadFlags();
+       bool AtLeastOneCanLoadFlagsIsSet() const;
+       
+       /**
+        * Reads this component's configuration parameters from the CDB.
+        * These include the middle of the dipole Z coordinate (zmiddle), the
+        * integrated magnetic field of the dipole, Z coordinates of the chambers
+        * and the region of interest parameters used during the tracking.
+        * \note Only those parameters are loaded from CDB for which the fCanLoadxyz
+        *       flags are true.
+        * \return 0 if no errors occured and negative error code compatible with
+        *       the HLT framework on errors.
+        */
+       int ReadConfigFromCDB();
+       
 
        AliHLTMUONMansoTrackerFSM* fTracker;  //! Tracker to do the actual work.
        
 
        AliHLTMUONMansoTrackerFSM* fTracker;  //! Tracker to do the actual work.
        
@@ -142,8 +160,8 @@ private:
        };
        
        //std::vector<AliRecHitBlockInfo> fRecHitBlock[4];  //! Arrays of rec hit block data.
        };
        
        //std::vector<AliRecHitBlockInfo> fRecHitBlock[4];  //! Arrays of rec hit block data.
-       AliHLTUInt32_t fRecHitBlockArraySize;  // The array size of each array in fRecHitBlock.
-       AliHLTUInt32_t fRecHitBlockCount[4];   // The number of records actually stored in fRecHitBlock[i].
+       AliHLTUInt32_t fRecHitBlockArraySize;  ///< The array size of each array in fRecHitBlock.
+       AliHLTUInt32_t fRecHitBlockCount[4];   ///< The number of records actually stored in fRecHitBlock[i].
        // The following are 4 dynamic arrays of AliRecHitBlockInfo structures.
        // These arrays will all have the same size = fRecHitBlockArraySize.
        // The array itself is actually allocated only once and the pointer stored in fRecHitBlock[0],
        // The following are 4 dynamic arrays of AliRecHitBlockInfo structures.
        // These arrays will all have the same size = fRecHitBlockArraySize.
        // The array itself is actually allocated only once and the pointer stored in fRecHitBlock[0],
@@ -151,7 +169,14 @@ private:
        // The allocated memory is: 4 * fRecHitBlockArraySize * sizeof(AliRecHitBlockInfo).
        AliRecHitBlockInfo* fRecHitBlock[4];  //! Arrays of rec hit block data.
 
        // The allocated memory is: 4 * fRecHitBlockArraySize * sizeof(AliRecHitBlockInfo).
        AliRecHitBlockInfo* fRecHitBlock[4];  //! Arrays of rec hit block data.
 
-       bool fWarnForUnexpecedBlock;  // Flag indicating if we should log a warning if we got a block of an unexpected type.
+       bool fWarnForUnexpecedBlock;  ///< Flag indicating if we should log a warning if we got a block of an unexpected type.
+       bool fDelaySetup;  ///< Indicates if the component should delay loading and initialising from the CDB to the start of run event.
+       
+       bool fCanLoadZmiddle;  ///< Indicates if the zmiddle parameter can be loaded from CDB.
+       bool fCanLoadBL;  ///< Indicates if the bfieldintegral parameter can be loaded from CDB.
+       bool fCanLoadA[4];  ///< Indicates if the roi_paramA_chamber[7..10] parameter can be loaded from CDB.
+       bool fCanLoadB[4];  ///< Indicates if the roi_paramB_chamber[7..10] parameter can be loaded from CDB.
+       bool fCanLoadZ[6];  ///< Indicates if the chamber[7..11,13]postion parameter can be loaded from CDB.
        
        ClassDef(AliHLTMUONMansoTrackerFSMComponent, 0);  // Manso tracker component implemented as a finite state machine (FSM).
 };
        
        ClassDef(AliHLTMUONMansoTrackerFSMComponent, 0);  // Manso tracker component implemented as a finite state machine (FSM).
 };
index 654787e53e0155e3776e9430fdc70a1be6a95773..7530c1e214d74f69a407c2427d3a7267a808797c 100644 (file)
@@ -138,6 +138,7 @@ AliHLTMUONTriggerReconstructor::AliDecoderHandler::AliDecoderHandler() :
        fSuppressPartialTriggers(false),
        fOverflowed(false),
        fWarnOnly(false),
        fSuppressPartialTriggers(false),
        fOverflowed(false),
        fWarnOnly(false),
+       fUseLocalId(true),
        fUseCrateId(true),
        fCurrentCrateId(0),
        fCurrentRegional(0)
        fUseCrateId(true),
        fCurrentCrateId(0),
        fCurrentRegional(0)
index 662ef8ada4a0bb1d5255d3ade1ab54f0904e0d46..31b65c6e117079db271bf7b0b0859a2179ba5571 100644 (file)
@@ -102,6 +102,20 @@ public:
         */
        void UseCrateId(bool value) { fDecoder.GetHandler().UseCrateId(value); }
        
         */
        void UseCrateId(bool value) { fDecoder.GetHandler().UseCrateId(value); }
        
+       /**
+        * Returns true if the local board ID as found in the local structure
+        * will be used for lookups in the LUT, rather than the sequencial
+        * index number of the structure.
+        */
+       bool UseLocalId() const { return fDecoder.GetHandler().UseLocalId(); }
+       
+       /**
+        * Sets the flag indicating if the local board ID as found in the local
+        * structure should be used for lookups in the LUT, rather than the
+        * sequencial index number of the structure.
+        */
+       void UseLocalId(bool value) { fDecoder.GetHandler().UseLocalId(value); }
+       
 private:
 
        class AliDecoderHandler : public AliMUONTriggerDDLDecoderEventHandler, public AliHLTLogging
 private:
 
        class AliDecoderHandler : public AliMUONTriggerDDLDecoderEventHandler, public AliHLTLogging
@@ -195,6 +209,20 @@ private:
                 */
                void UseCrateId(bool value) { fUseCrateId = value; }
                
                 */
                void UseCrateId(bool value) { fUseCrateId = value; }
                
+               /**
+                * Returns true if the local board ID as found in the local structure
+                * will be used for lookups in the LUT, rather than the sequencial
+                * index number of the structure.
+                */
+               bool UseLocalId() const { return fUseLocalId; }
+               
+               /**
+                * Sets the flag indicating if the local board ID as found in the local
+                * structure should be used for lookups in the LUT, rather than the
+                * sequencial index number of the structure.
+                */
+               void UseLocalId(bool value) { fUseLocalId = value; }
+               
                /**
                 * Sets the DDL bit according to the DDL value given.
                 */
                /**
                 * Sets the DDL bit according to the DDL value given.
                 */
@@ -296,6 +324,7 @@ private:
                bool fSuppressPartialTriggers;  ///< Flag to indicate if we should suppres partial triggers.
                bool fOverflowed;  ///< Flag to indicate if we overflowed the output buffer.
                bool fWarnOnly;  ///< Flag indicating if the OnError method should generate warnings rather than error messages.
                bool fSuppressPartialTriggers;  ///< Flag to indicate if we should suppres partial triggers.
                bool fOverflowed;  ///< Flag to indicate if we overflowed the output buffer.
                bool fWarnOnly;  ///< Flag indicating if the OnError method should generate warnings rather than error messages.
+               bool fUseLocalId;  ///< Flag to indicate if the local structure ID as found in the local structures should be used or not.
                bool fUseCrateId;  ///< Flag to indicate if the crate ID as found in the regional header structures should be used or not.
                AliHLTInt8_t fCurrentCrateId;  ///< The current trigger crate ID number from the regional header.
                UInt_t fCurrentRegional;  ///< Index number of current regional structure being decoded.
                bool fUseCrateId;  ///< Flag to indicate if the crate ID as found in the regional header structures should be used or not.
                AliHLTInt8_t fCurrentCrateId;  ///< The current trigger crate ID number from the regional header.
                UInt_t fCurrentRegional;  ///< Index number of current regional structure being decoded.
index 52de671bc3b5cfb8a4f91a18dda41511a0e1abe1..6f8d0ac559869df38a6db895dc77f2293a22bd4d 100644 (file)
@@ -28,6 +28,7 @@
 #include "AliHLTMUONTriggerReconstructor.h"
 #include "AliHLTMUONHitReconstructor.h"
 #include "AliHLTMUONConstants.h"
 #include "AliHLTMUONTriggerReconstructor.h"
 #include "AliHLTMUONHitReconstructor.h"
 #include "AliHLTMUONConstants.h"
+#include "AliHLTMUONCalculations.h"
 #include "AliHLTMUONUtils.h"
 #include "AliHLTMUONDataBlockWriter.h"
 #include "AliRawDataHeader.h"
 #include "AliHLTMUONUtils.h"
 #include "AliHLTMUONDataBlockWriter.h"
 #include "AliRawDataHeader.h"
@@ -60,7 +61,11 @@ AliHLTMUONTriggerReconstructorComponent::AliHLTMUONTriggerReconstructorComponent
        fDDL(-1),
        fWarnForUnexpecedBlock(false),
        fStopOnOverflow(false),
        fDDL(-1),
        fWarnForUnexpecedBlock(false),
        fStopOnOverflow(false),
-       fUseCrateId(true)
+       fUseCrateId(true),
+       fDelaySetup(false),
+       fZmiddleSpecified(false),
+       fBLSpecified(false),
+       fLutInitialised(false)
 {
        ///
        /// Default constructor.
 {
        ///
        /// Default constructor.
@@ -164,6 +169,10 @@ int AliHLTMUONTriggerReconstructorComponent::DoInit(int argc, const char** argv)
        fWarnForUnexpecedBlock = false;
        fStopOnOverflow = false;
        fUseCrateId = true;
        fWarnForUnexpecedBlock = false;
        fStopOnOverflow = false;
        fUseCrateId = true;
+       fDelaySetup = false;
+       fZmiddleSpecified = false;
+       fBLSpecified = false;
+       fLutInitialised = false;
        
        const char* lutFileName = NULL;
        const char* cdbPath = NULL;
        
        const char* lutFileName = NULL;
        const char* cdbPath = NULL;
@@ -171,14 +180,24 @@ int AliHLTMUONTriggerReconstructorComponent::DoInit(int argc, const char** argv)
        bool useCDB = false;
        bool suppressPartialTrigs = true;
        bool tryRecover = false;
        bool useCDB = false;
        bool suppressPartialTrigs = true;
        bool tryRecover = false;
+       bool useLocalId = true;
+       double zmiddle = 0;
+       double bfieldintegral = 0;
        
        for (int i = 0; i < argc; i++)
        {
                if (strcmp( argv[i], "-lut" ) == 0)
                {
        
        for (int i = 0; i < argc; i++)
        {
                if (strcmp( argv[i], "-lut" ) == 0)
                {
+                       if (lutFileName != NULL)
+                       {
+                               HLTWarning("LUT path was already specified."
+                                       " Will replace previous value given by -lut."
+                               );
+                       }
+                       
                        if ( argc <= i+1 )
                        {
                        if ( argc <= i+1 )
                        {
-                               HLTError("LookupTable filename not specified." );
+                               HLTError("The lookup table filename was not specified." );
                                // Make sure to delete fTrigRec to avoid partial initialisation.
                                delete fTrigRec;
                                fTrigRec = NULL;
                                // Make sure to delete fTrigRec to avoid partial initialisation.
                                delete fTrigRec;
                                fTrigRec = NULL;
@@ -193,6 +212,13 @@ int AliHLTMUONTriggerReconstructorComponent::DoInit(int argc, const char** argv)
                
                if (strcmp( argv[i], "-ddl" ) == 0)
                {
                
                if (strcmp( argv[i], "-ddl" ) == 0)
                {
+                       if (fDDL != -1)
+                       {
+                               HLTWarning("DDL number was already specified."
+                                       " Will replace previous value given by -ddl or -ddlid."
+                               );
+                       }
+                       
                        if ( argc <= i+1 )
                        {
                                HLTError("DDL number not specified. It must be in the range [21..22]" );
                        if ( argc <= i+1 )
                        {
                                HLTError("DDL number not specified. It must be in the range [21..22]" );
@@ -228,6 +254,13 @@ int AliHLTMUONTriggerReconstructorComponent::DoInit(int argc, const char** argv)
                
                if (strcmp( argv[i], "-ddlid" ) == 0)
                {
                
                if (strcmp( argv[i], "-ddlid" ) == 0)
                {
+                       if (fDDL != -1)
+                       {
+                               HLTWarning("DDL number was already specified."
+                                       " Will replace previous value given by -ddl or -ddlid."
+                               );
+                       }
+                       
                        if ( argc <= i+1 )
                        {
                                HLTError("DDL equipment ID number not specified. It must be in the range [2816..2817]" );
                        if ( argc <= i+1 )
                        {
                                HLTError("DDL equipment ID number not specified. It must be in the range [2816..2817]" );
@@ -269,6 +302,13 @@ int AliHLTMUONTriggerReconstructorComponent::DoInit(int argc, const char** argv)
                
                if (strcmp( argv[i], "-cdbpath" ) == 0)
                {
                
                if (strcmp( argv[i], "-cdbpath" ) == 0)
                {
+                       if (cdbPath != NULL)
+                       {
+                               HLTWarning("CDB path was already specified."
+                                       " Will replace previous value given by -cdbpath."
+                               );
+                       }
+                       
                        if ( argc <= i+1 )
                        {
                                HLTError("The CDB path was not specified." );
                        if ( argc <= i+1 )
                        {
                                HLTError("The CDB path was not specified." );
@@ -285,6 +325,13 @@ int AliHLTMUONTriggerReconstructorComponent::DoInit(int argc, const char** argv)
        
                if (strcmp( argv[i], "-run" ) == 0)
                {
        
                if (strcmp( argv[i], "-run" ) == 0)
                {
+                       if (run != -1)
+                       {
+                               HLTWarning("Run number was already specified."
+                                       " Will replace previous value given by -run."
+                               );
+                       }
+                       
                        if ( argc <= i+1 )
                        {
                                HLTError("The run number was not specified." );
                        if ( argc <= i+1 )
                        {
                                HLTError("The run number was not specified." );
@@ -310,6 +357,84 @@ int AliHLTMUONTriggerReconstructorComponent::DoInit(int argc, const char** argv)
                        i++;
                        continue;
                }
                        i++;
                        continue;
                }
+       
+               if (strcmp( argv[i], "-zmiddle" ) == 0)
+               {
+                       if (fZmiddleSpecified)
+                       {
+                               HLTWarning("The Z coordinate for the middle of the dipole was already specified."
+                                       " Will replace previous value given by -zmiddle."
+                               );
+                       }
+                       
+                       if ( argc <= i+1 )
+                       {
+                               HLTError("The Z coordinate for the middle of the dipole was not specified." );
+                               // Make sure to delete fTrigRec to avoid partial initialisation.
+                               delete fTrigRec;
+                               fTrigRec = NULL;
+                               return -EINVAL;
+                       }
+                       
+                       char* cpErr = NULL;
+                       zmiddle = strtod(argv[i+1], &cpErr);
+                       if (cpErr == NULL or *cpErr != '\0')
+                       {
+                               HLTError("Cannot convert '%s' to a valid floating point number.",
+                                       argv[i+1]
+                               );
+                               // Make sure to delete fTrigRec to avoid partial initialisation.
+                               delete fTrigRec;
+                               fTrigRec = NULL;
+                               return -EINVAL;
+                       }
+                       
+                       fZmiddleSpecified = true;
+                       i++;
+                       continue;
+               }
+       
+               if (strcmp( argv[i], "-bfieldintegral" ) == 0)
+               {
+                       if (fBLSpecified)
+                       {
+                               HLTWarning("The magnetic field integral was already specified."
+                                       " Will replace previous value given by -bfieldintegral."
+                               );
+                       }
+                       
+                       if ( argc <= i+1 )
+                       {
+                               HLTError("The magnetic field integral was not specified." );
+                               // Make sure to delete fTrigRec to avoid partial initialisation.
+                               delete fTrigRec;
+                               fTrigRec = NULL;
+                               return -EINVAL;
+                       }
+                       
+                       char* cpErr = NULL;
+                       bfieldintegral = strtod(argv[i+1], &cpErr);
+                       if (cpErr == NULL or *cpErr != '\0')
+                       {
+                               HLTError("Cannot convert '%s' to a valid floating point number.",
+                                       argv[i+1]
+                               );
+                               // Make sure to delete fTrigRec to avoid partial initialisation.
+                               delete fTrigRec;
+                               fTrigRec = NULL;
+                               return -EINVAL;
+                       }
+                       
+                       fBLSpecified = true;
+                       i++;
+                       continue;
+               }
+               
+               if (strcmp( argv[i], "-delaysetup" ) == 0)
+               {
+                       fDelaySetup = true;
+                       continue;
+               }
                
                if (strcmp( argv[i], "-warn_on_unexpected_block" ) == 0)
                {
                
                if (strcmp( argv[i], "-warn_on_unexpected_block" ) == 0)
                {
@@ -347,6 +472,12 @@ int AliHLTMUONTriggerReconstructorComponent::DoInit(int argc, const char** argv)
                        continue;
                }
                
                        continue;
                }
                
+               if (strcmp( argv[i], "-dont_use_localid" ) == 0)
+               {
+                       useLocalId = false;
+                       continue;
+               }
+               
                HLTError("Unknown option '%s'.", argv[i] );
                // Make sure to delete fTrigRec to avoid partial initialisation.
                delete fTrigRec;
                HLTError("Unknown option '%s'.", argv[i] );
                // Make sure to delete fTrigRec to avoid partial initialisation.
                delete fTrigRec;
@@ -355,46 +486,116 @@ int AliHLTMUONTriggerReconstructorComponent::DoInit(int argc, const char** argv)
                
        } // for loop
        
                
        } // for loop
        
+       if (fZmiddleSpecified and useCDB)
+       {
+               HLTWarning("The -cdb or -cdbpath parameter was specified, which indicates that"
+                       " this component should read from the CDB, but then the -zmiddle argument"
+                       " was also used. Will override the value from CDB with the command"
+                       " line parameter given."
+               );
+       }
+       if (fBLSpecified and useCDB)
+       {
+               HLTWarning("The -cdb or -cdbpath parameter was specified, which indicates that"
+                       " this component should read from the CDB, but then the -bfieldintegral"
+                       " argument was also used. Will override the value from CDB with the"
+                       " command line parameter given."
+               );
+       }
+       
+       if (lutFileName != NULL and useCDB == true)
+       {
+               HLTWarning("The -cdb or -cdbpath parameter was specified, which indicates that"
+                       " this component should read from the CDB, but then the -lut argument"
+                       " was also used. Will ignore the -lut option and load from CDB anyway."
+               );
+       }
+       
        if (lutFileName == NULL) useCDB = true;
        
        if (lutFileName == NULL) useCDB = true;
        
-       if (fDDL == -1)
+       if (fDDL == -1 and not fDelaySetup)
        {
                HLTWarning("DDL number not specified. Cannot check if incomming data is valid.");
        }
        
        {
                HLTWarning("DDL number not specified. Cannot check if incomming data is valid.");
        }
        
-       int result = 0;
        if (cdbPath != NULL or run != -1)
        {
        if (cdbPath != NULL or run != -1)
        {
-               result = SetCDBPathAndRunNo(cdbPath, run);
+               int result = SetCDBPathAndRunNo(cdbPath, run);
+               if (result != 0)
+               {
+                       // Error messages already generated in SetCDBPathAndRunNo.
+                       delete fTrigRec; // Make sure to delete fTrigRec to avoid partial initialisation.
+                       fTrigRec = NULL;
+                       return result;
+               }
        }
        
        }
        
-       if (result == 0 and useCDB)
+       if (useCDB)
        {
        {
-               HLTInfo("Loading lookup table information from CDB for DDL %d (ID = %d).",
-                       fDDL+1, AliHLTMUONUtils::DDLNumberToEquipId(fDDL)
-               );
-               if (fDDL == -1)
-                       HLTWarning("DDL number not specified. The lookup table loaded from CDB will be empty!");
-               result = ReadLutFromCDB();
+               if (not fDelaySetup)
+               {
+                       HLTInfo("Loading lookup table information from CDB for DDL %d (ID = %d).",
+                               fDDL+1, AliHLTMUONUtils::DDLNumberToEquipId(fDDL)
+                       );
+                       int result = ReadLutFromCDB();
+                       if (result != 0)
+                       {
+                               // Error messages already generated in ReadLutFromCDB.
+                               delete fTrigRec; // Make sure to delete fTrigRec to avoid partial initialisation.
+                               fTrigRec = NULL;
+                               return result;
+                       }
+                       fLutInitialised = true;
+               }
        }
        }
-       else if (result == 0)
+       else
        {
                HLTInfo("Loading lookup table information from file %s.", lutFileName);
        {
                HLTInfo("Loading lookup table information from file %s.", lutFileName);
-               result = ReadLookUpTable(lutFileName);
+               int result = ReadLookUpTable(lutFileName);
+               if (result != 0)
+               {
+                       // Error messages already generated in ReadLookUpTable.
+                       delete fTrigRec; // Make sure to delete fTrigRec to avoid partial initialisation.
+                       fTrigRec = NULL;
+                       return result;
+               }
+               fLutInitialised = true;
        }
        }
-       if (result != 0)
+       
+       if (fZmiddleSpecified) AliHLTMUONCalculations::Zf(zmiddle);
+       if (fBLSpecified) AliHLTMUONCalculations::QBL(bfieldintegral);
+       
+       if (not fDelaySetup)
        {
        {
-               // Error messages already generated in ReadLutFromCDB or ReadLookUpTable.
-               
-               // Make sure to delete fTrigRec to avoid partial initialisation.
-               delete fTrigRec;
-               fTrigRec = NULL;
-               return result;
+               if (not fZmiddleSpecified or not fBLSpecified)
+               {
+                       HLTInfo("Loading configuration parameters from CDB for DDL %d (ID = %d).",
+                               fDDL+1, AliHLTMUONUtils::DDLNumberToEquipId(fDDL)
+                       );
+                       
+                       int result = ReadConfigFromCDB(not fZmiddleSpecified, not fBLSpecified);
+                       if (result != 0)
+                       {
+                               // Error messages already generated in ReadConfigFromCDB.
+                               delete fTrigRec; // Make sure to delete fTrigRec to avoid partial initialisation.
+                               fTrigRec = NULL;
+                               return result;
+                       }
+               }
+               else
+               {
+                       // Print the debug messages here since ReadConfigFromCDB does not get called,
+                       // in-which the debug messages would have been printed.
+                       HLTDebug("Using the following configuration parameters:");
+                       HLTDebug("  Middle of dipole Z coordinate = %f cm", AliHLTMUONCalculations::Zf());
+                       HLTDebug("        Magnetic field integral = %f T.m", AliHLTMUONCalculations::QBL());
+               }
        }
        
        fTrigRec->SuppressPartialTriggers(suppressPartialTrigs);
        fTrigRec->TryRecover(tryRecover);
        fTrigRec->UseCrateId(fUseCrateId);
        }
        
        fTrigRec->SuppressPartialTriggers(suppressPartialTrigs);
        fTrigRec->TryRecover(tryRecover);
        fTrigRec->UseCrateId(fUseCrateId);
+       fTrigRec->UseLocalId(useLocalId);
        
        return 0;
 }
        
        return 0;
 }
@@ -430,6 +631,61 @@ int AliHLTMUONTriggerReconstructorComponent::DoEvent(
        /// Inherited from AliHLTProcessor. Processes the new event data.
        ///
        
        /// Inherited from AliHLTProcessor. Processes the new event data.
        ///
        
+       // Initialise the LUT and configuration parameters from CDB if we were
+       // requested to initialise only when the first event was received.
+       if (fDelaySetup)
+       {
+               // Use the specification given by the first data block if we
+               // have not been given a DDL number on the command line.
+               if (fDDL == -1)
+               {
+                       if (evtData.fBlockCnt <= 0)
+                       {
+                               HLTError("The initialisation from CDB of the component has"
+                                       " been delayed to the first received event. However,"
+                                       " no data blocks have been found in the first event."
+                               );
+                               return -ENOENT;
+                       }
+                       
+                       fDDL = AliHLTMUONUtils::SpecToDDLNumber(blocks[0].fSpecification);
+                       
+                       if (fDDL == -1)
+                       {
+                               HLTError("Received a data block with a specification (0x%8.8X)"
+                                       " indicating multiple DDL data sources, but we must only"
+                                       " receive data from one trigger station DDL.",
+                                       blocks[0].fSpecification
+                               );
+                               return -EPROTO;
+                       }
+               }
+               
+               // Check that the LUT was not already loaded in DoInit.
+               if (not fLutInitialised)
+               {
+                       HLTInfo("Loading lookup table information from CDB for DDL %d (ID = %d).",
+                               fDDL+1, AliHLTMUONUtils::DDLNumberToEquipId(fDDL)
+                       );
+                       int result = ReadLutFromCDB();
+                       if (result != 0) return result;
+                       fLutInitialised = true;
+               }
+               
+               // Load the configuration paramters from CDB if they have not been given
+               // on the command line.
+               if (not fZmiddleSpecified or not fBLSpecified)
+               {
+                       HLTInfo("Loading configuration parameters from CDB for DDL %d (ID = %d).",
+                               fDDL+1, AliHLTMUONUtils::DDLNumberToEquipId(fDDL)
+                       );
+                       int result = ReadConfigFromCDB(not fZmiddleSpecified, not fBLSpecified);
+                       if (result != 0) return result;
+               }
+               
+               fDelaySetup = false;
+       }
+       
        // Process an event
        unsigned long totalSize = 0; // Amount of memory currently consumed in bytes.
 
        // Process an event
        unsigned long totalSize = 0; // Amount of memory currently consumed in bytes.
 
@@ -561,6 +817,66 @@ int AliHLTMUONTriggerReconstructorComponent::DoEvent(
 }
 
 
 }
 
 
+int AliHLTMUONTriggerReconstructorComponent::Reconfigure(
+               const char* cdbEntry, const char* componentId
+       )
+{
+       /// Inherited from AliHLTComponent. This method will reload CDB configuration
+       /// entries for this component from the CDB.
+       /// \param cdbEntry If this is NULL then it is assumed that all CDB entries should
+       ///      be reloaded. Otherwise a particular value for 'cdbEntry' will trigger
+       ///      reloading of the LUT if the path contains 'MUON/', but the other
+       ///      configuration parameters will be loaded if 'cdbEntry' contains
+       ///      "HLT/ConfigMUON/TriggerReconstructor".
+       /// \param componentId  The name of the component in the current chain.
+       
+       bool startsWithMUON = TString(cdbEntry).Index("MUON/", 5, 0, TString::kExact) == 0;
+       bool givenConfigPath = strcmp(cdbEntry, AliHLTMUONConstants::TriggerReconstructorCDBPath()) == 0;
+       
+       if (cdbEntry == NULL or startsWithMUON or givenConfigPath)
+       {
+               HLTInfo("Reading new configuration entries from CDB for component '%s'.", componentId);
+       }
+       
+       if (cdbEntry == NULL or startsWithMUON)
+       {
+               int result = ReadLutFromCDB();
+               if (result != 0) return result;
+       }
+       
+       if (cdbEntry == NULL or givenConfigPath)
+       {
+               int result = ReadConfigFromCDB();
+               if (result != 0) return result;
+       }
+       
+       return 0;
+}
+
+
+int AliHLTMUONTriggerReconstructorComponent::ReadPreprocessorValues(const char* modules)
+{
+       /// Inherited from AliHLTComponent. 
+       /// Updates the configuration of this component if either HLT or MUON have
+       /// been specified in the 'modules' list.
+
+       TString mods = modules;
+       if (mods.Contains("ALL") or (mods.Contains("HLT") and mods.Contains("MUON")))
+       {
+               return Reconfigure(NULL, GetComponentID());
+       }
+       if (mods.Contains("HLT"))
+       {
+               return Reconfigure(AliHLTMUONConstants::TriggerReconstructorCDBPath(), GetComponentID());
+       }
+       if (mods.Contains("MUON"))
+       {
+               return Reconfigure("MUON/*", GetComponentID());
+       }
+       return 0;
+}
+
+
 int AliHLTMUONTriggerReconstructorComponent::ReadLookUpTable(const char* lutpath)
 {
        ///
 int AliHLTMUONTriggerReconstructorComponent::ReadLookUpTable(const char* lutpath)
 {
        ///
@@ -596,6 +912,49 @@ int AliHLTMUONTriggerReconstructorComponent::ReadLookUpTable(const char* lutpath
 }
 
 
 }
 
 
+int AliHLTMUONTriggerReconstructorComponent::ReadConfigFromCDB(
+               bool setZmiddle, bool setBL
+       )
+{
+       /// Reads this component's configuration parameters from the CDB.
+       /// These include the middle of the dipole Z coordinate (zmiddle) and the
+       /// integrated magnetic field of the dipole.
+       /// \param setZmiddle Indicates if the zmiddle parameter should be set
+       ///       (default true).
+       /// \param setBL Indicates if the integrated magnetic field parameter should
+       ///       be set (default true).
+       /// \return 0 if no errors occured and negative error code compatible with
+       ///       the HLT framework on errors.
+
+       const char* pathToEntry = AliHLTMUONConstants::TriggerReconstructorCDBPath();
+       
+       TMap* map = NULL;
+       int result = FetchTMapFromCDB(pathToEntry, map);
+       if (result != 0) return result;
+       
+       Double_t value = 0;
+       if (setZmiddle)
+       {
+               result = GetFloatFromTMap(map, "zmiddle", value, pathToEntry, "dipole middle Z coordinate");
+               if (result != 0) return result;
+               AliHLTMUONCalculations::Zf(value);
+       }
+       
+       if (setBL)
+       {
+               result = GetFloatFromTMap(map, "bfieldintegral", value, pathToEntry, "integrated magnetic field");
+               if (result != 0) return result;
+               AliHLTMUONCalculations::QBL(value);
+       }
+       
+       HLTDebug("Using the following configuration parameters:");
+       HLTDebug("  Middle of dipole Z coordinate = %f cm", AliHLTMUONCalculations::Zf());
+       HLTDebug("        Magnetic field integral = %f T.m", AliHLTMUONCalculations::QBL());
+       
+       return 0;
+}
+
+
 int AliHLTMUONTriggerReconstructorComponent::ReadLutFromCDB()
 {
        /// Loads the lookup table containing channel and geometrical position
 int AliHLTMUONTriggerReconstructorComponent::ReadLutFromCDB()
 {
        /// Loads the lookup table containing channel and geometrical position
@@ -749,8 +1108,7 @@ int AliHLTMUONTriggerReconstructorComponent::ReadLutFromCDB()
 
 bool AliHLTMUONTriggerReconstructorComponent::GenerateLookupTable(
                AliHLTInt32_t ddl, const char* filename,
 
 bool AliHLTMUONTriggerReconstructorComponent::GenerateLookupTable(
                AliHLTInt32_t ddl, const char* filename,
-               const char* cdbPath, Int_t run
-               //TODO add option fCrateId
+               const char* cdbPath, Int_t run, bool useCrateId
        )
 {
        /// Generates a binary file containing the lookup table (LUT) from the
        )
 {
        /// Generates a binary file containing the lookup table (LUT) from the
@@ -760,6 +1118,8 @@ bool AliHLTMUONTriggerReconstructorComponent::GenerateLookupTable(
        /// @param filename  The name of the LUT file to generate.
        /// @param cdbPath  The CDB path to use.
        /// @param run  The run number to use for the CDB.
        /// @param filename  The name of the LUT file to generate.
        /// @param cdbPath  The CDB path to use.
        /// @param run  The run number to use for the CDB.
+       /// @param useCrateId  Indicates that the crate ID should be used rather
+       ///             than a sequencial number.
        /// @return  True if the generation of the LUT file succeeded.
        
        AliHLTMUONTriggerReconstructorComponent comp;
        /// @return  True if the generation of the LUT file succeeded.
        
        AliHLTMUONTriggerReconstructorComponent comp;
@@ -774,8 +1134,14 @@ bool AliHLTMUONTriggerReconstructorComponent::GenerateLookupTable(
        char runNum[32];
        sprintf(ddlNum, "%d", ddl+1);
        sprintf(runNum, "%d", run);
        char runNum[32];
        sprintf(ddlNum, "%d", ddl+1);
        sprintf(runNum, "%d", run);
-       const char* argv[7] = {"-ddl", ddlNum, "-cdbpath", cdbPath, "-run", runNum, NULL};
-       int result = comp.DoInit(6, argv);
+       int argc = 7;
+       const char* argv[8] = {"-ddl", ddlNum, "-cdbpath", cdbPath, "-run", runNum, "-dont_use_crateid", NULL};
+       if (useCrateId)
+       {
+               argv[6] = NULL;
+               argc--;
+       }
+       int result = comp.DoInit(argc, argv);
        if (result != 0)
        {
                // Error message already generated in DoInit.
        if (result != 0)
        {
                // Error message already generated in DoInit.
index 8f8365e66627acd30228b8d24bd13390d0945958..b1dc05877e1bb5cea94384b3a9d4d7a58b3549ba 100644 (file)
@@ -49,11 +49,13 @@ public:
         * @param filename  The name of the LUT file to generate.
         * @param cdbPath  The CDB path to use.
         * @param run  The run number to use for the CDB.
         * @param filename  The name of the LUT file to generate.
         * @param cdbPath  The CDB path to use.
         * @param run  The run number to use for the CDB.
+        * @param useCrateId  Indicates that the crate ID should be used rather
+        *             than a sequencial number (default is true).
         * @return  True if the generation of the LUT file succeeded.
         */
        static bool GenerateLookupTable(
                        AliHLTInt32_t ddl, const char* filename,
         * @return  True if the generation of the LUT file succeeded.
         */
        static bool GenerateLookupTable(
                        AliHLTInt32_t ddl, const char* filename,
-                       const char* cdbPath, Int_t run
+                       const char* cdbPath, Int_t run, bool useCrateId = true
                );
 
 protected:
                );
 
 protected:
@@ -63,6 +65,8 @@ protected:
        // capabilities of the component.
        
        virtual int DoInit(int argc, const char** argv);
        // capabilities of the component.
        
        virtual int DoInit(int argc, const char** argv);
+       virtual int Reconfigure(const char* cdbEntry, const char* componentId);
+       virtual int ReadPreprocessorValues(const char* modules);
        virtual int DoDeinit();
 
        virtual int DoEvent(
        virtual int DoDeinit();
 
        virtual int DoEvent(
@@ -87,11 +91,28 @@ private:
        int ReadLookUpTable(const char* lutpath);
        int ReadLutFromCDB();
        
        int ReadLookUpTable(const char* lutpath);
        int ReadLutFromCDB();
        
+       /**
+        * Reads this component's configuration parameters from the CDB.
+        * These include the middle of the dipole Z coordinate (zmiddle) and the
+        * integrated magnetic field of the dipole.
+        * \param setZmiddle Indicates if the zmiddle parameter should be set
+        *       (default true).
+        * \param setBL Indicates if the integrated magnetic field parameter should
+        *       be set (default true).
+        * \return 0 if no errors occured and negative error code compatible with
+        *       the HLT framework on errors.
+        */
+       int ReadConfigFromCDB(bool setZmiddle = true, bool setBL = true);
+       
        AliHLTMUONTriggerReconstructor* fTrigRec; ///< The trigger reconstructor class implementing the algorithm.
        AliHLTInt32_t fDDL;   ///< The DDL number in the range 20..21 from which to expect input. Set to -1 for invalid/unspecified value.
        bool fWarnForUnexpecedBlock;  ///< Flag indicating if we should log a warning if we got a block of an unexpected type.
        bool fStopOnOverflow;  ///< Flag indicating if we should fail in the DoEvent method if the output buffer was overflowed.
        bool fUseCrateId;  ///< Flag to indicate if the crate ID as found in the regional header structures should be used or not.
        AliHLTMUONTriggerReconstructor* fTrigRec; ///< The trigger reconstructor class implementing the algorithm.
        AliHLTInt32_t fDDL;   ///< The DDL number in the range 20..21 from which to expect input. Set to -1 for invalid/unspecified value.
        bool fWarnForUnexpecedBlock;  ///< Flag indicating if we should log a warning if we got a block of an unexpected type.
        bool fStopOnOverflow;  ///< Flag indicating if we should fail in the DoEvent method if the output buffer was overflowed.
        bool fUseCrateId;  ///< Flag to indicate if the crate ID as found in the regional header structures should be used or not.
+       bool fDelaySetup;  ///< Indicates if the component should delay loading and initialising from the CDB to the start of run event.
+       bool fZmiddleSpecified;  ///< Indicates if the zmiddle parameter was specified on the command line.
+       bool fBLSpecified;  ///< Indicates if the bfieldintegral parameter was specified on the command line.
+       bool fLutInitialised;  ///< Flag to indicate if the LUT was loaded yet or not.
 
        ClassDef(AliHLTMUONTriggerReconstructorComponent, 0) // Trigger reconstructor component for dHLT trigger DDL raw data.
 
 
        ClassDef(AliHLTMUONTriggerReconstructorComponent, 0) // Trigger reconstructor component for dHLT trigger DDL raw data.
 
index c9f2a83210e5f73a343a87ff63cb950326cc1fe0..f74aa9f8dd8bb8b0c8f97802804af1cf4703302d 100644 (file)
@@ -77,6 +77,19 @@ void CreateDefaultCDBEntries(const char* cdbPath = "local://$ALICE_ROOT")
        TMap* params = NULL;
        AliCDBId id;
        
        TMap* params = NULL;
        AliCDBId id;
        
+       // Create and store the configuration parameters for the trigger reconstructor.
+       params = new TMap;
+       params->SetOwner(kTRUE);
+       params->Add(new TObjString("zmiddle"), new TObjString("-975"));
+       params->Add(new TObjString("bfieldintegral"), new TObjString("3"));
+       
+       path = AliHLTMUONConstants::TriggerReconstructorCDBPath();
+       id = AliCDBId(path, firstRun, lastRun, verison);
+       metaData = new AliCDBMetaData();
+       metaData->SetResponsible("dimuon HLT");
+       metaData->SetComment("Trigger reconstructor configuration parameters for dimuon HLT.");
+       storage->Put(params, id, metaData);
+       
        // Create and store the configuration parameters for the hit reconstructor.
        params = new TMap;
        params->SetOwner(kTRUE);
        // Create and store the configuration parameters for the hit reconstructor.
        params = new TMap;
        params->SetOwner(kTRUE);
@@ -89,6 +102,33 @@ void CreateDefaultCDBEntries(const char* cdbPath = "local://$ALICE_ROOT")
        metaData->SetComment("Hit reconstructor DC cut parameter for dimuon HLT.");
        storage->Put(params, id, metaData);
        
        metaData->SetComment("Hit reconstructor DC cut parameter for dimuon HLT.");
        storage->Put(params, id, metaData);
        
+       // Create and store the configuration parameters for the Manso tracker.
+       params = new TMap;
+       params->SetOwner(kTRUE);
+       params->Add(new TObjString("zmiddle"), new TObjString("-975"));
+       params->Add(new TObjString("bfieldintegral"), new TObjString("3"));
+       params->Add(new TObjString("roi_paramA_chamber7"), new TObjString("0.016"));
+       params->Add(new TObjString("roi_paramB_chamber7"), new TObjString("2.0"));
+       params->Add(new TObjString("roi_paramA_chamber8"), new TObjString("0.016"));
+       params->Add(new TObjString("roi_paramB_chamber8"), new TObjString("2.0"));
+       params->Add(new TObjString("roi_paramA_chamber9"), new TObjString("0.02"));
+       params->Add(new TObjString("roi_paramB_chamber9"), new TObjString("3.0"));
+       params->Add(new TObjString("roi_paramA_chamber10"), new TObjString("0.02"));
+       params->Add(new TObjString("roi_paramB_chamber10"), new TObjString("3.0"));
+       params->Add(new TObjString("chamber7postion"), new TObjString("-1274.5"));
+       params->Add(new TObjString("chamber8postion"), new TObjString("-1305.5"));
+       params->Add(new TObjString("chamber9postion"), new TObjString("-1408.6"));
+       params->Add(new TObjString("chamber10postion"), new TObjString("-1439.6"));
+       params->Add(new TObjString("chamber11postion"), new TObjString("-1603.5"));
+       params->Add(new TObjString("chamber13postion"), new TObjString("-1703.5"));
+       
+       path = AliHLTMUONConstants::MansoTrackerFSMCDBPath();
+       id = AliCDBId(path, firstRun, lastRun, verison);
+       metaData = new AliCDBMetaData();
+       metaData->SetResponsible("dimuon HLT");
+       metaData->SetComment("Manso tracker FSM component configuration parameters for dimuon HLT.");
+       storage->Put(params, id, metaData);
+       
        // Create and store the configuration parameters for the trigger decision cuts.
        params = new TMap;
        params->SetOwner(kTRUE);
        // Create and store the configuration parameters for the trigger decision cuts.
        params = new TMap;
        params->SetOwner(kTRUE);
index 0fc437f49aa253048f2eb738294c9c3ecabc8d91..4c3e822d9c2bf4687464797edf68602e9bfa4c94 100644 (file)
  * \param CDBPath  This is the CDB path to use as the DB storage.
  *                 (Default = local://$ALICE_ROOT)
  * \param run  This is the run number to use for the CDB (Default = 0).
  * \param CDBPath  This is the CDB path to use as the DB storage.
  *                 (Default = local://$ALICE_ROOT)
  * \param run  This is the run number to use for the CDB (Default = 0).
+ * \param useCrateId  Indicates if the crate ID should be used for the lookup table
+ *            indexing rather than just a sequencial number (Default = true).
  */
  */
-void CreateTriggerRecoLookupTables(const char* CDBPath = "local://$ALICE_ROOT", Int_t run = 0)
+void CreateTriggerRecoLookupTables(
+               const char* CDBPath = "local://$ALICE_ROOT",
+               Int_t run = 0,
+               bool useCrateId = true
+       )
 {
        gSystem->Load("libAliHLTMUON.so");
 
 {
        gSystem->Load("libAliHLTMUON.so");
 
@@ -65,7 +71,7 @@ void CreateTriggerRecoLookupTables(const char* CDBPath = "local://$ALICE_ROOT",
                cout << "Generating LUT for DDL " << ddl+1
                        << " and writing output to file " << filename << endl;
                bool ok = AliHLTMUONTriggerReconstructorComponent::GenerateLookupTable(
                cout << "Generating LUT for DDL " << ddl+1
                        << " and writing output to file " << filename << endl;
                bool ok = AliHLTMUONTriggerReconstructorComponent::GenerateLookupTable(
-                               ddl, filename, CDBPath, run
+                               ddl, filename, CDBPath, run, useCrateId
                        );
                if (! ok) return;
        }
                        );
                if (! ok) return;
        }
diff --git a/HLT/MUON/macros/DumpClusterPointFile.C b/HLT/MUON/macros/DumpClusterPointFile.C
deleted file mode 100644 (file)
index 169f00c..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Author: Artur Szostak
-// Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
-//
-////////////////////////////////////////////////////////////////////////////////
-
-#include "../src/Cluster.hpp"
-
-
-// Formated printing of floating point numbers.
-void Print(float value)
-{
-       char buffer[1024];
-       char* str = &buffer[0];
-       sprintf(str, "%f", value);
-       int length = strlen(str);
-       if (str[0] == '-')
-       {
-               cout << str;
-               for (int i = length; i < 15; i++)
-                       cout << " ";
-       }
-       else
-       {
-               cout << " " << str;
-               for (int i = length+1; i < 15; i++)
-                       cout << " ";
-       };
-};
-
-
-// TODO: fix the endian encoding of the data format.
-
-/* Reads the contents of a file generated with MakeClusterPointFiles.C
-   and prints the contents to screen.
- */
-void DumpClusterPointFile(const char* filename)
-{
-       FILE* file = fopen(filename, "r");
-       if (file == NULL)
-       {
-               Error("DumpClusterPointFile", "Could not open file: %s", filename);
-               return;
-       };
-       
-       // Read the first 32 bits which is the size of the data structure in
-       // the file in 32bit words.
-       dHLT::UInt size;
-       fread(&size, sizeof(size), 1, file);
-       if (ferror(file))
-       {
-               Error("DumpClusterPointFile", "Could not read from file: %s", filename);
-               return;
-       };
-       cout << "Size of structure: " << size << " (4 byte) words." << endl;
-       
-       cout << " X              Y" << endl;
-       
-       // Go through all the records and dump them to screen.
-       UInt_t recordcount = size / (sizeof(dHLT::ClusterPoint) / 4);
-       for (UInt_t i = 0; i < recordcount; i++)
-       {
-               dHLT::ClusterPoint point;
-               fread(&point, sizeof(point), 1, file);
-               if (ferror(file))
-               {
-                       Error("DumpClusterPointFile", "Could not read from file: %s", filename);
-                       return;
-               };
-               
-               Print(point.x);
-               Print(point.y);
-               cout << endl;
-       };
-       
-       fclose(file);
-};
-
diff --git a/HLT/MUON/macros/DumpClusterSource.C b/HLT/MUON/macros/DumpClusterSource.C
deleted file mode 100644 (file)
index 61363e3..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Author: Artur Szostak
-// Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
-//
-////////////////////////////////////////////////////////////////////////////////
-
-/* Dumps the contents of the ClusterSource 'cs' to the screen.
- */
-void DumpClusterSource(AliMUONHLT::ClusterSource* cs)
-{
-       cout << "File  : " << cs->FileName() << endl;
-       cout << "Folder: " << cs->FolderName() << endl;
-       if (cs->GetFirstEvent())
-       {
-               do
-               {
-                       cout << "================= Event: " << cs->CurrentEvent() << " =================" << endl;
-                       if ( ! cs->GetFirstBlock() )
-                       {
-                               cout << "No blocks found." << endl;
-                               continue;
-                       };
-                       do
-                       {
-                               cout << "Block for chamber: " << cs->Chamber() << endl;
-                               if ( cs->GetFirstCluster() == NULL )
-                               {
-                                       cout << "\tNo cluster points found." << endl;
-                                       continue;
-                               };
-                               do
-                               {
-                                       Float_t x, y;
-                                       cs->FetchCluster(x, y);
-                                       cout << "\tx = " << x << ", y = " << y << endl;
-                               } while (cs->GetNextCluster());
-                       } while (cs->GetNextBlock());
-               } while (cs->GetNextEvent());
-       }
-       else
-       {
-               cout << "No events found." << endl;
-       };
-};
-
diff --git a/HLT/MUON/macros/DumpTrackSink.C b/HLT/MUON/macros/DumpTrackSink.C
deleted file mode 100644 (file)
index 157a445..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Author: Artur Szostak
-// Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
-//
-////////////////////////////////////////////////////////////////////////////////
-
-/* Dumps the contents of the TrackSink 'ts' to the screen.
- */
-void DumpTrackSink(AliMUONHLT::TrackSink* ts)
-{
-       cout << "File  : " << ts->FileName() << endl;
-       cout << "Folder: " << ts->FolderName() << endl;
-       if ( ! ts->GetFirstEvent() )
-       {
-               cout << "No events found." << endl;
-               return;
-       };
-       
-       while (ts->MoreEvents())
-       {
-               cout << "================= Event: " << ts->CurrentEvent() << " =================" << endl;
-               Int_t blocknum = 0;
-
-               if ( ! ts->GetFirstBlock() )
-               {
-                       cout << "No blocks found." << endl;
-                       ts->GetNextEvent();
-                       continue;
-               };
-
-               while (ts->MoreBlocks())
-               {
-                       cout << "Block: " << blocknum++ << endl;
-                       if ( ts->GetFirstTrack() == NULL )
-                       {
-                               cout << "\tNo tracks found." << endl;
-                               ts->GetNextBlock();
-                               continue;
-                       };
-                       
-                       while (ts->MoreTracks())
-                       {
-                               const AliMUONHLT::Track* data = ts->GetTrack();
-
-                               cout << "\tTrigger ID = " << data->TriggerID()
-                                       << ", Sign = " << data->ParticleSign()
-                                       << ", P = " << data->P()
-                                       << ", Pt = " << data->Pt()
-                                       << endl;
-                               cout << "\t\tX\tY\tLeft\tRight\tBottom\tTop" << endl;
-                               for (Int_t i = 0; i < 10; i++)
-                               {
-                                       cout << "\t\t" << data->Hit(i).fX
-                                               << "\t" << data->Hit(i).fY
-                                               << "\t" << data->RegionOfInterest(i).Left()
-                                               << "\t" << data->RegionOfInterest(i).Right()
-                                               << "\t" << data->RegionOfInterest(i).Bottom()
-                                               << "\t" << data->RegionOfInterest(i).Top()
-                                               << endl;
-                               };
-
-                               ts->GetNextTrack();
-                       };
-                       ts->GetNextBlock();
-               };
-               ts->GetNextEvent();
-       };
-};
-
diff --git a/HLT/MUON/macros/DumpTriggerRecordFile.C b/HLT/MUON/macros/DumpTriggerRecordFile.C
deleted file mode 100644 (file)
index 5180c07..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Author: Artur Szostak
-// Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
-//
-////////////////////////////////////////////////////////////////////////////////
-
-#include "../src/TriggerRecord.hpp"
-
-
-// Formated printing of floating point numbers.
-void Print(float value)
-{
-       char buffer[1024];
-       char* str = &buffer[0];
-       sprintf(str, "%f", value);
-       int length = strlen(str);
-       if (str[0] == '-')
-       {
-               cout << str;
-               for (int i = length; i < 15; i++)
-                       cout << " ";
-       }
-       else
-       {
-               cout << " " << str;
-               for (int i = length+1; i < 15; i++)
-                       cout << " ";
-       };
-};
-
-
-// TODO: fix the endian encoding of the data format.
-
-/* Reads the contents of a file generated with MakeTriggerRecordFiles.C
-   and prints the contents to screen.
- */
-void DumpTriggerRecordFile(const char* filename)
-{
-       FILE* file = fopen(filename, "r");
-       if (file == NULL)
-       {
-               Error("DumpTriggerRecordFile", "Could not open file: %s", filename);
-               return;
-       };
-       
-       // Read the first 32 bits which is the size of the data structure in
-       // the file in 32bit words.
-       dHLT::UInt size;
-       fread(&size, sizeof(size), 1, file);
-       if (ferror(file))
-       {
-               Error("DumpTriggerRecordFile", "Could not read from file: %s", filename);
-               return;
-       };
-       cout << "Size of structure: " << size << " (4 byte) words." << endl;
-       
-       // Read the Trigger ID offset.
-       dHLT::UInt triggerIDoffset;
-       fread(&triggerIDoffset, sizeof(triggerIDoffset), 1, file);
-       if (ferror(file))
-       {
-               Error("DumpTriggerRecordFile", "Could not read from file: %s", filename);
-               return;
-       };
-       cout << "Trigger ID offset: " << triggerIDoffset << endl;
-       
-       cout << "Sign\t Pt             MT1 X          MT1 Y          MT2 X          MT2 Y" << endl;
-       
-       // Go through all the records and dump them to screen.
-       UInt_t recordcount = (size - sizeof(dHLT::UInt)) / (sizeof(dHLT::TriggerRecord) / 4);
-       for (UInt_t i = 0; i < recordcount; i++)
-       {
-               dHLT::TriggerRecord record;
-               fread(&record, sizeof(record), 1, file);
-               if (ferror(file))
-               {
-                       Error("DumpTriggerRecordFile", "Could not read from file: %s", filename);
-                       return;
-               };
-               
-               cout << record.sign << "\t";
-               Print(record.pt);
-               Print(record.station1impact.x);
-               Print(record.station1impact.y);
-               Print(record.station2impact.x);
-               Print(record.station2impact.y);
-               cout << endl;
-       };
-       
-       fclose(file);
-};
-
diff --git a/HLT/MUON/macros/DumpTriggerSource.C b/HLT/MUON/macros/DumpTriggerSource.C
deleted file mode 100644 (file)
index 1911375..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Author: Artur Szostak
-// Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
-//
-////////////////////////////////////////////////////////////////////////////////
-
-/* Dumps the contents of the TriggerSource 'ts' to the screen.
- */
-void DumpTriggerSource(AliMUONHLT::TriggerSource* ts)
-{
-       cout << "File  : " << ts->FileName() << endl;
-       cout << "Folder: " << ts->FolderName() << endl;
-       if (ts->GetFirstEvent())
-       {
-               do
-               {
-                       cout << "================= Event: " << ts->CurrentEvent() << " =================" << endl;
-                       Int_t blocknum = 0;
-                       if ( ! ts->GetFirstBlock() )
-                       {
-                               cout << "No blocks found." << endl;
-                               continue;
-                       };
-                       do
-                       {
-                               cout << "Block: " << blocknum++ << endl;
-                               if ( ts->GetFirstTrigger() == NULL )
-                               {
-                                       cout << "\tNo trigger records found." << endl;
-                                       continue;
-                               };
-                               do
-                               {
-                                       AliMUONHLT::TriggerRecord* data = ts->GetTrigger();
-
-                                       cout << "\tTrigger number = " << data->TriggerNumber()
-                                               << ", Sign = " << data->ParticleSign()
-                                               << ", Pt = " << data->Pt()
-                                               << ", ST1 x = " << data->Station1Point().fX
-                                               << ", ST1 y = " << data->Station1Point().fY
-                                               << ", ST2 x = " << data->Station2Point().fX
-                                               << ", ST2 y = " << data->Station2Point().fY
-                                               << endl;
-                               } while (ts->GetNextTrigger());
-                       } while (ts->GetNextBlock());
-               } while (ts->GetNextEvent());
-       }
-       else
-       {
-               cout << "No events found." << endl;
-       };
-};
-