]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
7 | * full copyright notice. * | |
8 | **************************************************************************/ | |
9 | #include "AliEveTOFStrip.h" | |
8616d353 | 10 | |
84aff7a4 | 11 | #include <TEveManager.h> |
8616d353 | 12 | |
13 | #include <AliTOFdigit.h> | |
28a21457 | 14 | #include <AliTOFGeometry.h> |
8616d353 | 15 | |
16 | #include <TStyle.h> | |
d810d0de | 17 | |
8616d353 | 18 | using namespace std; |
19 | ||
d810d0de | 20 | Bool_t AliEveTOFStrip::fgStaticInitDone = kFALSE; |
21 | TEveFrameBox* AliEveTOFStrip::fgTOFstripFrameBox = 0; | |
22 | TEveRGBAPalette* AliEveTOFStrip::fgTOFstripPalette = 0; | |
8616d353 | 23 | |
24 | //_______________________________________________________ | |
d810d0de | 25 | ClassImp(AliEveTOFStrip) |
8616d353 | 26 | |
27 | /* ************************************************************************ */ | |
28 | ||
d810d0de | 29 | AliEveTOFStrip::AliEveTOFStrip(const Text_t* n, const Text_t* t) : |
84aff7a4 | 30 | TEveQuadSet(n, t), |
28a21457 | 31 | fTOFgeometry(new AliTOFGeometry()), |
8616d353 | 32 | fTOFarray(0), |
33 | fSector(-1), fPlate(-1), fStrip(-1), | |
34 | fDx(0), fDz(0) | |
35 | { | |
36 | ||
84aff7a4 | 37 | fGeoManager = (TGeoManager*)gEve->GetGeometry("$REVESYS/alice-data/alice_fullgeo.root"); |
8616d353 | 38 | if (!fGeoManager) printf("ERROR: no TGeo\n"); |
39 | ||
40 | } | |
41 | /* ************************************************************************ */ | |
42 | ||
d810d0de | 43 | AliEveTOFStrip::AliEveTOFStrip(TGeoManager *localGeoManager, |
8616d353 | 44 | Int_t nSector, Int_t nPlate, Int_t nStrip) |
45 | : | |
84aff7a4 | 46 | TEveQuadSet(Form("Strip%i",nStrip)), |
28a21457 | 47 | fTOFgeometry(new AliTOFGeometry()), |
8616d353 | 48 | fTOFarray(0), |
49 | fSector(nSector), fPlate(nPlate), fStrip(nStrip), | |
50 | fDx(0), fDz(0), | |
51 | fGeoManager(localGeoManager) | |
52 | { | |
53 | ||
54 | //if (!fGeoManager) printf("ERROR: no TGeo\n"); | |
55 | ||
56 | InitModule(); | |
57 | ||
58 | } | |
59 | /* ************************************************************************ */ | |
60 | ||
d810d0de | 61 | AliEveTOFStrip::AliEveTOFStrip(TGeoManager *localGeoManager, |
8616d353 | 62 | Int_t nSector, Int_t nPlate, Int_t nStrip, |
63 | TClonesArray *tofArray) | |
64 | : | |
84aff7a4 | 65 | TEveQuadSet(Form("Strip%i",nStrip)), |
28a21457 | 66 | fTOFgeometry(new AliTOFGeometry()), |
8616d353 | 67 | fTOFarray(tofArray), |
68 | fSector(nSector), fPlate(nPlate), fStrip(nStrip), | |
69 | fDx(0), fDz(0), | |
70 | fGeoManager(localGeoManager) | |
71 | { | |
72 | ||
73 | InitModule(); | |
74 | ||
75 | } | |
76 | /* ************************************************************************ */ | |
77 | ||
d810d0de | 78 | AliEveTOFStrip::~AliEveTOFStrip() |
8616d353 | 79 | { |
80 | ||
81 | fGeoManager = 0x0; | |
82 | delete fGeoManager; | |
83 | ||
84 | fTOFarray = 0x0; | |
85 | delete fTOFarray; | |
86 | ||
87 | } | |
88 | ||
89 | /* ************************************************************************ */ | |
90 | /* | |
d810d0de | 91 | void AliEveTOFStrip::SetDigitsInfo(AliEveTOFDigitsInfo* info) |
8616d353 | 92 | { |
93 | if(fInfo) fInfo->DecRefCount(); | |
94 | fInfo = info; | |
95 | if(fInfo) fInfo->IncRefCount(); | |
96 | ||
97 | } | |
98 | */ | |
99 | /* ************************************************************************ */ | |
d810d0de | 100 | void AliEveTOFStrip::InitStatics() |
8616d353 | 101 | { |
102 | if (fgStaticInitDone) return; | |
103 | ||
104 | Float_t dx = 2.5*48; | |
105 | Float_t dz = 3.5*2; | |
84aff7a4 | 106 | fgTOFstripFrameBox = new TEveFrameBox(); |
8616d353 | 107 | |
108 | fgTOFstripFrameBox->SetAAQuadXZ(-dx*0.5, 0, -dz*0.5, dx, dz); | |
109 | fgTOFstripFrameBox->SetFrameColor((Color_t) 32);//31); | |
110 | ||
84aff7a4 | 111 | //fgTOFstripPalette = new TEveRGBAPalette(0, 2048); // TOT |
112 | fgTOFstripPalette = new TEveRGBAPalette(0, 8192); // TDC | |
8616d353 | 113 | |
114 | fgStaticInitDone = kTRUE; | |
115 | } | |
116 | ||
117 | /* ************************************************************************ */ | |
d810d0de | 118 | void AliEveTOFStrip::InitModule() |
8616d353 | 119 | { |
120 | ||
121 | fDx = fTOFgeometry->XPad()*fTOFgeometry->NpadX(); | |
122 | fDz = fTOFgeometry->ZPad()*fTOFgeometry->NpadZ(); | |
123 | ||
124 | if (!fgStaticInitDone) InitStatics(); | |
125 | ||
126 | SetFrame(fgTOFstripFrameBox); | |
127 | SetPalette(fgTOFstripPalette); | |
128 | //fFrame = fgTOFstripFrameBox; | |
129 | //fPalette = fgTOFstripPalette; | |
130 | ||
131 | LoadQuads(); | |
132 | ComputeBBox(); | |
133 | SetTrans(); | |
134 | ||
135 | } | |
136 | ||
137 | /* ************************************************************************ */ | |
d810d0de | 138 | void AliEveTOFStrip::LoadQuads() |
8616d353 | 139 | { |
140 | ||
141 | //Int_t n_col = gStyle->GetNumberOfColors(); | |
142 | ||
143 | Int_t iPadX = -1; | |
144 | Int_t iPadZ = -1; | |
145 | Int_t tdc = -1; | |
146 | Int_t tot = -1; | |
147 | Float_t x = -1; | |
148 | Float_t z = -1; | |
149 | ||
84aff7a4 | 150 | Reset(kQT_RectangleXZFixedY, kFALSE, 32); |
8616d353 | 151 | |
152 | AliTOFdigit *tofDigit; | |
153 | ||
154 | //printf(" fTOFarray->GetEntries() = %4i \n",fTOFarray->GetEntries()); | |
155 | ||
156 | for (Int_t ii=0; ii<fTOFarray->GetEntries(); ii++) { | |
157 | ||
158 | tofDigit = (AliTOFdigit*)fTOFarray->UncheckedAt(ii); | |
159 | ||
160 | iPadX = tofDigit->GetPadx(); | |
161 | iPadZ = tofDigit->GetPadz(); | |
162 | ||
163 | tot = tofDigit->GetToT(); | |
164 | tdc = tofDigit->GetTdc(); | |
165 | ||
166 | //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %2i %1i\n", iPadX, iPadZ); | |
167 | //if (iPadX==23 || iPadX==24) printf(" %2i %1i %2i \n", fSector, fPlate, fStrip); | |
168 | ||
169 | fTOFgeometry->DetToStripRF(iPadX, iPadZ, x, z); | |
170 | ||
171 | AddQuad(x, z, 2.5, 3.5); | |
172 | //AddQuad(-2.5*0.5, -3.5*0.5, 2.5, 3.5); | |
173 | ||
174 | // In principle could have color based on number of neigbours. We | |
175 | // can insert the time-of-flight value for each pad | |
176 | //QuadValue((Int_t)tot); | |
177 | QuadValue((Int_t)tdc); | |
178 | ||
179 | //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %1i %2i %f %f \n", iPadZ, iPadX, x, z); | |
180 | ||
181 | } | |
182 | ||
183 | RefitPlex(); | |
184 | ||
185 | } | |
186 | ||
187 | /* ************************************************************ */ | |
d810d0de | 188 | void AliEveTOFStrip::SetTrans() |
8616d353 | 189 | { |
190 | ||
191 | fHMTrans.UnitTrans(); | |
192 | ||
193 | //Int_t det[5] = {fSector, fPlate, fStrip, -1, -1}; | |
194 | Char_t path[100]; | |
195 | //fTOFgeometry->GetVolumePath(det,path); | |
196 | fTOFgeometry->GetVolumePath(fSector, fPlate, fStrip, path); | |
197 | ||
198 | fGeoManager->cd(path); | |
199 | TGeoHMatrix global = *fGeoManager->GetCurrentMatrix(); | |
200 | Double_t *rotMat = global.GetRotationMatrix(); | |
201 | ||
202 | /* | |
203 | // ok till 19 April 2007 | |
204 | fHMTrans.SetBaseVec(1, rotMat[0], rotMat[1], rotMat[2]); | |
205 | fHMTrans.SetBaseVec(2, rotMat[3], rotMat[4], rotMat[5]); | |
206 | fHMTrans.SetBaseVec(3, rotMat[6], rotMat[7], rotMat[8]); | |
207 | */ | |
208 | ||
209 | fHMTrans.SetBaseVec(1, rotMat[0], rotMat[3], rotMat[6]); | |
210 | fHMTrans.SetBaseVec(2, rotMat[1], rotMat[4], rotMat[7]); | |
211 | fHMTrans.SetBaseVec(3, rotMat[2], rotMat[5], rotMat[8]); | |
212 | ||
213 | Double_t *tr = global.GetTranslation(); | |
214 | fHMTrans.SetBaseVec(4, tr); | |
215 | ||
216 | } |