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 #include "AliHLTPHOSDDLDecoderComponent.h"
22 #include "AliRawReaderMemory.h"
23 #include "AliCaloRawStream.h"
24 #include "AliHLTPHOSRcuChannelDataStruct.h"
25 #include "AliHLTPHOSPulseGenerator.h"
26 #include "AliHLTPHOSDataCorruptor.h"
32 AliHLTPHOSDDLDecoderComponent gAliHLTPHOSDDLDecoderComponent;
35 AliHLTPHOSDDLDecoderComponent::AliHLTPHOSDDLDecoderComponent():AliHLTPHOSProcessor(), fPHOSRawStream(0), fRawMemoryReader(0),
36 fOutPtr(0), fDataCorruptorPtr(0)
39 fDataCorruptorPtr = new AliHLTPHOSDataCorruptor();
42 AliHLTPHOSDDLDecoderComponent::~AliHLTPHOSDDLDecoderComponent()
45 delete fRawMemoryReader;
46 delete fPHOSRawStream;
47 delete fDataCorruptorPtr;
51 AliHLTPHOSDDLDecoderComponent::AliHLTPHOSDDLDecoderComponent(const AliHLTPHOSDDLDecoderComponent & ) : AliHLTPHOSProcessor(),
52 fPHOSRawStream(0),fRawMemoryReader(0), fOutPtr(0), fDataCorruptorPtr(0)
59 AliHLTPHOSDDLDecoderComponent::Deinit()
61 //Se html documentation of base class
62 cout << "Deinit" << endl;
63 Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen DoDeinit");
65 if(fRawMemoryReader !=0)
67 delete fRawMemoryReader;
70 if(fPHOSRawStream != 0)
72 delete fPHOSRawStream;
81 AliHLTPHOSDDLDecoderComponent::GetComponentID()
83 //Se html documentation of base class
84 return "PhosDDLDecoder";
90 AliHLTPHOSDDLDecoderComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
92 //Se html documentation of base class
93 const AliHLTComponentDataType* pType=fgkInputDataTypes;
94 while (pType->fID!=0) {
95 list.push_back(*pType);
100 AliHLTComponentDataType
101 AliHLTPHOSDDLDecoderComponent::GetOutputDataType()
103 //See html documentation of base class
104 return AliHLTPHOSDefinitions::fgkCellChannelDataDataType;
108 AliHLTPHOSDDLDecoderComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
111 //Se html documentation of base class
118 AliHLTPHOSDDLDecoderComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
119 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
120 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
123 Int_t processedChannels = 0;
128 Int_t tmpChannelCnt = 0;
130 AliHLTUInt8_t* outBPtr;
133 const AliHLTComponentBlockData* iter = NULL;
136 // cout << "evtData.fBlockCnt = " << evtData.fBlockCnt << endl;
138 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
140 // cout << "AliHLTPHOSDDLDecoderComponent::DoEven ndx = " << ndx <<endl;
147 if ( iter->fDataType != AliHLTPHOSDefinitions::fgkDDLPackedRawDataType )
149 // cout << "iter->fDataType != AliHLTPHOSDefinitions::fgkDDLPackedRawDataType" << endl;
153 fRawMemoryReader->SetMemory( reinterpret_cast<UChar_t*>( iter->fPtr ), iter->fSize );
154 fOutPtr = (AliHLTPHOSRcuChannelDataStruct*)outBPtr;
155 mysize += sizeof(AliHLTPHOSRcuChannelDataStruct);
156 fOutPtr->fRcuX = fRcuX;
157 fOutPtr->fRcuZ = fRcuZ;
158 fOutPtr->fModuleID = fModuleID;
162 while(fPHOSRawStream->Next())
164 if (fPHOSRawStream->IsNewHWAddress())
167 fOutPtr->fValidData[tmpChannelCnt].fZ = (AliHLTUInt8_t)fPHOSRawStream->GetColumn() - fRcuZOffset;
168 fOutPtr->fValidData[tmpChannelCnt].fX = (AliHLTUInt8_t)fPHOSRawStream->GetRow() - fRcuXOffset;
169 fOutPtr->fValidData[tmpChannelCnt].fGain = fPHOSRawStream->IsLowGain();
170 fOutPtr->fValidData[tmpChannelCnt].fNSamples = 0;
173 fOutPtr->fValidData[tmpChannelCnt-1].fNSamples ++;
174 fOutPtr->fValidData[tmpChannelCnt-1].fChannelData[sampleCnt] = fPHOSRawStream->GetSignal();
178 fOutPtr->fNValidChannels = tmpChannelCnt-1;
179 // cout << "AliHLTPHOSDDLDecoderComponent::DoEven: setting fOutPtr->fNValidChannels =" << tmpChannelCnt-1<<endl;
182 AliHLTComponentBlockData bd;
186 bd.fDataType = AliHLTPHOSDefinitions::fgkCellChannelDataDataType;
187 bd.fSpecification = 0xeFFFFFFF;
188 outputBlocks.push_back( bd);
195 cout <<"kHLTLogFatal, HLT::AliHLTPHOSDDLDecoderComponent::DoEvent Too much data Data written over allowed buffer. Amount written:" << tSize << " allowed" << size << endl;
196 Logging( kHLTLogFatal, "HLT::AliHLTPHOSDDLDecoderComponent::DoEvent", "Too much data", "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", tSize, size );
202 if(fPrintInfo == kTRUE)
204 if(fPhosEventCount%fPrintInfoFrequncy == 0)
206 cout <<"Analyzing event " << fPhosEventCount << "for Equippment " << fkEquippmentID << endl;
215 AliHLTPHOSDDLDecoderComponent::DoInit( int argc, const char** argv )
217 //See html documentation of base class
219 fRawMemoryReader = new AliRawReaderMemory();
220 fPHOSRawStream = new AliCaloRawStream(fRawMemoryReader,"PHOS");
221 fPHOSRawStream->SetOldRCUFormat(kFALSE);
224 ScanArguments(argc, argv);
226 if(fIsSetEquippmentID == kFALSE)
229 cout << "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID <number>" << endl;
230 Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument",
231 "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID <number>");
236 fRawMemoryReader->SetEquipmentID(fkEquippmentID);
243 AliHLTPHOSDDLDecoderComponent::Spawn()
245 //See html documentation of base class
246 return new AliHLTPHOSDDLDecoderComponent;