free arrays before of return in PropagateBack
[u/mrichter/AliRoot.git] / TOF / AliTOFCalOnline.cxx
CommitLineData
87de54c7 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$
18*/
19
20///////////////////////////////////////////////////////////////////////////////
21// //
22// class for TOF online calibration : array of AliTOFChannelOnline //
23// //
24///////////////////////////////////////////////////////////////////////////////
25
26#include "TROOT.h"
27
28#include "AliLog.h"
29
30#include "AliTOFCalOnline.h"
31#include "AliTOFGeometryV5.h"
32
5480a4f2 33//extern TROOT *gROOT;
87de54c7 34
35ClassImp(AliTOFCalOnline)
36
37//________________________________________________________________
38
39AliTOFCalOnline::AliTOFCalOnline():
40 TObject(),
41 fNSector(0),
42 fNPlate(0),
43 fNStripA(0),
44 fNStripB(0),
45 fNStripC(0),
46 fNpadZ(0),
47 fNpadX(0),
48 fnpad(0),
49 fGeom(0x0),
50 fPads(0x0)
51{
52 //main ctor
53 }
54//________________________________________________________________
55
56AliTOFCalOnline::AliTOFCalOnline(AliTOFGeometry *geom):
57 TObject(),
58 fNSector(0),
59 fNPlate(0),
60 fNStripA(0),
61 fNStripB(0),
62 fNStripC(0),
63 fNpadZ(0),
64 fNpadX(0),
65 fnpad(0),
66 fGeom(geom),
67 fPads(0x0)
68{
69 //ctor with geom
70 fNSector = fGeom->NSectors();
71 fNPlate = fGeom->NPlates();
72 fNStripA = fGeom->NStripA();
73 fNStripB = fGeom->NStripB();
74 fNStripC = fGeom->NStripC();
75 fNpadZ = fGeom->NpadZ();
76 fNpadX = fGeom->NpadX();
77 fnpad = fNSector*(2*(fNStripC+fNStripB)+fNStripA)*fNpadZ*fNpadX;
78}
79//________________________________________________________________
80
81AliTOFCalOnline::AliTOFCalOnline(const AliTOFCalOnline& cal):
82 TObject(cal),
83 fNSector(0),
84 fNPlate(0),
85 fNStripA(0),
86 fNStripB(0),
87 fNStripC(0),
88 fNpadZ(0),
89 fNpadX(0),
90 fnpad(0),
91 fGeom(0x0),
92 fPads(0x0)
93{
94 //copy ctor
95 fNSector = cal.fNSector;
96 fNPlate = cal.fNPlate;
97 fNStripA = cal.fNStripA;
98 fNStripB = cal.fNStripB;
99 fNStripC = cal.fNStripC;
100 fNpadZ = cal.fNpadZ;
101 fNpadX = cal.fNpadX;
102 fnpad = cal.fnpad;
103 for (Int_t i = 0; i<fnpad; i++){
104 fPads[i]=cal.fPads[i];
105 }
106 }
107//____________________________________________________________________________
108AliTOFCalOnline& AliTOFCalOnline::operator=(const AliTOFCalOnline& cal)
109 {
110 //assignment operator
111 this->fNSector = cal.fNSector;
112 this->fNPlate = cal.fNPlate;
113 this->fNStripA = cal.fNStripA;
114 this->fNStripB = cal.fNStripB;
115 this->fNStripC = cal.fNStripC;
116 this->fNpadZ = cal.fNpadZ;
117 this->fNpadX = cal.fNpadX;
118 this->fnpad = cal.fnpad;
119 for (Int_t i = 0; i<fnpad; i++){
120 this->fPads[i]=cal.fPads[i];
121 }
122 return *this;
123
124 }
125//____________________________________________________________________________
126AliTOFCalOnline::~AliTOFCalOnline()
127{
128 //dtor
129 delete [] fPads;
130}
131//________________________________________________________________
132
133void AliTOFCalOnline::CreateArray(){
134 //create cal channel array
135 if(fGeom==0x0){
136 AliInfo("V5 TOF Geometry is taken as a default");
137 AliTOFGeometry *geom= new AliTOFGeometryV5();
138 fNSector = geom->NSectors();
139 fNPlate = geom->NPlates();
140 fNStripA = geom->NStripA();
141 fNStripB = geom->NStripB();
142 fNStripC = geom->NStripC();
143 fNpadZ = geom->NpadZ();
144 fNpadX = geom->NpadX();
145 fnpad = fNSector*(2*(fNStripC+fNStripB)+fNStripA)*fNpadZ*fNpadX;
146 delete geom;
147 }
148 fPads= new AliTOFChannelOnline[fnpad];
149}