Refactored code to move common command line options to AliHLTMUONProcessor base class.
Applying a bug fix with loading of libraries in command line utilities dHLTdumpraw and dHLTrootify. Also adding cdbpath and run number command line options.
#include "TMap.h"
#include "TObjString.h"
#include "TString.h"
+#include <string>
+#include <cstdlib>
+#include <fstream>
+
ClassImp(AliHLTMUONProcessor)
+AliHLTMUONProcessor::AliHLTMUONProcessor() :
+ AliHLTProcessor(),
+ fWarnForUnexpecedBlock(false),
+ fDelaySetup(false),
+ fDumpDataOnError(false),
+ fDumpPath("./")
+{
+ /// Default constructor.
+}
+
+
+int AliHLTMUONProcessor::DoInit(int argc, const char** argv)
+{
+ /// Parses common dHLT component arguments.
+
+ // Set the default values for various arguments comming from the command line.
+ fDelaySetup = false;
+ fDumpDataOnError = false;
+ fDumpPath = "./";
+ const char* cdbPath = NULL;
+ Int_t run = -1;
+
+ for (int i = 0; i < argc; i++)
+ {
+ // Ignore the argument if the child class indicates to do so.
+ if (IgnoreArgument(argv[i])) continue;
+
+ 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( 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 a positive integer value.", argv[i+1]
+ );
+ return -EINVAL;
+ }
+
+ i++;
+ continue;
+ }
+
+ if (strcmp(argv[i], "-delaysetup") == 0)
+ {
+ fDelaySetup = true;
+ continue;
+ }
+
+ if (strcmp(argv[i], "-dumponerror") == 0)
+ {
+ fDumpDataOnError = true;
+ continue;
+ }
+
+ if (strcmp(argv[i], "-dumppath") == 0)
+ {
+ if (fDumpPath != NULL)
+ {
+ HLTWarning("The dump path was already specified. Will"
+ " replace previous value given by -dumppath."
+ );
+ }
+ if (argc <= i+1)
+ {
+ HLTError("The dump path was not specified.");
+ return -EINVAL;
+ }
+ fDumpPath = argv[i+1];
+ i++;
+ continue;
+ }
+ }
+
+ if (cdbPath != NULL or run != -1)
+ {
+ int result = SetCDBPathAndRunNo(cdbPath, run);
+ if (result != 0)
+ {
+ // Error messages already generated in SetCDBPathAndRunNo.
+ return result;
+ }
+ }
+
+ return 0;
+}
+
+
+bool AliHLTMUONProcessor::ArgumentAlreadyHandled(int& i, const char* argi) const
+{
+ /// This method can be used by the derivind child class to check if a particular
+ /// argument in argv was already processed.
+
+ if (strcmp(argi, "-cdbpath") == 0)
+ {
+ if (IgnoreArgument(argi)) return false;
+ i++;
+ return true;
+ }
+
+ if (strcmp(argi, "-run") == 0)
+ {
+ if (IgnoreArgument(argi)) return false;
+ i++;
+ return true;
+ }
+
+ if (strcmp(argi, "-delaysetup") == 0)
+ {
+ if (IgnoreArgument(argi)) return false;
+ return true;
+ }
+
+ if (strcmp(argi, "-dumponerror") == 0)
+ {
+ if (IgnoreArgument(argi)) return false;
+ return true;
+ }
+
+ if (strcmp(argi, "-dumppath") == 0)
+ {
+ if (IgnoreArgument(argi)) return false;
+ i++;
+ return true;
+ }
+
+ return false;
+}
+
+
int AliHLTMUONProcessor::SetCDBPathAndRunNo(
const char* cdbPath, Int_t run, bool useDefault
) const
return 0;
}
+
+void AliHLTMUONProcessor::DumpBuffer(
+ const void* buffer, AliHLTUInt32_t size, const char* filename
+ ) const
+{
+ /// Dumps the data contained in a buffer to file as is.
+
+ using std::fstream;
+
+ fstream file(filename, fstream::out | fstream::trunc | fstream::binary);
+ if (file.good())
+ {
+ file.write(reinterpret_cast<const char*>(buffer), size);
+ if (file.fail())
+ {
+ HLTError("Could not write data block to file %s during"
+ " dumping operation!",
+ filename
+ );
+ }
+ }
+ else
+ {
+ HLTError("Could not open file %s for dumping data block!", filename);
+ }
+}
+
+
+void AliHLTMUONProcessor::DumpBlock(
+ const AliHLTComponentBlockData* block, const char* fileNamePrefix
+ ) const
+{
+ /// Dumps the data block and meta information to file.
+
+ std::string filename = fDumpPath;
+ filename += fileNamePrefix;
+ filename += "-blockmeta.bin";
+ DumpBuffer(block, sizeof(AliHLTComponentBlockData), filename.c_str());
+ filename = fDumpPath;
+ filename += fileNamePrefix;
+ filename += "-data.bin";
+ DumpBuffer(block->fPtr, block->fSize, filename.c_str());
+}
+
+
+void AliHLTMUONProcessor::DumpEvent(
+ const AliHLTComponentEventData& evtData,
+ const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& trigData,
+ AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size,
+ AliHLTComponentBlockDataList& outputBlocks
+ ) const
+{
+ /// Dumps the event information to files in the dump path given by the
+ /// method DumpPath, which can be set by the command line argument -dumppath.
+
+ using std::fstream;
+ char strbuf[1024];
+
+ std::string filename = fDumpPath;
+ sprintf(strbuf, "dump_event-0x%16.16llX.log", evtData.fEventID);
+ filename += strbuf;
+ fstream logfile(filename.c_str(), fstream::out | fstream::trunc);
+ if (logfile.fail())
+ {
+ HLTError("Could not open log file '%s' for dump information.", filename.c_str());
+ return;
+ }
+
+ filename = fDumpPath;
+ sprintf(strbuf, "dump_event-0x%16.16llX-eventdata.bin", evtData.fEventID);
+ filename += strbuf;
+ logfile << "Dumping event data structure to file: " << filename << std::endl;
+ DumpBuffer(&evtData, sizeof(AliHLTComponentEventData), filename.c_str());
+
+ filename = fDumpPath;
+ sprintf(strbuf, "dump_event-0x%16.16llX-triggerdata.bin", evtData.fEventID);
+ filename += strbuf;
+ logfile << "Dumping trigger data structure to file: " << filename << std::endl;
+ DumpBuffer(&trigData, sizeof(AliHLTComponentTriggerData), filename.c_str());
+
+ for (unsigned int n = 0; n < evtData.fBlockCnt; n++)
+ {
+ sprintf(strbuf, "dump_event-0x%16.16llX-block-0x%8.8X", evtData.fEventID, n);
+ filename = strbuf;
+ sprintf(strbuf, "0x%8.8X", blocks[n].fSpecification);
+ logfile << "Found block with data type = " << DataType2Text(blocks[n].fDataType)
+ << ", specification = " << strbuf << ". Dumping to file: "
+ << filename << "-data.bin" << std::endl;
+ DumpBlock(&blocks[n], filename.c_str());
+ }
+
+ filename = fDumpPath;
+ sprintf(strbuf, "dump_event-0x%16.16llX-output-buffer.bin", evtData.fEventID);
+ filename += strbuf;
+ logfile << "Dumping output buffer to file: " << filename << std::endl;
+ DumpBuffer(outputPtr, size, filename.c_str());
+
+ for (size_t i = 0; i < outputBlocks.size(); i++)
+ {
+ sprintf(strbuf, "dump_event-0x%16.16llX-output-block-0x%8.8X", evtData.fEventID, int(i));
+ filename = strbuf;
+ sprintf(strbuf, "0x%8.8X", outputBlocks[i].fSpecification);
+ logfile << "Generated output data block with type = "
+ << DataType2Text(outputBlocks[i].fDataType)
+ << ", specification = " << strbuf << ". Dumping to file: "
+ << filename << "-data.bin" << std::endl;
+ DumpBlock(&outputBlocks[i], filename.c_str());
+ }
+}
+
+
+void AliHLTMUONProcessor::DumpEvent(
+ const AliHLTComponentEventData& evtData,
+ AliHLTComponentTriggerData& trigData
+ ) const
+{
+ /// Dumps the event information to files in the dump path given by the
+ /// method DumpPath, which can be set by the command line argument -dumppath.
+
+ using std::fstream;
+ char strbuf[1024];
+
+ std::string filename = fDumpPath;
+ sprintf(strbuf, "dump_event-0x%16.16llX.log", evtData.fEventID);
+ filename += strbuf;
+ fstream logfile(filename.c_str(), fstream::out | fstream::trunc);
+ if (logfile.fail())
+ {
+ HLTError("Could not open log file '%s' for dump information.", filename.c_str());
+ return;
+ }
+
+ filename = fDumpPath;
+ sprintf(strbuf, "dump_event-0x%16.16llX-eventdata.bin", evtData.fEventID);
+ filename += strbuf;
+ logfile << "Dumping event data structure to file: " << filename << std::endl;
+ DumpBuffer(&evtData, sizeof(AliHLTComponentEventData), filename.c_str());
+
+ filename = fDumpPath;
+ sprintf(strbuf, "dump_event-0x%16.16llX-triggerdata.bin", evtData.fEventID);
+ filename += strbuf;
+ logfile << "Dumping trigger data structure to file: " << filename << std::endl;
+ DumpBuffer(&trigData, sizeof(AliHLTComponentTriggerData), filename.c_str());
+
+ for (int i = 0; i < GetNumberOfInputBlocks(); i++)
+ {
+ const AliHLTComponentBlockData* block = GetInputBlock(i);
+ sprintf(strbuf, "dump_event-0x%16.16llX-block-0x%8.8X", evtData.fEventID, i);
+ filename = strbuf;
+ sprintf(strbuf, "0x%8.8X", block->fSpecification);
+ logfile << "Found block with data type = " << DataType2Text(block->fDataType)
+ << ", specification = " << strbuf << ". Dumping to file: "
+ << filename << "-data.bin" << std::endl;
+ DumpBlock(block, filename.c_str());
+ }
+}
+
{
public:
/// Default constructor.
- AliHLTMUONProcessor() : AliHLTProcessor() {}
+ AliHLTMUONProcessor();
/// Default destructor.
virtual ~AliHLTMUONProcessor() {}
protected:
+ /**
+ * This method parses the common arguments for dHLT processing components
+ * and initialises the common internal state.
+ * Deriving classes can use the ArgumentAlreadyHandled method to check if
+ * the parent class has processed a particular argument. The following is
+ * an example of this:
+ *
+ * \code
+ * int DerivedClass::DoInit(int argc, const char** argv)
+ * {
+ * int result = AliHLTMUONProcessor::DoInit(argc, argv);
+ * if (result != 0) return result;
+ * for (int i = 0; i < argc; i++)
+ * {
+ * if (ArgumentAlreadyHandled(i, argv[i])) continue;
+ * // ... handle custom arguments here ...
+ * }
+ * }
+ * \endcode
+ */
+ virtual int DoInit(int argc, const char** argv);
+
+ /**
+ * This method can be used by the derivind child class to check if a particular
+ * argument in argv was already processed.
+ * \note This assumes that the deriving class called the DoInit method of the
+ * parent class in its own DoInit method.
+ */
+ virtual bool ArgumentAlreadyHandled(int& i, const char* argi) const;
+
+ /**
+ * This method returns the command line arguments that should not be parsed
+ * by this class. This method can be used by child classes that derive from
+ * AliHLTMUONProcessor, to indicate which arguments should not be handled by
+ * the AliHLTMUONProcessor::DoInit method. Default return value is false.
+ */
+ virtual bool IgnoreArgument(const char* /*arg*/) const { return false; }
+
+ /**
+ * Returns true if the component was told to delay initialisation from
+ * CDB until the first start of run event. This gets set by the -delaysetup
+ * flag which is processed in AliHLTMUONProcessor::DoInit.
+ */
+ bool DelaySetup() const { return fDelaySetup; }
+
+ /**
+ * This method should be called when a derived component has handled a
+ * delayed setup requested on the command line with -delaysetup and indicated
+ * by the flag returned by the DelaySetup method.
+ */
+ void DoneDelayedSetup() { fDelaySetup = false; }
+
+ /**
+ * Returns true if the component has the flag set indicating to dump raw
+ * data when an error occurs. The DumpEvent method should be used by the
+ * deriving components to actually dump data at the appropriate point.
+ * \note This facility is intended for debugging.
+ */
+ bool DumpDataOnError() const { return fDumpDataOnError; }
+
+ /**
+ * Returns the path where the dump files will be written to by the Dump*
+ * methods. Defaults to the current working directory.
+ * \note This facility is intended for debugging.
+ */
+ const char* DumpPath() const { return fDumpPath; }
+
/**
* Method to check the block structure and log appropriate error messages.
* If a problem is found with the data block then an appropriate HLT error
*/
int LoadRecoParamsFromCDB(AliMUONRecoParam*& params) const;
+ /**
+ * Dumps the data contained in a buffer to file as is.
+ */
+ void DumpBuffer(
+ const void* buffer, AliHLTUInt32_t size,
+ const char* filename
+ ) const;
+
+ /**
+ * Dumps the data block to file.
+ */
+ void DumpBlock(
+ const AliHLTComponentBlockData* block,
+ const char* fileNamePrefix
+ ) const;
+
+ /**
+ * Dumps the event information to files in the dump path given by the
+ * method DumpPath, which can be set by the command line argument -dumppath.
+ */
+ void DumpEvent(
+ const AliHLTComponentEventData& evtData,
+ const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& trigData,
+ AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size,
+ AliHLTComponentBlockDataList& outputBlocks
+ ) const;
+
+ /**
+ * Dumps the event information to files in the dump path given by the
+ * method DumpPath, which can be set by the command line argument -dumppath.
+ */
+ void DumpEvent(
+ const AliHLTComponentEventData& evtData,
+ AliHLTComponentTriggerData& trigData
+ ) const;
+
private:
// Do not allow copying of this class.
AliHLTMUONProcessor(const AliHLTMUONProcessor& /*obj*/);
/// Not implemented.
AliHLTMUONProcessor& operator = (const AliHLTMUONProcessor& /*obj*/);
+
+ 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 fDumpDataOnError; ///< Flag indicating if we should dump data when an error occurs in the reconstruction class.
+ const char* fDumpPath; ///< This is the path prefix to use to dump event data too when an error occurs.
ClassDef(AliHLTMUONProcessor, 0) // Abstract base class for dHLT specific components.
};
AliHLTComponentTriggerData& /*trigData*/,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
)
{
/// Inherited from AliHLTOfflineDataSource.
AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
);
using AliHLTOfflineDataSource::GetEvent;
}
+bool AliHLTMUONESDMaker::IgnoreArgument(const char* arg) const
+{
+ /// Return true if the argument is one of -cdbpath -run or -delaysetup
+ /// to prevent the parent class from parsing these arguments in DoInit.
+
+ if (strcmp(arg, "-cdbpath") == 0 or strcmp(arg, "-run") != 0 or
+ strcmp(arg, "-delaysetup") != 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
int AliHLTMUONESDMaker::DoInit(int argc, const char** argv)
{
/// Inherited from AliHLTComponent.
/// Parses the command line parameters and initialises the component.
HLTInfo("Initialising dHLT ESD maker component.");
+
+ // Inherit the parents functionality.
+ int result = AliHLTMUONProcessor::DoInit(argc, argv);
+ if (result != 0) return result;
fWarnForUnexpecedBlock = false;
fMakeMinimalESD = false;
for (int i = 0; i < argc; i++)
{
+ if (ArgumentAlreadyHandled(i, argv[i])) continue;
+
if (strcmp(argv[i], "-make_minimal_esd") == 0)
{
fMakeMinimalESD = true;
}
-void AliHLTMUONESDMaker::GetInputDataTypes(
- vector<AliHLTComponentDataType>& list
- )
+void AliHLTMUONESDMaker::GetInputDataTypes(AliHLTComponentDataTypeList& list)
{
/// Inherited from AliHLTProcessor.
/// Returns the list of expected input data types.
int AliHLTMUONESDMaker::DoEvent(
- const AliHLTComponentEventData& /*evtData*/,
- AliHLTComponentTriggerData& /*trigData*/
+ const AliHLTComponentEventData& evtData,
+ AliHLTComponentTriggerData& trigData
)
{
/// Inherited from AliHLTProcessor. Processes the new event data.
{
specification |= block->fSpecification;
AliHLTMUONTriggerRecordsBlockReader inblock(block->fPtr, block->fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, trigData);
+ continue;
+ }
for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
{
{
specification |= block->fSpecification;
AliHLTMUONMansoTracksBlockReader inblock(block->fPtr, block->fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, trigData);
+ continue;
+ }
for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
{
virtual const char* GetComponentID();
- virtual void GetInputDataTypes(vector<AliHLTComponentDataType>& list);
+ virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
virtual AliHLTComponentDataType GetOutputDataType();
virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
virtual int DoInit(int argc, const char** argv);
virtual int DoDeinit();
virtual int DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
+ virtual bool IgnoreArgument(const char* arg) const;
using AliHLTProcessor::DoEvent;
private:
AliHLTComponentTriggerData& /*trigData*/,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
)
{
///
AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
);
using AliHLTOfflineDataSource::GetEvent;
}
+bool AliHLTMUONRootifierComponent::IgnoreArgument(const char* arg) const
+{
+ /// Return true if the argument is one of -cdbpath -run or -delaysetup
+ /// to prevent the parent class from parsing these arguments in DoInit.
+
+ if (strcmp(arg, "-cdbpath") == 0 or strcmp(arg, "-run") != 0 or
+ strcmp(arg, "-delaysetup") != 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
int AliHLTMUONRootifierComponent::DoInit(int argc, const char** argv)
{
///
///
HLTInfo("Initialising dHLT rootifier component.");
+
+ // Inherit the parents functionality.
+ int result = AliHLTMUONProcessor::DoInit(argc, argv);
+ if (result != 0) return result;
fWarnForUnexpecedBlock = false;
for (int i = 0; i < argc; i++)
{
+ if (ArgumentAlreadyHandled(i, argv[i])) continue;
+
if (strcmp(argv[i], "-warn_on_unexpected_block") == 0)
{
fWarnForUnexpecedBlock = true;
}
-void AliHLTMUONRootifierComponent::GetInputDataTypes(
- vector<AliHLTComponentDataType>& list
- )
+void AliHLTMUONRootifierComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
{
///
/// Inherited from AliHLTProcessor. Returns the list of expected input data types.
int AliHLTMUONRootifierComponent::DoEvent(
const AliHLTComponentEventData& evtData,
- AliHLTComponentTriggerData& /*trigData*/
+ AliHLTComponentTriggerData& trigData
)
{
///
{
specification |= block->fSpecification;
AliHLTMUONRecHitsBlockReader inblock(block->fPtr, block->fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, trigData);
+ continue;
+ }
// Decode the source DDL from the specification bits.
Int_t sourceDDL = -1;
{
specification |= block->fSpecification;
AliHLTMUONTriggerRecordsBlockReader inblock(block->fPtr, block->fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, trigData);
+ continue;
+ }
// Decode the source DDL from the specification bits.
Int_t sourceDDL = -1;
{
specification |= block->fSpecification;
AliHLTMUONMansoTracksBlockReader inblock(block->fPtr, block->fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, trigData);
+ continue;
+ }
for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
{
decisionBlockFound = true;
specification |= block->fSpecification;
AliHLTMUONSinglesDecisionBlockReader inblock(block->fPtr, block->fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, trigData);
+ continue;
+ }
numLowPt += inblock.BlockHeader().fNlowPt;
numHighPt += inblock.BlockHeader().fNhighPt;
decisionBlockFound = true;
specification |= block->fSpecification;
AliHLTMUONPairsDecisionBlockReader inblock(block->fPtr, block->fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, trigData);
+ continue;
+ }
numUnlikeAnyPt += inblock.BlockHeader().fNunlikeAnyPt;
numUnlikeLowPt += inblock.BlockHeader().fNunlikeLowPt;
virtual const char* GetComponentID();
- virtual void GetInputDataTypes(vector<AliHLTComponentDataType>& list);
+ virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
virtual AliHLTComponentDataType GetOutputDataType();
virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
virtual int DoInit(int argc, const char** argv);
virtual int DoDeinit();
virtual int DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
+ virtual bool IgnoreArgument(const char* arg) const;
using AliHLTProcessor::DoEvent;
private:
AliHLTComponentTriggerData& /*trigData*/,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
)
{
///
AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
);
using AliHLTOfflineDataSource::GetEvent;
fLowMassCut(2.5), // 2.7 GeV/c^2 cut
fHighMassCut(7.), // 8 GeV/c^2 cut
fWarnForUnexpecedBlock(false),
- fDelaySetup(false),
fLowPtCutSet(false),
fHighPtCutSet(false),
fLowMassCutSet(false),
}
-void AliHLTMUONDecisionComponent::GetInputDataTypes(
- vector<AliHLTComponentDataType>& list
- )
+void AliHLTMUONDecisionComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
{
///
/// Inherited from AliHLTProcessor. Returns the list of expected input data types.
HLTInfo("Initialising dHLT trigger decision component.");
+ // Inherit the parents functionality.
+ int result = AliHLTMUONProcessor::DoInit(argc, argv);
+ if (result != 0) return result;
+
fWarnForUnexpecedBlock = false;
- fDelaySetup = false;
fLowPtCutSet = false;
fHighPtCutSet = false;
fLowMassCutSet = false;
fFillSinglesDetail = true;
fFillPairsDetail = true;
- 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 (ArgumentAlreadyHandled(i, argv[i])) continue;
+
if (strcmp( argv[i], "-lowptcut" ) == 0)
{
if (fLowPtCutSet)
return -EINVAL;
}
- if (cdbPath != NULL or run != -1)
- {
- int result = SetCDBPathAndRunNo(cdbPath, run);
- if (result != 0) return result;
- }
-
- if (not fDelaySetup)
+ if (not DelaySetup())
{
// 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)
int AliHLTMUONDecisionComponent::DoEvent(
const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& /*trigData*/,
+ AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
)
{
///
// Initialise the cut parameters from CDB if we were requested to
// initialise only when the first event was received.
- if (fDelaySetup)
+ if (DelaySetup())
{
// Load the cut paramters from CDB if they have not been given
// on the command line.
if (result != 0) return result;
}
- fDelaySetup = false;
+ DoneDelayedSetup();
}
AliHLTUInt32_t specification = 0; // Contains the output data block spec bits.
specification |= blocks[n].fSpecification;
AliHLTMUONMansoTracksBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
+ continue;
+ }
for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
{
int result = AddTrack(&inblock[i]);
if (result != 0)
{
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
size = 0; // Important to tell framework that nothing was generated.
return result;
}
" %d bytes for the singles output data block.",
size, sizeof(AliHLTMUONSinglesDecisionBlockWriter::HeaderType)
);
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
size = 0; // Important to tell framework that nothing was generated.
return -ENOBUFS;
}
" %d bytes for the singles output data block.",
size, bytesneeded
);
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
size = 0; // Important to tell framework that nothing was generated.
return -ENOBUFS;
}
size,
sizeof(AliHLTMUONPairsDecisionBlockWriter::HeaderType) + singlesBlock.BytesUsed()
);
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
size = 0; // Important to tell framework that nothing was generated.
return -ENOBUFS;
}
" %d bytes for the pairs output data block.",
size, bytesneeded
);
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
size = 0; // Important to tell framework that nothing was generated.
return -ENOBUFS;
}
#include "AliHLTMUONProcessor.h"
#include "AliHLTMUONDataTypes.h"
-#include <vector>
#if __GNUC__ && __GNUC__ < 3
#define std
AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
);
using AliHLTProcessor::DoEvent;
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.
fLutSize(0),
fLut(NULL),
fIdToEntry(),
- fWarnForUnexpecedBlock(false),
- fDelaySetup(false)
+ fWarnForUnexpecedBlock(false)
{
///
/// Default constructor.
}
-void AliHLTMUONHitReconstructorComponent::GetInputDataTypes( std::vector<AliHLTComponentDataType>& list)
+void AliHLTMUONHitReconstructorComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
{
///
/// Inherited from AliHLTProcessor. Returns the list of expected input data types.
}
-void AliHLTMUONHitReconstructorComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+void AliHLTMUONHitReconstructorComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
{
///
/// Inherited from AliHLTComponent. Returns an estimate of the expected output data size.
///
HLTInfo("Initialising dHLT hit reconstruction component.");
+
+ // Inherit the parents functionality.
+ int result = AliHLTMUONProcessor::DoInit(argc, argv);
+ if (result != 0) return result;
// Must make sure that fHitRec and fLut is deleted if it is still
// allocated for whatever reason.
FreeMemory();
- try
- {
- fHitRec = new AliHLTMUONHitReconstructor();
- }
- catch (const std::bad_alloc&)
- {
- HLTError("Could not allocate more memory for the hit reconstructor component.");
- return -ENOMEM;
- }
-
// Initialise fields with default values then parse the command line.
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++)
{
- HLTDebug("argv[%d] == %s", i, argv[i]);
+ // To keep the legacy behaviour we need to have the following check
+ // for -cdbpath here, before ArgumentAlreadyHandled.
+ if (strcmp(argv[i], "-cdbpath") == 0)
+ {
+ useCDB = true;
+ }
+
+ if (ArgumentAlreadyHandled(i, argv[i])) continue;
if (strcmp( argv[i], "-ddl" ) == 0)
{
if (argc <= i+1)
{
HLTError("The DDL number was not specified. Must be in the range [13..20].");
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
if (cpErr == NULL or *cpErr != '\0')
{
HLTError("Cannot convert '%s' to DDL a number.", argv[i+1] );
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
if (num < 13 or 20 < num)
{
HLTError("The DDL number must be in the range [13..20].");
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
fDDL = num - 1; // convert to range [12..19]
if ( argc <= i+1 )
{
HLTError("DDL equipment ID number not specified. It must be in the range [2572..2579]" );
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
if (cpErr == NULL or *cpErr != '\0')
{
HLTError("Cannot convert '%s' to a DDL equipment ID Number.", argv[i+1]);
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
fDDL = AliHLTMUONUtils::EquipIdToDDLNumber(num); // Convert to DDL number in the range 0..21
if (fDDL < 12 or 19 < fDDL)
{
HLTError("The DDL equipment ID number must be in the range [2572..2579].");
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
if (argc <= i+1)
{
HLTError("The lookup table filename was not specified.");
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
lutFileName = argv[i+1];
continue;
} // -cdb argument
- 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];
- useCDB = true;
- i++;
- continue;
- } // -cdb argument
-
- 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( 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 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)
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;
}
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;
}
continue;
}
- if (strcmp( argv[i], "-delaysetup" ) == 0)
- {
- fDelaySetup = true;
- continue;
- }
-
if (strcmp( argv[i], "-warn_on_unexpected_block" ) == 0)
{
fWarnForUnexpecedBlock = true;
}
HLTError("Unknown option '%s'", argv[i]);
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
} // for loop
+ try
+ {
+ fHitRec = new AliHLTMUONHitReconstructor();
+ }
+ catch (const std::bad_alloc&)
+ {
+ HLTError("Could not allocate more memory for the hit reconstructor component.");
+ return -ENOMEM;
+ }
+
if (dccut != -1 and useCDB)
{
HLTWarning("The -cdb or -cdbpath parameter was specified, which indicates that"
if (lutFileName == NULL) useCDB = true;
- if (fDDL == -1 and not fDelaySetup)
+ if (fDDL == -1 and not DelaySetup())
{
HLTWarning("DDL number not specified. Cannot check if incomming data is valid.");
}
- 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)
{
- if (not fDelaySetup)
+ if (not DelaySetup())
{
HLTInfo("Loading lookup table information from CDB for DDL %d (ID = %d).",
fDDL+1, AliHLTMUONUtils::DDLNumberToEquipId(fDDL)
if (dccut == -1)
{
- if (not fDelaySetup)
+ if (not DelaySetup())
{
HLTInfo("Loading DC cut parameters from CDB for DDL %d (ID = %d).",
fDDL+1, AliHLTMUONUtils::DDLNumberToEquipId(fDDL)
int AliHLTMUONHitReconstructorComponent::DoEvent(
const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& /*trigData*/,
+ AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
)
{
///
/// 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)
+ if (DelaySetup())
{
// Use the specification given by the first data block if we
// have not been given a DDL number on the command line.
if (result != 0) return result;
}
- fDelaySetup = false;
+ DoneDelayedSetup();
}
if (fLut == NULL)
if (not fHitRec->Run(buffer, ddlRawDataSize, block.GetArray(), nofHit))
{
HLTError("Error while processing the hit reconstruction algorithm.");
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
size = totalSize; // Must tell the framework how much buffer space was used.
return -EIO;
}
// These functions are required for the registration process
virtual const char* GetComponentID();
- virtual void GetInputDataTypes(std::vector<AliHLTComponentDataType>& list);
+ virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
virtual AliHLTComponentDataType GetOutputDataType();
- virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+ virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
virtual AliHLTComponent* Spawn();
/**
AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
);
using AliHLTProcessor::DoEvent;
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.
};
fBlock(NULL),
fRecHitBlockArraySize(0),
fWarnForUnexpecedBlock(false),
- fDelaySetup(false),
fCanLoadZmiddle(true),
fCanLoadBL(true)
{
void AliHLTMUONMansoTrackerFSMComponent::GetInputDataTypes(
- vector<AliHLTComponentDataType>& list
+ AliHLTComponentDataTypeList& list
)
{
///
HLTInfo("Initialising dHLT manso tracker FSM component.");
+ // Inherit the parents functionality.
+ int result = AliHLTMUONProcessor::DoInit(argc, argv);
+ if (result != 0) return result;
+
// Just in case for whatever reason we still have some of the internal
// object allocated previously still hanging around delete them now.
FreeMemory();
- try
- {
- fTracker = new AliHLTMUONMansoTrackerFSM();
- }
- catch (const std::bad_alloc&)
- {
- HLTError("Could not allocate more memory for the tracker component.");
- return -ENOMEM;
- }
- 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};
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 (ArgumentAlreadyHandled(i, argv[i])) continue;
+
if (strcmp( argv[i], "-zmiddle" ) == 0)
{
if (not fCanLoadZmiddle)
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;
}
HLTError("Cannot convert '%s' to a valid floating point number.",
argv[i+1]
);
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
if ( argc <= i+1 )
{
HLTError("The magnetic field integral was not specified." );
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
HLTError("Cannot convert '%s' to a valid floating point number.",
argv[i+1]
);
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
if ( argc <= i+1 )
{
HLTError("The region of interest parameter was not specified." );
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
HLTError("Cannot convert '%s' to a valid floating point number.",
argv[i+1]
);
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
if ( argc <= i+1 )
{
HLTError("The region of interest parameter was not specified." );
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
HLTError("Cannot convert '%s' to a valid floating point number.",
argv[i+1]
);
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
if ( argc <= i+1 )
{
HLTError("The region of interest parameter was not specified." );
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
HLTError("Cannot convert '%s' to a valid floating point number.",
argv[i+1]
);
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
continue;
}
- if (strcmp( argv[i], "-delaysetup" ) == 0)
- {
- fDelaySetup = true;
- continue;
- }
-
if (strcmp(argv[i], "-warn_on_unexpected_block") == 0)
{
fWarnForUnexpecedBlock = true;
}
HLTError("Unknown option '%s'.", argv[i]);
- FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
return -EINVAL;
}
- if (cdbPath != NULL or run != -1)
+ try
{
- 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;
- }
+ fTracker = new AliHLTMUONMansoTrackerFSM();
+ }
+ catch (const std::bad_alloc&)
+ {
+ HLTError("Could not allocate more memory for the tracker component.");
+ return -ENOMEM;
}
+ fTracker->SetCallback(this);
// Set all the parameters that were found on the command line.
if (not fCanLoadZmiddle) AliHLTMUONCalculations::Zf(zmiddle);
if (not fCanLoadZ[4]) fTracker->SetZ11(chamberZ[4]);
if (not fCanLoadZ[5]) fTracker->SetZ13(chamberZ[5]);
- if (not fDelaySetup)
+ if (not DelaySetup())
{
if (AtLeastOneCanLoadFlagsIsSet())
{
int AliHLTMUONMansoTrackerFSMComponent::DoEvent(
const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& /*trigData*/,
+ AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
)
{
///
// Initialise the configuration parameters from CDB if we were
// requested to initialise only when the first event was received.
- if (fDelaySetup)
+ if (DelaySetup())
{
// Load the configuration paramters from CDB if they have not
// been given on the command line.
if (result != 0) return result;
}
- fDelaySetup = false;
+ DoneDelayedSetup();
ResetCanLoadFlags(); // From this point read all parameters from CDB.
}
{
fRecHitBlock[i] = NULL;
}
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
return -ENOMEM;
}
// Only set the arrays' size once we have successfully allocated the memory for the arrays.
"The buffer is only %d bytes in size. We need a minimum of %d bytes.",
size, sizeof(AliHLTMUONMansoTracksBlockWriter::HeaderType)
);
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
size = 0; // Important to tell framework that nothing was generated.
return -ENOBUFS;
}
specification |= blocks[n].fSpecification;
AliHLTMUONRecHitsBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
+ continue;
+ }
if (inblock.Nentries() != 0)
AddRecHits(blocks[n].fSpecification, inblock.GetArray(), inblock.Nentries());
continue;
AliHLTMUONTriggerRecordsBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
+ continue;
+ }
DebugTrace("Processing a trigger block with "
<< inblock.Nentries() << " entries."
#include "AliHLTMUONProcessor.h"
#include "AliHLTMUONDataTypes.h"
#include "AliHLTMUONMansoTrackerFSMCallback.h"
-#include <vector>
#if __GNUC__ && __GNUC__ < 3
#define std
// Public functions to implement the AliHLTProcessor interface.
// These functions are required for the registration process.
virtual const char* GetComponentID();
- virtual void GetInputDataTypes(std::vector<AliHLTComponentDataType>& list);
+ virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
virtual AliHLTComponentDataType GetOutputDataType();
virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
virtual AliHLTComponent* Spawn();
AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
);
using AliHLTProcessor::DoEvent;
// 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 fDelaySetup; ///< Indicates if the component should delay loading and initialising from the CDB to the start of run event.
-
+ bool fWarnForUnexpecedBlock; ///< Flag indicating if we should log a warning if we got a block of an unexpected type.
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.
fWarnForUnexpecedBlock(false),
fStopOnOverflow(false),
fUseCrateId(true),
- fDelaySetup(false),
fZmiddleSpecified(false),
fBLSpecified(false),
fLutInitialised(false)
}
-void AliHLTMUONTriggerReconstructorComponent::GetInputDataTypes( std::vector<AliHLTComponentDataType>& list)
+void AliHLTMUONTriggerReconstructorComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
{
///
/// Inherited from AliHLTProcessor. Returns the list of expected input data types.
/// Parses the command line parameters and initialises the component.
///
- // perform initialization.
-
HLTInfo("Initialising dHLT trigger reconstructor component.");
+ // Inherit the parents functionality.
+ int result = AliHLTMUONProcessor::DoInit(argc, argv);
+ if (result != 0) return result;
+
// Make sure to cleanup fTrigRec if it is still there for some reason.
if (fTrigRec != NULL)
{
fTrigRec = NULL;
}
- try
- {
- fTrigRec = new AliHLTMUONTriggerReconstructor();
- }
- catch (const std::bad_alloc&)
- {
- HLTError("Could not allocate more memory for the trigger reconstructor component.");
- return -ENOMEM;
- }
-
fDDL = -1;
fWarnForUnexpecedBlock = false;
fStopOnOverflow = false;
fUseCrateId = true;
- fDelaySetup = false;
fZmiddleSpecified = false;
fBLSpecified = false;
fLutInitialised = false;
const char* lutFileName = NULL;
- const char* cdbPath = NULL;
- Int_t run = -1;
bool useCDB = false;
bool suppressPartialTrigs = true;
bool tryRecover = false;
for (int i = 0; i < argc; i++)
{
+ // To keep the legacy behaviour we need to have the following check
+ // for -cdbpath here, before ArgumentAlreadyHandled.
+ if (strcmp(argv[i], "-cdbpath") == 0)
+ {
+ useCDB = true;
+ }
+
+ if (ArgumentAlreadyHandled(i, argv[i])) continue;
+
if (strcmp( argv[i], "-lut" ) == 0)
{
if (lutFileName != NULL)
if ( argc <= i+1 )
{
HLTError("The lookup table filename was not specified." );
- // Make sure to delete fTrigRec to avoid partial initialisation.
- delete fTrigRec;
- fTrigRec = NULL;
return -EINVAL;
}
if ( argc <= i+1 )
{
- HLTError("DDL number not specified. It must be in the range [21..22]" );
- // Make sure to delete fTrigRec to avoid partial initialisation.
- delete fTrigRec;
- fTrigRec = NULL;
+ HLTError("DDL number not specified. It must be in the range [21..22]");
return -EINVAL;
}
if (cpErr == NULL or *cpErr != '\0')
{
HLTError("Cannot convert '%s' to a DDL Number.", argv[i+1]);
- // Make sure to delete fTrigRec to avoid partial initialisation.
- delete fTrigRec;
- fTrigRec = NULL;
return -EINVAL;
}
if (num < 21 or 22 < num)
{
HLTError("The DDL number must be in the range [21..22].");
- // Make sure to delete fTrigRec to avoid partial initialisation.
- delete fTrigRec;
- fTrigRec = NULL;
return -EINVAL;
}
fDDL = num - 1; // Convert to DDL number in the range 0..21
if ( argc <= i+1 )
{
- HLTError("DDL equipment ID number not specified. It must be in the range [2816..2817]" );
- // Make sure to delete fTrigRec to avoid partial initialisation.
- delete fTrigRec;
- fTrigRec = NULL;
+ HLTError("DDL equipment ID number not specified. It must be in the range [2816..2817]");
return -EINVAL;
}
if (cpErr == NULL or *cpErr != '\0')
{
HLTError("Cannot convert '%s' to a DDL equipment ID Number.", argv[i+1]);
- // Make sure to delete fTrigRec to avoid partial initialisation.
- delete fTrigRec;
- fTrigRec = NULL;
return -EINVAL;
}
fDDL = AliHLTMUONUtils::EquipIdToDDLNumber(num); // Convert to DDL number in the range 0..21
if (fDDL < 20 or 21 < fDDL)
{
HLTError("The DDL equipment ID number must be in the range [2816..2817].");
- // Make sure to delete fTrigRec to avoid partial initialisation.
- delete fTrigRec;
- fTrigRec = NULL;
return -EINVAL;
}
useCDB = true;
continue;
}
-
- 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." );
- // Make sure to delete fTrigRec to avoid partial initialisation.
- delete fTrigRec;
- fTrigRec = NULL;
- return -EINVAL;
- }
- cdbPath = argv[i+1];
- useCDB = true;
- 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." );
- // Make sure to delete fTrigRec to avoid partial initialisation.
- delete fTrigRec;
- fTrigRec = NULL;
- 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]
- );
- // Make sure to delete fTrigRec to avoid partial initialisation.
- delete fTrigRec;
- fTrigRec = NULL;
- return -EINVAL;
- }
-
- i++;
- continue;
- }
if (strcmp( argv[i], "-zmiddle" ) == 0)
{
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;
+ HLTError("The Z coordinate for the middle of the dipole was not specified.");
return -EINVAL;
}
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;
}
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;
}
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;
}
continue;
}
- if (strcmp( argv[i], "-delaysetup" ) == 0)
- {
- fDelaySetup = true;
- continue;
- }
-
if (strcmp( argv[i], "-warn_on_unexpected_block" ) == 0)
{
fWarnForUnexpecedBlock = true;
continue;
}
- HLTError("Unknown option '%s'.", argv[i] );
- // Make sure to delete fTrigRec to avoid partial initialisation.
- delete fTrigRec;
- fTrigRec = NULL;
+ HLTError("Unknown option '%s'.", argv[i]);
return -EINVAL;
} // for loop
+ try
+ {
+ fTrigRec = new AliHLTMUONTriggerReconstructor();
+ }
+ catch (const std::bad_alloc&)
+ {
+ HLTError("Could not allocate more memory for the trigger reconstructor component.");
+ return -ENOMEM;
+ }
+
if (fZmiddleSpecified and useCDB)
{
HLTWarning("The -cdb or -cdbpath parameter was specified, which indicates that"
if (lutFileName == NULL) useCDB = true;
- if (fDDL == -1 and not fDelaySetup)
+ if (fDDL == -1 and not DelaySetup())
{
HLTWarning("DDL number not specified. Cannot check if incomming data is valid.");
}
- if (cdbPath != NULL or run != -1)
- {
- 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 (useCDB)
{
- if (not fDelaySetup)
+ if (not DelaySetup())
{
HLTInfo("Loading lookup table information from CDB for DDL %d (ID = %d).",
fDDL+1, AliHLTMUONUtils::DDLNumberToEquipId(fDDL)
if (fZmiddleSpecified) AliHLTMUONCalculations::Zf(zmiddle);
if (fBLSpecified) AliHLTMUONCalculations::QBL(bfieldintegral);
- if (not fDelaySetup)
+ if (not DelaySetup())
{
if (not fZmiddleSpecified or not fBLSpecified)
{
int AliHLTMUONTriggerReconstructorComponent::DoEvent(
const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& /*trigData*/,
+ AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
)
{
///
// Initialise the LUT and configuration parameters from CDB if we were
// requested to initialise only when the first event was received.
- if (fDelaySetup)
+ if (DelaySetup())
{
// Use the specification given by the first data block if we
// have not been given a DDL number on the command line.
if (result != 0) return result;
}
- fDelaySetup = false;
+ DoneDelayedSetup();
}
// Process an event
if (not runOk)
{
HLTError("Error while processing the trigger DDL reconstruction algorithm.");
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
if (not fTrigRec->OverflowedOutputBuffer()
or (fTrigRec->OverflowedOutputBuffer() and fStopOnOverflow)
)
// These functions are required for the registration process
virtual const char* GetComponentID();
- virtual void GetInputDataTypes( std::vector<AliHLTComponentDataType>& list);
+ virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
virtual AliHLTComponentDataType GetOutputDataType();
virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
virtual AliHLTComponent* Spawn();
AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
);
using AliHLTProcessor::DoEvent;
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.
}
-void AliHLTMUONDataCheckerComponent::GetInputDataTypes( std::vector<AliHLTComponentDataType>& list)
+void AliHLTMUONDataCheckerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
{
/// Inherited from AliHLTProcessor. Returns the list of expected input data types.
/// At the moment this list is "any data type" since it is not known before
/// Parses the command line parameters and initialises the component.
HLTInfo("Initialising dHLT data checker component.");
+
+ // Inherit the parents functionality.
+ int result = AliHLTMUONProcessor::DoInit(argc, argv);
+ if (result != 0) return result;
// Initialise flags with default values.
fIgnoreType = false;
for (int i = 0; i < argc; i++)
{
+ if (ArgumentAlreadyHandled(i, argv[i])) continue;
+
if (strcmp(argv[i], "-ignoretype") == 0)
{
fIgnoreType = true;
int AliHLTMUONDataCheckerComponent::DoEvent(
const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& /*trigData*/,
+ AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* /*outputPtr*/,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
)
{
/// Inherited from AliHLTProcessor. Processes the new event data.
// Finally we set the total size of output memory we consumed, which is
// zero since we just copied the input descriptors to output if anything.
size = 0;
+
+ if (dataProblems and DumpDataOnError()) DumpEvent(evtData, trigData);
if (fReturnError)
{
// These functions are required for the component registration process.
virtual const char* GetComponentID();
- virtual void GetInputDataTypes(std::vector<AliHLTComponentDataType>& list);
+ virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
virtual AliHLTComponentDataType GetOutputDataType();
- virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+ virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
virtual AliHLTComponent* Spawn();
protected:
AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
);
using AliHLTProcessor::DoEvent;
}
-void AliHLTMUONEmptyEventFilterComponent::GetInputDataTypes( std::vector<AliHLTComponentDataType>& list)
+void AliHLTMUONEmptyEventFilterComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
{
///
/// Inherited from AliHLTProcessor. Returns the list of expected input data types.
}
+bool AliHLTMUONEmptyEventFilterComponent::IgnoreArgument(const char* arg) const
+{
+ /// Return true if the argument is one of -cdbpath -run or -delaysetup
+ /// to prevent the parent class from parsing these arguments in DoInit.
+
+ if (strcmp(arg, "-cdbpath") == 0 or strcmp(arg, "-run") != 0 or
+ strcmp(arg, "-delaysetup") != 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
int AliHLTMUONEmptyEventFilterComponent::DoInit(int argc, const char** argv)
{
///
/// Parses the command line parameters and initialises the component.
///
+ HLTInfo("Initialising dHLT event filter component.");
+
+ // Inherit the parents functionality.
+ int result = AliHLTMUONProcessor::DoInit(argc, argv);
+ if (result != 0) return result;
+
fSendOnEmpty = false; // Set to the default value.
for (int i = 0; i < argc; i++)
{
+ if (ArgumentAlreadyHandled(i, argv[i])) continue;
+
if (strcmp(argv[i], "-sendempty") == 0)
{
fSendOnEmpty = true;
///
/// Inherited from AliHLTComponent. Performs a cleanup of the component.
///
+
+ HLTInfo("Deinitialising dHLT event filter component.");
return 0;
}
int AliHLTMUONEmptyEventFilterComponent::DoEvent(
const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& /*trigData*/,
- AliHLTUInt8_t* /*outputPtr*/,
+ AliHLTComponentTriggerData& trigData,
+ AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
)
{
/// Inherited from AliHLTProcessor. Processes the new event data.
if (blocks[n].fDataType == AliHLTMUONConstants::TriggerRecordsBlockDataType())
{
AliHLTMUONTriggerRecordsBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
+ continue;
+ }
if (inblock.Nentries() != 0) emptyEvent = false;
}
else if (blocks[n].fDataType == AliHLTMUONConstants::RecHitsBlockDataType())
{
AliHLTMUONRecHitsBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
+ continue;
+ }
if (inblock.Nentries() != 0) emptyEvent = false;
}
else if (blocks[n].fDataType == AliHLTMUONConstants::MansoTracksBlockDataType())
{
AliHLTMUONMansoTracksBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
+ continue;
+ }
if (inblock.Nentries() != 0) emptyEvent = false;
}
else if (blocks[n].fDataType == AliHLTMUONConstants::SinglesDecisionBlockDataType())
{
AliHLTMUONSinglesDecisionBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
+ continue;
+ }
if (inblock.Nentries() != 0) emptyEvent = false;
}
else if (blocks[n].fDataType == AliHLTMUONConstants::PairsDecisionBlockDataType())
{
AliHLTMUONPairsDecisionBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
- if (not BlockStructureOk(inblock)) continue;
+ if (not BlockStructureOk(inblock))
+ {
+ if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
+ continue;
+ }
if (inblock.Nentries() != 0) emptyEvent = false;
}
}
// These functions are required for the registration process.
virtual const char* GetComponentID();
- virtual void GetInputDataTypes(std::vector<AliHLTComponentDataType>& list);
+ virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
virtual AliHLTComponentDataType GetOutputDataType();
- virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+ virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
virtual AliHLTComponent* Spawn();
protected:
AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- std::vector<AliHLTComponentBlockData>& outputBlocks
+ AliHLTComponentBlockDataList& outputBlocks
);
+ virtual bool IgnoreArgument(const char* arg) const;
using AliHLTProcessor::DoEvent;
return NULL;
}
+namespace
+{
+ // CDB path and run number to use.
+ const char* gCDBPath = "local://$ALICE_ROOT";
+ Int_t gRunNumber = 0;
+}
+
/**
* Performs basic data integrity checks of the data block using the
* AliHLTMUONDataCheckerComponent.
sys.SetGlobalLoggingLevel(AliHLTComponentLogSeverity(level));
}
- // Check if required libraries are there and load them if not.
- if (gClassTable->GetID("AliHLTAgentUtil") < 0)
- {
- sys.LoadComponentLibraries("libAliHLTUtil.so");
- }
- if (gClassTable->GetID("AliHLTMUONAgent") < 0)
- {
- sys.LoadComponentLibraries("libAliHLTMUON.so");
- }
+ sys.LoadComponentLibraries("libAliHLTUtil.so");
+ sys.LoadComponentLibraries("libAliHLTMUON.so");
// Setup the component parameter lists and then the components.
- TString dcparams = "-return_error -warn_on_unexpected_block -no_global_check";
+ TString dcparams = "-return_error -warn_on_unexpected_block -no_global_check -cdbpath ";
+ dcparams += gCDBPath;
+ dcparams += " -run ";
+ dcparams += gRunNumber;
TString fpparams = "-datatype '";
fpparams += TypeToString(type);
fpparams += "' 'MUON'";
{
std::ostream& os = asError ? cerr : cout;
os << "Usage: dHLTdumpraw [-help|-h] [-continue|-c] [-type|-t <typename>] [-check|-k]" << endl;
- os << " [-debug|-d] [-dataspec|-s <number>] <filename> [<filename> ...]" << endl;
+ os << " [-debug|-d] [-dataspec|-s <number>] [-cdbpath|-p <url>] [-run|-r <number>]" << endl;
+ os << " <filename> [<filename> ...]" << endl;
os << "Where <filename> is the name of a file containing a raw data block." << endl;
os << "Options:" << endl;
os << " -help | -h" << endl;
os << " -dataspec | -s <number>" << endl;
os << " When specified, then <number> is used as the data specification for the" << endl;
os << " data file that follows. This option is only useful with the -check|-k option." << endl;
+ os << " -cdbpath | -p <url>" << endl;
+ os << " The path to the CDB to use when running with the -check | -k option." << endl;
+ os << " -run | -r <number>" << endl;
+ os << " The run number to use when running with the -check | -k option." << endl;
}
/**
checkData = false;
int currentType = kUnknownDataBlock;
const char* currentDataSpec = NULL;
+ bool pathSet = false;
+ bool runSet = false;
// Parse the command line.
for (int i = 1; i < argc; i++)
}
currentDataSpec = argv[i];
}
+ else if (strcmp(argv[i], "-cdbpath") == 0 or strcmp(argv[i], "-p") == 0)
+ {
+ if (pathSet)
+ {
+ cerr << "WARNING: Already used -cdbpath|-p with '" << gCDBPath
+ << "' before. Will override it with the last value specified with -cdbpath|-p."
+ << endl;
+ }
+ if (++i >= argc)
+ {
+ cerr << "ERROR: Missing the URL for the CDB path." << endl << endl;
+ PrintUsage();
+ return CMDLINE_ERROR;
+ }
+ gCDBPath = argv[i];
+ pathSet = true;
+ }
+ else if (strcmp(argv[i], "-run") == 0 or strcmp(argv[i], "-r") == 0)
+ {
+ if (runSet)
+ {
+ cerr << "WARNING: Already used -run|-r with " << gRunNumber
+ << " before. Will override it with the last value specified with -run|-r."
+ << endl;
+ }
+ if (++i >= argc)
+ {
+ cerr << "ERROR: Missing the run number." << endl << endl;
+ PrintUsage();
+ return CMDLINE_ERROR;
+ }
+
+ char* cpErr = NULL;
+ Int_t run = Int_t( strtol(argv[i], &cpErr, 0) );
+ if (cpErr == NULL or *cpErr != '\0' or run < 0)
+ {
+ cerr << "ERROR: Cannot convert '" << argv[i] << "' to a valid run number."
+ " Expected a positive integer value." << endl;
+ return CMDLINE_ERROR;
+ }
+
+ gRunNumber = run;
+ runSet = true;
+ }
else
{
assert( numOfFiles < argc );
#define FATAL_ERROR 4
#define HLTSYSTEM_ERROR 5
+namespace
+{
+ // CDB path and run number to use.
+ const char* gCDBPath = "local://$ALICE_ROOT";
+ Int_t gRunNumber = 0;
+}
/**
* Uses AliHLTSystem and the AliHLTMUONRootifierComponent to convert the files
sys.SetGlobalLoggingLevel(kHLTLogAll);
}
- // Check if required libraries are there and load them if not.
- if (gClassTable->GetID("AliHLTAgentUtil") < 0)
- {
- sys.LoadComponentLibraries("libAliHLTUtil.so");
- }
- if (gClassTable->GetID("AliHLTMUONAgent") < 0)
- {
- sys.LoadComponentLibraries("libAliHLTMUON.so");
- }
+ sys.LoadComponentLibraries("libAliHLTUtil.so");
+ sys.LoadComponentLibraries("libAliHLTMUON.so");
TString sources = "";
typedef AliHLTConfiguration* PAliHLTConfiguration;
// Setup the component for data integrity checking.
if (checkData)
{
+ TString dcparams = "-warn_on_unexpected_block -ignorespec -cdbpath ";
+ dcparams += gCDBPath;
+ dcparams += " -run ";
+ dcparams += gRunNumber;
AliHLTConfiguration checker(
"checker", AliHLTMUONConstants::DataCheckerComponentId(),
- sources, "-warn_on_unexpected_block -ignorespec"
+ sources, dcparams
);
sources = "checker";
}
{
std::ostream& os = asError ? cerr : cout;
os << "Usage: dHLTrootify [-help|-h] [-outfile|-o <output_file>] [-type|-t <typename>]" << endl;
- os << " [-debug|-d] [-check|-c] <filename> [<filename> ...]" << endl;
+ os << " [-debug|-d] [-check|-c] [-cdbpath|-p <url>] [-run|-r <number>]" << endl;
+ os << " <filename> [<filename> ...]" << endl;
os << "Where <filename> is the name of a file containing a raw data block." << endl;
os << "Options:" << endl;
os << " -help | -h" << endl;
os << " If specified then data integrity checks are performed on the raw data." << endl;
os << " Warnings and errors are printed as problems are found with the data, but" << endl;
os << " the data will still be converted into ROOT objects as best as possible." << endl;
+ os << " -cdbpath | -p <url>" << endl;
+ os << " The path to the CDB to use when running with the -check | -k option." << endl;
+ os << " -run | -r <number>" << endl;
+ os << " The run number to use when running with the -check | -k option." << endl;
}
/**
outputFile = NULL;
maxLogging = false;
checkData = false;
+ bool pathSet = false;
+ bool runSet = false;
AliHLTMUONDataBlockType currentType = kUnknownDataBlock;
// Parse the command line.
}
else if (strcmp(argv[i], "-outfile") == 0 or strcmp(argv[i], "-o") == 0)
{
+ if (outputFile != NULL)
+ {
+ cerr << "WARNING: Already used -outfile|-o with " << outputFile
+ << " before. Will override it with the last value specified with -outfile|-o."
+ << endl;
+ }
if (++i >= argc)
{
cerr << "ERROR: Missing an output filename." << endl << endl;
{
checkData = true;
}
+ else if (strcmp(argv[i], "-cdbpath") == 0 or strcmp(argv[i], "-p") == 0)
+ {
+ if (pathSet)
+ {
+ cerr << "WARNING: Already used -cdbpath|-p with '" << gCDBPath
+ << "' before. Will override it with the last value specified with -cdbpath|-p."
+ << endl;
+ }
+ if (++i >= argc)
+ {
+ cerr << "ERROR: Missing the URL for the CDB path." << endl << endl;
+ PrintUsage();
+ return CMDLINE_ERROR;
+ }
+ gCDBPath = argv[i];
+ pathSet = true;
+ }
+ else if (strcmp(argv[i], "-run") == 0 or strcmp(argv[i], "-r") == 0)
+ {
+ if (runSet)
+ {
+ cerr << "WARNING: Already used -run|-r with " << gRunNumber
+ << " before. Will override it with the last value specified with -run|-r."
+ << endl;
+ }
+ if (++i >= argc)
+ {
+ cerr << "ERROR: Missing the run number." << endl << endl;
+ PrintUsage();
+ return CMDLINE_ERROR;
+ }
+
+ char* cpErr = NULL;
+ Int_t run = Int_t( strtol(argv[i], &cpErr, 0) );
+ if (cpErr == NULL or *cpErr != '\0' or run < 0)
+ {
+ cerr << "ERROR: Cannot convert '" << argv[i] << "' to a valid run number."
+ " Expected a positive integer value." << endl;
+ return CMDLINE_ERROR;
+ }
+
+ gRunNumber = run;
+ runSet = true;
+ }
else
{
assert( numOfFiles < argc );