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