Fixing small memory leaks (Hans)
[u/mrichter/AliRoot.git] / TOF / AliTOFCalStrip.cxx
CommitLineData
6dc9348d 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
762446e0 16/*
17$Log$
655e379f 18Revision 1.6 2006/04/20 22:30:49 hristov
19Coding conventions (Annalisa)
20
0e46b9ae 21Revision 1.5 2006/04/16 22:29:05 hristov
22Coding conventions (Annalisa)
23
7aeeaf38 24Revision 1.4 2006/04/05 08:35:38 hristov
25Coding conventions (S.Arcelli, C.Zampolli)
26
340693af 27Revision 1.3 2006/03/28 14:58:08 arcelli
28updates to handle new V5 geometry & some re-arrangements
29
d4ad0d6b 30Revision 1.2 2006/02/13 17:22:26 arcelli
31just Fixing Log info
32
762446e0 33Revision 1.1 2006/02/13 16:10:48 arcelli
34Add classes for TOF Calibration (C.Zampolli)
35
6dc9348d 36author: Chiara Zampolli, zampolli@bo.infn.it
762446e0 37*/
6dc9348d 38
39///////////////////////////////////////////////////////////////////////////////
40// //
41// class for TOF calibration : strips //
42// //
43///////////////////////////////////////////////////////////////////////////////
44
6dc9348d 45#include "TBrowser.h"
0e46b9ae 46
d4ad0d6b 47#include "AliLog.h"
0e46b9ae 48
6dc9348d 49#include "AliTOFCalPadZ.h"
0e46b9ae 50#include "AliTOFCalStrip.h"
51#include "AliTOFChannel.h"
52#include "AliTOFGeometryV5.h"
6dc9348d 53
54ClassImp(AliTOFCalStrip)
55
56//________________________________________________________________
57
655e379f 58AliTOFCalStrip::AliTOFCalStrip():
59 fNpadZ(0),
60 fNpadX(0),
61 fGeom(0x0),
62 fCh(0x0)
63{
340693af 64 //main ctor
6dc9348d 65}
66//________________________________________________________________
67
68AliTOFCalStrip::AliTOFCalStrip(AliTOFChannel *ch):
655e379f 69 fNpadZ(0),
70 fNpadX(0),
71 fGeom(0x0),
6dc9348d 72 fCh(ch)
73{
340693af 74 // ctor with channel
d4ad0d6b 75}
76//________________________________________________________________
77
655e379f 78AliTOFCalStrip::AliTOFCalStrip(AliTOFGeometry *geom):
79 fNpadZ(0),
80 fNpadX(0),
81 fGeom(geom),
82 fCh(0x0)
83{
340693af 84 //ctor with geom
d4ad0d6b 85 fNpadZ = fGeom->NpadZ();
86 fNpadX = fGeom->NpadX();
87}
88//________________________________________________________________
6dc9348d 89
d4ad0d6b 90AliTOFCalStrip::AliTOFCalStrip(AliTOFGeometry *geom,AliTOFChannel *ch):
655e379f 91 fNpadZ(0),
92 fNpadX(0),
93 fGeom(geom),
d4ad0d6b 94 fCh(ch)
95{
340693af 96 //ctor with channel and geom
d4ad0d6b 97 fNpadZ = fGeom->NpadZ();
98 fNpadX = fGeom->NpadX();
6dc9348d 99}
100//________________________________________________________________
101
102AliTOFCalStrip::~AliTOFCalStrip()
103{
340693af 104 //dtor
6dc9348d 105 delete[] fCh;
106}
107
108//________________________________________________________________
109
110AliTOFCalStrip::AliTOFCalStrip(const AliTOFCalStrip& strip):
655e379f 111 TObject(strip),
112 fNpadZ(0),
113 fNpadX(0),
114 fGeom(0x0),
115 fCh(0x0)
6dc9348d 116 {
340693af 117 //copy ctor
6dc9348d 118 fCh = strip.fCh;
6dc9348d 119 fNpadZ = strip.fNpadZ;
120 fNpadX = strip.fNpadX;
121
122 }
123//________________________________________________________________
124
7aeeaf38 125AliTOFCalStrip& AliTOFCalStrip::operator=(const AliTOFCalStrip& strip)
126 {
127 //assignment operator
128 this->fCh = strip.fCh;
129 this->fNpadZ = strip.fNpadZ;
130 this->fNpadX = strip.fNpadX;
131 return *this;
132
133 }
134//________________________________________________________________
135
6dc9348d 136void AliTOFCalStrip::Browse(TBrowser *b){
340693af 137 //add obj to list of browsables
d4ad0d6b 138 if(fGeom==0x0){
139 AliTOFGeometry *geom = new AliTOFGeometryV5();
140 AliInfo("V5 TOF Geometry is taken as the default");
141 fNpadZ = geom->NpadZ();
142 fNpadX = geom->NpadX();
143 delete geom;
144 }
6dc9348d 145 char name[10];
146 for(Int_t i=0; i<fNpadZ; ++i) {
147 snprintf(name,sizeof(name),"PadZ %2.2d",i);
148 b->Add(new AliTOFCalPadZ(&fCh[i*fNpadX]),name);
149 }
150}