#include "AliGeomManager.h"
#include "AliTRDReconstructor.h"
#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
#include "AliHLTTRDClusterizer.h"
#include "AliTRDrecoParam.h"
#include "AliTRDrawStreamBase.h"
#ifdef HAVE_VALGRIND_CALLGRIND_H
#include <valgrind/callgrind.h>
#else
-#define CALLGRIND_START_INSTRUMENTATION() do { } while (0)
-#define CALLGRIND_STOP_INSTRUMENTATION() do { } while (0)
+#define CALLGRIND_START_INSTRUMENTATION do { } while (0)
+#define CALLGRIND_STOP_INSTRUMENTATION do { } while (0)
#endif
#include <cstdlib>
#include <cerrno>
#include <string>
-ClassImp(AliHLTTRDClusterizerComponent);
+ClassImp(AliHLTTRDClusterizerComponent)
AliHLTTRDClusterizerComponent::AliHLTTRDClusterizerComponent():
AliHLTProcessor(),
- fOutputPercentage(100), // By default we copy to the output exactly what we got as input
- fStrorageDBpath("local://$ALICE_ROOT/OCDB"),
+ fOutputPercentage(500),
+ fOutputConst(0),
fClusterizer(NULL),
fRecoParam(NULL),
- fCDB(NULL),
fMemReader(NULL),
- fReconstructor(NULL),
- fGeometryFileName("")
+ fReconstructor(NULL)
{
// Default constructor
- fGeometryFileName = getenv("ALICE_ROOT");
- fGeometryFileName += "/HLT/TRD/geometry.root";
}
AliHLTTRDClusterizerComponent::~AliHLTTRDClusterizerComponent()
{
// Get the list of input data
list.clear(); // We do not have any requirements for our input data type(s).
- list.push_back( AliHLTTRDDefinitions::fgkDDLRawDataType );
+ list.push_back( (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD) );
}
AliHLTComponent_DataType AliHLTTRDClusterizerComponent::GetOutputDataType()
{
// Get the output data type
- return AliHLTTRDDefinitions::fgkClusterDataType;
+ return kAliHLTMultipleDataType;
}
+int AliHLTTRDClusterizerComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
+{
+ // Get the output data type
+ tgtList.clear();
+ tgtList.push_back(AliHLTTRDDefinitions::fgkClusterDataType);
+ tgtList.push_back(AliHLTTRDDefinitions::fgkMCMtrackletDataType);
+ return tgtList.size();
+}
+
+
void AliHLTTRDClusterizerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
{
// Get the output data size
- constBase = 0;
+ constBase = fOutputConst;
inputMultiplier = ((double)fOutputPercentage)/100.0;
}
int AliHLTTRDClusterizerComponent::DoInit( int argc, const char** argv )
{
// perform initialization. We check whether our relative output size is specified in the arguments.
- fOutputPercentage = 100;
Int_t iRawDataVersion = 2;
int i = 0;
char* cpErr;
// the data type will become obsolete as soon as the formats are established
Int_t iRecoDataType = -1; // default will be simulation
+ Int_t iyPosMethod = 1; // 0=COG 1=LUT 2=Gauss
+ Bool_t bProcessTracklets = kFALSE;
+ string geometryFileName = "";
while ( i < argc )
{
HLTError("Cannot convert output_percentage parameter '%s'", argv[i+1] );
return EINVAL;
}
- HLTInfo("Output percentage set to %lu %%", fOutputPercentage );
+ HLTInfo("Output percentage set to %i %%", fOutputPercentage );
i += 2;
}
- else if ( strcmp( argv[i], "-cdb" ) == 0)
- {
- if ( i+1 >= argc )
- {
- HLTError("Missing -cdb argument");
- return ENOTSUP;
- }
- fStrorageDBpath = argv[i+1];
- HLTInfo("DB storage is %s", fStrorageDBpath.c_str() );
- i += 2;
-
- }
-
else if ( strcmp( argv[i], "-lowflux" ) == 0)
{
iRecoParamType = 0;
HLTDebug("Low flux reco selected.");
i++;
-
- }
-
+ }
else if ( strcmp( argv[i], "-highflux" ) == 0)
{
iRecoParamType = 1;
HLTDebug("High flux reco selected.");
i++;
-
- }
-
+ }
else if ( strcmp( argv[i], "-cosmics" ) == 0)
{
iRecoParamType = 2;
HLTDebug("Cosmic test reco selected.");
i++;
-
- }
-
+ }
// raw data type - sim or experiment
else if ( strcmp( argv[i], "-simulation" ) == 0)
{
iRecoDataType = 0;
i++;
-
}
-
else if ( strcmp( argv[i], "-experiment" ) == 0)
{
iRecoDataType = 1;
i++;
-
}
-
else if ( strcmp( argv[i], "-rawver" ) == 0)
{
if ( i+1 >= argc )
HLTError("Missing -geometry argument");
return ENOTSUP;
}
- fGeometryFileName = argv[i+1];
- HLTInfo("GeomFile storage is %s", fGeometryFileName.c_str() );
+ geometryFileName = argv[i+1];
+ HLTInfo("GeomFile storage is %s", geometryFileName.c_str() );
i += 2;
- }
+ }
+ else if ( strcmp( argv[i], "-processTracklets" ) == 0)
+ {
+ bProcessTracklets = kTRUE;
+ i++;
+ }
+ else if ( strcmp( argv[i], "-yPosMethod" ) == 0)
+ {
+ if ( i+1 >= argc )
+ {
+ HLTError("Missing -yPosMethod argument");
+ return ENOTSUP;
+ }
+ if( strcmp(argv[i], "COG") )
+ iyPosMethod=0;
+ else if( strcmp(argv[i], "LUT") )
+ iyPosMethod=1;
+ else if( strcmp(argv[i], "Gauss") )
+ iyPosMethod=2;
+ else {
+ HLTError("Unknown -yPosMethod argument");
+ return ENOTSUP;
+ }
+ i += 2;
+ }
+ else if ( strcmp( argv[i], "-noZS" ) == 0) //no zero surpression in the input data
+ {
+ fOutputPercentage = 100;
+ i++;
+ }
+
else{
HLTError("Unknown option '%s'", argv[i] );
return EINVAL;
// THE "REAL" INIT COMES HERE
- if (iRecoParamType < 0 || iRecoParamType > 2)
+if (iRecoParamType < 0 || iRecoParamType > 2)
{
HLTWarning("No reco param selected. Use -lowflux or -highflux flag. Defaulting to low flux.");
iRecoParamType = 0;
fReconstructor->SetRecoParam(fRecoParam);
fReconstructor->SetStreamLevel(0, AliTRDReconstructor::kClusterizer); // default value
HLTInfo("Not writing clusters. I.e. output is a TClonesArray of clusters");
- fReconstructor->SetOption("hlt,!cw,sl_cf_0");
-
+ TString recoOptions="hlt,!cw,sl_cf_0";
+ switch(iRecoDataType){
+ case 0: recoOptions += ",tc"; break;
+ case 1: recoOptions += ",!tc"; break;
+ }
+ switch(iyPosMethod){
+ case 0: recoOptions += ",!gs,!lut"; break;
+ case 1: recoOptions += ",!gs,lut"; break;
+ case 2: recoOptions += ",gs,!lut"; break;
+ }
+ if(bProcessTracklets) recoOptions += ",tp";
+ else recoOptions += ",!tp";
+
+ HLTInfo("Reconstructor options: %s",recoOptions.Data());
+ fReconstructor->SetOption(recoOptions.Data());
// init the raw data type to be used...
// the switch here will become obsolete as soon as the data structures is fixed
}
// the DATA BASE STUFF
- fCDB = AliCDBManager::Instance();
- if (!fCDB)
- {
- HLTError("Could not get CDB instance", "fCDB 0x%x", fCDB);
- }
- else
- {
- fCDB->SetRun(0); // THIS HAS TO BE RETRIEVED !!!
- fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
- HLTDebug("CDB instance; fCDB 0x%x", fCDB);
- }
-
- if((AliGeomManager::GetGeometry()) == NULL){
-
- if ( TFile::Open(fGeometryFileName.c_str())) {
- AliGeomManager::LoadGeometry(fGeometryFileName.c_str());
+
+ if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
+ HLTError("DefaultStorage is not Set in CDBManager");
+ return -1;
+ }
+ if(AliCDBManager::Instance()->GetRun()<0){
+ AliCDBManager *cdb = AliCDBManager::Instance();
+ if (cdb)
+ {
+ cdb->SetRun(0);
+ HLTWarning("Setting CDB Runnumber to 0. CDB instance 0x%x", cdb);
+ }
+ else
+ {
+ HLTError("Could not get CDB instance", "cdb 0x%x", cdb);
+ return -1;
+ }
+ }
+ HLTInfo("CDB default storage: %s; RunNo: %i", (AliCDBManager::Instance()->GetDefaultStorage()->GetBaseFolder()).Data(), AliCDBManager::Instance()->GetRun());
+
+ if(!AliGeomManager::GetGeometry()){
+ if(!TFile::Open(geometryFileName.c_str())){
+ HLTInfo("Loading standard geometry file");
+ AliGeomManager::LoadGeometry();
+ }else{
+ HLTWarning("Loading non-standard geometry file");
+ AliGeomManager::LoadGeometry(geometryFileName.c_str());
}
- else {
- HLTError("Cannot load geometry from file %s",fGeometryFileName.c_str());
+ if(!AliGeomManager::GetGeometry()){
+ HLTError("Cannot load geometry");
return EINVAL;
}
}
- else
+ else{
HLTInfo("Geometry Already Loaded");
+ }
fMemReader = new AliRawReaderMemory;
fClusterizer = new AliHLTTRDClusterizer("TRDCclusterizer", "TRDCclusterizer");
fClusterizer->SetReconstructor(fReconstructor);
- fClusterizer->SetAddLabels(kFALSE);
+ fClusterizer->SetUseLabels(kFALSE);
fClusterizer->SetRawVersion(iRawDataVersion);
+
+ if(fReconstructor->IsProcessingTracklets())
+ fOutputConst = fClusterizer->GetTrMemBlockSize();
return 0;
}
fReconstructor = 0x0;
return 0;
-
- if (fCDB)
- {
- HLTDebug("destroy fCDB");
- fCDB->Destroy();
- fCDB = 0;
- }
-
if (fRecoParam)
{
HLTDebug("Deleting fRecoParam");
vector<AliHLTComponent_BlockData>& outputBlocks )
{
// Process an event
- HLTDebug( "NofBlocks %lu", evtData.fBlockCnt );
+
+ if (evtData.fEventID == 1)
+ CALLGRIND_START_INSTRUMENTATION;
+
+ HLTDebug( "NofBlocks %i", evtData.fBlockCnt );
// Process an event
AliHLTUInt32_t totalSize = 0, offset = 0;
// Loop over all input blocks in the event
AliHLTComponentDataType expectedDataType = (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD);
- for ( unsigned long i = 0; i < evtData.fBlockCnt; i++ )
- {
- if (evtData.fEventID == 1)
- CALLGRIND_START_INSTRUMENTATION();
-
- const AliHLTComponentBlockData &block = blocks[i];
- offset = totalSize;
+ for ( UInt_t iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ )
+ {
+ const AliHLTComponentBlockData &block = blocks[iBlock];
// lets not use the internal TRD data types here : AliHLTTRDDefinitions::fgkDDLRawDataType
// which is depreciated - we use HLT global defs instead
// if ( block.fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD) )
AliHLTComponentDataType inputDataType = block.fDataType;
if ( inputDataType != expectedDataType)
{
- HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s; Skipping",
- i, evtData.fBlockCnt,
+ HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) Wrong received datatype: %s - required datatype: %s; Skipping",
+ iBlock, evtData.fBlockCnt,
evtData.fEventID, evtData.fEventID,
DataType2Text(inputDataType).c_str(),
DataType2Text(expectedDataType).c_str());
}
else
{
- HLTDebug("We get the right data type: Block # %i/%i; Event 0x%08LX (%Lu) Received datatype: %s",
- i, evtData.fBlockCnt,
- evtData.fEventID, evtData.fEventID,
- DataType2Text(inputDataType).c_str());
+ HLTDebug("We get the right data type: Block # %i/%i; Event 0x%08LX (%Lu) Received datatype: %s; Block Size: %i",
+ iBlock, evtData.fBlockCnt,
+ evtData.fEventID, evtData.fEventID,
+ DataType2Text(inputDataType).c_str(),
+ block.fSize);
}
// fMemReader->Reset();
fMemReader->SetEquipmentID( id );
- fClusterizer->SetMemBlock(outputPtr);
+ fClusterizer->SetMemBlock(outputPtr+offset);
Bool_t iclustered = fClusterizer->Raw2ClustersChamber(fMemReader);
if (iclustered == kTRUE)
{
// put the tree into output
//fcTree->Print();
- AliHLTUInt32_t addedSize = fClusterizer->GetAddedSize();
+ AliHLTUInt32_t addedSize;
+ if(fReconstructor->IsProcessingTracklets()){
+ addedSize = fClusterizer->GetAddedTrSize();
+ totalSize += fClusterizer->GetTrMemBlockSize(); //if IsProcessingTracklets() is enabled we always reserve a data block of size GetTrMemBlockSize() for the tracklets
if (addedSize > 0){
// Using low-level interface
// with interface classes
- totalSize += addedSize;
if ( totalSize > size )
{
HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
totalSize, size );
return EMSGSIZE;
}
-
+
// Fill block
AliHLTComponentBlockData bd;
FillBlockData( bd );
bd.fSize = addedSize;
//bd.fSpecification = spec;
bd.fSpecification = gkAliEventTypeData;
- bd.fDataType = AliHLTTRDDefinitions::fgkClusterDataType;
+ bd.fDataType = AliHLTTRDDefinitions::fgkMCMtrackletDataType;
outputBlocks.push_back( bd );
- HLTDebug( "Block ; size %i; dataType %s; spec 0x%x ",
- bd.fSize, DataType2Text(bd.fDataType).c_str(), spec);
-
+ HLTDebug( "BD fPtr 0x%x, fOffset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), spec);
}
- else
- HLTWarning("Array of clusters is empty!");
+ offset = totalSize;
+ }
+
+ addedSize = fClusterizer->GetAddedClSize();
+ if (addedSize > 0){
+ // Using low-level interface
+ // with interface classes
+ totalSize += addedSize;
+ if ( totalSize > size )
+ {
+ HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
+ totalSize, size );
+ return EMSGSIZE;
+ }
+
+ // Fill block
+ AliHLTComponentBlockData bd;
+ FillBlockData( bd );
+ bd.fOffset = offset;
+ bd.fSize = addedSize;
+ //bd.fSpecification = spec;
+ bd.fSpecification = gkAliEventTypeData;
+ bd.fDataType = AliHLTTRDDefinitions::fgkClusterDataType;
+ outputBlocks.push_back( bd );
+ HLTDebug( "BD fPtr 0x%x, fOffset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), spec);
+ offset = totalSize;
+
+ }
+ else
+ HLTWarning("Array of clusters is empty!");
}
fReconstructor->SetClusters(0x0);
return 0;
}
-
void AliHLTTRDClusterizerComponent::PrintObject( TClonesArray* inClustersArray)
{
AliTRDcluster* cluster=0x0;
}
}
-