]>
Commit | Line | Data |
---|---|---|
792f66f1 | 1 | /************************************************************************** |
2 | * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Authors: Boris Polichtchouk & Per Thomas Hille for the ALICE * | |
5 | * offline/HLT Project. Contributors are mentioned in the code where * | |
6 | * 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 <iostream> | |
792f66f1 | 18 | #include "AliHLTPHOSRcuCellEnergyDataStruct.h" |
792f66f1 | 19 | #include "AliHLTPHOSRcuHistogramProducer.h" |
20 | #include "AliHLTPHOSRcuHistogramProducerComponent.h" | |
1b486665 | 21 | #include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h" |
792f66f1 | 22 | |
23 | ||
792f66f1 | 24 | AliHLTPHOSRcuHistogramProducerComponent gAliHLTPHOSRcuHistogramProducerComponent; |
25 | ||
1b486665 | 26 | |
27 | ||
792f66f1 | 28 | /************************************************************************* |
29 | * Class AliHLTPHOSRcuHistogramProducerComponent accumulating histograms * | |
30 | * with amplitudes per PHOS channel * | |
31 | * It is intended to run at the HLT farm * | |
32 | * and it fills the histograms with amplitudes per channel. * | |
33 | * Usage example see in PHOS/macros/Shuttle/AliPHOSCalibHistoProducer.C * | |
34 | **************************************************************************/ | |
b60bd496 | 35 | AliHLTPHOSRcuHistogramProducerComponent:: AliHLTPHOSRcuHistogramProducerComponent():AliHLTPHOSRcuProcessor(), fRcuHistoProducerPtr(0) |
792f66f1 | 36 | { |
1b486665 | 37 | //Default constructor |
792f66f1 | 38 | } |
39 | ||
40 | ||
792f66f1 | 41 | AliHLTPHOSRcuHistogramProducerComponent::~ AliHLTPHOSRcuHistogramProducerComponent() |
42 | { | |
1b486665 | 43 | //Destructor |
792f66f1 | 44 | } |
45 | ||
46 | ||
b60bd496 | 47 | /* |
48 | AliHLTPHOSRcuHistogramProducerComponent::AliHLTPHOSRcuHistogramProducerComponent(const AliHLTPHOSRcuHistogramProducerComponent & ) : AliHLTPHOSRcuProcessor(), fRcuHistoProducerPtr(0) | |
792f66f1 | 49 | { |
50 | ||
51 | } | |
b60bd496 | 52 | */ |
792f66f1 | 53 | |
54 | int | |
55 | AliHLTPHOSRcuHistogramProducerComponent::Deinit() | |
56 | { | |
1b486665 | 57 | //See html documentation of base class |
792f66f1 | 58 | cout << "AliHLTPHOSRcuHistogramProducerComponent::Deinit()" << endl; |
59 | fRcuHistoProducerPtr->WriteEnergyHistograms(); | |
60 | return 0; | |
61 | } | |
62 | ||
63 | ||
792f66f1 | 64 | const char* |
65 | AliHLTPHOSRcuHistogramProducerComponent::GetComponentID() | |
66 | { | |
1b486665 | 67 | //See html documentation of base class |
792f66f1 | 68 | return "RcuHistogramProducer"; |
69 | } | |
70 | ||
71 | ||
72 | void | |
1b486665 | 73 | AliHLTPHOSRcuHistogramProducerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
792f66f1 | 74 | { |
1b486665 | 75 | //See html documentation of base class |
76 | const AliHLTComponentDataType* pType=fgkInputDataTypes; | |
792f66f1 | 77 | while (pType->fID!=0) |
78 | { | |
79 | list.push_back(*pType); | |
80 | pType++; | |
81 | } | |
82 | } | |
83 | ||
84 | ||
85 | AliHLTComponentDataType | |
86 | AliHLTPHOSRcuHistogramProducerComponent::GetOutputDataType() | |
87 | { | |
1b486665 | 88 | //See html documentation of base class |
d504c864 | 89 | return AliHLTPHOSDefinitions::fgkCellEnergyDataType; |
792f66f1 | 90 | } |
91 | ||
92 | ||
93 | void | |
94 | AliHLTPHOSRcuHistogramProducerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) | |
95 | { | |
1b486665 | 96 | //See html documentation of base class |
792f66f1 | 97 | constBase = 30; |
98 | inputMultiplier = 1; | |
99 | } | |
100 | ||
101 | ||
102 | int AliHLTPHOSRcuHistogramProducerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, | |
103 | AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, | |
104 | AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks ) | |
105 | { | |
1b486665 | 106 | //See html documentation of base class |
792f66f1 | 107 | unsigned long ndx = 0; |
108 | UInt_t offset = 0; | |
109 | UInt_t mysize = 0; | |
110 | UInt_t tSize = 0; | |
111 | const AliHLTComponentBlockData* iter = NULL; | |
112 | AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr; | |
113 | AliHLTUInt8_t* outBPtr; | |
792f66f1 | 114 | int tmpCnt; |
115 | ||
116 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
117 | { | |
118 | iter = blocks+ndx; | |
119 | cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr); | |
120 | tmpCnt = cellDataPtr->fCnt; | |
121 | ||
122 | for(int i= 0; i <= tmpCnt; i ++) | |
123 | { | |
124 | fRcuHistoProducerPtr->FillEnergy(cellDataPtr->fValidData[i].fX, | |
125 | cellDataPtr->fValidData[i].fZ, | |
126 | cellDataPtr->fValidData[i].fGain, | |
127 | cellDataPtr->fValidData[i].fEnergy); | |
128 | } | |
129 | } | |
130 | ||
131 | outBPtr = outputPtr; | |
132 | fOutPtr = (AliHLTPHOSRcuCellAccumulatedEnergyDataStruct*)outBPtr; | |
133 | const AliHLTPHOSRcuCellAccumulatedEnergyDataStruct &innPtr = fRcuHistoProducerPtr->GetCellAccumulatedEnergies(); | |
134 | ||
135 | fOutPtr->fModuleID = fModuleID; | |
136 | fOutPtr->fRcuX = fRcuX; | |
137 | fOutPtr->fRcuZ = fRcuZ; | |
138 | ||
139 | ||
140 | for(int x=0; x < N_XCOLUMNS_RCU; x ++) | |
141 | { | |
142 | for(int z=0; z < N_XCOLUMNS_RCU; z ++) | |
143 | { | |
144 | for(int gain =0; gain < N_GAINS; gain ++) | |
145 | { | |
146 | fOutPtr->fAccumulatedEnergies[x][z][gain] = innPtr.fAccumulatedEnergies[x][z][gain]; | |
147 | fOutPtr->fHits[x][z][gain] = innPtr.fHits[x][z][gain]; | |
148 | } | |
149 | } | |
150 | } | |
151 | ||
152 | ||
153 | //pushing data to shared output memory | |
154 | mysize += sizeof(AliHLTPHOSRcuCellAccumulatedEnergyDataStruct); | |
155 | AliHLTComponentBlockData bd; | |
156 | FillBlockData( bd ); | |
157 | bd.fOffset = offset; | |
158 | bd.fSize = mysize; | |
d504c864 | 159 | bd.fDataType = AliHLTPHOSDefinitions::fgkCellAccumulatedEnergyDataType; |
792f66f1 | 160 | bd.fSpecification = 0xFFFFFFFF; |
161 | outputBlocks.push_back( bd ); | |
162 | tSize += mysize; | |
163 | outBPtr += mysize; | |
164 | ||
165 | if( tSize > size ) | |
166 | { | |
167 | Logging( kHLTLogFatal, "HLT::AliHLTRcuHistogramProducerComponent::DoEvent", "Too much data", | |
168 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu." | |
169 | , tSize, size ); | |
170 | return EMSGSIZE; | |
171 | } | |
172 | ||
1b486665 | 173 | fPhosEventCount++; |
792f66f1 | 174 | return 0; |
1b486665 | 175 | |
792f66f1 | 176 | }//end DoEvent |
177 | ||
178 | ||
179 | int | |
180 | AliHLTPHOSRcuHistogramProducerComponent::DoInit( int argc, const char** argv ) | |
181 | { | |
1b486665 | 182 | //See html documentation of base class |
183 | fPrintInfo = kFALSE; | |
792f66f1 | 184 | int iResult=0; |
185 | TString argument=""; | |
1b486665 | 186 | iResult = ScanArguments(argc, argv); |
792f66f1 | 187 | |
1b486665 | 188 | if(fIsSetEquippmentID == kFALSE) |
792f66f1 | 189 | { |
1b486665 | 190 | Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument", |
191 | "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID <number>"); | |
192 | iResult = -2; | |
792f66f1 | 193 | } |
1b486665 | 194 | fRcuHistoProducerPtr = new AliHLTPHOSRcuHistogramProducer( fModuleID, fRcuX, fRcuZ); |
792f66f1 | 195 | |
1b486665 | 196 | return iResult; |
792f66f1 | 197 | |
792f66f1 | 198 | } |
199 | ||
200 | ||
201 | AliHLTComponent* | |
202 | AliHLTPHOSRcuHistogramProducerComponent::Spawn() | |
203 | { | |
1b486665 | 204 | //See html documentation of base class |
792f66f1 | 205 | return new AliHLTPHOSRcuHistogramProducerComponent; |
206 | } | |
207 | ||
208 |