X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HLT%2FTRD%2FAliHLTTRDClusterizerComponent.cxx;h=fdc1aac234b2d0a7004f6405957a3e9e40896df3;hb=44fd53ca929e7d21599553f220998b2e933f3c0d;hp=2fbf81e5a4d7297dae59695aee3313324bb18c56;hpb=775f67d72739332a5f7a6b7b466eae13d4e04e3e;p=u%2Fmrichter%2FAliRoot.git diff --git a/HLT/TRD/AliHLTTRDClusterizerComponent.cxx b/HLT/TRD/AliHLTTRDClusterizerComponent.cxx index 2fbf81e5a4d..fdc1aac234b 100644 --- a/HLT/TRD/AliHLTTRDClusterizerComponent.cxx +++ b/HLT/TRD/AliHLTTRDClusterizerComponent.cxx @@ -1,25 +1,26 @@ // $Id$ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Authors: Matthias Richter * - * Timm Steinbeck * - * for The ALICE Off-line Project. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ +//************************************************************************** +//* This file is property of and copyright by the ALICE HLT Project * +//* ALICE Experiment at CERN, All rights reserved. * +//* * +//* Primary Authors: * +//* for The ALICE HLT Project. * +//* * +//* Permission to use, copy, modify and distribute this software and its * +//* documentation strictly for non-commercial purposes is hereby granted * +//* without fee, provided that the above copyright notice appears in all * +//* copies and that both the copyright notice and this permission notice * +//* appear in the supporting documentation. The authors make no claims * +//* about the suitability of this software for any purpose. It is * +//* provided "as is" without express or implied warranty. * +//************************************************************************** /** @file AliHLTTRDClusterizerComponent.cxx - @author Timm Steinbeck, Matthias Richter + @author Theodor Rascanu @date - @brief A TRDClusterizer processing component for the HLT. */ + @brief A TRDClusterizer processing component for the HLT. +*/ // see header file for class documentation // // or // @@ -37,13 +38,14 @@ using namespace std; #include "AliHLTTRDClusterizerComponent.h" #include "AliHLTTRDDefinitions.h" -#include "AliHLTTRDCluster.h" +#include "AliHLTTRDClusterizer.h" +#include "AliHLTTRDUtils.h" #include "AliGeomManager.h" #include "AliTRDReconstructor.h" #include "AliCDBManager.h" #include "AliCDBStorage.h" -#include "AliHLTTRDClusterizer.h" +#include "AliCDBEntry.h" #include "AliTRDrecoParam.h" #include "AliTRDrawStreamBase.h" #include "AliTRDcluster.h" @@ -53,8 +55,8 @@ using namespace std; #ifdef HAVE_VALGRIND_CALLGRIND_H #include #else -#define CALLGRIND_START_INSTRUMENTATION do { } while (0) -#define CALLGRIND_STOP_INSTRUMENTATION do { } while (0) +#define CALLGRIND_START_INSTRUMENTATION (void)0 +#define CALLGRIND_STOP_INSTRUMENTATION (void)0 #endif #include @@ -63,14 +65,25 @@ using namespace std; ClassImp(AliHLTTRDClusterizerComponent) -AliHLTTRDClusterizerComponent::AliHLTTRDClusterizerComponent(): - AliHLTProcessor(), - fOutputPercentage(500), +AliHLTTRDClusterizerComponent::AliHLTTRDClusterizerComponent() +: AliHLTProcessor(), + fOutputPercentage(100), fOutputConst(0), fClusterizer(NULL), fRecoParam(NULL), fMemReader(NULL), - fReconstructor(NULL) + fReconstructor(NULL), + fRecoParamType(-1), + fRecoDataType(-1), + fRawDataVersion(2), + fyPosMethod(1), + fgeometryFileName(""), + fProcessTracklets(kFALSE), + fHLTstreamer(kTRUE), + fTC(kFALSE), + fHLTflag(kTRUE), + fHighLevelOutput(kFALSE), + fEmulateHLTClusters(kFALSE) { // Default constructor @@ -93,10 +106,10 @@ void AliHLTTRDClusterizerComponent::GetInputDataTypes( vector=argc ) - { - HLTError("Missing output_percentage parameter"); - return ENOTSUP; - } - HLTDebug("argv[%d+1] == %s", i, argv[i+1] ); - fOutputPercentage = strtoul( argv[i+1], &cpErr, 0 ); - if ( *cpErr ) - { - HLTError("Cannot convert output_percentage parameter '%s'", argv[i+1] ); - return EINVAL; - } - HLTInfo("Output percentage set to %i %%", fOutputPercentage ); - 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 -rawver argument"); - return ENOTSUP; - } - iRawDataVersion = atoi( argv[i+1] ); - HLTInfo("Raw data version is %d", iRawDataVersion ); - i += 2; - - } - - else if ( strcmp( argv[i], "-geometry" ) == 0) - { - if ( i+1 >= argc ) - { - HLTError("Missing -geometry argument"); - return ENOTSUP; - } - 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) - { - HLTWarning("No reco param selected. Use -lowflux or -highflux flag. Defaulting to low flux."); - iRecoParamType = 0; - } - - if (iRecoParamType == 0) - { - fRecoParam = AliTRDrecoParam::GetLowFluxParam(); - HLTDebug("Low flux params init."); - } - - if (iRecoParamType == 1) - { - fRecoParam = AliTRDrecoParam::GetHighFluxParam(); - HLTDebug("High flux params init."); - } - - if (iRecoParamType == 2) - { - fRecoParam = AliTRDrecoParam::GetCosmicTestParam(); - HLTDebug("Cosmic Test params init."); - } - - if (fRecoParam == 0) - { - HLTError("No reco params initialized. Sniffing big trouble!"); - return -1; - } - fReconstructor = new AliTRDReconstructor(); - fReconstructor->SetRecoParam(fRecoParam); - fReconstructor->SetStreamLevel(0, AliTRDReconstructor::kClusterizer); // default value - HLTInfo("Not writing clusters. I.e. output is a TClonesArray of clusters"); - 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; + HLTDebug("TRDReconstructor at 0x%x", fReconstructor); + + TString configuration=""; + TString argument=""; + for (int i=0; i=0; i++) { + argument=argv[i]; + if (!configuration.IsNull()) configuration+=" "; + configuration+=argument; } - 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 - // both: in sim and reality - if (iRecoDataType < 0 || iRecoDataType > 1) - { - HLTWarning("No data type selected. Use -simulation or -experiment flag. Defaulting to simulation."); - iRecoDataType = 0; - } - - if (iRecoDataType == 0) - { - AliTRDrawStreamBase::SetRawStreamVersion(AliTRDrawStreamBase::kTRDsimStream); - HLTDebug("Data type expected is SIMULATION!"); - } - if (iRecoDataType == 1) - { - AliTRDrawStreamBase::SetRawStreamVersion(AliTRDrawStreamBase::kTRDrealStream); - HLTDebug("Data type expected is EXPERIMENT!"); - } + if (!configuration.IsNull()) { + iResult=Configure(configuration.Data()); + } else { + iResult=Reconfigure(NULL, NULL); + } - // the DATA BASE STUFF - - if(!AliCDBManager::Instance()->IsDefaultStorageSet()){ - HLTError("DefaultStorage is not Set in CDBManager"); + if(!fClusterizer){ + HLTFatal("Clusterizer was not initialized!"); 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()); - } - if(!AliGeomManager::GetGeometry()){ - HLTError("Cannot load geometry"); - return EINVAL; - } - } - else{ - HLTInfo("Geometry Already Loaded"); - } - - fMemReader = new AliRawReaderMemory; - fClusterizer = new AliHLTTRDClusterizer("TRDCclusterizer", "TRDCclusterizer"); + if(iResult<0) return iResult; + + fMemReader = new AliRawReaderMemory; fClusterizer->SetReconstructor(fReconstructor); fClusterizer->SetUseLabels(kFALSE); - fClusterizer->SetRawVersion(iRawDataVersion); if(fReconstructor->IsProcessingTracklets()) fOutputConst = fClusterizer->GetTrMemBlockSize(); - return 0; + + return iResult; } int AliHLTTRDClusterizerComponent::DoDeinit() @@ -403,9 +207,11 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD { // Process an event - if (evtData.fEventID == 1) + if (evtData.fEventID == 10) CALLGRIND_START_INSTRUMENTATION; + if(!IsDataEvent())return 0; + HLTDebug( "NofBlocks %i", evtData.fBlockCnt ); // Process an event AliHLTUInt32_t totalSize = 0, offset = 0; @@ -432,6 +238,8 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD evtData.fEventID, evtData.fEventID, DataType2Text(inputDataType).c_str(), DataType2Text(expectedDataType).c_str()); + if(block.fDataType == kAliHLTDataTypeEOR) + CALLGRIND_STOP_INSTRUMENTATION; continue; } else @@ -443,28 +251,29 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD block.fSize); } - // fMemReader->Reset(); +#ifndef NDEBUG + unsigned long constBase; + double inputMultiplier; + GetOutputDataSize(constBase,inputMultiplier); + if(size<(constBase+block.fSize*inputMultiplier)){ + HLTWarning("Memory Block given might be too small: %i < %i; Event %Lu", size, constBase+block.fSize*inputMultiplier, evtData.fEventID); + } +#endif + + // fMemReader->Reset(); fMemReader->SetMemory((UChar_t*) block.fPtr, block.fSize); AliHLTUInt32_t spec = block.fSpecification; - Int_t id = 1024; - - for ( Int_t ii = 0; ii < 18 ; ii++ ) { - if ( spec & 0x00000001 ) { - id += ii; - break; - } - spec = spec >> 1 ; - } + Int_t id = AliHLTTRDUtils::GetSM(spec) + 1024; - fMemReader->SetEquipmentID( id ); + fMemReader->SetEquipmentID(id); fClusterizer->SetMemBlock(outputPtr+offset); - Bool_t iclustered = fClusterizer->Raw2ClustersChamber(fMemReader); - if (iclustered == kTRUE) + Bool_t bclustered = fClusterizer->Raw2ClustersChamber(fMemReader); + if(bclustered) { - HLTDebug( "Clustered successfully"); + HLTDebug("Clustered successfully"); } else { @@ -472,9 +281,6 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD return -1; } - // put the tree into output - //fcTree->Print(); - AliHLTUInt32_t addedSize; if(fReconstructor->IsProcessingTracklets()){ addedSize = fClusterizer->GetAddedTrSize(); @@ -494,19 +300,21 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD FillBlockData( bd ); bd.fOffset = offset; bd.fSize = addedSize; - //bd.fSpecification = spec; - bd.fSpecification = gkAliEventTypeData; + bd.fSpecification = block.fSpecification; bd.fDataType = AliHLTTRDDefinitions::fgkMCMtrackletDataType; 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); + HLTDebug( "BD ptr 0x%x, offset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), spec); } offset = totalSize; } addedSize = fClusterizer->GetAddedClSize(); if (addedSize > 0){ - // Using low-level interface - // with interface classes + + Int_t* nTimeBins = (Int_t*)(outputPtr+offset+fClusterizer->GetAddedClSize()); + *nTimeBins = fClusterizer->GetNTimeBins(); + addedSize += sizeof(*nTimeBins); + totalSize += addedSize; if ( totalSize > size ) { @@ -514,22 +322,21 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD totalSize, size ); return EMSGSIZE; } - + // Fill block AliHLTComponentBlockData bd; FillBlockData( bd ); bd.fOffset = offset; bd.fSize = addedSize; - //bd.fSpecification = spec; - bd.fSpecification = gkAliEventTypeData; + bd.fSpecification = block.fSpecification; 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); + HLTDebug( "BD ptr 0x%x, offset %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!"); + else{ + HLTDebug("Array of clusters is empty!"); + } } fReconstructor->SetClusters(0x0); @@ -551,3 +358,346 @@ void AliHLTTRDClusterizerComponent::PrintObject( TClonesArray* inClustersArray) } } + +int AliHLTTRDClusterizerComponent::Configure(const char* arguments){ + int iResult=0; + if (!arguments) return iResult; + + TString allArgs=arguments; + TString argument; + int bMissingParam=0; + + TObjArray* pTokens=allArgs.Tokenize(" "); + if (pTokens) { + for (int i=0; iGetEntries() && iResult>=0; i++) { + argument=((TObjString*)pTokens->At(i))->GetString(); + if (argument.IsNull()) continue; + + if (argument.CompareTo("output_percentage")==0) { + if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; + HLTInfo("Setting output percentage to: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); + fOutputPercentage=((TObjString*)pTokens->At(i))->GetString().Atoi(); + continue; + } + else if (argument.CompareTo("-geometry")==0) { + if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; + HLTInfo("Setting geometry to: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); + fgeometryFileName=((TObjString*)pTokens->At(i))->GetString(); + continue; + } + else if (argument.CompareTo("-lowflux")==0) { + fRecoParamType = 0; + HLTInfo("Low flux reconstruction selected"); + continue; + } + else if (argument.CompareTo("-highflux")==0) { + fRecoParamType = 1; + HLTInfo("High flux reconstruction selected"); + continue; + } + else if (argument.CompareTo("-cosmics")==0) { + fRecoParamType = 2; + HLTInfo("Cosmics reconstruction selected"); + continue; + } + else if (argument.CompareTo("-simulation")==0) { + fRecoDataType = 0; + HLTInfo("Awaiting simulated data"); + continue; + } + else if (argument.CompareTo("-experiment")==0) { + fRecoDataType = 1; + HLTInfo("Awaiting real data"); + continue; + } + else if (argument.CompareTo("-processTracklets")==0) { + fProcessTracklets = kTRUE; + HLTInfo("Writing L1 tracklets to output"); + continue; + } + else if (argument.CompareTo("-noZS")==0) { + fOutputPercentage = 10; + HLTInfo("Awaiting non zero surpressed data"); + continue; + } + else if (argument.CompareTo("-HLTflag")==0) { + if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; + TString toCompareTo=((TObjString*)pTokens->At(i))->GetString(); + if (toCompareTo.CompareTo("yes")==0){ + HLTInfo("Setting HLTflag to: %s", toCompareTo.Data()); + fHLTflag=kTRUE; + } + else if (toCompareTo.CompareTo("no")==0){ + HLTInfo("Setting HLTflag to: %s", toCompareTo.Data()); + fHLTflag=kFALSE; + } + else { + HLTError("unknown argument for HLTflag: %s", toCompareTo.Data()); + iResult=-EINVAL; + break; + } + continue; + } + else if (argument.CompareTo("-faststreamer")==0) { + fHLTstreamer = kTRUE; + HLTInfo("Useing fast raw streamer"); + continue; + } + else if (argument.CompareTo("-nofaststreamer")==0) { + fHLTstreamer = kFALSE; + HLTInfo("Don't use fast raw streamer"); + continue; + } + else if (argument.CompareTo("-tailcancellation")==0) { + fTC = kTRUE; + HLTInfo("Useing tailcancellation"); + continue; + } + else if (argument.CompareTo("-rawver")==0) { + if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; + HLTInfo("Raw data version is: %s", ((TObjString*)pTokens->At(i))->GetString().Data()); + fRawDataVersion=((TObjString*)pTokens->At(i))->GetString().Atoi(); + continue; + } + else if (argument.CompareTo("-highLevelOutput")==0) { + if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; + TString toCompareTo=((TObjString*)pTokens->At(i))->GetString(); + if (toCompareTo.CompareTo("yes")==0){ + HLTWarning("Setting highLevelOutput to: %s", toCompareTo.Data()); + fHighLevelOutput=kTRUE; + } + else if (toCompareTo.CompareTo("no")==0){ + HLTInfo("Setting highLevelOutput to: %s", toCompareTo.Data()); + fHighLevelOutput=kFALSE; + } + else { + HLTError("unknown argument for highLevelOutput: %s", toCompareTo.Data()); + iResult=-EINVAL; + break; + } + continue; + } + else if (argument.CompareTo("-emulateHLToutput")==0) { + if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; + TString toCompareTo=((TObjString*)pTokens->At(i))->GetString(); + if (toCompareTo.CompareTo("yes")==0){ + HLTWarning("Setting emulateHLToutput to: %s", toCompareTo.Data()); + fEmulateHLTClusters=kTRUE; + } + else if (toCompareTo.CompareTo("no")==0){ + HLTInfo("Setting emulateHLToutput to: %s", toCompareTo.Data()); + fEmulateHLTClusters=kFALSE; + } + else { + HLTError("unknown argument for emulateHLToutput: %s", toCompareTo.Data()); + iResult=-EINVAL; + break; + } + continue; + } + else if (argument.CompareTo("-yPosMethod")==0) { + if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; + TString toCompareTo=((TObjString*)pTokens->At(i))->GetString(); + if (toCompareTo.CompareTo("COG")==0){ + HLTInfo("Setting yPosMethod method to: %s", toCompareTo.Data()); + fyPosMethod=0; + } + else if (toCompareTo.CompareTo("LUT")==0){ + HLTInfo("Setting yPosMethod method to: %s", toCompareTo.Data()); + fyPosMethod=1; + } + else if (toCompareTo.CompareTo("Gauss")==0){ + HLTInfo("Setting yPosMethod method to: %s", toCompareTo.Data()); + fyPosMethod=2; + } + else { + HLTError("unknown argument for yPosMethod: %s", toCompareTo.Data()); + iResult=-EINVAL; + break; + } + continue; + } + + else { + HLTError("unknown argument: %s", argument.Data()); + iResult=-EINVAL; + break; + } + } + delete pTokens; + } + if (bMissingParam) { + HLTError("missing parameter for argument %s", argument.Data()); + iResult=-EINVAL; + } + if(iResult>=0){ + iResult=SetParams(); + } + return iResult; +} + +int AliHLTTRDClusterizerComponent::SetParams() +{ + Int_t iResult=0; + if(!AliCDBManager::Instance()->IsDefaultStorageSet()){ + HLTError("DefaultStorage is not set in CDBManager"); + return -EINVAL; + } + if(AliCDBManager::Instance()->GetRun()<0){ + HLTError("Run Number is not set in CDBManager"); + return -EINVAL; + } + HLTInfo("CDB default storage: %s; RunNo: %i", (AliCDBManager::Instance()->GetDefaultStorage()->GetBaseFolder()).Data(), AliCDBManager::Instance()->GetRun()); + + if(!AliGeomManager::GetGeometry()){ + if(fgeometryFileName.CompareTo("")==0 || !TFile::Open(fgeometryFileName.Data())){ + HLTInfo("Loading standard geometry file"); + AliGeomManager::LoadGeometry(); + }else{ + HLTWarning("Loading NON-standard geometry file"); + AliGeomManager::LoadGeometry(fgeometryFileName.Data()); + } + if(!AliGeomManager::GetGeometry()){ + HLTError("Could not load geometry"); + return -EINVAL; + } + HLTInfo("Applying Alignment from CDB object"); + AliGeomManager::ApplyAlignObjsFromCDB("TRD"); + } + else{ + HLTInfo("Geometry Already Loaded!"); + } + + if(fReconstructor->GetRecoParam()){ + fRecoParam = new AliTRDrecoParam(*fReconstructor->GetRecoParam()); + HLTInfo("RecoParam already set!"); + }else{ + if(fRecoParamType == 0){ + HLTDebug("Low flux params init."); + fRecoParam = AliTRDrecoParam::GetLowFluxParam(); + } + if(fRecoParamType == 1){ + HLTDebug("High flux params init."); + fRecoParam = AliTRDrecoParam::GetHighFluxParam(); + } + if(fRecoParamType == 2){ + HLTDebug("Cosmic Test params init."); + fRecoParam = AliTRDrecoParam::GetCosmicTestParam(); + } + } + + if (!fRecoParam) + { + HLTError("No reco params initialized. Sniffing big trouble!"); + return -EINVAL; + } + + if(fTC){fRecoParam->SetTailCancelation(kTRUE); HLTDebug("Enableing Tail Cancelation"); } + else{fRecoParam->SetTailCancelation(kFALSE); HLTDebug("Disableing Tail Cancelation"); } + + switch(fyPosMethod){ + case 0: fRecoParam->SetGAUS(kFALSE); fRecoParam->SetLUT(kFALSE); break; + case 1: fRecoParam->SetGAUS(kFALSE); fRecoParam->SetLUT(kTRUE); break; + case 2: fRecoParam->SetGAUS(kTRUE); fRecoParam->SetLUT(kFALSE); break; + } + + fRecoParam->SetStreamLevel(AliTRDrecoParam::kClusterizer, 0); + fReconstructor->SetRecoParam(fRecoParam); + + TString recoOptions="!cw"; + if(fHLTflag) + recoOptions += ",hlt"; + if(fProcessTracklets) recoOptions += ",tp"; + else recoOptions += ",!tp"; + + HLTDebug("Reconstructor options are: %s",recoOptions.Data()); + fReconstructor->SetOption(recoOptions.Data()); + + if (fRecoDataType < 0 || fRecoDataType > 1) + { + HLTWarning("No data type selected. Use -simulation or -experiment flag. Defaulting to simulation."); + fRecoDataType = 0; + } + + if (fRecoDataType == 0) + { + AliTRDrawStreamBase::SetRawStreamVersion(AliTRDrawStreamBase::kTRDsimStream); + HLTDebug("Data type expected is SIMULATION!"); + } + + if (fRecoDataType == 1) + { + AliTRDrawStreamBase::SetRawStreamVersion(AliTRDrawStreamBase::kTRDrealStream); + HLTDebug("Data type expected is EXPERIMENT!"); + } + +#ifndef HAVE_NOT_ALITRD_RAWSTREAM_r39608 + if(fHLTstreamer){ + AliTRDrawStreamBase::SetRawStreamVersion("default"); + HLTDebug("fast rawstreamer used"); + }else{ + AliTRDrawStreamBase::SetRawStreamVersion("FAST"); + HLTDebug("old rawstreamer used"); + } +#else + if(fHLTstreamer){ + AliTRDrawStreamBase::SetRawStreamVersion("FAST"); + HLTDebug("fast rawstreamer used"); + } +#endif + + if(!fClusterizer){ + fClusterizer = new AliHLTTRDClusterizer("TRDCclusterizer", "TRDCclusterizer"); + HLTDebug("TRDClusterizer at 0x%x", fClusterizer); + } + + fClusterizer->SetRawVersion(fRawDataVersion); + + return iResult; +} + +int AliHLTTRDClusterizerComponent::Reconfigure(const char* cdbEntry, const char* chainId) +{ + // see header file for class documentation + + int iResult=0; + const char* path="HLT/ConfigTRD/ClusterizerComponent"; + const char* defaultNotify=""; + if (cdbEntry) { + path=cdbEntry; + defaultNotify=" (default)"; + } + if (path) { + HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:""); + AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); + if (pEntry) { + TObjString* pString=dynamic_cast(pEntry->GetObject()); + if (pString) { + HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data()); + iResult=Configure(pString->GetString().Data()); + } else { + HLTError("configuration object \"%s\" has wrong type, required TObjString", path); + } + } else { + HLTError("cannot fetch object \"%s\" from CDB", path); + } + } + + return iResult; +} + +void AliHLTTRDClusterizerComponent::GetOCDBObjectDescription(TMap* const targetMap){ + // Get a list of OCDB object description needed for the particular component + if (!targetMap) return; + targetMap->Add(new TObjString("HLT/ConfigTRD/ClusterizerComponent"), new TObjString("component arguments")); + targetMap->Add(new TObjString("TRD/Calib/ChamberGainFactor"), new TObjString("gain factor of chambers")); + targetMap->Add(new TObjString("TRD/Calib/ChamberT0"), new TObjString("T0 of chambers")); + targetMap->Add(new TObjString("TRD/Calib/ChamberVdrift"), new TObjString("drift velocity of chambers")); + targetMap->Add(new TObjString("TRD/Calib/DetNoise"), new TObjString("noise of chambers")); + targetMap->Add(new TObjString("TRD/Calib/LocalGainFactor"), new TObjString("per pad gain factor")); + targetMap->Add(new TObjString("TRD/Calib/LocalT0"), new TObjString("per pad T0")); + targetMap->Add(new TObjString("TRD/Calib/LocalVdrift"), new TObjString("per pad drift velocity")); + targetMap->Add(new TObjString("TRD/Calib/PadNoise"), new TObjString("per pad noise")); + targetMap->Add(new TObjString("TRD/Calib/PadStatus"), new TObjString("pad status")); + targetMap->Add(new TObjString("TRD/Calib/PRFWidth"), new TObjString("pad response function")); +}