1 // $Id: AliHLTCaloSharedMemoryInterfacev2.cxx 35071 2009-09-29 05:26:09Z phille $
3 /**************************************************************************
4 * This file is property of and copyright by the Experimental Nuclear *
5 * Physics Group, Dep. of Physics *
6 * University of Oslo, Norway, 2007 *
8 * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
9 * Contributors are mentioned in the code where appropriate. *
10 * Please report bugs to perthi@fys.uio.no *
12 * Permission to use, copy, modify and distribute this software and its *
13 * documentation strictly for non-commercial purposes is hereby granted *
14 * without fee, provided that the above copyright notice appears in all *
15 * copies and that both the copyright notice and this permission notice *
16 * appear in the supporting documentation. The authors make no claims *
17 * about the suitability of this software for any purpose. It is *
18 * provided "as is" without express or implied warranty. *
19 **************************************************************************/
22 #include "AliHLTCaloSharedMemoryInterfacev2.h"
23 #include "AliHLTCaloChannelDataHeaderStruct.h"
24 #include "AliHLTCaloChannelDataStruct.h"
25 #include "AliHLTLogging.h"
26 #include "AliHLTCaloMapper.h"
27 #include "AliHLTCaloConstants.h"
29 ClassImp(AliHLTCaloSharedMemoryInterfacev2);
31 AliHLTCaloSharedMemoryInterfacev2::AliHLTCaloSharedMemoryInterfacev2(TString det): AliHLTCaloConstantsHandler(det),
42 // See header file for class documentation
46 AliHLTCaloSharedMemoryInterfacev2::~AliHLTCaloSharedMemoryInterfacev2()
51 AliHLTCaloChannelDataStruct*
52 AliHLTCaloSharedMemoryInterfacev2::NextChannel()
55 AliHLTCaloChannelDataStruct* tmpChannelPtr = 0;
56 if(fCurrentCnt < fMaxCnt)
58 tmpChannelPtr = reinterpret_cast<AliHLTCaloChannelDataStruct*>(fChannelDataPtr);
60 fChannelDataPtr += sizeof(AliHLTCaloChannelDataStruct);
62 if(fHasRawData == true)
65 fRawData.fEnergy = tmpChannelPtr->fEnergy;
66 fRawData.fTime = tmpChannelPtr->fTime;
67 fRawData.fChannelID = tmpChannelPtr->fChannelID;
68 fRawData.fCrazyness = tmpChannelPtr->fCrazyness;
70 //AliHLTCaloMapper::ChannelId2Coordinate(const UShort_t channelId, AliHLTCaloCoordinate &channelCoord)
73 AliHLTCaloMapper::ChannelId2Coordinate( fRawData.fChannelID, fRawData.fCoordinate);
75 if( fRawData.fChannelID == fRawDataPtr[0] )
78 // cout << __FILE__ << __LINE__ << "fRawData.fChannelID == fRawDataPtr[0] = " << fRawDataPtr[0] << endl;
79 // cout << " copying raw dat not yet implemnted " << endl;
80 UShort_t tmpTotSize = fRawDataPtr[1];
81 UShort_t tmpStartBin = fRawDataPtr[2];
82 UShort_t tmpBunchtSize = fRawDataPtr[3];
84 // UShort_t tmpSamplesLeft = tmpTotSize -4;
85 int tmpSamplesLeft = tmpTotSize -4;
87 fRawData.nSamplesUsed = tmpTotSize + tmpStartBin;
89 if(tmpSamplesLeft > 0 )
91 while(tmpSamplesLeft > 0)
93 for(int i=0; i < tmpBunchtSize; i++ )
95 // fRawData.fDataPtr[i + tmpStartBin] = fRawDataPtr[ i+ 4];
99 fRawDataPtr+= tmpTotSize;
104 // cout << __FILE__ << __LINE__ << "ERROR! fRawData.fChannelID = "<< fRawData.fChannelID << " but fRawDataPtr[0] = " << fRawDataPtr[0] << endl;
108 // HLTDebug("Raw data interface not yet implemented, ignoring raw data");
110 return tmpChannelPtr;
121 AliHLTCaloSharedMemoryInterfacev2::NextRawChannel( )
123 if(fHasRawData == false )
125 cout << __FILE__ << __LINE__<< "ERROR: no raw data present" << endl;
129 for(int i = 0; i < 200 ; i++ )
132 cout << fRawDataPtr[i] << "\t";
142 //AliHLTCaloSharedMemoryInterfacev2::SetMemory(AliHLTCaloChannelDataHeaderStruct* channelDataHeaderPtr, const unsigned long specification)
143 AliHLTCaloSharedMemoryInterfacev2::SetMemory(AliHLTCaloChannelDataHeaderStruct* channelDataHeaderPtr)
145 // fSpecification = specification;
147 //Shutting up rule checker
148 fHasRawData = channelDataHeaderPtr->fHasRawData;
149 fMaxCnt = channelDataHeaderPtr->fNChannels;
150 fChannelDataPtr = reinterpret_cast<AliHLTUInt8_t*>(channelDataHeaderPtr) + sizeof(AliHLTCaloChannelDataHeaderStruct);
153 if(fHasRawData == true)
155 fRawDataPtr = reinterpret_cast< UShort_t* >(channelDataHeaderPtr);
156 int inc = sizeof (AliHLTCaloChannelDataHeaderStruct) + fMaxCnt*sizeof(AliHLTCaloChannelDataStruct);
157 fRawDataPtr += inc/sizeof(UShort_t );
165 AliHLTCaloSharedMemoryInterfacev2::Reset()
167 //Shutting up rule checker
169 fIsSetMemory = false;