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