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"
24 // #include "AliHLTPHOSConstant.h"
25 //#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
26 #include "TObjArray.h"
27 #include "AliHLTCaloUtilities.h"
28 #include "AliHLTReadoutList.h"
32 /** @file AliHLTPHOSRcuDAComponent.cxx
33 @author Oystein Djuvsland
35 @brief A module calibration component for PHOS HLT, using the PHOS DA's
38 // see header file for class documentation
40 // refer to README to build package
42 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
44 using namespace PhosHLTConst;
46 AliHLTPHOSRcuDAComponent gAliHLTPHOSRcuDAComponent;
48 AliHLTPHOSRcuDAComponent::AliHLTPHOSRcuDAComponent() :
49 //AliHLTPHOSRcuProperties(),
50 AliHLTCalibrationProcessor(),
56 fShmPtr = new AliHLTPHOSSharedMemoryInterfacev2();
61 AliHLTPHOSRcuDAComponent::~AliHLTPHOSRcuDAComponent()
76 void AliHLTPHOSRcuDAComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
79 list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType);
83 AliHLTComponentDataType AliHLTPHOSRcuDAComponent::GetOutputDataType()
85 return AliHLTPHOSDefinitions::fgkEmcCalibDataType;
89 void AliHLTPHOSRcuDAComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
97 AliHLTPHOSRcuDAComponent::Spawn()
99 return new AliHLTPHOSRcuDAComponent();
103 AliHLTPHOSRcuDAComponent::GetComponentID()
105 return "PhosRcuDAProcessor";
110 AliHLTPHOSRcuDAComponent::ScanArgument( Int_t /*argc*/, const char** /*argv*/)
113 // AliHLTPHOSUtilities::ScanArguments(argc, argv);
120 Int_t AliHLTPHOSRcuDAComponent::InitCalibration()
126 Int_t AliHLTPHOSRcuDAComponent::DeinitCalibration()
128 AliHLTComponentEventData dummyEvtData;
129 AliHLTComponentTriggerData dummyTrgData;
130 ShipDataToFXS(dummyEvtData, dummyTrgData);
148 Int_t AliHLTPHOSRcuDAComponent::ProcessCalibration(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
152 const AliHLTComponentEventData eDta = evtData;
153 AliHLTComponentTriggerData tDta = trigData;
155 UInt_t specification = 0;
156 const AliHLTComponentBlockData* iter = 0;
157 iter = GetFirstInputBlock( AliHLTPHOSDefinitions::fgkCellEnergyDataType | kAliHLTDataOriginPHOS);
159 AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0;
160 AliHLTPHOSValidCellDataStruct *currentChannel =0;
165 Float_t energyArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
166 Float_t timeArray[NXCOLUMNSMOD][NZROWSMOD][NGAINS];
167 ResetArrays(energyArray, timeArray);
171 specification = specification|iter->fSpecification;
172 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
173 module = cellDataPtr->fModuleID;
174 xOffset = cellDataPtr->fRcuX*NXCOLUMNSRCU;
175 zOffset = cellDataPtr->fRcuZ*NZROWSRCU;
177 while(currentChannel != 0)
179 Int_t tmpZ = currentChannel->fZ;
180 Int_t tmpX = currentChannel->fX;
181 Int_t tmpGain = currentChannel->fGain;
183 energyArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fEnergy;
184 timeArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fTime;
187 // for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
189 // for(Int_t z = 0; z < NZROWSRCU; z++)
191 // for(Int_t gain = 0; gain < NGAINS; gain++)
193 // energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy;
194 // timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime;
198 iter = GetNextInputBlock();
201 fPHOSDAPtr->FillHistograms(energyArray, timeArray);
203 ResetArrays(energyArray, timeArray);
210 AliHLTPHOSRcuDAComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ )
212 Char_t filename[200];
214 for(int i=0; i < 200; i++)
218 const TObjArray *calibPtr = fPHOSDAPtr->GetHistoContainer();
219 sprintf(filename, "/home/perthi/hlt/rundir/test/outdata/%s.root", fPHOSDAPtr->GetName() );
220 TFile *outFile = new TFile(filename, "recreate");
223 static AliHLTReadoutList rdList(AliHLTReadoutList::kPHOS);
224 PushToFXS( (TObject*)fPHOSDAPtr->GetHistoContainer(), "PHOS", filename, rdList.Buffer());
225 cout << "Finnished pushing data to HLT FXS" << endl;
233 AliHLTPHOSRcuDAComponent::ResetArrays(Float_t e[NXCOLUMNSMOD][NZROWSMOD][NGAINS], Float_t t[NXCOLUMNSMOD][NZROWSMOD][NGAINS])
235 for(Int_t x = 0; x < NXCOLUMNSRCU; x++)
237 for(Int_t z = 0; z < NZROWSRCU; z++)
239 for(Int_t gain = 0; gain < NGAINS; gain++)