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