1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
5 * Primary Authors: Oystein Djuvsland *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 #include "AliPHOSRcuDA1.h"
18 #include "AliHLTPHOSSharedMemoryInterface.h"
19 #include "AliHLTPHOSRcuDAComponent.h"
20 #include "AliHLTPHOSDefinitions.h"
21 #include "AliHLTPHOSConstants.h"
22 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
23 #include "TObjArray.h"
27 /** @file AliHLTPHOSRcuDAComponent.cxx
28 @author Oystein Djuvsland
30 @brief A module calibration component for PHOS HLT, using the PHOS DA's
33 // see header file for class documentation
35 // refer to README to build package
37 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
39 using namespace PhosHLTConst;
41 AliHLTPHOSRcuDAComponent gAliHLTPHOSRcuDAComponent;
43 AliHLTPHOSRcuDAComponent::AliHLTPHOSRcuDAComponent() : AliHLTPHOSRcuProperties(),
44 AliHLTCalibrationProcessor(),
50 fShmPtr = new AliHLTPHOSSharedMemoryInterface();
55 AliHLTPHOSRcuDAComponent::~AliHLTPHOSRcuDAComponent()
70 void AliHLTPHOSRcuDAComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
73 list.push_back(AliHLTPHOSDefinitions::fgkCellEnergyDataType);
77 AliHLTComponentDataType AliHLTPHOSRcuDAComponent::GetOutputDataType()
79 return AliHLTPHOSDefinitions::fgkEmcCalibDataType;
83 void AliHLTPHOSRcuDAComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
91 AliHLTPHOSRcuDAComponent::Spawn()
93 return new AliHLTPHOSRcuDAComponent();
97 AliHLTPHOSRcuDAComponent::GetComponentID()
99 return "PhosRcuDAProcessor";
104 AliHLTPHOSRcuDAComponent::ScanArgument( Int_t argc, const char** argv)
106 ScanArguments(argc, argv);
111 Int_t AliHLTPHOSRcuDAComponent::InitCalibration()
113 //CRAP PT just to get something working by 5 May 2008
114 const int tmpModule = 2;
115 fPHOSDAPtr = new AliPHOSRcuDA1(tmpModule ,GetRCUID());
120 Int_t AliHLTPHOSRcuDAComponent::DeinitCalibration()
122 AliHLTComponentEventData dummyEvtData;
123 AliHLTComponentTriggerData dummyTrgData;
124 ShipDataToFXS(dummyEvtData, dummyTrgData);
142 Int_t AliHLTPHOSRcuDAComponent::ProcessCalibration(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
145 const AliHLTComponentEventData eDta = evtData;
146 AliHLTComponentTriggerData tDta = trigData;
148 UInt_t specification = 0;
149 const AliHLTComponentBlockData* iter = 0;
150 iter = GetFirstInputBlock( AliHLTPHOSDefinitions::fgkCellEnergyDataType | kAliHLTDataOriginPHOS);
152 AliHLTPHOSRcuCellEnergyDataStruct* cellDataPtr = 0;
157 Float_t energyArray[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS];
158 Float_t timeArray[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS];
159 ResetArrays(energyArray, timeArray);
163 specification = specification|iter->fSpecification;
164 cellDataPtr = (AliHLTPHOSRcuCellEnergyDataStruct*)( iter->fPtr);
165 module = cellDataPtr->fModuleID;
166 xOffset = cellDataPtr->fRcuX*N_XCOLUMNS_RCU;
167 zOffset = cellDataPtr->fRcuZ*N_ZROWS_RCU;
169 for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++)
171 for(Int_t z = 0; z < N_ZROWS_RCU; z++)
173 for(Int_t gain = 0; gain < N_GAINS; gain++)
175 energyArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fEnergy;
176 timeArray[x+xOffset][z+zOffset][gain] = cellDataPtr->fValidData[x][z][gain].fTime;
180 iter = GetNextInputBlock();
183 fPHOSDAPtr->FillHistograms(energyArray, timeArray);
185 ResetArrays(energyArray, timeArray);
192 AliHLTPHOSRcuDAComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ )
194 Char_t filename[200];
196 for(int i=0; i < 200; i++)
200 const TObjArray *calibPtr = fPHOSDAPtr->GetHistoContainer();
201 sprintf(filename, "/home/perthi/hlt/rundir/test/outdata/%s.root", fPHOSDAPtr->GetName() );
202 TFile *outFile = new TFile(filename, "recreate");
205 PushToFXS( (TObject*)fPHOSDAPtr->GetHistoContainer(), "PHOS", filename);
206 cout << "Finnished pushing data to HLT FXS" << endl;
212 AliHLTPHOSRcuDAComponent::ResetArrays(Float_t e[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS], Float_t t[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS])
214 for(Int_t x = 0; x < N_XCOLUMNS_RCU; x++)
216 for(Int_t z = 0; z < N_ZROWS_RCU; z++)
218 for(Int_t gain = 0; gain < N_GAINS; gain++)