Fixed bug in treatment of run number in AliHLTMUONHitReconstructor.
Adding functionality to AliHLTMUONHitReconstructor for loading of DC cut parameter form CDB or command line. Also added a delaysetup option to delay loading of CDB entries to the Start-of-Run event.
#include "AliHLTMUONProcessor.h"
#include "AliCDBManager.h"
#include "AliCDBStorage.h"
+#include "AliCDBEntry.h"
#include "AliMpCDB.h"
#include "AliMpDDLStore.h"
#include "AliMpDEStore.h"
+#include "TMap.h"
+#include "TObjString.h"
+#include "TString.h"
ClassImp(AliHLTMUONProcessor)
-int AliHLTMUONProcessor::FetchMappingStores(
+int AliHLTMUONProcessor::SetCDBPathAndRunNo(
const char* cdbPath, Int_t run, bool useDefault
) const
{
- /// Fetches the DDL and detector element store objects for MUON mapping.
+ /// Sets the CDB path and run number to read from.
/// \param cdbPath The CDB path to use. If set to NULL and the path has
/// not been set in the CDB manager then the default path
/// "local://$ALICE_ROOT" is used if the 'useDefault' flag is also true.
/// \param run The run number to use. If set to -1 and the run number has
/// not been set in the CDB manager then a value of zero is used if
/// the 'useDefault' flag is also true.
- /// \param useDefault If set to true then a default CDB path and run number
+ /// \param useDefault If set to true then a default CDB path and/or run number
/// is used if they have not been set and 'cdbPath' == NULL or
- /// 'run' == NULL.
- /// \return Zero if the object could be loaded. Otherwise an error code is
- /// returned, which is compatible with the HLT framework.
- /// \note AliMpDDLStore::Instance() and AliMpDEStore::Instance() must be used
- /// to fetch the objects after this method returns a code equal to zero.
-
- Bool_t warn = kFALSE;
-
- // Check if the objects are already loaded. If they are then exit early,
- // otherwise we need to try load the objects.
- if (AliMpDDLStore::Instance(warn) != NULL and AliMpDEStore::Instance(warn) != NULL)
- return 0;
+ /// 'run' == -1.
+ /// \return Zero if the object could be loaded. Otherwise an error code,
+ /// compatible with the HLT framework, is returned.
const char* defaultPath = "local://$ALICE_ROOT";
Int_t defaultRun = 0;
}
// Setup the CDB path.
- const char* cdbPathUsed = "unknown (not set)";
if (cdbPath != NULL)
{
cdbManager->SetDefaultStorage(cdbPath);
- cdbPathUsed = cdbPath;
}
- else
+ else if (not cdbManager->IsDefaultStorageSet() and useDefault)
{
- AliCDBStorage* store = cdbManager->GetDefaultStorage();
- if (store == NULL)
- {
- if (useDefault)
- {
- cdbManager->SetDefaultStorage(defaultPath);
- cdbPathUsed = defaultPath;
- }
- }
- else
- {
- cdbPathUsed = store->GetURI().Data();
- }
+ cdbManager->SetDefaultStorage(defaultPath);
}
// Now setup the run number.
{
if (useDefault) cdbManager->SetRun(defaultRun);
}
+
+ return 0;
+}
+
+
+int AliHLTMUONProcessor::FetchMappingStores() const
+{
+ /// Fetches the DDL and detector element store objects for MUON mapping.
+ /// \return Zero if the objects could be loaded. Otherwise an error code,
+ /// which is compatible with the HLT framework, is returned.
+ /// \note AliMpDDLStore::Instance() and AliMpDEStore::Instance() must be used
+ /// to fetch the objects after this method returns a code equal to zero.
+
+ Bool_t warn = kFALSE;
+
+ // Check if the objects are already loaded. If they are then exit early,
+ // otherwise we need to try load the objects.
+ if (AliMpDDLStore::Instance(warn) != NULL and AliMpDEStore::Instance(warn) != NULL)
+ return 0;
+
+ AliCDBManager* cdbManager = AliCDBManager::Instance();
+ if (cdbManager == NULL)
+ {
+ HLTError("CDB manager instance does not exist.");
+ return -EIO;
+ }
+
+ const char* cdbPathUsed = "unknown (not set)";
+ AliCDBStorage* store = cdbManager->GetDefaultStorage();
+ if (store != NULL) cdbPathUsed = store->GetURI().Data();
+
Int_t runUsed = cdbManager->GetRun();
// Now we can try load the DDL and DE store objects.
return 0;
}
+
+int AliHLTMUONProcessor::FetchTMapFromCDB(const char* pathToEntry, TMap*& map) const
+{
+ /// Fetches a TMap object from the CDB.
+ /// [in] \param pathToEntry The relative path to the entry in the CDB to fetch.
+ /// [out] \param map This will be filled with the TMap object found if
+ /// a successful status code is returned. Otherwise it will be unchanged.
+ /// \return Zero if the object could be found. Otherwise an error code,
+ /// which is compatible with the HLT framework, is returned.
+
+ assert(AliCDBManager::Instance() != NULL);
+
+ AliCDBEntry* entry = AliCDBManager::Instance()->Get(pathToEntry);
+ if (entry == NULL)
+ {
+ HLTError("Could not get the CDB entry for \"%s\".", pathToEntry);
+ return -EIO;
+ }
+
+ TObject* obj = entry->GetObject();
+ if (obj == NULL)
+ {
+ HLTError("Configuration object for \"%s\" is missing.", pathToEntry);
+ return -ENOENT;
+ }
+
+ if (obj->IsA() != TMap::Class())
+ {
+ HLTError("Wrong type for configuration object in \"%s\". Found a %s but we need a TMap.",
+ pathToEntry, obj->ClassName()
+ );
+ return -EPROTO;
+ }
+ map = dynamic_cast<TMap*>(obj);
+
+ return 0;
+}
+
+
+int AliHLTMUONProcessor::GetValueFromTMap(
+ TMap* map, const char* paramName, TString& value,
+ const char* pathToEntry, const char* prettyName
+ ) const
+{
+ /// Tries to find the string value associated with a certain parameter in a TMap.
+ /// [in] \param map The TMap object to search in.
+ /// [in] \param paramName The name of the parameter to search for.
+ /// [out] \param value Will be filled with the object found.
+ /// [in] \param pathToEntry The relative path to the entry in the CDB.
+ /// Used when printing error messages. If set to NULL then a string of
+ /// "(unknown)" is used. (default is NULL).
+ /// [in] \param prettyName Should be the name of the parameter which will
+ /// be used when printing error messages. If this is set to NULL then
+ /// the paramName will be used instead (default is NULL).
+ /// \return Zero if the object could be found. Otherwise an error code,
+ /// which is compatible with the HLT framework, is returned.
+
+ if (pathToEntry == NULL) pathToEntry = "(unknown)";
+ if (prettyName == NULL) prettyName = paramName;
+
+ TPair* pair = static_cast<TPair*>(map->FindObject(paramName));
+ if (pair == NULL)
+ {
+ HLTError("Configuration object for \"%s\" does not contain the %s value.",
+ pathToEntry, prettyName
+ );
+ return -ENOENT;
+ }
+ TObject* valueObj = pair->Value();
+ if (valueObj->IsA() != TObjString::Class())
+ {
+ HLTError("The %s parameter found in configuration object \"%s\""
+ " is not a TObjString. Found an object of type %s instead.",
+ prettyName, pathToEntry, valueObj->ClassName()
+ );
+ return -EPROTO;
+ }
+ value = dynamic_cast<TObjString*>(valueObj)->GetString();
+
+ return 0;
+}
+
+
+int AliHLTMUONProcessor::GetIntFromTMap(
+ TMap* map, const char* paramName, Int_t& value,
+ const char* pathToEntry, const char* prettyName
+ ) const
+{
+ /// Tries to find a certain parameter in the TMap object and convert it to
+ /// an integer value.
+ /// [in] \param map The TMap object to search in.
+ /// [in] \param paramName The name of the parameter to search for.
+ /// [out] \param value Will be filled with the integer value for the parameter,
+ /// if it was found and it was an integer value.
+ /// [in] \param pathToEntry The relative path to the entry in the CDB.
+ /// Used when printing error messages. If set to NULL then a string of
+ /// "(unknown)" is used. (default is NULL).
+ /// [in] \param prettyName Should be the name of the parameter which will
+ /// be used when printing error messages. If this is set to NULL then
+ /// the paramName will be used instead (default is NULL).
+ /// \return Zero if the object could be found and is valid. Otherwise an
+ /// error code, which is compatible with the HLT framework, is returned.
+
+ if (pathToEntry == NULL) pathToEntry = "(unknown)";
+ if (prettyName == NULL) prettyName = paramName;
+
+ TString valueStr;
+ int result = GetValueFromTMap(map, paramName, valueStr, prettyName);
+ if (result != 0) return result;
+
+ if (not valueStr.IsDigit())
+ {
+ HLTError("The %s parameter found in configuration object \"%s\""
+ "is not a valid integer number string; found \"%s\".",
+ prettyName, pathToEntry, valueStr.Data()
+ );
+ return -EPROTO;
+ }
+ value = valueStr.Atoi();
+
+ return 0;
+}
+
+
+int AliHLTMUONProcessor::GetPositiveIntFromTMap(
+ TMap* map, const char* paramName, Int_t& value,
+ const char* pathToEntry, const char* prettyName
+ ) const
+{
+ /// Tries to find a certain parameter in the TMap object and convert it to
+ /// a positive integer value.
+ /// [in] \param map The TMap object to search in.
+ /// [in] \param paramName The name of the parameter to search for.
+ /// [out] \param value Will be filled with the integer value for the parameter,
+ /// if it was found and it was a positive integer value.
+ /// [in] \param pathToEntry The relative path to the entry in the CDB.
+ /// Used when printing error messages. If set to NULL then a string of
+ /// "(unknown)" is used. (default is NULL).
+ /// [in] \param prettyName Should be the name of the parameter which will
+ /// be used when printing error messages. If this is set to NULL then
+ /// the paramName will be used instead (default is NULL).
+ /// \return Zero if the object could be found and is valid. Otherwise an
+ /// error code, which is compatible with the HLT framework, is returned.
+
+ if (pathToEntry == NULL) pathToEntry = "(unknown)";
+ if (prettyName == NULL) prettyName = paramName;
+
+ TString valueStr;
+ int result = GetValueFromTMap(map, paramName, valueStr, prettyName);
+ if (result != 0) return result;
+
+ if (not valueStr.IsDigit())
+ {
+ HLTError("The %s parameter found in configuration object \"%s\""
+ "is not a valid integer number string; found \"%s\".",
+ prettyName, pathToEntry, valueStr.Data()
+ );
+ return -EPROTO;
+ }
+ Int_t val = valueStr.Atoi();
+ if (val < 0)
+ {
+ HLTError("The %s parameter found in configuration object \"%s\""
+ "is not a positive integer number; found \"%d\".",
+ prettyName, pathToEntry, val
+ );
+ return -EPROTO;
+ }
+ value = val;
+
+ return 0;
+}
+
+
+int AliHLTMUONProcessor::GetFloatFromTMap(
+ TMap* map, const char* paramName, Double_t& value,
+ const char* pathToEntry, const char* prettyName
+ ) const
+{
+ /// Tries to find a certain parameter in the TMap object and convert it to
+ /// an floating point value.
+ /// [in] \param map The TMap object to search in.
+ /// [in] \param paramName The name of the parameter to search for.
+ /// [out] \param value Will be filled with the floating point value for the
+ /// parameter, if it was found and it was a floating point value.
+ /// [in] \param pathToEntry The relative path to the entry in the CDB.
+ /// Used when printing error messages. If set to NULL then a string of
+ /// "(unknown)" is used. (default is NULL).
+ /// [in] \param prettyName Should be the name of the parameter which will
+ /// be used when printing error messages. If this is set to NULL then
+ /// the paramName will be used instead (default is NULL).
+ /// \return Zero if the object could be found and is valid. Otherwise an
+ /// error code, which is compatible with the HLT framework, is returned.
+
+ if (pathToEntry == NULL) pathToEntry = "(unknown)";
+ if (prettyName == NULL) prettyName = paramName;
+
+ TString valueStr;
+ int result = GetValueFromTMap(map, paramName, valueStr, prettyName);
+ if (result != 0) return result;
+
+ if (not valueStr.IsFloat())
+ {
+ HLTError("The %s parameter found in configuration object \"%s\""
+ "is not a valid floating point number string; found \"%s\".",
+ prettyName, pathToEntry, valueStr.Data()
+ );
+ return -EPROTO;
+ }
+ value = valueStr.Atof();
+
+ return 0;
+}
+
+
+int AliHLTMUONProcessor::GetPositiveFloatFromTMap(
+ TMap* map, const char* paramName, Double_t& value,
+ const char* pathToEntry, const char* prettyName
+ ) const
+{
+ /// Tries to find a certain parameter in the TMap object and convert it to
+ /// an positive floating point value.
+ /// [in] \param map The TMap object to search in.
+ /// [in] \param paramName The name of the parameter to search for.
+ /// [out] \param value Will be filled with the floating point value for the
+ /// parameter, if it was found and it was a positive floating point value.
+ /// [in] \param pathToEntry The relative path to the entry in the CDB.
+ /// Used when printing error messages. If set to NULL then a string of
+ /// "(unknown)" is used. (default is NULL).
+ /// [in] \param prettyName Should be the name of the parameter which will
+ /// be used when printing error messages. If this is set to NULL then
+ /// the paramName will be used instead (default is NULL).
+ /// \return Zero if the object could be found and is valid. Otherwise an
+ /// error code, which is compatible with the HLT framework, is returned.
+
+ if (pathToEntry == NULL) pathToEntry = "(unknown)";
+ if (prettyName == NULL) prettyName = paramName;
+
+ TString valueStr;
+ int result = GetValueFromTMap(map, paramName, valueStr, prettyName);
+ if (result != 0) return result;
+
+ if (not valueStr.IsFloat())
+ {
+ HLTError("The %s parameter found in configuration object \"%s\""
+ "is not a valid floating point number string; found \"%s\".",
+ prettyName, pathToEntry, valueStr.Data()
+ );
+ return -EPROTO;
+ }
+ Double_t val = valueStr.Atof();
+ if (val < 0)
+ {
+ HLTError("The %s parameter found in configuration object \"%s\""
+ "is not a positive floating point number; found \"%d\".",
+ prettyName, pathToEntry, val
+ );
+ return -EPROTO;
+ }
+ value = val;
+
+ return 0;
+}
#include "AliHLTMUONDataBlockReader.h"
#include "AliHLTMUONUtils.h"
+class TMap;
+
/**
* @class AliHLTMUONProcessor
* This component class is an abstract base class for dHLT components.
}
/**
- * Fetches the DDL and detector element store objects for MUON mapping.
+ * Sets the CDB path and run number to read from.
* \param cdbPath The CDB path to use. If set to NULL and the path has
* not been set in the CDB manager then the default path
* "local://$ALICE_ROOT" is used if the 'useDefault' flag is also true.
* \param run The run number to use. If set to -1 and the run number has
* not been set in the CDB manager then a value of zero is used if
* the 'useDefault' flag is also true.
- * \param useDefault If set to true then a default CDB path and run number
+ * \param useDefault If set to true then a default CDB path and/or run number
* is used if they have not been set and 'cdbPath' == NULL or
- * 'run' == NULL.
- * \return Zero if the object could be loaded. Otherwise an error code is
- * returned, which is compatible with the HLT framework.
+ * 'run' == -1. (false by default).
+ * \return Zero if the object could be loaded. Otherwise an error code,
+ * compatible with the HLT framework, is returned.
+ */
+ int SetCDBPathAndRunNo(
+ const char* cdbPath, Int_t run, bool useDefault = false
+ ) const;
+
+ /**
+ * Fetches the DDL and detector element store objects for MUON mapping.
+ * \return Zero if the objects could be loaded. Otherwise an error code,
+ * which is compatible with the HLT framework, is returned.
* \note AliMpDDLStore::Instance() and AliMpDEStore::Instance() must be used
* to fetch the objects after this method returns a code equal to zero.
*/
- int FetchMappingStores(
- const char* cdbPath = NULL, Int_t run = -1,
- bool useDefault = true
+ int FetchMappingStores() const;
+
+ /**
+ * Fetches a TMap object from the CDB.
+ * [in] \param pathToEntry The relative path to the entry in the CDB to fetch.
+ * [out] \param map This will be filled with the TMap object found if
+ * a successful status code is returned. Otherwise it will be unchanged.
+ * \return Zero if the object could be found. Otherwise an error code,
+ * which is compatible with the HLT framework, is returned.
+ */
+ int FetchTMapFromCDB(const char* pathToEntry, TMap*& map) const;
+
+ /**
+ * Tries to find the string value associated with a certain parameter in a TMap.
+ * [in] \param map The TMap object to search in.
+ * [in] \param paramName The name of the parameter to search for.
+ * [out] \param value Will be filled with the object found.
+ * [in] \param prettyName Should be the name of the parameter which will
+ * be used when printing error messages. If this is set to NULL then
+ * the paramName will be used instead (default is NULL).
+ * \return Zero if the object could be found. Otherwise an error code,
+ * which is compatible with the HLT framework, is returned.
+ */
+ int GetValueFromTMap(
+ TMap* map, const char* paramName, TString& value,
+ const char* pathToEntry = NULL, const char* prettyName = NULL
+ ) const;
+
+ /**
+ * Tries to find a certain parameter in the TMap object and convert it to
+ * an integer value.
+ * [in] \param map The TMap object to search in.
+ * [in] \param paramName The name of the parameter to search for.
+ * [out] \param value Will be filled with the integer value for the parameter,
+ * if it was found and it was an integer value.
+ * [in] \param prettyName Should be the name of the parameter which will
+ * be used when printing error messages. If this is set to NULL then
+ * the paramName will be used instead (default is NULL).
+ * \return Zero if the object could be found and is valid. Otherwise an
+ * error code, which is compatible with the HLT framework, is returned.
+ */
+ int GetIntFromTMap(
+ TMap* map, const char* paramName, Int_t& value,
+ const char* pathToEntry = NULL, const char* prettyName = NULL
+ ) const;
+
+ /**
+ * Tries to find a certain parameter in the TMap object and convert it to
+ * a positive integer value.
+ * [in] \param map The TMap object to search in.
+ * [in] \param paramName The name of the parameter to search for.
+ * [out] \param value Will be filled with the integer value for the parameter,
+ * if it was found and it was a positive integer value.
+ * [in] \param prettyName Should be the name of the parameter which will
+ * be used when printing error messages. If this is set to NULL then
+ * the paramName will be used instead (default is NULL).
+ * \return Zero if the object could be found and is valid. Otherwise an
+ * error code, which is compatible with the HLT framework, is returned.
+ */
+ int GetPositiveIntFromTMap(
+ TMap* map, const char* paramName, Int_t& value,
+ const char* pathToEntry = NULL, const char* prettyName = NULL
+ ) const;
+
+ /**
+ * Tries to find a certain parameter in the TMap object and convert it to
+ * an floating point value.
+ * [in] \param map The TMap object to search in.
+ * [in] \param paramName The name of the parameter to search for.
+ * [out] \param value Will be filled with the floating point value for the
+ * parameter, if it was found and it was a floating point value.
+ * [in] \param prettyName Should be the name of the parameter which will
+ * be used when printing error messages. If this is set to NULL then
+ * the paramName will be used instead (default is NULL).
+ * \return Zero if the object could be found and is valid. Otherwise an
+ * error code, which is compatible with the HLT framework, is returned.
+ */
+ int GetFloatFromTMap(
+ TMap* map, const char* paramName, Double_t& value,
+ const char* pathToEntry = NULL, const char* prettyName = NULL
+ ) const;
+
+ /**
+ * Tries to find a certain parameter in the TMap object and convert it to
+ * an positive floating point value.
+ * [in] \param map The TMap object to search in.
+ * [in] \param paramName The name of the parameter to search for.
+ * [out] \param value Will be filled with the floating point value for the
+ * parameter, if it was found and it was a positive floating point value.
+ * [in] \param prettyName Should be the name of the parameter which will
+ * be used when printing error messages. If this is set to NULL then
+ * the paramName will be used instead (default is NULL).
+ * \return Zero if the object could be found and is valid. Otherwise an
+ * error code, which is compatible with the HLT framework, is returned.
+ */
+ int GetPositiveFloatFromTMap(
+ TMap* map, const char* paramName, Double_t& value,
+ const char* pathToEntry = NULL, const char* prettyName = NULL
) const;
private:
{
if (strcmp( argv[i], "-lowptcut" ) == 0)
{
+ if (lowPtCutSet)
+ {
+ HLTWarning("Low pT cut parameter was already specified."
+ " Will replace previous value given by -lowptcut."
+ );
+ }
+
if (argc <= i+1)
{
HLTError("The value for the low pT cut was not specified.");
if (strcmp( argv[i], "-highptcut" ) == 0)
{
+ if (lowPtCutSet)
+ {
+ HLTWarning("High pT cut parameter was already specified."
+ " Will replace previous value given by -highptcut."
+ );
+ }
+
if (argc <= i+1)
{
HLTError("The value for the high pT cut was not specified.");
if (strcmp( argv[i], "-lowmasscut" ) == 0)
{
+ if (lowPtCutSet)
+ {
+ HLTWarning("Low invariant mass cut parameter was already specified."
+ " Will replace previous value given by -lowmasscut."
+ );
+ }
+
if (argc <= i+1)
{
HLTError("The value for the low invariant mass cut was not specified.");
if (strcmp( argv[i], "-highmasscut" ) == 0)
{
+ if (lowPtCutSet)
+ {
+ HLTWarning("High invariant mass cut parameter was already specified."
+ " Will replace previous value given by -highmasscut."
+ );
+ }
+
if (argc <= i+1)
{
HLTError("The value for the high invariant mass cut was not specified.");
)
{
/// Reads the cut parameters from the CDB.
+ /// \param path Indicates the partial (or relative) path to the CDB entry.
assert(AliCDBManager::Instance() != NULL);
if (path != NULL)
pathToEntry = path;
- AliCDBEntry* entry = AliCDBManager::Instance()->Get(pathToEntry);
- if (entry == NULL)
- {
- HLTError("Could not get the CDB entry for \"%s\".", pathToEntry);
- return -EIO;
- }
-
- TObject* obj = entry->GetObject();
- if (obj == NULL)
- {
- HLTError("Configuration object for \"%s\" is missing.", pathToEntry);
- return -ENOENT;
- }
-
- if (obj->IsA() != TMap::Class())
- {
- HLTError("Wrong type for configuration object in \"%s\". Found a %s but we need a TMap.",
- pathToEntry, obj->ClassName()
- );
- return -EPROTO;
- }
- TMap* map = dynamic_cast<TMap*>(obj);
+ TMap* map = NULL;
+ int result = FetchTMapFromCDB(pathToEntry, map);
+ if (result != 0) return result;
if (setLowPtCut)
{
- TPair* pair = static_cast<TPair*>(map->FindObject("lowptcut"));
- if (pair == NULL)
- {
- HLTError("Configuration object for \"%s\" does not contain the low pT cut value.",
- pathToEntry
- );
- return -ENOENT;
- }
- TObject* valueObj = pair->Value();
- if (valueObj->IsA() != TObjString::Class())
- {
- HLTError("The low pT cut parameter found in configuration object \"%s\""
- " is not a TObjString. Found an object of type %s instead.",
- pathToEntry, valueObj->ClassName()
- );
- return -EPROTO;
- }
- TString value = dynamic_cast<TObjString*>(valueObj)->GetString();
- if (not value.IsFloat())
- {
- HLTError("The low pT cut parameter found in configuration object \"%s\""
- "is not a floating point string; found \"%s\".",
- pathToEntry, value.Data()
- );
- return -EPROTO;
- }
- fLowPtCut = (AliHLTFloat32_t) value.Atof();
+ Double_t value = 0;
+ result = GetFloatFromTMap(map, "lowptcut", value, pathToEntry, "low pT cut");
+ if (result != 0) return result;
+ fLowPtCut = (AliHLTFloat32_t) value;
}
if (setHighPtCut)
{
- TPair* pair = static_cast<TPair*>(map->FindObject("highptcut"));
- if (pair == NULL)
- {
- HLTError("Configuration object for \"%s\" does not contain the high pT cut value.",
- pathToEntry
- );
- return -ENOENT;
- }
- TObject* valueObj = pair->Value();
- if (valueObj->IsA() != TObjString::Class())
- {
- HLTError("The high pT cut parameter found in configuration object \"%s\""
- " is not a TObjString. Found an object of type %s instead.",
- pathToEntry, valueObj->ClassName()
- );
- return -EPROTO;
- }
- TString value = dynamic_cast<TObjString*>(valueObj)->GetString();
- if (not value.IsFloat())
- {
- HLTError("The high pT cut parameter found in configuration object \"%s\""
- "is not a floating point string; found \"%s\".",
- pathToEntry, value.Data()
- );
- return -EPROTO;
- }
- fHighPtCut = (AliHLTFloat32_t) value.Atof();
+ Double_t value = 0;
+ result = GetFloatFromTMap(map, "highptcut", value, pathToEntry, "high pT cut");
+ if (result != 0) return result;
+ fHighPtCut = (AliHLTFloat32_t) value;
}
if (setLowMassCut)
{
- TPair* pair = static_cast<TPair*>(map->FindObject("lowmasscut"));
- if (pair == NULL)
- {
- HLTError("Configuration object for \"%s\" does not contain the low invariant mass cut value.",
- pathToEntry
- );
- return -ENOENT;
- }
- TObject* valueObj = pair->Value();
- if (valueObj->IsA() != TObjString::Class())
- {
- HLTError("The low invariant mass cut parameter found in configuration object \"%s\""
- " is not a TObjString. Found an object of type %s instead.",
- pathToEntry, valueObj->ClassName()
- );
- return -EPROTO;
- }
- TString value = dynamic_cast<TObjString*>(valueObj)->GetString();
- if (not value.IsFloat())
- {
- HLTError("The low invariant mass cut parameter found in configuration object \"%s\""
- "is not a floating point string; found \"%s\".",
- pathToEntry, value.Data()
- );
- return -EPROTO;
- }
- fLowMassCut = (AliHLTFloat32_t) value.Atof();
+ Double_t value = 0;
+ result = GetFloatFromTMap(map, "lowmasscut", value, pathToEntry, "low invariant mass cut");
+ if (result != 0) return result;
+ fLowMassCut = (AliHLTFloat32_t) value;
}
if (setHighMassCut)
{
- TPair* pair = static_cast<TPair*>(map->FindObject("highmasscut"));
- if (pair == NULL)
- {
- HLTError("Configuration object for \"%s\" does not contain the high invariant mass cut value.",
- pathToEntry
- );
- return -ENOENT;
- }
- TObject* valueObj = pair->Value();
- if (valueObj->IsA() != TObjString::Class())
- {
- HLTError("The high invariant mass cut parameter found in configuration object \"%s\""
- " is not a TObjString. Found an object of type %s instead.",
- pathToEntry, valueObj->ClassName()
- );
- return -EPROTO;
- }
- TString value = dynamic_cast<TObjString*>(valueObj)->GetString();
- if (not value.IsFloat())
- {
- HLTError("The high invariant mass cut parameter found in configuration object \"%s\""
- "is not a floating point string; found \"%s\".",
- pathToEntry, value.Data()
- );
- return -EPROTO;
- }
- fHighMassCut = (AliHLTFloat32_t) value.Atof();
+ Double_t value = 0;
+ result = GetFloatFromTMap(map, "highmasscut", value, pathToEntry, "high invariant mass cut");
+ if (result != 0) return result;
+ fHighMassCut = (AliHLTFloat32_t) value;
}
return 0;
fkBlockHeaderSize(8),
fkDspHeaderSize(8),
fkBuspatchHeaderSize(4),
- fDCCut(0),
+ fDCCut(-1),
fPadData(NULL),
fLookUpTableData(NULL),
fRecPoints(NULL),
AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::AliHLTMUONRawDecoder() :
fBufferStart(NULL),
fBusPatchId(0),
- fDCCut(0),
+ fDCCut(-1),
fPadData(NULL),
fLookUpTableData(NULL),
fNofFiredDetElem(NULL),
);
void SetDCCut(AliHLTInt32_t dcCut) { fDCCut = dcCut; }
+ AliHLTInt32_t GetDCCut() const { return fDCCut; }
bool Run(
const AliHLTUInt32_t* rawData,
/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project *
+ * This file is property of and copyright by the ALICE HLT Project *
* All rights reserved. *
* *
* Primary Authors: *
* Indranil Das <indra.das@saha.ac.in> *
+ * Artur Szostak <artursz@iafrica.com> *
* *
* Permission to use, copy, modify and distribute this software and its *
* documentation strictly for non-commercial purposes is hereby granted *
* without fee, provided that the above copyright notice appears in all *
* copies and that both the copyright notice and this permission notice *
* appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
+ * about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
/* $Id$ */
///
+/// @file AliHLTMUONHitReconstructorComponent.cxx
+/// @author Indranil Das <indra.das@saha.ac.in> | <indra.ehep@gmail.com>, Artur Szostak <artursz@iafrica.com>
+/// @date 28 May 2007
+/// @brief Implementation of the hit Reconstruction processing component.
///
/// The HitRec Component is designed to deal the rawdata inputfiles to findout the
/// the reconstructed hits. The output is send to the output block for further
#include <cassert>
#include <fstream>
-//STEER
+#include "TMap.h"
+
+//STEER
#include "AliCDBManager.h"
-#include "AliCDBStorage.h"
#include "AliGeomManager.h"
//MUON
fLutSize(0),
fLut(NULL),
fIdToEntry(),
- fWarnForUnexpecedBlock(false)
+ fWarnForUnexpecedBlock(false),
+ fDelaySetup(false)
{
///
/// Default constructor.
fDDL = -1;
fIdToEntry.clear();
fWarnForUnexpecedBlock = false;
+ fDelaySetup = false;
const char* lutFileName = NULL;
const char* cdbPath = NULL;
Int_t run = -1;
bool useCDB = false;
bool tryRecover = false;
+ AliHLTInt32_t dccut = -1;
for (int i = 0; i < argc; i++)
{
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("The DDL number was not specified. Must be in the range [13..20].");
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 [2572..2579]" );
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)
{
HLTError("The lookup table filename was not specified.");
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 (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." );
+ 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')
+ run = Int_t( strtol(argv[i+1], &cpErr, 0) );
+ if (cpErr == NULL or *cpErr != '\0' or run < 0)
{
HLTError("Cannot convert '%s' to a valid run number."
- " Expected an integer value.", argv[i+1]
+ " Expected a positive integer value.", argv[i+1]
);
FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
i++;
continue;
} // -run argument
+
+ if (strcmp( argv[i], "-dccut" ) == 0)
+ {
+ if (dccut != -1)
+ {
+ HLTWarning("DC cut parameter was already specified."
+ " Will replace previous value given by -dccut."
+ );
+ }
+
+ if ( argc <= i+1 )
+ {
+ HLTError("No DC cut value was specified. It should be a positive integer value." );
+ FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+ return -EINVAL;
+ }
+
+ char* cpErr = NULL;
+ dccut = AliHLTInt32_t( strtol(argv[i+1], &cpErr, 0) );
+ if (cpErr == NULL or *cpErr != '\0' or dccut < 0)
+ {
+ HLTError("Cannot convert '%s' to a valid DC cut value."
+ " 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], "-delaysetup" ) == 0)
+ {
+ fDelaySetup = true;
+ continue;
+ }
if (strcmp( argv[i], "-warn_on_unexpected_block" ) == 0)
{
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.");
}
- int result = 0;
+ 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;
+ }
+ }
+
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 = ReadCDB(cdbPath, run);
+ 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.
+ FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+ return result;
+ }
+ fHitRec->SetLookUpTable(fLut, &fIdToEntry);
+ }
}
else
{
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.
+ FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+ return result;
+ }
+ fHitRec->SetLookUpTable(fLut, &fIdToEntry);
}
- if (result != 0)
+
+ if (dccut == -1)
{
- // Error messages already generated in ReadCDB or ReadLookUpTable.
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
- return result;
+ if (not fDelaySetup)
+ {
+ HLTInfo("Loading DC cut parameters from CDB for DDL %d (ID = %d).",
+ fDDL+1, AliHLTMUONUtils::DDLNumberToEquipId(fDDL)
+ );
+ int result = ReadDCCutFromCDB();
+ if (result != 0)
+ {
+ // Error messages already generated in ReadDCCutFromCDB.
+ FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
+ return result;
+ }
+ 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->SetLookUpTable(fLut, &fIdToEntry);
fHitRec->TryRecover(tryRecover);
return 0;
}
+int AliHLTMUONHitReconstructorComponent::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/' 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.
+
+ if (strcmp(componentId, GetComponentID()) == 0)
+ {
+ HLTInfo("Reading new configuration entries from CDB.");
+
+ int result = 0;
+ bool startsWithMUON = TString(cdbEntry).Index("MUON/", 5, 0, TString::kExact) == 0;
+ if (cdbEntry == NULL or startsWithMUON)
+ {
+ // 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;
+ }
+
+ 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());
+ }
+ }
+
+ return 0;
+}
+
+
+int AliHLTMUONHitReconstructorComponent::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::HitReconstructorCDBPath(), GetComponentID());
+ }
+ if (mods.Contains("MUON"))
+ {
+ return Reconfigure("MUON/*", GetComponentID());
+ }
+ return 0;
+}
+
+
int AliHLTMUONHitReconstructorComponent::DoEvent(
const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
/// Inherited from AliHLTProcessor. Processes the new event data.
///
+ // Initialise the LUT and DC cut parameter 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 tracking station DDL.",
+ blocks[0].fSpecification
+ );
+ return -EPROTO;
+ }
+ }
+
+ // Check that the LUT was not already loaded in DoInit.
+ if (fLut == NULL)
+ {
+ 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;
+
+ fHitRec->SetLookUpTable(fLut, &fIdToEntry);
+ }
+
+ // Check that the DC cut was not already loaded in DoInit.
+ if (fHitRec->GetDCCut() == -1)
+ {
+ HLTInfo("Loading DC cut parameters from CDB for DDL %d (ID = %d).",
+ fDDL+1, AliHLTMUONUtils::DDLNumberToEquipId(fDDL)
+ );
+ int result = ReadDCCutFromCDB();
+ if (result != 0) return result;
+ HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
+ }
+
+ fDelaySetup = false;
+ }
+
+ if (fLut == NULL)
+ {
+ HLTFatal("Lookup table not loaded! Cannot continue processing data.");
+ return -ENOENT;
+ }
+
// Process an event
unsigned long totalSize = 0; // Amount of memory currently consumed in bytes.
}
-int AliHLTMUONHitReconstructorComponent::ReadCDB(const char* cdbPath, Int_t run)
+int AliHLTMUONHitReconstructorComponent::ReadLutFromCDB()
{
/// Reads LUT from CDB.
+ /// To override the default CDB path and / or run number the
+ /// SetCDBPathAndRunNo(cdbPath, run) method should be called before this
+ /// method.
assert( fLut == NULL );
assert( fLutSize == 0 );
AliHLTMUONHitRecoLutRow lut;
AliHLTUInt32_t iEntry = 0;
- int result = FetchMappingStores(cdbPath, run);
+ int result = FetchMappingStores();
// Error message already generated in FetchMappingStores.
if (result != 0) return result;
AliMpDDLStore* ddlStore = AliMpDDLStore::Instance();
return -ENOENT;
}
- AliMUONCalibrationData calibData(run);
+ AliMUONCalibrationData calibData(AliCDBManager::Instance()->GetRun());
Int_t chamberId;
}
+int AliHLTMUONHitReconstructorComponent::ReadDCCutFromCDB(const char* path)
+{
+ /// 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);
+ if (result != 0) return result;
+
+ Int_t value = 0;
+ result = GetPositiveIntFromTMap(map, "dccut", value, pathToEntry, "DC cut");
+ if (result != 0) return result;
+
+ assert(fHitRec != NULL);
+ fHitRec->SetDCCut(value);
+
+ return 0;
+}
+
+
bool AliHLTMUONHitReconstructorComponent::GenerateLookupTable(
AliHLTInt32_t ddl, const char* filename,
const char* cdbPath, Int_t run
}
comp.fDDL = ddl;
- if (comp.ReadCDB(cdbPath, run) != 0) return false;
+ if (comp.SetCDBPathAndRunNo(cdbPath, run) != 0) return false;
+ if (comp.ReadLutFromCDB() != 0) return false;
char str[1024*4];
std::fstream file(filename, std::ios::out);
AliHLTInt32_t idManuChannel = id->first;
AliHLTInt32_t row = id->second;
- assert( row < comp.fLutSize );
+ assert( AliHLTUInt32_t(row) < comp.fLutSize );
sprintf(str, "%d\t%d\t%d\t%d\t%.15e\t%.15e\t%.15e\t%.15e\t%d\t%.15e\t%.15e\t%.15e\t%.15e\t%d\t%d",
idManuChannel, comp.fLut[row].fDetElemId, comp.fLut[row].fIX,
///
/// @file AliHLTMUONHitReconstructorComponent.h
-/// @author Indranil Das <indra.das@saha.ac.in> | <indra.ehep@gmail.com>
+/// @author Indranil Das <indra.das@saha.ac.in> | <indra.ehep@gmail.com>, Artur Szostak <artursz@iafrica.com>
/// @date 28 May 2007
/// @brief Hit Reconstruction processing component for the dimuon HLT.
///
/**
* @class AliHLTMUONHitReconstructorComponent
* @brief A processing component for the dHLT tracker DDL reconstruction.
+ *
+ * This is the hit reconstruction component which forms part of the online dHLT
+ * reconstruction algorithm. It processes the raw DDL data from a dimuon spectrometer
+ * tracker station, applies simple 3 pad cluster finding and then a centre of gravity
+ * calculation to reconstruct the hit coordinate.
+ *
+ * <h2>General properties:</h2>
+ *
+ * Component ID: \b MUONHitReconstructor <br>
+ * Library: \b libAliHLTMUON.so <br>
+ * Input Data Types: ('DDL_RAW ', 'MUON') <br>
+ * Output Data Types: ('RECHITS ', 'MUON') <br>
+ *
+ * <h2>Mandatory arguments:</h2>
+ * \li -ddl <i>number</i> <br>
+ * This indicates the DDL from which the component is expect to receive data
+ * and for which it should load the appropriate electronics mapping lookup
+ * table.
+ * The <i>number</i> should be in the range [13..20], following local dimuon
+ * spectrometer DDL numbering. If either the -ddlid, -lut or -delaysetup
+ * arguments are used, then -ddl becomes optional. <br>
+ * \li -ddlid <i>number</i> <br>
+ * This indicates the DDL by equipment ID, from which the component is expect
+ * to receive data and for which it should load the appropriate electronics
+ * mapping lookup table.
+ * The <i>number</i> should be in the range [2572..2579].
+ * If either the -ddl, -lut or -delaysetup arguments are used, then -ddlid
+ * becomes optional. <br>
+ * \li -delaysetup <br>
+ * Specifying this option causes the component to initialise the lookup table
+ * and DC cut parameters from CDB only after receiving the first event to
+ * process in DoEvent.
+ * If -ddl or -ddlid were not used, then the DDL number will be taken from
+ * the first block's specification during runtime from the first
+ * event (Start-of-Run event).
+ * Using the -lut or -dccut arguments will override loading from CDB for a
+ * delayed setup. <br>
+ *
+ * <h2>Optional arguments:</h2>
+ * \li -lut <i>filename</i> <br>
+ * A pree-built lookup table for the electronics mapping and calibration
+ * information can be loaded with this argument. The file should have been
+ * generated with the GenerateLookupTable method. The location of the file
+ * is given by the parameter <i>filename</i> <br>
+ * \li -cdb <br>
+ * Indicates that the component should load from CDB. This option is implicit
+ * if the -cdbpath is given. It will also override the -lut option.<br>
+ * \li -cdbpath <i>path</i> <br>
+ * Specifies the CDB path to use, given by <i>path</i>. This option will override
+ * the CDB path automatically set by the HLT framework. <br>
+ * \li -run <i>number</i> <br>
+ * Specifies the run number to use, given by <i>number</i>. This option will
+ * override the current run number automatically set by the HLT framework. <br>
+ * \li -dccut <i>number</i> <br>
+ * Used to override the DC cut parameter in the CDB with the value given by
+ * <i>number</i>. <br>
+ * \li -warn_on_unexpected_block <br>
+ * This will cause the component to generate warnings when it receives data block
+ * types it does not know how to handle. Without this option the component only
+ * generates debug messages when they are compiled in. <br>
+ * \li -tryrecover <br>
+ * This is a special option to the raw data decoder to turn on logic which will
+ * try and recover from corrupt raw DDL data. This is off by default. <br>
+ *
+ * <h2>Standard configuration:</h2>
+ * This component should normally be configured with either of the two sets of
+ * options in the XML configuration. <br>
+ * \li -delaysetup <br>
+ * \li -ddlid ${DDL_ID} <br>
+ *
+ * <h2>Default CDB entries:</h2>
+ * The component loads electronics mapping and calibration information from the MUON
+ * subdirectory in the CDB, MUON/Calib and MUON/Align.
+ * The DC cut parameter is stored in a TMap under HLT/ConfigMUON/HitReconstructor
+ * with a default value of 50 ADC channels.
+ *
+ * <h2>Performance:</h2>
+ * Can achieve about 2kHz processing rate for nominal event sizes containing
+ * 150 tracks per event.
+ *
+ * <h2>Memory consumption:</h2>
+ * The lookup table requires about 3.5 MBytes of memory.
+ *
+ * <h2>Output size:</h2>
+ * Output size is about 10% of incoming raw input data for nominal p+p events.
+ *
+ * @ingroup alihlt_dimuon_component
*/
class AliHLTMUONHitReconstructorComponent : public AliHLTMUONProcessor
{
// 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,
void FreeMemory();
int ReadLookUpTable(const char* lutpath);
- int ReadCDB(const char* cdbpath, Int_t run);
+ int ReadLutFromCDB();
+ int ReadDCCutFromCDB(const char* path = NULL);
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.
AliHLTMUONHitRecoLutRow* fLut; ///< The lookup table used by the hit reconstruction algorithm (Owned by this component however).
IdManuChannelToEntry fIdToEntry; ///< id to line mapping.
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.
ClassDef(AliHLTMUONHitReconstructorComponent, 0) // Hit reconstructor component for dHLT tracker DDL raw data.
};
/// a new raw data buffer.
/// \param localStruct This is a pointer to the local L0 trigger structure data.
- assert(iloc >= 0 and iloc < 16);
+ assert(iloc < 16);
assert(localStruct != NULL);
assert(fOutputTrigRecs != NULL);
{
if ( argc <= i+1 )
{
- HLTError("The RUN number was not specified." );
+ HLTError("The run number was not specified." );
// Make sure to delete fTrigRec to avoid partial initialisation.
delete fTrigRec;
fTrigRec = NULL;
if (cpErr == NULL or *cpErr != '\0')
{
HLTError("Cannot convert '%s' to a valid run number."
- " Expected an integer value.", argv[i+1]
+ " Expected a positive integer value.", argv[i+1]
);
// Make sure to delete fTrigRec to avoid partial initialisation.
delete fTrigRec;
}
int result = 0;
- if (useCDB)
+ if (cdbPath != NULL or run != -1)
+ {
+ result = SetCDBPathAndRunNo(cdbPath, run);
+ }
+
+ if (result == 0 and 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 = ReadCDB(cdbPath, run);
+ result = ReadLutFromCDB();
}
- else
+ else if (result == 0)
{
HLTInfo("Loading lookup table information from file %s.", lutFileName);
result = ReadLookUpTable(lutFileName);
}
if (result != 0)
{
- // Error messages already generated in ReadCDB or ReadLookUpTable.
+ // Error messages already generated in ReadLutFromCDB or ReadLookUpTable.
// Make sure to delete fTrigRec to avoid partial initialisation.
delete fTrigRec;
}
-int AliHLTMUONTriggerReconstructorComponent::ReadCDB(const char* cdbPath, Int_t run)
+int AliHLTMUONTriggerReconstructorComponent::ReadLutFromCDB()
{
/// Loads the lookup table containing channel and geometrical position
/// information about trigger strips from CDB.
- /// \param cdbPath This specifies the CDB path to use to load from.
- /// Can be set to NULL meaning the default storage is used.
- /// \param run Specifies the run number to use. If set to -1 then the
- /// default / current run number set for the CDB is used.
+ ///
+ /// \note To override the default CDB path and / or run number the
+ /// SetCDBPathAndRunNo(cdbPath, run) method should be called before this
+ /// method.
+ ///
/// \return 0 on success and non zero codes for errors.
if (fDDL == -1)
return -EINVAL;
}
- int result = FetchMappingStores(cdbPath, run);
+ int result = FetchMappingStores();
// Error message already generated in FetchMappingStores.
if (result != 0) return result;
AliMpDDLStore* ddlStore = AliMpDDLStore::Instance();
AliHLTMUONTriggerReconstructorComponent& operator = (const AliHLTMUONTriggerReconstructorComponent& /*obj*/);
int ReadLookUpTable(const char* lutpath);
- int ReadCDB(const char* cdbPath, Int_t run);
+ int ReadLutFromCDB();
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.
Int_t firstRun = 0;
Int_t lastRun = AliCDBRunRange::Infinity();
+ const char* path = NULL;
+ AliCDBMetaData* metaData = NULL;
+ TMap* params = NULL;
+ AliCDBId id;
+
+ // Create and store the configuration parameters for the hit reconstructor.
+ params = new TMap;
+ params->SetOwner(kTRUE);
+ params->Add(new TObjString("dccut"), new TObjString("50"));
+
+ path = AliHLTMUONConstants::HitReconstructorCDBPath();
+ id = AliCDBId(path, firstRun, lastRun, verison);
+ metaData = new AliCDBMetaData();
+ metaData->SetResponsible("dimuon HLT");
+ metaData->SetComment("Hit reconstructor DC cut parameter for dimuon HLT.");
+ storage->Put(params, id, metaData);
+
// Create and store the configuration parameters for the trigger decision cuts.
- TMap* cuts = new TMap;
- cuts->SetOwner(kTRUE);
- cuts->Add(new TObjString("lowptcut"), new TObjString("1"));
- cuts->Add(new TObjString("highptcut"), new TObjString("2"));
- cuts->Add(new TObjString("lowmasscut"), new TObjString("2.5"));
- cuts->Add(new TObjString("highmasscut"), new TObjString("7"));
+ params = new TMap;
+ params->SetOwner(kTRUE);
+ params->Add(new TObjString("lowptcut"), new TObjString("1"));
+ params->Add(new TObjString("highptcut"), new TObjString("2"));
+ params->Add(new TObjString("lowmasscut"), new TObjString("2.5"));
+ params->Add(new TObjString("highmasscut"), new TObjString("7"));
- const char* path = AliHLTMUONConstants::DecisionComponentCDBPath();
- AliCDBId id(path, firstRun, lastRun, verison);
- AliCDBMetaData* metaData = new AliCDBMetaData();
+ path = AliHLTMUONConstants::DecisionComponentCDBPath();
+ id = AliCDBId(path, firstRun, lastRun, verison);
+ metaData = new AliCDBMetaData();
metaData->SetResponsible("dimuon HLT");
metaData->SetComment("Trigger decision cuts for dimuon HLT.");
- storage->Put(cuts, id, metaData);
+ storage->Put(params, id, metaData);
}