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 "AliHLTPHOSRcuDAComponent.h"
22 #include "AliHLTPHOSDefinitions.h"
23 #include "AliHLTPHOSConstants.h"
24 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
25 #include "TObjArray.h"
29 /** @file AliHLTPHOSRcuDAComponent.cxx
30 @author Oystein Djuvsland
32 @brief A module calibration component for PHOS HLT, using the PHOS DA's
35 // see header file for class documentation
37 // refer to README to build package
39 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
41 using namespace PhosHLTConst;
43 AliHLTPHOSRcuDAComponent gAliHLTPHOSRcuDAComponent;
45 AliHLTPHOSRcuDAComponent::AliHLTPHOSRcuDAComponent() : AliHLTPHOSRcuProperties(),
46 AliHLTCalibrationProcessor(),
52 fShmPtr = new AliHLTPHOSSharedMemoryInterface();
57 AliHLTPHOSRcuDAComponent::~AliHLTPHOSRcuDAComponent()
72 void AliHLTPHOSRcuDAComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
75 list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType);
79 AliHLTComponentDataType AliHLTPHOSRcuDAComponent::GetOutputDataType()
81 return AliHLTPHOSDefinitions::fgkEmcCalibDataType;
85 void AliHLTPHOSRcuDAComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
93 AliHLTPHOSRcuDAComponent::Spawn()
95 return new AliHLTPHOSRcuDAComponent();
99 AliHLTPHOSRcuDAComponent::GetComponentID()
101 return "PhosRcuDAProcessor";
106 AliHLTPHOSRcuDAComponent::ScanArgument( Int_t argc, const char** argv)
108 ScanArguments(argc, argv);
113 Int_t AliHLTPHOSRcuDAComponent::InitCalibration()
119 Int_t AliHLTPHOSRcuDAComponent::DeinitCalibration()
121 AliHLTComponentEventData dummyEvtData;
122 AliHLTComponentTriggerData dummyTrgData;
123 ShipDataToFXS(dummyEvtData, dummyTrgData);
141 Int_t AliHLTPHOSRcuDAComponent::ProcessCalibration(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
144 const AliHLTComponentEventData eDta = evtData;
145 AliHLTComponentTriggerData tDta = trigData;
147 UInt_t specification = 0;
148 const AliHLTComponentBlockData* iter = 0;
149 iter = GetFirstInputBlock( AliHLTPHOSDefinitions::fgkCellEnergyDataType | kAliHLTDataOriginPHOS);
151 AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0;
152 AliHLTPHOSValidCellDataStruct *currentChannel =0;
157 Float_t energyArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
158 Float_t timeArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
159 ResetArrays(energyArray, timeArray);
163 specification = specification|iter->fSpecification;
164 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
165 module = cellDataPtr->fModuleID;
166 xOffset = cellDataPtr->fRcuX*NXCOLUMNSRCU;
167 zOffset = cellDataPtr->fRcuZ*NZROWSRCU;
169 while(currentChannel != 0)
171 Int_t tmpZ = currentChannel->fZ;
172 Int_t tmpX = currentChannel->fX;
173 Int_t tmpGain = currentChannel->fGain;
175 energyArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fEnergy;
176 timeArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fTime;
179 // for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
181 // for(Int_t z = 0; z < NZROWSRCU; z++)
183 // for(Int_t gain = 0; gain < NGAINS; gain++)
185 // energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy;
186 // timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime;
190 iter = GetNextInputBlock();
193 fPHOSDAPtr->FillHistograms(energyArray, timeArray);
195 ResetArrays(energyArray, timeArray);
202 AliHLTPHOSRcuDAComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ )
204 Char_t filename[200];
206 for(int i=0; i < 200; i++)
210 const TObjArray *calibPtr = fPHOSDAPtr->GetHistoContainer();
211 sprintf(filename, "/home/perthi/hlt/rundir/test/outdata/%s.root", fPHOSDAPtr->GetName() );
212 TFile *outFile = new TFile(filename, "recreate");
215 PushToFXS( (TObject*)fPHOSDAPtr->GetHistoContainer(), "PHOS", filename);
216 cout << "Finnished pushing data to HLT FXS" << endl;
222 AliHLTPHOSRcuDAComponent::ResetArrays(Float_t e[NXCOLUMNSMOD][NZROWSMOD][NGAINS], Float_t t[NXCOLUMNSMOD][NZROWSMOD][NGAINS])
224 for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
226 for(Int_t z = 0; z < NZROWSRCU; z++)
228 for(Int_t gain = 0; gain < NGAINS; gain++)