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 "AliHLTPHOSSharedMemoryInterfacev2.h"
21 #include "AliHLTPHOSRcuDAComponent.h"
22 #include "AliHLTPHOSDefinitions.h"
23 #include "AliHLTPHOSConstants.h"
24 //#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
25 #include "TObjArray.h"
26 #include "AliHLTPHOSUtilities.h"
30 /** @file AliHLTPHOSRcuDAComponent.cxx
31 @author Oystein Djuvsland
33 @brief A module calibration component for PHOS HLT, using the PHOS DA's
36 // see header file for class documentation
38 // refer to README to build package
40 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
42 using namespace PhosHLTConst;
44 AliHLTPHOSRcuDAComponent gAliHLTPHOSRcuDAComponent;
46 AliHLTPHOSRcuDAComponent::AliHLTPHOSRcuDAComponent() : //AliHLTPHOSRcuProperties(),
47 AliHLTCalibrationProcessor(),
53 fShmPtr = new AliHLTPHOSSharedMemoryInterfacev2();
58 AliHLTPHOSRcuDAComponent::~AliHLTPHOSRcuDAComponent()
73 void AliHLTPHOSRcuDAComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
76 list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType);
80 AliHLTComponentDataType AliHLTPHOSRcuDAComponent::GetOutputDataType()
82 return AliHLTPHOSDefinitions::fgkEmcCalibDataType;
86 void AliHLTPHOSRcuDAComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
94 AliHLTPHOSRcuDAComponent::Spawn()
96 return new AliHLTPHOSRcuDAComponent();
100 AliHLTPHOSRcuDAComponent::GetComponentID()
102 return "PhosRcuDAProcessor";
107 AliHLTPHOSRcuDAComponent::ScanArgument( Int_t /*argc*/, const char** /*argv*/)
110 // AliHLTPHOSUtilities::ScanArguments(argc, argv);
117 Int_t AliHLTPHOSRcuDAComponent::InitCalibration()
123 Int_t AliHLTPHOSRcuDAComponent::DeinitCalibration()
125 AliHLTComponentEventData dummyEvtData;
126 AliHLTComponentTriggerData dummyTrgData;
127 ShipDataToFXS(dummyEvtData, dummyTrgData);
145 Int_t AliHLTPHOSRcuDAComponent::ProcessCalibration(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
149 const AliHLTComponentEventData eDta = evtData;
150 AliHLTComponentTriggerData tDta = trigData;
152 UInt_t specification = 0;
153 const AliHLTComponentBlockData* iter = 0;
154 iter = GetFirstInputBlock( AliHLTPHOSDefinitions::fgkCellEnergyDataType | kAliHLTDataOriginPHOS);
156 AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0;
157 AliHLTPHOSValidCellDataStruct *currentChannel =0;
162 Float_t energyArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
163 Float_t timeArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
164 ResetArrays(energyArray, timeArray);
168 specification = specification|iter->fSpecification;
169 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
170 module = cellDataPtr->fModuleID;
171 xOffset = cellDataPtr->fRcuX*NXCOLUMNSRCU;
172 zOffset = cellDataPtr->fRcuZ*NZROWSRCU;
174 while(currentChannel != 0)
176 Int_t tmpZ = currentChannel->fZ;
177 Int_t tmpX = currentChannel->fX;
178 Int_t tmpGain = currentChannel->fGain;
180 energyArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fEnergy;
181 timeArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fTime;
184 // for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
186 // for(Int_t z = 0; z < NZROWSRCU; z++)
188 // for(Int_t gain = 0; gain < NGAINS; gain++)
190 // energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy;
191 // timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime;
195 iter = GetNextInputBlock();
198 fPHOSDAPtr->FillHistograms(energyArray, timeArray);
200 ResetArrays(energyArray, timeArray);
207 AliHLTPHOSRcuDAComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ )
209 Char_t filename[200];
211 for(int i=0; i < 200; i++)
215 const TObjArray *calibPtr = fPHOSDAPtr->GetHistoContainer();
216 sprintf(filename, "/home/perthi/hlt/rundir/test/outdata/%s.root", fPHOSDAPtr->GetName() );
217 TFile *outFile = new TFile(filename, "recreate");
220 PushToFXS( (TObject*)fPHOSDAPtr->GetHistoContainer(), "PHOS", filename);
221 cout << "Finnished pushing data to HLT FXS" << endl;
227 AliHLTPHOSRcuDAComponent::ResetArrays(Float_t e[NXCOLUMNSMOD][NZROWSMOD][NGAINS], Float_t t[NXCOLUMNSMOD][NZROWSMOD][NGAINS])
229 for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
231 for(Int_t z = 0; z < NZROWSRCU; z++)
233 for(Int_t gain = 0; gain < NGAINS; gain++)