]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSDigitReader.cxx
Fixing comments
[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 #include "AliHLTLogging.h"
16 #include "AliHLTPHOSDigitReader.h"
17 #include "AliHLTPHOSDigitDataStruct.h"
18
19
20 AliHLTPHOSDigitReader::AliHLTPHOSDigitReader() :
21   fDigitHeader(0),
22   fCurrentDigit(0),
23   fNextDigit(0),
24   fPrevDigit(0),
25   fFirstDigit(0)
26 {
27   // See header file for documentation
28 }
29
30 AliHLTPHOSDigitReader::~AliHLTPHOSDigitReader()
31 {
32   // See header file for documentation
33 }
34
35
36 AliHLTPHOSDigitDataStruct* AliHLTPHOSDigitReader::NextDigit()
37 {
38
39   fPrevDigit = fCurrentDigit;
40   fCurrentDigit = fNextDigit;
41
42   if(fCurrentDigit == 0) return 0;
43
44   if(fCurrentDigit->fMemOffsetNext != 0)
45     {
46       fNextDigit = reinterpret_cast<AliHLTPHOSDigitDataStruct*>(reinterpret_cast<UChar_t*>(fCurrentDigit) + fCurrentDigit->fMemOffsetNext);
47     }
48   else
49     {
50       fNextDigit = 0;
51     }
52   //  cout << "Digit is (x, z): " << fCurrentDigit->fX << ", " << fCurrentDigit->fZ << endl;
53   return fCurrentDigit;
54 }
55
56 void AliHLTPHOSDigitReader::DropDigit()
57 {
58   if(fCurrentDigit == fFirstDigit)
59     {
60       fFirstDigit = reinterpret_cast<AliHLTPHOSDigitDataStruct*>(reinterpret_cast<UChar_t*>(fFirstDigit) + fFirstDigit->fMemOffsetNext);
61       fDigitHeader->fFirstDigitOffset += fCurrentDigit->fMemOffsetNext;
62       //      HLTError("Dropping digit (x,z): %d, %d was first in list", fCurrentDigit->fX, fCurrentDigit->fZ);
63     }
64   else if(fCurrentDigit != 0)
65     {
66       fPrevDigit->fMemOffsetNext = fPrevDigit->fMemOffsetNext + fCurrentDigit->fMemOffsetNext;
67       //      HLTError("Dropping digit (x,z): %d, %d, first digit is (x,z): %d, %d", fCurrentDigit->fX, fCurrentDigit->fZ, fFirstDigit->fX, fFirstDigit->fZ);
68     }
69   fCurrentDigit = fPrevDigit;
70 }