]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHv3.cxx
restyled Print
[u/mrichter/AliRoot.git] / RICH / AliRICHv3.cxx
CommitLineData
9123a941 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"
9123a941 18#include "AliMC.h"
19#include "AliMagF.h"
9123a941 20
9d6c0962 21#include "AliConst.h"
22#include "AliPDG.h"
23
7118aef0 24#include <Riostream.h>
9123a941 25#include <TNode.h>
26#include <TGeometry.h>
27#include <TBRIK.h>
28
9d6c0962 29#include <TLorentzVector.h>
30#include <TVector3.h>
31#include <TParticle.h>
32
33
ae714751 34#include "AliRICHGeometry.h"
35#include "AliRICHSegmentationV1.h"
36#include "AliRICHResponseV0.h"
9d6c0962 37#include "AliRICHHit.h"
ae714751 38
9d6c0962 39ClassImp(AliRICHv3)
ae714751 40
9d6c0962 41//______________________________________________________________
42// Implementation of the RICH version 3 with azimuthal rotation
9123a941 43
9123a941 44
9d6c0962 45AliRICHv3::AliRICHv3(const char *sName, const char *sTitle)
46 :AliRICH(sName,sTitle)
9123a941 47{
9d6c0962 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()
9123a941 53
ae714751 54 fCkovNumber=fFreonProd=fDebugLevel=0;
55
9d6c0962 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
ae714751 59
9123a941 60 fChambers = new TObjArray(kNCH);
61 for (Int_t i=0; i<kNCH; i++){
9d6c0962 62 fChambers->AddAt(new AliRICHChamber,i); // ??? to be changed to named ctor of AliRICHChamber
ae714751 63 SetGeometryModel(i,pRICHGeometry);
64 SetSegmentationModel(i,pRICHSegmentation);
65 SetResponseModel(i,pRICHResponse);
9d6c0962 66 ((AliRICHChamber*)fChambers->At(i))->Init(i); // ??? to be removed
9123a941 67 }
68}//AliRICHv3::ctor(const char *pcName, const char *pcTitle)
69
9d6c0962 70AliRICHv3::~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
9123a941 80void AliRICHv3::CreateMaterials()
81{
9d6c0962 82// Provides material definition for simulation (currently GEANT)
ae714751 83 if(IsDebugStart()) cout<<ClassName()<<"::CreateMaterials()>\n";
9123a941 84
9d6c0962 85 Int_t isxfld = gAlice->Field()->Integ();
86 Float_t sxmgmx = gAlice->Field()->Max();
87 Int_t i;
9123a941 88
89
90 //Photons energy intervals
91 Float_t ppckov[26];
92 for (i=0;i<26;i++)
93 {
94 ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9;
95 //printf ("Energy intervals: %e\n",ppckov[i]);
96 }
97
98
99 //Refraction index for quarz
100 Float_t rIndexQuarz[26];
101 Float_t e1= 10.666;
102 Float_t e2= 18.125;
103 Float_t f1= 46.411;
104 Float_t f2= 228.71;
105 for (i=0;i<26;i++)
106 {
107 Float_t ene=ppckov[i]*1e9;
108 Float_t a=f1/(e1*e1 - ene*ene);
109 Float_t b=f2/(e2*e2 - ene*ene);
110 rIndexQuarz[i] = TMath::Sqrt(1. + a + b );
111 //printf ("rIndexQuarz: %e\n",rIndexQuarz[i]);
112 }
113
114 //Refraction index for opaque quarz, methane and grid
115 Float_t rIndexOpaqueQuarz[26];
116 Float_t rIndexMethane[26];
117 Float_t rIndexGrid[26];
118 for (i=0;i<26;i++)
119 {
120 rIndexOpaqueQuarz[i]=1;
121 rIndexMethane[i]=1.000444;
122 rIndexGrid[i]=1;
123 //printf ("rIndexOpaqueQuarz , etc: %e, %e, %e\n",rIndexOpaqueQuarz[i], rIndexMethane[i], rIndexGrid[i]=1);
124 }
125
126 //Absorption index for freon
127 Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987,
128 179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196,
129 7.069031, 4.461292, 2.028366, 1.293013, .577267, .40746, .334964, 0., 0., 0.};
130
131
132 Float_t abscoQuarz [26] = {105.8, 65.52, 48.58, 42.85, 35.79, 31.262, 28.598, 27.527, 25.007, 22.815, 21.004,
133 19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627,
134 .192, .1497, .10857};
135
136 //Absorption index for methane
137 Float_t abscoMethane[26];
138 for (i=0;i<26;i++)
139 {
140 abscoMethane[i]=AbsoCH4(ppckov[i]*1e9);
141 //printf("abscoMethane: %e for energy: %e\n", abscoMethane[i],ppckov[i]*1e9);
142 }
143
144 //Absorption index for opaque quarz, csi and grid, efficiency for all and grid
145 Float_t abscoOpaqueQuarz[26];
146 Float_t abscoCsI[26];
147 Float_t abscoGrid[26];
148 Float_t efficAll[26];
149 Float_t efficGrid[26];
150 for (i=0;i<26;i++)
151 {
152 abscoOpaqueQuarz[i]=1e-5;
153 abscoCsI[i]=1e-4;
154 abscoGrid[i]=1e-4;
155 efficAll[i]=1;
156 efficGrid[i]=1;
157 }
158
159 //Efficiency for csi
160
161 Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
162 0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999,
163 0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592,
164 0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987};
165
166
167
168 //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND
169 //UNPOLARIZED PHOTONS
170
171 for (i=0;i<26;i++)
172 {
173 efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0));
174 }
175
176
177 Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon,
178 zmet[2], zqua[2];
179 Int_t nlmatfre;
180 Float_t densquao;
181 Int_t nlmatmet, nlmatqua;
182 Float_t wmatquao[2], rIndexFreon[26];
183 Float_t aquao[2], epsil, stmin, zquao[2];
184 Int_t nlmatquao;
185 Float_t radlal, densal, tmaxfd, deemax, stemax;
186 Float_t aal, zal, radlgri, densfre, radlhon, densgri, denshon,densqua, densmet, wmatfre[2], wmatmet[2], wmatqua[2];
187
188 Int_t *idtmed = fIdtmed->GetArray()-999;
189
190 // --- Photon energy (GeV)
191 // --- Refraction indexes
192 for (i = 0; i < 26; ++i) {
193 rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
194 //rIndexFreon[i] = 1;
195 //printf ("rIndexFreon: %e \n efficCsI: %e for energy: %e\n",rIndexFreon[i], efficCsI[i], ppckov[i]);
196 }
197
198 // --- Detection efficiencies (quantum efficiency for CsI)
199 // --- Define parameters for honeycomb.
200 // Used carbon of equivalent rad. lenght
201
202 ahon = 12.01;
203 zhon = 6.;
204 denshon = 0.1;
205 radlhon = 18.8;
206
207 // --- Parameters to include in GSMIXT, relative to Quarz (SiO2)
208
209 aqua[0] = 28.09;
210 aqua[1] = 16.;
211 zqua[0] = 14.;
212 zqua[1] = 8.;
213 densqua = 2.64;
214 nlmatqua = -2;
215 wmatqua[0] = 1.;
216 wmatqua[1] = 2.;
217
218 // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2)
219
220 aquao[0] = 28.09;
221 aquao[1] = 16.;
222 zquao[0] = 14.;
223 zquao[1] = 8.;
224 densquao = 2.64;
225 nlmatquao = -2;
226 wmatquao[0] = 1.;
227 wmatquao[1] = 2.;
228
229 // --- Parameters to include in GSMIXT, relative to Freon (C6F14)
230
231 afre[0] = 12.;
232 afre[1] = 19.;
233 zfre[0] = 6.;
234 zfre[1] = 9.;
235 densfre = 1.7;
236 nlmatfre = -2;
237 wmatfre[0] = 6.;
238 wmatfre[1] = 14.;
239
240 // --- Parameters to include in GSMIXT, relative to methane (CH4)
241
242 amet[0] = 12.01;
243 amet[1] = 1.;
244 zmet[0] = 6.;
245 zmet[1] = 1.;
246 densmet = 7.17e-4;
247 nlmatmet = -2;
248 wmatmet[0] = 1.;
249 wmatmet[1] = 4.;
250
251 // --- Parameters to include in GSMIXT, relative to anode grid (Cu)
252
253 agri = 63.54;
254 zgri = 29.;
255 densgri = 8.96;
256 radlgri = 1.43;
257
258 // --- Parameters to include in GSMATE related to aluminium sheet
259
260 aal = 26.98;
261 zal = 13.;
262 densal = 2.7;
263 radlal = 8.9;
264
265 // --- Glass parameters
266
267 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
268 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
269 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
270 Float_t dglass=1.74;
271
272
273 AliMaterial(1, "Air $", 14.61, 7.3, .001205, 30420., 67500);
274 AliMaterial(6, "HON", ahon, zhon, denshon, radlhon, 0);
275 AliMaterial(16, "CSI", ahon, zhon, denshon, radlhon, 0);
276 AliMixture(20, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
277 AliMixture(21, "QUAO", aquao, zquao, densquao, nlmatquao, wmatquao);
278 AliMixture(30, "FRE", afre, zfre, densfre, nlmatfre, wmatfre);
279 AliMixture(40, "MET", amet, zmet, densmet, nlmatmet, wmatmet);
280 AliMixture(41, "METG", amet, zmet, densmet, nlmatmet, wmatmet);
281 AliMaterial(11, "GRI", agri, zgri, densgri, radlgri, 0);
282 AliMaterial(50, "ALUM", aal, zal, densal, radlal, 0);
283 AliMixture(32, "GLASS",aglass, zglass, dglass, 5, wglass);
284 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
285
286 tmaxfd = -10.;
287 stemax = -.1;
288 deemax = -.2;
289 epsil = .001;
290 stmin = -.001;
291
292 AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
293 AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
294 AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
295 AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
296 AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
297 AliMedium(6, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
298 AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
299 AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
300 AliMedium(9, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, .1, -deemax, epsil, -stmin);
301 AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
302 AliMedium(11, "GLASS", 32, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
303 AliMedium(12, "PCB_COPPER", 31, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
304
305
306 gMC->SetCerenkov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
307 gMC->SetCerenkov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
308 gMC->SetCerenkov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll,rIndexQuarz);
309 gMC->SetCerenkov(idtmed[1003], 26, ppckov, abscoFreon, efficAll,rIndexFreon);
310 gMC->SetCerenkov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
311 gMC->SetCerenkov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane);
312 gMC->SetCerenkov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
313 gMC->SetCerenkov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
314 gMC->SetCerenkov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
315 gMC->SetCerenkov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
316 gMC->SetCerenkov(idtmed[1010], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
317}//AliRICHv3::CreateMaterials()
318
319
320void AliRICHv3::CreateGeometry()
321{
9d6c0962 322// Provides geometry structure for simulation (currently GEANT volumes tree)
323 if(IsDebugStart()) cout<<ClassName()<<"::CreateGeometry()>\n";
9123a941 324
325 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
326 AliRICHSegmentationV0* segmentation;
327 AliRICHGeometry* geometry;
328 AliRICHChamber* iChamber;
329
330 iChamber = &(pRICH->Chamber(0));
331 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel(0);
332 geometry=iChamber->GetGeometryModel();
333
334 Float_t distance;
335 distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness();
336 geometry->SetRadiatorToPads(distance);
337
338 //Opaque quartz thickness
339 Float_t oqua_thickness = .5;
340 //CsI dimensions
341
342
343 Float_t csi_width = segmentation->Npx()*segmentation->Dpx() + segmentation->DeadZone();
344 Float_t csi_length = segmentation->Npy()*segmentation->Dpy() + 2*segmentation->DeadZone();
345
346
347 Int_t *idtmed = fIdtmed->GetArray()-999;
348
349 Int_t i;
350 Float_t zs;
351 Int_t idrotm[1099];
352 Float_t par[3];
353
354 // --- Define the RICH detector
355 // External aluminium box
356 par[0] = 68.8;
357 par[1] = 13; //Original Settings
358 par[2] = 70.86;
359 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
360
361 // Air
362 par[0] = 66.3;
363 par[1] = 13; //Original Settings
364 par[2] = 68.35;
365 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
366
367 // Air 2 (cutting the lower part of the box)
368
369 par[0] = 1.25;
370 par[1] = 3; //Original Settings
371 par[2] = 70.86;
372 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
373
374 // Air 3 (cutting the lower part of the box)
375
376 par[0] = 66.3;
377 par[1] = 3; //Original Settings
378 par[2] = 1.2505;
379 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
380
381 // Honeycomb
382 par[0] = 66.3;
383 par[1] = .188; //Original Settings
384 par[2] = 68.35;
385 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
386
387 // Aluminium sheet
388 par[0] = 66.3;
389 par[1] = .025; //Original Settings
390 par[2] = 68.35;
391 /*par[0] = 66.5;
392 par[1] = .025;
393 par[2] = 63.1;*/
394 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
395
396 // Quartz
397 par[0] = geometry->GetQuartzWidth()/2;
398 par[1] = geometry->GetQuartzThickness()/2;
399 par[2] = geometry->GetQuartzLength()/2;
400 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
401
402 // Spacers (cylinders)
403 par[0] = 0.;
404 par[1] = .5;
405 par[2] = geometry->GetFreonThickness()/2;
406 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
407
408 // Feet (freon slabs supports)
409
410 par[0] = .7;
411 par[1] = .3;
412 par[2] = 1.9;
413 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
414
415 // Opaque quartz
416 par[0] = geometry->GetQuartzWidth()/2;
417 par[1] = .2;
418 par[2] = geometry->GetQuartzLength()/2;
419 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
420
421 // Frame of opaque quartz
422 par[0] = geometry->GetOuterFreonWidth()/2;
423 par[1] = geometry->GetFreonThickness()/2;
424 par[2] = geometry->GetOuterFreonLength()/2;
425 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
426
427 par[0] = geometry->GetInnerFreonWidth()/2;
428 par[1] = geometry->GetFreonThickness()/2;
429 par[2] = geometry->GetInnerFreonLength()/2;
430 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
431
432
433 // Freon
434 par[0] = geometry->GetOuterFreonWidth()/2 - oqua_thickness;
435 par[1] = geometry->GetFreonThickness()/2;
436 par[2] = geometry->GetOuterFreonLength()/2 - 2*oqua_thickness;
437 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
438
439 par[0] = geometry->GetInnerFreonWidth()/2 - oqua_thickness;
440 par[1] = geometry->GetFreonThickness()/2;
441 par[2] = geometry->GetInnerFreonLength()/2 - 2*oqua_thickness;
442 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
443
444 // Methane
445 par[0] = csi_width/2;
446 par[1] = geometry->GetGapThickness()/2;
447 par[2] = csi_length/2;
448 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
449
450 // Methane gap
451 par[0] = csi_width/2;
452 par[1] = geometry->GetProximityGapThickness()/2;
453 par[2] = csi_length/2;
454 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
455
456 // CsI photocathode
457 par[0] = csi_width/2;
458 par[1] = .25;
459 par[2] = csi_length/2;
460 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
461
462 // Anode grid
463 par[0] = 0.;
464 par[1] = .001;
465 par[2] = 20.;
466 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
467
468 // Wire supports
469 // Bar of metal
470
471 par[0] = csi_width/2;
472 par[1] = 1.05;
473 par[2] = 1.05;
474 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
475
476 // Ceramic pick up (base)
477
478 par[0] = csi_width/2;
479 par[1] = .25;
480 par[2] = 1.05;
481 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
482
483 // Ceramic pick up (head)
484
485 par[0] = csi_width/2;
486 par[1] = .1;
487 par[2] = .1;
488 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
489
490 // Aluminium supports for methane and CsI
491 // Short bar
492
493 par[0] = csi_width/2;
494 par[1] = geometry->GetGapThickness()/2 + .25;
495 par[2] = (68.35 - csi_length/2)/2;
496 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
497
498 // Long bar
499
500 par[0] = (66.3 - csi_width/2)/2;
501 par[1] = geometry->GetGapThickness()/2 + .25;
502 par[2] = csi_length/2 + 68.35 - csi_length/2;
503 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
504
505 // Aluminium supports for freon
506 // Short bar
507
508 par[0] = geometry->GetQuartzWidth()/2;
509 par[1] = .3;
510 par[2] = (68.35 - geometry->GetQuartzLength()/2)/2;
511 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
512
513 // Long bar
514
515 par[0] = (66.3 - geometry->GetQuartzWidth()/2)/2;
516 par[1] = .3;
517 par[2] = geometry->GetQuartzLength()/2 + 68.35 - geometry->GetQuartzLength()/2;
518 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
519
520 // PCB backplane
521
522 par[0] = csi_width/2;
523 par[1] = .25;
524 par[2] = csi_length/4 -.5025;
525 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
526
527
528 // Backplane supports
529
530 // Aluminium slab
531
532 par[0] = 33.15;
533 par[1] = 2;
534 par[2] = 21.65;
535 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
536
537 // Big hole
538
539 par[0] = 9.05;
540 par[1] = 2;
541 par[2] = 4.4625;
542 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
543
544 // Small hole
545
546 par[0] = 5.7;
547 par[1] = 2;
548 par[2] = 4.4625;
549 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
550
551 // Place holes inside backplane support
552
553 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
554 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
555 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
556 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
557 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
558 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
559 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
560 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
561 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
562 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
563 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
564 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
565 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
566 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
567 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
568 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
569
570
571
572 // --- Places the detectors defined with GSVOLU
573 // Place material inside RICH
574 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
575 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");
576 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");
577 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");
578 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");
579
580
581 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
582 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
583 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
584 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
585 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
586 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
587 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
588 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
589 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
590 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
591 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
592 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .2, 0., 0, "ONLY");
593
594 // Supports placing
595
596 // Methane supports
597 gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
598 gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
599 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
600 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
601
602 //Freon supports
603
604 Float_t supp_y = 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness() - .2 + .3; //y position of freon supports
605
606 gMC->Gspos("SFLG", 1, "SRIC", geometry->GetQuartzWidth()/2 + (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
607 gMC->Gspos("SFLG", 2, "SRIC", - geometry->GetQuartzWidth()/2 - (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
608 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, geometry->GetQuartzLength()/2 + (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
609 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - geometry->GetQuartzLength()/2 - (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
610
611 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
612
613
614 Int_t nspacers = 30;
615
616 for (i = 0; i < nspacers/3; i++) {
617 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
618 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
619 }
620
621 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
622 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
623 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
624 }
625
626 for (i = (nspacers*2)/3; i < nspacers; ++i) {
627 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
628 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
629 }
630
631 for (i = 0; i < nspacers/3; i++) {
632 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
633 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
634 }
635
636 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
637 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
638 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
639 }
640
641 for (i = (nspacers*2)/3; i < nspacers; ++i) {
642 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
643 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
644 }
645
646
647 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
648 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
649 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)
650 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings
651 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)
652 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness()/2, 0., 0, "ONLY");
653 gMC->Gspos("GAP ", 1, "META", 0., geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
654 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
655 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + geometry->GetGapThickness()/2 + .25, 0., 0, "ONLY");
656 printf("CSI pos: %f\n",1.276 + geometry->GetGapThickness()/2 + .25);
657
658 // Wire support placing
659
660 gMC->Gspos("WSG2", 1, "GAP ", 0., geometry->GetProximityGapThickness()/2 - .1, 0., 0, "ONLY");
661 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
662 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
663
664 // Backplane placing
665
666 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
667 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
668 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
669 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
670 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
671 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
672
673 // PCB placing
674
675 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
676 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
677
678// Place chambers into mother volume ALIC
679
9d6c0962 680 Double_t dOffset = geometry->GetOffset() - geometry->GetGapThickness()/2; // distance from center of mother volume ALIC to methane
681
682 Double_t dAlpha = geometry->GetAlphaAngle(); // angle between centers of chambers - y-z plane
683 Double_t dAlphaRad = dAlpha*kDegrad;
684
685 Double_t dBeta = geometry->GetBetaAngle(); // angle between center of chambers - y-x plane
686 Double_t dBetaRad = dBeta*kDegrad;
687
688 Double_t dRotAngle = geometry->GetRotationAngle(); // the whole RICH is to be rotated in x-y plane + means clockwise rotation
689 Double_t dRotAngleRad = dRotAngle*kDegrad;
9d6c0962 690
4b7382d1 691
9d6c0962 692 TRotMatrix *pRotMatrix; // tmp pointer
693
694 TVector3 vector(0,dOffset,0); // Position of chamber 2 without rotation
695
9123a941 696// Chamber 0 standalone (no other chambers in this row)
4b7382d1 697 pRotMatrix = new TRotMatrix("rot993","rot993", 0., 0., 0.,0.,0.,0.);
698 const Double_t* r = pRotMatrix->SetAngles(90., 0., 90.-dAlpha , 90., dAlpha, -90.);
699 Double_t* rr = RotateXY(r, -dRotAngleRad);
700 AliMatrix(idrotm[1000], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
701 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9123a941 702
9d6c0962 703 vector.SetXYZ(0,dOffset,0); vector.RotateX(dAlphaRad);
704 vector.RotateZ(-dRotAngleRad);
9123a941 705
9d6c0962 706 gMC->Gspos("RICH",1,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1000], "ONLY");
707 Chamber(0).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
9123a941 708// Chamber 1
4b7382d1 709 pRotMatrix = new TRotMatrix("rot994","rot994", 0., 0., 0.,0.,0.,0.);
710 r = pRotMatrix->SetAngles(90., -dBeta, 90., 90.-dBeta, 0., 0.);
711 rr = RotateXY(r, -dRotAngleRad);
712 AliMatrix(idrotm[1001], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
713 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 714 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad);
715 vector.RotateZ(-dRotAngleRad);
9123a941 716
9d6c0962 717 gMC->Gspos("RICH",2,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1001], "ONLY");
718 Chamber(1).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
4b7382d1 719
9123a941 720// Chamber 2 the top one with no Alpha-Beta rotation
4b7382d1 721 pRotMatrix = new TRotMatrix("rot995","rot995", 0., 0., 0.,0.,0.,0.);
722 r = pRotMatrix->SetAngles(90., 0., 90., 90., 0., 0.);
723 rr = RotateXY(r, -dRotAngleRad);
724 AliMatrix(idrotm[1002], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
725 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 726 vector.SetXYZ(0,dOffset,0);
727 vector.RotateZ(-dRotAngleRad);
9d6c0962 728 gMC->Gspos("RICH",3,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1002], "ONLY");
729 Chamber(2).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
9123a941 730// Chamber 3
4b7382d1 731 pRotMatrix = new TRotMatrix("rot996","rot996", 0., 0., 0.,0.,0.,0.);
732 r = pRotMatrix->SetAngles(90., dBeta, 90., 90.+dBeta, 0., 0.);
733 rr = RotateXY(r, -dRotAngleRad);
734 AliMatrix(idrotm[1003], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
735 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 736 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad);
737 vector.RotateZ(-dRotAngleRad);
9123a941 738
9d6c0962 739 gMC->Gspos("RICH",4,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1003], "ONLY");
740 Chamber(3).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
4b7382d1 741
9123a941 742// Chamber 4
4b7382d1 743 pRotMatrix = new TRotMatrix("rot997","rot997", 0., 0., 0.,0.,0.,0.);
744 r = pRotMatrix->SetAngles(90., 360.-dBeta, 108.2, 90.-dBeta, 18.2, 90.-dBeta);
745 rr = RotateXY(r, -dRotAngleRad);
746 AliMatrix(idrotm[1004], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
747 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 748 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad); vector.RotateX(-dAlphaRad);
749 vector.RotateZ(-dRotAngleRad);
9123a941 750
9d6c0962 751 gMC->Gspos("RICH",5,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1004], "ONLY");
752 Chamber(4).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
9123a941 753// Chamber 5
4b7382d1 754 pRotMatrix = new TRotMatrix("rot998","rot998", 0., 0., 0.,0.,0.,0.);
755 r = pRotMatrix->SetAngles(90., 0., 90.+dAlpha, 90., dAlpha, 90.);
756 rr = RotateXY(r, -dRotAngleRad);
757 AliMatrix(idrotm[1005], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
758 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 759 vector.SetXYZ(0,dOffset,0); vector.RotateX(-dAlphaRad);
760 vector.RotateZ(-dRotAngleRad);
761
762 gMC->Gspos("RICH",6,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1005], "ONLY");
763 Chamber(5).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
4b7382d1 764// Chamber 6
765 pRotMatrix = new TRotMatrix("rot999","rot999", 0., 0., 0.,0.,0.,0.);
766 r = pRotMatrix->SetAngles(90., dBeta, 108.2, 90.+dBeta, 18.2, 90.+dBeta);
767 rr = RotateXY(r, -dRotAngleRad);
768 AliMatrix(idrotm[1006], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
769 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 770 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad); vector.RotateX(-dAlphaRad);
771 vector.RotateZ(-dRotAngleRad);
772
773 gMC->Gspos("RICH",7,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1006], "ONLY");
774 Chamber(6).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
9123a941 775
776}//void AliRICHv3::CreateGeometry()
777
778
779
780
781void AliRICHv3::Init()
782{
9d6c0962 783// Makes nothing for a while
784 if(IsDebugStart()) cout<<ClassName()<<"::Init()>\n";
9123a941 785
786}
787
788
789void AliRICHv3::BuildGeometry()
9d6c0962 790{
791// Provides geometry structure for event display (ROOT TNode tree)
792
793 if(IsDebugStart()) cout<<ClassName()<<"::BuildGeometry()>\n";
9123a941 794
795 TNode *node, *subnode, *top;
796
797 const int kColorRICH = kRed;
798 //
799 top=gAlice->GetGeometry()->GetNode("alice");
800
801 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
9123a941 802 AliRICHChamber* iChamber;
803 AliRICHGeometry* geometry;
804
805 iChamber = &(pRICH->Chamber(0));
9d6c0962 806 AliRICHSegmentationV1* segmentation=(AliRICHSegmentationV1*) iChamber->GetSegmentationModel(0);
9123a941 807 geometry=iChamber->GetGeometryModel();
808
809 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
810
811 Float_t padplane_width = segmentation->GetPadPlaneWidth();
812 Float_t padplane_length = segmentation->GetPadPlaneLength();
813
814
815 new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
816
817// Chamber 0
818 top->cd();
819 node = new TNode("RICH1","RICH1","S_RICH",Chamber(0).GetX(),Chamber(0).GetY(),Chamber(0).GetZ(),"rot993");
820 node->SetLineColor(kColorRICH);
821 node->cd();
822 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
823 subnode->SetLineColor(kGreen);
824 fNodes->Add(subnode);
825 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
826 subnode->SetLineColor(kGreen);
827 fNodes->Add(subnode);
828 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
829 subnode->SetLineColor(kGreen);
830 fNodes->Add(subnode);
831 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
832 subnode->SetLineColor(kGreen);
833 fNodes->Add(subnode);
834 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
835 subnode->SetLineColor(kGreen);
836 fNodes->Add(subnode);
837 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
838 subnode->SetLineColor(kGreen);
839 fNodes->Add(subnode);
840 fNodes->Add(node);
841
842// Chamber 1
843 top->cd();
844 node = new TNode("RICH2","RICH2","S_RICH",Chamber(1).GetX(),Chamber(1).GetY(),Chamber(1).GetZ(),"rot994");
845 node->SetLineColor(kColorRICH);
846 node->cd();
847 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
848 subnode->SetLineColor(kGreen);
849 fNodes->Add(subnode);
850 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
851 subnode->SetLineColor(kGreen);
852 fNodes->Add(subnode);
853 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
854 subnode->SetLineColor(kGreen);
855 fNodes->Add(subnode);
856 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
857 subnode->SetLineColor(kGreen);
858 fNodes->Add(subnode);
859 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
860 subnode->SetLineColor(kGreen);
861 fNodes->Add(subnode);
862 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
863 subnode->SetLineColor(kGreen);
864 fNodes->Add(subnode);
865 fNodes->Add(node);
866
867// Chamber 2
868 top->cd();
869 node = new TNode("RICH3","RICH3","S_RICH",Chamber(2).GetX(),Chamber(2).GetY(),Chamber(2).GetZ(),"rot995");
870 node->SetLineColor(kColorRICH);
871 node->cd();
872 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
873 subnode->SetLineColor(kGreen);
874 fNodes->Add(subnode);
875 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
876 subnode->SetLineColor(kGreen);
877 fNodes->Add(subnode);
878 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
879 subnode->SetLineColor(kGreen);
880 fNodes->Add(subnode);
881 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
882 subnode->SetLineColor(kGreen);
883 fNodes->Add(subnode);
884 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
885 subnode->SetLineColor(kGreen);
886 fNodes->Add(subnode);
887 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
888 subnode->SetLineColor(kGreen);
889 fNodes->Add(subnode);
890 fNodes->Add(node);
891
892// Chamber 3
893 top->cd();
894 node = new TNode("RICH4","RICH4","S_RICH",Chamber(3).GetX(),Chamber(3).GetY(),Chamber(3).GetZ(),"rot996");
895 node->SetLineColor(kColorRICH);
896 node->cd();
897 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
898 subnode->SetLineColor(kGreen);
899 fNodes->Add(subnode);
900 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
901 subnode->SetLineColor(kGreen);
902 fNodes->Add(subnode);
903 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
904 subnode->SetLineColor(kGreen);
905 fNodes->Add(subnode);
906 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
907 subnode->SetLineColor(kGreen);
908 fNodes->Add(subnode);
909 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
910 subnode->SetLineColor(kGreen);
911 fNodes->Add(subnode);
912 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
913 subnode->SetLineColor(kGreen);
914 fNodes->Add(subnode);
915 fNodes->Add(node);
916
917// Chamber 4
918 top->cd();
919 node = new TNode("RICH5","RICH5","S_RICH",Chamber(4).GetX(),Chamber(4).GetY(),Chamber(4).GetZ(),"rot997");
920 node->SetLineColor(kColorRICH);
921 node->cd();
922 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
923 subnode->SetLineColor(kGreen);
924 fNodes->Add(subnode);
925 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
926 subnode->SetLineColor(kGreen);
927 fNodes->Add(subnode);
928 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
929 subnode->SetLineColor(kGreen);
930 fNodes->Add(subnode);
931 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
932 subnode->SetLineColor(kGreen);
933 fNodes->Add(subnode);
934 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
935 subnode->SetLineColor(kGreen);
936 fNodes->Add(subnode);
937 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
938 subnode->SetLineColor(kGreen);
939 fNodes->Add(subnode);
940 fNodes->Add(node);
941
942// Chamber 5
943 top->cd();
944 node = new TNode("RICH6","RICH6","S_RICH",Chamber(5).GetX(),Chamber(5).GetY(),Chamber(5).GetZ(),"rot998");
945 node->SetLineColor(kColorRICH);
946 fNodes->Add(node);node->cd();
947 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
948 subnode->SetLineColor(kGreen);
949 fNodes->Add(subnode);
950 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
951 subnode->SetLineColor(kGreen);
952 fNodes->Add(subnode);
953 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
954 subnode->SetLineColor(kGreen);
955 fNodes->Add(subnode);
956 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
957 subnode->SetLineColor(kGreen);
958 fNodes->Add(subnode);
959 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
960 subnode->SetLineColor(kGreen);
961 fNodes->Add(subnode);
962 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
963 subnode->SetLineColor(kGreen);
964 fNodes->Add(subnode);
965
966// Chamber 6
967 top->cd();
968 node = new TNode("RICH7","RICH7","S_RICH",Chamber(6).GetX(),Chamber(6).GetY(),Chamber(6).GetZ(),"rot999");
969 node->SetLineColor(kColorRICH);
970 node->cd();
971 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
972 subnode->SetLineColor(kGreen);
973 fNodes->Add(subnode);
974 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
975 subnode->SetLineColor(kGreen);
976 fNodes->Add(subnode);
977 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
978 subnode->SetLineColor(kGreen);
979 fNodes->Add(subnode);
980 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
981 subnode->SetLineColor(kGreen);
982 fNodes->Add(subnode);
983 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
984 subnode->SetLineColor(kGreen);
985 fNodes->Add(subnode);
986 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
987 subnode->SetLineColor(kGreen);
988 fNodes->Add(subnode);
989 fNodes->Add(node);
990
991}//AliRICHv3::BuildGeometry()
9d6c0962 992
993void AliRICHv3::StepManager()
994{
995// The active Step Manager is realised currently in AliRICHv3 for debug
996// leaving StepManager in AliRICH intact. To be removed in future.
997
998 Int_t copy, id;
999 static Int_t idvol;
1000 static Int_t vol[2];
1001 Int_t ipart;
1002 static Float_t hits[22];
1003 static Float_t ckovData[19];
1004 TLorentzVector position;
1005 TLorentzVector momentum;
1006 Float_t pos[3];
1007 Float_t mom[4];
1008 Float_t localPos[3];
1009 Float_t localMom[4];
1010 Float_t localTheta,localPhi;
1011 Float_t theta,phi;
1012 Float_t destep, step;
b9d0a01d 1013 Double_t ranf[2];
9d6c0962 1014 Int_t nPads;
1015 Float_t coscerenkov;
1016 static Float_t eloss, xhit, yhit, tlength;
1017 const Float_t kBig=1.e10;
1018
1019 TClonesArray &lhits = *fHits;
1020 TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->CurrentTrack()];
1021
1022 //if (current->Energy()>1)
1023 //{
1024
1025 // Only gas gap inside chamber
1026 // Tag chambers and record hits when track enters
1027
1028 idvol=-1;
1029 id=gMC->CurrentVolID(copy);
1030 Float_t cherenkovLoss=0;
1031 //gAlice->KeepTrack(gAlice->CurrentTrack());
1032
1033 gMC->TrackPosition(position);
1034 pos[0]=position(0);
1035 pos[1]=position(1);
1036 pos[2]=position(2);
1037 //bzero((char *)ckovData,sizeof(ckovData)*19);
1038 ckovData[1] = pos[0]; // X-position for hit
1039 ckovData[2] = pos[1]; // Y-position for hit
1040 ckovData[3] = pos[2]; // Z-position for hit
1041 ckovData[6] = 0; // dummy track length
1042 //ckovData[11] = gAlice->CurrentTrack();
1043
1044 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->CurrentTrack());
1045
1046 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
1047
1048 /********************Store production parameters for Cerenkov photons************************/
1049//is it a Cerenkov photon?
1050 if (gMC->TrackPid() == 50000050) {
1051
1052 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
1053 //{
1054 Float_t ckovEnergy = current->Energy();
1055 //energy interval for tracking
1056 if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )
1057 //if (ckovEnergy > 0)
1058 {
1059 if (gMC->IsTrackEntering()){ //is track entering?
1060 //printf("Track entered (1)\n");
1061 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1062 { //is it in freo?
1063 if (gMC->IsNewTrack()){ //is it the first step?
1064 //printf("I'm in!\n");
1065 Int_t mother = current->GetFirstMother();
1066
1067 //printf("Second Mother:%d\n",current->GetSecondMother());
1068
1069 ckovData[10] = mother;
1070 ckovData[11] = gAlice->CurrentTrack();
1071 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
1072 //printf("Produced in FREO\n");
1073 fCkovNumber++;
1074 fFreonProd=1;
1075 //printf("Index: %d\n",fCkovNumber);
1076 } //first step question
1077 } //freo question
1078
1079 if (gMC->IsNewTrack()){ //is it first step?
1080 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
1081 {
1082 ckovData[12] = 2;
1083 //printf("Produced in QUAR\n");
1084 } //quarz question
1085 } //first step question
1086
1087 //printf("Before %d\n",fFreonProd);
1088 } //track entering question
1089
1090 if (ckovData[12] == 1) //was it produced in Freon?
1091 //if (fFreonProd == 1)
1092 {
1093 if (gMC->IsTrackEntering()){ //is track entering?
1094 //printf("Track entered (2)\n");
1095 //printf("Current volume (should be META): %s\n",gMC->CurrentVolName());
1096 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("META"),gMC->CurrentVolID(copy));
1097 if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap?
1098 {
1099 //printf("Got in META\n");
1100 gMC->TrackMomentum(momentum);
1101 mom[0]=momentum(0);
1102 mom[1]=momentum(1);
1103 mom[2]=momentum(2);
1104 mom[3]=momentum(3);
1105 // Z-position for hit
1106
1107
1108 /**************** Photons lost in second grid have to be calculated by hand************/
1109
1110 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
1111 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
b9d0a01d 1112 //gMC->Rndm(ranf, 1);
1113 gMC->GetRandom()->RndmArray(1,ranf);
9d6c0962 1114 //printf("grid calculation:%f\n",t);
1115 if (ranf[0] > t) {
1116 gMC->StopTrack();
1117 ckovData[13] = 5;
1118 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1119 //printf("Added One (1)!\n");
1120 //printf("Lost one in grid\n");
1121 }
1122 /**********************************************************************************/
1123 } //gap
1124
1125 //printf("Current volume (should be CSI) (1): %s\n",gMC->CurrentVolName());
1126 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
1127 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
1128 {
1129 //printf("Got in CSI\n");
1130 gMC->TrackMomentum(momentum);
1131 mom[0]=momentum(0);
1132 mom[1]=momentum(1);
1133 mom[2]=momentum(2);
1134 mom[3]=momentum(3);
1135
1136 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
1137 /***********************Cerenkov phtons (always polarised)*************************/
1138
1139 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
1140 Float_t t = Fresnel(ckovEnergy*1e9,cophi,1);
b9d0a01d 1141 //gMC->Rndm(ranf, 1);
1142 gMC->GetRandom()->RndmArray(1,ranf);
9d6c0962 1143 if (ranf[0] < t) {
1144 gMC->StopTrack();
1145 ckovData[13] = 6;
1146 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1147 //printf("Added One (2)!\n");
1148 //printf("Lost by Fresnel\n");
1149 }
1150 /**********************************************************************************/
1151 }
1152 } //track entering?
1153
1154
1155 /********************Evaluation of losses************************/
1156 /******************still in the old fashion**********************/
1157
1158 TArrayI procs;
1159 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
1160 for (Int_t i = 0; i < i1; ++i) {
1161 // Reflection loss
1162 if (procs[i] == kPLightReflection) { //was it reflected
1163 ckovData[13]=10;
1164 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1165 ckovData[13]=1;
1166 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
1167 ckovData[13]=2;
1168 //gMC->StopTrack();
1169 //AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1170 } //reflection question
1171
1172 // Absorption loss
1173 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
1174 //printf("Got in absorption\n");
1175 ckovData[13]=20;
1176 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1177 ckovData[13]=11;
1178 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
1179 ckovData[13]=12;
1180 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
1181 ckovData[13]=13;
1182 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
1183 ckovData[13]=13;
1184
1185 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
1186 ckovData[13]=15;
1187
1188 // CsI inefficiency
1189 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
1190 ckovData[13]=16;
1191 }
1192 gMC->StopTrack();
1193 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1194 //printf("Added One (3)!\n");
1195 //printf("Added cerenkov %d\n",fCkovNumber);
1196 } //absorption question
1197
1198
1199 // Photon goes out of tracking scope
1200 else if (procs[i] == kPStop) { //is it below energy treshold?
1201 ckovData[13]=21;
1202 gMC->StopTrack();
1203 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1204 //printf("Added One (4)!\n");
1205 } // energy treshold question
1206 } //number of mechanisms cycle
1207 /**********************End of evaluation************************/
1208 } //freon production question
1209 } //energy interval question
1210 //}//inside the proximity gap question
1211 } //cerenkov photon question
1212
1213 /**************************************End of Production Parameters Storing*********************/
1214
1215
1216 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
1217
1218 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
1219 //printf("Cerenkov\n");
1220
1221 //if (gMC->TrackPid() == 50000051)
1222 //printf("Tracking a feedback\n");
1223
1224 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
1225 {
1226 //printf("Current volume (should be CSI) (2): %s\n",gMC->CurrentVolName());
1227 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
1228 //printf("Got in CSI\n");
1229 //printf("Tracking a %d\n",gMC->TrackPid());
1230 if (gMC->Edep() > 0.){
1231 gMC->TrackPosition(position);
1232 gMC->TrackMomentum(momentum);
1233 pos[0]=position(0);
1234 pos[1]=position(1);
1235 pos[2]=position(2);
1236 mom[0]=momentum(0);
1237 mom[1]=momentum(1);
1238 mom[2]=momentum(2);
1239 mom[3]=momentum(3);
1240 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1241 Double_t rt = TMath::Sqrt(tc);
1242 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1243 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1244 gMC->Gmtod(pos,localPos,1);
1245 gMC->Gmtod(mom,localMom,2);
1246
1247 gMC->CurrentVolOffID(2,copy);
1248 vol[0]=copy;
1249 idvol=vol[0]-1;
1250
1251 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1252 //->Sector(localPos[0], localPos[2]);
1253 //printf("Sector:%d\n",sector);
1254
1255 /*if (gMC->TrackPid() == 50000051){
1256 fFeedbacks++;
1257 printf("Feedbacks:%d\n",fFeedbacks);
1258 }*/
1259
1260 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1261 ((AliRICHChamber*)fChambers->At(idvol))
1262 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1263 if(idvol<kNCH) {
1264 ckovData[0] = gMC->TrackPid(); // particle type
1265 ckovData[1] = pos[0]; // X-position for hit
1266 ckovData[2] = pos[1]; // Y-position for hit
1267 ckovData[3] = pos[2]; // Z-position for hit
1268 ckovData[4] = theta; // theta angle of incidence
1269 ckovData[5] = phi; // phi angle of incidence
1270 ckovData[8] = (Float_t) fNSDigits; // first sdigit
1271 ckovData[9] = -1; // last pad hit
1272 ckovData[13] = 4; // photon was detected
1273 ckovData[14] = mom[0];
1274 ckovData[15] = mom[1];
1275 ckovData[16] = mom[2];
1276
1277 destep = gMC->Edep();
1278 gMC->SetMaxStep(kBig);
1279 cherenkovLoss += destep;
1280 ckovData[7]=cherenkovLoss;
1281
1282 nPads = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kCerenkov);
1283
1284 if (fNSDigits > (Int_t)ckovData[8]) {
1285 ckovData[8]= ckovData[8]+1;
1286 ckovData[9]= (Float_t) fNSDigits;
1287 }
1288
1289 //printf("Cerenkov loss: %f\n", cherenkovLoss);
1290
1291 ckovData[17] = nPads;
1292 //printf("nPads:%d",nPads);
1293
1294 //TClonesArray *Hits = RICH->Hits();
1295 AliRICHHit *mipHit = (AliRICHHit*) (fHits->UncheckedAt(0));
1296 if (mipHit)
1297 {
1298 mom[0] = current->Px();
1299 mom[1] = current->Py();
1300 mom[2] = current->Pz();
1301 Float_t mipPx = mipHit->MomX();
1302 Float_t mipPy = mipHit->MomY();
1303 Float_t mipPz = mipHit->MomZ();
1304
1305 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
1306 Float_t rt = TMath::Sqrt(r);
1307 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
1308 Float_t mipRt = TMath::Sqrt(mipR);
1309 if ((rt*mipRt) > 0)
1310 {
1311 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
1312 }
1313 else
1314 {
1315 coscerenkov = 0;
1316 }
1317 Float_t cherenkov = TMath::ACos(coscerenkov);
1318 ckovData[18]=cherenkov;
1319 }
1320 //if (sector != -1)
1321 //{
1322 AddHit(gAlice->CurrentTrack(),vol,ckovData);
1323 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1324 //printf("Added One (5)!\n");
1325 //}
1326 }
1327 }
1328 }
1329 }
1330
1331 /***********************************************End of photon hits*********************************************/
1332
1333
1334 /**********************************************Charged particles treatment*************************************/
1335
1336 else if (gMC->TrackCharge())
1337 //else if (1 == 1)
1338 {
1339//If MIP
1340 /*if (gMC->IsTrackEntering())
1341 {
1342 hits[13]=20;//is track entering?
1343 }*/
1344 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1345 {
1346 gMC->TrackMomentum(momentum);
1347 mom[0]=momentum(0);
1348 mom[1]=momentum(1);
1349 mom[2]=momentum(2);
1350 mom[3]=momentum(3);
1351 hits [19] = mom[0];
1352 hits [20] = mom[1];
1353 hits [21] = mom[2];
1354 fFreonProd=1;
1355 }
1356
1357 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {
1358// Get current particle id (ipart), track position (pos) and momentum (mom)
1359
1360 gMC->CurrentVolOffID(3,copy);
1361 vol[0]=copy;
1362 idvol=vol[0]-1;
1363
1364 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1365 //->Sector(localPos[0], localPos[2]);
1366 //printf("Sector:%d\n",sector);
1367
1368 gMC->TrackPosition(position);
1369 gMC->TrackMomentum(momentum);
1370 pos[0]=position(0);
1371 pos[1]=position(1);
1372 pos[2]=position(2);
1373 mom[0]=momentum(0);
1374 mom[1]=momentum(1);
1375 mom[2]=momentum(2);
1376 mom[3]=momentum(3);
1377 gMC->Gmtod(pos,localPos,1);
1378 gMC->Gmtod(mom,localMom,2);
1379
1380 ipart = gMC->TrackPid();
1381 //
1382 // momentum loss and steplength in last step
1383 destep = gMC->Edep();
1384 step = gMC->TrackStep();
1385
1386 //
1387 // record hits when track enters ...
1388 if( gMC->IsTrackEntering()) {
1389// gMC->SetMaxStep(fMaxStepGas);
1390 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1391 Double_t rt = TMath::Sqrt(tc);
1392 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1393 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1394
1395
1396 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
1397 Double_t localRt = TMath::Sqrt(localTc);
1398 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
1399 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
1400
1401 hits[0] = Float_t(ipart); // particle type
1402 hits[1] = localPos[0]; // X-position for hit
1403 hits[2] = localPos[1]; // Y-position for hit
1404 hits[3] = localPos[2]; // Z-position for hit
1405 hits[4] = localTheta; // theta angle of incidence
1406 hits[5] = localPhi; // phi angle of incidence
1407 hits[8] = (Float_t) fNSDigits; // first sdigit
1408 hits[9] = -1; // last pad hit
1409 hits[13] = fFreonProd; // did id hit the freon?
1410 hits[14] = mom[0];
1411 hits[15] = mom[1];
1412 hits[16] = mom[2];
1413 hits[18] = 0; // dummy cerenkov angle
1414
1415 tlength = 0;
1416 eloss = 0;
1417 fFreonProd = 0;
1418
1419 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
1420
1421
1422 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
1423 xhit = localPos[0];
1424 yhit = localPos[2];
1425 // Only if not trigger chamber
1426 if(idvol<kNCH) {
1427 //
1428 // Initialize hit position (cursor) in the segmentation model
1429 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1430 ((AliRICHChamber*)fChambers->At(idvol))
1431 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1432 }
1433 }
1434
1435 //
1436 // Calculate the charge induced on a pad (disintegration) in case
1437 //
1438 // Mip left chamber ...
1439 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1440 gMC->SetMaxStep(kBig);
1441 eloss += destep;
1442 tlength += step;
1443
1444
1445 // Only if not trigger chamber
1446 if(idvol<kNCH) {
1447 if (eloss > 0)
1448 {
1449 if(gMC->TrackPid() == kNeutron)
1450 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
1451 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
1452 hits[17] = nPads;
1453 //printf("nPads:%d",nPads);
1454 }
1455 }
1456
1457 hits[6]=tlength;
1458 hits[7]=eloss;
1459 if (fNSDigits > (Int_t)hits[8]) {
1460 hits[8]= hits[8]+1;
1461 hits[9]= (Float_t) fNSDigits;
1462 }
1463
1464 //if(sector !=-1)
1465 new(lhits[fNhits++]) AliRICHHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1466 eloss = 0;
1467 //
1468 // Check additional signal generation conditions
1469 // defined by the segmentation
1470 // model (boundary crossing conditions)
1471 } else if
1472 //PH (((AliRICHChamber*) (*fChambers)[idvol])
1473 (((AliRICHChamber*)fChambers->At(idvol))
1474 ->SigGenCond(localPos[0], localPos[2], localPos[1]))
1475 {
1476 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1477 ((AliRICHChamber*)fChambers->At(idvol))
1478 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1479 if (eloss > 0)
1480 {
1481 if(gMC->TrackPid() == kNeutron)
1482 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
1483 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
1484 hits[17] = nPads;
1485 //printf("Npads:%d",NPads);
1486 }
1487 xhit = localPos[0];
1488 yhit = localPos[2];
1489 eloss = destep;
1490 tlength += step ;
1491 //
1492 // nothing special happened, add up energy loss
1493 } else {
1494 eloss += destep;
1495 tlength += step ;
1496 }
1497 }
1498 }
1499 /*************************************************End of MIP treatment**************************************/
1500 //}
1501}// void AliRICHv3::StepManager()
4b7382d1 1502
1503Double_t* AliRICHv3::RotateXY(const Double_t* r, Double_t a)
1504{
1505 // Rotatation in xy-plane
1506 // by angle a
1507 // The resulting rotation matrix is given back in the G3 notation.
1508 Double_t* rr = new Double_t[6];
1509 Double_t m[9];
1510 Int_t i,j,k;
1511
1512 for (i = 0; i < 3; i++) {
1513 j = 3*i;
1514 m[j] = r[j] * TMath::Cos(a) - r[j+1] * TMath::Sin(a);
1515 m[j+1] = r[j] * TMath::Sin(a) + r[j+1] * TMath::Cos(a);
1516 m[j+2] = r[j+2];
1517 }
1518
1519 for (i = 0; i < 3; i++) {
1520 j = 3*i;
1521 k = 2*i;
1522 rr[k] = TMath::ACos(m[j+2]) * kRaddeg;
1523 rr[k+1] = TMath::ATan2(m[j+1], m[j]) * kRaddeg;
1524 }
1525 return rr;
1526}
1527