]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/CALO/AliHLTCaloSharedMemoryInterfacev2.cxx
ATO-17 Adding dummy function: AliTPCDigitizer::DigitizeWithTailAndCrossTalk
[u/mrichter/AliRoot.git] / HLT / CALO / AliHLTCaloSharedMemoryInterfacev2.cxx
CommitLineData
3800a654 1// $Id: AliHLTCaloSharedMemoryInterfacev2.cxx 35071 2009-09-29 05:26:09Z phille $
2
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 *
7 * *
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 *
11 * *
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 **************************************************************************/
20
21
22#include "AliHLTCaloSharedMemoryInterfacev2.h"
23#include "AliHLTCaloChannelDataHeaderStruct.h"
24#include "AliHLTCaloChannelDataStruct.h"
25#include "AliHLTLogging.h"
26#include "AliHLTCaloMapper.h"
27#include "AliHLTCaloConstants.h"
28
4f4b7ba4 29ClassImp(AliHLTCaloSharedMemoryInterfacev2);
3800a654 30
c6d582d5 31AliHLTCaloSharedMemoryInterfacev2::AliHLTCaloSharedMemoryInterfacev2(TString det): AliHLTCaloConstantsHandler(det),
32 fCurrentChannel(0),
33 fChannelDataPtr(0),
34 fIsSetMemory(false),
35 fHasRawData(false),
36 fMaxCnt(0),
37 fCurrentCnt(0),
38 fRawDataPtr(0),
39 fRawData()
40 // fSpecification(0)
3800a654 41{
c6d582d5 42 // See header file for class documentation
fe4e0365 43 for(Int_t i = 0; i < 32; i++)
44 {
45 fMapperPtr[i] = 0;
46 }
3800a654 47}
48
3800a654 49AliHLTCaloSharedMemoryInterfacev2::~AliHLTCaloSharedMemoryInterfacev2()
50{
51
52}
53
b850c417 54AliHLTCaloChannelDataStruct*
3800a654 55AliHLTCaloSharedMemoryInterfacev2::NextChannel()
56{
57 // Comment
58 AliHLTCaloChannelDataStruct* tmpChannelPtr = 0;
59 if(fCurrentCnt < fMaxCnt)
60 {
61 tmpChannelPtr = reinterpret_cast<AliHLTCaloChannelDataStruct*>(fChannelDataPtr);
62 fCurrentCnt++;
63 fChannelDataPtr += sizeof(AliHLTCaloChannelDataStruct);
b850c417 64
c6d582d5 65 if(fHasRawData == true)
66 if( false )
3800a654 67 {
68 fRawData.fEnergy = tmpChannelPtr->fEnergy;
69 fRawData.fTime = tmpChannelPtr->fTime;
b850c417 70 fRawData.fChannelID = tmpChannelPtr->fChannelID;
71 fRawData.fCrazyness = tmpChannelPtr->fCrazyness;
3800a654 72 Reset(fRawData);
b850c417 73 //AliHLTCaloMapper::ChannelId2Coordinate(const UShort_t channelId, AliHLTCaloCoordinate &channelCoord)
74
75
3800a654 76 AliHLTCaloMapper::ChannelId2Coordinate( fRawData.fChannelID, fRawData.fCoordinate);
77
b850c417 78 if( fRawData.fChannelID == fRawDataPtr[0] )
3800a654 79 {
80 Reset(fRawData);
b850c417 81 // cout << __FILE__ << __LINE__ << "fRawData.fChannelID == fRawDataPtr[0] = " << fRawDataPtr[0] << endl;
82 // cout << " copying raw dat not yet implemnted " << endl;
83 UShort_t tmpTotSize = fRawDataPtr[1];
84 UShort_t tmpStartBin = fRawDataPtr[2];
85 UShort_t tmpBunchtSize = fRawDataPtr[3];
86 // fRawDataPtr
87 // UShort_t tmpSamplesLeft = tmpTotSize -4;
88 int tmpSamplesLeft = tmpTotSize -4;
89
90 fRawData.nSamplesUsed = tmpTotSize + tmpStartBin;
91
92 if(tmpSamplesLeft > 0 )
3800a654 93 {
b850c417 94 while(tmpSamplesLeft > 0)
3800a654 95 {
b850c417 96 for(int i=0; i < tmpBunchtSize; i++ )
97 {
c6d582d5 98// fRawData.fDataPtr[i + tmpStartBin] = fRawDataPtr[ i+ 4];
b850c417 99 tmpSamplesLeft --;
100 }
3800a654 101 }
b850c417 102 fRawDataPtr+= tmpTotSize;
3800a654 103 }
3800a654 104 }
105 else
106 {
b850c417 107 // cout << __FILE__ << __LINE__ << "ERROR! fRawData.fChannelID = "<< fRawData.fChannelID << " but fRawDataPtr[0] = " << fRawDataPtr[0] << endl;
3800a654 108 }
b850c417 109
110
111 // HLTDebug("Raw data interface not yet implemented, ignoring raw data");
3800a654 112 }
113 return tmpChannelPtr;
114 }
115 else
116 {
117 Reset();
118 return 0;
119 }
120 return 0;
121}
122
3800a654 123void
124AliHLTCaloSharedMemoryInterfacev2::NextRawChannel( )
125{
126 if(fHasRawData == false )
127 {
128 cout << __FILE__ << __LINE__<< "ERROR: no raw data present" << endl;
129 }
130 else
131 {
132 for(int i = 0; i < 200 ; i++ )
133
134 {
135 cout << fRawDataPtr[i] << "\t";
136 if(i%16 == 0)
137 {
138 cout << endl;
139 }
140 }
141 }
142}
143
3800a654 144void
145//AliHLTCaloSharedMemoryInterfacev2::SetMemory(AliHLTCaloChannelDataHeaderStruct* channelDataHeaderPtr, const unsigned long specification)
146AliHLTCaloSharedMemoryInterfacev2::SetMemory(AliHLTCaloChannelDataHeaderStruct* channelDataHeaderPtr)
147{
148 // fSpecification = specification;
149
150 //Shutting up rule checker
151 fHasRawData = channelDataHeaderPtr->fHasRawData;
152 fMaxCnt = channelDataHeaderPtr->fNChannels;
153 fChannelDataPtr = reinterpret_cast<AliHLTUInt8_t*>(channelDataHeaderPtr) + sizeof(AliHLTCaloChannelDataHeaderStruct);
154
155
156 if(fHasRawData == true)
157 {
158 fRawDataPtr = reinterpret_cast< UShort_t* >(channelDataHeaderPtr);
159 int inc = sizeof (AliHLTCaloChannelDataHeaderStruct) + fMaxCnt*sizeof(AliHLTCaloChannelDataStruct);
160 fRawDataPtr += inc/sizeof(UShort_t );
161 }
162
163 fIsSetMemory = true;
164}
165
166
167void
168AliHLTCaloSharedMemoryInterfacev2::Reset()
169{
170 //Shutting up rule checker
171 fCurrentCnt = 0;
172 fIsSetMemory = false;
173 fHasRawData = false;
174}
175