3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * All rights reserved. *
7 * Primary Authors: Oystein Djuvsland *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
19 #include "AliPHOSRcuDA1.h"
20 #include "AliHLTPHOSSharedMemoryInterface.h"
21 #include "AliHLTPHOSModuleCalibrationProcessorComponent.h"
22 #include "AliHLTPHOSDefinitions.h"
23 #include "AliHLTPHOSConstants.h"
24 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
28 /** @file AliHLTPHOSModuleCalibrationProcessorComponent.cxx
29 @author Oystein Djuvsland
31 @brief A module calibration component for PHOS HLT, using the PHOS DA's
34 // see header file for class documentation
36 // refer to README to build package
38 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
40 using namespace PhosHLTConst;
42 AliHLTPHOSModuleCalibrationProcessorComponent gAliHLTPHOSModuleCalibrationProcessorComponent;
44 AliHLTPHOSModuleCalibrationProcessorComponent::AliHLTPHOSModuleCalibrationProcessorComponent() :
45 AliHLTCalibrationProcessor(),
50 //See header file for documentation
54 AliHLTPHOSModuleCalibrationProcessorComponent::~AliHLTPHOSModuleCalibrationProcessorComponent()
56 //See header file for documentation
69 void AliHLTPHOSModuleCalibrationProcessorComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
71 //See header file for documentation
73 list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType);
77 AliHLTComponentDataType AliHLTPHOSModuleCalibrationProcessorComponent::GetOutputDataType()
79 //See header file for documentation
80 return AliHLTPHOSDefinitions::fgkEmcCalibDataType;
83 void AliHLTPHOSModuleCalibrationProcessorComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
85 //See header file for documentation
91 AliHLTPHOSModuleCalibrationProcessorComponent::Spawn()
93 //See header file for documentation
94 return new AliHLTPHOSModuleCalibrationProcessorComponent();
98 AliHLTPHOSModuleCalibrationProcessorComponent::GetComponentID()
100 //See header file for documentation
101 return "PhosModuleCalibrationProcessor";
105 AliHLTPHOSModuleCalibrationProcessorComponent::ScanArgument( Int_t /*argc*/, const char** /*argv*/)
107 //See header file for documentation
111 Int_t AliHLTPHOSModuleCalibrationProcessorComponent::InitCalibration()
113 //See header file for documentation
114 fShmPtr = new AliHLTPHOSSharedMemoryInterface();
119 Int_t AliHLTPHOSModuleCalibrationProcessorComponent::DeinitCalibration()
121 //See header file for documentation
123 cout << "Int_t AliHLTPHOSModuleCalibrationProcessorComponent::DeinitCalibration()" << endl;
124 //AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) {
126 AliHLTComponentEventData dummyEvtData;
127 AliHLTComponentTriggerData dummyTrgData;
129 ShipDataToFXS(dummyEvtData, dummyTrgData);
131 //See header file for documentation
145 Int_t AliHLTPHOSModuleCalibrationProcessorComponent::ProcessCalibration(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
152 //See header file for documentation
153 const AliHLTComponentEventData eDta = evtData;
154 AliHLTComponentTriggerData tDta = trigData;
157 AliHLTPHOSValidCellDataStruct *currentChannel =0;
159 UInt_t specification = 0;
160 const AliHLTComponentBlockData* iter = 0;
161 iter = GetFirstInputBlock( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC);
162 AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0;
167 Float_t energyArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
168 Float_t timeArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
173 specification = specification|iter->fSpecification;
175 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
177 // Only necessary until the specification gives the module number
178 module = cellDataPtr->fModuleID;
181 // fPHOSDAPtr = new AliPHOSDA1(module,0);
182 fPHOSDAPtr = new AliPHOSRcuDA1(module,0);
185 xOffset = cellDataPtr->fRcuX*NXCOLUMNSRCU;
186 zOffset = cellDataPtr->fRcuZ*NZROWSRCU;
188 fShmPtr->SetMemory(cellDataPtr);
189 currentChannel = fShmPtr->NextChannel();
191 while(currentChannel != 0)
193 Int_t tmpZ = currentChannel->fZ;
194 Int_t tmpX = currentChannel->fX;
195 Int_t tmpGain = currentChannel->fGain;
197 energyArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fEnergy;
198 timeArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fTime;
200 // for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
202 // for(Int_t z = 0; z < NZROWSRCU; z++)
204 // for(Int_t gain = 0; gain < NGAINS; gain++)
206 // energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy;
207 // timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime;
211 iter = GetNextInputBlock();
216 // fPHOSDAPtr->FillHistograms(energyArray, timeArray);
219 ResetArrays(energyArray, timeArray);
221 //PushBack((TObject*) fCalibDataPtr, AliHLTPHOSDefinitions::fgkEmcCalibDataType, specification);
228 AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) {
230 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0" << endl;
234 // see header file for class documentation
236 // ** PushBack data to FXS ...
237 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.1" << endl;
238 Char_t filename[200];
240 for(int i=0; i < 200; i++)
245 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.2" << endl;
247 fPHOSDAPtr->GetModule();
249 sprintf(filename, "PHOS_Module%d_Calib_HLT.root", fPHOSDAPtr->GetModule() );
250 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP0.3" << endl;
251 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP1" << endl;
253 for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
255 for(Int_t z = 0; z < NZROWSRCU; z++)
257 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP2" << endl;
258 PushToFXS( (TObject*) fPHOSDAPtr->GetHgLgRatioHistogram(x, z), "PHOS", filename);
259 for(Int_t gain = 0; gain < NGAINS; gain++)
261 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP3" << endl;
262 PushToFXS( (TObject*) fPHOSDAPtr->GetTimeEnergyHistogram(x, z, gain), "PHOS", filename);
263 cout << "AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS TP4" << endl;
271 AliHLTPHOSModuleCalibrationProcessorComponent::ResetArrays(Float_t e[NXCOLUMNSMOD][NZROWSMOD][NGAINS], Float_t t[NXCOLUMNSMOD][NZROWSMOD][NGAINS])
273 for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
275 for(Int_t z = 0; z < NZROWSRCU; z++)
277 for(Int_t gain = 0; gain < NGAINS; gain++)