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.
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";
return fgkDataCheckerComponentId;
}
+ static const char* TriggerReconstructorCDBPath()
+ {
+ return fgkTriggerReconstructorCDBPath;
+ }
+
static const char* HitReconstructorCDBPath()
{
return fgkHitReconstructorCDBPath;
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.
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 (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 (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 (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())
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.
HLTInfo("Initialising dHLT trigger decision component.");
- bool lowPtCutSet = false;
- bool highPtCutSet = false;
- bool lowMassCutSet = false;
- bool highMassCutSet = 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++)
{
+ 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 (lowPtCutSet)
+ if (fLowPtCutSet)
{
HLTWarning("Low pT cut parameter was already specified."
" Will replace previous value given by -lowptcut."
return -EINVAL;
}
fLowPtCut = (AliHLTFloat32_t)num;
- lowPtCutSet = true;
+ fLowPtCutSet = true;
i++;
continue;
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."
return -EINVAL;
}
fHighPtCut = (AliHLTFloat32_t)num;
- highPtCutSet = true;
+ fHighPtCutSet = true;
i++;
continue;
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."
return -EINVAL;
}
fLowMassCut = (AliHLTFloat32_t)num;
- lowMassCutSet = true;
+ fLowMassCutSet = true;
i++;
continue;
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."
return -EINVAL;
}
fHighMassCut = (AliHLTFloat32_t)num;
- highMassCutSet = true;
+ fHighMassCutSet = true;
i++;
continue;
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;
}
- 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;
}
{
/// 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;
}
/// 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
int AliHLTMUONDecisionComponent::ReadConfigFromCDB(
- const char* path,
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();
- if (path != NULL)
- pathToEntry = path;
TMap* map = NULL;
int result = FetchTMapFromCDB(pathToEntry, map);
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;
}
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,
/**
* 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).
* \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
);
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.
};
} // 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)
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
{
- 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());
}
/// \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;
);
int result = ReadDCCutFromCDB();
if (result != 0) return result;
- HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
}
fDelaySetup = false;
}
-int AliHLTMUONHitReconstructorComponent::ReadDCCutFromCDB(const char* path)
+int AliHLTMUONHitReconstructorComponent::ReadDCCutFromCDB()
{
/// 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);
assert(fHitRec != NULL);
fHitRec->SetDCCut(value);
+ HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
+
return 0;
}
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.
#include "AliHLTMUONMansoTrackerFSMComponent.h"
#include "AliHLTMUONConstants.h"
+#include "AliHLTMUONCalculations.h"
#include "AliHLTMUONUtils.h"
#include "AliHLTMUONMansoTrackerFSM.h"
#include "AliHLTMUONDataBlockReader.h"
fTrackCount(0),
fBlock(NULL),
fRecHitBlockArraySize(0),
- fWarnForUnexpecedBlock(false)
+ fWarnForUnexpecedBlock(false),
+ fDelaySetup(false),
+ fCanLoadZmiddle(true),
+ fCanLoadBL(true)
{
///
/// Default constructor.
///
- for (Int_t i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
{
fRecHitBlockCount[i] = 0;
fRecHitBlock[i] = NULL;
}
+
+ ResetCanLoadFlags();
}
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++)
{
+ 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;
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
}
+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()
{
///
/// 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.
}
+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,
// 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,
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.
};
//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 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).
};
fSuppressPartialTriggers(false),
fOverflowed(false),
fWarnOnly(false),
+ fUseLocalId(true),
fUseCrateId(true),
fCurrentCrateId(0),
fCurrentRegional(0)
*/
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
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.
*/
void SetDDL(AliHLTInt32_t ddl) { fDDLBit = (ddl == 20 ? 0x00 : 0x80); }
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.
#include "AliHLTMUONTriggerReconstructor.h"
#include "AliHLTMUONHitReconstructor.h"
#include "AliHLTMUONConstants.h"
+#include "AliHLTMUONCalculations.h"
#include "AliHLTMUONUtils.h"
#include "AliHLTMUONDataBlockWriter.h"
#include "AliRawDataHeader.h"
fDDL(-1),
fWarnForUnexpecedBlock(false),
fStopOnOverflow(false),
- fUseCrateId(true)
+ fUseCrateId(true),
+ fDelaySetup(false),
+ fZmiddleSpecified(false),
+ fBLSpecified(false),
+ fLutInitialised(false)
{
///
/// Default constructor.
fWarnForUnexpecedBlock = false;
fStopOnOverflow = false;
fUseCrateId = true;
+ fDelaySetup = false;
+ fZmiddleSpecified = false;
+ fBLSpecified = false;
+ fLutInitialised = false;
const char* lutFileName = NULL;
const char* cdbPath = NULL;
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)
{
+ if (lutFileName != NULL)
+ {
+ HLTWarning("LUT path was already specified."
+ " Will replace previous value given by -lut."
+ );
+ }
+
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;
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 (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 (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." );
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)
{
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;
} // 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 (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)
{
- 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);
- 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->UseLocalId(useLocalId);
return 0;
}
/// 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.
}
+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::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
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
/// @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;
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.
* @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,
- const char* cdbPath, Int_t run
+ const char* cdbPath, Int_t run, bool useCrateId = true
);
protected:
// 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(
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.
+ 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.
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);
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);
* \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");
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;
}
+++ /dev/null
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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);
-};
-
+++ /dev/null
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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;
- };
-};
-
+++ /dev/null
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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();
- };
-};
-
+++ /dev/null
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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);
-};
-
+++ /dev/null
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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;
- };
-};
-