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 //AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) {
125 AliHLTComponentEventData dummyEvtData;
126 AliHLTComponentTriggerData dummyTrgData;
128 ShipDataToFXS(dummyEvtData, dummyTrgData);
130 //See header file for documentation
144 Int_t AliHLTPHOSModuleCalibrationProcessorComponent::ProcessCalibration(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
151 //See header file for documentation
152 const AliHLTComponentEventData eDta = evtData;
153 AliHLTComponentTriggerData tDta = trigData;
156 AliHLTPHOSValidCellDataStruct *currentChannel =0;
158 UInt_t specification = 0;
159 const AliHLTComponentBlockData* iter = 0;
160 iter = GetFirstInputBlock( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC);
161 AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0;
166 Float_t energyArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
167 Float_t timeArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
172 specification = specification|iter->fSpecification;
174 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
176 // Only necessary until the specification gives the module number
177 module = cellDataPtr->fModuleID;
180 // fPHOSDAPtr = new AliPHOSDA1(module,0);
181 fPHOSDAPtr = new AliPHOSRcuDA1(module,0);
184 xOffset = cellDataPtr->fRcuX*NXCOLUMNSRCU;
185 zOffset = cellDataPtr->fRcuZ*NZROWSRCU;
187 fShmPtr->SetMemory(cellDataPtr);
188 currentChannel = fShmPtr->NextChannel();
190 while(currentChannel != 0)
192 Int_t tmpZ = currentChannel->fZ;
193 Int_t tmpX = currentChannel->fX;
194 Int_t tmpGain = currentChannel->fGain;
196 energyArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fEnergy;
197 timeArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fTime;
199 // for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
201 // for(Int_t z = 0; z < NZROWSRCU; z++)
203 // for(Int_t gain = 0; gain < NGAINS; gain++)
205 // energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy;
206 // timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime;
210 iter = GetNextInputBlock();
215 // fPHOSDAPtr->FillHistograms(energyArray, timeArray);
218 ResetArrays(energyArray, timeArray);
220 //PushBack((TObject*) fCalibDataPtr, AliHLTPHOSDefinitions::fgkEmcCalibDataType, specification);
227 AliHLTPHOSModuleCalibrationProcessorComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ )
234 // see header file for class documentation
236 // ** PushBack data to FXS ...
237 Char_t filename[200];
239 for(int i=0; i < 200; i++)
244 fPHOSDAPtr->GetModule();
246 sprintf(filename, "PHOS_Module%d_Calib_HLT.root", fPHOSDAPtr->GetModule() );
248 for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
250 for(Int_t z = 0; z < NZROWSRCU; z++)
252 PushToFXS( (TObject*) fPHOSDAPtr->GetHgLgRatioHistogram(x, z), "PHOS", filename);
253 for(Int_t gain = 0; gain < NGAINS; gain++)
255 PushToFXS( (TObject*) fPHOSDAPtr->GetTimeEnergyHistogram(x, z, gain), "PHOS", filename);
263 AliHLTPHOSModuleCalibrationProcessorComponent::ResetArrays(Float_t e[NXCOLUMNSMOD][NZROWSMOD][NGAINS], Float_t t[NXCOLUMNSMOD][NZROWSMOD][NGAINS])
265 for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
267 for(Int_t z = 0; z < NZROWSRCU; z++)
269 for(Int_t gain = 0; gain < NGAINS; gain++)