]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/CALO/AliHLTCaloSharedMemoryInterfacev2.cxx
- removing obsolete file
[u/mrichter/AliRoot.git] / HLT / CALO / AliHLTCaloSharedMemoryInterfacev2.cxx
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
29 ClassImp(AliHLTCaloSharedMemoryInterfacev2);
30
31 AliHLTCaloSharedMemoryInterfacev2::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)
41 {
42    // See header file for class documentation
43    
44 }
45
46 AliHLTCaloSharedMemoryInterfacev2::~AliHLTCaloSharedMemoryInterfacev2()
47 {
48
49 }
50
51 AliHLTCaloChannelDataStruct*
52 AliHLTCaloSharedMemoryInterfacev2::NextChannel()
53 {
54   // Comment
55   AliHLTCaloChannelDataStruct* tmpChannelPtr = 0;
56   if(fCurrentCnt < fMaxCnt)
57     {
58       tmpChannelPtr = reinterpret_cast<AliHLTCaloChannelDataStruct*>(fChannelDataPtr);
59       fCurrentCnt++;
60       fChannelDataPtr += sizeof(AliHLTCaloChannelDataStruct);
61       
62      if(fHasRawData == true)
63       if( false )       
64         {
65           fRawData.fEnergy = tmpChannelPtr->fEnergy;
66           fRawData.fTime = tmpChannelPtr->fTime;
67           fRawData.fChannelID = tmpChannelPtr->fChannelID;
68           fRawData.fCrazyness = tmpChannelPtr->fCrazyness;
69           Reset(fRawData);
70           //AliHLTCaloMapper::ChannelId2Coordinate(const UShort_t channelId, AliHLTCaloCoordinate &channelCoord)
71  
72  
73           AliHLTCaloMapper::ChannelId2Coordinate( fRawData.fChannelID, fRawData.fCoordinate);
74           
75           if( fRawData.fChannelID == fRawDataPtr[0] )
76             {
77               Reset(fRawData);
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];
83               // fRawDataPtr
84               //     UShort_t tmpSamplesLeft = tmpTotSize -4;
85               int tmpSamplesLeft = tmpTotSize -4;
86
87               fRawData.nSamplesUsed = tmpTotSize + tmpStartBin;
88
89               if(tmpSamplesLeft > 0 )
90                 {
91                   while(tmpSamplesLeft > 0)
92                     {
93                       for(int i=0; i < tmpBunchtSize; i++ )
94                         {
95 //                        fRawData.fDataPtr[i + tmpStartBin] = fRawDataPtr[ i+ 4];
96                           tmpSamplesLeft --;
97                         }
98                     }
99                   fRawDataPtr+= tmpTotSize;
100                 }
101             }
102           else
103             {
104               // cout << __FILE__ << __LINE__ << "ERROR! fRawData.fChannelID = "<< fRawData.fChannelID << " but fRawDataPtr[0] = " << fRawDataPtr[0] << endl;
105             }
106  
107  
108           // HLTDebug("Raw data interface not yet implemented, ignoring raw data");
109         }
110       return tmpChannelPtr;
111     }
112   else
113     {
114       Reset();
115       return 0;
116     }
117   return 0;
118 }
119
120 void  
121 AliHLTCaloSharedMemoryInterfacev2::NextRawChannel( )
122 {
123   if(fHasRawData == false )
124     {
125       cout << __FILE__ << __LINE__<< "ERROR: no raw data present" << endl;
126     }
127   else
128     {
129       for(int i = 0; i <  200 ; i++ )
130
131         {
132           cout << fRawDataPtr[i] << "\t";
133           if(i%16 == 0)
134             {
135               cout << endl;
136             }
137         }
138     }
139 }
140
141 void
142 //AliHLTCaloSharedMemoryInterfacev2::SetMemory(AliHLTCaloChannelDataHeaderStruct* channelDataHeaderPtr,  const unsigned long specification)
143 AliHLTCaloSharedMemoryInterfacev2::SetMemory(AliHLTCaloChannelDataHeaderStruct* channelDataHeaderPtr)
144 {
145   //  fSpecification = specification;
146
147   //Shutting up rule checker
148   fHasRawData = channelDataHeaderPtr->fHasRawData; 
149   fMaxCnt = channelDataHeaderPtr->fNChannels;
150   fChannelDataPtr = reinterpret_cast<AliHLTUInt8_t*>(channelDataHeaderPtr) + sizeof(AliHLTCaloChannelDataHeaderStruct);
151   
152
153   if(fHasRawData == true)
154     {
155       fRawDataPtr = reinterpret_cast<  UShort_t* >(channelDataHeaderPtr); 
156       int inc =  sizeof (AliHLTCaloChannelDataHeaderStruct) +  fMaxCnt*sizeof(AliHLTCaloChannelDataStruct);
157       fRawDataPtr += inc/sizeof(UShort_t );
158     }
159
160     fIsSetMemory = true;
161 }
162
163
164 void
165 AliHLTCaloSharedMemoryInterfacev2::Reset()
166 {
167   //Shutting up rule checker
168   fCurrentCnt = 0;
169   fIsSetMemory = false;
170   fHasRawData = false;
171 }
172