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 "AliHLTPHOSConstant.h"
24 //#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
25 #include "TObjArray.h"
26 #include "AliHLTPHOSUtilities.h"
27 #include "AliHLTReadoutList.h"
31 /** @file AliHLTPHOSRcuDAComponent.cxx
32 @author Oystein Djuvsland
34 @brief A module calibration component for PHOS HLT, using the PHOS DA's
37 // see header file for class documentation
39 // refer to README to build package
41 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
43 using namespace PhosHLTConst;
45 AliHLTPHOSRcuDAComponent gAliHLTPHOSRcuDAComponent;
47 AliHLTPHOSRcuDAComponent::AliHLTPHOSRcuDAComponent() :
48 //AliHLTPHOSRcuProperties(),
49 AliHLTCalibrationProcessor(),
55 fShmPtr = new AliHLTPHOSSharedMemoryInterfacev2();
60 AliHLTPHOSRcuDAComponent::~AliHLTPHOSRcuDAComponent()
75 void AliHLTPHOSRcuDAComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
78 list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType);
82 AliHLTComponentDataType AliHLTPHOSRcuDAComponent::GetOutputDataType()
84 return AliHLTPHOSDefinitions::fgkEmcCalibDataType;
88 void AliHLTPHOSRcuDAComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
96 AliHLTPHOSRcuDAComponent::Spawn()
98 return new AliHLTPHOSRcuDAComponent();
102 AliHLTPHOSRcuDAComponent::GetComponentID()
104 return "PhosRcuDAProcessor";
109 AliHLTPHOSRcuDAComponent::ScanArgument( Int_t /*argc*/, const char** /*argv*/)
112 // AliHLTPHOSUtilities::ScanArguments(argc, argv);
119 Int_t AliHLTPHOSRcuDAComponent::InitCalibration()
125 Int_t AliHLTPHOSRcuDAComponent::DeinitCalibration()
127 AliHLTComponentEventData dummyEvtData;
128 AliHLTComponentTriggerData dummyTrgData;
129 ShipDataToFXS(dummyEvtData, dummyTrgData);
147 Int_t AliHLTPHOSRcuDAComponent::ProcessCalibration(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
151 const AliHLTComponentEventData eDta = evtData;
152 AliHLTComponentTriggerData tDta = trigData;
154 UInt_t specification = 0;
155 const AliHLTComponentBlockData* iter = 0;
156 iter = GetFirstInputBlock( AliHLTPHOSDefinitions::fgkCellEnergyDataType | kAliHLTDataOriginPHOS);
158 AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0;
159 AliHLTPHOSValidCellDataStruct *currentChannel =0;
164 Float_t energyArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
165 Float_t timeArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
166 ResetArrays(energyArray, timeArray);
170 specification = specification|iter->fSpecification;
171 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
172 module = cellDataPtr->fModuleID;
173 xOffset = cellDataPtr->fRcuX*NXCOLUMNSRCU;
174 zOffset = cellDataPtr->fRcuZ*NZROWSRCU;
176 while(currentChannel != 0)
178 Int_t tmpZ = currentChannel->fZ;
179 Int_t tmpX = currentChannel->fX;
180 Int_t tmpGain = currentChannel->fGain;
182 energyArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fEnergy;
183 timeArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fTime;
186 // for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
188 // for(Int_t z = 0; z < NZROWSRCU; z++)
190 // for(Int_t gain = 0; gain < NGAINS; gain++)
192 // energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy;
193 // timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime;
197 iter = GetNextInputBlock();
200 fPHOSDAPtr->FillHistograms(energyArray, timeArray);
202 ResetArrays(energyArray, timeArray);
209 AliHLTPHOSRcuDAComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ )
211 Char_t filename[200];
213 for(int i=0; i < 200; i++)
217 const TObjArray *calibPtr = fPHOSDAPtr->GetHistoContainer();
218 sprintf(filename, "/home/perthi/hlt/rundir/test/outdata/%s.root", fPHOSDAPtr->GetName() );
219 TFile *outFile = new TFile(filename, "recreate");
222 static AliHLTReadoutList rdList(AliHLTReadoutList::kPHOS);
223 PushToFXS( (TObject*)fPHOSDAPtr->GetHistoContainer(), "PHOS", filename, rdList.Buffer());
224 cout << "Finnished pushing data to HLT FXS" << endl;
230 AliHLTPHOSRcuDAComponent::ResetArrays(Float_t e[NXCOLUMNSMOD][NZROWSMOD][NGAINS], Float_t t[NXCOLUMNSMOD][NZROWSMOD][NGAINS])
232 for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
234 for(Int_t z = 0; z < NZROWSRCU; z++)
236 for(Int_t gain = 0; gain < NGAINS; gain++)