Add classes for TOF Calibration (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 /*$Log$
17 author: Chiara Zampolli, zampolli@bo.infn.it
18  */  
19
20 ///////////////////////////////////////////////////////////////////////////////
21 //                                                                           //
22 // class for TOF calibration : array of AliTOFChannels                       //
23 //                                                                           //
24 ///////////////////////////////////////////////////////////////////////////////
25
26 #include "TObject.h"
27 #include "TROOT.h"
28 #include "TBrowser.h"
29 #include "TClass.h"
30 #include "AliTOFGeometryV4.h"
31 #include "AliTOFCalSector.h"
32 #include "AliTOFCal.h"
33 #include "AliTOFChannel.h"
34
35 extern TROOT *gROOT;
36
37 ClassImp(AliTOFCal)
38
39 //________________________________________________________________
40
41 AliTOFCal::AliTOFCal():TObject(){
42   // fCalp = 0;
43   fNSector = AliTOFGeometryV4::NSectors();
44   fNPlate = AliTOFGeometryV4::NPlates();
45   fNStripA = AliTOFGeometryV4::NStripA();
46   fNStripB = AliTOFGeometryV4::NStripB();
47   //  fNStripC = AliTOFGeometryV4::NStripC();
48   fNStripC = 20;
49   fNpadZ = AliTOFGeometryV4::NpadZ();
50   fNpadX = AliTOFGeometryV4::NpadX();
51   fnpad = 0;
52   fPads = 0x0;
53   gROOT->GetListOfBrowsables()->Add(this);
54 }
55 //________________________________________________________________
56
57 AliTOFCal::AliTOFCal(const AliTOFCal& cal):
58   TObject(cal)
59   {
60     fNSector = cal.fNSector;
61     fNPlate = cal.fNPlate;
62     fNStripA = cal.fNStripA;
63     fNStripB = cal.fNStripB;
64     fNStripC = cal.fNStripC;
65     fNpadZ = cal.fNpadZ;
66     fNpadX = cal.fNpadX;
67     fnpad = cal.fnpad;
68     for (Int_t i = 0; i<fnpad; i++){
69       fPads[i]=cal.fPads[i];
70     }
71     gROOT->GetListOfBrowsables()->Add(this);
72   }
73 //____________________________________________________________________________ 
74 AliTOFCal::~AliTOFCal()
75 {
76   delete [] fPads;
77 }
78 //________________________________________________________________
79
80 void AliTOFCal::Browse(TBrowser *b)
81 {
82   char name[10];
83   for(Int_t i=0; i<fNSector; ++i) {
84     snprintf(name,sizeof(name),"Sector %2.2d",i);
85     b->Add(new AliTOFCalSector(&fPads[i*fnpad/fNSector]),name);
86   }
87 }
88 //________________________________________________________________
89
90 void AliTOFCal::CreateArray(){
91   fnpad = AliTOFGeometryV4::NSectors()*(2*(20+AliTOFGeometryV4::NStripB())+AliTOFGeometryV4::NStripA())*AliTOFGeometryV4::NpadZ()*AliTOFGeometryV4::NpadX();
92   fPads= new AliTOFChannel[fnpad];
93 }