]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHv3.cxx
StepManager and CreateMaterials removed (inherited from AliRICH) (J. Barbosa)
[u/mrichter/AliRoot.git] / RICH / AliRICHv3.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 #include "AliRICHv3.h"
17 #include "AliRun.h"
18 #include "AliMC.h"
19 #include "AliMagF.h"
20
21 #include "AliConst.h"
22 #include "AliPDG.h"
23
24 #include <Riostream.h>
25 #include <TNode.h>
26 #include <TGeometry.h>
27 #include <TBRIK.h>
28
29 #include <TLorentzVector.h>
30 #include <TVector3.h>
31 #include <TParticle.h>
32
33
34 #include "AliRICHGeometry.h"
35 #include "AliRICHSegmentationV1.h"
36 #include "AliRICHResponseV0.h"
37 #include "AliRICHHit.h"
38
39 ClassImp(AliRICHv3)
40
41 //______________________________________________________________
42 //    Implementation of the RICH version 3 with azimuthal rotation
43
44
45 AliRICHv3::AliRICHv3(const char *sName, const char *sTitle)
46           :AliRICH(sName,sTitle)
47 {
48 // The named ctor currently creates a single copy of 
49 // AliRICHGeometry AliRICHSegmentationV1 AliRICHResponseV0
50 // and initialises the corresponding models of all 7 chambers with these stuctures.
51 // Note: all chambers share the single copy of models. MUST be changed later (???).
52    cout<<ClassName()<<"::named ctor(sName,sTitle)>\n"; // no way to control it as ctor is called before call to SetDebugXXXX()
53
54    fCkovNumber=fFreonProd=fDebugLevel=0;
55    
56    AliRICHGeometry       *pRICHGeometry    =new AliRICHGeometry;           // ??? to be moved to AlRICHChamber::named ctor
57    AliRICHSegmentationV1 *pRICHSegmentation=new AliRICHSegmentationV1;     // ??? to be moved to AlRICHChamber::named ctor
58    AliRICHResponseV0     *pRICHResponse    =new AliRICHResponseV0;         // ??? to be moved to AlRICHChamber::named ctor
59      
60    fChambers = new TObjArray(kNCH);
61    for (Int_t i=0; i<kNCH; i++){    
62       fChambers->AddAt(new AliRICHChamber,i); // ??? to be changed to named ctor of AliRICHChamber
63       SetGeometryModel(i,pRICHGeometry);
64       SetSegmentationModel(i,pRICHSegmentation);
65       SetResponseModel(i,pRICHResponse);
66       ((AliRICHChamber*)fChambers->At(i))->Init(i); // ??? to be removed     
67    }
68 }//AliRICHv3::ctor(const char *pcName, const char *pcTitle)
69
70 AliRICHv3::~AliRICHv3()
71 {
72 // Dtor deletes RICH models. In future (???) AliRICHChamber will be responsible for that.
73    if(IsDebugStart()) cout<<ClassName()<<"::dtor()>\n";
74       
75    delete GetChamber(0)->GetGeometryModel();
76    delete GetChamber(0)->GetResponseModel();
77    delete GetChamber(0)->GetSegmentationModel();
78 }//AliRICHv3::dtor()
79
80
81 void AliRICHv3::CreateGeometry()
82 {
83 // Provides geometry structure for simulation (currently GEANT volumes tree)         
84    if(IsDebugStart()) cout<<ClassName()<<"::CreateGeometry()>\n";
85
86   AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH"); 
87   AliRICHSegmentationV0*  segmentation;
88   AliRICHGeometry*  geometry;
89   AliRICHChamber*       iChamber;
90
91   iChamber = &(pRICH->Chamber(0));
92   segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel(0);
93   geometry=iChamber->GetGeometryModel();
94
95   Float_t distance;
96   distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness();
97   geometry->SetRadiatorToPads(distance);
98     
99   //Opaque quartz thickness
100   Float_t oqua_thickness = .5;
101   //CsI dimensions
102
103
104   Float_t csi_width = segmentation->Npx()*segmentation->Dpx() + segmentation->DeadZone();
105   Float_t csi_length = segmentation->Npy()*segmentation->Dpy() + 2*segmentation->DeadZone();
106   
107   
108   Int_t *idtmed = fIdtmed->GetArray()-999;
109     
110     Int_t i;
111     Float_t zs;
112     Int_t idrotm[1099];
113     Float_t par[3];
114     
115     // --- Define the RICH detector 
116     //     External aluminium box 
117     par[0] = 68.8;
118     par[1] = 13;                 //Original Settings
119     par[2] = 70.86;
120     gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
121     
122     //     Air 
123     par[0] = 66.3;
124     par[1] = 13;                 //Original Settings
125     par[2] = 68.35;
126     gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
127     
128     //    Air 2 (cutting the lower part of the box)
129     
130     par[0] = 1.25;
131     par[1] = 3;                 //Original Settings
132     par[2] = 70.86;
133     gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
134
135     //    Air 3 (cutting the lower part of the box)
136     
137     par[0] = 66.3;
138     par[1] = 3;                 //Original Settings
139     par[2] = 1.2505;
140     gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
141     
142     //     Honeycomb 
143     par[0] = 66.3;
144     par[1] = .188;                 //Original Settings
145     par[2] = 68.35;
146     gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
147     
148     //     Aluminium sheet 
149     par[0] = 66.3;
150     par[1] = .025;                 //Original Settings
151     par[2] = 68.35;
152     /*par[0] = 66.5;
153     par[1] = .025;
154     par[2] = 63.1;*/
155     gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
156     
157     //     Quartz 
158     par[0] = geometry->GetQuartzWidth()/2;
159     par[1] = geometry->GetQuartzThickness()/2;
160     par[2] = geometry->GetQuartzLength()/2;
161     gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
162     
163     //     Spacers (cylinders) 
164     par[0] = 0.;
165     par[1] = .5;
166     par[2] = geometry->GetFreonThickness()/2;
167     gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
168     
169     //     Feet (freon slabs supports)
170
171     par[0] = .7;
172     par[1] = .3;
173     par[2] = 1.9;
174     gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
175
176     //     Opaque quartz 
177     par[0] = geometry->GetQuartzWidth()/2;
178     par[1] = .2;
179     par[2] = geometry->GetQuartzLength()/2;
180     gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
181   
182     //     Frame of opaque quartz
183     par[0] = geometry->GetOuterFreonWidth()/2;
184     par[1] = geometry->GetFreonThickness()/2;
185     par[2] = geometry->GetOuterFreonLength()/2; 
186     gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
187
188     par[0] = geometry->GetInnerFreonWidth()/2;
189     par[1] = geometry->GetFreonThickness()/2;
190     par[2] = geometry->GetInnerFreonLength()/2; 
191     gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
192     
193     
194     //     Freon 
195     par[0] = geometry->GetOuterFreonWidth()/2 - oqua_thickness;
196     par[1] = geometry->GetFreonThickness()/2;
197     par[2] = geometry->GetOuterFreonLength()/2 - 2*oqua_thickness; 
198     gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
199
200     par[0] = geometry->GetInnerFreonWidth()/2 - oqua_thickness;
201     par[1] = geometry->GetFreonThickness()/2;
202     par[2] = geometry->GetInnerFreonLength()/2 - 2*oqua_thickness; 
203     gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
204     
205     //     Methane 
206     par[0] = csi_width/2;
207     par[1] = geometry->GetGapThickness()/2;
208     par[2] = csi_length/2;
209     gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
210     
211     //     Methane gap 
212     par[0] = csi_width/2;
213     par[1] = geometry->GetProximityGapThickness()/2;
214     par[2] = csi_length/2;
215     gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
216     
217     //     CsI photocathode 
218     par[0] = csi_width/2;
219     par[1] = .25;
220     par[2] = csi_length/2;
221     gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
222     
223     //     Anode grid 
224     par[0] = 0.;
225     par[1] = .001;
226     par[2] = 20.;
227     gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
228
229     // Wire supports
230     // Bar of metal
231     
232     par[0] = csi_width/2;
233     par[1] = 1.05;
234     par[2] = 1.05;
235     gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
236
237     // Ceramic pick up (base)
238     
239     par[0] =  csi_width/2;
240     par[1] = .25;
241     par[2] = 1.05;
242     gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
243
244     // Ceramic pick up (head)
245
246     par[0] = csi_width/2;
247     par[1] = .1;
248     par[2] = .1;
249     gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
250
251     // Aluminium supports for methane and CsI
252     // Short bar
253
254     par[0] = csi_width/2;
255     par[1] = geometry->GetGapThickness()/2 + .25;
256     par[2] = (68.35 - csi_length/2)/2;
257     gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
258     
259     // Long bar
260
261     par[0] = (66.3 - csi_width/2)/2;
262     par[1] = geometry->GetGapThickness()/2 + .25;
263     par[2] = csi_length/2 + 68.35 - csi_length/2;
264     gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
265     
266     // Aluminium supports for freon
267     // Short bar
268
269     par[0] = geometry->GetQuartzWidth()/2;
270     par[1] = .3;
271     par[2] = (68.35 - geometry->GetQuartzLength()/2)/2;
272     gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
273     
274     // Long bar
275
276     par[0] = (66.3 - geometry->GetQuartzWidth()/2)/2;
277     par[1] = .3;
278     par[2] = geometry->GetQuartzLength()/2 + 68.35 - geometry->GetQuartzLength()/2;
279     gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
280     
281     // PCB backplane
282     
283     par[0] = csi_width/2;
284     par[1] = .25;
285     par[2] = csi_length/4 -.5025;
286     gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
287
288     
289     // Backplane supports
290
291     // Aluminium slab
292     
293     par[0] = 33.15;
294     par[1] = 2;
295     par[2] = 21.65;
296     gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
297     
298     // Big hole
299     
300     par[0] = 9.05;
301     par[1] = 2;
302     par[2] = 4.4625;
303     gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
304
305     // Small hole
306     
307     par[0] = 5.7;
308     par[1] = 2;
309     par[2] = 4.4625;
310     gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
311
312     // Place holes inside backplane support
313
314     gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
315     gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
316     gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
317     gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
318     gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
319     gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
320     gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
321     gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
322     gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
323     gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
324     gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
325     gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
326     gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
327     gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
328     gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
329     gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
330
331     
332   
333     // --- Places the detectors defined with GSVOLU 
334     //     Place material inside RICH 
335     gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
336     gMC->Gspos("AIR2", 1, "RICH", 66.3 + 1.2505, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
337     gMC->Gspos("AIR2", 2, "RICH", -66.3 - 1.2505, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
338     gMC->Gspos("AIR3", 1, "RICH", 0.,  1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, -68.35 - 1.25, 0, "ONLY");
339     gMC->Gspos("AIR3", 2, "RICH", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35,  68.35 + 1.25, 0, "ONLY");
340     
341       
342     gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
343     gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- geometry->GetGapThickness()/2  - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
344     gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
345     gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
346     gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
347     gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
348     gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
349     gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
350     gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
351     gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
352     gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
353     gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .2, 0., 0, "ONLY");
354     
355     // Supports placing
356
357     // Methane supports
358     gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
359     gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
360     gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
361     gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
362
363     //Freon supports
364
365     Float_t supp_y = 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness() - .2 + .3; //y position of freon supports
366
367     gMC->Gspos("SFLG", 1, "SRIC", geometry->GetQuartzWidth()/2 + (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
368     gMC->Gspos("SFLG", 2, "SRIC", - geometry->GetQuartzWidth()/2 - (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
369     gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, geometry->GetQuartzLength()/2 + (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
370     gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - geometry->GetQuartzLength()/2 - (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
371     
372     AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
373     
374
375     Int_t nspacers = 30;
376     
377     for (i = 0; i < nspacers/3; i++) {
378         zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
379         gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY");  //Original settings 
380     }
381     
382     for (i = nspacers/3; i < (nspacers*2)/3; i++) {
383         zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
384         gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY");  //Original settings 
385     }
386     
387     for (i = (nspacers*2)/3; i < nspacers; ++i) {
388         zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
389         gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings  
390     }
391
392     for (i = 0; i < nspacers/3; i++) {
393         zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
394         gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY");  //Original settings 
395     }
396     
397     for (i = nspacers/3; i < (nspacers*2)/3; i++) {
398         zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
399         gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY");  //Original settings 
400     }
401     
402     for (i = (nspacers*2)/3; i < nspacers; ++i) {
403         zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
404         gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings  
405     }
406
407     
408     gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
409     gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
410     gMC->Gspos("OQF1", 1, "SRIC", geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2 + 2, 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3)
411     gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY");          //Original settings 
412     gMC->Gspos("OQF1", 3, "SRIC", - (geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2) - 2, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY");       //Original settings (-31.3)
413     gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness()/2, 0., 0, "ONLY");
414     gMC->Gspos("GAP ", 1, "META", 0., geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
415     gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
416     gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + geometry->GetGapThickness()/2 + .25, 0., 0, "ONLY");
417     printf("CSI pos: %f\n",1.276 + geometry->GetGapThickness()/2 + .25);
418    
419     // Wire support placing
420
421     gMC->Gspos("WSG2", 1, "GAP ", 0., geometry->GetProximityGapThickness()/2 - .1, 0., 0, "ONLY");
422     gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
423     gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
424
425     // Backplane placing
426     
427     gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
428     gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
429     gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
430     gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
431     gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
432     gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
433
434     // PCB placing
435     
436     gMC->Gspos("PCB ", 1, "SRIC ", 0.,  1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
437     gMC->Gspos("PCB ", 2, "SRIC ", 0.,  1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
438
439 // Place chambers into mother volume ALIC
440            
441    Double_t dOffset        = geometry->GetOffset() - geometry->GetGapThickness()/2;  // distance from center of mother volume ALIC to methane
442    
443    Double_t dAlpha         = geometry->GetAlphaAngle(); // angle between centers of chambers - y-z plane
444    Double_t dAlphaRad      = dAlpha*kDegrad;
445    
446    Double_t dBeta          = geometry->GetBetaAngle();   // angle between center of chambers - y-x plane
447    Double_t dBetaRad       = dBeta*kDegrad;
448    
449    Double_t dRotAngle      = geometry->GetRotationAngle();     // the whole RICH is to be rotated in x-y plane + means clockwise rotation 
450    Double_t dRotAngleRad   = dRotAngle*kDegrad;
451     
452    
453    TRotMatrix *pRotMatrix; // tmp pointer
454    
455    TVector3 vector(0,dOffset,0); // Position of chamber 2 without rotation
456     
457 // Chamber 0  standalone (no other chambers in this row) 
458    pRotMatrix = new TRotMatrix("rot993","rot993", 0., 0., 0.,0.,0.,0.);
459    const Double_t* r   = pRotMatrix->SetAngles(90., 0., 90.-dAlpha , 90.,  dAlpha, -90.);
460    Double_t* rr  = RotateXY(r, -dRotAngleRad);
461    AliMatrix(idrotm[1000], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
462    pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
463
464    vector.SetXYZ(0,dOffset,0);  vector.RotateX(dAlphaRad); 
465    vector.RotateZ(-dRotAngleRad);
466    
467    gMC->Gspos("RICH",1,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1000], "ONLY");           
468    Chamber(0).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
469 // Chamber 1   
470    pRotMatrix = new TRotMatrix("rot994","rot994", 0., 0., 0.,0.,0.,0.);
471    r   = pRotMatrix->SetAngles(90., -dBeta, 90., 90.-dBeta,  0., 0.);
472    rr  = RotateXY(r, -dRotAngleRad);
473    AliMatrix(idrotm[1001], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
474    pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
475    vector.SetXYZ(0,dOffset,0);  vector.RotateZ(-dBetaRad); 
476    vector.RotateZ(-dRotAngleRad);
477    
478    gMC->Gspos("RICH",2,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1001], "ONLY");           
479    Chamber(1).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
480
481 // Chamber 2   the top one with no Alpha-Beta rotation
482    pRotMatrix = new TRotMatrix("rot995","rot995", 0., 0., 0.,0.,0.,0.);
483    r   = pRotMatrix->SetAngles(90., 0., 90., 90.,  0., 0.);
484    rr  = RotateXY(r, -dRotAngleRad);
485    AliMatrix(idrotm[1002], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
486    pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
487    vector.SetXYZ(0,dOffset,0);
488    vector.RotateZ(-dRotAngleRad);
489    gMC->Gspos("RICH",3,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1002], "ONLY");           
490    Chamber(2).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
491 // Chamber 3
492    pRotMatrix = new TRotMatrix("rot996","rot996", 0., 0., 0.,0.,0.,0.);
493    r   = pRotMatrix->SetAngles(90., dBeta, 90., 90.+dBeta,  0., 0.);
494    rr  = RotateXY(r, -dRotAngleRad);
495    AliMatrix(idrotm[1003], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
496    pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
497    vector.SetXYZ(0,dOffset,0);  vector.RotateZ(dBetaRad); 
498    vector.RotateZ(-dRotAngleRad);
499    
500    gMC->Gspos("RICH",4,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1003], "ONLY");           
501    Chamber(3).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
502
503 // Chamber 4   
504    pRotMatrix = new TRotMatrix("rot997","rot997", 0., 0., 0.,0.,0.,0.);
505    r   = pRotMatrix->SetAngles(90., 360.-dBeta, 108.2, 90.-dBeta,  18.2, 90.-dBeta);
506    rr  = RotateXY(r, -dRotAngleRad);
507    AliMatrix(idrotm[1004], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
508    pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
509    vector.SetXYZ(0,dOffset,0);  vector.RotateZ(-dBetaRad); vector.RotateX(-dAlphaRad); 
510    vector.RotateZ(-dRotAngleRad);
511    
512    gMC->Gspos("RICH",5,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1004], "ONLY");
513    Chamber(4).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
514 // Chamber 5   
515    pRotMatrix = new TRotMatrix("rot998","rot998", 0., 0., 0.,0.,0.,0.);
516    r   = pRotMatrix->SetAngles(90., 0., 90.+dAlpha, 90.,  dAlpha, 90.);
517    rr  = RotateXY(r, -dRotAngleRad);
518    AliMatrix(idrotm[1005], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
519    pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);   
520    vector.SetXYZ(0,dOffset,0); vector.RotateX(-dAlphaRad); 
521    vector.RotateZ(-dRotAngleRad);
522       
523    gMC->Gspos("RICH",6,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1005], "ONLY");           
524    Chamber(5).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
525 // Chamber 6          
526    pRotMatrix = new TRotMatrix("rot999","rot999", 0., 0., 0.,0.,0.,0.);
527    r   = pRotMatrix->SetAngles(90., dBeta, 108.2, 90.+dBeta,  18.2, 90.+dBeta);
528    rr  = RotateXY(r, -dRotAngleRad);
529    AliMatrix(idrotm[1006], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
530    pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
531    vector.SetXYZ(0,dOffset,0);  vector.RotateZ(dBetaRad); vector.RotateX(-dAlphaRad); 
532    vector.RotateZ(-dRotAngleRad);
533       
534    gMC->Gspos("RICH",7,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1006], "ONLY");
535    Chamber(6).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
536       
537 }//void AliRICHv3::CreateGeometry()
538
539
540
541
542 void AliRICHv3::Init()
543 {
544 // Makes nothing for a while   
545    if(IsDebugStart()) cout<<ClassName()<<"::Init()>\n";
546     
547 }
548
549
550
551 void AliRICHv3::BuildGeometry()    
552 {                                      
553 // Provides geometry structure for event display (ROOT TNode tree)
554    
555    if(IsDebugStart()) cout<<ClassName()<<"::BuildGeometry()>\n";
556   
557     TNode *node, *subnode, *top;
558     
559     const int kColorRICH = kRed;
560     //
561     top=gAlice->GetGeometry()->GetNode("alice");
562
563     AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH"); 
564     AliRICHChamber*       iChamber;
565     AliRICHGeometry*  geometry;
566  
567     iChamber = &(pRICH->Chamber(0));
568     AliRICHSegmentationV1* segmentation=(AliRICHSegmentationV1*) iChamber->GetSegmentationModel(0);
569     geometry=iChamber->GetGeometryModel();
570     
571     new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
572
573     Float_t padplane_width = segmentation->GetPadPlaneWidth();
574     Float_t padplane_length = segmentation->GetPadPlaneLength();
575
576
577     new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
578
579 // Chamber 0             
580     top->cd();
581     node = new TNode("RICH1","RICH1","S_RICH",Chamber(0).GetX(),Chamber(0).GetY(),Chamber(0).GetZ(),"rot993");
582     node->SetLineColor(kColorRICH);
583     node->cd();
584     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
585     subnode->SetLineColor(kGreen);
586     fNodes->Add(subnode);
587     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
588     subnode->SetLineColor(kGreen);
589     fNodes->Add(subnode);
590     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
591     subnode->SetLineColor(kGreen);
592     fNodes->Add(subnode);
593     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
594     subnode->SetLineColor(kGreen);
595     fNodes->Add(subnode);
596     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
597     subnode->SetLineColor(kGreen);
598     fNodes->Add(subnode);
599     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
600     subnode->SetLineColor(kGreen);
601     fNodes->Add(subnode);
602     fNodes->Add(node);
603
604 // Chamber 1
605     top->cd(); 
606     node = new TNode("RICH2","RICH2","S_RICH",Chamber(1).GetX(),Chamber(1).GetY(),Chamber(1).GetZ(),"rot994");
607     node->SetLineColor(kColorRICH);
608     node->cd();
609     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
610     subnode->SetLineColor(kGreen);
611     fNodes->Add(subnode);
612     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
613     subnode->SetLineColor(kGreen);
614     fNodes->Add(subnode);
615     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
616     subnode->SetLineColor(kGreen);
617     fNodes->Add(subnode);
618     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
619     subnode->SetLineColor(kGreen);
620     fNodes->Add(subnode);
621     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
622     subnode->SetLineColor(kGreen);
623     fNodes->Add(subnode);
624     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
625     subnode->SetLineColor(kGreen);
626     fNodes->Add(subnode);
627     fNodes->Add(node);
628
629 // Chamber 2
630     top->cd();
631     node = new TNode("RICH3","RICH3","S_RICH",Chamber(2).GetX(),Chamber(2).GetY(),Chamber(2).GetZ(),"rot995");
632     node->SetLineColor(kColorRICH);
633     node->cd();
634     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
635     subnode->SetLineColor(kGreen);
636     fNodes->Add(subnode);
637     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
638     subnode->SetLineColor(kGreen);
639     fNodes->Add(subnode);
640     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
641     subnode->SetLineColor(kGreen);
642     fNodes->Add(subnode);
643     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
644     subnode->SetLineColor(kGreen);
645     fNodes->Add(subnode);
646     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
647     subnode->SetLineColor(kGreen);
648     fNodes->Add(subnode);
649     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
650     subnode->SetLineColor(kGreen);
651     fNodes->Add(subnode);
652     fNodes->Add(node);
653     
654 // Chamber 3
655     top->cd();
656     node = new TNode("RICH4","RICH4","S_RICH",Chamber(3).GetX(),Chamber(3).GetY(),Chamber(3).GetZ(),"rot996");
657     node->SetLineColor(kColorRICH);
658     node->cd();
659     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
660     subnode->SetLineColor(kGreen);
661     fNodes->Add(subnode);
662     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
663     subnode->SetLineColor(kGreen);
664     fNodes->Add(subnode);
665     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
666     subnode->SetLineColor(kGreen);
667     fNodes->Add(subnode);
668     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
669     subnode->SetLineColor(kGreen);
670     fNodes->Add(subnode);
671     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
672     subnode->SetLineColor(kGreen);
673     fNodes->Add(subnode);
674     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
675     subnode->SetLineColor(kGreen);
676     fNodes->Add(subnode);
677     fNodes->Add(node);
678
679 // Chamber 4
680     top->cd();
681     node = new TNode("RICH5","RICH5","S_RICH",Chamber(4).GetX(),Chamber(4).GetY(),Chamber(4).GetZ(),"rot997");
682     node->SetLineColor(kColorRICH);
683     node->cd();
684     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
685     subnode->SetLineColor(kGreen);
686     fNodes->Add(subnode);
687     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
688     subnode->SetLineColor(kGreen);
689     fNodes->Add(subnode);
690     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
691     subnode->SetLineColor(kGreen);
692     fNodes->Add(subnode);
693     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
694     subnode->SetLineColor(kGreen);
695     fNodes->Add(subnode);
696     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
697     subnode->SetLineColor(kGreen);
698     fNodes->Add(subnode);
699     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
700     subnode->SetLineColor(kGreen);
701     fNodes->Add(subnode);
702     fNodes->Add(node);
703
704 // Chamber 5
705     top->cd();
706     node = new TNode("RICH6","RICH6","S_RICH",Chamber(5).GetX(),Chamber(5).GetY(),Chamber(5).GetZ(),"rot998");
707     node->SetLineColor(kColorRICH);
708     fNodes->Add(node);node->cd();
709     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
710     subnode->SetLineColor(kGreen);
711     fNodes->Add(subnode);
712     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
713     subnode->SetLineColor(kGreen);
714     fNodes->Add(subnode);
715     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
716     subnode->SetLineColor(kGreen);
717     fNodes->Add(subnode);
718     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
719     subnode->SetLineColor(kGreen);
720     fNodes->Add(subnode);
721     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
722     subnode->SetLineColor(kGreen);
723     fNodes->Add(subnode);
724     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
725     subnode->SetLineColor(kGreen);
726     fNodes->Add(subnode);
727
728 // Chamber 6
729     top->cd();
730     node = new TNode("RICH7","RICH7","S_RICH",Chamber(6).GetX(),Chamber(6).GetY(),Chamber(6).GetZ(),"rot999");
731     node->SetLineColor(kColorRICH);
732     node->cd();
733     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
734     subnode->SetLineColor(kGreen);
735     fNodes->Add(subnode);
736     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
737     subnode->SetLineColor(kGreen);
738     fNodes->Add(subnode);
739     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
740     subnode->SetLineColor(kGreen);
741     fNodes->Add(subnode);
742     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
743     subnode->SetLineColor(kGreen);
744     fNodes->Add(subnode);
745     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
746     subnode->SetLineColor(kGreen);
747     fNodes->Add(subnode);
748     subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
749     subnode->SetLineColor(kGreen);
750     fNodes->Add(subnode);
751     fNodes->Add(node); 
752     
753 }//AliRICHv3::BuildGeometry()
754
755
756 Double_t* AliRICHv3::RotateXY(const Double_t* r, Double_t a)
757 {
758     // Rotatation in xy-plane
759     // by angle a
760     // The resulting rotation matrix is given back in the G3 notation. 
761     Double_t* rr = new Double_t[6];
762     Double_t m[9];
763     Int_t i,j,k;
764     
765     for (i = 0; i < 3; i++) {
766         j = 3*i;
767         m[j]   = r[j] * TMath::Cos(a) - r[j+1] * TMath::Sin(a);
768         m[j+1] = r[j] * TMath::Sin(a) + r[j+1] * TMath::Cos(a);
769         m[j+2] = r[j+2];
770     }
771     
772     for (i = 0; i < 3; i++) {
773             j = 3*i;
774             k = 2*i;
775             rr[k]    = TMath::ACos(m[j+2])        * kRaddeg;
776             rr[k+1]  = TMath::ATan2(m[j+1], m[j]) * kRaddeg;
777     }
778     return rr;
779 }