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