1 /**************************************************************************
2 * This file is property of and copyright by the Experimental Nuclear *
3 * Physics Group, Dep. of Physics *
4 * University of Oslo, Norway, 2007 *
6 * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
7 * Contributors are mentioned in the code where appropriate. *
8 * Please report bugs to perthi@fys.uio.no *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
20 /// @class AliHLTPHOSRawAnalyzerComponent
21 /// Base class of PHOS HLT online raw analysis component.
22 /// The class provides a common interface for the implementation of PHOS
24 /// processors components. The class is intended for processing of
25 /// arrays of raw data samples to evaluate energy and timing.
26 /// The Energy will be given in entities of ADC leves ranging from 0 to
27 /// 1023. Timing will be given in entities of samples periods.
28 /// Drived clases must implement the fucntions
29 /// - @ref GetComponentID
32 #include "AliHLTPHOSRawAnalyzer.h"
33 #include "AliHLTPHOSRawAnalyzerComponent.h"
34 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
35 #include "AliHLTPHOSRcuChannelDataStruct.h"
36 #include "AliHLTDDLDecoder.h"
37 #include "AliHLTAltroData.h"
38 #include "AliHLTPHOSMapper.h"
43 AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTPHOSProcessor(), fAnalyzerPtr(0),
44 fSendChannelData(kFALSE),fOutPtr(0)
46 fMapperPtr = new AliHLTPHOSMapper();
50 AliHLTPHOSRawAnalyzerComponent::~AliHLTPHOSRawAnalyzerComponent()
56 AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent(const AliHLTPHOSRawAnalyzerComponent & ) : AliHLTPHOSProcessor(), fAnalyzerPtr(0),
57 fSendChannelData(kFALSE),fOutPtr(0)
64 AliHLTPHOSRawAnalyzerComponent::Deinit()
66 Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen Deinit");
72 AliHLTPHOSRawAnalyzerComponent::GetComponentID()
74 return "AliPhosTestRaw";
79 AliHLTPHOSRawAnalyzerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
81 const AliHLTComponentDataType* pType=fgkInputDataTypes;
82 while (pType->fID!=0) {
83 list.push_back(*pType);
89 AliHLTComponentDataType
90 AliHLTPHOSRawAnalyzerComponent::GetOutputDataType()
92 return AliHLTPHOSDefinitions::fgkCellEnergyDataType;
97 AliHLTPHOSRawAnalyzerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
106 AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
111 Int_t tmpChannelCnt = 0;
112 AliHLTUInt8_t* outBPtr;
114 const AliHLTComponentBlockData* iter = NULL;
117 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
123 if ( iter->fDataType != AliHLTPHOSDefinitions::fgkDDLPackedRawDataType )
125 cout <<"WARNING: notAliHLTPHOSDefinitions::fgkDDLPackedRawDataTyp " << endl;
129 fDecoderPtr->SetMemory(reinterpret_cast<UChar_t*>( iter->fPtr ), iter->fSize);
130 fDecoderPtr->Decode();
131 fOutPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)outBPtr;
133 while( fDecoderPtr->NextChannel(fAltroDataPtr) == true )
136 fAnalyzerPtr->SetData(fAltroDataPtr->fData);
137 fAnalyzerPtr->Evaluate(0, fAltroDataPtr->fDataSize -2);
139 fOutPtr->fValidData[tmpChannelCnt].fGain = fMapperPtr->ALTRO_MAP[fAltroDataPtr->fHadd].gain;
140 fOutPtr->fValidData[tmpChannelCnt].fZ = fMapperPtr->ALTRO_MAP[fAltroDataPtr->fHadd].row;
141 fOutPtr->fValidData[tmpChannelCnt].fX = fMapperPtr->ALTRO_MAP[fAltroDataPtr->fHadd].col;
142 fOutPtr->fValidData[tmpChannelCnt].fEnergy = (float)fAnalyzerPtr->GetEnergy();
143 fOutPtr->fValidData[tmpChannelCnt].fTime = (float)fAnalyzerPtr->GetTiming();
147 mysize += sizeof(AliHLTPHOSRcuCellEnergyDataStruct);
149 fOutPtr->fCnt = tmpChannelCnt;
150 AliHLTComponentBlockData bd;
155 bd.fDataType = AliHLTPHOSDefinitions::fgkCellEnergyDataType;
156 bd.fSpecification = 0xFFFFFFFF;
157 outputBlocks.push_back( bd );
164 cout <<"kHLTLogFatal, HLT::AliHLTPHOSRawAnalyzerComponent::DoEvent Too much dataData written over allowed buffer. Amount written:"
165 << tSize << " allowed" << size << endl;
166 Logging( kHLTLogFatal, "HLT::AliHLTPHOSRawAnalyzerComponent::DoEvent", "Too much data",
167 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."
175 if(fPrintInfo == kTRUE)
177 if(fPhosEventCount%fPrintInfoFrequncy == 0)
179 cout <<"Analyzing event " << fPhosEventCount << "for Equippment " << fkEquippmentID << endl;
189 AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv )
191 cout <<"AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv ) "<< endl;
192 fAltroDataPtr = new AliHLTAltroData();
193 fDecoderPtr = new AliHLTDDLDecoder();
194 fSendChannelData = kFALSE;
199 iResult = ScanArguments(argc, argv);
201 if(fIsSetEquippmentID == kFALSE)
203 cout << "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID <number>" << endl;
204 Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument",
205 "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID <number>");
211 // fRawMemoryReader->SetEquipmentID(fkEquippmentID);
221 AliHLTPHOSRawAnalyzerComponent::Reset()
223 for(int mod = 0; mod < N_MODULES; mod ++)
225 for(int row = 0; row < N_ROWS_MOD; row ++)
227 for(int col = 0; col < N_COLUMNS_MOD; col ++)
229 for(int gain = 0; gain < N_GAINS; gain ++ )
231 fMaxValues[mod][row][col][gain] = 0;
237 ResetDataPtr(0, ALTRO_MAX_SAMPLES);
243 AliHLTPHOSRawAnalyzerComponent::ResetDataPtr(int startindex, int sampleCnt)
245 for(int i = startindex ; i< sampleCnt; i++)
247 fTmpChannelData[i] = 0;