]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHv3.cxx
new Hits2SDigits.
[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
88cb7938 16/* $Id$ */
9d6c0962 17
7118aef0 18#include <Riostream.h>
9123a941 19
88cb7938 20#include <TBRIK.h>
21#include <TGeometry.h>
9d6c0962 22#include <TLorentzVector.h>
88cb7938 23#include <TNode.h>
9d6c0962 24#include <TParticle.h>
88cb7938 25#include <TVector3.h>
26#include <TVirtualMC.h>
cd1cf354 27#include <TPDGCode.h> //for kNuetron
9d6c0962 28
88cb7938 29#include "AliConst.h"
30#include "AliMagF.h"
31#include "AliPDG.h"
ae714751 32#include "AliRICHGeometry.h"
88cb7938 33#include "AliRICHResponseV0.h"
34#include "AliRICHSegmentationV1.h"
35#include "AliRICHv3.h"
36#include "AliRun.h"
ae714751 37
9d6c0962 38ClassImp(AliRICHv3)
ae714751 39
9d6c0962 40//______________________________________________________________
41// Implementation of the RICH version 3 with azimuthal rotation
9123a941 42
9123a941 43
9d6c0962 44AliRICHv3::AliRICHv3(const char *sName, const char *sTitle)
45 :AliRICH(sName,sTitle)
9123a941 46{
9d6c0962 47// The named ctor currently creates a single copy of
48// AliRICHGeometry AliRICHSegmentationV1 AliRICHResponseV0
49// and initialises the corresponding models of all 7 chambers with these stuctures.
50// Note: all chambers share the single copy of models. MUST be changed later (???).
cd1cf354 51 if(GetDebug())Info("named ctor","Start.");
9123a941 52
cd1cf354 53 fCkovNumber=fFreonProd=0;
ae714751 54
9d6c0962 55 AliRICHGeometry *pRICHGeometry =new AliRICHGeometry; // ??? to be moved to AlRICHChamber::named ctor
56 AliRICHSegmentationV1 *pRICHSegmentation=new AliRICHSegmentationV1; // ??? to be moved to AlRICHChamber::named ctor
57 AliRICHResponseV0 *pRICHResponse =new AliRICHResponseV0; // ??? to be moved to AlRICHChamber::named ctor
ae714751 58
9123a941 59 fChambers = new TObjArray(kNCH);
60 for (Int_t i=0; i<kNCH; i++){
9d6c0962 61 fChambers->AddAt(new AliRICHChamber,i); // ??? to be changed to named ctor of AliRICHChamber
ae714751 62 SetGeometryModel(i,pRICHGeometry);
63 SetSegmentationModel(i,pRICHSegmentation);
64 SetResponseModel(i,pRICHResponse);
9d6c0962 65 ((AliRICHChamber*)fChambers->At(i))->Init(i); // ??? to be removed
9123a941 66 }
cd1cf354 67 if(GetDebug())Info("named ctor","Stop.");
9123a941 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.
cd1cf354 73 if(GetDebug()) cout<<ClassName()<<"::dtor()>\n";
9d6c0962 74
75 delete GetChamber(0)->GetGeometryModel();
76 delete GetChamber(0)->GetResponseModel();
77 delete GetChamber(0)->GetSegmentationModel();
78}//AliRICHv3::dtor()
79
9123a941 80
81void AliRICHv3::CreateGeometry()
82{
9d6c0962 83// Provides geometry structure for simulation (currently GEANT volumes tree)
cd1cf354 84 if(GetDebug()) cout<<ClassName()<<"::CreateGeometry()>\n";
9123a941 85
86 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
87 AliRICHSegmentationV0* segmentation;
88 AliRICHGeometry* geometry;
89 AliRICHChamber* iChamber;
90
91 iChamber = &(pRICH->Chamber(0));
92 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel(0);
93 geometry=iChamber->GetGeometryModel();
94
95 Float_t distance;
96 distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness();
97 geometry->SetRadiatorToPads(distance);
98
99 //Opaque quartz thickness
100 Float_t oqua_thickness = .5;
101 //CsI dimensions
102
103
104 Float_t csi_width = segmentation->Npx()*segmentation->Dpx() + segmentation->DeadZone();
105 Float_t csi_length = segmentation->Npy()*segmentation->Dpy() + 2*segmentation->DeadZone();
106
107
108 Int_t *idtmed = fIdtmed->GetArray()-999;
109
110 Int_t i;
111 Float_t zs;
112 Int_t idrotm[1099];
113 Float_t par[3];
114
115 // --- Define the RICH detector
116 // External aluminium box
117 par[0] = 68.8;
118 par[1] = 13; //Original Settings
119 par[2] = 70.86;
120 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
121
122 // Air
123 par[0] = 66.3;
124 par[1] = 13; //Original Settings
125 par[2] = 68.35;
126 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
127
128 // Air 2 (cutting the lower part of the box)
129
130 par[0] = 1.25;
131 par[1] = 3; //Original Settings
132 par[2] = 70.86;
133 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
134
135 // Air 3 (cutting the lower part of the box)
136
137 par[0] = 66.3;
138 par[1] = 3; //Original Settings
139 par[2] = 1.2505;
140 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
141
142 // Honeycomb
143 par[0] = 66.3;
144 par[1] = .188; //Original Settings
145 par[2] = 68.35;
146 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
147
148 // Aluminium sheet
149 par[0] = 66.3;
150 par[1] = .025; //Original Settings
151 par[2] = 68.35;
152 /*par[0] = 66.5;
153 par[1] = .025;
154 par[2] = 63.1;*/
155 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
156
157 // Quartz
158 par[0] = geometry->GetQuartzWidth()/2;
159 par[1] = geometry->GetQuartzThickness()/2;
160 par[2] = geometry->GetQuartzLength()/2;
161 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
162
163 // Spacers (cylinders)
164 par[0] = 0.;
165 par[1] = .5;
166 par[2] = geometry->GetFreonThickness()/2;
167 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
168
169 // Feet (freon slabs supports)
170
171 par[0] = .7;
172 par[1] = .3;
173 par[2] = 1.9;
174 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
175
176 // Opaque quartz
177 par[0] = geometry->GetQuartzWidth()/2;
178 par[1] = .2;
179 par[2] = geometry->GetQuartzLength()/2;
180 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
181
182 // Frame of opaque quartz
183 par[0] = geometry->GetOuterFreonWidth()/2;
184 par[1] = geometry->GetFreonThickness()/2;
185 par[2] = geometry->GetOuterFreonLength()/2;
186 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
187
188 par[0] = geometry->GetInnerFreonWidth()/2;
189 par[1] = geometry->GetFreonThickness()/2;
190 par[2] = geometry->GetInnerFreonLength()/2;
191 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
192
193
194 // Freon
195 par[0] = geometry->GetOuterFreonWidth()/2 - oqua_thickness;
196 par[1] = geometry->GetFreonThickness()/2;
197 par[2] = geometry->GetOuterFreonLength()/2 - 2*oqua_thickness;
198 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
199
200 par[0] = geometry->GetInnerFreonWidth()/2 - oqua_thickness;
201 par[1] = geometry->GetFreonThickness()/2;
202 par[2] = geometry->GetInnerFreonLength()/2 - 2*oqua_thickness;
203 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
204
205 // Methane
206 par[0] = csi_width/2;
207 par[1] = geometry->GetGapThickness()/2;
208 par[2] = csi_length/2;
209 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
210
211 // Methane gap
212 par[0] = csi_width/2;
213 par[1] = geometry->GetProximityGapThickness()/2;
214 par[2] = csi_length/2;
215 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
216
217 // CsI photocathode
218 par[0] = csi_width/2;
219 par[1] = .25;
220 par[2] = csi_length/2;
221 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
222
223 // Anode grid
224 par[0] = 0.;
225 par[1] = .001;
226 par[2] = 20.;
227 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
228
229 // Wire supports
230 // Bar of metal
231
232 par[0] = csi_width/2;
233 par[1] = 1.05;
234 par[2] = 1.05;
235 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
236
237 // Ceramic pick up (base)
238
239 par[0] = csi_width/2;
240 par[1] = .25;
241 par[2] = 1.05;
242 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
243
244 // Ceramic pick up (head)
245
246 par[0] = csi_width/2;
247 par[1] = .1;
248 par[2] = .1;
249 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
250
251 // Aluminium supports for methane and CsI
252 // Short bar
253
254 par[0] = csi_width/2;
255 par[1] = geometry->GetGapThickness()/2 + .25;
256 par[2] = (68.35 - csi_length/2)/2;
257 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
258
259 // Long bar
260
261 par[0] = (66.3 - csi_width/2)/2;
262 par[1] = geometry->GetGapThickness()/2 + .25;
263 par[2] = csi_length/2 + 68.35 - csi_length/2;
264 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
265
266 // Aluminium supports for freon
267 // Short bar
268
269 par[0] = geometry->GetQuartzWidth()/2;
270 par[1] = .3;
271 par[2] = (68.35 - geometry->GetQuartzLength()/2)/2;
272 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
273
274 // Long bar
275
276 par[0] = (66.3 - geometry->GetQuartzWidth()/2)/2;
277 par[1] = .3;
278 par[2] = geometry->GetQuartzLength()/2 + 68.35 - geometry->GetQuartzLength()/2;
279 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
280
281 // PCB backplane
282
283 par[0] = csi_width/2;
284 par[1] = .25;
285 par[2] = csi_length/4 -.5025;
286 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
287
288
289 // Backplane supports
290
291 // Aluminium slab
292
293 par[0] = 33.15;
294 par[1] = 2;
295 par[2] = 21.65;
296 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
297
298 // Big hole
299
300 par[0] = 9.05;
301 par[1] = 2;
302 par[2] = 4.4625;
303 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
304
305 // Small hole
306
307 par[0] = 5.7;
308 par[1] = 2;
309 par[2] = 4.4625;
310 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
311
312 // Place holes inside backplane support
313
314 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
315 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
316 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
317 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
318 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
319 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
320 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
321 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
322 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
323 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
324 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
325 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
326 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
327 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
328 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
329 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
330
331
332
333 // --- Places the detectors defined with GSVOLU
334 // Place material inside RICH
335 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
336 gMC->Gspos("AIR2", 1, "RICH", 66.3 + 1.2505, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
337 gMC->Gspos("AIR2", 2, "RICH", -66.3 - 1.2505, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
338 gMC->Gspos("AIR3", 1, "RICH", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, -68.35 - 1.25, 0, "ONLY");
339 gMC->Gspos("AIR3", 2, "RICH", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 68.35 + 1.25, 0, "ONLY");
340
341
342 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
343 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
344 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
345 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
346 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
347 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
348 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
349 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
350 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
351 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
352 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
353 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .2, 0., 0, "ONLY");
354
355 // Supports placing
356
357 // Methane supports
358 gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
359 gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
360 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
361 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
362
363 //Freon supports
364
365 Float_t supp_y = 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness() - .2 + .3; //y position of freon supports
366
367 gMC->Gspos("SFLG", 1, "SRIC", geometry->GetQuartzWidth()/2 + (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
368 gMC->Gspos("SFLG", 2, "SRIC", - geometry->GetQuartzWidth()/2 - (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
369 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, geometry->GetQuartzLength()/2 + (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
370 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - geometry->GetQuartzLength()/2 - (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
371
372 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
373
374
375 Int_t nspacers = 30;
376
377 for (i = 0; i < nspacers/3; i++) {
378 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
379 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
380 }
381
382 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
383 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
384 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
385 }
386
387 for (i = (nspacers*2)/3; i < nspacers; ++i) {
388 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
389 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
390 }
391
392 for (i = 0; i < nspacers/3; i++) {
393 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
394 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
395 }
396
397 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
398 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
399 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
400 }
401
402 for (i = (nspacers*2)/3; i < nspacers; ++i) {
403 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
404 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
405 }
406
407
408 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
409 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
410 gMC->Gspos("OQF1", 1, "SRIC", geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2 + 2, 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3)
411 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings
412 gMC->Gspos("OQF1", 3, "SRIC", - (geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2) - 2, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings (-31.3)
413 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness()/2, 0., 0, "ONLY");
414 gMC->Gspos("GAP ", 1, "META", 0., geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
415 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
416 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + geometry->GetGapThickness()/2 + .25, 0., 0, "ONLY");
417 printf("CSI pos: %f\n",1.276 + geometry->GetGapThickness()/2 + .25);
418
419 // Wire support placing
420
421 gMC->Gspos("WSG2", 1, "GAP ", 0., geometry->GetProximityGapThickness()/2 - .1, 0., 0, "ONLY");
422 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
423 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
424
425 // Backplane placing
426
427 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
428 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
429 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
430 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
431 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
432 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
433
434 // PCB placing
435
436 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
437 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
438
439// Place chambers into mother volume ALIC
440
9d6c0962 441 Double_t dOffset = geometry->GetOffset() - geometry->GetGapThickness()/2; // distance from center of mother volume ALIC to methane
442
443 Double_t dAlpha = geometry->GetAlphaAngle(); // angle between centers of chambers - y-z plane
444 Double_t dAlphaRad = dAlpha*kDegrad;
445
446 Double_t dBeta = geometry->GetBetaAngle(); // angle between center of chambers - y-x plane
447 Double_t dBetaRad = dBeta*kDegrad;
448
449 Double_t dRotAngle = geometry->GetRotationAngle(); // the whole RICH is to be rotated in x-y plane + means clockwise rotation
450 Double_t dRotAngleRad = dRotAngle*kDegrad;
9d6c0962 451
4b7382d1 452
9d6c0962 453 TRotMatrix *pRotMatrix; // tmp pointer
454
455 TVector3 vector(0,dOffset,0); // Position of chamber 2 without rotation
456
9123a941 457// Chamber 0 standalone (no other chambers in this row)
4b7382d1 458 pRotMatrix = new TRotMatrix("rot993","rot993", 0., 0., 0.,0.,0.,0.);
459 const Double_t* r = pRotMatrix->SetAngles(90., 0., 90.-dAlpha , 90., dAlpha, -90.);
460 Double_t* rr = RotateXY(r, -dRotAngleRad);
461 AliMatrix(idrotm[1000], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
462 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9123a941 463
9d6c0962 464 vector.SetXYZ(0,dOffset,0); vector.RotateX(dAlphaRad);
465 vector.RotateZ(-dRotAngleRad);
9123a941 466
9d6c0962 467 gMC->Gspos("RICH",1,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1000], "ONLY");
468 Chamber(0).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 469 if(GetDebug()) Info("CreateGeometry 0","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
470 if(GetDebug()) Info("CreateGeometry 0","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 471// Chamber 1
4b7382d1 472 pRotMatrix = new TRotMatrix("rot994","rot994", 0., 0., 0.,0.,0.,0.);
473 r = pRotMatrix->SetAngles(90., -dBeta, 90., 90.-dBeta, 0., 0.);
474 rr = RotateXY(r, -dRotAngleRad);
475 AliMatrix(idrotm[1001], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
476 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 477 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad);
478 vector.RotateZ(-dRotAngleRad);
9123a941 479
9d6c0962 480 gMC->Gspos("RICH",2,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1001], "ONLY");
481 Chamber(1).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 482 if(GetDebug()) Info("CreateGeometry 1","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
483 if(GetDebug()) Info("CreateGeometry 1","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 484// Chamber 2 the top one with no Alpha-Beta rotation
4b7382d1 485 pRotMatrix = new TRotMatrix("rot995","rot995", 0., 0., 0.,0.,0.,0.);
486 r = pRotMatrix->SetAngles(90., 0., 90., 90., 0., 0.);
487 rr = RotateXY(r, -dRotAngleRad);
488 AliMatrix(idrotm[1002], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
489 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 490 vector.SetXYZ(0,dOffset,0);
491 vector.RotateZ(-dRotAngleRad);
9d6c0962 492 gMC->Gspos("RICH",3,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1002], "ONLY");
493 Chamber(2).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 494 if(GetDebug()) Info("CreateGeometry 2","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
495 if(GetDebug()) Info("CreateGeometry 2","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 496// Chamber 3
4b7382d1 497 pRotMatrix = new TRotMatrix("rot996","rot996", 0., 0., 0.,0.,0.,0.);
498 r = pRotMatrix->SetAngles(90., dBeta, 90., 90.+dBeta, 0., 0.);
499 rr = RotateXY(r, -dRotAngleRad);
500 AliMatrix(idrotm[1003], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
501 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 502 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad);
503 vector.RotateZ(-dRotAngleRad);
9123a941 504
9d6c0962 505 gMC->Gspos("RICH",4,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1003], "ONLY");
506 Chamber(3).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 507 if(GetDebug()) Info("CreateGeometry 3","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
508 if(GetDebug()) Info("CreateGeometry 3","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 509// Chamber 4
4b7382d1 510 pRotMatrix = new TRotMatrix("rot997","rot997", 0., 0., 0.,0.,0.,0.);
511 r = pRotMatrix->SetAngles(90., 360.-dBeta, 108.2, 90.-dBeta, 18.2, 90.-dBeta);
512 rr = RotateXY(r, -dRotAngleRad);
513 AliMatrix(idrotm[1004], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
514 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 515 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad); vector.RotateX(-dAlphaRad);
516 vector.RotateZ(-dRotAngleRad);
9123a941 517
9d6c0962 518 gMC->Gspos("RICH",5,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1004], "ONLY");
519 Chamber(4).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 520 if(GetDebug()) Info("CreateGeometry 4","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
521 if(GetDebug()) Info("CreateGeometry 4","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 522// Chamber 5
4b7382d1 523 pRotMatrix = new TRotMatrix("rot998","rot998", 0., 0., 0.,0.,0.,0.);
524 r = pRotMatrix->SetAngles(90., 0., 90.+dAlpha, 90., dAlpha, 90.);
525 rr = RotateXY(r, -dRotAngleRad);
526 AliMatrix(idrotm[1005], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
527 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 528 vector.SetXYZ(0,dOffset,0); vector.RotateX(-dAlphaRad);
529 vector.RotateZ(-dRotAngleRad);
530
531 gMC->Gspos("RICH",6,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1005], "ONLY");
532 Chamber(5).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 533 if(GetDebug()) Info("CreateGeometry 5","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
534 if(GetDebug()) Info("CreateGeometry 5","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
4b7382d1 535// Chamber 6
536 pRotMatrix = new TRotMatrix("rot999","rot999", 0., 0., 0.,0.,0.,0.);
537 r = pRotMatrix->SetAngles(90., dBeta, 108.2, 90.+dBeta, 18.2, 90.+dBeta);
538 rr = RotateXY(r, -dRotAngleRad);
539 AliMatrix(idrotm[1006], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
540 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 541 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad); vector.RotateX(-dAlphaRad);
542 vector.RotateZ(-dRotAngleRad);
543
544 gMC->Gspos("RICH",7,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1006], "ONLY");
545 Chamber(6).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 546 if(GetDebug()) Info("CreateGeometry 6","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
547 if(GetDebug()) Info("CreateGeometry 6","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 548
549}//void AliRICHv3::CreateGeometry()
e1826cc2 550//______________________________________________________________________________
9123a941 551void AliRICHv3::Init()
cd1cf354 552{//Makes nothing for a while
553 if(GetDebug())Info("Init","Start.");
554 if(GetDebug())Info("Init","Stop.");
9123a941 555}
e1826cc2 556//______________________________________________________________________________
9123a941 557void AliRICHv3::BuildGeometry()
cd1cf354 558{//Provides geometry structure for event display (ROOT TNode tree)
559 if(GetDebug())Info("BuildGeometry","Start.");
9123a941 560
561 TNode *node, *subnode, *top;
562
563 const int kColorRICH = kRed;
564 //
565 top=gAlice->GetGeometry()->GetNode("alice");
566
567 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
9123a941 568 AliRICHChamber* iChamber;
569 AliRICHGeometry* geometry;
570
571 iChamber = &(pRICH->Chamber(0));
9d6c0962 572 AliRICHSegmentationV1* segmentation=(AliRICHSegmentationV1*) iChamber->GetSegmentationModel(0);
9123a941 573 geometry=iChamber->GetGeometryModel();
574
575 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
576
577 Float_t padplane_width = segmentation->GetPadPlaneWidth();
578 Float_t padplane_length = segmentation->GetPadPlaneLength();
579
580
581 new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
582
583// Chamber 0
584 top->cd();
585 node = new TNode("RICH1","RICH1","S_RICH",Chamber(0).GetX(),Chamber(0).GetY(),Chamber(0).GetZ(),"rot993");
586 node->SetLineColor(kColorRICH);
587 node->cd();
588 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
589 subnode->SetLineColor(kGreen);
590 fNodes->Add(subnode);
591 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
592 subnode->SetLineColor(kGreen);
593 fNodes->Add(subnode);
594 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
595 subnode->SetLineColor(kGreen);
596 fNodes->Add(subnode);
597 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
598 subnode->SetLineColor(kGreen);
599 fNodes->Add(subnode);
600 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
601 subnode->SetLineColor(kGreen);
602 fNodes->Add(subnode);
603 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
604 subnode->SetLineColor(kGreen);
605 fNodes->Add(subnode);
606 fNodes->Add(node);
607
608// Chamber 1
609 top->cd();
610 node = new TNode("RICH2","RICH2","S_RICH",Chamber(1).GetX(),Chamber(1).GetY(),Chamber(1).GetZ(),"rot994");
611 node->SetLineColor(kColorRICH);
612 node->cd();
613 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
614 subnode->SetLineColor(kGreen);
615 fNodes->Add(subnode);
616 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
617 subnode->SetLineColor(kGreen);
618 fNodes->Add(subnode);
619 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
620 subnode->SetLineColor(kGreen);
621 fNodes->Add(subnode);
622 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
623 subnode->SetLineColor(kGreen);
624 fNodes->Add(subnode);
625 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
626 subnode->SetLineColor(kGreen);
627 fNodes->Add(subnode);
628 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
629 subnode->SetLineColor(kGreen);
630 fNodes->Add(subnode);
631 fNodes->Add(node);
632
633// Chamber 2
634 top->cd();
635 node = new TNode("RICH3","RICH3","S_RICH",Chamber(2).GetX(),Chamber(2).GetY(),Chamber(2).GetZ(),"rot995");
636 node->SetLineColor(kColorRICH);
637 node->cd();
638 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
639 subnode->SetLineColor(kGreen);
640 fNodes->Add(subnode);
641 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
642 subnode->SetLineColor(kGreen);
643 fNodes->Add(subnode);
644 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
645 subnode->SetLineColor(kGreen);
646 fNodes->Add(subnode);
647 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
648 subnode->SetLineColor(kGreen);
649 fNodes->Add(subnode);
650 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
651 subnode->SetLineColor(kGreen);
652 fNodes->Add(subnode);
653 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
654 subnode->SetLineColor(kGreen);
655 fNodes->Add(subnode);
656 fNodes->Add(node);
657
658// Chamber 3
659 top->cd();
660 node = new TNode("RICH4","RICH4","S_RICH",Chamber(3).GetX(),Chamber(3).GetY(),Chamber(3).GetZ(),"rot996");
661 node->SetLineColor(kColorRICH);
662 node->cd();
663 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
664 subnode->SetLineColor(kGreen);
665 fNodes->Add(subnode);
666 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
667 subnode->SetLineColor(kGreen);
668 fNodes->Add(subnode);
669 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
670 subnode->SetLineColor(kGreen);
671 fNodes->Add(subnode);
672 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
673 subnode->SetLineColor(kGreen);
674 fNodes->Add(subnode);
675 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
676 subnode->SetLineColor(kGreen);
677 fNodes->Add(subnode);
678 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
679 subnode->SetLineColor(kGreen);
680 fNodes->Add(subnode);
681 fNodes->Add(node);
682
683// Chamber 4
684 top->cd();
685 node = new TNode("RICH5","RICH5","S_RICH",Chamber(4).GetX(),Chamber(4).GetY(),Chamber(4).GetZ(),"rot997");
686 node->SetLineColor(kColorRICH);
687 node->cd();
688 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
689 subnode->SetLineColor(kGreen);
690 fNodes->Add(subnode);
691 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
692 subnode->SetLineColor(kGreen);
693 fNodes->Add(subnode);
694 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
695 subnode->SetLineColor(kGreen);
696 fNodes->Add(subnode);
697 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
698 subnode->SetLineColor(kGreen);
699 fNodes->Add(subnode);
700 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
701 subnode->SetLineColor(kGreen);
702 fNodes->Add(subnode);
703 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
704 subnode->SetLineColor(kGreen);
705 fNodes->Add(subnode);
706 fNodes->Add(node);
707
708// Chamber 5
709 top->cd();
710 node = new TNode("RICH6","RICH6","S_RICH",Chamber(5).GetX(),Chamber(5).GetY(),Chamber(5).GetZ(),"rot998");
711 node->SetLineColor(kColorRICH);
712 fNodes->Add(node);node->cd();
713 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
714 subnode->SetLineColor(kGreen);
715 fNodes->Add(subnode);
716 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
717 subnode->SetLineColor(kGreen);
718 fNodes->Add(subnode);
719 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
720 subnode->SetLineColor(kGreen);
721 fNodes->Add(subnode);
722 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
723 subnode->SetLineColor(kGreen);
724 fNodes->Add(subnode);
725 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
726 subnode->SetLineColor(kGreen);
727 fNodes->Add(subnode);
728 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
729 subnode->SetLineColor(kGreen);
730 fNodes->Add(subnode);
731
732// Chamber 6
733 top->cd();
734 node = new TNode("RICH7","RICH7","S_RICH",Chamber(6).GetX(),Chamber(6).GetY(),Chamber(6).GetZ(),"rot999");
735 node->SetLineColor(kColorRICH);
736 node->cd();
737 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
738 subnode->SetLineColor(kGreen);
739 fNodes->Add(subnode);
740 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
741 subnode->SetLineColor(kGreen);
742 fNodes->Add(subnode);
743 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
744 subnode->SetLineColor(kGreen);
745 fNodes->Add(subnode);
746 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
747 subnode->SetLineColor(kGreen);
748 fNodes->Add(subnode);
749 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
750 subnode->SetLineColor(kGreen);
751 fNodes->Add(subnode);
752 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
753 subnode->SetLineColor(kGreen);
754 fNodes->Add(subnode);
755 fNodes->Add(node);
cd1cf354 756 if(GetDebug())Info("BuildGeometry","Stop.");
9123a941 757}//AliRICHv3::BuildGeometry()
e1826cc2 758//______________________________________________________________________________
4b7382d1 759Double_t* AliRICHv3::RotateXY(const Double_t* r, Double_t a)
760{
761 // Rotatation in xy-plane
762 // by angle a
763 // The resulting rotation matrix is given back in the G3 notation.
764 Double_t* rr = new Double_t[6];
765 Double_t m[9];
766 Int_t i,j,k;
767
768 for (i = 0; i < 3; i++) {
769 j = 3*i;
770 m[j] = r[j] * TMath::Cos(a) - r[j+1] * TMath::Sin(a);
771 m[j+1] = r[j] * TMath::Sin(a) + r[j+1] * TMath::Cos(a);
772 m[j+2] = r[j+2];
773 }
774
775 for (i = 0; i < 3; i++) {
776 j = 3*i;
777 k = 2*i;
778 rr[k] = TMath::ACos(m[j+2]) * kRaddeg;
779 rr[k+1] = TMath::ATan2(m[j+1], m[j]) * kRaddeg;
780 }
781 return rr;
e1826cc2 782}//Double_t* AliRICHv3::RotateXY(const Double_t* r, Double_t a)
cd1cf354 783//______________________________________________________________________________
784void AliRICHv3::StepManager()
785{//Full Step Manager
786
787 Int_t copy, id;
788 static Int_t idvol;
789 static Int_t vol[2];
790 Int_t ipart;
791 static Float_t hits[22];
792 static Float_t ckovData[19];
793 TLorentzVector position;
794 TLorentzVector momentum;
795 Float_t pos[3];
796 Float_t mom[4];
797 Float_t localPos[3];
798 Float_t localMom[4];
799 Float_t localTheta,localPhi;
800 Float_t theta,phi;
801 Float_t destep, step;
802 Double_t ranf[2];
853634d3 803 Int_t nPads=1;
cd1cf354 804 Float_t coscerenkov;
805 static Float_t eloss, xhit, yhit, tlength;
806 const Float_t kBig=1.e10;
807
808 TClonesArray &lhits = *fHits;
642f15cf 809 TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->GetCurrentTrackNumber()];
cd1cf354 810
811 //if (current->Energy()>1)
812 //{
813
814 // Only gas gap inside chamber
815 // Tag chambers and record hits when track enters
816
817
818 id=gMC->CurrentVolID(copy);
819 idvol = copy-1;
820 Float_t cherenkovLoss=0;
642f15cf 821 //gAlice->KeepTrack(gAlice->GetCurrentTrackNumber());
cd1cf354 822
823 gMC->TrackPosition(position);
824 pos[0]=position(0);
825 pos[1]=position(1);
826 pos[2]=position(2);
827 //bzero((char *)ckovData,sizeof(ckovData)*19);
828 ckovData[1] = pos[0]; // X-position for hit
829 ckovData[2] = pos[1]; // Y-position for hit
830 ckovData[3] = pos[2]; // Z-position for hit
831 ckovData[6] = 0; // dummy track length
642f15cf 832 //ckovData[11] = gAlice->GetCurrentTrackNumber();
cd1cf354 833
642f15cf 834 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->GetCurrentTrackNumber());
cd1cf354 835
836 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
837
838 /********************Store production parameters for Cerenkov photons************************/
839//is it a Cerenkov photon?
840 if (gMC->TrackPid() == 50000050) {
841
842 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
843 //{
844 Float_t ckovEnergy = current->Energy();
845 //energy interval for tracking
846 if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )
847 //if (ckovEnergy > 0)
848 {
849 if (gMC->IsTrackEntering()){ //is track entering?
850 //printf("Track entered (1)\n");
851 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
852 { //is it in freo?
853 if (gMC->IsNewTrack()){ //is it the first step?
854 //printf("I'm in!\n");
855 Int_t mother = current->GetFirstMother();
856
857 //printf("Second Mother:%d\n",current->GetSecondMother());
858
859 ckovData[10] = mother;
642f15cf 860 ckovData[11] = gAlice->GetCurrentTrackNumber();
cd1cf354 861 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
862 //printf("Produced in FREO\n");
863 fCkovNumber++;
864 fFreonProd=1;
865 //printf("Index: %d\n",fCkovNumber);
866 } //first step question
867 } //freo question
868
869 if (gMC->IsNewTrack()){ //is it first step?
870 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
871 {
872 ckovData[12] = 2;
873 //printf("Produced in QUAR\n");
874 } //quarz question
875 } //first step question
876
877 //printf("Before %d\n",fFreonProd);
878 } //track entering question
879
880 if (ckovData[12] == 1) //was it produced in Freon?
881 //if (fFreonProd == 1)
882 {
883 if (gMC->IsTrackEntering()){ //is track entering?
884 //printf("Track entered (2)\n");
885 //printf("Current volume (should be META): %s\n",gMC->CurrentVolName());
886 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("META"),gMC->CurrentVolID(copy));
887 if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap?
888 {
889 //printf("Got in META\n");
890 gMC->TrackMomentum(momentum);
891 mom[0]=momentum(0);
892 mom[1]=momentum(1);
893 mom[2]=momentum(2);
894 mom[3]=momentum(3);
895
896 gMC->Gmtod(mom,localMom,2);
897 Float_t cophi = TMath::Cos(TMath::ATan2(localMom[0], localMom[1]));
898 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
899 /**************** Photons lost in second grid have to be calculated by hand************/
900 gMC->GetRandom()->RndmArray(1,ranf);
901 if (ranf[0] > t) {
902 gMC->StopTrack();
903 ckovData[13] = 5;
642f15cf 904 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 905 //printf("Added One (1)!\n");
906 //printf("Lost one in grid\n");
907 }
908 /**********************************************************************************/
909 } //gap
910
911 //printf("Current volume (should be CSI) (1): %s\n",gMC->CurrentVolName());
912 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
913 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
914 {
915 //printf("Got in CSI\n");
916 gMC->TrackMomentum(momentum);
917 mom[0]=momentum(0);
918 mom[1]=momentum(1);
919 mom[2]=momentum(2);
920 mom[3]=momentum(3);
921
922 gMC->Gmtod(mom,localMom,2);
923 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
924 /***********************Cerenkov phtons (always polarised)*************************/
925 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
926 Double_t localRt = TMath::Sqrt(localTc);
927 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])));
928 Double_t cotheta = TMath::Abs(cos(localTheta));
929 Float_t t = Fresnel(ckovEnergy*1e9,cotheta,1);
930 gMC->GetRandom()->RndmArray(1,ranf);
931 if (ranf[0] < t) {
932 gMC->StopTrack();
933 ckovData[13] = 6;
642f15cf 934 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 935
936 //printf("Added One (2)!\n");
937 //printf("Lost by Fresnel\n");
938 }
939 /**********************************************************************************/
940 }
941 } //track entering?
942
943
944 /********************Evaluation of losses************************/
945 /******************still in the old fashion**********************/
946
947 TArrayI procs;
948 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
949 for (Int_t i = 0; i < i1; ++i) {
950 // Reflection loss
951 if (procs[i] == kPLightReflection) { //was it reflected
952 ckovData[13]=10;
953 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
954 ckovData[13]=1;
955 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
956 ckovData[13]=2;
957 //gMC->StopTrack();
642f15cf 958 //AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 959 } //reflection question
960
961 // Absorption loss
962 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
963 //printf("Got in absorption\n");
964 ckovData[13]=20;
965 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
966 ckovData[13]=11;
967 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
968 ckovData[13]=12;
969 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
970 ckovData[13]=13;
971 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
972 ckovData[13]=13;
973
974 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
975 ckovData[13]=15;
976
977 // CsI inefficiency
978 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
979 ckovData[13]=16;
980 }
981 gMC->StopTrack();
642f15cf 982 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 983 //printf("Added One (3)!\n");
984 //printf("Added cerenkov %d\n",fCkovNumber);
985 } //absorption question
986
987
988 // Photon goes out of tracking scope
989 else if (procs[i] == kPStop) { //is it below energy treshold?
990 ckovData[13]=21;
991 gMC->StopTrack();
642f15cf 992 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 993 //printf("Added One (4)!\n");
994 } // energy treshold question
995 } //number of mechanisms cycle
996 /**********************End of evaluation************************/
997 } //freon production question
998 } //energy interval question
999 //}//inside the proximity gap question
1000 } //cerenkov photon question
1001
1002 /**************************************End of Production Parameters Storing*********************/
1003
1004
1005 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
1006
1007 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
1008 //printf("Cerenkov\n");
1009
1010 //if (gMC->TrackPid() == 50000051)
1011 //printf("Tracking a feedback\n");
1012
1013 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
1014 {
1015 //printf("Current volume (should be CSI) (2): %s\n",gMC->CurrentVolName());
1016 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
1017 //printf("Got in CSI\n");
1018 //printf("Tracking a %d\n",gMC->TrackPid());
1019 if (gMC->Edep() > 0.){
1020 gMC->TrackPosition(position);
1021 gMC->TrackMomentum(momentum);
1022 pos[0]=position(0);
1023 pos[1]=position(1);
1024 pos[2]=position(2);
1025 mom[0]=momentum(0);
1026 mom[1]=momentum(1);
1027 mom[2]=momentum(2);
1028 mom[3]=momentum(3);
1029 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1030 Double_t rt = TMath::Sqrt(tc);
1031 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1032 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1033
1034 gMC->CurrentVolOffID(2,copy);
1035 vol[0]=copy;
1036 idvol=vol[0]-1;
1037
1038
1039 gMC->Gmtod(pos,localPos,1);
1040
1041 //Chamber(idvol).GlobaltoLocal(pos,localPos);
1042
1043 gMC->Gmtod(mom,localMom,2);
1044
1045 //Chamber(idvol).GlobaltoLocal(mom,localMom);
1046
1047 gMC->CurrentVolOffID(2,copy);
1048 vol[0]=copy;
1049 idvol=vol[0]-1;
1050
1051 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1052 //->Sector(localPos[0], localPos[2]);
1053 //printf("Sector:%d\n",sector);
1054
1055 /*if (gMC->TrackPid() == 50000051){
1056 fFeedbacks++;
1057 printf("Feedbacks:%d\n",fFeedbacks);
1058 }*/
1059
1060 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1061 ((AliRICHChamber*)fChambers->At(idvol))
1062 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1063 if(idvol<kNCH) {
1064 ckovData[0] = gMC->TrackPid(); // particle type
1065 ckovData[1] = pos[0]; // X-position for hit
1066 ckovData[2] = pos[1]; // Y-position for hit
1067 ckovData[3] = pos[2]; // Z-position for hit
1068 ckovData[4] = theta; // theta angle of incidence
1069 ckovData[5] = phi; // phi angle of incidence
853634d3 1070 ckovData[8] = (Float_t) fNsdigits; // first sdigit
cd1cf354 1071 ckovData[9] = -1; // last pad hit
1072 ckovData[13] = 4; // photon was detected
1073 ckovData[14] = mom[0];
1074 ckovData[15] = mom[1];
1075 ckovData[16] = mom[2];
1076
1077 destep = gMC->Edep();
1078 gMC->SetMaxStep(kBig);
1079 cherenkovLoss += destep;
1080 ckovData[7]=cherenkovLoss;
1081
1082 //nPads = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kCerenkov);//for photons in CsI kir
1083
853634d3 1084 if (fNsdigits > (Int_t)ckovData[8]) {
cd1cf354 1085 ckovData[8]= ckovData[8]+1;
853634d3 1086 ckovData[9]= (Float_t) fNsdigits;
cd1cf354 1087 }
1088
1089 //printf("Cerenkov loss: %f\n", cherenkovLoss);
1090
1091 ckovData[17] = nPads;
1092 //printf("nPads:%d",nPads);
1093
1094 //TClonesArray *Hits = RICH->Hits();
853634d3 1095 AliRICHhit *mipHit = (AliRICHhit*) (fHits->UncheckedAt(0));
cd1cf354 1096 if (mipHit)
1097 {
1098 mom[0] = current->Px();
1099 mom[1] = current->Py();
1100 mom[2] = current->Pz();
1101 Float_t mipPx = mipHit->MomX();
1102 Float_t mipPy = mipHit->MomY();
1103 Float_t mipPz = mipHit->MomZ();
1104
1105 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
1106 Float_t rt = TMath::Sqrt(r);
1107 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
1108 Float_t mipRt = TMath::Sqrt(mipR);
1109 if ((rt*mipRt) > 0)
1110 {
1111 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
1112 }
1113 else
1114 {
1115 coscerenkov = 0;
1116 }
1117 Float_t cherenkov = TMath::ACos(coscerenkov);
1118 ckovData[18]=cherenkov;
1119 }
1120 //if (sector != -1)
1121 //{
642f15cf 1122 AddHit(gAlice->GetCurrentTrackNumber(),vol,ckovData);
1123 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 1124 //printf("Added One (5)!\n");
1125 //}
1126 }
1127 }
1128 }
1129 }
1130
1131 /***********************************************End of photon hits*********************************************/
1132
1133
1134 /**********************************************Charged particles treatment*************************************/
1135
1136 else if (gMC->TrackCharge())
1137 //else if (1 == 1)
1138 {
1139//If MIP
1140 /*if (gMC->IsTrackEntering())
1141 {
1142 hits[13]=20;//is track entering?
1143 }*/
1144 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1145 {
1146 gMC->TrackMomentum(momentum);
1147 mom[0]=momentum(0);
1148 mom[1]=momentum(1);
1149 mom[2]=momentum(2);
1150 mom[3]=momentum(3);
1151 hits [19] = mom[0];
1152 hits [20] = mom[1];
1153 hits [21] = mom[2];
1154 fFreonProd=1;
1155 }
1156
1157 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {
1158// Get current particle id (ipart), track position (pos) and momentum (mom)
1159
1160 gMC->CurrentVolOffID(3,copy);
1161 vol[0]=copy;
1162 idvol=vol[0]-1;
1163
1164 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1165 //->Sector(localPos[0], localPos[2]);
1166 //printf("Sector:%d\n",sector);
1167
1168 gMC->TrackPosition(position);
1169 gMC->TrackMomentum(momentum);
1170 pos[0]=position(0);
1171 pos[1]=position(1);
1172 pos[2]=position(2);
1173 mom[0]=momentum(0);
1174 mom[1]=momentum(1);
1175 mom[2]=momentum(2);
1176 mom[3]=momentum(3);
1177
1178 gMC->Gmtod(pos,localPos,1);
1179
1180 //Chamber(idvol).GlobaltoLocal(pos,localPos);
1181
1182 gMC->Gmtod(mom,localMom,2);
1183
1184 //Chamber(idvol).GlobaltoLocal(mom,localMom);
1185
1186 ipart = gMC->TrackPid();
1187 //
1188 // momentum loss and steplength in last step
1189 destep = gMC->Edep();
1190 step = gMC->TrackStep();
1191
1192 //
1193 // record hits when track enters ...
1194 if( gMC->IsTrackEntering()) {
1195// gMC->SetMaxStep(fMaxStepGas);
1196 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1197 Double_t rt = TMath::Sqrt(tc);
1198 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1199 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1200
1201
1202 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
1203 Double_t localRt = TMath::Sqrt(localTc);
1204 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
1205 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
1206
1207 hits[0] = Float_t(ipart); // particle type
1208 hits[1] = localPos[0]; // X-position for hit
1209 hits[2] = localPos[1]; // Y-position for hit
1210 hits[3] = localPos[2]; // Z-position for hit
1211 hits[4] = localTheta; // theta angle of incidence
1212 hits[5] = localPhi; // phi angle of incidence
853634d3 1213 hits[8] = (Float_t) fNsdigits; // first sdigit
cd1cf354 1214 hits[9] = -1; // last pad hit
1215 hits[13] = fFreonProd; // did id hit the freon?
1216 hits[14] = mom[0];
1217 hits[15] = mom[1];
1218 hits[16] = mom[2];
1219 hits[18] = 0; // dummy cerenkov angle
1220
1221 tlength = 0;
1222 eloss = 0;
1223 fFreonProd = 0;
1224
1225 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
1226
1227
1228 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
1229 xhit = localPos[0];
1230 yhit = localPos[2];
1231 // Only if not trigger chamber
1232 if(idvol<kNCH) {
1233 //
1234 // Initialize hit position (cursor) in the segmentation model
1235 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1236 ((AliRICHChamber*)fChambers->At(idvol))
1237 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1238 }
1239 }
1240
1241 //
1242 // Calculate the charge induced on a pad (disintegration) in case
1243 //
1244 // Mip left chamber ...
1245 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1246 gMC->SetMaxStep(kBig);
1247 eloss += destep;
1248 tlength += step;
1249
1250
1251 // Only if not trigger chamber
1252 if(idvol<kNCH) {
1253 if (eloss > 0)
1254 {
1255 if(gMC->TrackPid() == kNeutron)
1256 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
1257 //nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip); //for MIP kir
1258 hits[17] = nPads;
1259 //printf("nPads:%d",nPads);
1260 }
1261 }
1262
1263 hits[6]=tlength;
1264 hits[7]=eloss;
853634d3 1265 if (fNsdigits > (Int_t)hits[8]) {
cd1cf354 1266 hits[8]= hits[8]+1;
853634d3 1267 hits[9]= (Float_t) fNsdigits;
cd1cf354 1268 }
1269
1270 //if(sector !=-1)
853634d3 1271 new(lhits[fNhits++]) AliRICHhit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits);
cd1cf354 1272 eloss = 0;
1273 //
1274 // Check additional signal generation conditions
1275 // defined by the segmentation
1276 // model (boundary crossing conditions)
1277 } else if
1278 //PH (((AliRICHChamber*) (*fChambers)[idvol])
1279 (((AliRICHChamber*)fChambers->At(idvol))
1280 ->SigGenCond(localPos[0], localPos[2], localPos[1]))
1281 {
1282 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1283 ((AliRICHChamber*)fChambers->At(idvol))
1284 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1285 if (eloss > 0)
1286 {
1287 if(gMC->TrackPid() == kNeutron)
1288 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
1289 //nPads = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);//for N kir
1290 hits[17] = nPads;
1291 //printf("Npads:%d",NPads);
1292 }
1293 xhit = localPos[0];
1294 yhit = localPos[2];
1295 eloss = destep;
1296 tlength += step ;
1297 //
1298 // nothing special happened, add up energy loss
1299 } else {
1300 eloss += destep;
1301 tlength += step ;
1302 }
1303 }
1304 }
1305 /*************************************************End of MIP treatment**************************************/
1306}//void AliRICHv3::StepManager()