3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
7 * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
8 * Sorina Popescu <sorina.popescu@cern.ch *
9 * for The ALICE HLT Project. *
11 * Permission to use, copy, modify and distribute this software and its *
12 * documentation strictly for non-commercial purposes is hereby granted *
13 * without fee, provided that the above copyright notice appears in all *
14 * copies and that both the copyright notice and this permission notice *
15 * appear in the supporting documentation. The authors make no claims *
16 * about the suitability of this software for any purpose. It is *
17 * provided "as is" without express or implied warranty. *
18 **************************************************************************/
20 /** @file AliHLTTPCCalibSignalComponent.cxx
21 @author Jochen Thaeder, Sorina Popescu
23 @brief HLT pulser calibration component for the TPC.
30 #include "AliHLTTPCLogging.h"
31 #include "AliHLTTPCTransform.h"
33 #include "AliHLTTPCCalibSignalComponent.h"
35 #include "AliRawDataHeader.h"
36 #include "AliRawReaderMemory.h"
37 #include "AliTPCRawStream.h"
39 #include "AliTPCCalibSignal.h"
45 // this is a global object used for automatic component registration, do not use this
46 AliHLTTPCCalibSignalComponent gAliHLTTPCCalibSignalComponent;
48 ClassImp(AliHLTTPCCalibSignalComponent)
50 AliHLTTPCCalibSignalComponent::AliHLTTPCCalibSignalComponent()
57 // see header file for class documentation
59 // refer to README to build package
61 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
64 AliHLTTPCCalibSignalComponent::AliHLTTPCCalibSignalComponent(const AliHLTTPCCalibSignalComponent&)
71 // see header file for class documentation
72 HLTFatal("copy constructor to be tested");
75 AliHLTTPCCalibSignalComponent& AliHLTTPCCalibSignalComponent::operator=(const AliHLTTPCCalibSignalComponent&)
77 // see header file for class documentation
78 HLTFatal("assignment operator to be tested");
82 AliHLTTPCCalibSignalComponent::~AliHLTTPCCalibSignalComponent()
84 // see header file for class documentation
87 // Public functions to implement AliHLTComponent's interface.
88 // These functions are required for the registration process
90 const char* AliHLTTPCCalibSignalComponent::GetComponentID()
92 // see header file for class documentation
93 return "TPCCalibSignal";
96 void AliHLTTPCCalibSignalComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
98 // see header file for class documentation
100 list.push_back( AliHLTTPCDefinitions::fgkDDLPackedRawDataType );
103 AliHLTComponentDataType AliHLTTPCCalibSignalComponent::GetOutputDataType()
105 // see header file for class documentation
106 return AliHLTTPCDefinitions::fgkCalibSignalDataType;
109 void AliHLTTPCCalibSignalComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
111 // see header file for class documentation
112 // XXX TODO: Find more realistic values.
114 inputMultiplier = (2.0);
117 AliHLTComponent* AliHLTTPCCalibSignalComponent::Spawn()
119 // see header file for class documentation
120 return new AliHLTTPCCalibSignalComponent();
123 Int_t AliHLTTPCCalibSignalComponent::DoInit( int argc, const char** argv )
125 // see header file for class documentation
127 // ** Interprete commandline arguments
133 // -- rcu format option-- default in constructor: kFALSE => use new data format
134 if ( !strcmp( argv[i], "rcuformat" ) ) {
136 HLTError( "Missing RCU format - RCU format not specified" );
140 // Decodes the rcu format -- options: "old" or "new"
141 if ( !strcmp( argv[i+1], "old" ) ) {
144 else if ( !strcmp( argv[i+1], "new" ) ) {
148 HLTError( "Missing RCU format - Cannot convert rcu format specifier '%s'.", argv[i+1] );
156 HLTError( "Unknown Option - Unknown option '%s'", argv[i] );
161 // ** Create Signal calibration
165 fCalibSignal = new AliTPCCalibSignal();
167 // ** Create AliRoot Memory Reader
171 #if defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
172 fRawReader = new AliRawReaderMemory();
174 HLTFatal("AliRawReader not available - check your build");
181 Int_t AliHLTTPCCalibSignalComponent::DoDeinit()
183 // see header file for class documentation
197 * --- will be changing with the Calibration Processor, -> Split DoEvent into 2 functions:
198 * --- > Process event
199 * --- > Ship Data to FXS
200 * --- setter for rcuformat need in AliTPCCalibSignal class
202 Int_t AliHLTTPCCalibSignalComponent::DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ) {
203 // see header file for class documentation
205 const AliHLTComponentBlockData* iter = NULL;
206 AliHLTUInt32_t spec = 0;
213 //--------same as for pedestal
215 // ** Loop over all input blocks and specify which data format should be read
216 iter = GetFirstInputBlock( AliHLTTPCDefinitions::fgkDDLPackedRawDataType );
218 while ( iter != NULL ) {
220 // ** Print Debug output which data format was received
221 char tmp1[14], tmp2[14];
222 DataType2Text( iter->fDataType, tmp1 );
223 DataType2Text( AliHLTTPCDefinitions::fgkDDLPackedRawDataType, tmp2 );
225 HLTDebug ( "Event received - Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", evtData.fEventID, evtData.fEventID, tmp1, tmp2 );
227 // ** Get DDL ID in order to tell the memory reader which slice/patch to use
228 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
229 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
231 if (patch < 2) DDLid = 768 + (2 * slice) + patch;
232 else DDLid = 838 + (4*slice) + patch;
236 HLTDebug ( "Input Raw Data - Slice/Patch: %d/%d - EquipmentID : %d.", slice, patch, DDLid );
238 // ** Get the min and max patch, used in the output specfication
239 if ( patch < minPatch ) minPatch = patch;
240 if ( patch > maxPatch ) maxPatch = patch;
242 // ** Init TPCRawStream
243 fRawReader->SetMemory( reinterpret_cast<UChar_t*>( iter->fPtr ), iter->fSize );
244 fRawReader->SetEquipmentID(DDLid);
246 fRawStream = new AliTPCRawStream( fRawReader );
247 fRawStream->SetOldRCUFormat( fRCUFormat );
249 fCalibSignal->ProcessEvent( fRawStream );
256 // ** Get next input block, with the same specification as defined in GetFirstInputBlock()
257 iter = GetNextInputBlock();
259 } // while ( iter != NULL ) {
261 // !!! HIGHLY DEBUG !!!
262 // fCalibSignal->DumpToFile("Signal.root");
263 // !!! HIGHLY DEBUG !!!
265 // ** Call only at END of RUN event
266 // fCalibSignal->Analyse();
268 // ** PushBack data to shared memory ...
270 spec = AliHLTTPCDefinitions::EncodeDataSpecification( slice, slice, minPatch, maxPatch );
271 PushBack( (TObject*) fCalibSignal, AliHLTTPCDefinitions::fgkCalibSignalDataType, spec);
274 } // Int_t AliHLTTPCCalibSignalComponent::DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ) {