From 775f67d72739332a5f7a6b7b466eae13d4e04e3e Mon Sep 17 00:00:00 2001 From: richterm Date: Wed, 5 Aug 2009 08:18:04 +0000 Subject: [PATCH] HLT TRD code update by Theodor - Add possibility to output online (L1) tracklets - remove code setting the OCDB storage within the component - re-arrangement of OCDB access from the components - code cleanup --- HLT/TRD/AliHLTTRDCalibrationComponent.cxx | 303 +++++++++++----------- HLT/TRD/AliHLTTRDCalibrationComponent.h | 4 +- HLT/TRD/AliHLTTRDClusterizer.cxx | 51 +++- HLT/TRD/AliHLTTRDClusterizer.h | 34 ++- HLT/TRD/AliHLTTRDClusterizerComponent.cxx | 203 +++++++++------ HLT/TRD/AliHLTTRDClusterizerComponent.h | 94 ++++--- HLT/TRD/AliHLTTRDTrackerV1Component.cxx | 125 +++++---- HLT/TRD/AliHLTTRDTrackerV1Component.h | 89 +++---- HLT/TRD/AliHLTTRDTrackletWordArray.h | 25 ++ HLT/TRD/AliHLTTRDUtils.cxx | 2 + HLT/TRD/AliHLTTRDUtils.h | 1 + HLT/libAliHLTTRD.pkg | 1 + 12 files changed, 519 insertions(+), 413 deletions(-) create mode 100644 HLT/TRD/AliHLTTRDTrackletWordArray.h diff --git a/HLT/TRD/AliHLTTRDCalibrationComponent.cxx b/HLT/TRD/AliHLTTRDCalibrationComponent.cxx index 181e3688bf4..5ef550485cc 100644 --- a/HLT/TRD/AliHLTTRDCalibrationComponent.cxx +++ b/HLT/TRD/AliHLTTRDCalibrationComponent.cxx @@ -22,7 +22,7 @@ @brief A TRDCalibration processing component for the HLT. */ #if __GNUC__ >= 3 - using namespace std; +using namespace std; #endif #include "TTree.h" @@ -34,6 +34,7 @@ #include "AliHLTTRDUtils.h" #include "AliCDBManager.h" +#include "AliCDBStorage.h" #include "AliRawReaderMemory.h" #include "AliTRDCalibraFillHisto.h" #include "AliTRDtrackV1.h" @@ -48,135 +49,123 @@ AliHLTTRDCalibrationComponent gAliHLTTRDCalibrationComponent; ClassImp(AliHLTTRDCalibrationComponent); AliHLTTRDCalibrationComponent::AliHLTTRDCalibrationComponent(): - 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) + AliHLTCalibrationProcessor(), + fTRDCalibraFillHisto(NULL), + fOutputPercentage(100) // By default we copy to the output exactly what we got as input { - // 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& 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. - int i = 0; - char* cpErr; - while ( i < argc ) + // 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" ) ) { - 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; + 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; } - return 0; + 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); - } + if(!AliCDBManager::Instance()->IsDefaultStorageSet()){ + HLTError("DefaultStorage is not Set in CDBManager"); + return -1; + } + if(AliCDBManager::Instance()->GetRun()<0){ + AliCDBManager *cdb = AliCDBManager::Instance(); + if (cdb) + { + cdb->SetRun(0); + HLTWarning("Setting CDB Runnumber to 0. CDB instance 0x%x", cdb); + } else - { - 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; + { + 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()); + + + 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"); + HLTDebug("DeinitCalibration"); - // Deinitialization of the component + // Deinitialization of the component - if (fCDB) - { - HLTDebug("destroy fCDB"); - fCDB->Destroy(); - fCDB = 0; - } - return 0; + return 0; } Int_t AliHLTTRDCalibrationComponent::ProcessCalibration(const AliHLTComponent_EventData& evtData, @@ -186,61 +175,61 @@ Int_t AliHLTTRDCalibrationComponent::ProcessCalibration(const AliHLTComponent_Ev AliHLTUInt32_t& /*size*/, vector& /*outputBlocks*/) { - HLTDebug("NofBlocks %lu", evtData.fBlockCnt ); - // Process an event - - // Loop over all input blocks in the event - vector 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); - } - } + HLTDebug("NofBlocks %lu", evtData.fBlockCnt ); + // Process an event + + // Loop over all input blocks in the event + vector 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; - } + TObjArray *outArray = FormOutput(); + if (outArray) { + PushBack(outArray, AliHLTTRDDefinitions::fgkCalibrationDataType); + delete outArray; + } - } - return 0; + } + return 0; } @@ -251,31 +240,31 @@ Int_t AliHLTTRDCalibrationComponent::ProcessCalibration(const AliHLTComponent_Ev //============================================================================ TObjArray* AliHLTTRDCalibrationComponent::FormOutput() { - TObjArray *outArray=new TObjArray(3); + TObjArray *outArray=new TObjArray(3); - // gain histo - TH2I *hCH2d = fTRDCalibraFillHisto->GetCH2d(); - outArray->Add(hCH2d); + // gain histo + TH2I *hCH2d = fTRDCalibraFillHisto->GetCH2d(); + outArray->Add(hCH2d); - // drift velocity histo - TProfile2D *hPH2d = fTRDCalibraFillHisto->GetPH2d(); - outArray->Add(hPH2d); + // drift velocity histo + TProfile2D *hPH2d = fTRDCalibraFillHisto->GetPH2d(); + outArray->Add(hPH2d); - // PRF histo - TProfile2D *hPRF2d = fTRDCalibraFillHisto->GetPRF2d(); - outArray->Add(hPRF2d); + // 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)); + 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; + return outArray; } diff --git a/HLT/TRD/AliHLTTRDCalibrationComponent.h b/HLT/TRD/AliHLTTRDCalibrationComponent.h index 11937244ce7..dc695386d8d 100644 --- a/HLT/TRD/AliHLTTRDCalibrationComponent.h +++ b/HLT/TRD/AliHLTTRDCalibrationComponent.h @@ -76,10 +76,8 @@ class AliHLTTRDCalibrationComponent : public AliHLTCalibrationProcessor // 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 - ClassDef(AliHLTTRDCalibrationComponent, 0) + ClassDef(AliHLTTRDCalibrationComponent, 1) }; #endif diff --git a/HLT/TRD/AliHLTTRDClusterizer.cxx b/HLT/TRD/AliHLTTRDClusterizer.cxx index f1eab4b3d4c..f4c6d676d7a 100644 --- a/HLT/TRD/AliHLTTRDClusterizer.cxx +++ b/HLT/TRD/AliHLTTRDClusterizer.cxx @@ -30,7 +30,9 @@ ClassImp(AliHLTTRDClusterizer) //_____________________________________________________________________________ AliHLTTRDClusterizer::AliHLTTRDClusterizer(const AliTRDReconstructor *const rec) :AliTRDclusterizer(rec) - , fMemBlock(NULL) + ,fClMemBlock(NULL) + ,fTrMemBlock(NULL) + ,fTrMemCurrPtr(NULL) { // // AliHLTTRDClusterizer default constructor @@ -40,7 +42,9 @@ AliHLTTRDClusterizer::AliHLTTRDClusterizer(const AliTRDReconstructor *const rec) //_____________________________________________________________________________ AliHLTTRDClusterizer::AliHLTTRDClusterizer(const Text_t *const name, const Text_t *const title, const AliTRDReconstructor *const rec) : AliTRDclusterizer(name,title,rec) - , fMemBlock(NULL) + ,fClMemBlock(NULL) + ,fTrMemBlock(NULL) + ,fTrMemCurrPtr(NULL) { // // AliHLTTRDClusterizer constructor @@ -50,7 +54,9 @@ AliHLTTRDClusterizer::AliHLTTRDClusterizer(const Text_t *const name, const Text_ //_____________________________________________________________________________ AliHLTTRDClusterizer::AliHLTTRDClusterizer(const AliHLTTRDClusterizer& c) : AliTRDclusterizer(c) - , fMemBlock(NULL) + ,fClMemBlock(NULL) + ,fTrMemBlock(NULL) + ,fTrMemCurrPtr(NULL) { // // AliHLTTRDClusterizer copy constructor @@ -76,7 +82,9 @@ void AliHLTTRDClusterizer::Copy(TObject& c) const // Copy function // - ((AliHLTTRDClusterizer&)c).fMemBlock = NULL; + ((AliHLTTRDClusterizer&)c).fClMemBlock = NULL; + ((AliHLTTRDClusterizer&)c).fTrMemBlock = NULL; + ((AliHLTTRDClusterizer&)c).fTrMemCurrPtr = NULL; } //_____________________________________________________________________________ @@ -86,6 +94,39 @@ void AliHLTTRDClusterizer::AddClusterToArray(AliTRDcluster *cluster) // Add a cluster to the array // - AliHLTTRDCluster *ptr = &(((AliHLTTRDCluster*)GetMemBlock())[fNoOfClusters]); + AliHLTTRDCluster *ptr = &(((AliHLTTRDCluster*)GetClMemBlock())[fNoOfClusters]); new(ptr) AliHLTTRDCluster(cluster); } + +//_____________________________________________________________________________ +void AliHLTTRDClusterizer::AddTrackletsToArray() +{ + // + // Add the online tracklets of this chamber to the array + // + + // memcpy(&(((UInt_t*)GetTrMemBlock())[fNoOfTracklets]),fTrackletContainer[0],256*sizeof(UInt_t)); + // memcpy(&(((UInt_t*)GetTrMemBlock())[fNoOfTracklets+256]),fTrackletContainer[1],256*sizeof(UInt_t)); + + // fNoOfTracklets += 512; + + UInt_t* trackletword; + AliHLTTRDTrackletWordArray* trklArr = new(fTrMemCurrPtr) AliHLTTRDTrackletWordArray(fDet); + fTrMemCurrPtr += sizeof(AliHLTTRDTrackletWordArray); + for(Int_t side=0; side<2; side++) + { + Int_t trkl=0; + trackletword=fTrackletContainer[side]; + while(trackletword[trkl]>0){ + trkl++; + } + memcpy(fTrMemCurrPtr,fTrackletContainer[side],trkl*sizeof(UInt_t)); + fTrMemCurrPtr += trkl*sizeof(UInt_t); + trklArr->fCount += trkl; + } + + // fTrackletContainer[0]+=256; + // fTrackletContainer[1]+=256; + // fNoOfTracklets += 512; + +} diff --git a/HLT/TRD/AliHLTTRDClusterizer.h b/HLT/TRD/AliHLTTRDClusterizer.h index a4171b4c2c0..06f23e7e11e 100644 --- a/HLT/TRD/AliHLTTRDClusterizer.h +++ b/HLT/TRD/AliHLTTRDClusterizer.h @@ -10,11 +10,12 @@ //////////////////////////////////////////////////////////////////////////// #include "AliTRDclusterizer.h" +#include "AliTRDReconstructor.h" #include "AliHLTTRDCluster.h" #include "AliHLTDataTypes.h" +#include "AliHLTTRDTrackletWordArray.h" -class AliTRDReconstructor; -class TClonesArray; +class AliHLTTRDTrackletWord; class AliHLTTRDClusterizer : public AliTRDclusterizer { @@ -25,20 +26,33 @@ class AliHLTTRDClusterizer : public AliTRDclusterizer 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);} + void SetMemBlock(AliHLTUInt8_t* ptr){ + if(fReconstructor->IsProcessingTracklets()){ + fTrMemBlock=ptr; fTrMemCurrPtr=ptr; + fClMemBlock=ptr+GetTrMemBlockSize(); fNoOfClusters=0; //if IsProcessingTracklets() is enabled we always reserve a data block of size GetTrMemBlockSize() for the tracklets + }else{ + fClMemBlock=ptr; fNoOfClusters=0; + } + } + AliHLTUInt8_t* GetClMemBlock(){return fClMemBlock;} + AliHLTUInt8_t* GetTrMemBlock(){return fTrMemBlock;} + UInt_t GetAddedClSize(){return fNoOfClusters*sizeof(AliHLTTRDCluster);} + UInt_t GetAddedTrSize(){return (AliHLTUInt8_t*)fTrMemCurrPtr-(AliHLTUInt8_t*)fTrMemBlock;} + UInt_t GetTrMemBlockSize(){return 30*(sizeof(AliHLTTRDTrackletWordArray)+512*sizeof(UInt_t));} protected: void AddClusterToArray(AliTRDcluster *cluster); + void AddTrackletsToArray(); - 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, - //but the error can also appear in run time + TClonesArray* RecPoints(){return 0x0;} //these are functions in the parents class and must not be used in hlt! + TClonesArray* TrackletsArray(){return 0x0;} //if used accidentally it may give a compilation error because they are protected, + void SetClustersOwner(Bool_t /*own*/){} //but it could be that the error appears only in run time - AliHLTUInt8_t* fMemBlock; + AliHLTUInt8_t* fClMemBlock; + AliHLTUInt8_t* fTrMemBlock; + AliHLTUInt8_t* fTrMemCurrPtr; - ClassDef(AliHLTTRDClusterizer, 0) + ClassDef(AliHLTTRDClusterizer, 1) }; #endif diff --git a/HLT/TRD/AliHLTTRDClusterizerComponent.cxx b/HLT/TRD/AliHLTTRDClusterizerComponent.cxx index abc425297a6..2fbf81e5a4d 100644 --- a/HLT/TRD/AliHLTTRDClusterizerComponent.cxx +++ b/HLT/TRD/AliHLTTRDClusterizerComponent.cxx @@ -42,6 +42,7 @@ using namespace std; #include "AliGeomManager.h" #include "AliTRDReconstructor.h" #include "AliCDBManager.h" +#include "AliCDBStorage.h" #include "AliHLTTRDClusterizer.h" #include "AliTRDrecoParam.h" #include "AliTRDrawStreamBase.h" @@ -64,19 +65,15 @@ ClassImp(AliHLTTRDClusterizerComponent) AliHLTTRDClusterizerComponent::AliHLTTRDClusterizerComponent(): AliHLTProcessor(), - fOutputPercentage(100), // By default we copy to the output exactly what we got as input - fStrorageDBpath("local://$ALICE_ROOT/OCDB"), + fOutputPercentage(500), + fOutputConst(0), fClusterizer(NULL), fRecoParam(NULL), - fCDB(NULL), fMemReader(NULL), - fReconstructor(NULL), - fGeometryFileName("") + fReconstructor(NULL) { // Default constructor - fGeometryFileName = getenv("ALICE_ROOT"); - fGeometryFileName += "/HLT/TRD/geometry.root"; } AliHLTTRDClusterizerComponent::~AliHLTTRDClusterizerComponent() @@ -96,19 +93,29 @@ void AliHLTTRDClusterizerComponent::GetInputDataTypes( vector= argc ) - { - HLTError("Missing -cdb argument"); - return ENOTSUP; - } - fStrorageDBpath = argv[i+1]; - HLTInfo("DB storage is %s", fStrorageDBpath.c_str() ); + HLTInfo("Output percentage set to %i %%", fOutputPercentage ); i += 2; } else if ( strcmp( argv[i], "-lowflux" ) == 0) @@ -212,11 +209,15 @@ int AliHLTTRDClusterizerComponent::DoInit( int argc, const char** argv ) HLTError("Missing -geometry argument"); return ENOTSUP; } - fGeometryFileName = argv[i+1]; - HLTInfo("GeomFile storage is %s", fGeometryFileName.c_str() ); + geometryFileName = argv[i+1]; + HLTInfo("GeomFile storage is %s", geometryFileName.c_str() ); i += 2; - } - + } + else if ( strcmp( argv[i], "-processTracklets" ) == 0) + { + bProcessTracklets = kTRUE; + i++; + } else if ( strcmp( argv[i], "-yPosMethod" ) == 0) { if ( i+1 >= argc ) @@ -236,6 +237,11 @@ int AliHLTTRDClusterizerComponent::DoInit( int argc, const char** argv ) } 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] ); @@ -246,7 +252,7 @@ int AliHLTTRDClusterizerComponent::DoInit( int argc, const char** argv ) // THE "REAL" INIT COMES HERE - if (iRecoParamType < 0 || iRecoParamType > 2) +if (iRecoParamType < 0 || iRecoParamType > 2) { HLTWarning("No reco param selected. Use -lowflux or -highflux flag. Defaulting to low flux."); iRecoParamType = 0; @@ -290,7 +296,10 @@ int AliHLTTRDClusterizerComponent::DoInit( int argc, const char** argv ) case 1: recoOptions += ",!gs,lut"; break; case 2: recoOptions += ",gs,!lut"; break; } - + if(bProcessTracklets) recoOptions += ",tp"; + else recoOptions += ",!tp"; + + HLTInfo("Reconstructor options: %s",recoOptions.Data()); fReconstructor->SetOption(recoOptions.Data()); // init the raw data type to be used... @@ -315,30 +324,42 @@ int AliHLTTRDClusterizerComponent::DoInit( int argc, const char** argv ) } // the DATA BASE STUFF - fCDB = AliCDBManager::Instance(); - if (!fCDB) - { - HLTError("Could not get CDB instance", "fCDB 0x%x", fCDB); - } - else - { - fCDB->SetRun(0); // THIS HAS TO BE RETRIEVED !!! - fCDB->SetDefaultStorage(fStrorageDBpath.c_str()); - HLTDebug("CDB instance; fCDB 0x%x", fCDB); - } - - if((AliGeomManager::GetGeometry()) == NULL){ - - if ( TFile::Open(fGeometryFileName.c_str())) { - AliGeomManager::LoadGeometry(fGeometryFileName.c_str()); + + if(!AliCDBManager::Instance()->IsDefaultStorageSet()){ + HLTError("DefaultStorage is not Set in CDBManager"); + return -1; + } + if(AliCDBManager::Instance()->GetRun()<0){ + AliCDBManager *cdb = AliCDBManager::Instance(); + if (cdb) + { + cdb->SetRun(0); + HLTWarning("Setting CDB Runnumber to 0. CDB instance 0x%x", cdb); + } + else + { + HLTError("Could not get CDB instance", "cdb 0x%x", cdb); + return -1; + } + } + HLTInfo("CDB default storage: %s; RunNo: %i", (AliCDBManager::Instance()->GetDefaultStorage()->GetBaseFolder()).Data(), AliCDBManager::Instance()->GetRun()); + + if(!AliGeomManager::GetGeometry()){ + if(!TFile::Open(geometryFileName.c_str())){ + HLTInfo("Loading standard geometry file"); + AliGeomManager::LoadGeometry(); + }else{ + HLTWarning("Loading non-standard geometry file"); + AliGeomManager::LoadGeometry(geometryFileName.c_str()); } - else { - HLTError("Cannot load geometry from file %s",fGeometryFileName.c_str()); + if(!AliGeomManager::GetGeometry()){ + HLTError("Cannot load geometry"); return EINVAL; } } - else + else{ HLTInfo("Geometry Already Loaded"); + } fMemReader = new AliRawReaderMemory; @@ -346,6 +367,9 @@ int AliHLTTRDClusterizerComponent::DoInit( int argc, const char** argv ) fClusterizer->SetReconstructor(fReconstructor); fClusterizer->SetUseLabels(kFALSE); fClusterizer->SetRawVersion(iRawDataVersion); + + if(fReconstructor->IsProcessingTracklets()) + fOutputConst = fClusterizer->GetTrMemBlockSize(); return 0; } @@ -362,14 +386,6 @@ int AliHLTTRDClusterizerComponent::DoDeinit() fReconstructor = 0x0; return 0; - - if (fCDB) - { - HLTDebug("destroy fCDB"); - fCDB->Destroy(); - fCDB = 0; - } - if (fRecoParam) { HLTDebug("Deleting fRecoParam"); @@ -386,7 +402,11 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD vector& outputBlocks ) { // Process an event - HLTDebug( "NofBlocks %lu", evtData.fBlockCnt ); + + if (evtData.fEventID == 1) + CALLGRIND_START_INSTRUMENTATION; + + HLTDebug( "NofBlocks %i", evtData.fBlockCnt ); // Process an event AliHLTUInt32_t totalSize = 0, offset = 0; @@ -398,20 +418,17 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD // Loop over all input blocks in the event AliHLTComponentDataType expectedDataType = (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD); - for ( unsigned long i = 0; i < evtData.fBlockCnt; i++ ) - { - if (evtData.fEventID == 1) - CALLGRIND_START_INSTRUMENTATION; - - const AliHLTComponentBlockData &block = blocks[i]; + for ( UInt_t iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ ) + { + const AliHLTComponentBlockData &block = blocks[iBlock]; // lets not use the internal TRD data types here : AliHLTTRDDefinitions::fgkDDLRawDataType // which is depreciated - we use HLT global defs instead // if ( block.fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTRD) ) AliHLTComponentDataType inputDataType = block.fDataType; if ( inputDataType != expectedDataType) { - HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s; Skipping", - i, evtData.fBlockCnt, + HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) Wrong received datatype: %s - required datatype: %s; Skipping", + iBlock, evtData.fBlockCnt, evtData.fEventID, evtData.fEventID, DataType2Text(inputDataType).c_str(), DataType2Text(expectedDataType).c_str()); @@ -419,10 +436,11 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD } else { - HLTDebug("We get the right data type: Block # %i/%i; Event 0x%08LX (%Lu) Received datatype: %s", - i, evtData.fBlockCnt, - evtData.fEventID, evtData.fEventID, - DataType2Text(inputDataType).c_str()); + HLTDebug("We get the right data type: Block # %i/%i; Event 0x%08LX (%Lu) Received datatype: %s; Block Size: %i", + iBlock, evtData.fBlockCnt, + evtData.fEventID, evtData.fEventID, + DataType2Text(inputDataType).c_str(), + block.fSize); } // fMemReader->Reset(); @@ -442,7 +460,7 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD fMemReader->SetEquipmentID( id ); - fClusterizer->SetMemBlock((AliHLTUInt8_t*)(outputPtr+offset)); + fClusterizer->SetMemBlock(outputPtr+offset); Bool_t iclustered = fClusterizer->Raw2ClustersChamber(fMemReader); if (iclustered == kTRUE) { @@ -457,18 +475,20 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD // put the tree into output //fcTree->Print(); - AliHLTUInt32_t addedSize = fClusterizer->GetAddedSize(); + AliHLTUInt32_t addedSize; + if(fReconstructor->IsProcessingTracklets()){ + addedSize = fClusterizer->GetAddedTrSize(); + totalSize += fClusterizer->GetTrMemBlockSize(); //if IsProcessingTracklets() is enabled we always reserve a data block of size GetTrMemBlockSize() for the tracklets if (addedSize > 0){ // Using low-level interface // with interface classes - totalSize += addedSize; if ( totalSize > size ) { HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", totalSize, size ); return EMSGSIZE; } - + // Fill block AliHLTComponentBlockData bd; FillBlockData( bd ); @@ -476,14 +496,40 @@ int AliHLTTRDClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtD bd.fSize = addedSize; //bd.fSpecification = spec; bd.fSpecification = gkAliEventTypeData; - bd.fDataType = AliHLTTRDDefinitions::fgkClusterDataType; + 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); - offset = totalSize; - } - else - HLTWarning("Array of clusters is empty!"); + offset = totalSize; + } + + addedSize = fClusterizer->GetAddedClSize(); + if (addedSize > 0){ + // Using low-level interface + // with interface classes + totalSize += addedSize; + if ( totalSize > size ) + { + HLTError("Too much data; Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", + totalSize, size ); + return EMSGSIZE; + } + + // Fill block + AliHLTComponentBlockData bd; + FillBlockData( bd ); + bd.fOffset = offset; + bd.fSize = addedSize; + //bd.fSpecification = spec; + bd.fSpecification = gkAliEventTypeData; + bd.fDataType = AliHLTTRDDefinitions::fgkClusterDataType; + outputBlocks.push_back( bd ); + HLTDebug( "BD fPtr 0x%x, fOffset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), spec); + offset = totalSize; + + } + else + HLTWarning("Array of clusters is empty!"); } fReconstructor->SetClusters(0x0); @@ -505,4 +551,3 @@ void AliHLTTRDClusterizerComponent::PrintObject( TClonesArray* inClustersArray) } } - diff --git a/HLT/TRD/AliHLTTRDClusterizerComponent.h b/HLT/TRD/AliHLTTRDClusterizerComponent.h index d0236d23869..f80d9798f7e 100644 --- a/HLT/TRD/AliHLTTRDClusterizerComponent.h +++ b/HLT/TRD/AliHLTTRDClusterizerComponent.h @@ -28,60 +28,56 @@ class AliTRDReconstructor; * @ingroup alihlt_tutorial */ class AliHLTTRDClusterizerComponent : public AliHLTProcessor - { - public: - AliHLTTRDClusterizerComponent(); - virtual ~AliHLTTRDClusterizerComponent(); - - // Public functions to implement AliHLTComponent's interface. - // These functions are required for the registration process - - const char* GetComponentID(); - void GetInputDataTypes( vector& list); - AliHLTComponent_DataType GetOutputDataType(); - virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); - AliHLTComponent* Spawn(); - - protected: +{ +public: + AliHLTTRDClusterizerComponent(); + virtual ~AliHLTTRDClusterizerComponent(); + + // Public functions to implement AliHLTComponent's interface. + // These functions are required for the registration process + + const char* GetComponentID(); + void GetInputDataTypes( vector& list); + AliHLTComponent_DataType GetOutputDataType(); + int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList); + virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); + AliHLTComponent* Spawn(); - // 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& outputBlocks ); - - void PrintObject( TClonesArray* inClustersArray); - using AliHLTProcessor::DoEvent; +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& outputBlocks ); + + void PrintObject( TClonesArray* inClustersArray); + using AliHLTProcessor::DoEvent; - private: - /** copy constructor prohibited */ - AliHLTTRDClusterizerComponent(const AliHLTTRDClusterizerComponent&); - /** assignment operator prohibited */ - AliHLTTRDClusterizerComponent& operator=(const AliHLTTRDClusterizerComponent&); - - // 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 - - AliHLTTRDClusterizer *fClusterizer; //! Offline derived HLT clusterizer - AliTRDrecoParam *fRecoParam; //! Offline reco params - AliCDBManager *fCDB; //! Pointer to OCDB - AliRawReaderMemory *fMemReader; //! Input raw data reader - AliTRDReconstructor *fReconstructor; - - string fGeometryFileName; // Path to geometry file +private: + /** copy constructor prohibited */ + AliHLTTRDClusterizerComponent(const AliHLTTRDClusterizerComponent&); + /** assignment operator prohibited */ + AliHLTTRDClusterizerComponent& operator=(const AliHLTTRDClusterizerComponent&); + + // The size of the output data produced, as a percentage of the input data's size. + // Can be greater than 100 (%) + + unsigned int fOutputPercentage; // Output volume in percentage of the input + unsigned int fOutputConst; + + AliHLTTRDClusterizer *fClusterizer; //! Offline derived HLT clusterizer + AliTRDrecoParam *fRecoParam; //! Offline reco params + AliRawReaderMemory *fMemReader; //! Input raw data reader + AliTRDReconstructor *fReconstructor; - ClassDef(AliHLTTRDClusterizerComponent, 0) + ClassDef(AliHLTTRDClusterizerComponent, 1) - }; +}; #endif diff --git a/HLT/TRD/AliHLTTRDTrackerV1Component.cxx b/HLT/TRD/AliHLTTRDTrackerV1Component.cxx index 299f720e7d1..613f3568357 100644 --- a/HLT/TRD/AliHLTTRDTrackerV1Component.cxx +++ b/HLT/TRD/AliHLTTRDTrackerV1Component.cxx @@ -36,6 +36,7 @@ using namespace std; #include "AliGeomManager.h" #include "AliCDBManager.h" +#include "AliCDBStorage.h" #include "AliESDEvent.h" #include "AliMagF.h" #include "AliESDfriend.h" @@ -60,18 +61,14 @@ ClassImp(AliHLTTRDTrackerV1Component) AliHLTTRDTrackerV1Component::AliHLTTRDTrackerV1Component(): AliHLTProcessor(), - fOutputPercentage(100), // By default we copy to the output exactly what we got as input - fStrorageDBpath("local://$ALICE_ROOT/OCDB"), - fCDB(NULL), - fGeometryFileName(""), + fOutputPercentage(100), // By default we copy to the output exactly what we got as input fTracker(NULL), fRecoParam(NULL), - fReconstructor(NULL) + fReconstructor(NULL), + fESD(NULL) { // Default constructor - fGeometryFileName = getenv("ALICE_ROOT"); - fGeometryFileName += "/HLT/TRD/geometry.root"; } AliHLTTRDTrackerV1Component::~AliHLTTRDTrackerV1Component() @@ -126,6 +123,7 @@ int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv ) Int_t iMagneticField = -1; // magnetic field: 0==OFF and 1==ON Int_t iPIDmethod = 1; // 0=LikelyHood(LH) 1=NeuronalNetwork(NN) 2=TruncatedMean(TM) Bool_t bHLTMode = kTRUE, bWriteClusters = kFALSE; + string geometryFileName = ""; while ( i < argc ) { @@ -144,7 +142,7 @@ int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv ) HLTError("Cannot convert output_percentage parameter '%s'", argv[i+1] ); return EINVAL; } - HLTInfo("Output percentage set to %lu %%", fOutputPercentage ); + HLTInfo("Output percentage set to %i %%", fOutputPercentage ); i += 2; } else if ( !strcmp( argv[i], "-NTimeBins" ) ) @@ -163,17 +161,6 @@ int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv ) } i += 2; } - else if ( strcmp( argv[i], "-cdb" ) == 0) - { - if ( i+1 >= argc ) - { - HLTError( "Missing -cdb argument"); - return ENOTSUP; - } - fStrorageDBpath = argv[i+1]; - HLTInfo("DB storage is %s", fStrorageDBpath.c_str() ); - i += 2; - } else if ( strcmp( argv[i], "-geometry" ) == 0) { if ( i+1 >= argc ) @@ -181,9 +168,9 @@ int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv ) HLTError("Missing -geometry argument"); return ENOTSUP; } - fGeometryFileName = argv[i+1]; + geometryFileName = argv[i+1]; HLTInfo("GeomFile storage is %s", - fGeometryFileName.c_str() ); + geometryFileName.c_str() ); i += 2; } // the flux parametrizations @@ -248,20 +235,44 @@ int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv ) } - // THE "REAL" INIT COMES HERE - // offline condition data base - fCDB = AliCDBManager::Instance(); - if (!fCDB) - { - HLTError("Could not get CDB instance", "fCDB 0x%x", fCDB); - return -1; + // THE "REAL" INIT COMES HERE + // offline condition data base + + if(!AliCDBManager::Instance()->IsDefaultStorageSet()){ + HLTError("DefaultStorage is not Set in CDBManager"); + return -1; + } + if(AliCDBManager::Instance()->GetRun()<0){ + AliCDBManager *cdb = AliCDBManager::Instance(); + if (cdb) + { + cdb->SetRun(0); + HLTWarning("Setting CDB Runnumber to 0. CDB instance 0x%x", cdb); + } + else + { + HLTError("Could not get CDB instance", "cdb 0x%x", cdb); + return -1; + } + } + HLTInfo("CDB default storage: %s; RunNo: %i", (AliCDBManager::Instance()->GetDefaultStorage()->GetBaseFolder()).Data(), AliCDBManager::Instance()->GetRun()); + + if(!AliGeomManager::GetGeometry()){ + if(!TFile::Open(geometryFileName.c_str())){ + HLTInfo("Loading standard geometry file"); + AliGeomManager::LoadGeometry(); + }else{ + HLTWarning("Loading non-standard geometry file"); + AliGeomManager::LoadGeometry(geometryFileName.c_str()); } - else - { - fCDB->SetRun(0); // THIS HAS TO BE RETRIEVED !!! - fCDB->SetDefaultStorage(fStrorageDBpath.c_str()); - HLTDebug("CDB instance", "fCDB 0x%x", fCDB); + if(!AliGeomManager::GetGeometry()){ + HLTError("Cannot load geometry"); + return EINVAL; } + } + else{ + HLTInfo("Geometry Already Loaded"); + } // check if the N of time bins make sense if (iNtimeBins <= 0) @@ -372,29 +383,13 @@ int AliHLTTRDTrackerV1Component::DoInit( int argc, const char** argv ) fReconstructor->SetOption(recoOptions.Data()); HLTDebug("Reconstructor options are: %s",recoOptions.Data()); - if((AliGeomManager::GetGeometry()) == NULL){ - - if ( TFile::Open(fGeometryFileName.c_str())) { - AliGeomManager::LoadGeometry(fGeometryFileName.c_str()); - } - else { - HLTError("Cannot load geometry from file %s",fGeometryFileName.c_str()); - return EINVAL; - } - } - else - HLTInfo("Geometry Already Loaded"); - // create the tracker fTracker = new AliTRDtrackerV1(); - fTracker->SetReconstructor(fReconstructor); HLTDebug("TRDTracker at 0x%x", fTracker); + fTracker->SetReconstructor(fReconstructor); - if (fTracker == 0) - { - HLTError("Unable to create the tracker!"); - return -1; - } + fESD = new AliESDEvent; + fESD->CreateStdContent(); return 0; } @@ -412,6 +407,8 @@ int AliHLTTRDTrackerV1Component::DoDeinit() fReconstructor->SetClusters(0x0); delete fReconstructor; fReconstructor = 0x0; + delete fESD; + fESD=NULL; AliTRDcalibDB::Terminate(); @@ -426,16 +423,20 @@ int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtDat vector& outputBlocks ) { // Process an event + + if (evtData.fEventID == 1) + CALLGRIND_START_INSTRUMENTATION; + + HLTDebug("NofBlocks %i", evtData.fBlockCnt ); - HLTDebug("NofBlocks %lu", evtData.fBlockCnt ); - + fESD->Reset(); + //fESD->SetMagneticField(fSolenoidBz); + AliHLTUInt32_t totalSize = 0, offset = 0; AliHLTUInt32_t dBlockSpecification = 0; vector expectedDataTypes; GetInputDataTypes(expectedDataTypes); - if (evtData.fEventID > 1) - CALLGRIND_START_INSTRUMENTATION; for ( unsigned long iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ ) { const AliHLTComponentBlockData &block = blocks[iBlock]; @@ -468,20 +469,17 @@ int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtDat 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); + fTracker->Clusters2Tracks(fESD); - Int_t nTracks = esd->GetNumberOfTracks(); + Int_t nTracks = fESD->GetNumberOfTracks(); HLTInfo("Number of tracks == %d ==", nTracks); TClonesArray* trdTracks = 0x0; //trdTracks = fTracker->GetListOfTracks(); if(nTracks>0){ - HLTDebug("We have an output ESDEvent: 0x%x with %i tracks", esd, nTracks); - AliHLTUInt32_t addedSize = AliHLTTRDUtils::AddESDToOutput(esd, (AliHLTUInt8_t*)(outputPtr+offset)); + HLTDebug("We have an output ESDEvent: 0x%x with %i tracks", fESD, nTracks); + AliHLTUInt32_t addedSize = AliHLTTRDUtils::AddESDToOutput(fESD, (AliHLTUInt8_t*)(outputPtr+offset)); totalSize += addedSize; // Fill block @@ -537,7 +535,6 @@ int AliHLTTRDTrackerV1Component::DoEvent( const AliHLTComponentEventData& evtDat //here we are deleting clusters (but not the TClonesArray itself) fTracker->UnloadClusters(); AliTRDReconstructor::SetClusters(0x0); - delete esd; clusterArray->Delete(); delete clusterArray; diff --git a/HLT/TRD/AliHLTTRDTrackerV1Component.h b/HLT/TRD/AliHLTTRDTrackerV1Component.h index af129483f75..67b99cedaca 100644 --- a/HLT/TRD/AliHLTTRDTrackerV1Component.h +++ b/HLT/TRD/AliHLTTRDTrackerV1Component.h @@ -19,67 +19,64 @@ class AliMagF; class AliTRDtrackerV1; class AliTRDrecoParam; class AliTRDReconstructor; +class AliESDEvent; /** * @class AliHLTTRDTrackerV1Component * @brief A TRDTrackerV1 HLT processing component. * * Uses the second generation TRD tracker AliTRDtrackerV1 -*/ + */ class AliHLTTRDTrackerV1Component : public AliHLTProcessor - { - public: - AliHLTTRDTrackerV1Component(); - virtual ~AliHLTTRDTrackerV1Component(); +{ +public: + AliHLTTRDTrackerV1Component(); + virtual ~AliHLTTRDTrackerV1Component(); - // Public functions to implement AliHLTComponent's interface. - // These functions are required for the registration process + // Public functions to implement AliHLTComponent's interface. + // These functions are required for the registration process - const char* GetComponentID(); - void GetInputDataTypes( vector& list); - AliHLTComponent_DataType GetOutputDataType(); - virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); - AliHLTComponent* Spawn(); + const char* GetComponentID(); + void GetInputDataTypes( vector& list); + AliHLTComponent_DataType GetOutputDataType(); + virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); + AliHLTComponent* Spawn(); - protected: - AliHLTUInt32_t TransportTracks(TClonesArray *inTracksArray, AliHLTUInt8_t* output, - vector& outputBlocks, AliHLTUInt32_t inOffset, AliHLTUInt32_t inSpec); +protected: + AliHLTUInt32_t TransportTracks(TClonesArray *inTracksArray, AliHLTUInt8_t* output, + vector& outputBlocks, AliHLTUInt32_t inOffset, AliHLTUInt32_t inSpec); - // Protected functions to implement AliHLTComponent's interface. - // These functions provide initialization as well as the actual processing - // capabilities of the component. + // 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 AliHLTComponentEventData& evtData, - const AliHLTComponentBlockData* blocks, - AliHLTComponent_TriggerData& /*trigData*/, - AliHLTUInt8_t* outputPtr, - AliHLTUInt32_t& size, - vector& outputBlocks ); - using AliHLTProcessor::DoEvent; + int DoInit( int argc, const char** argv ); + int DoDeinit(); + int DoEvent( const AliHLTComponentEventData& evtData, + const AliHLTComponentBlockData* blocks, + AliHLTComponent_TriggerData& /*trigData*/, + AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, + vector& outputBlocks ); + using AliHLTProcessor::DoEvent; - private: - /** copy constructor prohibited */ - AliHLTTRDTrackerV1Component(const AliHLTTRDTrackerV1Component&); - /** assignment operator prohibited */ - AliHLTTRDTrackerV1Component& operator=(const AliHLTTRDTrackerV1Component&); +private: + /** copy constructor prohibited */ + AliHLTTRDTrackerV1Component(const AliHLTTRDTrackerV1Component&); + /** assignment operator prohibited */ + AliHLTTRDTrackerV1Component& operator=(const AliHLTTRDTrackerV1Component&); - // 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 + // 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 - AliTRDtrackerV1 *fTracker;//! Offline-pure/HLT tracker V1 - AliTRDrecoParam *fRecoParam; //! Offline reco params - AliTRDReconstructor * fReconstructor; - - ClassDef(AliHLTTRDTrackerV1Component, 0) + AliTRDtrackerV1 *fTracker;//! Offline-pure/HLT tracker V1 + AliTRDrecoParam *fRecoParam; //! Offline reco params + AliTRDReconstructor * fReconstructor; + AliESDEvent* fESD; + + ClassDef(AliHLTTRDTrackerV1Component, 1) - }; +}; #endif diff --git a/HLT/TRD/AliHLTTRDTrackletWordArray.h b/HLT/TRD/AliHLTTRDTrackletWordArray.h new file mode 100644 index 00000000000..7a2a71cdf04 --- /dev/null +++ b/HLT/TRD/AliHLTTRDTrackletWordArray.h @@ -0,0 +1,25 @@ +// $Id$ +//* This file is property of and copyright by the ALICE HLT Project * +//* ALICE Experiment at CERN, All rights reserved. * +//* See cxx source for full Copyright notice * + +#ifndef _ALIHLTTRDTRACKLETWORDARRAY_H_ +#define _ALITHLTTRDTRACKLETWORDARRAY_H_ + +#include "AliHLTDataTypes.h" +#include "AliHLTStdIncludes.h" + +struct AliHLTTRDTrackletWordArray { + AliHLTTRDTrackletWordArray(Int_t det):fDet(det),fCount(0){} + Int_t fDet; + AliHLTUInt32_t fCount; +#if defined(__HP_aCC) || defined(__DECCXX) || defined(__SUNPRO_CC) + UInt_t fTracklets[1]; +#else + UInt_t fTracklets[]; +#endif +}; + +//typedef struct AliTRDHLTTrackletWordArray AliTRDHLTTrackletWordArray ?plain c! + +#endif diff --git a/HLT/TRD/AliHLTTRDUtils.cxx b/HLT/TRD/AliHLTTRDUtils.cxx index f4c8d3c1adb..7b120f056c9 100644 --- a/HLT/TRD/AliHLTTRDUtils.cxx +++ b/HLT/TRD/AliHLTTRDUtils.cxx @@ -1,3 +1,4 @@ +// $Id:$ /************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * @@ -106,6 +107,7 @@ AliHLTUInt32_t AliHLTTRDUtils::ReadClusters(TClonesArray *outArray, void* inputP AliTRDcluster* curTRDCluster = new((*outArray)[i]) AliTRDcluster(); curCluster->ExportTRDCluster(curTRDCluster); + curTRDCluster->SetRPhiMethod(AliTRDcluster::kCOG); //HLTDebug(" fX = %f; fY = %f; fZ = %f", curTRDCluster->GetX(), curTRDCluster->GetY(), curTRDCluster->GetZ()); curSize += clusterSize; i++; diff --git a/HLT/TRD/AliHLTTRDUtils.h b/HLT/TRD/AliHLTTRDUtils.h index c2acbd59b7a..a82238bb206 100644 --- a/HLT/TRD/AliHLTTRDUtils.h +++ b/HLT/TRD/AliHLTTRDUtils.h @@ -1,3 +1,4 @@ +// $Id:$ #ifndef ALIHLTTRDUTILS_H #define ALIHLTTRDUTILS_H /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. * diff --git a/HLT/libAliHLTTRD.pkg b/HLT/libAliHLTTRD.pkg index 00f6c366eab..1bcf010c4cd 100644 --- a/HLT/libAliHLTTRD.pkg +++ b/HLT/libAliHLTTRD.pkg @@ -19,6 +19,7 @@ CLASS_HDRS:= \ # library sources MODULE_SRCS= \ + AliHLTTRDTrackletWordArray.h \ $(CLASS_HDRS:.h=.cxx) # library headers -- 2.43.0