]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHv3.cxx
Introducing Riostream.h
[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;
690
691
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)
697 AliMatrix(idrotm[1000], 90, -dRotAngle , 90-dAlpha , 90-dRotAngle , dAlpha , -90 );
698 pRotMatrix=new TRotMatrix("rot993","rot993", 90, -dRotAngle , 90-dAlpha , 90-dRotAngle , dAlpha , -90 );
699
9d6c0962 700 vector.SetXYZ(0,dOffset,0); vector.RotateX(dAlphaRad);
701 vector.RotateZ(-dRotAngleRad);
9123a941 702
9d6c0962 703 gMC->Gspos("RICH",1,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1000], "ONLY");
704 Chamber(0).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
9123a941 705// Chamber 1
706 AliMatrix(idrotm[1001], 90, -dBeta-dRotAngle , 90 , 90-dBeta-dRotAngle , 0 , 0 );
707 pRotMatrix=new TRotMatrix("rot994","rot994", 90, -dBeta-dRotAngle , 90 , 90-dBeta-dRotAngle , 0 , 0 );
708
9d6c0962 709 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad);
710 vector.RotateZ(-dRotAngleRad);
9123a941 711
9d6c0962 712 gMC->Gspos("RICH",2,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1001], "ONLY");
713 Chamber(1).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
9123a941 714// Chamber 2 the top one with no Alpha-Beta rotation
715 AliMatrix(idrotm[1002], 90, -dRotAngle , 90 , 90-dRotAngle , 0 , 0 );
716 pRotMatrix=new TRotMatrix("rot995","rot995", 90, -dRotAngle , 90 , 90-dRotAngle , 0 , 0 );
717
9d6c0962 718 vector.SetXYZ(0,dOffset,0);
719 vector.RotateZ(-dRotAngleRad);
720
721 gMC->Gspos("RICH",3,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1002], "ONLY");
722 Chamber(2).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
9123a941 723// Chamber 3
724 AliMatrix(idrotm[1003], 90, dBeta-dRotAngle , 90. , 90+dBeta-dRotAngle , 0 , 0 );
725 pRotMatrix=new TRotMatrix("rot996","rot996", 90, dBeta-dRotAngle , 90. , 90+dBeta-dRotAngle , 0 , 0 );
726
9d6c0962 727 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad);
728 vector.RotateZ(-dRotAngleRad);
9123a941 729
9d6c0962 730 gMC->Gspos("RICH",4,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1003], "ONLY");
731 Chamber(3).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
9123a941 732// Chamber 4
733 AliMatrix(idrotm[1004], 90, 360-dBeta-dRotAngle , 108.2 , 90-dBeta-dRotAngle , 18.2 , 90-dBeta );
734 pRotMatrix=new TRotMatrix("rot997","rot997", 90, 360-dBeta-dRotAngle , 108.2 , 90-dBeta-dRotAngle , 18.2 , 90-dBeta );
735
9d6c0962 736 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad); vector.RotateX(-dAlphaRad);
737 vector.RotateZ(-dRotAngleRad);
9123a941 738
9d6c0962 739 gMC->Gspos("RICH",5,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1004], "ONLY");
740 Chamber(4).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
9123a941 741// Chamber 5
742 AliMatrix(idrotm[1005], 90, -dRotAngle , 90+dAlpha , 90-dRotAngle , dAlpha , 90 );
743 pRotMatrix=new TRotMatrix("rot998","rot998", 90, -dRotAngle , 90+dAlpha , 90-dRotAngle , dAlpha , 90 );
744
9d6c0962 745 vector.SetXYZ(0,dOffset,0); vector.RotateX(-dAlphaRad);
746 vector.RotateZ(-dRotAngleRad);
747
748 gMC->Gspos("RICH",6,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1005], "ONLY");
749 Chamber(5).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
9123a941 750// Chamber 6
751 AliMatrix(idrotm[1006], 90, dBeta-dRotAngle , 108.2 , 90+dBeta-dRotAngle , 18.2 , 90+dBeta );
752 pRotMatrix=new TRotMatrix("rot999","rot999", 90, dBeta-dRotAngle , 108.2 , 90+dBeta-dRotAngle , 18.2 , 90+dBeta );
753
9d6c0962 754 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad); vector.RotateX(-dAlphaRad);
755 vector.RotateZ(-dRotAngleRad);
756
757 gMC->Gspos("RICH",7,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1006], "ONLY");
758 Chamber(6).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
9123a941 759
760}//void AliRICHv3::CreateGeometry()
761
762
763
764
765void AliRICHv3::Init()
766{
9d6c0962 767// Makes nothing for a while
768 if(IsDebugStart()) cout<<ClassName()<<"::Init()>\n";
9123a941 769
770}
771
772
773void AliRICHv3::BuildGeometry()
9d6c0962 774{
775// Provides geometry structure for event display (ROOT TNode tree)
776
777 if(IsDebugStart()) cout<<ClassName()<<"::BuildGeometry()>\n";
9123a941 778
779 TNode *node, *subnode, *top;
780
781 const int kColorRICH = kRed;
782 //
783 top=gAlice->GetGeometry()->GetNode("alice");
784
785 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
9123a941 786 AliRICHChamber* iChamber;
787 AliRICHGeometry* geometry;
788
789 iChamber = &(pRICH->Chamber(0));
9d6c0962 790 AliRICHSegmentationV1* segmentation=(AliRICHSegmentationV1*) iChamber->GetSegmentationModel(0);
9123a941 791 geometry=iChamber->GetGeometryModel();
792
793 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
794
795 Float_t padplane_width = segmentation->GetPadPlaneWidth();
796 Float_t padplane_length = segmentation->GetPadPlaneLength();
797
798
799 new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
800
801// Chamber 0
802 top->cd();
803 node = new TNode("RICH1","RICH1","S_RICH",Chamber(0).GetX(),Chamber(0).GetY(),Chamber(0).GetZ(),"rot993");
804 node->SetLineColor(kColorRICH);
805 node->cd();
806 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
807 subnode->SetLineColor(kGreen);
808 fNodes->Add(subnode);
809 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
810 subnode->SetLineColor(kGreen);
811 fNodes->Add(subnode);
812 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
813 subnode->SetLineColor(kGreen);
814 fNodes->Add(subnode);
815 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
816 subnode->SetLineColor(kGreen);
817 fNodes->Add(subnode);
818 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
819 subnode->SetLineColor(kGreen);
820 fNodes->Add(subnode);
821 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
822 subnode->SetLineColor(kGreen);
823 fNodes->Add(subnode);
824 fNodes->Add(node);
825
826// Chamber 1
827 top->cd();
828 node = new TNode("RICH2","RICH2","S_RICH",Chamber(1).GetX(),Chamber(1).GetY(),Chamber(1).GetZ(),"rot994");
829 node->SetLineColor(kColorRICH);
830 node->cd();
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 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
841 subnode->SetLineColor(kGreen);
842 fNodes->Add(subnode);
843 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
844 subnode->SetLineColor(kGreen);
845 fNodes->Add(subnode);
846 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
847 subnode->SetLineColor(kGreen);
848 fNodes->Add(subnode);
849 fNodes->Add(node);
850
851// Chamber 2
852 top->cd();
853 node = new TNode("RICH3","RICH3","S_RICH",Chamber(2).GetX(),Chamber(2).GetY(),Chamber(2).GetZ(),"rot995");
854 node->SetLineColor(kColorRICH);
855 node->cd();
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 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
866 subnode->SetLineColor(kGreen);
867 fNodes->Add(subnode);
868 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
869 subnode->SetLineColor(kGreen);
870 fNodes->Add(subnode);
871 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
872 subnode->SetLineColor(kGreen);
873 fNodes->Add(subnode);
874 fNodes->Add(node);
875
876// Chamber 3
877 top->cd();
878 node = new TNode("RICH4","RICH4","S_RICH",Chamber(3).GetX(),Chamber(3).GetY(),Chamber(3).GetZ(),"rot996");
879 node->SetLineColor(kColorRICH);
880 node->cd();
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 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
891 subnode->SetLineColor(kGreen);
892 fNodes->Add(subnode);
893 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
894 subnode->SetLineColor(kGreen);
895 fNodes->Add(subnode);
896 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
897 subnode->SetLineColor(kGreen);
898 fNodes->Add(subnode);
899 fNodes->Add(node);
900
901// Chamber 4
902 top->cd();
903 node = new TNode("RICH5","RICH5","S_RICH",Chamber(4).GetX(),Chamber(4).GetY(),Chamber(4).GetZ(),"rot997");
904 node->SetLineColor(kColorRICH);
905 node->cd();
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 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
916 subnode->SetLineColor(kGreen);
917 fNodes->Add(subnode);
918 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
919 subnode->SetLineColor(kGreen);
920 fNodes->Add(subnode);
921 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
922 subnode->SetLineColor(kGreen);
923 fNodes->Add(subnode);
924 fNodes->Add(node);
925
926// Chamber 5
927 top->cd();
928 node = new TNode("RICH6","RICH6","S_RICH",Chamber(5).GetX(),Chamber(5).GetY(),Chamber(5).GetZ(),"rot998");
929 node->SetLineColor(kColorRICH);
930 fNodes->Add(node);node->cd();
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 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
941 subnode->SetLineColor(kGreen);
942 fNodes->Add(subnode);
943 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
944 subnode->SetLineColor(kGreen);
945 fNodes->Add(subnode);
946 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
947 subnode->SetLineColor(kGreen);
948 fNodes->Add(subnode);
949
950// Chamber 6
951 top->cd();
952 node = new TNode("RICH7","RICH7","S_RICH",Chamber(6).GetX(),Chamber(6).GetY(),Chamber(6).GetZ(),"rot999");
953 node->SetLineColor(kColorRICH);
954 node->cd();
955 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
956 subnode->SetLineColor(kGreen);
957 fNodes->Add(subnode);
958 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
959 subnode->SetLineColor(kGreen);
960 fNodes->Add(subnode);
961 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
962 subnode->SetLineColor(kGreen);
963 fNodes->Add(subnode);
964 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
965 subnode->SetLineColor(kGreen);
966 fNodes->Add(subnode);
967 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
968 subnode->SetLineColor(kGreen);
969 fNodes->Add(subnode);
970 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
971 subnode->SetLineColor(kGreen);
972 fNodes->Add(subnode);
973 fNodes->Add(node);
974
975}//AliRICHv3::BuildGeometry()
9d6c0962 976
977void AliRICHv3::StepManager()
978{
979// The active Step Manager is realised currently in AliRICHv3 for debug
980// leaving StepManager in AliRICH intact. To be removed in future.
981
982 Int_t copy, id;
983 static Int_t idvol;
984 static Int_t vol[2];
985 Int_t ipart;
986 static Float_t hits[22];
987 static Float_t ckovData[19];
988 TLorentzVector position;
989 TLorentzVector momentum;
990 Float_t pos[3];
991 Float_t mom[4];
992 Float_t localPos[3];
993 Float_t localMom[4];
994 Float_t localTheta,localPhi;
995 Float_t theta,phi;
996 Float_t destep, step;
b9d0a01d 997 Double_t ranf[2];
9d6c0962 998 Int_t nPads;
999 Float_t coscerenkov;
1000 static Float_t eloss, xhit, yhit, tlength;
1001 const Float_t kBig=1.e10;
1002
1003 TClonesArray &lhits = *fHits;
1004 TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->CurrentTrack()];
1005
1006 //if (current->Energy()>1)
1007 //{
1008
1009 // Only gas gap inside chamber
1010 // Tag chambers and record hits when track enters
1011
1012 idvol=-1;
1013 id=gMC->CurrentVolID(copy);
1014 Float_t cherenkovLoss=0;
1015 //gAlice->KeepTrack(gAlice->CurrentTrack());
1016
1017 gMC->TrackPosition(position);
1018 pos[0]=position(0);
1019 pos[1]=position(1);
1020 pos[2]=position(2);
1021 //bzero((char *)ckovData,sizeof(ckovData)*19);
1022 ckovData[1] = pos[0]; // X-position for hit
1023 ckovData[2] = pos[1]; // Y-position for hit
1024 ckovData[3] = pos[2]; // Z-position for hit
1025 ckovData[6] = 0; // dummy track length
1026 //ckovData[11] = gAlice->CurrentTrack();
1027
1028 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->CurrentTrack());
1029
1030 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
1031
1032 /********************Store production parameters for Cerenkov photons************************/
1033//is it a Cerenkov photon?
1034 if (gMC->TrackPid() == 50000050) {
1035
1036 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
1037 //{
1038 Float_t ckovEnergy = current->Energy();
1039 //energy interval for tracking
1040 if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )
1041 //if (ckovEnergy > 0)
1042 {
1043 if (gMC->IsTrackEntering()){ //is track entering?
1044 //printf("Track entered (1)\n");
1045 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1046 { //is it in freo?
1047 if (gMC->IsNewTrack()){ //is it the first step?
1048 //printf("I'm in!\n");
1049 Int_t mother = current->GetFirstMother();
1050
1051 //printf("Second Mother:%d\n",current->GetSecondMother());
1052
1053 ckovData[10] = mother;
1054 ckovData[11] = gAlice->CurrentTrack();
1055 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
1056 //printf("Produced in FREO\n");
1057 fCkovNumber++;
1058 fFreonProd=1;
1059 //printf("Index: %d\n",fCkovNumber);
1060 } //first step question
1061 } //freo question
1062
1063 if (gMC->IsNewTrack()){ //is it first step?
1064 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
1065 {
1066 ckovData[12] = 2;
1067 //printf("Produced in QUAR\n");
1068 } //quarz question
1069 } //first step question
1070
1071 //printf("Before %d\n",fFreonProd);
1072 } //track entering question
1073
1074 if (ckovData[12] == 1) //was it produced in Freon?
1075 //if (fFreonProd == 1)
1076 {
1077 if (gMC->IsTrackEntering()){ //is track entering?
1078 //printf("Track entered (2)\n");
1079 //printf("Current volume (should be META): %s\n",gMC->CurrentVolName());
1080 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("META"),gMC->CurrentVolID(copy));
1081 if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap?
1082 {
1083 //printf("Got in META\n");
1084 gMC->TrackMomentum(momentum);
1085 mom[0]=momentum(0);
1086 mom[1]=momentum(1);
1087 mom[2]=momentum(2);
1088 mom[3]=momentum(3);
1089 // Z-position for hit
1090
1091
1092 /**************** Photons lost in second grid have to be calculated by hand************/
1093
1094 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
1095 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
b9d0a01d 1096 //gMC->Rndm(ranf, 1);
1097 gMC->GetRandom()->RndmArray(1,ranf);
9d6c0962 1098 //printf("grid calculation:%f\n",t);
1099 if (ranf[0] > t) {
1100 gMC->StopTrack();
1101 ckovData[13] = 5;
1102 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1103 //printf("Added One (1)!\n");
1104 //printf("Lost one in grid\n");
1105 }
1106 /**********************************************************************************/
1107 } //gap
1108
1109 //printf("Current volume (should be CSI) (1): %s\n",gMC->CurrentVolName());
1110 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
1111 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
1112 {
1113 //printf("Got in CSI\n");
1114 gMC->TrackMomentum(momentum);
1115 mom[0]=momentum(0);
1116 mom[1]=momentum(1);
1117 mom[2]=momentum(2);
1118 mom[3]=momentum(3);
1119
1120 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
1121 /***********************Cerenkov phtons (always polarised)*************************/
1122
1123 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
1124 Float_t t = Fresnel(ckovEnergy*1e9,cophi,1);
b9d0a01d 1125 //gMC->Rndm(ranf, 1);
1126 gMC->GetRandom()->RndmArray(1,ranf);
9d6c0962 1127 if (ranf[0] < t) {
1128 gMC->StopTrack();
1129 ckovData[13] = 6;
1130 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1131 //printf("Added One (2)!\n");
1132 //printf("Lost by Fresnel\n");
1133 }
1134 /**********************************************************************************/
1135 }
1136 } //track entering?
1137
1138
1139 /********************Evaluation of losses************************/
1140 /******************still in the old fashion**********************/
1141
1142 TArrayI procs;
1143 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
1144 for (Int_t i = 0; i < i1; ++i) {
1145 // Reflection loss
1146 if (procs[i] == kPLightReflection) { //was it reflected
1147 ckovData[13]=10;
1148 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1149 ckovData[13]=1;
1150 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
1151 ckovData[13]=2;
1152 //gMC->StopTrack();
1153 //AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1154 } //reflection question
1155
1156 // Absorption loss
1157 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
1158 //printf("Got in absorption\n");
1159 ckovData[13]=20;
1160 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1161 ckovData[13]=11;
1162 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
1163 ckovData[13]=12;
1164 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
1165 ckovData[13]=13;
1166 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
1167 ckovData[13]=13;
1168
1169 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
1170 ckovData[13]=15;
1171
1172 // CsI inefficiency
1173 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
1174 ckovData[13]=16;
1175 }
1176 gMC->StopTrack();
1177 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1178 //printf("Added One (3)!\n");
1179 //printf("Added cerenkov %d\n",fCkovNumber);
1180 } //absorption question
1181
1182
1183 // Photon goes out of tracking scope
1184 else if (procs[i] == kPStop) { //is it below energy treshold?
1185 ckovData[13]=21;
1186 gMC->StopTrack();
1187 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1188 //printf("Added One (4)!\n");
1189 } // energy treshold question
1190 } //number of mechanisms cycle
1191 /**********************End of evaluation************************/
1192 } //freon production question
1193 } //energy interval question
1194 //}//inside the proximity gap question
1195 } //cerenkov photon question
1196
1197 /**************************************End of Production Parameters Storing*********************/
1198
1199
1200 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
1201
1202 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
1203 //printf("Cerenkov\n");
1204
1205 //if (gMC->TrackPid() == 50000051)
1206 //printf("Tracking a feedback\n");
1207
1208 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
1209 {
1210 //printf("Current volume (should be CSI) (2): %s\n",gMC->CurrentVolName());
1211 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
1212 //printf("Got in CSI\n");
1213 //printf("Tracking a %d\n",gMC->TrackPid());
1214 if (gMC->Edep() > 0.){
1215 gMC->TrackPosition(position);
1216 gMC->TrackMomentum(momentum);
1217 pos[0]=position(0);
1218 pos[1]=position(1);
1219 pos[2]=position(2);
1220 mom[0]=momentum(0);
1221 mom[1]=momentum(1);
1222 mom[2]=momentum(2);
1223 mom[3]=momentum(3);
1224 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1225 Double_t rt = TMath::Sqrt(tc);
1226 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1227 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1228 gMC->Gmtod(pos,localPos,1);
1229 gMC->Gmtod(mom,localMom,2);
1230
1231 gMC->CurrentVolOffID(2,copy);
1232 vol[0]=copy;
1233 idvol=vol[0]-1;
1234
1235 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1236 //->Sector(localPos[0], localPos[2]);
1237 //printf("Sector:%d\n",sector);
1238
1239 /*if (gMC->TrackPid() == 50000051){
1240 fFeedbacks++;
1241 printf("Feedbacks:%d\n",fFeedbacks);
1242 }*/
1243
1244 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1245 ((AliRICHChamber*)fChambers->At(idvol))
1246 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1247 if(idvol<kNCH) {
1248 ckovData[0] = gMC->TrackPid(); // particle type
1249 ckovData[1] = pos[0]; // X-position for hit
1250 ckovData[2] = pos[1]; // Y-position for hit
1251 ckovData[3] = pos[2]; // Z-position for hit
1252 ckovData[4] = theta; // theta angle of incidence
1253 ckovData[5] = phi; // phi angle of incidence
1254 ckovData[8] = (Float_t) fNSDigits; // first sdigit
1255 ckovData[9] = -1; // last pad hit
1256 ckovData[13] = 4; // photon was detected
1257 ckovData[14] = mom[0];
1258 ckovData[15] = mom[1];
1259 ckovData[16] = mom[2];
1260
1261 destep = gMC->Edep();
1262 gMC->SetMaxStep(kBig);
1263 cherenkovLoss += destep;
1264 ckovData[7]=cherenkovLoss;
1265
1266 nPads = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kCerenkov);
1267
1268 if (fNSDigits > (Int_t)ckovData[8]) {
1269 ckovData[8]= ckovData[8]+1;
1270 ckovData[9]= (Float_t) fNSDigits;
1271 }
1272
1273 //printf("Cerenkov loss: %f\n", cherenkovLoss);
1274
1275 ckovData[17] = nPads;
1276 //printf("nPads:%d",nPads);
1277
1278 //TClonesArray *Hits = RICH->Hits();
1279 AliRICHHit *mipHit = (AliRICHHit*) (fHits->UncheckedAt(0));
1280 if (mipHit)
1281 {
1282 mom[0] = current->Px();
1283 mom[1] = current->Py();
1284 mom[2] = current->Pz();
1285 Float_t mipPx = mipHit->MomX();
1286 Float_t mipPy = mipHit->MomY();
1287 Float_t mipPz = mipHit->MomZ();
1288
1289 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
1290 Float_t rt = TMath::Sqrt(r);
1291 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
1292 Float_t mipRt = TMath::Sqrt(mipR);
1293 if ((rt*mipRt) > 0)
1294 {
1295 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
1296 }
1297 else
1298 {
1299 coscerenkov = 0;
1300 }
1301 Float_t cherenkov = TMath::ACos(coscerenkov);
1302 ckovData[18]=cherenkov;
1303 }
1304 //if (sector != -1)
1305 //{
1306 AddHit(gAlice->CurrentTrack(),vol,ckovData);
1307 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1308 //printf("Added One (5)!\n");
1309 //}
1310 }
1311 }
1312 }
1313 }
1314
1315 /***********************************************End of photon hits*********************************************/
1316
1317
1318 /**********************************************Charged particles treatment*************************************/
1319
1320 else if (gMC->TrackCharge())
1321 //else if (1 == 1)
1322 {
1323//If MIP
1324 /*if (gMC->IsTrackEntering())
1325 {
1326 hits[13]=20;//is track entering?
1327 }*/
1328 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1329 {
1330 gMC->TrackMomentum(momentum);
1331 mom[0]=momentum(0);
1332 mom[1]=momentum(1);
1333 mom[2]=momentum(2);
1334 mom[3]=momentum(3);
1335 hits [19] = mom[0];
1336 hits [20] = mom[1];
1337 hits [21] = mom[2];
1338 fFreonProd=1;
1339 }
1340
1341 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {
1342// Get current particle id (ipart), track position (pos) and momentum (mom)
1343
1344 gMC->CurrentVolOffID(3,copy);
1345 vol[0]=copy;
1346 idvol=vol[0]-1;
1347
1348 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1349 //->Sector(localPos[0], localPos[2]);
1350 //printf("Sector:%d\n",sector);
1351
1352 gMC->TrackPosition(position);
1353 gMC->TrackMomentum(momentum);
1354 pos[0]=position(0);
1355 pos[1]=position(1);
1356 pos[2]=position(2);
1357 mom[0]=momentum(0);
1358 mom[1]=momentum(1);
1359 mom[2]=momentum(2);
1360 mom[3]=momentum(3);
1361 gMC->Gmtod(pos,localPos,1);
1362 gMC->Gmtod(mom,localMom,2);
1363
1364 ipart = gMC->TrackPid();
1365 //
1366 // momentum loss and steplength in last step
1367 destep = gMC->Edep();
1368 step = gMC->TrackStep();
1369
1370 //
1371 // record hits when track enters ...
1372 if( gMC->IsTrackEntering()) {
1373// gMC->SetMaxStep(fMaxStepGas);
1374 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1375 Double_t rt = TMath::Sqrt(tc);
1376 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1377 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1378
1379
1380 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
1381 Double_t localRt = TMath::Sqrt(localTc);
1382 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
1383 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
1384
1385 hits[0] = Float_t(ipart); // particle type
1386 hits[1] = localPos[0]; // X-position for hit
1387 hits[2] = localPos[1]; // Y-position for hit
1388 hits[3] = localPos[2]; // Z-position for hit
1389 hits[4] = localTheta; // theta angle of incidence
1390 hits[5] = localPhi; // phi angle of incidence
1391 hits[8] = (Float_t) fNSDigits; // first sdigit
1392 hits[9] = -1; // last pad hit
1393 hits[13] = fFreonProd; // did id hit the freon?
1394 hits[14] = mom[0];
1395 hits[15] = mom[1];
1396 hits[16] = mom[2];
1397 hits[18] = 0; // dummy cerenkov angle
1398
1399 tlength = 0;
1400 eloss = 0;
1401 fFreonProd = 0;
1402
1403 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
1404
1405
1406 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
1407 xhit = localPos[0];
1408 yhit = localPos[2];
1409 // Only if not trigger chamber
1410 if(idvol<kNCH) {
1411 //
1412 // Initialize hit position (cursor) in the segmentation model
1413 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1414 ((AliRICHChamber*)fChambers->At(idvol))
1415 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1416 }
1417 }
1418
1419 //
1420 // Calculate the charge induced on a pad (disintegration) in case
1421 //
1422 // Mip left chamber ...
1423 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1424 gMC->SetMaxStep(kBig);
1425 eloss += destep;
1426 tlength += step;
1427
1428
1429 // Only if not trigger chamber
1430 if(idvol<kNCH) {
1431 if (eloss > 0)
1432 {
1433 if(gMC->TrackPid() == kNeutron)
1434 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
1435 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
1436 hits[17] = nPads;
1437 //printf("nPads:%d",nPads);
1438 }
1439 }
1440
1441 hits[6]=tlength;
1442 hits[7]=eloss;
1443 if (fNSDigits > (Int_t)hits[8]) {
1444 hits[8]= hits[8]+1;
1445 hits[9]= (Float_t) fNSDigits;
1446 }
1447
1448 //if(sector !=-1)
1449 new(lhits[fNhits++]) AliRICHHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1450 eloss = 0;
1451 //
1452 // Check additional signal generation conditions
1453 // defined by the segmentation
1454 // model (boundary crossing conditions)
1455 } else if
1456 //PH (((AliRICHChamber*) (*fChambers)[idvol])
1457 (((AliRICHChamber*)fChambers->At(idvol))
1458 ->SigGenCond(localPos[0], localPos[2], localPos[1]))
1459 {
1460 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1461 ((AliRICHChamber*)fChambers->At(idvol))
1462 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1463 if (eloss > 0)
1464 {
1465 if(gMC->TrackPid() == kNeutron)
1466 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
1467 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
1468 hits[17] = nPads;
1469 //printf("Npads:%d",NPads);
1470 }
1471 xhit = localPos[0];
1472 yhit = localPos[2];
1473 eloss = destep;
1474 tlength += step ;
1475 //
1476 // nothing special happened, add up energy loss
1477 } else {
1478 eloss += destep;
1479 tlength += step ;
1480 }
1481 }
1482 }
1483 /*************************************************End of MIP treatment**************************************/
1484 //}
1485}// void AliRICHv3::StepManager()