1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
5 * Primary Authors: Oystein Djuvsland *
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 **************************************************************************/
17 #include "AliPHOSRcuDA1.h"
18 #include "AliHLTPHOSSharedMemoryInterface.h"
19 #include "AliHLTPHOSModuleCalibrationProcessorComponent.h"
20 #include "AliHLTPHOSDefinitions.h"
21 #include "AliHLTPHOSConstants.h"
22 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
26 /** @file AliHLTPHOSModuleCalibrationProcessorComponent.cxx
27 @author Oystein Djuvsland
29 @brief A module calibration component for PHOS HLT, using the PHOS DA's
32 // see header file for class documentation
34 // refer to README to build package
36 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
38 using namespace PhosHLTConst;
40 AliHLTPHOSModuleCalibrationProcessorComponent gAliHLTPHOSModuleCalibrationProcessorComponent;
42 AliHLTPHOSModuleCalibrationProcessorComponent::AliHLTPHOSModuleCalibrationProcessorComponent() :
43 AliHLTCalibrationProcessor(),
48 //See header file for documentation
52 AliHLTPHOSModuleCalibrationProcessorComponent::~AliHLTPHOSModuleCalibrationProcessorComponent()
54 //See header file for documentation
67 void AliHLTPHOSModuleCalibrationProcessorComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
69 //See header file for documentation
71 list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType);
75 AliHLTComponentDataType AliHLTPHOSModuleCalibrationProcessorComponent::GetOutputDataType()
77 //See header file for documentation
78 return AliHLTPHOSDefinitions::fgkEmcCalibDataType;
81 void AliHLTPHOSModuleCalibrationProcessorComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
83 //See header file for documentation
89 AliHLTPHOSModuleCalibrationProcessorComponent::Spawn()
91 //See header file for documentation
92 return new AliHLTPHOSModuleCalibrationProcessorComponent();
96 AliHLTPHOSModuleCalibrationProcessorComponent::GetComponentID()
98 //See header file for documentation
99 return "PhosModuleCalibrationProcessor";
103 AliHLTPHOSModuleCalibrationProcessorComponent::ScanArgument( Int_t /*argc*/, const char** /*argv*/)
105 //See header file for documentation
109 Int_t AliHLTPHOSModuleCalibrationProcessorComponent::InitCalibration()
111 //See header file for documentation
112 fShmPtr = new AliHLTPHOSSharedMemoryInterface();
117 Int_t AliHLTPHOSModuleCalibrationProcessorComponent::DeinitCalibration()
119 //See header file for documentation
121 cout << "Int_t AliHLTPHOSModuleCalibrationProcessorComponent::DeinitCalibration()" << endl;
122 //AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) {
124 AliHLTComponentEventData dummyEvtData;
125 AliHLTComponentTriggerData dummyTrgData;
127 ShipDataToFXS(dummyEvtData, dummyTrgData);
129 //See header file for documentation
143 Int_t AliHLTPHOSModuleCalibrationProcessorComponent::ProcessCalibration(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
150 //See header file for documentation
151 const AliHLTComponentEventData eDta = evtData;
152 AliHLTComponentTriggerData tDta = trigData;
155 AliHLTPHOSValidCellDataStruct *currentChannel =0;
157 UInt_t specification = 0;
158 const AliHLTComponentBlockData* iter = 0;
159 iter = GetFirstInputBlock( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC);
160 AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0;
165 Float_t energyArray[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS];
166 Float_t timeArray[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS];
171 specification = specification|iter->fSpecification;
173 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
175 // Only necessary until the specification gives the module number
176 module = cellDataPtr->fModuleID;
179 // fPHOSDAPtr = new AliPHOSDA1(module,0);
180 fPHOSDAPtr = new AliPHOSRcuDA1(module,0);
183 xOffset = cellDataPtr->fRcuX*N_XCOLUMNS_RCU;
184 zOffset = cellDataPtr->fRcuZ*N_ZROWS_RCU;
186 fShmPtr->SetMemory(cellDataPtr);
187 currentChannel = fShmPtr->NextChannel();
189 while(currentChannel != 0)
191 Int_t tmpZ = currentChannel->fZ;
192 Int_t tmpX = currentChannel->fX;
193 Int_t tmpGain = currentChannel->fGain;
195 energyArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fEnergy;
196 timeArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fTime;
198 // for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++)
200 // for(Int_t z = 0; z < N_ZROWS_RCU; z++)
202 // for(Int_t gain = 0; gain < N_GAINS; gain++)
204 // energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy;
205 // timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime;
209 iter = GetNextInputBlock();
214 // fPHOSDAPtr->FillHistograms(energyArray, timeArray);
217 ResetArrays(energyArray, timeArray);
219 //PushBack((TObject*) fCalibDataPtr, AliHLTPHOSDefinitions::fgkEmcCalibDataType, specification);
226 AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) {
228 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0" << endl;
232 // see header file for class documentation
234 // ** PushBack data to FXS ...
235 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.1" << endl;
236 Char_t filename[200];
238 for(int i=0; i < 200; i++)
243 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.2" << endl;
245 fPHOSDAPtr->GetModule();
247 sprintf(filename, "PHOS_Module%d_Calib_HLT.root", fPHOSDAPtr->GetModule() );
248 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.3" << endl;
249 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP1" << endl;
251 for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++)
253 for(Int_t z = 0; z < N_ZROWS_RCU; z++)
255 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP2" << endl;
256 PushToFXS( (TObject*) fPHOSDAPtr->GetHgLgRatioHistogram(x, z), "PHOS", filename);
257 for(Int_t gain = 0; gain < N_GAINS; gain++)
259 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP3" << endl;
260 PushToFXS( (TObject*) fPHOSDAPtr->GetTimeEnergyHistogram(x, z, gain), "PHOS", filename);
261 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP4" << endl;
269 AliHLTPHOSModuleCalibrationProcessorComponent::ResetArrays(Float_t e[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS], Float_t t[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS])
271 for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++)
273 for(Int_t z = 0; z < N_ZROWS_RCU; z++)
275 for(Int_t gain = 0; gain < N_GAINS; gain++)