New AliTRDcluster constructor
[u/mrichter/AliRoot.git] / TOF / AliTOFHitDataBuffer.cxx
CommitLineData
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 18Revision 1.1 2007/04/27 11:03:09 arcelli
19container 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"
e7d00ae7 35#include "AliTOFHitDataBuffer.h"
36
37ClassImp(AliTOFHitDataBuffer)
38
54b02b47 39AliTOFHitDataBuffer::AliTOFHitDataBuffer(Int_t BufferSize) :
e7d00ae7 40 TObject(),
41 fBufferSize(BufferSize),
42 fBuffer(0x0),
43 fEntries(0)
44{
45 fBuffer = new AliTOFHitData[BufferSize];
46}
47//-----------------------------------------------------------------------------
48AliTOFHitDataBuffer::AliTOFHitDataBuffer(const AliTOFHitDataBuffer &source):
49 TObject(),
50 fBufferSize(0),
51 fBuffer(0x0),
52 fEntries(source.fEntries)
53{
54 // copy ctr
55 this->fBufferSize = source.fBufferSize;
56 this->fBuffer = new AliTOFHitData[this->fBufferSize];
57 this->fEntries = source.fEntries;
58 for (Int_t i = 0; i < this->fEntries; i++)
59 this->fBuffer[i] = source.fBuffer[i];
60}
61
62//-----------------------------------------------------------------------------
63AliTOFHitDataBuffer& AliTOFHitDataBuffer::operator=(const AliTOFHitDataBuffer & source)
64{
65 // ass operator
66 this->fEntries = source.fEntries < this->fBufferSize ? source.fEntries : this->fBufferSize;
67 for (Int_t i = 0; i < this->fEntries; i++)
68 this->fBuffer[i] = source.fBuffer[i];
69 return *this;
70}
71
72//-----------------------------------------------------------------------------
73AliTOFHitDataBuffer::~AliTOFHitDataBuffer()
74{
75 delete [] fBuffer;
76}
77
78//-----------------------------------------------------------------------------
79Bool_t AliTOFHitDataBuffer::Add(AliTOFHitData &HitData) {
80 // adding a new entry
81 if (fEntries >= fBufferSize){
54b02b47 82 AliError("The buffer is completely full. ");
e7d00ae7 83 return kTRUE;
84 }
85 fBuffer[fEntries++] = HitData;
86 return kFALSE;
87}
88
89