1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 #include "AliRICHv3.h"
26 #include <TGeometry.h>
29 #include <TLorentzVector.h>
31 #include <TParticle.h>
34 #include "AliRICHGeometry.h"
35 #include "AliRICHSegmentationV1.h"
36 #include "AliRICHResponseV0.h"
37 #include "AliRICHHit.h"
41 //______________________________________________________________
42 // Implementation of the RICH version 3 with azimuthal rotation
45 AliRICHv3::AliRICHv3(const char *sName, const char *sTitle)
46 :AliRICH(sName,sTitle)
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()
54 fCkovNumber=fFreonProd=fDebugLevel=0;
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
60 fChambers = new TObjArray(kNCH);
61 for (Int_t i=0; i<kNCH; i++){
62 fChambers->AddAt(new AliRICHChamber,i); // ??? to be changed to named ctor of AliRICHChamber
63 SetGeometryModel(i,pRICHGeometry);
64 SetSegmentationModel(i,pRICHSegmentation);
65 SetResponseModel(i,pRICHResponse);
66 ((AliRICHChamber*)fChambers->At(i))->Init(i); // ??? to be removed
68 }//AliRICHv3::ctor(const char *pcName, const char *pcTitle)
70 AliRICHv3::~AliRICHv3()
72 // Dtor deletes RICH models. In future (???) AliRICHChamber will be responsible for that.
73 if(IsDebugStart()) cout<<ClassName()<<"::dtor()>\n";
75 delete GetChamber(0)->GetGeometryModel();
76 delete GetChamber(0)->GetResponseModel();
77 delete GetChamber(0)->GetSegmentationModel();
80 void AliRICHv3::CreateMaterials()
82 // Provides material definition for simulation (currently GEANT)
83 if(IsDebugStart()) cout<<ClassName()<<"::CreateMaterials()>\n";
85 Int_t isxfld = gAlice->Field()->Integ();
86 Float_t sxmgmx = gAlice->Field()->Max();
90 //Photons energy intervals
94 ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9;
95 //printf ("Energy intervals: %e\n",ppckov[i]);
99 //Refraction index for quarz
100 Float_t rIndexQuarz[26];
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]);
114 //Refraction index for opaque quarz, methane and grid
115 Float_t rIndexOpaqueQuarz[26];
116 Float_t rIndexMethane[26];
117 Float_t rIndexGrid[26];
120 rIndexOpaqueQuarz[i]=1;
121 rIndexMethane[i]=1.000444;
123 //printf ("rIndexOpaqueQuarz , etc: %e, %e, %e\n",rIndexOpaqueQuarz[i], rIndexMethane[i], rIndexGrid[i]=1);
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.};
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};
136 //Absorption index for methane
137 Float_t abscoMethane[26];
140 abscoMethane[i]=AbsoCH4(ppckov[i]*1e9);
141 //printf("abscoMethane: %e for energy: %e\n", abscoMethane[i],ppckov[i]*1e9);
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];
152 abscoOpaqueQuarz[i]=1e-5;
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};
168 //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND
169 //UNPOLARIZED PHOTONS
173 efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0));
177 Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon,
181 Int_t nlmatmet, nlmatqua;
182 Float_t wmatquao[2], rIndexFreon[26];
183 Float_t aquao[2], epsil, stmin, zquao[2];
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];
188 Int_t *idtmed = fIdtmed->GetArray()-999;
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]);
198 // --- Detection efficiencies (quantum efficiency for CsI)
199 // --- Define parameters for honeycomb.
200 // Used carbon of equivalent rad. lenght
207 // --- Parameters to include in GSMIXT, relative to Quarz (SiO2)
218 // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2)
229 // --- Parameters to include in GSMIXT, relative to Freon (C6F14)
240 // --- Parameters to include in GSMIXT, relative to methane (CH4)
251 // --- Parameters to include in GSMIXT, relative to anode grid (Cu)
258 // --- Parameters to include in GSMATE related to aluminium sheet
265 // --- Glass parameters
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};
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.);
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);
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()
320 void AliRICHv3::CreateGeometry()
322 // Provides geometry structure for simulation (currently GEANT volumes tree)
323 if(IsDebugStart()) cout<<ClassName()<<"::CreateGeometry()>\n";
325 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
326 AliRICHSegmentationV0* segmentation;
327 AliRICHGeometry* geometry;
328 AliRICHChamber* iChamber;
330 iChamber = &(pRICH->Chamber(0));
331 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel(0);
332 geometry=iChamber->GetGeometryModel();
335 distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness();
336 geometry->SetRadiatorToPads(distance);
338 //Opaque quartz thickness
339 Float_t oqua_thickness = .5;
343 Float_t csi_width = segmentation->Npx()*segmentation->Dpx() + segmentation->DeadZone();
344 Float_t csi_length = segmentation->Npy()*segmentation->Dpy() + 2*segmentation->DeadZone();
347 Int_t *idtmed = fIdtmed->GetArray()-999;
354 // --- Define the RICH detector
355 // External aluminium box
357 par[1] = 13; //Original Settings
359 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
363 par[1] = 13; //Original Settings
365 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
367 // Air 2 (cutting the lower part of the box)
370 par[1] = 3; //Original Settings
372 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
374 // Air 3 (cutting the lower part of the box)
377 par[1] = 3; //Original Settings
379 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
383 par[1] = .188; //Original Settings
385 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
389 par[1] = .025; //Original Settings
394 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
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);
402 // Spacers (cylinders)
405 par[2] = geometry->GetFreonThickness()/2;
406 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
408 // Feet (freon slabs supports)
413 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
416 par[0] = geometry->GetQuartzWidth()/2;
418 par[2] = geometry->GetQuartzLength()/2;
419 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
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);
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);
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);
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);
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);
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);
457 par[0] = csi_width/2;
459 par[2] = csi_length/2;
460 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
466 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
471 par[0] = csi_width/2;
474 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
476 // Ceramic pick up (base)
478 par[0] = csi_width/2;
481 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
483 // Ceramic pick up (head)
485 par[0] = csi_width/2;
488 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
490 // Aluminium supports for methane and CsI
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);
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);
505 // Aluminium supports for freon
508 par[0] = geometry->GetQuartzWidth()/2;
510 par[2] = (68.35 - geometry->GetQuartzLength()/2)/2;
511 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
515 par[0] = (66.3 - geometry->GetQuartzWidth()/2)/2;
517 par[2] = geometry->GetQuartzLength()/2 + 68.35 - geometry->GetQuartzLength()/2;
518 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
522 par[0] = csi_width/2;
524 par[2] = csi_length/4 -.5025;
525 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
528 // Backplane supports
535 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
542 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
549 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
551 // Place holes inside backplane support
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");
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");
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");
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");
604 Float_t supp_y = 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness() - .2 + .3; //y position of freon supports
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");
611 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
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
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
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
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
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
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
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);
658 // Wire support placing
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");
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");
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");
678 // Place chambers into mother volume ALIC
680 Double_t dOffset = geometry->GetOffset() - geometry->GetGapThickness()/2; // distance from center of mother volume ALIC to methane
682 Double_t dAlpha = geometry->GetAlphaAngle(); // angle between centers of chambers - y-z plane
683 Double_t dAlphaRad = dAlpha*kDegrad;
685 Double_t dBeta = geometry->GetBetaAngle(); // angle between center of chambers - y-x plane
686 Double_t dBetaRad = dBeta*kDegrad;
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;
692 TRotMatrix *pRotMatrix; // tmp pointer
694 TVector3 vector(0,dOffset,0); // Position of chamber 2 without rotation
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 );
700 vector.SetXYZ(0,dOffset,0); vector.RotateX(dAlphaRad);
701 vector.RotateZ(-dRotAngleRad);
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);
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 );
709 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad);
710 vector.RotateZ(-dRotAngleRad);
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);
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 );
718 vector.SetXYZ(0,dOffset,0);
719 vector.RotateZ(-dRotAngleRad);
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);
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 );
727 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad);
728 vector.RotateZ(-dRotAngleRad);
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);
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 );
736 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad); vector.RotateX(-dAlphaRad);
737 vector.RotateZ(-dRotAngleRad);
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);
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 );
745 vector.SetXYZ(0,dOffset,0); vector.RotateX(-dAlphaRad);
746 vector.RotateZ(-dRotAngleRad);
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);
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 );
754 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad); vector.RotateX(-dAlphaRad);
755 vector.RotateZ(-dRotAngleRad);
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);
760 }//void AliRICHv3::CreateGeometry()
765 void AliRICHv3::Init()
767 // Makes nothing for a while
768 if(IsDebugStart()) cout<<ClassName()<<"::Init()>\n";
773 void AliRICHv3::BuildGeometry()
775 // Provides geometry structure for event display (ROOT TNode tree)
777 if(IsDebugStart()) cout<<ClassName()<<"::BuildGeometry()>\n";
779 TNode *node, *subnode, *top;
781 const int kColorRICH = kRed;
783 top=gAlice->GetGeometry()->GetNode("alice");
785 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
786 AliRICHChamber* iChamber;
787 AliRICHGeometry* geometry;
789 iChamber = &(pRICH->Chamber(0));
790 AliRICHSegmentationV1* segmentation=(AliRICHSegmentationV1*) iChamber->GetSegmentationModel(0);
791 geometry=iChamber->GetGeometryModel();
793 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
795 Float_t padplane_width = segmentation->GetPadPlaneWidth();
796 Float_t padplane_length = segmentation->GetPadPlaneLength();
799 new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
803 node = new TNode("RICH1","RICH1","S_RICH",Chamber(0).GetX(),Chamber(0).GetY(),Chamber(0).GetZ(),"rot993");
804 node->SetLineColor(kColorRICH);
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);
828 node = new TNode("RICH2","RICH2","S_RICH",Chamber(1).GetX(),Chamber(1).GetY(),Chamber(1).GetZ(),"rot994");
829 node->SetLineColor(kColorRICH);
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);
853 node = new TNode("RICH3","RICH3","S_RICH",Chamber(2).GetX(),Chamber(2).GetY(),Chamber(2).GetZ(),"rot995");
854 node->SetLineColor(kColorRICH);
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);
878 node = new TNode("RICH4","RICH4","S_RICH",Chamber(3).GetX(),Chamber(3).GetY(),Chamber(3).GetZ(),"rot996");
879 node->SetLineColor(kColorRICH);
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);
903 node = new TNode("RICH5","RICH5","S_RICH",Chamber(4).GetX(),Chamber(4).GetY(),Chamber(4).GetZ(),"rot997");
904 node->SetLineColor(kColorRICH);
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);
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);
952 node = new TNode("RICH7","RICH7","S_RICH",Chamber(6).GetX(),Chamber(6).GetY(),Chamber(6).GetZ(),"rot999");
953 node->SetLineColor(kColorRICH);
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);
975 }//AliRICHv3::BuildGeometry()
977 void AliRICHv3::StepManager()
979 // The active Step Manager is realised currently in AliRICHv3 for debug
980 // leaving StepManager in AliRICH intact. To be removed in future.
986 static Float_t hits[22];
987 static Float_t ckovData[19];
988 TLorentzVector position;
989 TLorentzVector momentum;
994 Float_t localTheta,localPhi;
996 Float_t destep, step;
1000 static Float_t eloss, xhit, yhit, tlength;
1001 const Float_t kBig=1.e10;
1003 TClonesArray &lhits = *fHits;
1004 TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->CurrentTrack()];
1006 //if (current->Energy()>1)
1009 // Only gas gap inside chamber
1010 // Tag chambers and record hits when track enters
1013 id=gMC->CurrentVolID(copy);
1014 Float_t cherenkovLoss=0;
1015 //gAlice->KeepTrack(gAlice->CurrentTrack());
1017 gMC->TrackPosition(position);
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();
1028 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->CurrentTrack());
1030 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
1032 /********************Store production parameters for Cerenkov photons************************/
1033 //is it a Cerenkov photon?
1034 if (gMC->TrackPid() == 50000050) {
1036 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
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)
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))
1047 if (gMC->IsNewTrack()){ //is it the first step?
1048 //printf("I'm in!\n");
1049 Int_t mother = current->GetFirstMother();
1051 //printf("Second Mother:%d\n",current->GetSecondMother());
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");
1059 //printf("Index: %d\n",fCkovNumber);
1060 } //first step question
1063 if (gMC->IsNewTrack()){ //is it first step?
1064 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
1067 //printf("Produced in QUAR\n");
1069 } //first step question
1071 //printf("Before %d\n",fFreonProd);
1072 } //track entering question
1074 if (ckovData[12] == 1) //was it produced in Freon?
1075 //if (fFreonProd == 1)
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?
1083 //printf("Got in META\n");
1084 gMC->TrackMomentum(momentum);
1089 // Z-position for hit
1092 /**************** Photons lost in second grid have to be calculated by hand************/
1094 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
1095 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
1097 //printf("grid calculation:%f\n",t);
1101 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1102 //printf("Added One (1)!\n");
1103 //printf("Lost one in grid\n");
1105 /**********************************************************************************/
1108 //printf("Current volume (should be CSI) (1): %s\n",gMC->CurrentVolName());
1109 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
1110 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
1112 //printf("Got in CSI\n");
1113 gMC->TrackMomentum(momentum);
1119 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
1120 /***********************Cerenkov phtons (always polarised)*************************/
1122 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
1123 Float_t t = Fresnel(ckovEnergy*1e9,cophi,1);
1128 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1129 //printf("Added One (2)!\n");
1130 //printf("Lost by Fresnel\n");
1132 /**********************************************************************************/
1137 /********************Evaluation of losses************************/
1138 /******************still in the old fashion**********************/
1141 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
1142 for (Int_t i = 0; i < i1; ++i) {
1144 if (procs[i] == kPLightReflection) { //was it reflected
1146 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1148 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
1151 //AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1152 } //reflection question
1155 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
1156 //printf("Got in absorption\n");
1158 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1160 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
1162 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
1164 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
1167 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
1171 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
1175 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1176 //printf("Added One (3)!\n");
1177 //printf("Added cerenkov %d\n",fCkovNumber);
1178 } //absorption question
1181 // Photon goes out of tracking scope
1182 else if (procs[i] == kPStop) { //is it below energy treshold?
1185 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1186 //printf("Added One (4)!\n");
1187 } // energy treshold question
1188 } //number of mechanisms cycle
1189 /**********************End of evaluation************************/
1190 } //freon production question
1191 } //energy interval question
1192 //}//inside the proximity gap question
1193 } //cerenkov photon question
1195 /**************************************End of Production Parameters Storing*********************/
1198 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
1200 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
1201 //printf("Cerenkov\n");
1203 //if (gMC->TrackPid() == 50000051)
1204 //printf("Tracking a feedback\n");
1206 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
1208 //printf("Current volume (should be CSI) (2): %s\n",gMC->CurrentVolName());
1209 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
1210 //printf("Got in CSI\n");
1211 //printf("Tracking a %d\n",gMC->TrackPid());
1212 if (gMC->Edep() > 0.){
1213 gMC->TrackPosition(position);
1214 gMC->TrackMomentum(momentum);
1222 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1223 Double_t rt = TMath::Sqrt(tc);
1224 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1225 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1226 gMC->Gmtod(pos,localPos,1);
1227 gMC->Gmtod(mom,localMom,2);
1229 gMC->CurrentVolOffID(2,copy);
1233 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1234 //->Sector(localPos[0], localPos[2]);
1235 //printf("Sector:%d\n",sector);
1237 /*if (gMC->TrackPid() == 50000051){
1239 printf("Feedbacks:%d\n",fFeedbacks);
1242 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1243 ((AliRICHChamber*)fChambers->At(idvol))
1244 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1246 ckovData[0] = gMC->TrackPid(); // particle type
1247 ckovData[1] = pos[0]; // X-position for hit
1248 ckovData[2] = pos[1]; // Y-position for hit
1249 ckovData[3] = pos[2]; // Z-position for hit
1250 ckovData[4] = theta; // theta angle of incidence
1251 ckovData[5] = phi; // phi angle of incidence
1252 ckovData[8] = (Float_t) fNSDigits; // first sdigit
1253 ckovData[9] = -1; // last pad hit
1254 ckovData[13] = 4; // photon was detected
1255 ckovData[14] = mom[0];
1256 ckovData[15] = mom[1];
1257 ckovData[16] = mom[2];
1259 destep = gMC->Edep();
1260 gMC->SetMaxStep(kBig);
1261 cherenkovLoss += destep;
1262 ckovData[7]=cherenkovLoss;
1264 nPads = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kCerenkov);
1266 if (fNSDigits > (Int_t)ckovData[8]) {
1267 ckovData[8]= ckovData[8]+1;
1268 ckovData[9]= (Float_t) fNSDigits;
1271 //printf("Cerenkov loss: %f\n", cherenkovLoss);
1273 ckovData[17] = nPads;
1274 //printf("nPads:%d",nPads);
1276 //TClonesArray *Hits = RICH->Hits();
1277 AliRICHHit *mipHit = (AliRICHHit*) (fHits->UncheckedAt(0));
1280 mom[0] = current->Px();
1281 mom[1] = current->Py();
1282 mom[2] = current->Pz();
1283 Float_t mipPx = mipHit->MomX();
1284 Float_t mipPy = mipHit->MomY();
1285 Float_t mipPz = mipHit->MomZ();
1287 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
1288 Float_t rt = TMath::Sqrt(r);
1289 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
1290 Float_t mipRt = TMath::Sqrt(mipR);
1293 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
1299 Float_t cherenkov = TMath::ACos(coscerenkov);
1300 ckovData[18]=cherenkov;
1304 AddHit(gAlice->CurrentTrack(),vol,ckovData);
1305 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
1306 //printf("Added One (5)!\n");
1313 /***********************************************End of photon hits*********************************************/
1316 /**********************************************Charged particles treatment*************************************/
1318 else if (gMC->TrackCharge())
1322 /*if (gMC->IsTrackEntering())
1324 hits[13]=20;//is track entering?
1326 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1328 gMC->TrackMomentum(momentum);
1339 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {
1340 // Get current particle id (ipart), track position (pos) and momentum (mom)
1342 gMC->CurrentVolOffID(3,copy);
1346 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1347 //->Sector(localPos[0], localPos[2]);
1348 //printf("Sector:%d\n",sector);
1350 gMC->TrackPosition(position);
1351 gMC->TrackMomentum(momentum);
1359 gMC->Gmtod(pos,localPos,1);
1360 gMC->Gmtod(mom,localMom,2);
1362 ipart = gMC->TrackPid();
1364 // momentum loss and steplength in last step
1365 destep = gMC->Edep();
1366 step = gMC->TrackStep();
1369 // record hits when track enters ...
1370 if( gMC->IsTrackEntering()) {
1371 // gMC->SetMaxStep(fMaxStepGas);
1372 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1373 Double_t rt = TMath::Sqrt(tc);
1374 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1375 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1378 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
1379 Double_t localRt = TMath::Sqrt(localTc);
1380 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
1381 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
1383 hits[0] = Float_t(ipart); // particle type
1384 hits[1] = localPos[0]; // X-position for hit
1385 hits[2] = localPos[1]; // Y-position for hit
1386 hits[3] = localPos[2]; // Z-position for hit
1387 hits[4] = localTheta; // theta angle of incidence
1388 hits[5] = localPhi; // phi angle of incidence
1389 hits[8] = (Float_t) fNSDigits; // first sdigit
1390 hits[9] = -1; // last pad hit
1391 hits[13] = fFreonProd; // did id hit the freon?
1395 hits[18] = 0; // dummy cerenkov angle
1401 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
1404 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
1407 // Only if not trigger chamber
1410 // Initialize hit position (cursor) in the segmentation model
1411 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1412 ((AliRICHChamber*)fChambers->At(idvol))
1413 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1418 // Calculate the charge induced on a pad (disintegration) in case
1420 // Mip left chamber ...
1421 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1422 gMC->SetMaxStep(kBig);
1427 // Only if not trigger chamber
1431 if(gMC->TrackPid() == kNeutron)
1432 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
1433 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
1435 //printf("nPads:%d",nPads);
1441 if (fNSDigits > (Int_t)hits[8]) {
1443 hits[9]= (Float_t) fNSDigits;
1447 new(lhits[fNhits++]) AliRICHHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1450 // Check additional signal generation conditions
1451 // defined by the segmentation
1452 // model (boundary crossing conditions)
1454 //PH (((AliRICHChamber*) (*fChambers)[idvol])
1455 (((AliRICHChamber*)fChambers->At(idvol))
1456 ->SigGenCond(localPos[0], localPos[2], localPos[1]))
1458 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1459 ((AliRICHChamber*)fChambers->At(idvol))
1460 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1463 if(gMC->TrackPid() == kNeutron)
1464 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
1465 nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);
1467 //printf("Npads:%d",NPads);
1474 // nothing special happened, add up energy loss
1481 /*************************************************End of MIP treatment**************************************/
1483 }// void AliRICHv3::StepManager()