LCOV - code coverage report
Current view: top level - HLT/CALO - AliHLTCaloSharedMemoryInterfacev2.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 48 2.1 %
Date: 2016-06-14 17:26:59 Functions: 1 10 10.0 %

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

Generated by: LCOV version 1.11