]>
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$ | |
54b02b47 | 18 | Revision 1.1 2007/04/27 11:03:09 arcelli |
19 | container for TOF raw data | |
20 | ||
e7d00ae7 | 21 | authors: Roberto Preghenella, preghenella@bo.infn.it |
22 | with contribution from Chiara Zampolli, zampolli@bo.infn.it | |
23 | */ | |
24 | ||
25 | ||
26 | //////////////////////////////////////////////////////////////////////// | |
27 | // // | |
28 | // This class provides access to TOF raw data in DDL files. // | |
29 | // // | |
30 | // It loops over all TOF raw data given by the AliRawReader. // | |
31 | // // | |
32 | //////////////////////////////////////////////////////////////////////// | |
33 | ||
54b02b47 | 34 | #include "AliLog.h" |
5c7c93fa | 35 | |
36 | //#include "AliTOFHitData.h" | |
e7d00ae7 | 37 | #include "AliTOFHitDataBuffer.h" |
38 | ||
39 | ClassImp(AliTOFHitDataBuffer) | |
40 | ||
57131140 | 41 | AliTOFHitDataBuffer::AliTOFHitDataBuffer(Int_t bufferSize) : |
e7d00ae7 | 42 | TObject(), |
57131140 | 43 | fBufferSize(bufferSize), |
44 | fBuffer(new AliTOFHitData[bufferSize]), | |
e7d00ae7 | 45 | fEntries(0) |
46 | { | |
e7d00ae7 | 47 | } |
57131140 | 48 | |
e7d00ae7 | 49 | //----------------------------------------------------------------------------- |
50 | AliTOFHitDataBuffer::AliTOFHitDataBuffer(const AliTOFHitDataBuffer &source): | |
57131140 | 51 | TObject(source), |
52 | fBufferSize(source.fBufferSize), | |
53 | fBuffer(new AliTOFHitData[fBufferSize]), | |
e7d00ae7 | 54 | fEntries(source.fEntries) |
55 | { | |
56 | // copy ctr | |
57131140 | 57 | for (Int_t i = 0; i < fEntries; ++i) |
58 | fBuffer[i] = source.fBuffer[i]; | |
e7d00ae7 | 59 | } |
60 | ||
61 | //----------------------------------------------------------------------------- | |
62 | AliTOFHitDataBuffer& AliTOFHitDataBuffer::operator=(const AliTOFHitDataBuffer & source) | |
63 | { | |
64 | // ass operator | |
57131140 | 65 | if(this!=&source) { |
66 | TObject::operator=(source); | |
67 | fEntries = source.fEntries < fBufferSize ? source.fEntries : fBufferSize; | |
68 | for (Int_t i = 0; i < fEntries; ++i) fBuffer[i]=source.fBuffer[i]; | |
69 | } | |
e7d00ae7 | 70 | return *this; |
71 | } | |
72 | ||
73 | //----------------------------------------------------------------------------- | |
74 | AliTOFHitDataBuffer::~AliTOFHitDataBuffer() | |
75 | { | |
76 | delete [] fBuffer; | |
77 | } | |
78 | ||
79 | //----------------------------------------------------------------------------- | |
80 | Bool_t AliTOFHitDataBuffer::Add(AliTOFHitData &HitData) { | |
81 | // adding a new entry | |
82 | if (fEntries >= fBufferSize){ | |
54b02b47 | 83 | AliError("The buffer is completely full. "); |
e7d00ae7 | 84 | return kTRUE; |
85 | } | |
86 | fBuffer[fEntries++] = HitData; | |
87 | return kFALSE; | |
88 | } | |
89 | ||
90 |