From 0a211711ffecdfe31deb6deb0504fc7cac17c5e8 Mon Sep 17 00:00:00 2001 From: phille Date: Mon, 22 Jan 2007 12:02:15 +0000 Subject: [PATCH] Started the implemetation of the online analysis --- HLT/PHOS/AliHLTPHOSDefinitions.cxx | 37 +++ HLT/PHOS/AliHLTPHOSDefinitions.h | 72 ++++++ HLT/PHOS/AliHLTPHOSLinkDef.h | 1 + HLT/PHOS/AliHLTPHOSRawAnalyzer.cxx | 15 ++ HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx | 254 ++++++++++++------- HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.h | 27 +- HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.cxx | 1 - HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.h | 5 +- HLT/PHOS/Makefile.am | 5 +- 9 files changed, 317 insertions(+), 100 deletions(-) create mode 100644 HLT/PHOS/AliHLTPHOSDefinitions.cxx create mode 100644 HLT/PHOS/AliHLTPHOSDefinitions.h diff --git a/HLT/PHOS/AliHLTPHOSDefinitions.cxx b/HLT/PHOS/AliHLTPHOSDefinitions.cxx new file mode 100644 index 00000000000..3e4e4619de0 --- /dev/null +++ b/HLT/PHOS/AliHLTPHOSDefinitions.cxx @@ -0,0 +1,37 @@ +// $Id$ + +/************************************************************************** + * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: Per Thomas Hille for the ALICE HLT 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. * + **************************************************************************/ + + +/////////////////////////////////////////////////////////////////////////////// +// // +// Definitions for the HLT PHOS components // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliHLTPHOSDefinitions.h" + + +//ClassImp(AliHLTPHOSDefinitions) + +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkDDLPackedRawDataType = { sizeof(AliHLTComponentDataType), {'D','D','L','_','R','W','P','K'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkPackedRawDataType = { sizeof(AliHLTComponentDataType), {'R','A','W','P','A','K','E','D'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkUnpackedRawDataType = { sizeof(AliHLTComponentDataType), {'R','A','W','U','N','P','A','K'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkClustersDataType = { sizeof(AliHLTComponentDataType), {'C','L','U','S','T','E','R','S'},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkVertexDataType = { sizeof(AliHLTComponentDataType), {'V','E','R','T','E','X',' ',' '},{'P','H','O','S'}};; +const AliHLTComponentDataType AliHLTPHOSDefinitions::gkTrackSegmentsDataType = { sizeof(AliHLTComponentDataType), {'T','R','A','K','S','E','G','S'},{'P','H','O','S'}};; + + diff --git a/HLT/PHOS/AliHLTPHOSDefinitions.h b/HLT/PHOS/AliHLTPHOSDefinitions.h new file mode 100644 index 00000000000..ba960829ca7 --- /dev/null +++ b/HLT/PHOS/AliHLTPHOSDefinitions.h @@ -0,0 +1,72 @@ +// XEmacs -*-C++-*- +// @(#) $Id$ + +#ifndef ALIHLTPHOSDEFINITIONS_H +#define ALIHLTPHOSDEFINITIONS_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* AliHLTTPCDefinitions + */ + +#include "AliHLTDataTypes.h" +//#include "TObject.h" +#include "Rtypes.h" + +class AliHLTPHOSDefinitions + { + public: + + static AliHLTUInt8_t GetMinSliceNr( const AliHLTComponentBlockData& block ) + { + return (AliHLTUInt8_t)( (block.fSpecification & 0x00FF0000) >> 16 ); + } + static AliHLTUInt8_t GetMinSliceNr( ULong_t spec ) + { + return (AliHLTUInt8_t)( (spec & 0x00FF0000) >> 16 ); + } + static AliHLTUInt8_t GetMaxSliceNr( const AliHLTComponentBlockData& block ) + { + return (AliHLTUInt8_t)( (block.fSpecification & 0xFF000000) >> 24 ); + } + static AliHLTUInt8_t GetMaxSliceNr( ULong_t spec ) + { + return (AliHLTUInt8_t)( (spec & 0xFF000000) >> 24 ); + } + static AliHLTUInt8_t GetMinPatchNr( const AliHLTComponentBlockData& block ) + { + return (AliHLTUInt8_t)( (block.fSpecification & 0x000000FF) ); + } + static AliHLTUInt8_t GetMinPatchNr( ULong_t spec ) + { + return (AliHLTUInt8_t)( (spec & 0x000000FF) ); + } + static AliHLTUInt8_t GetMaxPatchNr( const AliHLTComponentBlockData& block ) + { + return (AliHLTUInt8_t)( (block.fSpecification & 0x0000FF00) >> 8 ); + } + static AliHLTUInt8_t GetMaxPatchNr( ULong_t spec ) + { + return (AliHLTUInt8_t)( (spec & 0x0000FF00) >> 8 ); + } + + static AliHLTUInt32_t EncodeDataSpecification( AliHLTUInt8_t minSliceNr, + AliHLTUInt8_t maxSliceNr, + AliHLTUInt8_t minPatchNr, + AliHLTUInt8_t maxPatchNr ) + { + return ((maxSliceNr & 0xFF) << 24) | ((minSliceNr & 0xFF) << 16) | ((maxPatchNr & 0xFF) << 8) | ((minPatchNr & 0xFF)); + } + + static const AliHLTComponentDataType gkDDLPackedRawDataType; + static const AliHLTComponentDataType gkPackedRawDataType; + static const AliHLTComponentDataType gkUnpackedRawDataType; + static const AliHLTComponentDataType gkClustersDataType; + static const AliHLTComponentDataType gkTrackSegmentsDataType; + static const AliHLTComponentDataType gkVertexDataType; + + // ClassDef(AliHLTPHOSDefinitions, 0) + + }; + +#endif diff --git a/HLT/PHOS/AliHLTPHOSLinkDef.h b/HLT/PHOS/AliHLTPHOSLinkDef.h index 8aba5e97015..a590aae9753 100644 --- a/HLT/PHOS/AliHLTPHOSLinkDef.h +++ b/HLT/PHOS/AliHLTPHOSLinkDef.h @@ -11,6 +11,7 @@ #pragma link C++ class AliHLTPHOSRawAnalyzerLMS+; #pragma link C++ class AliHLTPHOSPulseGenerator+; #pragma link C++ class AliHLTPHOSEmcCalibData+; +#pragma link C++ AliHLTPHOSDefinitions+; //#pragma link C++ class AliHLTPHOSRawAnalyzerComponent+; //#pragma link C++ class AliHLTPHOSRawAnalyzerPeakFinderComponent+; //#pragma link C++ class AliHLTPHOSRawAnalyzerCrudeComponent+; diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzer.cxx b/HLT/PHOS/AliHLTPHOSRawAnalyzer.cxx index eb4d52b1551..fccd6f87c41 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzer.cxx +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzer.cxx @@ -1,3 +1,18 @@ +/************************************************************************** + * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: Per Thomas Hille for the ALICE HLT 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. * + **************************************************************************/ + #include "AliHLTPHOSRawAnalyzer.h" #include diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx b/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx index d5a6002d091..b4c09d7415a 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx @@ -17,7 +17,11 @@ #include "AliHLTPHOSRawAnalyzerComponent.h" #include #include "stdio.h" + #include "AliRawReaderMemory.h" +#include "AliCaloRawStream.h" + +//#include "AliHLTTPCDefinitions.h" const AliHLTComponentDataType AliHLTPHOSRawAnalyzerComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array const AliHLTComponentDataType AliHLTPHOSRawAnalyzerComponent::outputDataType=kAliHLTVoidDataType; @@ -25,33 +29,32 @@ const AliHLTComponentDataType AliHLTPHOSRawAnalyzerComponent::outputDataType=kAl //AliHLTPHOSRawAnalyzerComponent gAliHLTPHOSRawAnalyzerComponent; //ClassImp(AliHLTPHOSRawAnalyzerComponent) -AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTProcessor(), eventCount(0) +AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTProcessor(), eventCount(0), fPHOSRawStream(), fRawMemoryReader(0) { - // ddlDecoderPtr = new AliRawReaderMemory(); // fRawMemoryReader = NULL; } AliHLTPHOSRawAnalyzerComponent::~AliHLTPHOSRawAnalyzerComponent() { - // fRawMemoryReader = NULL; + if(fRawMemoryReader != 0) + { + delete fRawMemoryReader; + } + if(fPHOSRawStream != 0) + { + delete fPHOSRawStream; + } + } -AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent(const AliHLTPHOSRawAnalyzerComponent & ) : AliHLTProcessor(), eventCount(0) + +AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent(const AliHLTPHOSRawAnalyzerComponent & ) : AliHLTProcessor(), eventCount(0), fPHOSRawStream(),fRawMemoryReader(0) { - // ddlDecoderPtr = new AliRawReaderMemory(); // fRawMemoryReader = NULL; } -//AliHLTComponent* -//AliHLTPHOSRawAnalyzerComponent::Spawn() -//{ -// return new AliHLTPHOSRawAnalyzerComponent; -//} - - - int AliHLTPHOSRawAnalyzerComponent::Deinit() { @@ -63,10 +66,15 @@ AliHLTPHOSRawAnalyzerComponent::DoDeinit() { Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen DoDeinit"); - // if ( fRawMemoryReader ) - // delete fRawMemoryReader; - // fRawMemoryReader = NULL; - + if(fRawMemoryReader !=0) + { + delete fRawMemoryReader; + } + + if(fPHOSRawStream != 0) + { + delete fPHOSRawStream; + } return 0; } @@ -100,109 +108,171 @@ AliHLTPHOSRawAnalyzerComponent::GetOutputDataSize(unsigned long& constBase, doub constBase = 0;inputMultiplier = 0; } -int -AliHLTPHOSRawAnalyzerComponent::DoEvent(const AliHLTComponentEventData& evtDtaPtr, const AliHLTComponentBlockData* dtaPtr, AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&, std::vector >&) + +int AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, + AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, vector& outputBlocks ) { + // int tmpCnt = 0; + cout << "processing Event" << endl; + const AliHLTComponentBlockData* iter = NULL; + unsigned long ndx; + + for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) + { + cout <<"Inside for loop ndx =" << ndx << endl; + iter = blocks+ndx; + + 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; + } - // ddlDecoderPtr->SetMemory( reinterpret_cast( dtaPtr->fPtr ), dtaPtr->fSize ); + eventCount++; - // analyzerPtr->Evaluate(0, 100); + return 0; +} + + + +int +AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv ) +{ + cout << "AliHLTPHOSRawAnalyzerComponent::DoInit Creating new AliRawReaderMemory()" << endl; + fRawMemoryReader = new AliRawReaderMemory(); + fPHOSRawStream = new AliCaloRawStream(fRawMemoryReader,"PHOS"); + cout <<"AliHLTPHOSRawAnalyzerComponent::DoIni DONE!" << endl; + if (argc==0 && argv==NULL) { + // this is currently just to get rid of the warning "unused parameter" + } + return 0; +} - Logging(kHLTLogInfo, "HLT", "Sample", "PhosHLTRawAnalyzerComonent, DoEvent"); - // AliHLTUInt32_t *tmpDtaPtr = (AliHLTUInt32_t *)dtaPtr->fPtr; +/* +int +AliHLTPHOSRawAnalyzerComponent::DoEvent(const AliHLTComponentEventData& evtDtaPtr, const AliHLTComponentBlockData* dtaPtr, AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&, std::vector >&) +{ + const Bool_t skipBadEvent=kFALSE; + const AliHLTComponentBlockData* iter = NULL; + + fRawMemoryReader->SetMemory( reinterpret_cast( dtaPtr->fPtr ), dtaPtr->fSize ); - // UChar_t *dataPtr = address; - //ULong_t address, + // fPHOSRawStream = new AliCaloRawStream(fRawMemoryReader,"PHOS"); - UChar_t *tmpDtaPtr = (UChar_t *)dtaPtr->fPtr; - // UChar_t *tmpDtaPtr = (ULong_t *)dtaPtr->fPtr; + fRawMemoryReader->DumpData(); + Logging(kHLTLogInfo, "HLT", "Sample", "PhosHLTRawAnalyzerComonent, DoEvent"); - AliHLTUInt32_t tmpSize = dtaPtr->fSize; - AliHLTUInt32_t tmpSize32 = dtaPtr->fSize/4; + // 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; - // AliHLTUInt32_t *tmpDtaPtr = (AliHLTUInt32_t *)dtaPtr->fPtr; - - - // testDDLDecoderPtr->SetMemory(tmpDtaPtr, tmpSize); - // cout << "Dumoing data from the AliRawReader" << endl; - // ddlDecoderPtr->DumpData(30); - // cout << "finnished dumping data from the AliRawReader" << endl; - - // unsigned int tmpSize = (dtaPtr->fSize)/4; - cout << "content of data pointer =" << tmpDtaPtr << endl; + // UChar_t *tmpDtaPtr = (UChar_t *)blokcs->fPtr; + + // AliCaloRawStream in(fRawMemoryReader,"PHOS"); // for(unsigned int i = 0; i < tmpSize; i++) - for(unsigned int i = 0; i < 10; i++) + for(unsigned int i = 0; i < 15; i++) { // 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; + } + } + cout << "Finnsihed while loop" << endl << endl; - cout <<"AliHLTPHOSRawAnalyzerComponent::DoIni DONE!" << endl; - if (argc==0 && argv==NULL) { - // this is currently just to get rid of the warning "unused parameter" - } + eventCount++; return 0; } +*/ diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.h b/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.h index 137e886f442..4e2daa4483f 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.h +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.h @@ -9,6 +9,21 @@ #include "AliHLTProcessor.h" #include "AliHLTPHOSRawAnalyzer.h" #include "AliRawReaderMemory.h" +#include "AliCaloRawStream.h" +#include "AliHLTPHOSDefinitions.h" + + +/* +#include "AliHLTTPCRawDataUnpackerComponent.h" +#include "AliTPCRawStream.h" +#include "AliRawDataHeader.h" +#include "AliRawReaderMemory.h" +#include "AliHLTTPCRawDataFormat.h" +#include "AliHLTTPCDigitData.h" +#include "AliHLTTPCTransform.h" +#include +#include +*/ class AliHLTPHOSRawAnalyzerComponent: public AliHLTProcessor { @@ -21,6 +36,8 @@ class AliHLTPHOSRawAnalyzerComponent: public AliHLTProcessor return *this; }; + + virtual int DoInit( int argc, const char** argv ); virtual int Deinit(); virtual int DoDeinit(); @@ -40,9 +57,13 @@ class AliHLTPHOSRawAnalyzerComponent: public AliHLTProcessor private: int eventCount; -AliRawReaderMemory *fRawMemoryReader; - static const AliHLTComponentDataType inputDataTypes[]; - static const AliHLTComponentDataType outputDataType; + // AliRawReaderMemory *fRawMemoryReader; + // AliTPCRawStream *fTPCRawStream; + + AliCaloRawStream *fPHOSRawStream; + AliRawReaderMemory *fRawMemoryReader; + static const AliHLTComponentDataType inputDataTypes[]; + static const AliHLTComponentDataType outputDataType; }; #endif diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.cxx b/HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.cxx index 9f3e144c006..6489a831509 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.cxx +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.cxx @@ -1,4 +1,3 @@ - /************************************************************************** * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * * * diff --git a/HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.h b/HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.h index b8ad68cb939..d93f573255f 100644 --- a/HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.h +++ b/HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.h @@ -1,11 +1,12 @@ #ifndef ALIHLTPHOSRAWANALYZERPEAKFINDER_H #define ALIHLTPHOSRAWANALYZERPEAKFINDER_H +/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + #include #include "TObject.h" #include "AliHLTPHOSRawAnalyzer.h" -/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ class AliHLTPHOSRawAnalyzerPeakFinder : public AliHLTPHOSRawAnalyzer { diff --git a/HLT/PHOS/Makefile.am b/HLT/PHOS/Makefile.am index 3ae7e28d0f5..4872f758bb6 100644 --- a/HLT/PHOS/Makefile.am +++ b/HLT/PHOS/Makefile.am @@ -21,6 +21,7 @@ libAliHLTPHOS_la_SOURCES = AliHLTPHOSPulseGenerator.cxx \ AliHLTPHOSRawAnalyzerComponent.cxx \ AliHLTPHOSRawAnalyzerCrudeComponent.cxx \ AliHLTPHOSRawAnalyzerPeakFinderComponent.cxx \ + AliHLTPHOSDefinitions.cxx \ PeakFinderTest.cxx # class header files, the link definition for the root dictionary @@ -35,8 +36,8 @@ CLASS_HDRS = AliHLTPHOSPulseGenerator.h \ AliHLTPHOSEmcCalibData.h \ AliHLTPHOSRawAnalyzerComponent.h \ AliHLTPHOSRawAnalyzerCrudeComponent.h \ - AliHLTPHOSRawAnalyzerPeakFinderComponent.h - + AliHLTPHOSRawAnalyzerPeakFinderComponent.h \ + AliHLTPHOSDefinitions.h pkginclude_HEADERS = $(CLASS_HDRS) \ AliHLTPHOSCommonDefs.h -- 2.43.0