From 2947a32c23ca1d54f18cf32df738552ac8737792 Mon Sep 17 00:00:00 2001 From: phille Date: Mon, 22 Jan 2007 17:12:56 +0000 Subject: [PATCH 1/1] First working implementation of the online cell energy/time evaluation. The equippment ID is passed as an argument to the AliHLTPHOSRawAnalyzerCrudeComponent. The idea is to run a process for each readout partition (RCU). --- HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx | 231 +++++++++----------- HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.h | 14 ++ HLT/PHOS/AliHLTPHOSRawAnalyzerCrude.cxx | 2 +- 3 files changed, 120 insertions(+), 127 deletions(-) diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx b/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx index b4c09d7415a..26530aeef8b 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx @@ -20,6 +20,8 @@ #include "AliRawReaderMemory.h" #include "AliCaloRawStream.h" +#include +//#include "TH2.h" //#include "AliHLTTPCDefinitions.h" @@ -113,92 +115,88 @@ int AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evt AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector& outputBlocks ) { - // int tmpCnt = 0; - cout << "processing Event" << endl; + Int_t tmpMod = 0; + Int_t tmpRow = 0; + Int_t tmpCol = 0; + Int_t tmpGain = 0; + Int_t processedChannels = 0; + // Int_t tmpMax = 0; const AliHLTComponentBlockData* iter = NULL; unsigned long ndx; - + Reset(); + for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) { - cout <<"Inside for loop ndx =" << ndx << endl; iter = blocks+ndx; - - if (eventCount == 0) - { - continue; - } + if (eventCount == 0) + { + continue; + } - - if ( iter->fDataType == AliHLTPHOSDefinitions::gkDDLPackedRawDataType ) cout << "data type is :gkDDLPackedRawDataType " <fDataType == AliHLTPHOSDefinitions::gkPackedRawDataType ) cout << "data type is : gkPackedRawDataType" <fDataType == AliHLTPHOSDefinitions::gkUnpackedRawDataType) cout << "data type is gkUnpackedRawDataType" <fDataType == AliHLTPHOSDefinitions::gkClustersDataType) cout << "data type is ::gkClustersDataType" <fDataType == AliHLTPHOSDefinitions::gkVertexDataType ) cout << "data type is ::gkVertexDataType " <fDataType == AliHLTPHOSDefinitions::gkTrackSegmentsDataType) cout << "data type is :::gkTrackSegmentsDataType" <fDataType != AliHLTPHOSDefinitions::gkDDLPackedRawDataType ) { cout << "Warning: data type = is nOT gkDDLPackedRawDataType " << endl; continue; } - - cout <<"PHOSHLT DoEvent: processing event:"<< eventCount << endl; - cout <<"Struct size = " << evtData.fStructSize << endl; - cout <<"Event ID = " <Next(); - } - cout << "end of for lop" << endl; - } - - eventCount++; - - return 0; -} + analyzerPtr->SetData(fTmpChannelData); + + while(fPHOSRawStream->Next()) + { + if (fPHOSRawStream->IsNewHWAddress()) + { + if(processedChannels > 0) + { + analyzerPtr->SetData(fTmpChannelData); + analyzerPtr->Evaluate(0, 1008); + fMaxValues[tmpMod][tmpRow][tmpCol][tmpGain] = analyzerPtr->GetEnergy(); + ResetDataPtr(); + } + + tmpMod = fPHOSRawStream->GetModule(); + tmpRow = fPHOSRawStream->GetRow(); + tmpCol = fPHOSRawStream->GetColumn(); + tmpGain = fPHOSRawStream->IsLowGain(); + processedChannels ++; + } + + fTmpChannelData[fPHOSRawStream->GetTime()] = fPHOSRawStream->GetSignal(); + } + } + DumpData(); + fEventCount++; + return 0; +}//end DoEvent int AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv ) { + cout << "DOINIT argc =" << argc << endl; + cout << "DOINIT argv[0] =" << argv[0] << endl; + cout << "DOINIT argv[1] =" << argv[1] << endl; + cout << "DOINIT argv[2] =" << argv[2] << endl; + cout << "DOINIT argv[3] =" << argv[3] << endl; + cout << "DOINIT argv[4] =" << argv[4] << endl; + cout << "DOINIT argv[5] =" << argv[5] << endl; + cout << "DOINIT argv[6] =" << argv[6] << endl; + + int equippmentId = atoi(argv[6]); + cout << "The equipment ID was set to " <SetEquipmentID(1806); + + Reset(); cout << "AliHLTPHOSRawAnalyzerComponent::DoInit Creating new AliRawReaderMemory()" << endl; + legoPlotPtr = new TH2S("Lego plot 1","Phi0 20Gev, High gain", 56*5, 0, 56*5, 64, 0, 64); fRawMemoryReader = new AliRawReaderMemory(); fPHOSRawStream = new AliCaloRawStream(fRawMemoryReader,"PHOS"); + fRawMemoryReader->SetEquipmentID(equippmentId); + cout <<"AliHLTPHOSRawAnalyzerComponent::DoIni DONE!" << endl; if (argc==0 && argv==NULL) { // this is currently just to get rid of the warning "unused parameter" @@ -206,73 +204,54 @@ AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv ) return 0; } - - -/* -int -AliHLTPHOSRawAnalyzerComponent::DoEvent(const AliHLTComponentEventData& evtDtaPtr, const AliHLTComponentBlockData* dtaPtr, AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&, std::vector >&) +void +AliHLTPHOSRawAnalyzerComponent::DumpData() { - const Bool_t skipBadEvent=kFALSE; - const AliHLTComponentBlockData* iter = NULL; - - fRawMemoryReader->SetMemory( reinterpret_cast( dtaPtr->fPtr ), dtaPtr->fSize ); - - // fPHOSRawStream = new AliCaloRawStream(fRawMemoryReader,"PHOS"); - - fRawMemoryReader->DumpData(); - - Logging(kHLTLogInfo, "HLT", "Sample", "PhosHLTRawAnalyzerComonent, DoEvent"); - - // UChar_t *tmpDtaPtr = (UChar_t *)dtaPtr->fPtr; - // UInt32_t *tmpDtaPtr = (UInt32_t *)dtaPtr->fPtr; - // unsigned long *tmpDtaPtr = (unsigned long *)dtaPtr->fPtr; - - - cout <<"PHOSHLT DoEvent: processing event:"<< eventCount << endl; - cout <<"Struct size = " <fPtr; - // AliCaloRawStream in(fRawMemoryReader,"PHOS"); - // for(unsigned int i = 0; i < tmpSize; i++) - for(unsigned int i = 0; i < 15; i++) +void +AliHLTPHOSRawAnalyzerComponent::Reset() +{ + for(int mod = 0; mod <5; mod ++) { - // getc(); - // sleep(10); - // printf("\ntype return to continue; "); - // getc(stdin); - // printf("\nThanks; read in \n"); - // cout << "entry:" <Next() ) - { - cout << "Inside while loop" << endl; - if (fPHOSRawStream->IsNewHWAddress()) cout << endl << " New HW address: " << endl; - cout << "time bin=" << fPHOSRawStream->GetTime() << " of "<< fPHOSRawStream->GetTimeLength() - << ", amp=" << fPHOSRawStream->GetSignal() <<" gain="<< fPHOSRawStream->IsLowGain() - << " HW address="<GetHWAddress() - << " channel=("<GetModule() <<","<GetColumn()<<","<GetRow()<<")"<< endl; - - - if (skipBadEvent && (fPHOSRawStream->GetTime() < 0 || fPHOSRawStream->GetTimeLength() <=0) ) { - cout << "Wrong time bin or time length. Skip this event" << endl; - break; - } + for(int i = 0 ; i< 1008; i++) + { + fTmpChannelData[i] = 0; } - cout << "Finnsihed while loop" << endl << endl; +} // end Reset - eventCount++; - return 0; +void +AliHLTPHOSRawAnalyzerComponent::ResetDataPtr() +{ + for(int i = 0 ; i< 1008; i++) + { + fTmpChannelData[i] = 0; + } } -*/ diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.h b/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.h index 4e2daa4483f..31301f41da6 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.h +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.h @@ -11,6 +11,7 @@ #include "AliRawReaderMemory.h" #include "AliCaloRawStream.h" #include "AliHLTPHOSDefinitions.h" +#include "TH2.h" /* @@ -41,6 +42,7 @@ class AliHLTPHOSRawAnalyzerComponent: public AliHLTProcessor virtual int DoInit( int argc, const char** argv ); virtual int Deinit(); virtual int DoDeinit(); + void DumpData(); virtual const char* GetComponentID() = 0; @@ -54,12 +56,24 @@ class AliHLTPHOSRawAnalyzerComponent: public AliHLTProcessor // private: protected: AliHLTPHOSRawAnalyzer *analyzerPtr; + void Reset(); + void ResetDataPtr(); private: + + int eventCount; + + // AliRawReaderMemory *fRawMemoryReader; // AliTPCRawStream *fTPCRawStream; + Double_t fTmpChannelData[1008]; + // Int_t fMaxValues[5][64][56][2]; + Double_t fMaxValues[5][64][56][2]; + // Int_t fMaxValuesLG[5][64][56][2]; + TH2S *legoPlotPtr; + // TH2S *legoPlotLgPtr; AliCaloRawStream *fPHOSRawStream; AliRawReaderMemory *fRawMemoryReader; static const AliHLTComponentDataType inputDataTypes[]; diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerCrude.cxx b/HLT/PHOS/AliHLTPHOSRawAnalyzerCrude.cxx index 6b73da2ae2c..b00cf827258 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerCrude.cxx +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerCrude.cxx @@ -63,7 +63,7 @@ AliHLTPHOSRawAnalyzerCrude::~AliHLTPHOSRawAnalyzerCrude() void AliHLTPHOSRawAnalyzerCrude::Evaluate(int start, int length) { - printf("\nAliHLTPHOSRawAnalyzerCrude::Evaluat() from index %d to %d\n", start, start + length); + // printf("\nAliHLTPHOSRawAnalyzerCrude::Evaluat() from index %d to %d\n", start, start + length); double tmpAmplitudeMax =0; -- 2.39.3