Coding conventions (C.Oppedisano)
[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.2 2006/02/13 17:22:26 arcelli
19just Fixing Log info
20
21Revision 1.1 2006/02/13 16:10:48 arcelli
22Add classes for TOF Calibration (C.Zampolli)
23
24author: Chiara Zampolli, zampolli@bo.infn.it
25*/
26
27///////////////////////////////////////////////////////////////////////////////
28// //
29// class for TOF calibration : array of AliTOFChannels //
30// //
31///////////////////////////////////////////////////////////////////////////////
32
33#include "TObject.h"
34#include "TROOT.h"
35#include "TBrowser.h"
36#include "TClass.h"
37#include "AliLog.h"
38#include "AliTOFGeometryV5.h"
39#include "AliTOFCalSector.h"
40#include "AliTOFCal.h"
41#include "AliTOFChannel.h"
42
43extern TROOT *gROOT;
44
45ClassImp(AliTOFCal)
46
47//________________________________________________________________
48
49AliTOFCal::AliTOFCal():TObject(){
50 fGeom = 0x0;
51 fNSector = 0;
52 fNPlate = 0;
53 fNStripA = 0;
54 fNStripB = 0;
55 fNStripC = 0;
56 fNpadZ = 0;
57 fNpadX = 0;
58 fnpad = 0;
59 fPads = 0x0;
60 gROOT->GetListOfBrowsables()->Add(this);
61 }
62//________________________________________________________________
63
64AliTOFCal::AliTOFCal(AliTOFGeometry *geom):TObject(){
65 fGeom = geom;
66 fNSector = fGeom->NSectors();
67 fNPlate = fGeom->NPlates();
68 fNStripA = fGeom->NStripA();
69 fNStripB = fGeom->NStripB();
70 fNStripC = fGeom->NStripC();
71 fNpadZ = fGeom->NpadZ();
72 fNpadX = fGeom->NpadX();
73 fnpad = fNSector*(2*(fNStripC+fNStripB)+fNStripA)*fNpadZ*fNpadX;
74 fPads = 0x0;
75 gROOT->GetListOfBrowsables()->Add(this);
76}
77//________________________________________________________________
78
79AliTOFCal::AliTOFCal(const AliTOFCal& cal):
80 TObject(cal)
81 {
82 fNSector = cal.fNSector;
83 fNPlate = cal.fNPlate;
84 fNStripA = cal.fNStripA;
85 fNStripB = cal.fNStripB;
86 fNStripC = cal.fNStripC;
87 fNpadZ = cal.fNpadZ;
88 fNpadX = cal.fNpadX;
89 fnpad = cal.fnpad;
90 for (Int_t i = 0; i<fnpad; i++){
91 fPads[i]=cal.fPads[i];
92 }
93 gROOT->GetListOfBrowsables()->Add(this);
94 }
95//____________________________________________________________________________
96AliTOFCal::~AliTOFCal()
97{
98 gROOT->GetListOfBrowsables()->Remove(this);
99 delete [] fPads;
100}
101//________________________________________________________________
102
103void AliTOFCal::Browse(TBrowser *b)
104{
105 char name[10];
106 for(Int_t i=0; i<fNSector; ++i) {
107 snprintf(name,sizeof(name),"Sector %2.2d",i);
108 b->Add(new AliTOFCalSector(&fPads[i*fnpad/fNSector]),name);
109 }
110}
111//________________________________________________________________
112
113void AliTOFCal::CreateArray(){
114 if(fGeom==0x0){
115 AliInfo("V5 TOF Geometry is taken as a default");
116 AliTOFGeometry *geom= new AliTOFGeometryV5();
117 fNSector = geom->NSectors();
118 fNPlate = geom->NPlates();
119 fNStripA = geom->NStripA();
120 fNStripB = geom->NStripB();
121 fNStripC = geom->NStripC();
122 fNpadZ = geom->NpadZ();
123 fNpadX = geom->NpadX();
124 fnpad = fNSector*(2*(fNStripC+fNStripB)+fNStripA)*fNpadZ*fNpadX;
125 delete geom;
126 }
127 fPads= new AliTOFChannel[fnpad];
128}