]>
Commit | Line | Data |
---|---|---|
e7d00ae7 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | $Log$ | |
18 | authors: Roberto Preghenella, preghenella@bo.infn.it | |
19 | with contribution from Chiara Zampolli, zampolli@bo.infn.it | |
20 | */ | |
21 | ||
22 | ||
23 | //////////////////////////////////////////////////////////////////////// | |
24 | // // | |
25 | // This class provides access to TOF raw data in DDL files. // | |
26 | // // | |
27 | // It loops over all TOF raw data given by the AliRawReader. // | |
28 | // // | |
29 | //////////////////////////////////////////////////////////////////////// | |
30 | ||
31 | #include <stdlib.h> | |
32 | #include "AliTOFHitDataBuffer.h" | |
33 | ||
34 | ClassImp(AliTOFHitDataBuffer) | |
35 | ||
36 | AliTOFHitDataBuffer::AliTOFHitDataBuffer(Int_t BufferSize = 1000) : | |
37 | TObject(), | |
38 | fBufferSize(BufferSize), | |
39 | fBuffer(0x0), | |
40 | fEntries(0) | |
41 | { | |
42 | fBuffer = new AliTOFHitData[BufferSize]; | |
43 | } | |
44 | //----------------------------------------------------------------------------- | |
45 | AliTOFHitDataBuffer::AliTOFHitDataBuffer(const AliTOFHitDataBuffer &source): | |
46 | TObject(), | |
47 | fBufferSize(0), | |
48 | fBuffer(0x0), | |
49 | fEntries(source.fEntries) | |
50 | { | |
51 | // copy ctr | |
52 | this->fBufferSize = source.fBufferSize; | |
53 | this->fBuffer = new AliTOFHitData[this->fBufferSize]; | |
54 | this->fEntries = source.fEntries; | |
55 | for (Int_t i = 0; i < this->fEntries; i++) | |
56 | this->fBuffer[i] = source.fBuffer[i]; | |
57 | } | |
58 | ||
59 | //----------------------------------------------------------------------------- | |
60 | AliTOFHitDataBuffer& AliTOFHitDataBuffer::operator=(const AliTOFHitDataBuffer & source) | |
61 | { | |
62 | // ass operator | |
63 | this->fEntries = source.fEntries < this->fBufferSize ? source.fEntries : this->fBufferSize; | |
64 | for (Int_t i = 0; i < this->fEntries; i++) | |
65 | this->fBuffer[i] = source.fBuffer[i]; | |
66 | return *this; | |
67 | } | |
68 | ||
69 | //----------------------------------------------------------------------------- | |
70 | AliTOFHitDataBuffer::~AliTOFHitDataBuffer() | |
71 | { | |
72 | delete [] fBuffer; | |
73 | } | |
74 | ||
75 | //----------------------------------------------------------------------------- | |
76 | Bool_t AliTOFHitDataBuffer::Add(AliTOFHitData &HitData) { | |
77 | // adding a new entry | |
78 | if (fEntries >= fBufferSize){ | |
79 | printf("buffer limit: current entries = %d\n", fEntries); | |
80 | return kTRUE; | |
81 | } | |
82 | fBuffer[fEntries++] = HitData; | |
83 | return kFALSE; | |
84 | } | |
85 | ||
86 |