]>
Commit | Line | Data |
---|---|---|
87434909 | 1 | |
2 | /************************************************************************** | |
3 | * This file is property of and copyright by the ALICE HLT Project * | |
4 | * All rights reserved. * | |
5 | * * | |
6 | * Primary Authors: Per Thomas Hille, Oystein Djuvsland * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | ||
87434909 | 17 | #include "AliHLTPHOSRawAnalyzerComponentv3.h" |
44175a17 | 18 | #include "AliHLTPHOSRawAnalyzer.h" |
19 | #include "AliHLTCaloChannelDataHeaderStruct.h" | |
20 | #include "AliHLTPHOSDefinitions.h" | |
9a2451f1 | 21 | #include "AliHLTPHOSUtilities.h" |
44175a17 | 22 | #include "AliHLTPHOSMapper.h" |
ae3ca5ff | 23 | #include "AliLog.h" |
87434909 | 24 | |
4f4b7ba4 | 25 | |
44175a17 | 26 | AliHLTPHOSRawAnalyzerComponentv3::AliHLTPHOSRawAnalyzerComponentv3() : |
27 | AliHLTCaloRawAnalyzerComponentv3("PHOS") | |
f137c3c5 | 28 | ,fCurrentSpec(-1) |
87434909 | 29 | { |
44175a17 | 30 | // See header file for class documentation |
9a0cbaba | 31 | InitMapping(0x1); //using 0x1 to avoid error message |
87434909 | 32 | } |
33 | ||
87434909 | 34 | AliHLTPHOSRawAnalyzerComponentv3::~AliHLTPHOSRawAnalyzerComponentv3() |
35 | { | |
36 | //comment | |
cb12f62a | 37 | } |
38 | ||
39 | ||
87434909 | 40 | void |
41 | AliHLTPHOSRawAnalyzerComponentv3::GetInputDataTypes( vector<AliHLTComponentDataType>& list) | |
42 | { | |
43 | //comment | |
44 | list.clear(); | |
44175a17 | 45 | list.push_back( AliHLTPHOSDefinitions::fgkDDLPackedRawDataType); |
87434909 | 46 | } |
47 | ||
0a21baa3 | 48 | AliHLTComponentDataType |
49 | AliHLTPHOSRawAnalyzerComponentv3::GetOutputDataType() | |
50 | { | |
51 | //comment | |
52 | return AliHLTPHOSDefinitions::fgkChannelDataType; | |
53 | } | |
54 | ||
55 | void | |
56 | AliHLTPHOSRawAnalyzerComponentv3::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) | |
57 | { | |
58 | //comment | |
44175a17 | 59 | constBase = sizeof(AliHLTCaloChannelDataHeaderStruct); |
60 | inputMultiplier = 1.5; | |
0a21baa3 | 61 | } |
62 | ||
63 | int | |
64 | AliHLTPHOSRawAnalyzerComponentv3::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& /*trigData*/, | |
65 | AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks ) | |
66 | { | |
67 | //comment | |
9acbbea1 | 68 | |
69 | ||
70 | if(!IsDataEvent()) | |
71 | { | |
72 | size = 0; | |
73 | return 0; | |
74 | } | |
75 | ||
76 | ||
0a21baa3 | 77 | Int_t blockSize = 0; |
78 | UInt_t totSize = 0; | |
79 | ||
80 | const AliHLTComponentBlockData* iter = NULL; | |
81 | unsigned long ndx; | |
82 | ||
83 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
84 | { | |
85 | iter = blocks+ndx; | |
86 | if ( iter->fDataType != AliHLTPHOSDefinitions::fgkDDLPackedRawDataType ) | |
87 | { | |
88 | HLTDebug("Data block is not of type fgkDDLPackedRawDataType"); | |
89 | continue; | |
90 | } | |
44175a17 | 91 | if(iter->fSpecification != fCurrentSpec) |
92 | { | |
93 | fCurrentSpec = iter->fSpecification; | |
94 | InitMapping(iter->fSpecification); | |
95 | } | |
0a21baa3 | 96 | blockSize = DoIt(iter, outputPtr, size, totSize); // Processing the block |
97 | ||
98 | if(blockSize == -1) // If the processing returns -1 we are out of buffer and return an error msg. | |
99 | { | |
100 | return -ENOBUFS; | |
101 | } | |
102 | ||
103 | totSize += blockSize; //Keeping track of the used size | |
104 | // HLTDebug("Output data size: %d - Input data size: %d", totSize, iter->fSize); | |
105 | ||
106 | //Filling the block data | |
107 | AliHLTComponentBlockData bdChannelData; | |
108 | FillBlockData( bdChannelData ); | |
109 | bdChannelData.fOffset = 0; //FIXME | |
110 | bdChannelData.fSize = blockSize; | |
111 | bdChannelData.fDataType = AliHLTPHOSDefinitions::fgkChannelDataType; | |
112 | bdChannelData.fSpecification = iter->fSpecification; | |
113 | outputBlocks.push_back(bdChannelData); | |
114 | ||
115 | outputPtr += blockSize; //Updating position of the output buffer | |
116 | } | |
117 | ||
44175a17 | 118 | fCaloEventCount++; |
0a21baa3 | 119 | size = totSize; //telling the framework how much buffer space we have used. |
120 | ||
121 | return 0; | |
122 | }//end DoEvent | |
123 | ||
cb12f62a | 124 | |
44175a17 | 125 | void AliHLTPHOSRawAnalyzerComponentv3::InitMapping ( const int specification ) |
cb12f62a | 126 | { |
44175a17 | 127 | // See header file for class documentation |
128 | fMapperPtr = new AliHLTPHOSMapper; | |
f137c3c5 | 129 | fMapperPtr->InitDDLSpecificationMapping(); |
130 | fMapperPtr->InitAltroMapping(specification); | |
131 | ||
cb12f62a | 132 | } |
133 |