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