1 /**************************************************************************
2 * This file is property of and copyright by the Experimental Nuclear *
3 * Physics Group, Dep. of Physics *
4 * University of Oslo, Norway, 2007 *
6 * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
7 * Contributors are mentioned in the code where appropriate. *
8 * Please report bugs to perthi@fys.uio.no *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
21 #include "AliHLTPHOSSharedMemoryInterface.h"
22 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
23 #include "AliHLTPHOSValidCellDataStruct.h"
27 AliHLTPHOSSharedMemoryInterface::AliHLTPHOSSharedMemoryInterface(): fCurrentChannel(0),
39 fCharDataOffset = sizeof(AliHLTPHOSRcuCellEnergyDataStruct);
43 AliHLTPHOSSharedMemoryInterface::~AliHLTPHOSSharedMemoryInterface()
49 AliHLTPHOSValidCellDataStruct*
50 AliHLTPHOSSharedMemoryInterface::NextChannel()
52 // Returns the next channel of the current AliHLTPHOSRcuCellEnergyDataStruct
53 // Returns zero when all cannels are read
55 if(fCurrentCnt < fMaxCnt)
57 fCurrentChannel = &fCellEnergiesPtr->fValidData[fCurrentCnt];
58 fCurrentChannel->fData = fIntPtr;
59 fIntPtr += fCurrentChannel->fNSamples;
61 return fCurrentChannel;
66 if(fCurrentCnt < fMaxCnt)
68 for(Int_t x = 0; x < N_XCOLUMNS_MOD; x++)
70 for(Int_t z = 0; z < N_ZROWS_MOD; z++)
72 for(Int_t gain = 0; gain < N_GAINS; gain++)
74 fCurrentChannel = &(fCellEnergiesPtr->fValidData[x][z][gain]);
75 if(fCurrentChannel->fID == fCurrentCnt)
77 fCurrentChannel->fData = fIntPtr;
78 fIntPtr += fCurrentChannel->fNSamples;
80 return fCurrentChannel;
97 AliHLTPHOSSharedMemoryInterface::SetMemory(AliHLTPHOSRcuCellEnergyDataStruct *rcuCellEnergyPtr)
99 //Shutting up rule checker
100 fCellEnergiesPtr = rcuCellEnergyPtr;
101 fMaxCnt = fCellEnergiesPtr->fCnt;
108 AliHLTPHOSSharedMemoryInterface::Reset()
110 //Shutting up rule checker
116 fIsSetMemory = false;
121 AliHLTPHOSSharedMemoryInterface::PingPongPointer()
123 // ping pong ping ping pong ping pong
124 fCharPtr = (char *)fCellEnergiesPtr ;
125 fCharPtr += fCharDataOffset;
126 fIntPtr = (Int_t *)fCharPtr;