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()
115 //CRAP PT just to get something working by 5 May 2008
116 const int tmpModule = 2;
117 fPHOSDAPtr = new AliPHOSRcuDA1(tmpModule ,GetRCUID());
122 Int_t AliHLTPHOSRcuDAComponent::DeinitCalibration()
124 AliHLTComponentEventData dummyEvtData;
125 AliHLTComponentTriggerData dummyTrgData;
126 ShipDataToFXS(dummyEvtData, dummyTrgData);
144 Int_t AliHLTPHOSRcuDAComponent::ProcessCalibration(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
147 const AliHLTComponentEventData eDta = evtData;
148 AliHLTComponentTriggerData tDta = trigData;
150 UInt_t specification = 0;
151 const AliHLTComponentBlockData* iter = 0;
152 iter = GetFirstInputBlock( AliHLTPHOSDefinitions::fgkCellEnergyDataType | kAliHLTDataOriginPHOS);
154 AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0;
155 AliHLTPHOSValidCellDataStruct *currentChannel =0;
160 Float_t energyArray[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS];
161 Float_t timeArray[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS];
162 ResetArrays(energyArray, timeArray);
166 specification = specification|iter->fSpecification;
167 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
168 module = cellDataPtr->fModuleID;
169 xOffset = cellDataPtr->fRcuX*N_XCOLUMNS_RCU;
170 zOffset = cellDataPtr->fRcuZ*N_ZROWS_RCU;
172 while(currentChannel != 0)
174 Int_t tmpZ = currentChannel->fZ;
175 Int_t tmpX = currentChannel->fX;
176 Int_t tmpGain = currentChannel->fGain;
178 energyArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fEnergy;
179 timeArray[tmpX+xOffset][tmpZ+zOffset][tmpGain] = currentChannel->fTime;
182 // for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++)
184 // for(Int_t z = 0; z < N_ZROWS_RCU; z++)
186 // for(Int_t gain = 0; gain < N_GAINS; gain++)
188 // energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy;
189 // timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime;
193 iter = GetNextInputBlock();
196 fPHOSDAPtr->FillHistograms(energyArray, timeArray);
198 ResetArrays(energyArray, timeArray);
205 AliHLTPHOSRcuDAComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ )
207 Char_t filename[200];
209 for(int i=0; i < 200; i++)
213 const TObjArray *calibPtr = fPHOSDAPtr->GetHistoContainer();
214 sprintf(filename, "/home/perthi/hlt/rundir/test/outdata/%s.root", fPHOSDAPtr->GetName() );
215 TFile *outFile = new TFile(filename, "recreate");
218 PushToFXS( (TObject*)fPHOSDAPtr->GetHistoContainer(), "PHOS", filename);
219 cout << "Finnished pushing data to HLT FXS" << endl;
225 AliHLTPHOSRcuDAComponent::ResetArrays(Float_t e[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS], Float_t t[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS])
227 for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++)
229 for(Int_t z = 0; z < N_ZROWS_RCU; z++)
231 for(Int_t gain = 0; gain < N_GAINS; gain++)