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