9dfd64cf |
1 | |
cbab66dd |
2 | /************************************************************************** |
3 | * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * |
4 | * * |
5 | * Author: Per Thomas Hille for the ALICE HLT Project. * |
6 | * Contributors are mentioned in the code where appropriate. * |
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 | |
17 | #include "AliHLTPHOSRawAnalyzerComponent.h" |
18 | #include <iostream> |
9dfd64cf |
19 | #include "stdio.h" |
20 | #include "AliRawReaderMemory.h" |
cbab66dd |
21 | |
ee7849e6 |
22 | const AliHLTComponentDataType AliHLTPHOSRawAnalyzerComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array |
23 | const AliHLTComponentDataType AliHLTPHOSRawAnalyzerComponent::outputDataType=kAliHLTVoidDataType; |
24 | |
25 | |
9dfd64cf |
26 | //AliHLTPHOSRawAnalyzerComponent gAliHLTPHOSRawAnalyzerComponent; |
ee7849e6 |
27 | //ClassImp(AliHLTPHOSRawAnalyzerComponent) |
28 | AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent():AliHLTProcessor(), eventCount(0) |
cbab66dd |
29 | { |
9dfd64cf |
30 | // ddlDecoderPtr = new AliRawReaderMemory(); |
31 | // fRawMemoryReader = NULL; |
cbab66dd |
32 | } |
33 | |
34 | AliHLTPHOSRawAnalyzerComponent::~AliHLTPHOSRawAnalyzerComponent() |
35 | { |
9dfd64cf |
36 | // fRawMemoryReader = NULL; |
cbab66dd |
37 | } |
38 | |
39 | |
ee7849e6 |
40 | AliHLTPHOSRawAnalyzerComponent::AliHLTPHOSRawAnalyzerComponent(const AliHLTPHOSRawAnalyzerComponent & ) : AliHLTProcessor(), eventCount(0) |
cbab66dd |
41 | { |
9dfd64cf |
42 | // ddlDecoderPtr = new AliRawReaderMemory(); |
43 | // fRawMemoryReader = NULL; |
cbab66dd |
44 | } |
45 | |
9dfd64cf |
46 | |
47 | //AliHLTComponent* |
48 | //AliHLTPHOSRawAnalyzerComponent::Spawn() |
49 | //{ |
50 | // return new AliHLTPHOSRawAnalyzerComponent; |
51 | //} |
52 | |
53 | |
54 | |
cbab66dd |
55 | int |
56 | AliHLTPHOSRawAnalyzerComponent::Deinit() |
57 | { |
58 | return 0; |
59 | } |
60 | |
61 | int |
62 | AliHLTPHOSRawAnalyzerComponent::DoDeinit() |
63 | { |
9dfd64cf |
64 | Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerComponen DoDeinit"); |
65 | |
66 | // if ( fRawMemoryReader ) |
67 | // delete fRawMemoryReader; |
68 | // fRawMemoryReader = NULL; |
69 | |
cbab66dd |
70 | return 0; |
cbab66dd |
71 | |
cbab66dd |
72 | } |
73 | |
9dfd64cf |
74 | const char* |
75 | AliHLTPHOSRawAnalyzerComponent::GetComponentID() |
76 | { |
77 | return "AliPhosTestRaw"; |
78 | } |
ee7849e6 |
79 | |
cbab66dd |
80 | void |
ee7849e6 |
81 | AliHLTPHOSRawAnalyzerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
cbab66dd |
82 | { |
ee7849e6 |
83 | const AliHLTComponentDataType* pType=inputDataTypes; |
84 | while (pType->fID!=0) { |
85 | list.push_back(*pType); |
86 | pType++; |
87 | } |
cbab66dd |
88 | } |
89 | |
90 | AliHLTComponentDataType |
91 | AliHLTPHOSRawAnalyzerComponent::GetOutputDataType() |
92 | { |
ee7849e6 |
93 | return outputDataType; |
cbab66dd |
94 | } |
95 | |
96 | void |
9dfd64cf |
97 | AliHLTPHOSRawAnalyzerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) |
98 | |
cbab66dd |
99 | { |
ee7849e6 |
100 | constBase = 0;inputMultiplier = 0; |
cbab66dd |
101 | } |
102 | |
ee7849e6 |
103 | int |
9dfd64cf |
104 | AliHLTPHOSRawAnalyzerComponent::DoEvent(const AliHLTComponentEventData& evtDtaPtr, const AliHLTComponentBlockData* dtaPtr, AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&, std::vector<AliHLTComponentBlockData, std::allocator<AliHLTComponentBlockData> >&) |
cbab66dd |
105 | { |
9dfd64cf |
106 | |
107 | // AliRawReaderMemory *testDDLDecoderPtr = new AliRawReaderMemory() ; |
108 | // virtual Bool_t SetMemory( UChar_t* memory, ULong_t size ); |
109 | |
110 | // ddlDecoderPtr->SetMemory( reinterpret_cast<UChar_t*>( dtaPtr->fPtr ), dtaPtr->fSize ); |
111 | |
112 | // analyzerPtr->Evaluate(0, 100); |
113 | |
ee7849e6 |
114 | Logging(kHLTLogInfo, "HLT", "Sample", "PhosHLTRawAnalyzerComonent, DoEvent"); |
9dfd64cf |
115 | |
116 | // AliHLTUInt32_t *tmpDtaPtr = (AliHLTUInt32_t *)dtaPtr->fPtr; |
117 | |
118 | |
119 | // UChar_t *dataPtr = address; |
120 | //ULong_t address, |
121 | |
122 | UChar_t *tmpDtaPtr = (UChar_t *)dtaPtr->fPtr; |
123 | // UChar_t *tmpDtaPtr = (ULong_t *)dtaPtr->fPtr; |
124 | |
125 | |
126 | AliHLTUInt32_t tmpSize = dtaPtr->fSize; |
127 | AliHLTUInt32_t tmpSize32 = dtaPtr->fSize/4; |
128 | |
129 | cout <<"PHOSHLT DoEvent: processing event:"<< eventCount << endl; |
130 | cout <<"Struct size = " <<evtDtaPtr.fStructSize << endl; |
131 | cout <<"Event ID = " <<evtDtaPtr.fEventID << endl; |
132 | cout <<"Block count = " <<evtDtaPtr.fBlockCnt << endl; |
133 | cout <<"Block size = " << dtaPtr->fSize << endl; |
134 | cout <<"printing out start od data block" << endl; |
135 | |
136 | |
137 | // tmpDtaPtr = dtaPtr->fPtr; |
138 | // AliHLTUInt32_t *tmpDtaPtr = (AliHLTUInt32_t *)dtaPtr->fPtr; |
139 | |
140 | |
141 | // testDDLDecoderPtr->SetMemory(tmpDtaPtr, tmpSize); |
142 | // cout << "Dumoing data from the AliRawReader" << endl; |
143 | // ddlDecoderPtr->DumpData(30); |
144 | // cout << "finnished dumping data from the AliRawReader" << endl; |
145 | |
146 | // unsigned int tmpSize = (dtaPtr->fSize)/4; |
147 | |
148 | cout << "content of data pointer =" << tmpDtaPtr << endl; |
149 | |
150 | |
151 | // for(unsigned int i = 0; i < tmpSize; i++) |
152 | for(unsigned int i = 0; i < 10; i++) |
153 | { |
154 | // getc(); |
155 | // sleep(10); |
156 | printf("\ntype return to continue; "); |
157 | getc(stdin); |
158 | printf("\nThanks; read in \n"); |
159 | cout << "entry:" <<i <<" = " << *tmpDtaPtr << endl; |
160 | tmpDtaPtr ++; |
161 | } |
162 | |
163 | |
ee7849e6 |
164 | eventCount++; |
cbab66dd |
165 | return 0; |
166 | } |
167 | |
9dfd64cf |
168 | //void |
169 | //AliHLTPHOSRawAnalyzerComponent::Evaluate(int start, int length) |
170 | //{ |
171 | // cout <<" AliHLTPHOSRawAnalyzerComponent::Evaluate" << endl ; |
172 | //} |
173 | |
ee7849e6 |
174 | |
175 | int |
176 | AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv ) |
cbab66dd |
177 | { |
9dfd64cf |
178 | cout << "AliHLTPHOSRawAnalyzerComponent::DoInit Creating new AliRawReaderMemory()" << endl; |
179 | fRawMemoryReader = new AliRawReaderMemory; |
180 | |
181 | |
182 | |
183 | /* |
184 | if(fRawMemoryReader) |
185 | { |
186 | return EINPROGRESS; |
187 | } |
188 | int i = 0; |
189 | // const char* tableFileBaseDir = NULL; |
190 | while ( i < argc ) |
191 | { |
192 | Logging(kHLTLogError, "HLT::TPCRawDataUnpacker::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] ); |
193 | return EINVAL; |
194 | } |
195 | |
196 | // fRawMemoryReader = new AliRawReaderMemory; |
197 | */ |
198 | |
199 | |
200 | |
201 | |
202 | |
203 | cout <<"AliHLTPHOSRawAnalyzerComponent::DoIni DONE!" << endl; |
ee7849e6 |
204 | if (argc==0 && argv==NULL) { |
205 | // this is currently just to get rid of the warning "unused parameter" |
206 | } |
cbab66dd |
207 | return 0; |
208 | } |