]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TOF/AliTOFCal.cxx
Fixing small memory leaks (Hans)
[u/mrichter/AliRoot.git] / TOF / AliTOFCal.cxx
... / ...
CommitLineData
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$
18Revision 1.6 2006/04/20 22:30:49 hristov
19Coding conventions (Annalisa)
20
21Revision 1.5 2006/04/16 22:29:05 hristov
22Coding conventions (Annalisa)
23
24Revision 1.4 2006/04/05 08:35:38 hristov
25Coding conventions (S.Arcelli, C.Zampolli)
26
27Revision 1.3 2006/03/28 14:56:48 arcelli
28updates to handle new V5 geometry & some re-arrangements
29
30Revision 1.2 2006/02/13 17:22:26 arcelli
31just Fixing Log info
32
33Revision 1.1 2006/02/13 16:10:48 arcelli
34Add classes for TOF Calibration (C.Zampolli)
35
36author: Chiara Zampolli, zampolli@bo.infn.it
37*/
38
39///////////////////////////////////////////////////////////////////////////////
40// //
41// class for TOF calibration : array of AliTOFChannels //
42// //
43///////////////////////////////////////////////////////////////////////////////
44
45#include "TBrowser.h"
46#include "TROOT.h"
47
48#include "AliLog.h"
49
50#include "AliTOFCalSector.h"
51#include "AliTOFCal.h"
52#include "AliTOFGeometryV5.h"
53
54//extern TROOT *gROOT;
55
56ClassImp(AliTOFCal)
57
58//________________________________________________________________
59
60AliTOFCal::AliTOFCal():
61 TObject(),
62 fNSector(0),
63 fNPlate(0),
64 fNStripA(0),
65 fNStripB(0),
66 fNStripC(0),
67 fNpadZ(0),
68 fNpadX(0),
69 fnpad(0),
70 fGeom(0x0),
71 fPads(0x0)
72{
73 //main ctor
74 gROOT->GetListOfBrowsables()->Add(this);
75 }
76//________________________________________________________________
77
78AliTOFCal::AliTOFCal(AliTOFGeometry *geom):
79 TObject(),
80 fNSector(0),
81 fNPlate(0),
82 fNStripA(0),
83 fNStripB(0),
84 fNStripC(0),
85 fNpadZ(0),
86 fNpadX(0),
87 fnpad(0),
88 fGeom(geom),
89 fPads(0x0)
90{
91 //ctor with geom
92 fNSector = fGeom->NSectors();
93 fNPlate = fGeom->NPlates();
94 fNStripA = fGeom->NStripA();
95 fNStripB = fGeom->NStripB();
96 fNStripC = fGeom->NStripC();
97 fNpadZ = fGeom->NpadZ();
98 fNpadX = fGeom->NpadX();
99 fnpad = fNSector*(2*(fNStripC+fNStripB)+fNStripA)*fNpadZ*fNpadX;
100 gROOT->GetListOfBrowsables()->Add(this);
101}
102//________________________________________________________________
103
104AliTOFCal::AliTOFCal(const AliTOFCal& cal):
105 TObject(cal),
106 fNSector(0),
107 fNPlate(0),
108 fNStripA(0),
109 fNStripB(0),
110 fNStripC(0),
111 fNpadZ(0),
112 fNpadX(0),
113 fnpad(0),
114 fGeom(0x0),
115 fPads(0x0)
116{
117 //copy ctor
118 fNSector = cal.fNSector;
119 fNPlate = cal.fNPlate;
120 fNStripA = cal.fNStripA;
121 fNStripB = cal.fNStripB;
122 fNStripC = cal.fNStripC;
123 fNpadZ = cal.fNpadZ;
124 fNpadX = cal.fNpadX;
125 fnpad = cal.fnpad;
126 for (Int_t i = 0; i<fnpad; i++){
127 fPads[i]=cal.fPads[i];
128 }
129 gROOT->GetListOfBrowsables()->Add(this);
130 }
131//____________________________________________________________________________
132AliTOFCal& AliTOFCal::operator=(const AliTOFCal& cal)
133 {
134 //assignment operator
135 this->fNSector = cal.fNSector;
136 this->fNPlate = cal.fNPlate;
137 this->fNStripA = cal.fNStripA;
138 this->fNStripB = cal.fNStripB;
139 this->fNStripC = cal.fNStripC;
140 this->fNpadZ = cal.fNpadZ;
141 this->fNpadX = cal.fNpadX;
142 this->fnpad = cal.fnpad;
143 for (Int_t i = 0; i<fnpad; i++){
144 this->fPads[i]=cal.fPads[i];
145 }
146 return *this;
147
148 }
149//____________________________________________________________________________
150AliTOFCal::~AliTOFCal()
151{
152 //dtor
153 gROOT->GetListOfBrowsables()->Remove(this);
154 delete [] fPads;
155}
156//________________________________________________________________
157
158void AliTOFCal::Browse(TBrowser *b)
159{
160 //add cal obj to list of browsables
161 char name[10];
162 for(Int_t i=0; i<fNSector; ++i) {
163 snprintf(name,sizeof(name),"Sector %2.2d",i);
164 b->Add(new AliTOFCalSector(&fPads[i*fnpad/fNSector]),name);
165 }
166}
167//________________________________________________________________
168
169void AliTOFCal::CreateArray(){
170 //create cal channel array
171 if(fGeom==0x0){
172 AliInfo("V5 TOF Geometry is taken as a default");
173 AliTOFGeometry *geom= new AliTOFGeometryV5();
174 fNSector = geom->NSectors();
175 fNPlate = geom->NPlates();
176 fNStripA = geom->NStripA();
177 fNStripB = geom->NStripB();
178 fNStripC = geom->NStripC();
179 fNpadZ = geom->NpadZ();
180 fNpadX = geom->NpadX();
181 fnpad = fNSector*(2*(fNStripC+fNStripB)+fNStripA)*fNpadZ*fNpadX;
182 delete geom;
183 }
184 fPads= new AliTOFChannel[fnpad];
185}