* provided "as is" without express or implied warranty. *
**************************************************************************/
-/* $Id$ */
+// $Id$
///
/// @file AliHLTMUONTriggerReconstructorComponent.cxx
#include "AliHLTMUONUtils.h"
#include "AliHLTMUONDataBlockWriter.h"
#include "AliRawDataHeader.h"
+#include "AliHLTCDHWrapper.h"
#include "AliCDBManager.h"
#include "AliCDBStorage.h"
#include "AliGeomManager.h"
AliHLTComponentDataType AliHLTMUONTriggerReconstructorComponent::GetOutputDataType()
{
///
- /// Inherited from AliHLTComponent. Returns the output data type.
+ /// Inherited from AliHLTComponent. Returns kAliHLTMultipleDataType.
///
- return AliHLTMUONConstants::TriggerRecordsBlockDataType();
+ return kAliHLTMultipleDataType;
+}
+
+
+int AliHLTMUONTriggerReconstructorComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& list)
+{
+ /// Inherited from AliHLTComponent. Returns the output data types.
+
+ assert( list.empty() );
+ list.push_back( AliHLTMUONConstants::TriggerRecordsBlockDataType() );
+ list.push_back( AliHLTMUONConstants::TrigRecsDebugBlockDataType() );
+ return list.size();
}
/// Inherited from AliHLTComponent. Returns an estimate of the expected output data size.
///
- constBase = sizeof(AliHLTMUONTriggerRecordsBlockWriter::HeaderType);
+ constBase = sizeof(AliHLTMUONTriggerRecordsBlockWriter::HeaderType) + 1024*1024;
inputMultiplier = 4;
}
bool suppressPartialTrigs = true;
bool tryRecover = false;
bool useLocalId = true;
+ bool makeDebugInfo = false;
+ bool dontPrintWrongEventError = false;
double zmiddle = 0;
double bfieldintegral = 0;
continue;
}
+ if (strcmp( argv[i], "-makedebuginfo" ) == 0)
+ {
+ makeDebugInfo = true;
+ continue;
+ }
+
+ if (strcmp( argv[i], "-dontprintwrongeventerror" ) == 0)
+ {
+ dontPrintWrongEventError = true;
+ continue;
+ }
+
HLTError("Unknown option '%s'.", argv[i]);
return -EINVAL;
fTrigRec->TryRecover(tryRecover);
fTrigRec->UseCrateId(fUseCrateId);
fTrigRec->UseLocalId(useLocalId);
+ fTrigRec->StoreDebugInfo(makeDebugInfo);
+ fTrigRec->DontPrintWrongEventError(dontPrintWrongEventError);
return 0;
}
if (not block.InitCommonHeader())
{
HLTError("There is not enough space in the output buffer for the new data block."
- " We require at least %ufTrigRec->GetkDDLHeaderSize() bytes, but have %u bytes left.",
+ " We require at least %u bytes, but have %u bytes left.",
sizeof(AliHLTMUONTriggerRecordsBlockWriter::HeaderType),
block.BufferSize()
);
}
AliHLTUInt32_t totalDDLSize = blocks[n].fSize;
- if (totalDDLSize < sizeof(AliRawDataHeader))
+ AliHLTCDHWrapper header(blocks[n].fPtr);
+ if (totalDDLSize < sizeof(AliRawDataHeader) &&
+ totalDDLSize < header.GetHeaderSize()) // if cdh v3
{
HLTError("Raw data block %d is %d bytes in size and is too short to"
- " possibly contain valid DDL raw data. We expect it to have"
- " at least %d bytes for the commond data header.",
- n, totalDDLSize, sizeof(AliRawDataHeader)
+ " possibly contain valid DDL raw data.",
+ n, totalDDLSize
);
continue;
}
- AliRawDataHeader* header = reinterpret_cast<AliRawDataHeader*>(blocks[n].fPtr);
- AliHLTUInt32_t payloadSize = totalDDLSize - sizeof(AliRawDataHeader);
- AliHLTUInt8_t* buffer = reinterpret_cast<AliHLTUInt8_t*>(header + 1);
+ AliHLTUInt32_t payloadSize = totalDDLSize - header.GetHeaderSize();
+ AliHLTUInt8_t* buffer = reinterpret_cast<AliHLTUInt8_t*>(blocks[n].fPtr);
+ buffer += header.GetHeaderSize();
AliHLTUInt32_t nofTrigRec = block.MaxNumberOfEntries();
// Decode if this is a scalar event or not.
- bool scalarEvent = ((header->GetL1TriggerMessage() & 0x1) == 0x1);
+ bool scalarEvent = ((header.GetL1TriggerMessage() & 0x1) == 0x1);
// Remember: the following does NOT change the mapping!
// It is just to generate unique trigger record IDs.
outputBlocks.push_back(bd);
HLTDebug("Created a new output data block at fPtr = %p,"
- " with fOffset = %u (0x%.X) and fSize = %u bytes.",
+ " with fOffset = %u (0x%.X) and fSize = %u bytes.",
bd.fPtr, bd.fOffset, bd.fOffset, bd.fSize
);
// Increase the total amount of data written so far to our output memory.
totalSize += block.BytesUsed();
+
+ if (fTrigRec->StoreDebugInfo())
+ {
+ // Create a new output data block and initialise the header.
+ AliHLTMUONTrigRecsDebugBlockWriter infoblock(outputPtr+totalSize, size-totalSize);
+ if (not infoblock.InitCommonHeader())
+ {
+ HLTError("There is not enough space in the output buffer for the new debug"
+ " data block. We require at least %u bytes, but have %u bytes left.",
+ sizeof(AliHLTMUONTrigRecsDebugBlockWriter::HeaderType),
+ infoblock.BufferSize()
+ );
+ break;
+ }
+
+ infoblock.SetNumberOfEntries(fTrigRec->InfoBufferCount());
+ for (AliHLTUInt32_t i = 0; i < fTrigRec->InfoBufferCount(); ++i)
+ {
+ infoblock[i] = fTrigRec->InfoBuffer()[i];
+ }
+ fTrigRec->ZeroInfoBuffer();
+
+ // Fill the block data structure for our output block.
+ AliHLTComponentBlockData bd2;
+ FillBlockData(bd2);
+ bd2.fPtr = outputPtr;
+ // This block's start (offset) is after all other blocks written so far.
+ bd2.fOffset = totalSize;
+ bd2.fSize = infoblock.BytesUsed();
+ bd2.fDataType = AliHLTMUONConstants::TrigRecsDebugBlockDataType();
+ bd2.fSpecification = blocks[n].fSpecification;
+ outputBlocks.push_back(bd2);
+
+ HLTDebug("Created a new output data block for debug information at fPtr = %p,"
+ " with fOffset = %u (0x%.X) and fSize = %u bytes.",
+ bd2.fPtr, bd2.fOffset, bd2.fOffset, bd2.fSize
+ );
+
+ // Increase the total amount of data written so far to our output memory.
+ totalSize += infoblock.BytesUsed();
+ }
}
// Finally we set the total size of output memory we consumed.
/// "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;
+ TString path = cdbEntry;
+ bool startsWithMUON = path.Index("MUON/", 5, 0, TString::kExact) == 0;
+ bool givenConfigPath = (path == AliHLTMUONConstants::TriggerReconstructorCDBPath());
if (cdbEntry == NULL or startsWithMUON or givenConfigPath)
{
if (setBL)
{
- result = GetFloatFromTMap(map, "bfieldintegral", value, pathToEntry, "integrated magnetic field");
- if (result != 0) return result;
- AliHLTMUONCalculations::QBL(value);
+ Double_t bfieldintegral;
+ result = FetchFieldIntegral(bfieldintegral);
+ if (result == 0)
+ {
+ AliHLTMUONCalculations::QBL(bfieldintegral);
+ }
+ else
+ {
+ HLTWarning("Failed to load the magnetic field integral from GRP information.");
+ result = GetFloatFromTMap(map, "bfieldintegral", value, pathToEntry, "integrated magnetic field");
+ if (result != 0) return result;
+ HLTWarning(Form("Using deprecated magnetic field integral value of %f T.m.", value));
+ AliHLTMUONCalculations::QBL(value);
+ }
}
HLTDebug("Using the following configuration parameters:");
Int_t offset = 0;
if (iCathode && localBoard->GetSwitch(6)) offset = -8;
+// just use this switch for simplicity for two different but shortly after each other applied changes
+#ifndef HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
+ AliMpPad pad = seg->PadByLocation(boardId, bitxy+offset, kFALSE);
+#else // old AliMpPad functionality < r 31742
AliMpPad pad = seg->PadByLocation(AliMpIntPair(boardId, bitxy+offset), kFALSE);
+#endif //HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
if (! pad.IsValid())
{
}
// Get the global coodinates of the pad.
+#ifndef HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
+ Float_t lx = pad.GetPositionX();
+ Float_t ly = pad.GetPositionY();
+#else // old AliMpPad functionality < r 31769
Float_t lx = pad.Position().X();
Float_t ly = pad.Position().Y();
+#endif //HAVE_NOT_MUON_ALIMPPAD_GETPOSITION
Float_t gx, gy, gz;
detElemTransform->Local2Global(lx, ly, 0, gx, gy, gz);
/// @return True if the generation of the LUT file succeeded.
AliHLTMUONTriggerReconstructorComponent comp;
-
- if (ddl < 20 or 21 < ddl)
+ try
{
- std::cerr << "ERROR: the DDL number must be in the range [20..21]." << std::endl;
- return false;
+ // Perform minimal initialisation to be able to fill the LUT buffer.
+ comp.fTrigRec = new AliHLTMUONTriggerReconstructor();
}
-
- char ddlNum[32];
- char runNum[32];
- sprintf(ddlNum, "%d", ddl+1);
- sprintf(runNum, "%d", run);
- int argc = 7;
- const char* argv[8] = {"-ddl", ddlNum, "-cdbpath", cdbPath, "-run", runNum, "-dont_use_crateid", NULL};
- if (useCrateId)
+ catch (const std::bad_alloc&)
{
- argv[6] = NULL;
- argc--;
+ std::cerr << "ERROR: Could not allocate more memory for the trigger reconstructor component." << std::endl;
+ return false;
}
- int result = comp.DoInit(argc, argv);
- if (result != 0)
+
+ if (ddl < 20 or 21 < ddl)
{
- // Error message already generated in DoInit.
+ std::cerr << "ERROR: the DDL number must be in the range [20..21]." << std::endl;
return false;
}
+ comp.fDDL = ddl;
+ comp.fUseCrateId = useCrateId;
+ if (comp.SetCDBPathAndRunNo(cdbPath, run) != 0) return false;
+ if (comp.ReadLutFromCDB() != 0) return false;
+
std::fstream file(filename, std::ios::out);
if (not file)
{
}
file.close();
- comp.DoDeinit();
-
return true;
}