]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDUshortInfo.cxx
Coding rules
[u/mrichter/AliRoot.git] / TRD / AliTRDUshortInfo.cxx
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
27 #include <iostream>
28 #include <fstream>
29 #include <string>
30 #include <TStyle.h>
31
32 #include "AliTRDUshortInfo.h"
33 #include "TMath.h"
34 #include "AliMathBase.h"
35 #include "TLinearFitter.h"
36 #include "TArrayI.h"
37 #include "TH2F.h"
38 #include "TH1F.h"
39 #include "TArrayF.h"
40 #include "TGraph2D.h"
41 #include "TGraphDelaunay.h"
42 #include "TList.h"
43
44 #include "AliTRDCommonParam.h"
45 #include "AliTRDpadPlane.h"
46 #include "AliLog.h"
47
48 ClassImp(AliTRDUshortInfo)
49
50 //_____________________________________________________________________________
51 AliTRDUshortInfo::AliTRDUshortInfo()
52   :TObject()
53   ,fSize(0)
54   ,fData(0)
55 {
56   //
57   // Default constructor
58   //
59
60 }
61 //_____________________________________________________________________________
62 AliTRDUshortInfo::AliTRDUshortInfo(Int_t n)
63   :TObject()
64   ,fSize(n)
65   ,fData(0)
66 {
67   //
68   // Constructor that initializes a given size
69   //
70   
71   fData = new UShort_t[fSize];
72   for(Int_t k = 0; k < fSize; k++){
73     fData[k] = 0;
74   }
75 }
76 //_____________________________________________________________________________
77 AliTRDUshortInfo::AliTRDUshortInfo(const AliTRDUshortInfo &c)
78   :TObject(c)
79   ,fSize(c.fSize)
80   ,fData(0)
81 {
82   //
83   // AliTRDUshortInfo copy constructor
84   //
85
86   Int_t iBin = 0;
87
88   fData = new UShort_t[fSize];
89   for (iBin = 0; iBin < fSize; iBin++) {
90     fData[iBin] = ((AliTRDUshortInfo &) c).fData[iBin];
91   }
92
93 }
94 //_____________________________________________________________________________
95 AliTRDUshortInfo::~AliTRDUshortInfo()
96 {
97   //
98   // AliTRDUshortInfo destructor
99   //
100
101   if (fData) {
102     delete [] fData;
103     fData = 0;
104   }
105
106 }
107 //_____________________________________________________________________________
108 AliTRDUshortInfo &AliTRDUshortInfo::operator=(const AliTRDUshortInfo &c)
109 {
110   //
111   // Assignment operator
112   //
113
114   if (this != &c) ((AliTRDUshortInfo &) c).Copy(*this);
115   return *this;
116
117 }
118 //_____________________________________________________________________________
119 void AliTRDUshortInfo::Copy(TObject &c) const
120 {
121   //
122   // Copy function
123   //
124   
125   Int_t iBin = 0;
126
127   ((AliTRDUshortInfo &) c).fSize = fSize;
128
129   if (((AliTRDUshortInfo &) c).fData) delete [] ((AliTRDUshortInfo &) c).fData;
130   ((AliTRDUshortInfo &) c).fData = new UShort_t[fSize];
131   for (iBin = 0; iBin < fSize; iBin++) {
132     ((AliTRDUshortInfo &) c).fData[iBin] = fData[iBin];
133   }
134   
135   TObject::Copy(c);
136
137 }
138 //_____________________________________________________________________________
139 void AliTRDUshortInfo::SetSize(Int_t n)
140 {
141   //
142   // Set the size
143   //
144
145   if(fData) delete [] fData;
146   fData = new UShort_t[n];
147
148   fSize = n;
149   
150 }