]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDUshortInfo.cxx
More code clean up.
[u/mrichter/AliRoot.git] / TRD / AliTRDUshortInfo.cxx
CommitLineData
e526983e 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/* $Id: AliTRDUshortInfo.cxx 27946 2008-08-13 15:26:24Z cblume $ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// Calibration base class for a single ROC //
21// Contains one UShort_t value per pad //
22// However, values are set and get as float, there are stored internally as //
23// (UShort_t) value * 10000 //
24// //
25///////////////////////////////////////////////////////////////////////////////
26
e526983e 27#include "AliTRDUshortInfo.h"
e526983e 28
29ClassImp(AliTRDUshortInfo)
30
31//_____________________________________________________________________________
32AliTRDUshortInfo::AliTRDUshortInfo()
33 :TObject()
34 ,fSize(0)
35 ,fData(0)
36{
37 //
38 // Default constructor
39 //
40
41}
42//_____________________________________________________________________________
43AliTRDUshortInfo::AliTRDUshortInfo(Int_t n)
44 :TObject()
45 ,fSize(n)
46 ,fData(0)
47{
48 //
49 // Constructor that initializes a given size
50 //
51
52 fData = new UShort_t[fSize];
53 for(Int_t k = 0; k < fSize; k++){
54 fData[k] = 0;
55 }
56}
57//_____________________________________________________________________________
58AliTRDUshortInfo::AliTRDUshortInfo(const AliTRDUshortInfo &c)
59 :TObject(c)
60 ,fSize(c.fSize)
61 ,fData(0)
62{
63 //
64 // AliTRDUshortInfo copy constructor
65 //
66
67 Int_t iBin = 0;
68
69 fData = new UShort_t[fSize];
70 for (iBin = 0; iBin < fSize; iBin++) {
71 fData[iBin] = ((AliTRDUshortInfo &) c).fData[iBin];
72 }
73
74}
75//_____________________________________________________________________________
76AliTRDUshortInfo::~AliTRDUshortInfo()
77{
78 //
79 // AliTRDUshortInfo destructor
80 //
81
82 if (fData) {
83 delete [] fData;
84 fData = 0;
85 }
86
87}
88//_____________________________________________________________________________
89AliTRDUshortInfo &AliTRDUshortInfo::operator=(const AliTRDUshortInfo &c)
90{
91 //
92 // Assignment operator
93 //
94
95 if (this != &c) ((AliTRDUshortInfo &) c).Copy(*this);
96 return *this;
97
98}
99//_____________________________________________________________________________
100void AliTRDUshortInfo::Copy(TObject &c) const
101{
102 //
103 // Copy function
104 //
105
106 Int_t iBin = 0;
107
108 ((AliTRDUshortInfo &) c).fSize = fSize;
109
110 if (((AliTRDUshortInfo &) c).fData) delete [] ((AliTRDUshortInfo &) c).fData;
111 ((AliTRDUshortInfo &) c).fData = new UShort_t[fSize];
112 for (iBin = 0; iBin < fSize; iBin++) {
113 ((AliTRDUshortInfo &) c).fData[iBin] = fData[iBin];
114 }
115
116 TObject::Copy(c);
117
118}
119//_____________________________________________________________________________
120void AliTRDUshortInfo::SetSize(Int_t n)
121{
122 //
123 // Set the size
124 //
125
126 if(fData) delete [] fData;
127 fData = new UShort_t[n];
128
129 fSize = n;
130
131}