]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSDigitReader.cxx
- adding digit readers to assist with the linked list of digits
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSDigitReader.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Authors: Oystein Djuvsland <oysteind@ift.uib.no>                       *
5  *                                                                        *
6  * Permission to use, copy, modify and distribute this software and its   *
7  * documentation strictly for non-commercial purposes is hereby granted   *
8  * without fee, provided that the above copyright notice appears in all   *
9  * copies and that both the copyright notice and this permission notice   *
10  * appear in the supporting documentation. The authors make no claims     *
11  * about the suitability of this software for any purpose. It is          *
12  * provided "as is" without express or implied warranty.                  *
13  **************************************************************************/
14
15
16 #include "AliHLTPHOSDigitReader.h"
17 #include "AliHLTPHOSDigitDataStruct.h"
18
19
20 AliHLTPHOSDigitReader::AliHLTPHOSDigitReader() :
21   fDigitHeader(0)
22 {
23   // See header file for documentation
24 }
25
26 AliHLTPHOSDigitReader::~AliHLTPHOSDigitReader()
27 {
28   // See header file for documentation
29 }
30
31
32 AliHLTPHOSDigitDataStruct* AliHLTPHOSDigitReader::NextDigit()
33 {
34
35   fPrevDigit = fCurrentDigit;
36   fCurrentDigit = fNextDigit;
37
38   if(fCurrentDigit->fMemOffsetNext != 0)
39     {
40       fNextDigit = reinterpret_cast<AliHLTPHOSDigitDataStruct*>(reinterpret_cast<Int_t>(fCurrentDigit) + fCurrentDigit->fMemOffsetNext);
41     }
42   else
43     {
44       fNextDigit = 0;
45     }
46
47   return fCurrentDigit;
48 }
49
50 void AliHLTPHOSDigitReader::DropDigit()
51 {
52   if(fCurrentDigit == fFirstDigit)
53     {
54       fFirstDigit = reinterpret_cast<AliHLTPHOSDigitDataStruct*>(reinterpret_cast<Int_t>(fFirstDigit) + fFirstDigit->fMemOffsetNext);
55       fDigitHeader->fFirstDigitOffset += fCurrentDigit->fMemOffsetNext;
56     }
57   else if(fCurrentDigit != 0)
58     {
59       fPrevDigit->fMemOffsetNext = fPrevDigit->fMemOffsetNext + fCurrentDigit->fMemOffsetNext;
60     }
61   fCurrentDigit = fPrevDigit;
62 }