]>
Commit | Line | Data |
---|---|---|
25b7f84c | 1 | /************************************************************************** |
ab38011b | 2 | * This file is property of and copyright by the ALICE HLT Project * |
3 | * All rights reserved. * | |
4 | * * | |
5 | * Primary Authors: Oystein Djuvsland * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
209a4703 | 15 | |
16 | #include "AliHLTPHOSDigitMakerComponent.h" | |
17 | #include "AliHLTPHOSDigitMaker.h" | |
18 | #include "TTree.h" | |
19 | #include "AliHLTPHOSProcessor.h" | |
20 | #include "AliHLTPHOSRcuCellEnergyDataStruct.h" | |
21 | #include "AliHLTPHOSDigitContainerDataStruct.h" | |
94594220 | 22 | #include "AliHLTPHOSChannelDataHeaderStruct.h" |
209a4703 | 23 | #include "TClonesArray.h" |
24 | #include "TFile.h" | |
25 | #include <sys/stat.h> | |
26 | #include <sys/types.h> | |
27 | ||
2374af72 | 28 | |
29 | /** | |
30 | * @file AliHLTPHOSDigitMakerComponent.cxx | |
31 | * @author Oystein Djuvsland | |
32 | * @date | |
33 | * @brief A digit maker component for PHOS HLT | |
34 | */ | |
35 | ||
36 | // see below for class documentation | |
37 | // or | |
38 | // refer to README to build package | |
39 | // or | |
40 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
41 | ||
42 | ||
209a4703 | 43 | const AliHLTComponentDataType AliHLTPHOSDigitMakerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; |
44 | ||
45 | AliHLTPHOSDigitMakerComponent gAliHLTPHOSDigitMakerComponent; | |
46 | ||
47 | AliHLTPHOSDigitMakerComponent::AliHLTPHOSDigitMakerComponent() : | |
48 | AliHLTPHOSProcessor(), | |
25b7f84c | 49 | fDigitMakerPtr(0), |
50 | fDigitContainerPtr(0) | |
939c67e7 | 51 | // fEvtCnt(0) |
209a4703 | 52 | { |
2374af72 | 53 | //see header file for documentation |
209a4703 | 54 | } |
55 | ||
56 | AliHLTPHOSDigitMakerComponent::~AliHLTPHOSDigitMakerComponent() | |
57 | { | |
2374af72 | 58 | //see header file for documentation |
209a4703 | 59 | } |
60 | ||
61 | int | |
62 | AliHLTPHOSDigitMakerComponent::Deinit() | |
63 | { | |
2374af72 | 64 | //see header file for documentation |
209a4703 | 65 | if(fDigitMakerPtr) |
66 | { | |
67 | delete fDigitMakerPtr; | |
68 | fDigitMakerPtr = 0; | |
69 | } | |
52be7fb0 | 70 | return 0; |
209a4703 | 71 | } |
72 | ||
73 | const char* | |
74 | AliHLTPHOSDigitMakerComponent::GetComponentID() | |
75 | { | |
2374af72 | 76 | //see header file for documentation |
209a4703 | 77 | return "PhosDigitMaker"; |
78 | } | |
79 | ||
209a4703 | 80 | |
af6a2273 | 81 | void |
209a4703 | 82 | AliHLTPHOSDigitMakerComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list) |
83 | { | |
2374af72 | 84 | //see header file for documentation |
94594220 | 85 | list.clear(); |
86 | list.push_back(AliHLTPHOSDefinitions::fgkChannelDataType); | |
87 | ||
88 | // const AliHLTComponentDataType* pType=fgkInputDataTypes; | |
89 | // while (pType->fID!=0) { | |
90 | // list.push_back(*pType); | |
91 | // pType++; | |
92 | // } | |
209a4703 | 93 | } |
94 | ||
95 | AliHLTComponentDataType | |
96 | AliHLTPHOSDigitMakerComponent::GetOutputDataType() | |
97 | { | |
2374af72 | 98 | //see header file for documentation |
25b7f84c | 99 | return AliHLTPHOSDefinitions::fgkDigitDataType; |
209a4703 | 100 | } |
101 | ||
102 | ||
103 | void | |
104 | AliHLTPHOSDigitMakerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) | |
105 | { | |
2374af72 | 106 | //see header file for documentation |
9bf87c6f | 107 | constBase = sizeof(AliHLTPHOSDigitContainerDataStruct); |
108 | inputMultiplier = 1; | |
209a4703 | 109 | } |
110 | ||
111 | int | |
112 | AliHLTPHOSDigitMakerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, | |
113 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, | |
114 | std::vector<AliHLTComponentBlockData>& outputBlocks) | |
115 | { | |
2374af72 | 116 | //see header file for documentation |
209a4703 | 117 | UInt_t tSize = 0; |
118 | UInt_t offset = 0; | |
119 | UInt_t mysize = 0; | |
209a4703 | 120 | Int_t digitCount = 0; |
209a4703 | 121 | |
122 | AliHLTUInt8_t* outBPtr; | |
123 | outBPtr = outputPtr; | |
124 | const AliHLTComponentBlockData* iter = 0; | |
125 | unsigned long ndx; | |
d949e02e | 126 | |
127 | UInt_t specification = 0; | |
94594220 | 128 | AliHLTPHOSChannelDataHeaderStruct* tmpChannelData = 0; |
d949e02e | 129 | |
94594220 | 130 | fDigitMakerPtr->SetDigitContainerStruct(reinterpret_cast<AliHLTPHOSDigitContainerDataStruct*>(outputPtr)); |
209a4703 | 131 | |
132 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
133 | { | |
134 | iter = blocks+ndx; | |
135 | ||
94594220 | 136 | if(iter->fDataType != AliHLTPHOSDefinitions::fgkChannelDataType) |
209a4703 | 137 | { |
94594220 | 138 | HLTDebug("Data block is not of type fgkChannelDataType"); |
209a4703 | 139 | continue; |
209a4703 | 140 | } |
94594220 | 141 | if(iter == 0) continue; |
142 | if((reinterpret_cast<AliHLTPHOSChannelDataHeaderStruct*>(iter->fPtr))->fNChannels == 0) continue; | |
d949e02e | 143 | specification = specification|iter->fSpecification; |
94594220 | 144 | tmpChannelData = reinterpret_cast<AliHLTPHOSChannelDataHeaderStruct*>(iter->fPtr); |
145 | ||
146 | digitCount += fDigitMakerPtr->MakeDigits(tmpChannelData); | |
209a4703 | 147 | } |
209a4703 | 148 | |
94594220 | 149 | // mysize = 0; |
150 | //offset = tSize; | |
209a4703 | 151 | |
152 | mysize += sizeof(AliHLTPHOSDigitContainerDataStruct); | |
94594220 | 153 | (reinterpret_cast<AliHLTPHOSDigitContainerDataStruct*>(outputPtr))->fNDigits = digitCount; |
209a4703 | 154 | AliHLTComponentBlockData bd; |
155 | FillBlockData( bd ); | |
156 | bd.fOffset = offset; | |
157 | bd.fSize = mysize; | |
25b7f84c | 158 | bd.fDataType = AliHLTPHOSDefinitions::fgkDigitDataType; |
d949e02e | 159 | bd.fSpecification = specification; |
94594220 | 160 | outputBlocks.push_back(bd); |
209a4703 | 161 | |
94594220 | 162 | // tSize += mysize; |
163 | // outputPtr += mysize; | |
8efbf5fe | 164 | |
209a4703 | 165 | if( tSize > size ) |
166 | { | |
8efbf5fe | 167 | Logging( kHLTLogFatal, "HLT::AliHLTPHOSDigitMakerComponent::DoEvent", "Too much data", "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", tSize, size ); |
209a4703 | 168 | return EMSGSIZE; |
169 | } | |
14ff16ed | 170 | |
94594220 | 171 | fDigitMakerPtr->Reset(); |
9bf87c6f | 172 | |
173 | size = mysize; | |
174 | ||
209a4703 | 175 | return 0; |
176 | } | |
177 | ||
178 | ||
179 | int | |
180 | AliHLTPHOSDigitMakerComponent::DoInit(int argc, const char** argv ) | |
181 | { | |
2374af72 | 182 | //see header file for documentation |
209a4703 | 183 | |
184 | fDigitMakerPtr = new AliHLTPHOSDigitMaker(); | |
185 | ||
186 | for(int i = 0; i < argc; i++) | |
187 | { | |
d949e02e | 188 | if(!strcmp("-rmsfilepath", argv[i])) |
189 | { | |
190 | fDigitMakerPtr->SetDigitThresholds(argv[i+1], 3); | |
191 | } | |
192 | if(!strcmp("-lowgainfactor", argv[i])) | |
193 | { | |
194 | fDigitMakerPtr->SetGlobalLowGainFactor(atof(argv[i+1])); | |
d949e02e | 195 | } |
196 | if(!strcmp("-highgainfactor", argv[i])) | |
197 | { | |
198 | fDigitMakerPtr->SetGlobalHighGainFactor(atof(argv[i+1])); | |
d949e02e | 199 | } |
94594220 | 200 | if(!strcmp("-digitthresholds", argv[i])) |
201 | { | |
202 | fDigitMakerPtr->SetDigitThresholds(atof(argv[i+1]), atof(argv[i+2])); | |
203 | } | |
209a4703 | 204 | } |
205 | ||
206 | //fDigitMakerPtr->SetDigitThreshold(2); | |
207 | ||
208 | return 0; | |
209 | } | |
210 | ||
211 | AliHLTComponent* | |
212 | AliHLTPHOSDigitMakerComponent::Spawn() | |
213 | { | |
2374af72 | 214 | //see header file for documentation |
209a4703 | 215 | return new AliHLTPHOSDigitMakerComponent(); |
216 | } |