* Option to pass clusters and tracks between components in TClonesArray removed.
We must use only low-level interface now.
* Restructure of the code
* AliTRDClusterizerHLT.[h,cxx] renamed to AliHLTTRDClusterizer.[h,cxx]
* AliHLTTRDUtils.[h,cxx] created, that contains class with commonly used functions in HLTTRD
* AliHLTTRDTrackerComponent.[h,cxx] removed, since we are using only TrackerV1
#pragma link off all classes;
#pragma link off all functions;
-#pragma link C++ class AliTRDclusterizerHLT;
+#pragma link C++ class AliHLTTRDClusterizer;
#pragma link C++ class AliHLTTRDClusterizerComponent;
-#pragma link C++ class AliHLTTRDTrackerComponent;
#pragma link C++ class AliHLTTRDTrackerV1Component;
#pragma link C++ class AliHLTTRDDefinitions;
#pragma link C++ class AliHLTTRDEsdWriterComponent;
#pragma link C++ class AliHLTTRDCalibrationComponent;
+#pragma link C++ class AliHLTTRDUtils;
#endif
// component headers
#include "AliHLTTRDClusterizerComponent.h"
-#include "AliHLTTRDTrackerComponent.h"
#include "AliHLTTRDTrackerV1Component.h"
#include "AliHLTTRDCalibrationComponent.h"
#include "AliHLTTRDEsdWriterComponent.h"
// see header file for class documentation
if (!pHandler) return -EINVAL;
pHandler->AddComponent(new AliHLTTRDClusterizerComponent);
- pHandler->AddComponent(new AliHLTTRDTrackerComponent);
pHandler->AddComponent(new AliHLTTRDTrackerV1Component);
pHandler->AddComponent(new AliHLTTRDCalibrationComponent);
pHandler->AddComponent(new AliHLTTRDEsdWriterComponent);
/** @file AliHLTTRDCalibrationComponent.cxx
@author Timm Steinbeck, Matthias Richter
- @date
+ @date
@brief A TRDCalibration processing component for the HLT. */
#if __GNUC__ >= 3
-using namespace std;
+ using namespace std;
#endif
#include "TTree.h"
#include "AliHLTTRDCalibrationComponent.h"
#include "AliHLTTRDDefinitions.h"
-#include "AliHLTTRDTrack.h"
+#include "AliHLTTRDUtils.h"
#include "AliCDBManager.h"
-#include "AliTRDclusterizerHLT.h"
#include "AliRawReaderMemory.h"
#include "AliTRDCalibraFillHisto.h"
+#include "AliTRDtrackV1.h"
#include <cstdlib>
#include <cerrno>
AliHLTTRDCalibrationComponent gAliHLTTRDCalibrationComponent;
ClassImp(AliHLTTRDCalibrationComponent);
-
+
AliHLTTRDCalibrationComponent::AliHLTTRDCalibrationComponent():
- AliHLTCalibrationProcessor(),
- fTRDCalibraFillHisto(NULL),
- fUseHLTTracks(kFALSE),
- fOutputPercentage(100), // By default we copy to the output exactly what we got as input
- fStrorageDBpath("local://$ALICE_ROOT/OCDB"),
- fCDB(NULL)
+ AliHLTCalibrationProcessor(),
+ fTRDCalibraFillHisto(NULL),
+ fOutputPercentage(100), // By default we copy to the output exactly what we got as input
+ fStrorageDBpath("local://$ALICE_ROOT/OCDB"),
+ fCDB(NULL)
{
- // Default constructor
+ // Default constructor
}
AliHLTTRDCalibrationComponent::~AliHLTTRDCalibrationComponent()
{
- // Destructor
- ;
+ // Destructor
+ ;
}
const char* AliHLTTRDCalibrationComponent::GetComponentID()
{
- // Return the component ID const char *
- return "TRDCalibration"; // The ID of this component
+ // Return the component ID const char *
+ return "TRDCalibration"; // The ID of this component
}
void AliHLTTRDCalibrationComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
{
- // Get the list of input data
- list.clear(); // We do not have any requirements for our input data type(s).
- list.push_back( AliHLTTRDDefinitions::fgkTRDSATracksDataType );
+ // Get the list of input data
+ list.clear(); // We do not have any requirements for our input data type(s).
+ list.push_back( AliHLTTRDDefinitions::fgkTRDSATracksDataType );
}
AliHLTComponent_DataType AliHLTTRDCalibrationComponent::GetOutputDataType()
{
- // Get the output data type
- return AliHLTTRDDefinitions::fgkCalibrationDataType;
+ // Get the output data type
+ return AliHLTTRDDefinitions::fgkCalibrationDataType;
}
void AliHLTTRDCalibrationComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
{
- // Get the output data size
- constBase = 0;
- inputMultiplier = ((double)fOutputPercentage)/100.0;
+ // Get the output data size
+ constBase = 0;
+ inputMultiplier = ((double)fOutputPercentage)/100.0;
}
AliHLTComponent* AliHLTTRDCalibrationComponent::Spawn()
{
- // Spawn function, return new instance of this class
- return new AliHLTTRDCalibrationComponent;
+ // Spawn function, return new instance of this class
+ return new AliHLTTRDCalibrationComponent;
};
Int_t AliHLTTRDCalibrationComponent::ScanArgument( int argc, const char** argv )
{
- // perform initialization. We check whether our relative output size is specified in the arguments.
- fOutputPercentage = 100;
- int i = 0;
- char* cpErr;
- while ( i < argc )
- {
- HLTDebug("argv[%d] == %s", i, argv[i] );
- if ( !strcmp( argv[i], "output_percentage" ) )
- {
- if ( i+1>=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 %lu %%", fOutputPercentage );
- i += 2;
- continue;
- }
- 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;
- continue;
- }
- else if ( strcmp( argv[i], "-useHLTTracks" ) == 0){
- fUseHLTTracks = kTRUE;
- i++;
- HLTInfo("Expecting block of AliHLTTracks as input. Using low-level interface");
- }
- else{
- HLTError("Unknown option '%s'", argv[i] );
- return EINVAL;
- }
- }
- return 0;
+ // perform initialization. We check whether our relative output size is specified in the arguments.
+ int i = 0;
+ char* cpErr;
+ while ( i < argc )
+ {
+ HLTDebug("argv[%d] == %s", i, argv[i] );
+ if ( !strcmp( argv[i], "output_percentage" ) )
+ {
+ if ( i+1>=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 %lu %%", fOutputPercentage );
+ i += 2;
+ continue;
+ }
+ 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;
+ continue;
+ }
+ else {
+ HLTError("Unknown option '%s'", argv[i] );
+ return EINVAL;
+ }
+ }
+ return 0;
}
Int_t AliHLTTRDCalibrationComponent::InitCalibration()
{
- //init the calibration
- 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("fCDB 0x%x", fCDB);
- }
- fTRDCalibraFillHisto = AliTRDCalibraFillHisto::Instance();
- fTRDCalibraFillHisto->SetHisto2d(); // choose to use histograms
- fTRDCalibraFillHisto->SetCH2dOn(); // choose to calibrate the gain
- fTRDCalibraFillHisto->SetPH2dOn(); // choose to calibrate the drift velocity
- fTRDCalibraFillHisto->SetPRF2dOn(); // choose to look at the PRF
- fTRDCalibraFillHisto->Init2Dhistos(); // initialise the histos
- return 0;
+ //init the calibration
+ 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("fCDB 0x%x", fCDB);
+ }
+ fTRDCalibraFillHisto = AliTRDCalibraFillHisto::Instance();
+ fTRDCalibraFillHisto->SetHisto2d(); // choose to use histograms
+ fTRDCalibraFillHisto->SetCH2dOn(); // choose to calibrate the gain
+ fTRDCalibraFillHisto->SetPH2dOn(); // choose to calibrate the drift velocity
+ fTRDCalibraFillHisto->SetPRF2dOn(); // choose to look at the PRF
+ fTRDCalibraFillHisto->Init2Dhistos(); // initialise the histos
+ return 0;
}
Int_t AliHLTTRDCalibrationComponent::DeinitCalibration()
{
- HLTDebug("DeinitCalibration");
-
- // Deinitialization of the component
-
- if (fCDB)
- {
- HLTDebug("destroy fCDB");
- fCDB->Destroy();
- fCDB = 0;
- }
- return 0;
+ HLTDebug("DeinitCalibration");
+
+ // Deinitialization of the component
+
+ if (fCDB)
+ {
+ HLTDebug("destroy fCDB");
+ fCDB->Destroy();
+ fCDB = 0;
+ }
+ return 0;
}
Int_t AliHLTTRDCalibrationComponent::ProcessCalibration(const AliHLTComponent_EventData& evtData,
- const AliHLTComponent_BlockData* blocks,
- AliHLTComponent_TriggerData& /*trigData*/,
- AliHLTUInt8_t* /*outputPtr*/,
- AliHLTUInt32_t& /*size*/,
- vector<AliHLTComponent_BlockData>& /*outputBlocks*/)
+ const AliHLTComponent_BlockData* blocks,
+ AliHLTComponent_TriggerData& /*trigData*/,
+ AliHLTUInt8_t* /*outputPtr*/,
+ AliHLTUInt32_t& /*size*/,
+ vector<AliHLTComponent_BlockData>& /*outputBlocks*/)
{
- // Process an event
- // Logging( kHLTLogInfo, "HLT::TRDCalibration::ProcessCalibration", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
- HLTDebug("NofBlocks %lu", evtData.fBlockCnt );
- // Process an event
-
- // Loop over all input blocks in the event
- vector<AliHLTComponent_DataType> expectedDataTypes;
- GetInputDataTypes(expectedDataTypes);
- for ( unsigned long iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ )
- {
- const AliHLTComponentBlockData &block = blocks[iBlock];
- AliHLTComponentDataType inputDataType = block.fDataType;
- Bool_t correctDataType = kFALSE;
-
- for(UInt_t i = 0; i < expectedDataTypes.size(); i++)
- if( expectedDataTypes.at(i) == inputDataType)
- correctDataType = kTRUE;
- if (!correctDataType)
- {
- HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) Wrong received datatype: %s - Skipping",
- iBlock, evtData.fBlockCnt,
- evtData.fEventID, evtData.fEventID,
- DataType2Text(inputDataType).c_str());
- continue;
- }
- else
- HLTDebug("We get the right data type: Block # %i/%i; Event 0x%08LX (%Lu) Received datatype: %s",
- iBlock, evtData.fBlockCnt-1,
- evtData.fEventID, evtData.fEventID,
- DataType2Text(inputDataType).c_str());
-
- TClonesArray* tracksArray = NULL;
- int ibForce = 0;
- if (fUseHLTTracks)
- {
- tracksArray = new TClonesArray("AliTRDtrackV1");
- HLTDebug("BLOCK fPtr 0x%x, fOffset %i, fSize %i, fSpec 0x%x, fDataType %s", block.fPtr, block.fOffset, block.fSize, block.fSpecification, DataType2Text(block.fDataType).c_str());
- ReadTracks(tracksArray, block.fPtr, block.fSize);
- }
- else
- {
- TObject *objIn = NULL;
- if (iBlock == 0)
- objIn = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::fgkTRDSATracksDataType, "TClonesArray", ibForce);
- else
- objIn = (TObject *)GetNextInputObject( ibForce );
- HLTDebug("1stBLOCK, Pointer = 0x%x", objIn);
- if (objIn){
- tracksArray = (TClonesArray* )objIn;
- }
- }
-
- if (tracksArray)
- {
- Int_t nbEntries = tracksArray->GetEntries();
- HLTDebug(" %i TRDtracks in tracksArray", nbEntries);
- AliTRDtrackV1* trdTrack = 0x0;
- for (Int_t i = 0; i < nbEntries; i++){
- HLTDebug("%i/%i: ", i+1, nbEntries);
- trdTrack = (AliTRDtrackV1*)tracksArray->At(i);
- trdTrack->Print();
- fTRDCalibraFillHisto->UpdateHistogramsV1(trdTrack);
- }
- }
-
-
- TObjArray *outArray = FormOutput();
- if (outArray){
- PushBack(outArray, AliHLTTRDDefinitions::fgkCalibrationDataType);
- delete outArray;
- }
-
- }
- return 0;
-
+ HLTDebug("NofBlocks %lu", evtData.fBlockCnt );
+ // Process an event
+
+ // Loop over all input blocks in the event
+ vector<AliHLTComponent_DataType> expectedDataTypes;
+ GetInputDataTypes(expectedDataTypes);
+ for ( unsigned long iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ )
+ {
+ const AliHLTComponentBlockData &block = blocks[iBlock];
+ AliHLTComponentDataType inputDataType = block.fDataType;
+ Bool_t correctDataType = kFALSE;
+
+ for(UInt_t i = 0; i < expectedDataTypes.size(); i++)
+ if( expectedDataTypes.at(i) == inputDataType)
+ correctDataType = kTRUE;
+ if (!correctDataType) {
+ HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) Wrong received datatype: %s - Skipping",
+ iBlock, evtData.fBlockCnt,
+ evtData.fEventID, evtData.fEventID,
+ DataType2Text(inputDataType).c_str());
+ continue;
+ }
+ else
+ HLTDebug("We get the right data type: Block # %i/%i; Event 0x%08LX (%Lu) Received datatype: %s",
+ iBlock, evtData.fBlockCnt-1,
+ evtData.fEventID, evtData.fEventID,
+ DataType2Text(inputDataType).c_str());
+
+ TClonesArray* tracksArray = NULL;
+ tracksArray = new TClonesArray("AliTRDtrackV1");
+ HLTDebug("BLOCK fPtr 0x%x, fOffset %i, fSize %i, fSpec 0x%x, fDataType %s", block.fPtr, block.fOffset, block.fSize, block.fSpecification, DataType2Text(block.fDataType).c_str());
+ AliHLTTRDUtils::ReadTracks(tracksArray, block.fPtr, block.fSize);
+
+ if (tracksArray) {
+ Int_t nbEntries = tracksArray->GetEntries();
+ HLTDebug(" %i TRDtracks in tracksArray", nbEntries);
+ AliTRDtrackV1* trdTrack = 0x0;
+ for (Int_t i = 0; i < nbEntries; i++){
+ HLTDebug("%i/%i: ", i+1, nbEntries);
+ trdTrack = (AliTRDtrackV1*)tracksArray->At(i);
+ trdTrack->Print();
+ fTRDCalibraFillHisto->UpdateHistogramsV1(trdTrack);
+ }
+ }
+
+
+ TObjArray *outArray = FormOutput();
+ if (outArray) {
+ PushBack(outArray, AliHLTTRDDefinitions::fgkCalibrationDataType);
+ delete outArray;
+ }
+
+ }
+ return 0;
+
}
+
/**
- * Read track to the TClonesArray from the memory
+ * Form output array of histrograms
*/
//============================================================================
-Int_t AliHLTTRDCalibrationComponent::ReadTracks(TClonesArray *outArray, void* inputPtr, AliHLTUInt32_t size)
+TObjArray* AliHLTTRDCalibrationComponent::FormOutput()
{
- AliHLTUInt8_t* iterPtr = (AliHLTUInt8_t* )inputPtr;
-
- cout << "\nReading tracks from the Memory\n ============= \n";
- AliHLTTRDTrack * hltTrack;
- AliHLTUInt32_t trackSize = 0, curSize = 0;
- Int_t counter=0;
-
- while (curSize < size)
- {
- hltTrack = (AliHLTTRDTrack*) iterPtr;
- HLTDebug("curSize %i, size %i",curSize, size);
-
- trackSize = hltTrack->GetSize();
- HLTDebug("GetSize() %i", trackSize);
-
- hltTrack->ReadTrackletsFromMemory(iterPtr + sizeof(AliHLTTRDTrack));
-
- AliTRDtrackV1* curTRDTrack = new((*outArray)[counter]) AliTRDtrackV1();
- hltTrack->ExportTRDTrack(curTRDTrack);
-
- curSize += trackSize;
- iterPtr += trackSize;
- counter++;
- }
-
- //CheckTrackArray(outArray);
- return counter;
-}
+ TObjArray *outArray=new TObjArray(3);
+ // gain histo
+ TH2I *hCH2d = fTRDCalibraFillHisto->GetCH2d();
+ outArray->Add(hCH2d);
-Int_t AliHLTTRDCalibrationComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
-{
-// //Int_t PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
-// //ireturn = PushToFXS(object, "TRD ", "TRDCalib", "1024 ");
-
- TObjArray *outArray = FormOutput();
- HLTDebug("Shipping data. Dummy. outputArray: pointer = 0x%x; NEntries = %i;", outArray, outArray->GetEntries());
- Int_t ireturn = PushToFXS(outArray, "TRD ", "TRDCalib");
-
- if (outArray){
- outArray->Delete();
- delete outArray;
- }
-
- return ireturn;
-}
+ // drift velocity histo
+ TProfile2D *hPH2d = fTRDCalibraFillHisto->GetPH2d();
+ outArray->Add(hPH2d);
+ // PRF histo
+ TProfile2D *hPRF2d = fTRDCalibraFillHisto->GetPRF2d();
+ outArray->Add(hPRF2d);
+
+ HLTDebug("GetCH2d = 0x%x; NEntries = %i; size = %i", hCH2d, hCH2d->GetEntries(), sizeof(hCH2d));
+ hCH2d->Print();
+ HLTDebug("GetPH2d = 0x%x; NEntries = %i; size = %i", hPH2d, hPH2d->GetEntries(), sizeof(hPH2d));
+ hPH2d->Print();
+ HLTDebug("GetPRF2d = 0x%x; NEntries = %i; size = %i", hPRF2d, hPRF2d->GetEntries(), sizeof(hPRF2d));
+ hPRF2d->Print();
+ HLTDebug("output Array: pointer = 0x%x; NEntries = %i; size = %i", outArray, outArray->GetEntries(), sizeof(outArray));
+
+
+
+ return outArray;
-/**
- * Form output array of histrograms
- */
-//============================================================================
-TObjArray* AliHLTTRDCalibrationComponent::FormOutput()
-{
- TObjArray *outArray=new TObjArray(3);
-
- // gain histo
- TH2I *hCH2d = fTRDCalibraFillHisto->GetCH2d();
- outArray->Add(hCH2d);
-
- // drift velocity histo
- TProfile2D *hPH2d = fTRDCalibraFillHisto->GetPH2d();
- outArray->Add(hPH2d);
-
- // PRF histo
- TProfile2D *hPRF2d = fTRDCalibraFillHisto->GetPRF2d();
- outArray->Add(hPRF2d);
-
- HLTDebug("GetCH2d = 0x%x; NEntries = %i; size = %i", hCH2d, hCH2d->GetEntries(), sizeof(hCH2d));
- hCH2d->Print();
- HLTDebug("GetPH2d = 0x%x; NEntries = %i; size = %i", hPH2d, hPH2d->GetEntries(), sizeof(hPH2d));
- hPH2d->Print();
- HLTDebug("GetPRF2d = 0x%x; NEntries = %i; size = %i", hPRF2d, hPRF2d->GetEntries(), sizeof(hPRF2d));
- hPRF2d->Print();
- HLTDebug("output Array: pointer = 0x%x; NEntries = %i; size = %i", outArray, outArray->GetEntries(), sizeof(outArray));
-
-
-
- return outArray;
-
}
AliHLTUInt32_t& size,
vector<AliHLTComponent_BlockData>& outputBlocks);
/* virtual Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData); */
- virtual Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
+// virtual Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
using AliHLTCalibrationProcessor::ProcessCalibration;
- using AliHLTCalibrationProcessor::ShipDataToFXS;
+// using AliHLTCalibrationProcessor::ShipDataToFXS;
- Bool_t fUseHLTTracks;
- Int_t ReadTracks(TClonesArray *outArray, void* inputPtr, AliHLTUInt32_t size);
-
private:
/** copy constructor prohibited */
AliHLTTRDCalibrationComponent(const AliHLTTRDCalibrationComponent&);
/** assignment operator prohibited */
AliHLTTRDCalibrationComponent& operator=(const AliHLTTRDCalibrationComponent&);
TObjArray* FormOutput();
+
// The size of the output data produced, as a percentage of the input data's size.
- // Can be greater than 100 (%)
-
+ // Can be greater than 100 (%)
unsigned fOutputPercentage; // Output volume in percentage of the input
string fStrorageDBpath; // Default path for OCDB
AliCDBManager *fCDB; //! Pointer to OCDB
#include "AliHLTTRDCluster.h"
-
/**
* Default Constructor
*/
//============================================================================
AliHLTTRDCluster::AliHLTTRDCluster():
- fSize(sizeof(AliHLTTRDCluster)),
fX(0),
fY(0),
fZ(0),
+ fQ(0),
fIsInChamber(kFALSE),
fIsShared(kFALSE),
fDetector(-1),
fLocalTimeBin(0),
- fQ(0),
fClusterMasking(0),
fPadCol(0),
fPadRow(0),
*/
//============================================================================
AliHLTTRDCluster::AliHLTTRDCluster(AliTRDcluster * inCluster):
- fSize (sizeof(AliHLTTRDCluster)),
fX (inCluster->GetX()),
fY (inCluster->GetY()),
fZ (inCluster->GetZ()),
+ fQ (inCluster->GetQ()),
fIsInChamber(inCluster->IsInChamber()),
fIsShared (inCluster->IsShared()),
fDetector (inCluster->GetDetector()),
fLocalTimeBin (inCluster->GetLocalTimeBin()),
- fQ (inCluster->GetQ()),
fClusterMasking (inCluster->IsMasked()),
fPadCol (inCluster->GetPadCol()),
fPadRow (inCluster->GetPadRow()),
outCluster->SetX(fX);
outCluster->SetY(fY);
outCluster->SetZ(fZ);
+ outCluster->SetQ(fQ);
outCluster->SetInChamber(fIsInChamber);
outCluster->SetShared(fIsShared);
outCluster->SetDetector(fDetector);
outCluster->SetLocalTimeBin(fLocalTimeBin);
- outCluster->SetQ(fQ);
outCluster->SetClusterMasking(fClusterMasking);
outCluster->SetPadCol(fPadCol);
//============================================================================
void AliHLTTRDCluster::Print()
{
- //printf(" --hltCluster-- addr 0x%x(%i); fSize %i\n", this, (int)this, this->GetSize());
+ //printf(" --hltCluster-- addr 0x%x(%i); sizeof(*this) %i\n", this, (int)this, this->GetSize());
//printf(" fX %f; fY %f; fZ %f\n",fX,fY,fZ);
}
void ExportTRDCluster(AliTRDcluster* outCluster);
AliHLTUInt8_t *GetEndPointer() // Returns pointer to the end of the cluster
- { return ((AliHLTUInt8_t *) this + fSize); };
- AliHLTUInt32_t GetSize(){ return fSize; };
- void Print();
-
- AliHLTUInt32_t fSize; // Size of the Cluster
-
+ { return ((AliHLTUInt8_t *) this + sizeof(*this)); };
+ AliHLTUInt32_t GetSize(){ return sizeof(*this); };
+ void Print();
private:
// From AliCluster
Float_t fX; // X of the cluster in the tracking c.s.
Float_t fY; // Y of the cluster in the tracking c.s.
Float_t fZ; // Z of the cluster in the tracking c.s.
+ Float_t fQ; // Amplitude
- Bool_t fIsInChamber;
- Bool_t fIsShared;
+ Bool_t fIsInChamber;
+ Bool_t fIsShared;
Short_t fDetector; // TRD detector number
Char_t fLocalTimeBin; // T0-calibrated time bin number
- Float_t fQ; // Amplitude
UChar_t fClusterMasking; // Bit field containing cluster status information;
// From AliTRDcluster
- UChar_t fPadCol; // Central pad number in column direction
- UChar_t fPadRow; // Central pad number in row direction
- UChar_t fPadTime; // Uncalibrated time bin number
- // Short_t fSignals[7]; // Signals in the cluster
-// UChar_t fNPads; // Number of pads in cluster
-// Float_t fCenter; // Center of the cluster relative to the pad
-
+ UChar_t fPadCol; // Central pad number in column direction
+ UChar_t fPadRow; // Central pad number in row direction
+ UChar_t fPadTime; // Uncalibrated time bin number
+ // Short_t fSignals[7]; // Signals in the cluster
+ // UChar_t fNPads; // Number of pads in cluster
+ // Float_t fCenter; // Center of the cluster relative to the pad
};
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * 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. *
+ **************************************************************************/
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// HLT TRD cluster finder //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliHLTTRDClusterizer.h"
+#include "AliTRDgeometry.h"
+#include "AliTRDcluster.h"
+#include "AliTRDReconstructor.h"
+#include <TClonesArray.h>
+
+ClassImp(AliHLTTRDClusterizer);
+
+//_____________________________________________________________________________
+AliHLTTRDClusterizer::AliHLTTRDClusterizer(const AliTRDReconstructor *const rec)
+ :AliTRDclusterizer(rec)
+ , fMemBlock(NULL)
+{
+ //
+ // AliHLTTRDClusterizer default constructor
+ //
+}
+
+//_____________________________________________________________________________
+AliHLTTRDClusterizer::AliHLTTRDClusterizer(const Text_t *const name, const Text_t *const title, const AliTRDReconstructor *const rec)
+ : AliTRDclusterizer(name,title,rec)
+ , fMemBlock(NULL)
+{
+ //
+ // AliHLTTRDClusterizer constructor
+ //
+}
+
+//_____________________________________________________________________________
+AliHLTTRDClusterizer::AliHLTTRDClusterizer(const AliHLTTRDClusterizer& c)
+ : AliTRDclusterizer(c)
+ , fMemBlock(NULL)
+{
+ //
+ // AliHLTTRDClusterizer copy constructor
+ //
+}
+
+//_____________________________________________________________________________
+AliHLTTRDClusterizer& AliHLTTRDClusterizer::operator=(const AliHLTTRDClusterizer& c)
+{
+ //
+ // Assignment operator
+ //
+
+ if(this!=&c)
+ c.Copy(*this);
+ return *this;
+}
+
+//_____________________________________________________________________________
+void AliHLTTRDClusterizer::Copy(TObject& c) const
+{
+ //
+ // Copy function
+ //
+
+ ((AliHLTTRDClusterizer&)c).fMemBlock = NULL;
+}
+
+//_____________________________________________________________________________
+void AliHLTTRDClusterizer::AddClusterToArray(AliTRDcluster *cluster)
+{
+ //
+ // Add a cluster to the array
+ //
+
+ AliHLTTRDCluster *ptr = &(((AliHLTTRDCluster*)GetMemBlock())[fNoOfClusters]);
+ new(ptr) AliHLTTRDCluster(cluster);
+}
--- /dev/null
+#ifndef ALIHLTTRDCLUSTERIZER_H
+#define ALIHLTTRDCLUSTERIZER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+////////////////////////////////////////////////////////////////////////////
+// //
+// HLT TRD cluster finder //
+// //
+////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDclusterizer.h"
+#include "AliHLTTRDCluster.h"
+#include "AliHLTDataTypes.h"
+
+class AliTRDReconstructor;
+class TClonesArray;
+
+class AliHLTTRDClusterizer : public AliTRDclusterizer
+{
+ public:
+ AliHLTTRDClusterizer(const AliTRDReconstructor *const rec = 0x0);
+ AliHLTTRDClusterizer(const Text_t *const name, const Text_t *const title, const AliTRDReconstructor *const rec = 0x0);
+ AliHLTTRDClusterizer(const AliHLTTRDClusterizer& c);
+ AliHLTTRDClusterizer& operator=(const AliHLTTRDClusterizer& c);
+
+ void Copy(TObject& c) const;
+
+ void SetMemBlock(AliHLTUInt8_t* ptr){fMemBlock=ptr;fNoOfClusters=0;}
+ AliHLTUInt8_t* GetMemBlock(){return fMemBlock;}
+ UInt_t GetAddedSize(){return fNoOfClusters*sizeof(AliHLTTRDCluster);}
+
+ protected:
+ TClonesArray* RecPoints(){return 0x0;} //these are functions in the parents class. must not be used in hlt!
+ void SetClustersOwner(Bool_t own){ //if used accidentally it may give an compilation error because are protected,
+ if(own){ /*get rid of warning*/} //but the error can also appear in run time
+ }
+
+
+ void AddClusterToArray(AliTRDcluster *cluster);
+
+ AliHLTUInt8_t* fMemBlock;
+
+ ClassDef(AliHLTTRDClusterizer, 0)
+};
+
+#endif
#include "AliGeomManager.h"
#include "AliTRDReconstructor.h"
#include "AliCDBManager.h"
-#include "AliTRDclusterizerHLT.h"
+#include "AliHLTTRDClusterizer.h"
#include "AliTRDrecoParam.h"
#include "AliTRDrawStreamBase.h"
#include "AliTRDcluster.h"
fCDB(NULL),
fMemReader(NULL),
fReconstructor(NULL),
- fGeometryFileName(""),
- fUseHLTClusters(kFALSE)
+ fGeometryFileName("")
{
// Default constructor
// Work is Done in DoDeInit()
}
-/**
- * Convert AliTRDcluster to AliHLTTRDCluster
- * Add HLTCluster to the output, defined by pointer
- * Fill block desctiptors
- * Return size of the added to ouput objects
- */
-//============================================================================
-UInt_t AliHLTTRDClusterizerComponent::AddToOutput(TClonesArray* inClusterArray, AliHLTUInt8_t* outBlockPtr)
-{
- AliTRDcluster* cluster = 0;
- AliHLTUInt32_t addedSize = 0;
- // == OUTdatatype pointer
- AliHLTTRDCluster * outPtr = (AliHLTTRDCluster*)outBlockPtr;
-
- if (inClusterArray){
- Int_t nbEntries = inClusterArray->GetEntries();
- for (Int_t iCluster = 0; iCluster<nbEntries; iCluster++){
- //cout << "Geting cluster #" << iCluster << endl;
- UInt_t blockSize=0;
-
- cluster = dynamic_cast<AliTRDcluster*>(inClusterArray->At(iCluster));
-
- AliHLTTRDCluster *hltCluster = new (outPtr) AliHLTTRDCluster(cluster);
- //cout << Form("cluster added at 0x%x (%i)\n",outPtr,outPtr);
-
- blockSize = sizeof(*hltCluster);
-
- addedSize += blockSize;
- outBlockPtr += blockSize;
- outPtr = (AliHLTTRDCluster*)outBlockPtr;
- }
- }
- return addedSize;
-
-}
const char* AliHLTTRDClusterizerComponent::GetComponentID()
{
Int_t iRawDataVersion = 2;
int i = 0;
char* cpErr;
- Bool_t bWriteClusters = kFALSE;
-
Int_t iRecoParamType = -1; // default will be the low flux
fGeometryFileName = argv[i+1];
HLTInfo("GeomFile storage is %s", fGeometryFileName.c_str() );
i += 2;
-
}
- else if ( strcmp( argv[i], "-writeClusters" ) == 0)
- {
- bWriteClusters = kTRUE;
- i++;
- }
- else if ( strcmp( argv[i], "-useHLTClusters" ) == 0)
- {
- fUseHLTClusters = kTRUE;
- i++;
- HLTInfo("Using AliHLTCluster to pass data further in the chain");
- }
else{
HLTError("Unknown option '%s'", argv[i] );
return EINVAL;
fReconstructor = new AliTRDReconstructor();
fReconstructor->SetRecoParam(fRecoParam);
fReconstructor->SetStreamLevel(0, AliTRDReconstructor::kClusterizer); // default value
- if (bWriteClusters)
- {
- HLTInfo("Writing clusters. I.e. output is a TTree with clusters");
- fReconstructor->SetOption("cw,sl_cf_0");
- }
- else
- {
- HLTInfo("Not writing clusters. I.e. output is a TClonesArray of clusters");
- fReconstructor->SetOption("!cw,sl_cf_0");
- }
+ HLTInfo("Not writing clusters. I.e. output is a TClonesArray of clusters");
+ fReconstructor->SetOption("hlt,!cw,sl_cf_0");
// init the raw data type to be used...
fMemReader = new AliRawReaderMemory;
- fClusterizer = new AliTRDclusterizerHLT("TRDCclusterizer", "TRDCclusterizer");
+ fClusterizer = new AliHLTTRDClusterizer("TRDCclusterizer", "TRDCclusterizer");
fClusterizer->SetReconstructor(fReconstructor);
-
+ fClusterizer->SetAddLabels(kFALSE);
fClusterizer->SetRawVersion(iRawDataVersion);
- fClusterizer->InitClusterTree();
return 0;
}
HLTDebug( "NofBlocks %lu", evtData.fBlockCnt );
// Process an event
AliHLTUInt32_t totalSize = 0, offset = 0;
- Bool_t bWriteClusters = fReconstructor->IsWritingClusters();
//implement a usage of the following
// AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
fMemReader->SetEquipmentID( id );
- fClusterizer->ResetTree();
+ fClusterizer->SetMemBlock(outputPtr);
Bool_t iclustered = fClusterizer->Raw2ClustersChamber(fMemReader);
if (iclustered == kTRUE)
{
// put the tree into output
//fcTree->Print();
- if (bWriteClusters)
- {
- TTree *fcTree = fClusterizer->GetClusterTree();
- if (fcTree)
+
+ AliHLTUInt32_t addedSize = fClusterizer->GetAddedSize();
+ if (addedSize > 0){
+ // Using low-level interface
+ // with interface classes
+ totalSize += addedSize;
+ if ( totalSize > size )
{
- Int_t nbEntries = fcTree->GetEntriesFast();
- if (nbEntries > 0){
- HLTDebug("fcTree: Entries - %i; Size - %i",nbEntries,sizeof(fcTree));
- PushBack(fcTree, AliHLTTRDDefinitions::fgkClusterDataType, spec);
- }
-
+ HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
+ totalSize, size );
+ return EMSGSIZE;
}
- fClusterizer->RecPoints()->Delete();
-
- }
- else
- {
- TClonesArray *clustersArray = fClusterizer->RecPoints();
- fClusterizer->SetClustersOwner(kFALSE);
- if (clustersArray){
- Int_t nbEntries = clustersArray->GetEntriesFast();
- if (nbEntries > 0){
- if (fUseHLTClusters){
- // Using low-level interface
- // with interface classes
- AliHLTUInt32_t addedSize = AddToOutput(clustersArray, outputPtr);
- 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( "Block ; size %i; dataType %s; spec 0x%x ",
- bd.fSize, DataType2Text(bd.fDataType).c_str(), spec);
-
- }
- else{
- // Using high-level interface
- // pass TClonesArray with streamers
- clustersArray->BypassStreamer(kFALSE);
- HLTDebug("clustersArray: Entries - %i; Size - %i",clustersArray->GetEntriesFast(),sizeof(clustersArray));
- PushBack(clustersArray, AliHLTTRDDefinitions::fgkClusterDataType, spec);
- //PrintObject(clustersArray);
- }
+ // 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( "Block ; size %i; dataType %s; spec 0x%x ",
+ bd.fSize, DataType2Text(bd.fDataType).c_str(), spec);
- clustersArray->Delete();
- }
- delete clustersArray;
- }
- else
- HLTWarning("Array of clusters is empty!");
}
- }// for ( unsigned long i = 0; i < evtData.fBlockCnt; i++ )
+ else
+ HLTWarning("Array of clusters is empty!");
+ }
fReconstructor->SetClusters(0x0);
size = totalSize;
#include "AliHLTProcessor.h"
class AliCDBManager;
-class AliTRDclusterizerHLT;
+class AliHLTTRDClusterizer;
class AliRawReaderMemory;
class TFile;
class AliTRDrecoParam;
/** assignment operator prohibited */
AliHLTTRDClusterizerComponent& operator=(const AliHLTTRDClusterizerComponent&);
- UInt_t AddToOutput(TClonesArray* inClusterArray, AliHLTUInt8_t* outBlockPtr);
-
// The size of the output data produced, as a percentage of the input data's size.
// Can be greater than 100 (%)
string fStrorageDBpath; // Default path for OCDB
- AliTRDclusterizerHLT *fClusterizer; //! Offline derived HLT clusterizer
+ AliHLTTRDClusterizer *fClusterizer; //! Offline derived HLT clusterizer
AliTRDrecoParam *fRecoParam; //! Offline reco params
AliCDBManager *fCDB; //! Pointer to OCDB
AliRawReaderMemory *fMemReader; //! Input raw data reader
string fGeometryFileName; // Path to geometry file
- Bool_t fUseHLTClusters; // Use or not AliHLTCluster interface
ClassDef(AliHLTTRDClusterizerComponent, 0)
#include "AliESDtrack.h"
#include "TTree.h"
#include "AliHLTTRDDefinitions.h"
+#include "AliHLTTRDUtils.h" \
/** global instance for component registration */
AliHLTTRDEsdWriterComponent gTRDEsdWriter;
:
AliHLTRootFileWriterComponent(),
fTree(NULL),
+ fOutputPercentage(100),
fESD(NULL)
{
// see header file for class documentation
:
AliHLTRootFileWriterComponent(),
fTree(NULL),
+ fOutputPercentage(100),
fESD(NULL)
{
}
return iResult;
}
-int AliHLTTRDEsdWriterComponent::DumpEvent( const AliHLTComponentEventData& /*evtData*/,
- const AliHLTComponentBlockData* /*blocks*/,
- AliHLTComponentTriggerData& trigData )
+int AliHLTTRDEsdWriterComponent::DumpEvent( const AliHLTComponentEventData& evtData,
+ const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& /*trigData*/ )
{
- // see header file for class documentation
- int iResult=0;
- TTree* pTree=fTree;
-
- AliHLTUInt32_t fDblock_Specification = 0;
+int result=0;
- //implement a usage of the following
- // AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
- // AliHLTUInt32_t triggerDataSize = trigData.fDataSize;
- // void *triggerData = trigData.fData;
- Logging( kHLTLogDebug, "HLT::TRDEsdWriter::DumpEvent", "Trigger data received",
- "Struct size %d Data size %d Data location 0x%x", trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
-
- //AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::fgkTRDSAEsdDataType );
- AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::fgkTRDSATracksDataType );
- if (dblock != 0)
+for ( unsigned long iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ )
{
- fDblock_Specification = dblock->fSpecification;
+ // HLTDebug("i am a debug message"); // y does it not print out debug messages???
+ /*HLTInfo("Block # %i/%i; Event 0x%08LX (%Lu)",
+ iBlock, evtData.fBlockCnt,
+ evtData.fEventID, evtData.fEventID);*/
+
+
+ TClonesArray* tracksArray = NULL;
+ const AliHLTComponentBlockData &block = blocks[iBlock];
+ tracksArray = new TClonesArray("AliTRDtrackV1");
+
+ //HLTInfo("BLOCK fPtr 0x%x, fOffset %i, fSize %i, fSpec 0x%x, fDataType %s", block.fPtr, block.fOffset, block.fSize, block.fSpecification, DataType2Text(block.fDataType).c_str()); //HLTInfo instead of HLTDebug, because debug gives no output... -> strange
+
+ AliHLTTRDUtils::ReadTracks(tracksArray, block.fPtr, block.fSize);
+
+ // give out number of tracklets in tracksArray
+ Int_t nbEntries = tracksArray->GetEntries();
+ HLTInfo(" %i TRDtracks in tracksArray", nbEntries);
+
}
- else
- {
- Logging( kHLTLogWarning, "HLT::TRDEsdWriter::DumpEvent", "DATAIN", "First Input Block not found! 0x%x", dblock);
- return -1;
- }
-
- int ibForce = 1;
- TObject *tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::fgkTRDSATracksDataType, "AliESDtrack", ibForce);
- Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "1stBLOCK", "Pointer = 0x%x", tobjin);
- AliESDtrack* track = (AliESDtrack *)tobjin;
+ /* AliESDtrack* track = (AliESDtrack *)tobjin;
if (!track)
{
Logging( kHLTLogWarning, "HLT::TRDEsdWriter::DumpEvent", "DATAIN", "First Input Block not a ESDtrack! 0x%x", tobjin);
Logging( kHLTLogInfo, "HLT::TRDEsdWriter::DumpEvent", "Fill", "Ntracks: %d", nTracks);
pTree->Fill();
- fESD->Reset();
+ fESD->Reset(); */
- return iResult;
+ return result;
}
-int AliHLTTRDEsdWriterComponent::ScanArgument(int argc, const char** argv)
+// int AliHLTTRDEsdWriterComponent::ScanArgument(int argc, const char** argv)
+// {
+// // see header file for class documentation
+// int iResult=AliHLTRootFileWriterComponent::ScanArgument(argc, argv);
+// return iResult;
+// }
+
+int AliHLTTRDEsdWriterComponent::DoEvent( const AliHLTComponent_EventData& /*evtData*/,
+ const AliHLTComponent_BlockData* /*blocks*/,
+ AliHLTComponent_TriggerData& /*trigData*/,
+ AliHLTUInt8_t* /*outputPtr*/,
+ AliHLTUInt32_t& /*size*/,
+ vector<AliHLTComponent_BlockData>& /*outputBlocks*/)
{
- // see header file for class documentation
- int iResult=AliHLTRootFileWriterComponent::ScanArgument(argc, argv);
- return iResult;
+HLTDebug("ignor me");
+return 0;
+
+}
+
+Int_t AliHLTTRDEsdWriterComponent::ScanArgument( int argc, const char** argv )
+{
+ // perform initialization. We check whether our relative output size is specified in the arguments.
+ int i = 0;
+ char* cpErr;
+ HLTDebug("argv[%d] == %s", i, argv[i] );
+ if ( !strcmp( argv[i], "output_percentage" ) )
+ {
+ if ( i+1>=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 %lu %%", fOutputPercentage );
+
+ }
+ //AliHLTRootFileWriterComponent::ScanArgument(argc, argv);
+
+ return 0;
+}
+
+
+void AliHLTTRDEsdWriterComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+ // Get the output data size
+ constBase = 0;
+ inputMultiplier = ((double)fOutputPercentage)/100.0;
}
* Spawn function.
* @return new class instance
*/
+ virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
AliHLTComponent* Spawn() {return new AliHLTTRDEsdWriterComponent;}
protected:
virtual int DumpEvent( const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
AliHLTComponentTriggerData& trigData );
-
+
using AliHLTRootFileWriterComponent::DumpEvent;
/**
* -EPROTO parameter for argument missing <br>
*/
int ScanArgument(int argc, const char** argv);
+
+
private:
/** not a valid copy constructor, defined according to effective C++ style */
/** the ESD tree */
TTree* fTree; //! transient value
+
+ /** output percentage descared*/
+ Int_t fOutputPercentage;
/** the ESD */
AliESDEvent* fESD; //! transient value
+ int DoEvent( const AliHLTComponent_EventData& evtData,
+ const AliHLTComponent_BlockData* blocks,
+ AliHLTComponent_TriggerData& /*trigData*/,
+ AliHLTUInt8_t* /*outputPtr*/,
+ AliHLTUInt32_t& /*size*/,
+ vector<AliHLTComponent_BlockData>& /*outputBlocks*/);
+
ClassDef(AliHLTTRDEsdWriterComponent, 1)
+
};
#endif
+++ /dev/null
-// $Id$
-
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
- * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
- * 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. *
- **************************************************************************/
-
-/** @file AliHLTTRDTrackerComponent.cxx
- @author Timm Steinbeck, Matthias Richter
- @date
- @brief A TRDTracker processing component for the HLT. */
-
-#if __GNUC__ >= 3
-using namespace std;
-#endif
-
-#include "TFile.h"
-#include "TChain.h"
-
-#include "AliHLTTRDTrackerComponent.h"
-#include "AliHLTTRDDefinitions.h"
-#include "AliCDBManager.h"
-
-#include "AliTRDReconstructor.h"
-#include "AliTRDrecoParam.h"
-#include "AliESDEvent.h"
-//#include "AliTRDtrackerHLT.h"
-#include "AliTRDtracker.h"
-#include "AliTRDCalibraFillHisto.h"
-#include "AliMagF.h"
-#include "AliTRDcluster.h"
-#include "AliESDfriend.h"
-#include <cstdlib>
-#include <cerrno>
-#include <string>
-
-// this is a global object used for automatic component registration, do not use this
-AliHLTTRDTrackerComponent gAliHLTTRDTrackerComponent;
-
-ClassImp(AliHLTTRDTrackerComponent);
-
-AliHLTTRDTrackerComponent::AliHLTTRDTrackerComponent()
- : AliHLTProcessor()
- , fOutputPercentage(100) // By default we copy to the output exactly what we got as input
- , fStrorageDBpath("local://$ALICE_ROOT/OCDB")
- , fCDB(NULL)
- , fGeometryFileName("")
- , fGeometryFile(NULL)
- , fGeoManager(NULL)
- , fTracker(NULL)
-{
- // Default constructor
-
- fGeometryFileName = getenv("ALICE_ROOT");
- fGeometryFileName += "/HLT/TRD/geometry.root";
-}
-
-AliHLTTRDTrackerComponent::~AliHLTTRDTrackerComponent()
-{
- // Destructor
-}
-
-const char* AliHLTTRDTrackerComponent::GetComponentID()
-{
- // Return the component ID const char *
- return "TRDTracker"; // The ID of this component
-}
-
-void AliHLTTRDTrackerComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
-{
- // Get the list of input data
- list.clear(); // We do not have any requirements for our input data type(s).
- list.push_back( AliHLTTRDDefinitions::fgkClusterDataType );
-}
-
-AliHLTComponent_DataType AliHLTTRDTrackerComponent::GetOutputDataType()
-{
- // Get the output data type
- return AliHLTTRDDefinitions::fgkClusterDataType;
-}
-
-void AliHLTTRDTrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
-{
- // Get the output data size
- constBase = 0;
- inputMultiplier = ((double)fOutputPercentage)/100.0;
-}
-
-// Spawn function, return new instance of this class
-AliHLTComponent* AliHLTTRDTrackerComponent::Spawn()
-{
- // Spawn function, return new instance of this class
- return new AliHLTTRDTrackerComponent;
-};
-
-int AliHLTTRDTrackerComponent::DoInit( int argc, const char** argv )
-{
- // perform initialization. We check whether our relative output size is specified in the arguments.
- fOutputPercentage = 100;
- int i = 0;
- char* cpErr;
- while ( i < argc )
- {
- HLTDebug("argv[%d] == %s", i, argv[i] );
- if ( !strcmp( argv[i], "output_percentage" ) )
- {
- if ( i+1>=argc )
- {
- HLTError("Missing output_percentage parameter");
- return ENOTSUP;
- }
- HLTDebug("Arguments", "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 %lu %%", fOutputPercentage );
- i += 2;
- continue;
- }
-
- 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;
- continue;
- }
-
- if ( strcmp( argv[i], "-geometry" ) == 0)
- {
- if ( i+1 >= argc )
- {
- HLTError("Missing -geometry argument");
- return ENOTSUP;
- }
- fGeometryFileName = argv[i+1];
- HLTInfo("GeomFile storage is %s", fGeometryFileName.c_str() );
- i += 2;
- continue;
- }
-
- HLTError("Unknown option '%s'", argv[i] );
- return EINVAL;
- }
-
-
- 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("fCDB 0x%x", fCDB);
- }
-
- fGeometryFile = TFile::Open(fGeometryFileName.c_str());
- if (fGeometryFile)
- {
- fGeoManager = (TGeoManager *)fGeometryFile->Get("Geometry");
- //fTracker = new AliTRDtrackerHLT(fGeometryFile);
- AliTRDrecoParam *fPars = AliTRDrecoParam::GetLowFluxParam();
- //fPars->SetSeeding(kTRUE);
- //fPars->SetStreamLevel(0);
- AliTRDReconstructor reconstructor; reconstructor.SetRecoParam(fPars);
- // write clusters [cw] = true
- // track seeding (stand alone tracking) [sa] = true
- // PID method in reconstruction (NN) [nn] = true
- // write online tracklets [tw] = false
- // drift gas [ar] = false
- reconstructor.SetOption("cw,sa");
- fTracker = new AliTRDtracker(fGeometryFile);
- //fTracker = new AliTRDtracker(fGeometryFile);
- }
- else
- {
- HLTError("Unable to open file. FATAL!");
- return -1;
- }
-
- AliTRDCalibraFillHisto *calibra = AliTRDCalibraFillHisto::Instance();
- if (calibra == 0)
- {
- HLTError("Calibration Histos ::Instance failed");
- return -1;
- }
- else
- {
- calibra->Init2Dhistos();
- }
-
- return 0;
-}
-
-int AliHLTTRDTrackerComponent::DoDeinit()
-{
- // Deinitialization of the component
-
- delete fTracker;
- fTracker = 0;
-
- if (fGeometryFile)
- {
- fGeometryFile->Close();
- delete fGeometryFile;
- fGeometryFile = 0;
- }
-
- AliTRDCalibraFillHisto *calibra = AliTRDCalibraFillHisto::Instance();
- if (calibra)
- {
- // should not write in here!
- calibra->Write2d();
- calibra->Destroy();
- }
-
- return 0;
-}
-
-int AliHLTTRDTrackerComponent::DoEvent( const AliHLTComponentEventData & /*evtData*/,
- AliHLTComponentTriggerData & /*trigData*/ )
-{
- // Process an event
-
- HLTInfo("Output percentage set to %lu %%", fOutputPercentage );
- HLTInfo("NofBlocks %lu", GetNumberOfInputBlocks() );
-
- AliHLTUInt32_t dBlockSpecification = 0;
-
- //implement a usage of the following
- // AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
- // AliHLTUInt32_t triggerDataSize = trigData.fDataSize;
- // void *triggerData = trigData.fData;
- //HLTDebug("Struct size %d Data size %d Data location 0x%x", trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
-
- AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTTRDDefinitions::fgkClusterDataType );
- if (dblock != 0)
- {
- dBlockSpecification = dblock->fSpecification;
- }
- else
- {
- HLTWarning("First Input Block not found! 0x%x", dblock);
- return -1;
- }
-
- int ibForce = 0;
- TObject *tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::fgkClusterDataType, "TTree", ibForce);
- HLTInfo("Pointer = 0x%x", tobjin);
-
- TTree *clusterTree = (TTree*)tobjin;
- if (!clusterTree)
- {
- HLTWarning("First Input Block not a tree! 0x%x", tobjin);
- return -1;
- }
-
- HLTInfo("Pointer = 0x%x Name = %s", clusterTree, clusterTree->GetName());
-
- while (tobjin != 0)
- {
- if (clusterTree)
- {
- HLTInfo("Pointer = 0x%x Name = %s", clusterTree, clusterTree->GetName());
- Int_t iNentries = clusterTree->GetEntries();
- HLTInfo("N of tree entries = %d", iNentries);
- fTracker->LoadClusters(clusterTree);
- }
- else
- {
- HLTError("Tree Pointer = 0x%x", clusterTree);
- }
-
- tobjin = (TObject *)GetNextInputObject( ibForce );
- HLTInfo("Pointer = 0x%x", tobjin);
- clusterTree = (TTree*)tobjin;
- }
-
- fTracker->SetAddTRDseeds();
-
- AliESDfriend *esdFriend = new AliESDfriend();
-
- AliESDEvent *esd = new AliESDEvent();
- esd->CreateStdContent();
- fTracker->PropagateBack(esd);
- fTracker->RefitInward(esd);
- fTracker->Clusters2Tracks(esd);
-
- esd->GetESDfriend(esdFriend);
- //here transport the esd tracks further
-
- Int_t nTracks = esd->GetNumberOfTracks();
- Int_t nTRDTracks = esd->GetNumberOfTrdTracks();
- HLTInfo( "Number of tracks %d Number of TRD tracks %d", nTracks, nTRDTracks);
-
-
- for (Int_t it = 0; it < nTracks; it++)
- {
- AliESDtrack* track = esd->GetTrack(it);
- HLTInfo("Track %d 0x%x Pt %1.2f", it, track, track->Pt());
- PushBack(track, AliHLTTRDDefinitions::fgkTRDSATracksDataType, ++dBlockSpecification);
- }
-
- delete esd;
- delete esdFriend;
-
- delete clusterTree;
-
- return 0;
-}
+++ /dev/null
-// $Id$
-
-#ifndef ALIHLTTRDTRACKERCOMPONENT_H
-#define ALIHLTTRDTRACKERCOMPONENT_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/** @file AliHLTTRDTrackerComponent.h
- @author Timm Steinbeck, Matthias Richter
- @date
- @brief Declaration of a TRDTracker component. */
-
-
-#include "AliHLTProcessor.h"
-class AliCDBManager;
-class TFile;
-class TGeoManager;
-//class AliTRDtrackerHLT;
-class AliTRDtracker;
-class AliMagF;
-
-/**
- * @class AliHLTTRDTrackerComponent
- * @brief A TRDTracker HLT processing component.
- *
- * An implementiation of a TRDTracker component that just copies its input data
- * as a test, demonstration, and example of the HLT component scheme.
- * @ingroup alihlt_tutorial
- */
-class AliHLTTRDTrackerComponent : public AliHLTProcessor
- {
- public:
- AliHLTTRDTrackerComponent();
- virtual ~AliHLTTRDTrackerComponent();
-
- // Public functions to implement AliHLTComponent's interface.
- // These functions are required for the registration process
-
- const char* GetComponentID();
- void GetInputDataTypes( vector<AliHLTComponent_DataType>& list);
- AliHLTComponent_DataType GetOutputDataType();
- virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
- AliHLTComponent* Spawn();
-
- protected:
-
- // Protected functions to implement AliHLTComponent's interface.
- // These functions provide initialization as well as the actual processing
- // capabilities of the component.
-
- int DoInit( int argc, const char** argv );
- int DoDeinit();
-/* int DoEvent( const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks, */
-/* AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr, */
-/* AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& outputBlocks ); */
- int DoEvent( const AliHLTComponentEventData & evtData,
- AliHLTComponentTriggerData & trigData );
-
- using AliHLTProcessor::DoEvent;
-
- private:
- /** copy constructor prohibited */
- AliHLTTRDTrackerComponent(const AliHLTTRDTrackerComponent&);
- /** assignment operator prohibited */
- AliHLTTRDTrackerComponent& operator=(const AliHLTTRDTrackerComponent&);
-
- // The size of the output data produced, as a percentage of the input data's size.
- // Can be greater than 100 (%)
- unsigned fOutputPercentage; // Output volume in percentage of the input
-
- string fStrorageDBpath; // Default path for OCDB
- AliCDBManager *fCDB; //! Pointer to OCDB
-
- string fGeometryFileName; // Path to geometry file
- TFile *fGeometryFile; //! // Pointer to the geom root file
- TGeoManager *fGeoManager; //! Pointer to geometry manager
-
- //AliTRDtrackerHLT *fTracker;//! Offline-like/HLT tracker
- AliTRDtracker *fTracker;//! Offline-pure/HLT tracker
-
- ClassDef(AliHLTTRDTrackerComponent, 0)
-
- };
-#endif
#include "AliHLTTRDDefinitions.h"
#include "AliHLTTRDCluster.h"
#include "AliHLTTRDTrack.h"
+#include "AliHLTTRDUtils.h"
#include "TFile.h"
#include "TChain.h"
fStrorageDBpath("local://$ALICE_ROOT/OCDB"),
fCDB(NULL),
fGeometryFileName(""),
- fUseHLTClusters(kFALSE),
- fUseHLTTracks(kFALSE),
fTracker(NULL),
fRecoParam(NULL),
fReconstructor(NULL)
return new AliHLTTRDTrackerV1Component;
};
-/**
- * Convert AliTRDtrackV1 to AliHLTTRDTrack
- * Add HLTTrack to the output, defined by pointer
- * Fill block desctiptors
- * Return size of the added to ouput objects
- */
-//============================================================================
-AliHLTUInt32_t AliHLTTRDTrackerV1Component::AddToOutput(TClonesArray* inTrackArray, AliHLTUInt8_t* output)
-{
- cout << "\nWriting tracks to the Memory\n ============= \n";
- AliTRDtrackV1* track = 0;
- AliHLTUInt32_t addedSize = 0;
- AliHLTUInt8_t *iterPtr = output;
- AliHLTTRDTrack * outPtr = (AliHLTTRDTrack*)iterPtr;
-
- if (inTrackArray){
- Int_t nbTracks = inTrackArray->GetEntries();
- for (Int_t iTrack = 0; iTrack<nbTracks; iTrack++){
- AliHLTUInt32_t trackSize=0;
-
- track = dynamic_cast<AliTRDtrackV1*>(inTrackArray->At(iTrack));
- //track->Print();
-
- AliHLTTRDTrack *hltTrack = new (outPtr) AliHLTTRDTrack(track);
- trackSize = hltTrack->GetSize();
- addedSize += trackSize;
- HLTDebug("addedSize %i, trackSize %i", addedSize, trackSize);
-
- iterPtr += trackSize;
- outPtr = (AliHLTTRDTrack*)iterPtr;
- }
- }
- return addedSize;
-
-}
int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv )
{
iMagneticField = 0;
i++;
}
- else if ( strcmp( argv[i], "-writeClusters" ) == 0)
- {
- bWriteClusters = kTRUE;
- HLTDebug("input clusters are expected to be in a TTree.");
- i++;
- }
else if ( strcmp( argv[i], "-offlineMode" ) == 0)
{
bHLTMode=kFALSE;
HLTDebug("Using standard offline tracking.");
i++;
}
- else if ( strcmp( argv[i], "-useHLTClusters" ) == 0)
- {
- fUseHLTClusters = kTRUE;
- i++;
- HLTInfo("expecting AliHLTCluster as input");
- }
- else if ( strcmp( argv[i], "-useHLTTracks" ) == 0)
- {
- fUseHLTTracks = kTRUE;
- i++;
- HLTInfo("Using AliHLTTrack to pass data further in the chain");
- }
else {
HLTError("Unknown option '%s'", argv[i] );
return EINVAL;
vector<AliHLTComponent_BlockData>& outputBlocks )
{
// Process an event
- Bool_t bWriteClusters = fReconstructor->IsWritingClusters();
-
+
HLTDebug("NofBlocks %lu", evtData.fBlockCnt );
AliHLTUInt32_t totalSize = 0, offset = 0;
DataType2Text(inputDataType).c_str());
- TTree *clusterTree = 0x0;
- TClonesArray* clusterArray = 0x0;
- ReadAndLoadClusters(clusterTree, clusterArray, &block);
+ TClonesArray* clusterArray = new TClonesArray("AliTRDcluster"); // would be nice to allocate memory for all clusters here.
+ AliHLTTRDUtils::ReadClusters(clusterArray, block.fPtr, block.fSize);
+ HLTDebug("TClonesArray of clusters: nbEntries = %i", clusterArray->GetEntriesFast());
+ fTracker->LoadClusters(clusterArray);
+
+
// maybe it is not so smart to create it each event? clear is enough ?
AliESDEvent *esd = new AliESDEvent();
esd->CreateStdContent();
fTracker->Clusters2Tracks(esd);
- //here transport the esd tracks further
Int_t nTracks = esd->GetNumberOfTracks();
- Int_t nTRDTracks = esd->GetNumberOfTrdTracks();
- HLTInfo("Number of tracks == %d == Number of TRD tracks %d", nTracks, nTRDTracks);
+ HLTInfo("Number of tracks == %d ==", nTracks);
TClonesArray* trdTracks = fTracker->GetListOfTracks();
AliTRDReconstructor::SetClusters(0x0);
delete esd;
- if (bWriteClusters)
- delete clusterTree;
- else{
- //clusterArray->Delete();
- delete clusterArray;
}
- }
size = totalSize;
HLTDebug("Event is done. size written to the output is %i", size);
- // CALLGRIND_STOP_INSTRUMENTATION();
return 0;
}
-/**
- * ReadClusters from the component input and load them to the tracker
- */
-//============================================================================
-void AliHLTTRDTrackerV1Component::ReadAndLoadClusters(TTree *inClusterTree,
- TClonesArray *inClusterArray, const AliHLTComponentBlockData *inBlock)
-{
- Bool_t bWriteClusters = fReconstructor->IsWritingClusters();
- const AliHLTComponentBlockData &block = *inBlock;
-
-
- TObject *tobjin = 0x0;
- int ibForce = 0; // almost obsolet
-
- if (bWriteClusters){
- tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::fgkClusterDataType, "TTree", ibForce);
- HLTDebug("1stBLOCK; Pointer = 0x%x", tobjin);
- inClusterTree = (TTree*)tobjin;
- if (inClusterTree)
- {
- HLTDebug("CLUSTERS; Pointer to TTree = 0x%x Name = %s", inClusterTree, inClusterTree->GetName());
- HLTDebug("TTree of clusters: nbEntries = %i", inClusterTree->GetEntriesFast());
- fTracker->LoadClusters(inClusterTree);
- }
- else
- {
- HLTError("First Input Block is not a TTree 0x%x", tobjin);
- }
- }
- else if (fUseHLTClusters)
- {
- inClusterArray = new TClonesArray("AliTRDcluster"); // would be nice to allocate memory for all clusters here.
- ReadClusters(inClusterArray, block.fPtr, block.fSize);
- HLTDebug("TClonesArray of clusters: nbEntries = %i", inClusterArray->GetEntriesFast());
- fTracker->LoadClusters(inClusterArray);
- }
- else
- {
- tobjin = (TObject *)GetFirstInputObject( AliHLTTRDDefinitions::fgkClusterDataType, "TClonesArray", ibForce);
- HLTDebug("1stBLOCK; Pointer = 0x%x", tobjin);
- inClusterArray = (TClonesArray*)tobjin;
- if (inClusterArray)
- {
- HLTDebug("CLUSTERS; Pointer to TClonesArray = 0x%x Name = %s", inClusterArray, inClusterArray->GetName());
- HLTDebug("TClonesArray of clusters: nbEntries = %i", inClusterArray->GetEntriesFast());
- fTracker->LoadClusters(inClusterArray);
- }
- else
- {
- HLTError("First Input Block not a TClonesArray 0x%x", tobjin);
- }
- }
-}
-
-/**
- * Read cluster to the TClonesArray from the memory
- */
-//============================================================================
-Int_t AliHLTTRDTrackerV1Component::ReadClusters(TClonesArray *outArray, void* inputPtr, AliHLTUInt32_t size)
-{
- //HLTDebug("\nReading clusters from the Memory\n ============= \n");
- AliHLTTRDCluster * curCluster;
- UInt_t clusterSize = sizeof(AliHLTTRDCluster), curSize = 0;
- Int_t i=0;
-
- curCluster = (AliHLTTRDCluster*) inputPtr;
- while (curSize + clusterSize <= size)
- {
- // HLTDebug(" fX = %f; fY = %f; fZ = %f", curCluster->fX, curCluster->fY, curCluster->fZ);
-
- AliTRDcluster* curTRDCluster = new((*outArray)[i]) AliTRDcluster();
- curCluster->ExportTRDCluster(curTRDCluster);
- // HLTDebug(" fX = %f; fY = %f; fZ = %f", curTRDCluster->GetX(), curTRDCluster->GetY(), curTRDCluster->GetZ());
- curSize += clusterSize;
- i++;
- curCluster++;
- //cout << " current readed size is " << curSize << "/" << size << endl;
- }
-
- return i;
-}
/**
* Transport tracks to the next component
* Return Numbers of bytes written to the output
if (nbTracks>0)
{
HLTDebug("We have an output array: pointer to inTracksArray = 0x%x, nbEntries = %i", inTracksArray, nbTracks);
- if (fUseHLTTracks){
- // Using low-level interface
+
+ // Using low-level interface
// with interface classes
- AliHLTUInt32_t addedSize = AddToOutput(inTracksArray, output);
+ AliHLTUInt32_t addedSize = AliHLTTRDUtils::AddTracksToOutput(inTracksArray, output);
// Fill block
AliHLTComponentBlockData bd;
HLTDebug("BD fPtr 0x%x, fOffset %i, fSize %i, fSpec 0x%x", bd.fPtr, bd.fOffset, bd.fSize, bd.fSpecification);
return addedSize;
+
}
- else{
- inTracksArray->BypassStreamer(kFALSE);
- PushBack(inTracksArray, AliHLTTRDDefinitions::fgkTRDSATracksDataType);
- return 0;
- }
-
- }
return 0;
}
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-/** @file AliHLTTRDTrackerComponent.h
+/** @file AliHLTTRDTrackerV1Component.h
@author Timm Steinbeck, Matthias Richter
@date
@brief Declaration of a TRDTracker component. */
class AliTRDReconstructor;
/**
- * @class AliHLTTRDTrackerComponent
+ * @class AliHLTTRDTrackerV1Component
* @brief A TRDTrackerV1 HLT processing component.
*
* Uses the second generation TRD tracker AliTRDtrackerV1
AliHLTComponent* Spawn();
protected:
- AliHLTUInt32_t AddToOutput (TClonesArray* inTrackArray, AliHLTUInt8_t* output);
- Int_t ReadClusters (TClonesArray *outArray, void* inputPtr, AliHLTUInt32_t size);
- void ReadAndLoadClusters(TTree *inClusterTree, TClonesArray *inClusterArray, const AliHLTComponentBlockData *inBlock);
AliHLTUInt32_t TransportTracks(TClonesArray *inTracksArray, AliHLTUInt8_t* output,
vector<AliHLTComponent_BlockData>& outputBlocks, AliHLTUInt32_t inOffset, AliHLTUInt32_t inSpec);
AliCDBManager *fCDB; //! Pointer to OCDB
string fGeometryFileName; // Path to geometry file
- Bool_t fUseHLTClusters;
- Bool_t fUseHLTTracks;
-
+
AliTRDtrackerV1 *fTracker;//! Offline-pure/HLT tracker V1
AliTRDrecoParam *fRecoParam; //! Offline reco params
AliTRDReconstructor * fReconstructor;
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * 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. *
+ **************************************************************************/
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// HLT TRD Utillities Class //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliHLTTRDUtils.h"
+#include <TClonesArray.h>
+#include "AliHLTTRDTrack.h"
+#include "AliHLTTRDCluster.h"
+
+AliHLTUInt32_t AliHLTTRDUtils::AddClustersToOutput(TClonesArray* inClusterArray, AliHLTUInt8_t* outBlockPtr)
+{
+ AliTRDcluster* cluster = 0;
+ AliHLTUInt32_t addedSize = 0;
+ // == OUTdatatype pointer
+ AliHLTTRDCluster * outPtr = (AliHLTTRDCluster*)outBlockPtr;
+
+ if (inClusterArray){
+ Int_t nbEntries = inClusterArray->GetEntries();
+ for (Int_t iCluster = 0; iCluster<nbEntries; iCluster++){
+ //cout << "Geting cluster #" << iCluster << endl;
+ UInt_t blockSize=0;
+
+ cluster = dynamic_cast<AliTRDcluster*>(inClusterArray->At(iCluster));
+
+ AliHLTTRDCluster *hltCluster = new (outPtr) AliHLTTRDCluster(cluster);
+ //cout << Form("cluster added at 0x%x (%i)\n",outPtr,outPtr);
+
+ blockSize = sizeof(*hltCluster);
+
+ addedSize += blockSize;
+ outBlockPtr += blockSize;
+ outPtr = (AliHLTTRDCluster*)outBlockPtr;
+ }
+ }
+ return addedSize;
+
+}
+
+AliHLTUInt32_t AliHLTTRDUtils::AddTracksToOutput(TClonesArray* inTrackArray, AliHLTUInt8_t* output)
+{
+ cout << "\nWriting tracks to the Memory\n ============= \n";
+ AliTRDtrackV1* track = 0;
+ AliHLTUInt32_t addedSize = 0;
+ AliHLTUInt8_t *iterPtr = output;
+ AliHLTTRDTrack * outPtr = (AliHLTTRDTrack*)iterPtr;
+
+ if (inTrackArray){
+ Int_t nbTracks = inTrackArray->GetEntries();
+ for (Int_t iTrack = 0; iTrack<nbTracks; iTrack++){
+ AliHLTUInt32_t trackSize=0;
+
+ track = dynamic_cast<AliTRDtrackV1*>(inTrackArray->At(iTrack));
+ //track->Print();
+
+ AliHLTTRDTrack *hltTrack = new (outPtr) AliHLTTRDTrack(track);
+ trackSize = hltTrack->GetSize();
+ addedSize += trackSize;
+ HLTDebug("addedSize %i, trackSize %i", addedSize, trackSize);
+
+ iterPtr += trackSize;
+ outPtr = (AliHLTTRDTrack*)iterPtr;
+ }
+ }
+ return addedSize;
+
+}
+
+/**
+ * Read cluster to the TClonesArray from the memory
+ */
+//============================================================================
+AliHLTUInt32_t AliHLTTRDUtils::ReadClusters(TClonesArray *outArray, void* inputPtr, AliHLTUInt32_t size)
+{
+ //HLTDebug("\nReading clusters from the Memory\n ============= \n");
+ AliHLTTRDCluster * curCluster;
+ UInt_t clusterSize = sizeof(AliHLTTRDCluster), curSize = 0;
+ Int_t i=0;
+
+ curCluster = (AliHLTTRDCluster*) inputPtr;
+ while (curSize + clusterSize <= size)
+ {
+ // HLTDebug(" fX = %f; fY = %f; fZ = %f", curCluster->fX, curCluster->fY, curCluster->fZ);
+
+ AliTRDcluster* curTRDCluster = new((*outArray)[i]) AliTRDcluster();
+ curCluster->ExportTRDCluster(curTRDCluster);
+ // HLTDebug(" fX = %f; fY = %f; fZ = %f", curTRDCluster->GetX(), curTRDCluster->GetY(), curTRDCluster->GetZ());
+ curSize += clusterSize;
+ i++;
+ curCluster++;
+ //cout << " current readed size is " << curSize << "/" << size << endl;
+ }
+
+ return i;
+}
+
+AliHLTUInt32_t AliHLTTRDUtils::ReadTracks(TClonesArray *outArray, void* inputPtr, AliHLTUInt32_t size)
+{
+ AliHLTUInt8_t* iterPtr = (AliHLTUInt8_t* )inputPtr;
+
+ //cout << "\nReading tracks from the Memory\n ============= \n";
+ HLTDebug ("\nReading tracks from the Memory\n ============= \n");
+ AliHLTTRDTrack * hltTrack;
+ AliHLTUInt32_t trackSize = 0, curSize = 0;
+ Int_t counter=0;
+
+ while (curSize < size)
+ {
+ hltTrack = (AliHLTTRDTrack*) iterPtr;
+ HLTDebug("curSize %i, size %i",curSize, size);
+
+ trackSize = hltTrack->GetSize();
+ HLTDebug("GetSize() %i", trackSize);
+
+ hltTrack->ReadTrackletsFromMemory(iterPtr + sizeof(AliHLTTRDTrack));
+
+ AliTRDtrackV1* curTRDTrack = new((*outArray)[counter]) AliTRDtrackV1();
+ hltTrack->ExportTRDTrack(curTRDTrack);
+
+ curSize += trackSize;
+ iterPtr += trackSize;
+ counter++;
+ }
+
+ //CheckTrackArray(outArray);
+
+ return counter;
+}
+
--- /dev/null
+#ifndef ALIHLTTRDUTILS_H
+#define ALIHLTTRDUTILS_H
+/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+////////////////////////////////////////////////////////////////////////////
+// //
+// HLT TRD Utillities Class //
+// //
+////////////////////////////////////////////////////////////////////////////
+
+
+#include "AliHLTDataTypes.h"
+
+class TClonesArray;
+
+class AliHLTTRDUtils
+{
+public:
+static AliHLTUInt32_t AddClustersToOutput(TClonesArray* inClusterArray, AliHLTUInt8_t* outBlockPtr);
+static AliHLTUInt32_t AddTracksToOutput(TClonesArray* inTrackArray,AliHLTUInt8_t* output);
+static AliHLTUInt32_t ReadClusters(TClonesArray *outArray, void* inputPtr, AliHLTUInt32_t size);
+static AliHLTUInt32_t ReadTracks(TClonesArray *outArray, void* inputPtr, AliHLTUInt32_t size);
+
+};
+
+#endif
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * 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. *
- **************************************************************************/
-
-///////////////////////////////////////////////////////////////////////////////
-// //
-// TRD cluster finder //
-// //
-///////////////////////////////////////////////////////////////////////////////
-
-#include <TF1.h>
-#include <TTree.h>
-#include <TH1.h>
-#include <TFile.h>
-
-#include "AliRunLoader.h"
-#include "AliLoader.h"
-#include "AliRawReader.h"
-#include "AliLog.h"
-
-#include "AliTRDclusterizerHLT.h"
-#include "AliTRDgeometry.h"
-#include "AliTRDdigitsManager.h"
-#include "AliTRDfeeParam.h"
-#include "AliTRDpadPlane.h"
-#include "AliTRDrawData.h"
-#include "AliTRDcalibDB.h"
-#include "AliTRDSimParam.h"
-#include "AliTRDcluster.h"
-
-#include "Cal/AliTRDCalROC.h"
-#include "Cal/AliTRDCalDet.h"
-
-ClassImp(AliTRDclusterizerHLT)
-
- //_____________________________________________________________________________
- AliTRDclusterizerHLT::AliTRDclusterizerHLT()
- : AliTRDclusterizer()
- , fTreeCreatedHere(kFALSE)
- , fNclusters(-1)
- , fRawDataSource(0)
- , fFeeParams(0)
-{
- //
- // AliTRDclusterizerHLT default constructor
- //
-}
-
-//_____________________________________________________________________________
-AliTRDclusterizerHLT::AliTRDclusterizerHLT(const Text_t *name, const Text_t *title, AliTRDReconstructor * rec)
- : AliTRDclusterizer(name,title,rec)
- , fTreeCreatedHere(kFALSE)
- , fNclusters(-1)
- , fRawDataSource(0)
- , fFeeParams(0)
-{
- //
- // AliTRDclusterizerHLT constructor
- //
-}
-
-//_____________________________________________________________________________
-AliTRDclusterizerHLT::AliTRDclusterizerHLT(const Text_t *name, const Text_t *title)
- : AliTRDclusterizer(name,title)
- , fTreeCreatedHere(kFALSE)
- , fNclusters(-1)
- , fRawDataSource(0)
- , fFeeParams(0)
-{
- //
- // AliTRDclusterizerHLT constructor
- //
-}
-
-//_____________________________________________________________________________
-AliTRDclusterizerHLT::AliTRDclusterizerHLT(const AliTRDclusterizerHLT &c)
- : AliTRDclusterizer(c)
- , fTreeCreatedHere(kFALSE)
- , fNclusters(-1)
- , fRawDataSource(0)
- , fFeeParams(0)
-{
- //
- // AliTRDclusterizerHLT copy constructor
- //
-}
-
-//_____________________________________________________________________________
-AliTRDclusterizerHLT::~AliTRDclusterizerHLT()
-{
- //
- // AliTRDclusterizerHLT destructor
- //
- if (fTreeCreatedHere == kTRUE)
- delete fClusterTree;
-
- delete fRawDataSource;
-
-}
-
-//_____________________________________________________________________________
-AliTRDclusterizerHLT &AliTRDclusterizerHLT::operator=(const AliTRDclusterizerHLT &c)
-{
- //
- // Assignment operator
- //
-
- this->fRawDataSource = 0;
- if (this != &c) ((AliTRDclusterizerHLT &) c).Copy(*this);
- return *this;
-
-}
-
-//_____________________________________________________________________________
-void AliTRDclusterizerHLT::Copy(TObject &c) const
-{
- //
- // Copy function
- //
-
- AliFatal("Not implemented");
-
- //use the parameter c - no warning...
- ((AliTRDclusterizerHLT &) c).fDigitsManager = 0;
- // ((AliTRDclusterizerHLT &) c).fDigitsManager = 0;
- // ((AliTRDclusterizerHLT &) c).fTreeCreatedHere = kFALSE;
- // AliTRDclusterizer::Copy(c);
-
-}
-
-void AliTRDclusterizerHLT::SetRawVersion(Int_t iver)
-{
- //
- // set the expected raw data version
- //
-
- AliTRDclusterizer::SetRawVersion(iver);
-
- if (fFeeParams == 0)
- {
- fFeeParams = AliTRDfeeParam::Instance();
- }
-
- fFeeParams->SetRAWversion(iver);
-}
-//_____________________________________________________________________________
-Bool_t AliTRDclusterizerHLT::ReadDigits(AliRawReaderMemory *rawReader)
-{
- //
- // Reads the digits arrays from the ddl file
- //
-
- if (fRawDataSource == 0)
- fRawDataSource = new AliTRDrawData;
-
- //PH fRawDataSource->SetRawVersion(fRawVersion);
-
- fDigitsManager = fRawDataSource->Raw2Digits((AliRawReader*)rawReader);
- //AliInfo(Form("Digits manager at 0x%x", fDigitsManager));
- AliDebug(1, Form("Digits manager at 0x%x", fDigitsManager));
- if (fDigitsManager)
- return kTRUE;
- else
- return kFALSE;
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDclusterizerHLT::InitClusterTree()
-{
- //
- // This has to be called on HLT - creation of the cluster Tree used by the offline clusterizer (base class)
- //
- Bool_t kReturn = kFALSE;
- if (fClusterTree == 0)
- {
- fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree");
- fTreeCreatedHere = kTRUE;
- }
-
- if (fClusterTree != 0)
- kReturn = kTRUE;
-
- return kReturn;
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDclusterizerHLT::InsertClusters(TClonesArray *tobjarr, Int_t idet)
-{
- //
- // Fill the tree with clusters - from a different component for example
- //
-
- //clear the current
- ResetRecPoints();
- delete fRecPoints;
- fRecPoints = 0;
-
- //set the pointer used in WriteClusters
- fRecPoints = tobjarr;
- Bool_t kRet = kFALSE;
- if (InitClusterTree())
- kRet = WriteClusters(idet);
-
- fRecPoints = 0;
-
- return kRet;
-}
-//_____________________________________________________________________________
-Int_t AliTRDclusterizerHLT::GetNclusters()
-{
- //
- // Returns the number of clusters AliTRDclusterizerHLT::fNclusters
- // Count them first if fNclusters < 0
- //
-
- if (fNclusters < 0)
- {
- CountClusters();
- }
- return fNclusters;
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDclusterizerHLT::ResetTree()
-{
- //
- // Recreate the cluster tree
- //
-
- // if (fClusterTree != 0)
- // fClusterTree->Reset();
- // well we'd better delete the whole tree and branches
- delete fClusterTree;
- fClusterTree = NULL;
- fClusterTree = new TTree("TRDclusterTree", "TRDclusterTree");
- if (fClusterTree)
- {
- fTreeCreatedHere = kTRUE;
- fNclusters = -1;
- //AliInfo("Tree Reset Successful");
- AliDebug(1,Form("Tree Reset Successful"));
- }
- else
- {
- fTreeCreatedHere = kFALSE;
- AliError("Reset Tree Error!\n");
- }
-
- return fTreeCreatedHere;
-}
-
-//_____________________________________________________________________________
-Int_t AliTRDclusterizerHLT::CountClusters()
-{
- //
- // Count the clusters - runs over the cluster tree
- //
-
- fNclusters = -1;
- if (fClusterTree == 0)
- {
- AliError("No tree to count clusters!\n");
- return -1;
- }
- TList *lt = (TList*)fClusterTree->GetListOfBranches();
- TIter it(lt);
- it.Reset();
- TBranch *tb = 0;
- Int_t icount = 0;
- while ((tb = (TBranch*)it.Next()) != 0)
- {
- TObjArray *clusters = 0;
- tb->SetAddress(&clusters);
- for (Int_t icb = 0; icb < tb->GetEntries(); icb++)
- {
- tb->GetEntry(icb);
- icount += clusters->GetEntries();
- }
- }
- fNclusters = icount;
- //AliInfo(Form("Recounted clusters %d", fNclusters));
- AliDebug(2, Form("Recounted clusters %d", fNclusters));
-
- return fNclusters;
-}
+++ /dev/null
-#ifndef ALITRDCLUSTERIZERHLT_H
-#define ALITRDCLUSTERIZERHLT_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-////////////////////////////////////////////////////////////////////////////
-// //
-// TRD cluster finder //
-// //
-////////////////////////////////////////////////////////////////////////////
-
-#include "AliTRDclusterizer.h"
-
-class AliRawReader;
-class AliRawReaderMemory;
-class AliTRDrawData;
-class AliTRDfeeParam;
-
-class AliTRDclusterizerHLT : public AliTRDclusterizer
-{
- public:
-
- AliTRDclusterizerHLT();
- AliTRDclusterizerHLT(const Text_t* name, const Text_t* title, AliTRDReconstructor* reconstructor);
- AliTRDclusterizerHLT(const Text_t* name, const Text_t* title);
- AliTRDclusterizerHLT(const AliTRDclusterizerHLT &c);
- virtual ~AliTRDclusterizerHLT();
- AliTRDclusterizerHLT &operator=(const AliTRDclusterizerHLT &c);
-
- virtual void Copy(TObject &c) const;
- //virtual Bool_t MakeClusters();
- virtual Bool_t ReadDigits(AliRawReaderMemory* rawReader);
- using AliTRDclusterizer::ReadDigits;
- //virtual Bool_t TreeClusters(Int_t idet);
- virtual Bool_t InitClusterTree();
- virtual Bool_t InsertClusters(TClonesArray *tobjarr, Int_t idet);
- virtual Int_t CountClusters();
- virtual Int_t GetNclusters();
-
- virtual Bool_t ResetTree();
-
- TTree * GetClusterTree() {return fClusterTree;}
- virtual Bool_t IsTreeOwner() const {return fTreeCreatedHere;}
-
- virtual void SetRawVersion(Int_t iver);
-
- protected:
- virtual Bool_t ReadDigits() const {return kFALSE;} //this method not to be used on HLT
- virtual Bool_t ReadDigits(AliRawReader* /*rawReader*/) const {/*if (!rawReader) */ return kFALSE;} //this method not to be used on HLT
-
- Bool_t fTreeCreatedHere; //flag indicating that AliTRDclusterizerHLT has created the cluster tree
-
- private:
-
- Int_t fNclusters; //number of clusters found - updated by ::GetNclusters()
- AliTRDrawData *fRawDataSource; //! pointer to the TRD raw data stream
- AliTRDfeeParam *fFeeParams; //! fee parameters - this is singleton so watch out! with delete
-
- ClassDef(AliTRDclusterizerHLT,1) // TRD-Cluster finder, slow simulator
-
-};
-
-#endif
CLASS_HDRS:= \
AliHLTTRDClusterizerComponent.h \
AliHLTTRDDefinitions.h \
- AliHLTTRDTrackerComponent.h \
AliHLTTRDTrackerV1Component.h \
- AliTRDclusterizerHLT.h \
+ AliHLTTRDClusterizer.h \
AliHLTTRDEsdWriterComponent.h \
AliHLTTRDCalibrationComponent.h \
AliHLTTRDCluster.h \
AliHLTTRDTracklet.h \
AliHLTTRDTrack.h \
- AliHLTTRDAgent.h
+ AliHLTTRDAgent.h \
+ AliHLTTRDUtils.h
# library sources
MODULE_SRCS= \