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