1 /**************************************************************************
2 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
4 * Authors: Boris Polichtchouk & Per Thomas Hille for the ALICE *
5 * offline/HLT Project. Contributors are mentioned in the code where *
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 **************************************************************************/
18 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
19 #include "AliHLTPHOSRcuHistogramProducer.h"
20 #include "AliHLTPHOSRcuHistogramProducerComponent.h"
21 #include "AliHLTPHOSRcuCellAccumulatedEnergyDataStruct.h"
24 //const AliHLTComponentDataType AliHLTPHOSRcuHistogramProducerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
25 //const AliHLTComponentDataType AliHLTPHOSRcuHistogramProducerComponent::fgkOutputDataType=kAliHLTVoidDataType;
27 AliHLTPHOSRcuHistogramProducerComponent gAliHLTPHOSRcuHistogramProducerComponent;
31 /*************************************************************************
32 * Class AliHLTPHOSRcuHistogramProducerComponent accumulating histograms *
33 * with amplitudes per PHOS channel *
34 * It is intended to run at the HLT farm *
35 * and it fills the histograms with amplitudes per channel. *
36 * Usage example see in PHOS/macros/Shuttle/AliPHOSCalibHistoProducer.C *
37 **************************************************************************/
38 AliHLTPHOSRcuHistogramProducerComponent:: AliHLTPHOSRcuHistogramProducerComponent():AliHLTPHOSProcessor(), fRcuHistoProducerPtr(0)
44 AliHLTPHOSRcuHistogramProducerComponent::~ AliHLTPHOSRcuHistogramProducerComponent()
50 AliHLTPHOSRcuHistogramProducerComponent::AliHLTPHOSRcuHistogramProducerComponent(const AliHLTPHOSRcuHistogramProducerComponent & ) : AliHLTPHOSProcessor(), fRcuHistoProducerPtr(0)
57 AliHLTPHOSRcuHistogramProducerComponent::Deinit()
59 //See html documentation of base class
60 cout << "AliHLTPHOSRcuHistogramProducerComponent::Deinit()" << endl;
61 fRcuHistoProducerPtr->WriteEnergyHistograms();
67 AliHLTPHOSRcuHistogramProducerComponent::GetComponentID()
69 //See html documentation of base class
70 return "RcuHistogramProducer";
75 AliHLTPHOSRcuHistogramProducerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
77 //See html documentation of base class
78 const AliHLTComponentDataType* pType=fgkInputDataTypes;
81 list.push_back(*pType);
87 AliHLTComponentDataType
88 AliHLTPHOSRcuHistogramProducerComponent::GetOutputDataType()
90 //See html documentation of base class
91 return AliHLTPHOSDefinitions::fgkCellEnergyDataType;
96 AliHLTPHOSRcuHistogramProducerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
98 //See html documentation of base class
104 int AliHLTPHOSRcuHistogramProducerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
105 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
106 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
108 //See html documentation of base class
109 unsigned long ndx = 0;
113 const AliHLTComponentBlockData* iter = NULL;
114 AliHLTPHOSRcuCellEnergyDataStruct *cellDataPtr;
115 AliHLTUInt8_t* outBPtr;
118 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
121 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
122 tmpCnt = cellDataPtr->fCnt;
124 for(int i= 0; i <= tmpCnt; i ++)
126 fRcuHistoProducerPtr->FillEnergy(cellDataPtr->fValidData[i].fX,
127 cellDataPtr->fValidData[i].fZ,
128 cellDataPtr->fValidData[i].fGain,
129 cellDataPtr->fValidData[i].fEnergy);
134 fOutPtr = (AliHLTPHOSRcuCellAccumulatedEnergyDataStruct*)outBPtr;
135 const AliHLTPHOSRcuCellAccumulatedEnergyDataStruct &innPtr = fRcuHistoProducerPtr->GetCellAccumulatedEnergies();
137 fOutPtr->fModuleID = fModuleID;
138 fOutPtr->fRcuX = fRcuX;
139 fOutPtr->fRcuZ = fRcuZ;
142 for(int x=0; x < N_XCOLUMNS_RCU; x ++)
144 for(int z=0; z < N_XCOLUMNS_RCU; z ++)
146 for(int gain =0; gain < N_GAINS; gain ++)
148 fOutPtr->fAccumulatedEnergies[x][z][gain] = innPtr.fAccumulatedEnergies[x][z][gain];
149 fOutPtr->fHits[x][z][gain] = innPtr.fHits[x][z][gain];
155 //pushing data to shared output memory
156 mysize += sizeof(AliHLTPHOSRcuCellAccumulatedEnergyDataStruct);
157 AliHLTComponentBlockData bd;
161 bd.fDataType = AliHLTPHOSDefinitions::fgkCellAccumulatedEnergyDataType;
162 bd.fSpecification = 0xFFFFFFFF;
163 outputBlocks.push_back( bd );
169 Logging( kHLTLogFatal, "HLT::AliHLTRcuHistogramProducerComponent::DoEvent", "Too much data",
170 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."
182 AliHLTPHOSRcuHistogramProducerComponent::DoInit( int argc, const char** argv )
184 //See html documentation of base class
188 iResult = ScanArguments(argc, argv);
190 if(fIsSetEquippmentID == kFALSE)
192 Logging( kHLTLogFatal, "HLT::AliHLTPHOSRcuHistogramProducerComponent::DoInt( int argc, const char** argv )", "Missing argument",
193 "The argument equippmentID is not set: set it with a component argumet like this: -equippmentID <number>");
196 fRcuHistoProducerPtr = new AliHLTPHOSRcuHistogramProducer( fModuleID, fRcuX, fRcuZ);
204 AliHLTPHOSRcuHistogramProducerComponent::Spawn()
206 //See html documentation of base class
207 return new AliHLTPHOSRcuHistogramProducerComponent;