From 28355ac2b4f19f40f64a4854df69d779cecd828d Mon Sep 17 00:00:00 2001 From: richterm Date: Wed, 30 Jan 2008 08:19:39 +0000 Subject: [PATCH] added AliHLTTPCCalibCEComponent for TPC central electrode calibration; added corresponding data type in AliHLTTPCDefinitions (Jochen) --- HLT/TPCLib/AliHLTTPCCalibCEComponent.cxx | 273 +++++++++++++++++++++++ HLT/TPCLib/AliHLTTPCCalibCEComponent.h | 117 ++++++++++ HLT/TPCLib/AliHLTTPCDefinitions.cxx | 2 + HLT/TPCLib/AliHLTTPCDefinitions.h | 27 ++- HLT/libAliHLTTPC.pkg | 4 +- 5 files changed, 409 insertions(+), 14 deletions(-) create mode 100644 HLT/TPCLib/AliHLTTPCCalibCEComponent.cxx create mode 100644 HLT/TPCLib/AliHLTTPCCalibCEComponent.h diff --git a/HLT/TPCLib/AliHLTTPCCalibCEComponent.cxx b/HLT/TPCLib/AliHLTTPCCalibCEComponent.cxx new file mode 100644 index 00000000000..a7684b02b8a --- /dev/null +++ b/HLT/TPCLib/AliHLTTPCCalibCEComponent.cxx @@ -0,0 +1,273 @@ +// $Id$ +/************************************************************************** + * This file is property of and copyright by the ALICE HLT Project * + * ALICE Experiment at CERN, All rights reserved. * + * * + * Primary Authors: Jochen Thaeder * + * for The ALICE HLT Project. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/** @file AliHLTTPCCalibCEComponent.cxx + @author Jochen Thaeder + @date + @brief A pedestal calibration component for the TPC. +*/ + +// see header file for class documentation +// or +// refer to README to build package +// or +// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt + +#if __GNUC__>= 3 +using namespace std; +#endif + +//#include "AliHLTTPCLogging.h" +#include "AliHLTTPCDefinitions.h" +//#include "AliHLTTPCTransform.h" + +#include "AliHLTTPCCalibCEComponent.h" + +//#include "AliRawDataHeader.h" +#include "AliRawReaderMemory.h" +#include "AliTPCRawStream.h" + +#include "AliTPCCalibCE.h" + +#include +#include +#include "TString.h" + +// this is a global object used for automatic component registration, do not use this +AliHLTTPCCalibCEComponent gAliHLTTPCCalibCEComponent; + +ClassImp(AliHLTTPCCalibCEComponent) + +AliHLTTPCCalibCEComponent::AliHLTTPCCalibCEComponent() + : + fRawReader(NULL), + fRawStream(NULL), + fCalibCE(NULL), + fRCUFormat(kFALSE), + fMinPatch(5), + fMaxPatch(0), + fSpecification(0) , + fEnableAnalysis(kFALSE) { + // see header file for class documentation + // or + // refer to README to build package + // or + // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt +} + +AliHLTTPCCalibCEComponent::~AliHLTTPCCalibCEComponent() { + // see header file for class documentation +} + +// Public functions to implement AliHLTComponent's interface. +// These functions are required for the registration process + +const char* AliHLTTPCCalibCEComponent::GetComponentID() { + // see header file for class documentation + + return "TPCCalibCE"; +} + +void AliHLTTPCCalibCEComponent::GetInputDataTypes( vector& list) { + // see header file for class documentation + + list.clear(); + list.push_back( AliHLTTPCDefinitions::fgkDDLPackedRawDataType ); +} + +AliHLTComponentDataType AliHLTTPCCalibCEComponent::GetOutputDataType() { + // see header file for class documentation + + return AliHLTTPCDefinitions::fgkCalibCEDataType; +} + +void AliHLTTPCCalibCEComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) { + // see header file for class documentation + + // XXX TODO: Find more realistic values. + constBase = 0; + inputMultiplier = (2.0); +} + +AliHLTComponent* AliHLTTPCCalibCEComponent::Spawn() { + // see header file for class documentation + + return new AliHLTTPCCalibCEComponent(); +} + + +Int_t AliHLTTPCCalibCEComponent::ScanArgument( Int_t argc, const char** argv ) { + // see header file for class documentation + + Int_t iResult = 0; + TString argument = ""; + TString parameter = ""; + + if ( !argc ) + return -EINVAL; + + argument = argv[iResult]; + + if ( argument.IsNull() ) + return -EINVAL; + + // -rcuformat + if ( argument.CompareTo("-rcuformat") == 0 ) { + + if ( ++iResult >= argc ) { + iResult = -EPROTO; + } + else { + parameter = argv[1]; + if ( parameter.CompareTo("old") == 0 ) { + fRCUFormat = kTRUE; + HLTInfo( "RCU Format is set to old." ); + } + else if ( parameter.CompareTo("new") == 0 ) { + fRCUFormat = kFALSE; + HLTInfo( "RCU Format is set to new." ); + } + else { + HLTError( "Cannot convert rcu format specifier '%s'.", argv[1] ); + iResult = -EPROTO; + } + } + } + else if ( argument.CompareTo("-enableanalysis") == 0 ) { + HLTInfo( "Analysis before shipping data to FXS enabled." ); + fEnableAnalysis = kTRUE; + } + else { + iResult = -EINVAL; + } + + return iResult; +} + +Int_t AliHLTTPCCalibCEComponent::InitCalibration() { + // see header file for class documentation + + // ** Create pedestal calibration + if ( fCalibCE ) + return EINPROGRESS; + + fCalibCE = new AliTPCCalibCE(); + + // ** Create AliRoot Memory Reader + if (fRawReader) + return EINPROGRESS; + + fRawReader = new AliRawReaderMemory(); + + return 0; +} + +Int_t AliHLTTPCCalibCEComponent::DeinitCalibration() { + // see header file for class documentation + + if ( fRawReader ) + delete fRawReader; + fRawReader = NULL; + + if ( fCalibCE ) + delete fCalibCE; + fCalibCE = NULL; + + return 0; +} + +/* + * --- setter for rcuformat need in AliTPCCalibCE class + */ +Int_t AliHLTTPCCalibCEComponent::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/, + AliHLTComponentTriggerData& /*trigData*/ ) { + // see header file for class documentation + + const AliHLTComponentBlockData* iter = NULL; + + AliHLTUInt8_t slice=0, patch=0; + Int_t ddlId = 0; + + // ** Loop over all input blocks and specify which data format should be read - only select Raw Data + iter = GetFirstInputBlock( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC); + + while ( iter != NULL ) { + + // ** Print Debug output which data format was received + // char tmp1[14], tmp2[14]; + // DataType2Text( iter->fDataType, tmp1 ); + // DataType2Text( AliHLTTPCDefinitions::fgkDDLPackedRawDataType, tmp2 ); + // HLTDebug ( "Event received - Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", + // evtData.fEventID, evtData.fEventID, tmp1, tmp2 ); + + // ** Get DDL ID in order to tell the memory reader which slice/patch to use + slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); + patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); + + if (patch < 2) ddlId = 768 + (2 * slice) + patch; + else ddlId = 838 + (4*slice) + patch; + + HLTDebug ( "Input Raw Data - Slice/Patch: %d/%d - EquipmentID : %d.", slice, patch, ddlId ); + + // ** Get min and max patch, used for output specification + if ( patch < fMinPatch ) fMinPatch = patch; + if ( patch > fMaxPatch ) fMaxPatch = patch; + + // ** Init TPCRawStream + fRawReader->SetMemory( reinterpret_cast( iter->fPtr ), iter->fSize ); + fRawReader->SetEquipmentID(ddlId); + + fRawStream = new AliTPCRawStream( fRawReader ); + fRawStream->SetOldRCUFormat( fRCUFormat ); + + // ** Process actual Pedestal Calibration - Fill histograms + fCalibCE->ProcessEvent( fRawStream ); + + // ** Delete TPCRawStream + if ( fRawStream ) + delete fRawStream; + fRawStream = NULL; + + // ** Get next input block, with the same specification as defined in GetFirstInputBlock() + iter = GetNextInputBlock(); + + } // while ( iter != NULL ) { + + // ** Get output specification + fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, fMinPatch, fMaxPatch ); + + // ** PushBack data to shared memory ... + PushBack( (TObject*) fCalibCE, AliHLTTPCDefinitions::fgkCalibCEDataType, fSpecification); + + return 0; +} // Int_t AliHLTTPCCalibCEComponent::ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ) { + + +Int_t AliHLTTPCCalibCEComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, + AliHLTComponentTriggerData& /*trigData*/ ) { + // see header file for class documentation + + if ( fEnableAnalysis ) + fCalibCE->Analyse(); + + // ** PushBack data to FXS ... + PushToFXS( (TObject*) fCalibCE, "TPC", "CE" ) ; + + return 0; +} // Int_t AliHLTTPCCalibCEComponent::ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ) { + + diff --git a/HLT/TPCLib/AliHLTTPCCalibCEComponent.h b/HLT/TPCLib/AliHLTTPCCalibCEComponent.h new file mode 100644 index 00000000000..c24bbb668d6 --- /dev/null +++ b/HLT/TPCLib/AliHLTTPCCalibCEComponent.h @@ -0,0 +1,117 @@ +//-*- Mode: C++ -*- +// $Id$ +#ifndef ALIHLTTPCCALIBCECOMPONENT_H +#define ALIHLTTPCCALIBCECOMPONENT_H + +/* 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 */ + +/** @file AliHLTTPCCalibCEComponent.h + @author Jochen Thaeder + @date + @brief A pedestal calibration component for the TPC. +*/ + +// see below for class documentation +// or +// refer to README to build package +// or +// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt + +#include "AliHLTCalibrationProcessor.h" + +class AliTPCRawStream; +class AliRawReaderMemory; +class AliTPCCalibCE; + +/** + * @class AliHLTTPCCalibCEComponent + * + * This class is the calibration component for the AliTPCCalibCE class + * used for central electrode calibration of the TPC. + * + * It inherits from the AliHLTCalibrationProcessor and uses the high-level + * interface. The output is the class AliTPCCalibCE as a TObject. + * + * The component has the following component arguments: + * -rcuformat : Whether to use old or new rcuformat ( default is new ) + * -enableanalysis : Whether to enable analyis before shipping data to FXS + * + * @ingroup alihlt_tpc + */ +class AliHLTTPCCalibCEComponent : public AliHLTCalibrationProcessor + { + public: + /** constructor */ + AliHLTTPCCalibCEComponent(); + /** destructor */ + virtual ~AliHLTTPCCalibCEComponent(); + + // Public functions to implement AliHLTComponent's interface. + // These functions are required for the registration process + + const char* GetComponentID(); + void GetInputDataTypes( vector& list); + AliHLTComponentDataType GetOutputDataType(); + virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); + AliHLTComponent* Spawn(); + + protected: + + using AliHLTCalibrationProcessor::ProcessCalibration; + using AliHLTCalibrationProcessor::ShipDataToFXS; + + // Protected functions to implement AliHLTComponent's interface. + // These functions provide initialization as well as the actual processing + // capabilities of the component. + + /** Initialize the calibration component. */ + Int_t InitCalibration(); + + /** Scan commandline arguments of the calibration component. */ + Int_t ScanArgument( Int_t argc, const char** argv ); + + /** DeInitialize the calibration component. */ + Int_t DeinitCalibration(); + + /** Process the data in the calibration component. */ + Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ); + + /** Ship the data to the FXS at end of run or eventmodulo. */ + Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ); + + private: + /** copy constructor prohibited */ + AliHLTTPCCalibCEComponent(const AliHLTTPCCalibCEComponent&); + /** assignment operator prohibited */ + AliHLTTPCCalibCEComponent& operator=(const AliHLTTPCCalibCEComponent&); + + /** The reader object for reading from memory */ + AliRawReaderMemory* fRawReader; //!transient + + /** The reader object for reading TPC raw data */ + AliTPCRawStream* fRawStream; //!transient + + /** Pedestal Calibration class */ + AliTPCCalibCE * fCalibCE; //!transient + + /** Wether to use old RCU format */ + Bool_t fRCUFormat; // see above + + /** Minimum patch specifcation for this component */ + AliHLTUInt8_t fMinPatch; // see above + + /** Minimum patch specifcation for this component */ + AliHLTUInt8_t fMaxPatch; // see above + + /** The Specification for this component */ + AliHLTUInt32_t fSpecification; // see above + + /** Analysze calibration data before shipping to FXS */ + Bool_t fEnableAnalysis; // see above + + ClassDef(AliHLTTPCCalibCEComponent, 1) + + }; +#endif diff --git a/HLT/TPCLib/AliHLTTPCDefinitions.cxx b/HLT/TPCLib/AliHLTTPCDefinitions.cxx index 4a203fb1a1b..6215e674819 100644 --- a/HLT/TPCLib/AliHLTTPCDefinitions.cxx +++ b/HLT/TPCLib/AliHLTTPCDefinitions.cxx @@ -60,6 +60,8 @@ const AliHLTComponentDataType AliHLTTPCDefinitions::fgkCalibPedestalDataType = (AliHLTComponentDataType){sizeof(AliHLTComponentDataType), {'C','A','L','_','P','E','D',' '}, kAliHLTDataOriginAny} | kAliHLTDataOriginTPC; const AliHLTComponentDataType AliHLTTPCDefinitions::fgkCalibPulserDataType = (AliHLTComponentDataType){sizeof(AliHLTComponentDataType), {'C','A','L','_','P','U','L','S'}, kAliHLTDataOriginAny} | kAliHLTDataOriginTPC; +const AliHLTComponentDataType AliHLTTPCDefinitions::fgkCalibCEDataType = + (AliHLTComponentDataType){sizeof(AliHLTComponentDataType), {'C','A','L','_','C','E',' ',' '}, kAliHLTDataOriginAny} | kAliHLTDataOriginTPC; const AliHLTComponentDataType AliHLTTPCDefinitions::fgkActivePadsDataType = (AliHLTComponentDataType){sizeof(AliHLTComponentDataType), {'A','C','T','I','V','P','A','D'}, kAliHLTDataOriginAny} | kAliHLTDataOriginTPC; diff --git a/HLT/TPCLib/AliHLTTPCDefinitions.h b/HLT/TPCLib/AliHLTTPCDefinitions.h index 63062c245c4..10937070628 100644 --- a/HLT/TPCLib/AliHLTTPCDefinitions.h +++ b/HLT/TPCLib/AliHLTTPCDefinitions.h @@ -61,29 +61,29 @@ public: } /** DDL packed RAW data */ - static const AliHLTComponentDataType fgkDDLPackedRawDataType; // see above + static const AliHLTComponentDataType fgkDDLPackedRawDataType; // see above /** DDL entropy encoded data */ static const AliHLTComponentDataType fgkDDLEncodedEntropyRawDataType; // see above /** packed RAW data */ - static const AliHLTComponentDataType fgkPackedRawDataType; // see above + static const AliHLTComponentDataType fgkPackedRawDataType; // see above /** unpacked RAW data */ - static const AliHLTComponentDataType fgkUnpackedRawDataType; // see above + static const AliHLTComponentDataType fgkUnpackedRawDataType; // see above /** cluster data */ - static const AliHLTComponentDataType fgkClustersDataType; // see above + static const AliHLTComponentDataType fgkClustersDataType; // see above /** track segments in local coordinates */ - static const AliHLTComponentDataType fgkTrackSegmentsDataType; // see above + static const AliHLTComponentDataType fgkTrackSegmentsDataType; // see above /** tracks in global koordinates */ - static const AliHLTComponentDataType fgkTracksDataType; // see above + static const AliHLTComponentDataType fgkTracksDataType; // see above /** vertex data structure */ - static const AliHLTComponentDataType fgkVertexDataType; // see above + static const AliHLTComponentDataType fgkVertexDataType; // see above // Cluster & Tracks model data /** cluster tracks model data type */ - static const AliHLTComponentDataType fgkClusterTracksModelDataType; // see above + static const AliHLTComponentDataType fgkClusterTracksModelDataType; // see above /** remaining clusters model data type */ - static const AliHLTComponentDataType fgkRemainingClustersModelDataType; // see above + static const AliHLTComponentDataType fgkRemainingClustersModelDataType; // see above /** cluster tracks compressed data type */ - static const AliHLTComponentDataType fgkClusterTracksCompressedDataType; // see above + static const AliHLTComponentDataType fgkClusterTracksCompressedDataType; // see above /** remaining clusters compressed data type */ static const AliHLTComponentDataType fgkRemainingClustersCompressedDataType; // see above @@ -92,9 +92,12 @@ public: static const AliHLTComponentDataType fgkCalibPedestalDataType; // see above /** signal calibration data */ static const AliHLTComponentDataType fgkCalibPulserDataType; // see above - /** active pads data type, Used for cosmics test december 2007 */ - static const AliHLTComponentDataType fgkActivePadsDataType; // see above + /** central electrode calibration data */ + static const AliHLTComponentDataType fgkCalibCEDataType; // see above + /** active pads data type, Used for cosmics test december 2007 */ + static const AliHLTComponentDataType fgkActivePadsDataType; // see above + ClassDef(AliHLTTPCDefinitions, 1); diff --git a/HLT/libAliHLTTPC.pkg b/HLT/libAliHLTTPC.pkg index e080b3b6d40..f50e10df953 100644 --- a/HLT/libAliHLTTPC.pkg +++ b/HLT/libAliHLTTPC.pkg @@ -66,8 +66,8 @@ CLASS_HDRS:= AliHLTTPCTransform.h \ comp/AliHLTTPCCompModelInflater.h \ comp/AliHLTTPCCompModelInflaterComponent.h \ AliHLTTPCCalibPedestalComponent.h \ - AliHLTTPCCalibPulserComponent.h - + AliHLTTPCCalibPulserComponent.h \ + AliHLTTPCCalibCEComponent.h # AliHLTTPCDDLDataFileHandler.h # tracking/AliHLTTPCHough.h \ -- 2.39.3