]>
Commit | Line | Data |
---|---|---|
4c039060 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* | |
2e5f0f7b | 17 | $Log$ |
e51a3fa9 | 18 | Revision 1.21 2000/07/21 10:21:07 morsch |
19 | fNrawch = 0; and fNrechits = 0; in the default constructor. | |
20 | ||
db481a6e | 21 | Revision 1.20 2000/07/10 15:28:39 fca |
22 | Correction of the inheritance scheme | |
23 | ||
452a64c6 | 24 | Revision 1.19 2000/06/30 16:29:51 dibari |
25 | Added kDebugLevel variable to control output size on demand | |
26 | ||
33984590 | 27 | Revision 1.18 2000/06/12 15:15:46 jbarbosa |
28 | Cleaned up version. | |
29 | ||
237c933d | 30 | Revision 1.17 2000/06/09 14:58:37 jbarbosa |
31 | New digitisation per particle type | |
32 | ||
d28b5fc2 | 33 | Revision 1.16 2000/04/19 12:55:43 morsch |
34 | Newly structured and updated version (JB, AM) | |
35 | ||
4c039060 | 36 | */ |
37 | ||
2e5f0f7b | 38 | |
ddae0931 | 39 | //////////////////////////////////////////////// |
40 | // Manager and hits classes for set:RICH // | |
41 | //////////////////////////////////////////////// | |
fe4da5cc | 42 | |
ddae0931 | 43 | #include <TBRIK.h> |
44 | #include <TTUBE.h> | |
fe4da5cc | 45 | #include <TNode.h> |
46 | #include <TRandom.h> | |
ddae0931 | 47 | #include <TObject.h> |
48 | #include <TVector.h> | |
49 | #include <TObjArray.h> | |
2e5f0f7b | 50 | #include <TArrayF.h> |
237c933d | 51 | #include <TFile.h> |
52 | #include <TParticle.h> | |
53 | #include <iostream.h> | |
fe4da5cc | 54 | |
fe4da5cc | 55 | #include "AliRICH.h" |
237c933d | 56 | #include "AliRICHSegmentation.h" |
57 | #include "AliRICHHit.h" | |
58 | #include "AliRICHCerenkov.h" | |
59 | #include "AliRICHPadHit.h" | |
60 | #include "AliRICHDigit.h" | |
61 | #include "AliRICHTransientDigit.h" | |
62 | #include "AliRICHRawCluster.h" | |
63 | #include "AliRICHRecHit.h" | |
64 | #include "AliRICHHitMapA1.h" | |
2e5f0f7b | 65 | #include "AliRICHClusterFinder.h" |
fe4da5cc | 66 | #include "AliRun.h" |
ddae0931 | 67 | #include "AliMC.h" |
452a64c6 | 68 | #include "AliConst.h" |
69 | #include "AliPDG.h" | |
2e5f0f7b | 70 | #include "AliPoints.h" |
ddae0931 | 71 | #include "AliCallf77.h" |
452a64c6 | 72 | #include "TGeant3.h" |
237c933d | 73 | |
ddae0931 | 74 | |
75 | // Static variables for the pad-hit iterator routines | |
76 | static Int_t sMaxIterPad=0; | |
77 | static Int_t sCurIterPad=0; | |
78 | static TClonesArray *fClusters2; | |
79 | static TClonesArray *fHits2; | |
2e5f0f7b | 80 | static TTree *TrH1; |
ddae0931 | 81 | |
fe4da5cc | 82 | ClassImp(AliRICH) |
ddae0931 | 83 | |
84 | //___________________________________________ | |
fe4da5cc | 85 | AliRICH::AliRICH() |
86 | { | |
237c933d | 87 | // Default constructor for RICH manager class |
88 | ||
ddae0931 | 89 | fIshunt = 0; |
90 | fHits = 0; | |
2e5f0f7b | 91 | fPadHits = 0; |
92 | fNPadHits = 0; | |
93 | fNcerenkovs = 0; | |
ddae0931 | 94 | fDchambers = 0; |
ddae0931 | 95 | fCerenkovs = 0; |
96 | fNdch = 0; | |
db481a6e | 97 | fNrawch = 0; |
98 | fNrechits = 0; | |
fe4da5cc | 99 | } |
ddae0931 | 100 | |
101 | //___________________________________________ | |
fe4da5cc | 102 | AliRICH::AliRICH(const char *name, const char *title) |
ddae0931 | 103 | : AliDetector(name,title) |
fe4da5cc | 104 | { |
ddae0931 | 105 | //Begin_Html |
106 | /* | |
107 | <img src="gif/alirich.gif"> | |
108 | */ | |
109 | //End_Html | |
110 | ||
2e5f0f7b | 111 | fHits = new TClonesArray("AliRICHHit",1000 ); |
1cedd08a | 112 | gAlice->AddHitList(fHits); |
2e5f0f7b | 113 | fPadHits = new TClonesArray("AliRICHPadHit",100000); |
114 | fCerenkovs = new TClonesArray("AliRICHCerenkov",1000); | |
115 | gAlice->AddHitList(fCerenkovs); | |
116 | //gAlice->AddHitList(fHits); | |
117 | fNPadHits = 0; | |
118 | fNcerenkovs = 0; | |
119 | fIshunt = 0; | |
ddae0931 | 120 | |
237c933d | 121 | fNdch = new Int_t[kNCH]; |
ddae0931 | 122 | |
237c933d | 123 | fDchambers = new TObjArray(kNCH); |
2e5f0f7b | 124 | |
237c933d | 125 | fRecHits = new TObjArray(kNCH); |
ddae0931 | 126 | |
127 | Int_t i; | |
128 | ||
237c933d | 129 | for (i=0; i<kNCH ;i++) { |
2e5f0f7b | 130 | (*fDchambers)[i] = new TClonesArray("AliRICHDigit",10000); |
ddae0931 | 131 | fNdch[i]=0; |
132 | } | |
2e5f0f7b | 133 | |
237c933d | 134 | fNrawch = new Int_t[kNCH]; |
ddae0931 | 135 | |
237c933d | 136 | fRawClusters = new TObjArray(kNCH); |
d28b5fc2 | 137 | //printf("Created fRwClusters with adress:%p",fRawClusters); |
2e5f0f7b | 138 | |
237c933d | 139 | for (i=0; i<kNCH ;i++) { |
2e5f0f7b | 140 | (*fRawClusters)[i] = new TClonesArray("AliRICHRawCluster",10000); |
141 | fNrawch[i]=0; | |
142 | } | |
143 | ||
237c933d | 144 | fNrechits = new Int_t[kNCH]; |
ddae0931 | 145 | |
237c933d | 146 | for (i=0; i<kNCH ;i++) { |
2e5f0f7b | 147 | (*fRecHits)[i] = new TClonesArray("AliRICHRecHit",1000); |
148 | } | |
d28b5fc2 | 149 | //printf("Created fRecHits with adress:%p",fRecHits); |
2e5f0f7b | 150 | |
151 | ||
ddae0931 | 152 | SetMarkerColor(kRed); |
fe4da5cc | 153 | } |
154 | ||
237c933d | 155 | AliRICH::AliRICH(const AliRICH& RICH) |
156 | { | |
157 | // Copy Constructor | |
158 | } | |
159 | ||
160 | ||
ddae0931 | 161 | //___________________________________________ |
fe4da5cc | 162 | AliRICH::~AliRICH() |
163 | { | |
237c933d | 164 | |
165 | // Destructor of RICH manager class | |
166 | ||
ddae0931 | 167 | fIshunt = 0; |
168 | delete fHits; | |
2e5f0f7b | 169 | delete fPadHits; |
ddae0931 | 170 | delete fCerenkovs; |
fe4da5cc | 171 | } |
172 | ||
ddae0931 | 173 | //___________________________________________ |
fe4da5cc | 174 | void AliRICH::AddHit(Int_t track, Int_t *vol, Float_t *hits) |
175 | { | |
237c933d | 176 | |
177 | // | |
178 | // Adds a hit to the Hits list | |
179 | // | |
180 | ||
ddae0931 | 181 | TClonesArray &lhits = *fHits; |
2e5f0f7b | 182 | new(lhits[fNhits++]) AliRICHHit(fIshunt,track,vol,hits); |
fe4da5cc | 183 | } |
fe4da5cc | 184 | //_____________________________________________________________________________ |
ddae0931 | 185 | void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs) |
186 | { | |
237c933d | 187 | |
188 | // | |
189 | // Adds a RICH cerenkov hit to the Cerenkov Hits list | |
190 | // | |
191 | ||
ddae0931 | 192 | TClonesArray &lcerenkovs = *fCerenkovs; |
193 | new(lcerenkovs[fNcerenkovs++]) AliRICHCerenkov(fIshunt,track,vol,cerenkovs); | |
2e5f0f7b | 194 | //printf ("Done for Cerenkov %d\n\n\n\n",fNcerenkovs); |
fe4da5cc | 195 | } |
ddae0931 | 196 | //___________________________________________ |
2e5f0f7b | 197 | void AliRICH::AddPadHit(Int_t *clhits) |
ddae0931 | 198 | { |
237c933d | 199 | |
200 | // | |
201 | // Add a RICH pad hit to the list | |
202 | // | |
203 | ||
2e5f0f7b | 204 | TClonesArray &lPadHits = *fPadHits; |
205 | new(lPadHits[fNPadHits++]) AliRICHPadHit(clhits); | |
33984590 | 206 | } |
fe4da5cc | 207 | //_____________________________________________________________________________ |
ddae0931 | 208 | void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits) |
209 | { | |
237c933d | 210 | |
211 | // | |
212 | // Add a RICH digit to the list | |
213 | // | |
ddae0931 | 214 | |
215 | TClonesArray &ldigits = *((TClonesArray*)(*fDchambers)[id]); | |
2e5f0f7b | 216 | new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits); |
fe4da5cc | 217 | } |
218 | ||
219 | //_____________________________________________________________________________ | |
2e5f0f7b | 220 | void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c) |
fe4da5cc | 221 | { |
ddae0931 | 222 | // |
2e5f0f7b | 223 | // Add a RICH digit to the list |
ddae0931 | 224 | // |
2e5f0f7b | 225 | |
226 | TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]); | |
227 | new(lrawcl[fNrawch[id]++]) AliRICHRawCluster(c); | |
fe4da5cc | 228 | } |
229 | ||
2e5f0f7b | 230 | //_____________________________________________________________________________ |
33984590 | 231 | void AliRICH::AddRecHit(Int_t id, Float_t *rechit, Float_t *photons, Int_t *padsx, Int_t* padsy) |
2e5f0f7b | 232 | { |
237c933d | 233 | |
234 | // | |
235 | // Add a RICH reconstructed hit to the list | |
236 | // | |
fe4da5cc | 237 | |
2e5f0f7b | 238 | TClonesArray &lrec = *((TClonesArray*)(*fRecHits)[id]); |
33984590 | 239 | new(lrec[fNrechits[id]++]) AliRICHRecHit(id,rechit,photons,padsx,padsy); |
2e5f0f7b | 240 | } |
fe4da5cc | 241 | |
ddae0931 | 242 | //___________________________________________ |
243 | void AliRICH::BuildGeometry() | |
244 | ||
fe4da5cc | 245 | { |
237c933d | 246 | |
247 | // | |
248 | // Builds a TNode geometry for event display | |
249 | // | |
250 | TNode *node, *top; | |
ddae0931 | 251 | |
252 | const int kColorRICH = kGreen; | |
253 | // | |
237c933d | 254 | top=gAlice->GetGeometry()->GetNode("alice"); |
ddae0931 | 255 | |
256 | ||
257 | new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15); | |
258 | ||
237c933d | 259 | top->cd(); |
ddae0931 | 260 | Float_t pos1[3]={0,471.8999,165.2599}; |
2e5f0f7b | 261 | //Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2], |
262 | new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90); | |
237c933d | 263 | node = new TNode("RICH1","RICH1","S_RICH",pos1[0],pos1[1],pos1[2],"rot993"); |
ddae0931 | 264 | |
265 | ||
237c933d | 266 | node->SetLineColor(kColorRICH); |
267 | fNodes->Add(node); | |
268 | top->cd(); | |
ddae0931 | 269 | |
270 | Float_t pos2[3]={171,470,0}; | |
2e5f0f7b | 271 | //Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2], |
272 | new TRotMatrix("rot994","rot994",90,-20,90,70,0,0); | |
237c933d | 273 | node = new TNode("RICH2","RICH2","S_RICH",pos2[0],pos2[1],pos2[2],"rot994"); |
ddae0931 | 274 | |
275 | ||
237c933d | 276 | node->SetLineColor(kColorRICH); |
277 | fNodes->Add(node); | |
278 | top->cd(); | |
ddae0931 | 279 | Float_t pos3[3]={0,500,0}; |
2e5f0f7b | 280 | //Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2], |
281 | new TRotMatrix("rot995","rot995",90,0,90,90,0,0); | |
237c933d | 282 | node = new TNode("RICH3","RICH3","S_RICH",pos3[0],pos3[1],pos3[2],"rot995"); |
ddae0931 | 283 | |
284 | ||
237c933d | 285 | node->SetLineColor(kColorRICH); |
286 | fNodes->Add(node); | |
287 | top->cd(); | |
ddae0931 | 288 | Float_t pos4[3]={-171,470,0}; |
2e5f0f7b | 289 | //Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2], |
290 | new TRotMatrix("rot996","rot996",90,20,90,110,0,0); | |
237c933d | 291 | node = new TNode("RICH4","RICH4","S_RICH",pos4[0],pos4[1],pos4[2],"rot996"); |
ddae0931 | 292 | |
293 | ||
237c933d | 294 | node->SetLineColor(kColorRICH); |
295 | fNodes->Add(node); | |
296 | top->cd(); | |
ddae0931 | 297 | Float_t pos5[3]={161.3999,443.3999,-165.3}; |
2e5f0f7b | 298 | //Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2], |
299 | new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70); | |
237c933d | 300 | node = new TNode("RICH5","RICH5","S_RICH",pos5[0],pos5[1],pos5[2],"rot997"); |
ddae0931 | 301 | |
237c933d | 302 | node->SetLineColor(kColorRICH); |
303 | fNodes->Add(node); | |
304 | top->cd(); | |
ddae0931 | 305 | Float_t pos6[3]={0., 471.9, -165.3,}; |
2e5f0f7b | 306 | //Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2], |
307 | new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90); | |
237c933d | 308 | node = new TNode("RICH6","RICH6","S_RICH",pos6[0],pos6[1],pos6[2],"rot998"); |
ddae0931 | 309 | |
310 | ||
237c933d | 311 | node->SetLineColor(kColorRICH); |
312 | fNodes->Add(node); | |
313 | top->cd(); | |
ddae0931 | 314 | Float_t pos7[3]={-161.399,443.3999,-165.3}; |
2e5f0f7b | 315 | //Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2], |
316 | new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110); | |
237c933d | 317 | node = new TNode("RICH7","RICH7","S_RICH",pos7[0],pos7[1],pos7[2],"rot999"); |
318 | node->SetLineColor(kColorRICH); | |
319 | fNodes->Add(node); | |
ddae0931 | 320 | |
fe4da5cc | 321 | } |
322 | ||
452a64c6 | 323 | //___________________________________________ |
324 | void AliRICH::CreateGeometry() | |
325 | { | |
326 | // | |
327 | // Create the geometry for RICH version 1 | |
328 | // | |
329 | // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it) | |
330 | // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it) | |
331 | // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it) | |
332 | // | |
333 | //Begin_Html | |
334 | /* | |
335 | <img src="picts/AliRICHv1.gif"> | |
336 | */ | |
337 | //End_Html | |
338 | //Begin_Html | |
339 | /* | |
340 | <img src="picts/AliRICHv1Tree.gif"> | |
341 | */ | |
342 | //End_Html | |
343 | ||
344 | AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH"); | |
345 | AliRICHSegmentation* segmentation; | |
346 | AliRICHGeometry* geometry; | |
347 | AliRICHChamber* iChamber; | |
348 | ||
349 | iChamber = &(pRICH->Chamber(0)); | |
350 | segmentation=iChamber->GetSegmentationModel(0); | |
351 | geometry=iChamber->GetGeometryModel(); | |
352 | ||
353 | Float_t distance; | |
354 | distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness(); | |
355 | geometry->SetRadiatorToPads(distance); | |
356 | ||
357 | ||
358 | Int_t *idtmed = fIdtmed->GetArray()-999; | |
359 | ||
360 | Int_t i; | |
361 | Float_t zs; | |
362 | Int_t idrotm[1099]; | |
363 | Float_t par[3]; | |
364 | ||
365 | // --- Define the RICH detector | |
366 | // External aluminium box | |
367 | par[0] = 71.1; | |
368 | par[1] = 11.5; //Original Settings | |
369 | par[2] = 73.15; | |
370 | /*par[0] = 73.15; | |
371 | par[1] = 11.5; | |
372 | par[2] = 71.1;*/ | |
373 | gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3); | |
374 | ||
375 | // Sensitive part of the whole RICH | |
376 | par[0] = 64.8; | |
377 | par[1] = 11.5; //Original Settings | |
378 | par[2] = 66.55; | |
379 | /*par[0] = 66.55; | |
380 | par[1] = 11.5; | |
381 | par[2] = 64.8;*/ | |
382 | gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3); | |
383 | ||
384 | // Honeycomb | |
385 | par[0] = 63.1; | |
386 | par[1] = .188; //Original Settings | |
387 | par[2] = 66.55; | |
388 | /*par[0] = 66.55; | |
389 | par[1] = .188; | |
390 | par[2] = 63.1;*/ | |
391 | gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3); | |
392 | ||
393 | // Aluminium sheet | |
394 | par[0] = 63.1; | |
395 | par[1] = .025; //Original Settings | |
396 | par[2] = 66.55; | |
397 | /*par[0] = 66.5; | |
398 | par[1] = .025; | |
399 | par[2] = 63.1;*/ | |
400 | gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3); | |
401 | ||
402 | // Quartz | |
403 | par[0] = geometry->GetQuartzWidth()/2; | |
404 | par[1] = geometry->GetQuartzThickness()/2; | |
405 | par[2] = geometry->GetQuartzLength()/2; | |
406 | /*par[0] = 63.1; | |
407 | par[1] = .25; //Original Settings | |
408 | par[2] = 65.5;*/ | |
409 | /*par[0] = geometry->GetQuartzWidth()/2; | |
410 | par[1] = geometry->GetQuartzThickness()/2; | |
411 | par[2] = geometry->GetQuartzLength()/2;*/ | |
412 | //printf("\n\n\n\n\n\n\n\\n\n\n\n Gap Thickness: %f %f %f\n\n\n\n\n\n\n\n\n\n\n\n\n\n",par[0],par[1],par[2]); | |
413 | gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3); | |
414 | ||
415 | // Spacers (cylinders) | |
416 | par[0] = 0.; | |
417 | par[1] = .5; | |
418 | par[2] = geometry->GetFreonThickness()/2; | |
419 | gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3); | |
420 | ||
421 | // Opaque quartz | |
422 | par[0] = 61.95; | |
423 | par[1] = .2; //Original Settings | |
424 | par[2] = 66.5; | |
425 | /*par[0] = 66.5; | |
426 | par[1] = .2; | |
427 | par[2] = 61.95;*/ | |
428 | gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3); | |
429 | ||
430 | // Frame of opaque quartz | |
431 | par[0] = geometry->GetOuterFreonWidth()/2; | |
432 | par[1] = geometry->GetFreonThickness()/2; | |
433 | par[2] = geometry->GetOuterFreonLength()/2 + 1; | |
434 | /*par[0] = 20.65; | |
435 | par[1] = .5; //Original Settings | |
436 | par[2] = 66.5;*/ | |
437 | /*par[0] = 66.5; | |
438 | par[1] = .5; | |
439 | par[2] = 20.65;*/ | |
440 | gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3); | |
441 | ||
442 | par[0] = geometry->GetInnerFreonWidth()/2; | |
443 | par[1] = geometry->GetFreonThickness()/2; | |
444 | par[2] = geometry->GetInnerFreonLength()/2 + 1; | |
445 | gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3); | |
446 | ||
447 | // Little bar of opaque quartz | |
448 | par[0] = .275; | |
449 | par[1] = geometry->GetQuartzThickness()/2; | |
450 | par[2] = geometry->GetInnerFreonLength()/2 - 2.4; | |
451 | /*par[0] = .275; | |
452 | par[1] = .25; //Original Settings | |
453 | par[2] = 63.1;*/ | |
454 | /*par[0] = 63.1; | |
455 | par[1] = .25; | |
456 | par[2] = .275;*/ | |
457 | gMC->Gsvolu("BARR", "BOX ", idtmed[1007], par, 3); | |
458 | ||
459 | // Freon | |
460 | par[0] = geometry->GetOuterFreonWidth()/2; | |
461 | par[1] = geometry->GetFreonThickness()/2; | |
462 | par[2] = geometry->GetOuterFreonLength()/2; | |
463 | /*par[0] = 20.15; | |
464 | par[1] = .5; //Original Settings | |
465 | par[2] = 65.5;*/ | |
466 | /*par[0] = 65.5; | |
467 | par[1] = .5; | |
468 | par[2] = 20.15;*/ | |
469 | gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3); | |
470 | ||
471 | par[0] = geometry->GetInnerFreonWidth()/2; | |
472 | par[1] = geometry->GetFreonThickness()/2; | |
473 | par[2] = geometry->GetInnerFreonLength()/2; | |
474 | gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3); | |
475 | ||
476 | // Methane | |
477 | par[0] = 64.8; | |
478 | par[1] = geometry->GetGapThickness()/2; | |
479 | //printf("\n\n\n\n\n\n\n\\n\n\n\n Gap Thickness: %f\n\n\n\n\n\n\n\n\n\n\n\n\n\n",par[1]); | |
480 | par[2] = 64.8; | |
481 | gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3); | |
482 | ||
483 | // Methane gap | |
484 | par[0] = 64.8; | |
485 | par[1] = geometry->GetProximityGapThickness()/2; | |
486 | //printf("\n\n\n\n\n\n\n\\n\n\n\n Gap Thickness: %f\n\n\n\n\n\n\n\n\n\n\n\n\n\n",par[1]); | |
487 | par[2] = 64.8; | |
488 | gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3); | |
489 | ||
490 | // CsI photocathode | |
491 | par[0] = 64.8; | |
492 | par[1] = .25; | |
493 | par[2] = 64.8; | |
494 | gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3); | |
495 | ||
496 | // Anode grid | |
497 | par[0] = 0.; | |
498 | par[1] = .001; | |
499 | par[2] = 20.; | |
500 | gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3); | |
501 | ||
502 | // --- Places the detectors defined with GSVOLU | |
503 | // Place material inside RICH | |
504 | gMC->Gspos("SRIC", 1, "RICH", 0., 0., 0., 0, "ONLY"); | |
505 | ||
506 | gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 -.05 - .376 -.025, 0., 0, "ONLY"); | |
507 | gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 -.05 - .188, 0., 0, "ONLY"); | |
508 | gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .025, 0., 0, "ONLY"); | |
509 | gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .2, 0., 0, "ONLY"); | |
510 | ||
511 | AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.); | |
512 | ||
513 | Int_t nspacers = (Int_t)(TMath::Abs(geometry->GetInnerFreonLength()/14.4)); | |
514 | //printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n Spacers:%d\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",nspacers); | |
515 | ||
516 | //printf("Nspacers: %d", nspacers); | |
517 | ||
518 | //for (i = 1; i <= 9; ++i) { | |
519 | //zs = (5 - i) * 14.4; //Original settings | |
520 | for (i = 0; i < nspacers; i++) { | |
521 | zs = (TMath::Abs(nspacers/2) - i) * 14.4; | |
522 | gMC->Gspos("SPAC", i, "FRE1", 6.7, 0., zs, idrotm[1019], "ONLY"); //Original settings | |
523 | //gMC->Gspos("SPAC", i, "FRE1", zs, 0., 6.7, idrotm[1019], "ONLY"); | |
524 | } | |
525 | //for (i = 10; i <= 18; ++i) { | |
526 | //zs = (14 - i) * 14.4; //Original settings | |
527 | for (i = nspacers; i < nspacers*2; ++i) { | |
528 | zs = (nspacers + TMath::Abs(nspacers/2) - i) * 14.4; | |
529 | gMC->Gspos("SPAC", i, "FRE1", -6.7, 0., zs, idrotm[1019], "ONLY"); //Original settings | |
530 | //gMC->Gspos("SPAC", i, "FRE1", zs, 0., -6.7, idrotm[1019], "ONLY"); | |
531 | } | |
532 | ||
533 | //for (i = 1; i <= 9; ++i) { | |
534 | //zs = (5 - i) * 14.4; //Original settings | |
535 | for (i = 0; i < nspacers; i++) { | |
536 | zs = (TMath::Abs(nspacers/2) - i) * 14.4; | |
537 | gMC->Gspos("SPAC", i, "FRE2", 6.7, 0., zs, idrotm[1019], "ONLY"); //Original settings | |
538 | //gMC->Gspos("SPAC", i, "FRE2", zs, 0., 6.7, idrotm[1019], "ONLY"); | |
539 | } | |
540 | //for (i = 10; i <= 18; ++i) { | |
541 | //zs = (5 - i) * 14.4; //Original settings | |
542 | for (i = nspacers; i < nspacers*2; ++i) { | |
543 | zs = (nspacers + TMath::Abs(nspacers/2) - i) * 14.4; | |
544 | gMC->Gspos("SPAC", i, "FRE2", -6.7, 0., zs, idrotm[1019], "ONLY"); //Original settings | |
545 | //gMC->Gspos("SPAC", i, "FRE2", zs, 0., -6.7, idrotm[1019], "ONLY"); | |
546 | } | |
547 | ||
548 | /*gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY"); | |
549 | gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY"); | |
550 | gMC->Gspos("OQF1", 1, "SRIC", 31.3, -4.724, 41.3, 0, "ONLY"); | |
551 | gMC->Gspos("OQF2", 2, "SRIC", 0., -4.724, 0., 0, "ONLY"); | |
552 | gMC->Gspos("OQF1", 3, "SRIC", -31.3, -4.724, -41.3, 0, "ONLY"); | |
553 | gMC->Gspos("BARR", 1, "QUAR", -21.65, 0., 0., 0, "ONLY"); //Original settings | |
554 | gMC->Gspos("BARR", 2, "QUAR", 21.65, 0., 0., 0, "ONLY"); //Original settings | |
555 | gMC->Gspos("QUAR", 1, "SRIC", 0., -3.974, 0., 0, "ONLY"); | |
556 | gMC->Gspos("GAP ", 1, "META", 0., 4.8, 0., 0, "ONLY"); | |
557 | gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY"); | |
558 | gMC->Gspos("CSI ", 1, "SRIC", 0., 6.526, 0., 0, "ONLY");*/ | |
559 | ||
560 | ||
561 | gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY"); | |
562 | gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY"); | |
563 | gMC->Gspos("OQF1", 1, "SRIC", geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2, 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3) | |
564 | gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings | |
565 | gMC->Gspos("OQF1", 3, "SRIC", - (geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2), 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings (-31.3) | |
566 | gMC->Gspos("BARR", 1, "QUAR", -21.65, 0., 0., 0, "ONLY"); //Original settings | |
567 | gMC->Gspos("BARR", 2, "QUAR", 21.65, 0., 0., 0, "ONLY"); //Original settings | |
568 | gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness()/2, 0., 0, "ONLY"); | |
569 | gMC->Gspos("GAP ", 1, "META", 0., geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY"); | |
570 | gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY"); | |
571 | gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + geometry->GetGapThickness()/2 + .25, 0., 0, "ONLY"); | |
572 | ||
573 | //printf("Position of the gap: %f to %f\n", 1.276 + geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - .2, 1.276 + geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 + .2); | |
574 | ||
575 | // Place RICH inside ALICE apparatus | |
576 | ||
577 | AliMatrix(idrotm[1000], 90., 0., 70.69, 90., 19.31, -90.); | |
578 | AliMatrix(idrotm[1001], 90., -20., 90., 70., 0., 0.); | |
579 | AliMatrix(idrotm[1002], 90., 0., 90., 90., 0., 0.); | |
580 | AliMatrix(idrotm[1003], 90., 20., 90., 110., 0., 0.); | |
581 | AliMatrix(idrotm[1004], 90., 340., 108.2, 70., 18.2, 70.); | |
582 | AliMatrix(idrotm[1005], 90., 0., 109.31, 90., 19.31, 90.); | |
583 | AliMatrix(idrotm[1006], 90., 20., 108.2, 110., 18.2, 110.); | |
584 | ||
585 | gMC->Gspos("RICH", 1, "ALIC", 0., 471.9, 165.26, idrotm[1000], "ONLY"); | |
586 | gMC->Gspos("RICH", 2, "ALIC", 171., 470., 0., idrotm[1001], "ONLY"); | |
587 | gMC->Gspos("RICH", 3, "ALIC", 0., 500., 0., idrotm[1002], "ONLY"); | |
588 | gMC->Gspos("RICH", 4, "ALIC", -171., 470., 0., idrotm[1003], "ONLY"); | |
589 | gMC->Gspos("RICH", 5, "ALIC", 161.4, 443.4, -165.3, idrotm[1004], "ONLY"); | |
590 | gMC->Gspos("RICH", 6, "ALIC", 0., 471.9, -165.3, idrotm[1005], "ONLY"); | |
591 | gMC->Gspos("RICH", 7, "ALIC", -161.4, 443.4, -165.3, idrotm[1006], "ONLY"); | |
592 | ||
593 | } | |
594 | ||
595 | ||
596 | //___________________________________________ | |
597 | void AliRICH::CreateMaterials() | |
598 | { | |
599 | // | |
600 | // *** DEFINITION OF AVAILABLE RICH MATERIALS *** | |
601 | // ORIGIN : NICK VAN EIJNDHOVEN | |
602 | // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it) | |
603 | // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it) | |
604 | // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it) | |
605 | // | |
606 | Int_t isxfld = gAlice->Field()->Integ(); | |
607 | Float_t sxmgmx = gAlice->Field()->Max(); | |
608 | Int_t i; | |
609 | ||
610 | /************************************Antonnelo's Values (14-vectors)*****************************************/ | |
611 | /* | |
612 | Float_t ppckov[14] = { 5.63e-9,5.77e-9,5.9e-9,6.05e-9,6.2e-9,6.36e-9,6.52e-9, | |
613 | 6.7e-9,6.88e-9,7.08e-9,7.3e-9,7.51e-9,7.74e-9,8e-9 }; | |
614 | Float_t rIndexQuarz[14] = { 1.528309,1.533333, | |
615 | 1.538243,1.544223,1.550568,1.55777, | |
616 | 1.565463,1.574765,1.584831,1.597027, | |
617 | 1.611858,1.6277,1.6472,1.6724 }; | |
618 | Float_t rIndexOpaqueQuarz[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. }; | |
619 | Float_t rIndexMethane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. }; | |
620 | Float_t rIndexGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. }; | |
621 | Float_t abscoFreon[14] = { 179.0987,179.0987, | |
622 | 179.0987,179.0987,179.0987,142.92,56.65,13.95,10.43,7.07,2.03,.5773,.33496,0. }; | |
623 | //Float_t abscoFreon[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5, | |
624 | // 1e-5,1e-5,1e-5,1e-5,1e-5 }; | |
625 | Float_t abscoQuarz[14] = { 64.035,39.98,35.665,31.262,27.527,22.815,21.04,17.52, | |
626 | 14.177,9.282,4.0925,1.149,.3627,.10857 }; | |
627 | Float_t abscoOpaqueQuarz[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5, | |
628 | 1e-5,1e-5,1e-5,1e-5,1e-5 }; | |
629 | Float_t abscoCsI[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4, | |
630 | 1e-4,1e-4,1e-4,1e-4 }; | |
631 | Float_t abscoMethane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6, | |
632 | 1e6,1e6,1e6 }; | |
633 | Float_t abscoGrid[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4, | |
634 | 1e-4,1e-4,1e-4,1e-4 }; | |
635 | Float_t efficAll[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. }; | |
636 | Float_t efficCsI[14] = { 6e-4,.005,.0075,.01125,.045,.117,.135,.16575, | |
637 | .17425,.1785,.1836,.1904,.1938,.221 }; | |
638 | Float_t efficGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. }; | |
639 | */ | |
640 | ||
641 | ||
642 | /**********************************End of Antonnelo's Values**********************************/ | |
643 | ||
644 | /**********************************Values from rich_media.f (31-vectors)**********************************/ | |
645 | ||
646 | ||
647 | //Photons energy intervals | |
648 | Float_t ppckov[26]; | |
649 | for (i=0;i<26;i++) | |
650 | { | |
651 | ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9; | |
652 | //printf ("Energy intervals: %e\n",ppckov[i]); | |
653 | } | |
654 | ||
655 | ||
656 | //Refraction index for quarz | |
657 | Float_t rIndexQuarz[26]; | |
658 | Float_t e1= 10.666; | |
659 | Float_t e2= 18.125; | |
660 | Float_t f1= 46.411; | |
661 | Float_t f2= 228.71; | |
662 | for (i=0;i<26;i++) | |
663 | { | |
664 | Float_t ene=ppckov[i]*1e9; | |
665 | Float_t a=f1/(e1*e1 - ene*ene); | |
666 | Float_t b=f2/(e2*e2 - ene*ene); | |
667 | rIndexQuarz[i] = TMath::Sqrt(1. + a + b ); | |
668 | //printf ("rIndexQuarz: %e\n",rIndexQuarz[i]); | |
669 | } | |
670 | ||
671 | //Refraction index for opaque quarz, methane and grid | |
672 | Float_t rIndexOpaqueQuarz[26]; | |
673 | Float_t rIndexMethane[26]; | |
674 | Float_t rIndexGrid[26]; | |
675 | for (i=0;i<26;i++) | |
676 | { | |
677 | rIndexOpaqueQuarz[i]=1; | |
678 | rIndexMethane[i]=1.000444; | |
679 | rIndexGrid[i]=1; | |
680 | //printf ("rIndexOpaqueQuarz , etc: %e, %e, %e\n",rIndexOpaqueQuarz[i], rIndexMethane[i], rIndexGrid[i]=1); | |
681 | } | |
682 | ||
683 | //Absorption index for freon | |
684 | Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, | |
685 | 179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196, | |
686 | 7.069031, 4.461292, 2.028366, 1.293013, .577267, .40746, .334964, 0., 0., 0.}; | |
687 | ||
688 | //Absorption index for quarz | |
689 | /*Float_t Qzt [21] = {.0,.0,.005,.04,.35,.647,.769,.808,.829,.844,.853,.858,.869,.887,.903,.902,.902, | |
690 | .906,.907,.907,.907}; | |
691 | Float_t Wavl2[] = {150.,155.,160.0,165.0,170.0,175.0,180.0,185.0,190.0,195.0,200.0,205.0,210.0, | |
692 | 215.0,220.0,225.0,230.0,235.0,240.0,245.0,250.0}; | |
693 | Float_t abscoQuarz[31]; | |
694 | for (Int_t i=0;i<31;i++) | |
695 | { | |
696 | Float_t Xlam = 1237.79 / (ppckov[i]*1e9); | |
697 | if (Xlam <= 160) abscoQuarz[i] = 0; | |
698 | if (Xlam > 250) abscoQuarz[i] = 1; | |
699 | else | |
700 | { | |
701 | for (Int_t j=0;j<21;j++) | |
702 | { | |
703 | //printf ("Passed\n"); | |
704 | if (Xlam > Wavl2[j] && Xlam < Wavl2[j+1]) | |
705 | { | |
706 | Float_t Dabs = (Qzt[j+1] - Qzt[j])/(Wavl2[j+1] - Wavl2[j]); | |
707 | Float_t Abso = Qzt[j] + Dabs*(Xlam - Wavl2[j]); | |
708 | abscoQuarz[i] = -5.0/(TMath::Log(Abso)); | |
709 | } | |
710 | } | |
711 | } | |
712 | printf ("abscoQuarz: %e abscoFreon: %e for energy: %e\n",abscoQuarz[i],abscoFreon[i],ppckov[i]); | |
713 | }*/ | |
714 | ||
715 | /*Float_t abscoQuarz[31] = {49.64211, 48.41296, 47.46989, 46.50492, 45.13682, 44.47883, 43.1929 , 41.30922, 40.5943 , | |
716 | 39.82956, 38.98623, 38.6247 , 38.43448, 37.41084, 36.22575, 33.74852, 30.73901, 24.25086, | |
717 | 17.94531, 11.88753, 5.99128, 3.83503, 2.36661, 1.53155, 1.30582, 1.08574, .8779708, | |
718 | .675275, 0., 0., 0.}; | |
719 | ||
720 | for (Int_t i=0;i<31;i++) | |
721 | { | |
722 | abscoQuarz[i] = abscoQuarz[i]/10; | |
723 | }*/ | |
724 | ||
725 | 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, | |
726 | 19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627, | |
727 | .192, .1497, .10857}; | |
728 | ||
729 | //Absorption index for methane | |
730 | Float_t abscoMethane[26]; | |
731 | for (i=0;i<26;i++) | |
732 | { | |
733 | abscoMethane[i]=AbsoCH4(ppckov[i]*1e9); | |
734 | //printf("abscoMethane: %e for energy: %e\n", abscoMethane[i],ppckov[i]*1e9); | |
735 | } | |
736 | ||
737 | //Absorption index for opaque quarz, csi and grid, efficiency for all and grid | |
738 | Float_t abscoOpaqueQuarz[26]; | |
739 | Float_t abscoCsI[26]; | |
740 | Float_t abscoGrid[26]; | |
741 | Float_t efficAll[26]; | |
742 | Float_t efficGrid[26]; | |
743 | for (i=0;i<26;i++) | |
744 | { | |
745 | abscoOpaqueQuarz[i]=1e-5; | |
746 | abscoCsI[i]=1e-4; | |
747 | abscoGrid[i]=1e-4; | |
748 | efficAll[i]=1; | |
749 | efficGrid[i]=1; | |
750 | //printf ("All must be 1: %e, %e, %e, %e, %e\n",abscoOpaqueQuarz[i],abscoCsI[i],abscoGrid[i],efficAll[i],efficGrid[i]); | |
751 | } | |
752 | ||
753 | //Efficiency for csi | |
754 | ||
755 | Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125, | |
756 | 0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999, | |
757 | 0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592, | |
758 | 0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987}; | |
759 | ||
760 | ||
761 | ||
762 | //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND | |
763 | //UNPOLARIZED PHOTONS | |
764 | ||
765 | for (i=0;i<26;i++) | |
766 | { | |
767 | efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0)); | |
768 | //printf ("Fresnel result: %e for energy: %e\n",Fresnel(ppckov[i]*1e9,1.,0),ppckov[i]*1e9); | |
769 | } | |
770 | ||
771 | /*******************************************End of rich_media.f***************************************/ | |
772 | ||
773 | ||
774 | ||
775 | ||
776 | ||
777 | ||
778 | Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon, | |
779 | zmet[2], zqua[2]; | |
780 | Int_t nlmatfre; | |
781 | Float_t densquao; | |
782 | Int_t nlmatmet, nlmatqua; | |
783 | Float_t wmatquao[2], rIndexFreon[26]; | |
784 | Float_t aquao[2], epsil, stmin, zquao[2]; | |
785 | Int_t nlmatquao; | |
786 | Float_t radlal, densal, tmaxfd, deemax, stemax; | |
787 | Float_t aal, zal, radlgri, densfre, radlhon, densgri, denshon,densqua, densmet, wmatfre[2], wmatmet[2], wmatqua[2]; | |
788 | ||
789 | Int_t *idtmed = fIdtmed->GetArray()-999; | |
790 | ||
791 | TGeant3 *geant3 = (TGeant3*) gMC; | |
792 | ||
793 | // --- Photon energy (GeV) | |
794 | // --- Refraction indexes | |
795 | for (i = 0; i < 26; ++i) { | |
796 | rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177; | |
797 | //rIndexFreon[i] = 1; | |
798 | //printf ("rIndexFreon: %e \n efficCsI: %e for energy: %e\n",rIndexFreon[i], efficCsI[i], ppckov[i]); | |
799 | } | |
800 | ||
801 | // --- Detection efficiencies (quantum efficiency for CsI) | |
802 | // --- Define parameters for honeycomb. | |
803 | // Used carbon of equivalent rad. lenght | |
804 | ||
805 | ahon = 12.01; | |
806 | zhon = 6.; | |
807 | denshon = 2.265; | |
808 | radlhon = 18.8; | |
809 | ||
810 | // --- Parameters to include in GSMIXT, relative to Quarz (SiO2) | |
811 | ||
812 | aqua[0] = 28.09; | |
813 | aqua[1] = 16.; | |
814 | zqua[0] = 14.; | |
815 | zqua[1] = 8.; | |
816 | densqua = 2.64; | |
817 | nlmatqua = -2; | |
818 | wmatqua[0] = 1.; | |
819 | wmatqua[1] = 2.; | |
820 | ||
821 | // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2) | |
822 | ||
823 | aquao[0] = 28.09; | |
824 | aquao[1] = 16.; | |
825 | zquao[0] = 14.; | |
826 | zquao[1] = 8.; | |
827 | densquao = 2.64; | |
828 | nlmatquao = -2; | |
829 | wmatquao[0] = 1.; | |
830 | wmatquao[1] = 2.; | |
831 | ||
832 | // --- Parameters to include in GSMIXT, relative to Freon (C6F14) | |
833 | ||
834 | afre[0] = 12.; | |
835 | afre[1] = 19.; | |
836 | zfre[0] = 6.; | |
837 | zfre[1] = 9.; | |
838 | densfre = 1.7; | |
839 | nlmatfre = -2; | |
840 | wmatfre[0] = 6.; | |
841 | wmatfre[1] = 14.; | |
842 | ||
843 | // --- Parameters to include in GSMIXT, relative to methane (CH4) | |
844 | ||
845 | amet[0] = 12.01; | |
846 | amet[1] = 1.; | |
847 | zmet[0] = 6.; | |
848 | zmet[1] = 1.; | |
849 | densmet = 7.17e-4; | |
850 | nlmatmet = -2; | |
851 | wmatmet[0] = 1.; | |
852 | wmatmet[1] = 4.; | |
853 | ||
854 | // --- Parameters to include in GSMIXT, relative to anode grid (Cu) | |
855 | ||
856 | agri = 63.54; | |
857 | zgri = 29.; | |
858 | densgri = 8.96; | |
859 | radlgri = 1.43; | |
860 | ||
861 | // --- Parameters to include in GSMATE related to aluminium sheet | |
862 | ||
863 | aal = 26.98; | |
864 | zal = 13.; | |
865 | densal = 2.7; | |
866 | radlal = 8.9; | |
867 | ||
868 | AliMaterial(1, "Air $", 14.61, 7.3, .001205, 30420., 67500); | |
869 | AliMaterial(6, "HON", ahon, zhon, denshon, radlhon, 0); | |
870 | AliMaterial(16, "CSI", ahon, zhon, denshon, radlhon, 0); | |
871 | AliMixture(20, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua); | |
872 | AliMixture(21, "QUAO", aquao, zquao, densquao, nlmatquao, wmatquao); | |
873 | AliMixture(30, "FRE", afre, zfre, densfre, nlmatfre, wmatfre); | |
874 | AliMixture(40, "MET", amet, zmet, densmet, nlmatmet, wmatmet); | |
875 | AliMixture(41, "METG", amet, zmet, densmet, nlmatmet, wmatmet); | |
876 | AliMaterial(11, "GRI", agri, zgri, densgri, radlgri, 0); | |
877 | AliMaterial(50, "ALUM", aal, zal, densal, radlal, 0); | |
878 | ||
879 | tmaxfd = -10.; | |
880 | stemax = -.1; | |
881 | deemax = -.2; | |
882 | epsil = .001; | |
883 | stmin = -.001; | |
884 | ||
885 | AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
886 | AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
887 | AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
888 | AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
889 | AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
890 | AliMedium(6, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin); | |
891 | AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
892 | AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
893 | AliMedium(9, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, .1, -deemax, epsil, -stmin); | |
894 | AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin); | |
895 | ||
896 | ||
897 | geant3->Gsckov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane); | |
898 | geant3->Gsckov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane); | |
899 | geant3->Gsckov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll,rIndexQuarz); | |
900 | geant3->Gsckov(idtmed[1003], 26, ppckov, abscoFreon, efficAll,rIndexFreon); | |
901 | geant3->Gsckov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane); | |
902 | geant3->Gsckov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane); | |
903 | geant3->Gsckov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid); | |
904 | geant3->Gsckov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz); | |
905 | geant3->Gsckov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane); | |
906 | geant3->Gsckov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid); | |
907 | } | |
908 | ||
909 | //___________________________________________ | |
910 | ||
911 | Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola) | |
912 | { | |
913 | ||
914 | //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.) | |
915 | ||
916 | Float_t en[36] = {5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,5.8,5.9,6.0,6.1,6.2, | |
917 | 6.3,6.4,6.5,6.6,6.7,6.8,6.9,7.0,7.1,7.2,7.3,7.4,7.5,7.6,7.7, | |
918 | 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5}; | |
919 | ||
920 | ||
921 | Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05, | |
922 | 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11, | |
923 | 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95, | |
924 | 1.72,1.53}; | |
925 | ||
926 | Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543, | |
927 | 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878, | |
928 | 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824, | |
929 | 1.714,1.498}; | |
930 | Float_t xe=ene; | |
931 | Int_t j=Int_t(xe*10)-49; | |
932 | Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]); | |
933 | Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]); | |
934 | ||
935 | //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR | |
936 | //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197 | |
937 | ||
938 | Float_t sinin=TMath::Sqrt(1-pdoti*pdoti); | |
939 | Float_t tanin=sinin/pdoti; | |
940 | ||
941 | Float_t c1=cn*cn-ck*ck-sinin*sinin; | |
942 | Float_t c2=4*cn*cn*ck*ck; | |
943 | Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1)); | |
944 | Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1); | |
945 | ||
946 | Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2); | |
947 | Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2); | |
948 | ||
949 | ||
950 | //CORRECTION FACTOR FOR SURFACE ROUGHNESS | |
951 | //B.J. STAGG APPLIED OPTICS, 30(1991),4113 | |
952 | ||
953 | Float_t sigraf=18.; | |
954 | Float_t lamb=1240/ene; | |
955 | Float_t fresn; | |
956 | ||
957 | Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb)); | |
958 | ||
959 | if(pola) | |
960 | { | |
961 | Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S | |
962 | fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr)); | |
963 | } | |
964 | else | |
965 | fresn=0.5*(rp+rs); | |
966 | ||
967 | fresn = fresn*rO; | |
968 | return(fresn); | |
969 | } | |
970 | ||
971 | //__________________________________________ | |
972 | Float_t AliRICH::AbsoCH4(Float_t x) | |
973 | { | |
974 | ||
975 | //KLOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31) | |
976 | Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.}; //MB X 10^22 | |
977 | //Float_t wl[9] = {153.,152.,151.,150.,149.,148.,147.,146.,145}; | |
978 | Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55}; | |
979 | const Float_t kLosch=2.686763E19; // LOSCHMIDT NUMBER IN CM-3 | |
980 | const Float_t kIgas1=100, kIgas2=0, kOxy=10., kWater=5., kPressure=750.,kTemperature=283.; | |
981 | Float_t pn=kPressure/760.; | |
982 | Float_t tn=kTemperature/273.16; | |
983 | ||
984 | ||
985 | // ------- METHANE CROSS SECTION ----------------- | |
986 | // ASTROPH. J. 214, L47 (1978) | |
987 | ||
988 | Float_t sm=0; | |
989 | if (x<7.75) | |
990 | sm=.06e-22; | |
991 | ||
992 | if(x>=7.75 && x<=8.1) | |
993 | { | |
994 | Float_t c0=-1.655279e-1; | |
995 | Float_t c1=6.307392e-2; | |
996 | Float_t c2=-8.011441e-3; | |
997 | Float_t c3=3.392126e-4; | |
998 | sm=(c0+c1*x+c2*x*x+c3*x*x*x)*1.e-18; | |
999 | } | |
1000 | ||
1001 | if (x> 8.1) | |
1002 | { | |
1003 | Int_t j=0; | |
1004 | while (x<=em[j] && x>=em[j+1]) | |
1005 | { | |
1006 | j++; | |
1007 | Float_t a=(sch4[j+1]-sch4[j])/(em[j+1]-em[j]); | |
1008 | sm=(sch4[j]+a*(x-em[j]))*1e-22; | |
1009 | } | |
1010 | } | |
1011 | ||
1012 | Float_t dm=(kIgas1/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn; | |
1013 | Float_t abslm=1./sm/dm; | |
1014 | ||
1015 | // ------- ISOBUTHANE CROSS SECTION -------------- | |
1016 | // i-C4H10 (ai) abs. length from curves in | |
1017 | // Lu-McDonald paper for BARI RICH workshop . | |
1018 | // ----------------------------------------------------------- | |
1019 | ||
1020 | Float_t ai; | |
1021 | Float_t absli; | |
1022 | if (kIgas2 != 0) | |
1023 | { | |
1024 | if (x<7.25) | |
1025 | ai=100000000.; | |
1026 | ||
1027 | if(x>=7.25 && x<7.375) | |
1028 | ai=24.3; | |
1029 | ||
1030 | if(x>=7.375) | |
1031 | ai=.0000000001; | |
1032 | ||
1033 | Float_t si = 1./(ai*kLosch*273.16/293.); // ISOB. CRO.SEC.IN CM2 | |
1034 | Float_t di=(kIgas2/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn; | |
1035 | absli =1./si/di; | |
1036 | } | |
1037 | else | |
1038 | absli=1.e18; | |
1039 | // --------------------------------------------------------- | |
1040 | // | |
1041 | // transmission of O2 | |
1042 | // | |
1043 | // y= path in cm, x=energy in eV | |
1044 | // so= cross section for UV absorption in cm2 | |
1045 | // do= O2 molecular density in cm-3 | |
1046 | // --------------------------------------------------------- | |
1047 | ||
1048 | Float_t abslo; | |
1049 | Float_t so=0; | |
1050 | if(x>=6.0) | |
1051 | { | |
1052 | if(x>=6.0 && x<6.5) | |
1053 | { | |
1054 | so=3.392709e-13 * TMath::Exp(2.864104 *x); | |
1055 | so=so*1e-18; | |
1056 | } | |
1057 | ||
1058 | if(x>=6.5 && x<7.0) | |
1059 | { | |
1060 | so=2.910039e-34 * TMath::Exp(10.3337*x); | |
1061 | so=so*1e-18; | |
1062 | } | |
1063 | ||
1064 | ||
1065 | if (x>=7.0) | |
1066 | { | |
1067 | Float_t a0=-73770.76; | |
1068 | Float_t a1=46190.69; | |
1069 | Float_t a2=-11475.44; | |
1070 | Float_t a3=1412.611; | |
1071 | Float_t a4=-86.07027; | |
1072 | Float_t a5=2.074234; | |
1073 | so= a0+(a1*x)+(a2*x*x)+(a3*x*x*x)+(a4*x*x*x*x)+(a5*x*x*x*x*x); | |
1074 | so=so*1e-18; | |
1075 | } | |
1076 | ||
1077 | Float_t dox=(kOxy/1e6)*kLosch*pn/tn; | |
1078 | abslo=1./so/dox; | |
1079 | } | |
1080 | else | |
1081 | abslo=1.e18; | |
1082 | // --------------------------------------------------------- | |
1083 | // | |
1084 | // transmission of H2O | |
1085 | // | |
1086 | // y= path in cm, x=energy in eV | |
1087 | // sw= cross section for UV absorption in cm2 | |
1088 | // dw= H2O molecular density in cm-3 | |
1089 | // --------------------------------------------------------- | |
1090 | ||
1091 | Float_t abslw; | |
1092 | ||
1093 | Float_t b0=29231.65; | |
1094 | Float_t b1=-15807.74; | |
1095 | Float_t b2=3192.926; | |
1096 | Float_t b3=-285.4809; | |
1097 | Float_t b4=9.533944; | |
1098 | ||
1099 | if(x>6.75) | |
1100 | { | |
1101 | Float_t sw= b0+(b1*x)+(b2*x*x)+(b3*x*x*x)+(b4*x*x*x*x); | |
1102 | sw=sw*1e-18; | |
1103 | Float_t dw=(kWater/1e6)*kLosch*pn/tn; | |
1104 | abslw=1./sw/dw; | |
1105 | } | |
1106 | else | |
1107 | abslw=1.e18; | |
1108 | ||
1109 | // --------------------------------------------------------- | |
1110 | ||
1111 | Float_t alength=1./(1./abslm+1./absli+1./abslo+1./abslw); | |
1112 | return (alength); | |
1113 | } | |
1114 | ||
1115 | ||
1116 | ||
ddae0931 | 1117 | //___________________________________________ |
1118 | Int_t AliRICH::DistancetoPrimitive(Int_t , Int_t ) | |
1119 | { | |
237c933d | 1120 | |
1121 | // Default value | |
1122 | ||
ddae0931 | 1123 | return 9999; |
1124 | } | |
fe4da5cc | 1125 | |
ddae0931 | 1126 | //___________________________________________ |
1127 | void AliRICH::MakeBranch(Option_t* option) | |
fe4da5cc | 1128 | { |
237c933d | 1129 | // Create Tree branches for the RICH. |
fe4da5cc | 1130 | |
237c933d | 1131 | const Int_t kBufferSize = 4000; |
ddae0931 | 1132 | char branchname[20]; |
fe4da5cc | 1133 | |
ddae0931 | 1134 | |
1135 | AliDetector::MakeBranch(option); | |
1136 | sprintf(branchname,"%sCerenkov",GetName()); | |
1137 | if (fCerenkovs && gAlice->TreeH()) { | |
237c933d | 1138 | gAlice->TreeH()->Branch(branchname,&fCerenkovs, kBufferSize); |
ddae0931 | 1139 | printf("Making Branch %s for Cerenkov Hits\n",branchname); |
fe4da5cc | 1140 | } |
ddae0931 | 1141 | |
2e5f0f7b | 1142 | sprintf(branchname,"%sPadHits",GetName()); |
1143 | if (fPadHits && gAlice->TreeH()) { | |
237c933d | 1144 | gAlice->TreeH()->Branch(branchname,&fPadHits, kBufferSize); |
2e5f0f7b | 1145 | printf("Making Branch %s for PadHits\n",branchname); |
fe4da5cc | 1146 | } |
1147 | ||
ddae0931 | 1148 | // one branch for digits per chamber |
1149 | Int_t i; | |
1150 | ||
237c933d | 1151 | for (i=0; i<kNCH ;i++) { |
ddae0931 | 1152 | sprintf(branchname,"%sDigits%d",GetName(),i+1); |
1153 | ||
1154 | if (fDchambers && gAlice->TreeD()) { | |
237c933d | 1155 | gAlice->TreeD()->Branch(branchname,&((*fDchambers)[i]), kBufferSize); |
ddae0931 | 1156 | printf("Making Branch %s for digits in chamber %d\n",branchname,i+1); |
1157 | } | |
fe4da5cc | 1158 | } |
2e5f0f7b | 1159 | |
1160 | // one branch for raw clusters per chamber | |
237c933d | 1161 | for (i=0; i<kNCH ;i++) { |
2e5f0f7b | 1162 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); |
1163 | ||
1164 | if (fRawClusters && gAlice->TreeR()) { | |
237c933d | 1165 | gAlice->TreeR()->Branch(branchname,&((*fRawClusters)[i]), kBufferSize); |
2e5f0f7b | 1166 | printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1); |
1167 | } | |
1168 | } | |
1169 | ||
1170 | // one branch for rec hits per chamber | |
237c933d | 1171 | for (i=0; i<kNCH ;i++) { |
2e5f0f7b | 1172 | sprintf(branchname,"%sRecHits%d",GetName(),i+1); |
1173 | ||
1174 | if (fRecHits && gAlice->TreeR()) { | |
237c933d | 1175 | gAlice->TreeR()->Branch(branchname,&((*fRecHits)[i]), kBufferSize); |
2e5f0f7b | 1176 | printf("Making Branch %s for rec. hits in chamber %d\n",branchname,i+1); |
1177 | } | |
1178 | } | |
fe4da5cc | 1179 | } |
1180 | ||
ddae0931 | 1181 | //___________________________________________ |
1182 | void AliRICH::SetTreeAddress() | |
fe4da5cc | 1183 | { |
237c933d | 1184 | // Set branch address for the Hits and Digits Tree. |
2e5f0f7b | 1185 | char branchname[20]; |
1186 | Int_t i; | |
1187 | ||
ddae0931 | 1188 | AliDetector::SetTreeAddress(); |
1189 | ||
1190 | TBranch *branch; | |
1191 | TTree *treeH = gAlice->TreeH(); | |
1192 | TTree *treeD = gAlice->TreeD(); | |
2e5f0f7b | 1193 | TTree *treeR = gAlice->TreeR(); |
ddae0931 | 1194 | |
1195 | if (treeH) { | |
2e5f0f7b | 1196 | if (fPadHits) { |
1197 | branch = treeH->GetBranch("RICHPadHits"); | |
1198 | if (branch) branch->SetAddress(&fPadHits); | |
fe4da5cc | 1199 | } |
ddae0931 | 1200 | if (fCerenkovs) { |
1201 | branch = treeH->GetBranch("RICHCerenkov"); | |
1202 | if (branch) branch->SetAddress(&fCerenkovs); | |
fe4da5cc | 1203 | } |
ddae0931 | 1204 | } |
1205 | ||
1206 | if (treeD) { | |
237c933d | 1207 | for (int i=0; i<kNCH; i++) { |
ddae0931 | 1208 | sprintf(branchname,"%sDigits%d",GetName(),i+1); |
1209 | if (fDchambers) { | |
1210 | branch = treeD->GetBranch(branchname); | |
1211 | if (branch) branch->SetAddress(&((*fDchambers)[i])); | |
1212 | } | |
fe4da5cc | 1213 | } |
fe4da5cc | 1214 | } |
2e5f0f7b | 1215 | if (treeR) { |
237c933d | 1216 | for (i=0; i<kNCH; i++) { |
2e5f0f7b | 1217 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); |
1218 | if (fRawClusters) { | |
1219 | branch = treeR->GetBranch(branchname); | |
1220 | if (branch) branch->SetAddress(&((*fRawClusters)[i])); | |
1221 | } | |
1222 | } | |
1223 | ||
237c933d | 1224 | for (i=0; i<kNCH; i++) { |
2e5f0f7b | 1225 | sprintf(branchname,"%sRecHits%d",GetName(),i+1); |
1226 | if (fRecHits) { | |
1227 | branch = treeR->GetBranch(branchname); | |
1228 | if (branch) branch->SetAddress(&((*fRecHits)[i])); | |
1229 | } | |
1230 | } | |
1231 | ||
1232 | } | |
ddae0931 | 1233 | } |
1234 | //___________________________________________ | |
1235 | void AliRICH::ResetHits() | |
1236 | { | |
237c933d | 1237 | // Reset number of clusters and the cluster array for this detector |
ddae0931 | 1238 | AliDetector::ResetHits(); |
2e5f0f7b | 1239 | fNPadHits = 0; |
1240 | fNcerenkovs = 0; | |
1241 | if (fPadHits) fPadHits->Clear(); | |
ddae0931 | 1242 | if (fCerenkovs) fCerenkovs->Clear(); |
fe4da5cc | 1243 | } |
1244 | ||
2e5f0f7b | 1245 | |
ddae0931 | 1246 | //____________________________________________ |
1247 | void AliRICH::ResetDigits() | |
1248 | { | |
237c933d | 1249 | // |
1250 | // Reset number of digits and the digits array for this detector | |
1251 | // | |
1252 | for ( int i=0;i<kNCH;i++ ) { | |
ddae0931 | 1253 | if ((*fDchambers)[i]) (*fDchambers)[i]->Clear(); |
1254 | if (fNdch) fNdch[i]=0; | |
1255 | } | |
1256 | } | |
2e5f0f7b | 1257 | |
ddae0931 | 1258 | //____________________________________________ |
2e5f0f7b | 1259 | void AliRICH::ResetRawClusters() |
fe4da5cc | 1260 | { |
237c933d | 1261 | // |
1262 | // Reset number of raw clusters and the raw clust array for this detector | |
1263 | // | |
1264 | for ( int i=0;i<kNCH;i++ ) { | |
2e5f0f7b | 1265 | if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear(); |
1266 | if (fNrawch) fNrawch[i]=0; | |
fe4da5cc | 1267 | } |
ddae0931 | 1268 | } |
fe4da5cc | 1269 | |
2e5f0f7b | 1270 | //____________________________________________ |
1271 | void AliRICH::ResetRecHits() | |
fe4da5cc | 1272 | { |
237c933d | 1273 | // |
1274 | // Reset number of raw clusters and the raw clust array for this detector | |
1275 | // | |
2e5f0f7b | 1276 | |
237c933d | 1277 | for ( int i=0;i<kNCH;i++ ) { |
2e5f0f7b | 1278 | if ((*fRecHits)[i]) ((TClonesArray*)(*fRecHits)[i])->Clear(); |
1279 | if (fNrechits) fNrechits[i]=0; | |
1280 | } | |
fe4da5cc | 1281 | } |
1282 | ||
ddae0931 | 1283 | //___________________________________________ |
2e5f0f7b | 1284 | void AliRICH::SetGeometryModel(Int_t id, AliRICHGeometry *geometry) |
fe4da5cc | 1285 | { |
237c933d | 1286 | |
1287 | // | |
1288 | // Setter for the RICH geometry model | |
1289 | // | |
1290 | ||
1291 | ||
2e5f0f7b | 1292 | ((AliRICHChamber*) (*fChambers)[id])->GeometryModel(geometry); |
fe4da5cc | 1293 | } |
1294 | ||
ddae0931 | 1295 | //___________________________________________ |
2e5f0f7b | 1296 | void AliRICH::SetSegmentationModel(Int_t id, AliRICHSegmentation *segmentation) |
ddae0931 | 1297 | { |
237c933d | 1298 | |
1299 | // | |
1300 | // Setter for the RICH segmentation model | |
1301 | // | |
1302 | ||
2e5f0f7b | 1303 | ((AliRICHChamber*) (*fChambers)[id])->SegmentationModel(segmentation); |
ddae0931 | 1304 | } |
fe4da5cc | 1305 | |
ddae0931 | 1306 | //___________________________________________ |
2e5f0f7b | 1307 | void AliRICH::SetResponseModel(Int_t id, AliRICHResponse *response) |
fe4da5cc | 1308 | { |
237c933d | 1309 | |
1310 | // | |
1311 | // Setter for the RICH response model | |
1312 | // | |
1313 | ||
2e5f0f7b | 1314 | ((AliRICHChamber*) (*fChambers)[id])->ResponseModel(response); |
fe4da5cc | 1315 | } |
1316 | ||
2e5f0f7b | 1317 | void AliRICH::SetReconstructionModel(Int_t id, AliRICHClusterFinder *reconst) |
ddae0931 | 1318 | { |
237c933d | 1319 | |
1320 | // | |
1321 | // Setter for the RICH reconstruction model (clusters) | |
1322 | // | |
1323 | ||
2e5f0f7b | 1324 | ((AliRICHChamber*) (*fChambers)[id])->ReconstructionModel(reconst); |
fe4da5cc | 1325 | } |
1326 | ||
ddae0931 | 1327 | void AliRICH::SetNsec(Int_t id, Int_t nsec) |
1328 | { | |
237c933d | 1329 | |
1330 | // | |
1331 | // Sets the number of padplanes | |
1332 | // | |
1333 | ||
2e5f0f7b | 1334 | ((AliRICHChamber*) (*fChambers)[id])->SetNsec(nsec); |
ddae0931 | 1335 | } |
1336 | ||
1337 | ||
1338 | //___________________________________________ | |
ddae0931 | 1339 | void AliRICH::StepManager() |
fe4da5cc | 1340 | { |
237c933d | 1341 | |
452a64c6 | 1342 | // Full Step Manager |
1343 | ||
1344 | Int_t copy, id; | |
1345 | static Int_t idvol; | |
1346 | static Int_t vol[2]; | |
1347 | Int_t ipart; | |
1348 | static Float_t hits[18]; | |
1349 | static Float_t ckovData[19]; | |
1350 | TLorentzVector position; | |
1351 | TLorentzVector momentum; | |
1352 | Float_t pos[3]; | |
1353 | Float_t mom[4]; | |
1354 | Float_t localPos[3]; | |
1355 | Float_t localMom[4]; | |
1356 | Float_t localTheta,localPhi; | |
1357 | Float_t theta,phi; | |
1358 | Float_t destep, step; | |
1359 | Float_t ranf[2]; | |
1360 | Int_t nPads; | |
1361 | Float_t coscerenkov; | |
1362 | static Float_t eloss, xhit, yhit, tlength; | |
1363 | const Float_t kBig=1.e10; | |
1364 | ||
1365 | TClonesArray &lhits = *fHits; | |
1366 | TGeant3 *geant3 = (TGeant3*) gMC; | |
1367 | TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->CurrentTrack()]; | |
237c933d | 1368 | |
452a64c6 | 1369 | //if (current->Energy()>1) |
1370 | //{ | |
1371 | ||
1372 | // Only gas gap inside chamber | |
1373 | // Tag chambers and record hits when track enters | |
1374 | ||
1375 | idvol=-1; | |
1376 | id=gMC->CurrentVolID(copy); | |
1377 | Float_t cherenkovLoss=0; | |
1378 | //gAlice->KeepTrack(gAlice->CurrentTrack()); | |
1379 | ||
1380 | gMC->TrackPosition(position); | |
1381 | pos[0]=position(0); | |
1382 | pos[1]=position(1); | |
1383 | pos[2]=position(2); | |
e51a3fa9 | 1384 | bzero(ckovData,sizeof(ckovData)*19); |
452a64c6 | 1385 | ckovData[1] = pos[0]; // X-position for hit |
1386 | ckovData[2] = pos[1]; // Y-position for hit | |
1387 | ckovData[3] = pos[2]; // Z-position for hit | |
1388 | //ckovData[11] = gAlice->CurrentTrack(); | |
1389 | ||
1390 | //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH"); | |
1391 | ||
1392 | /********************Store production parameters for Cerenkov photons************************/ | |
1393 | //is it a Cerenkov photon? | |
1394 | if (gMC->TrackPid() == 50000050) { | |
1395 | ||
1396 | //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy)) | |
1397 | //{ | |
1398 | Float_t ckovEnergy = current->Energy(); | |
1399 | //energy interval for tracking | |
1400 | if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 ) | |
1401 | //if (ckovEnergy > 0) | |
1402 | { | |
1403 | if (gMC->IsTrackEntering()){ //is track entering? | |
1404 | if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy)) | |
1405 | { //is it in freo? | |
1406 | if (geant3->Gctrak()->nstep<1){ //is it the first step? | |
1407 | Int_t mother = current->GetFirstMother(); | |
1408 | ||
1409 | //printf("Second Mother:%d\n",current->GetSecondMother()); | |
1410 | ||
1411 | ckovData[10] = mother; | |
1412 | ckovData[11] = gAlice->CurrentTrack(); | |
1413 | ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz | |
1414 | fCkovNumber++; | |
1415 | fFreonProd=1; | |
1416 | //printf("Index: %d\n",fCkovNumber); | |
1417 | } //first step question | |
1418 | } //freo question | |
1419 | ||
1420 | if (geant3->Gctrak()->nstep<1){ //is it first step? | |
1421 | if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz? | |
1422 | { | |
1423 | ckovData[12] = 2; | |
1424 | } //quarz question | |
1425 | } //first step question | |
1426 | ||
1427 | //printf("Before %d\n",fFreonProd); | |
1428 | } //track entering question | |
1429 | ||
1430 | if (ckovData[12] == 1) //was it produced in Freon? | |
1431 | //if (fFreonProd == 1) | |
1432 | { | |
1433 | if (gMC->IsTrackEntering()){ //is track entering? | |
1434 | //printf("Got in"); | |
1435 | if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap? | |
1436 | { | |
1437 | //printf("Got in\n"); | |
1438 | gMC->TrackMomentum(momentum); | |
1439 | mom[0]=momentum(0); | |
1440 | mom[1]=momentum(1); | |
1441 | mom[2]=momentum(2); | |
1442 | mom[3]=momentum(3); | |
1443 | // Z-position for hit | |
1444 | ||
1445 | ||
1446 | /**************** Photons lost in second grid have to be calculated by hand************/ | |
1447 | ||
1448 | Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1])); | |
1449 | Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi); | |
1450 | gMC->Rndm(ranf, 1); | |
1451 | //printf("grid calculation:%f\n",t); | |
1452 | if (ranf[0] > t) { | |
1453 | //geant3->StopTrack(); | |
1454 | ckovData[13] = 5; | |
1455 | AddCerenkov(gAlice->CurrentTrack(),vol,ckovData); | |
1456 | //printf("Lost one in grid\n"); | |
1457 | } | |
1458 | /**********************************************************************************/ | |
1459 | } //gap | |
1460 | ||
1461 | if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi? | |
1462 | { | |
1463 | gMC->TrackMomentum(momentum); | |
1464 | mom[0]=momentum(0); | |
1465 | mom[1]=momentum(1); | |
1466 | mom[2]=momentum(2); | |
1467 | mom[3]=momentum(3); | |
1468 | ||
1469 | /********* Photons lost by Fresnel reflection have to be calculated by hand********/ | |
1470 | /***********************Cerenkov phtons (always polarised)*************************/ | |
1471 | ||
1472 | Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1])); | |
1473 | Float_t t = Fresnel(ckovEnergy*1e9,cophi,1); | |
1474 | gMC->Rndm(ranf, 1); | |
1475 | if (ranf[0] < t) { | |
1476 | //geant3->StopTrack(); | |
1477 | ckovData[13] = 6; | |
1478 | AddCerenkov(gAlice->CurrentTrack(),vol,ckovData); | |
1479 | //printf("Lost by Fresnel\n"); | |
1480 | } | |
1481 | /**********************************************************************************/ | |
1482 | } | |
1483 | } //track entering? | |
1484 | ||
1485 | ||
1486 | /********************Evaluation of losses************************/ | |
1487 | /******************still in the old fashion**********************/ | |
1488 | ||
1489 | Int_t i1 = geant3->Gctrak()->nmec; //number of physics mechanisms acting on the particle | |
1490 | for (Int_t i = 0; i < i1; ++i) { | |
1491 | // Reflection loss | |
1492 | if (geant3->Gctrak()->lmec[i] == 106) { //was it reflected | |
1493 | ckovData[13]=10; | |
1494 | if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy)) | |
1495 | ckovData[13]=1; | |
1496 | if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR")) | |
1497 | ckovData[13]=2; | |
1498 | //geant3->StopTrack(); | |
1499 | AddCerenkov(gAlice->CurrentTrack(),vol,ckovData); | |
1500 | } //reflection question | |
1501 | ||
1502 | ||
1503 | // Absorption loss | |
1504 | else if (geant3->Gctrak()->lmec[i] == 101) { //was it absorbed? | |
1505 | ckovData[13]=20; | |
1506 | if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy)) | |
1507 | ckovData[13]=11; | |
1508 | if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR")) | |
1509 | ckovData[13]=12; | |
1510 | if (gMC->CurrentVolID(copy) == gMC->VolId("META")) | |
1511 | ckovData[13]=13; | |
1512 | if (gMC->CurrentVolID(copy) == gMC->VolId("GAP ")) | |
1513 | ckovData[13]=13; | |
1514 | ||
1515 | if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC")) | |
1516 | ckovData[13]=15; | |
1517 | ||
1518 | // CsI inefficiency | |
1519 | if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) { | |
1520 | ckovData[13]=16; | |
1521 | } | |
1522 | //geant3->StopTrack(); | |
1523 | AddCerenkov(gAlice->CurrentTrack(),vol,ckovData); | |
1524 | //printf("Added cerenkov %d\n",fCkovNumber); | |
1525 | } //absorption question | |
1526 | ||
1527 | ||
1528 | // Photon goes out of tracking scope | |
1529 | else if (geant3->Gctrak()->lmec[i] == 30) { //is it below energy treshold? | |
1530 | ckovData[13]=21; | |
1531 | //geant3->StopTrack(); | |
1532 | AddCerenkov(gAlice->CurrentTrack(),vol,ckovData); | |
1533 | } // energy treshold question | |
1534 | } //number of mechanisms cycle | |
1535 | /**********************End of evaluation************************/ | |
1536 | } //freon production question | |
1537 | } //energy interval question | |
1538 | //}//inside the proximity gap question | |
1539 | } //cerenkov photon question | |
1540 | ||
1541 | /**************************************End of Production Parameters Storing*********************/ | |
1542 | ||
1543 | ||
1544 | /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/ | |
1545 | ||
1546 | if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) { | |
1547 | //printf("Cerenkov\n"); | |
1548 | if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) | |
1549 | { | |
1550 | ||
1551 | if (gMC->Edep() > 0.){ | |
1552 | gMC->TrackPosition(position); | |
1553 | gMC->TrackMomentum(momentum); | |
1554 | pos[0]=position(0); | |
1555 | pos[1]=position(1); | |
1556 | pos[2]=position(2); | |
1557 | mom[0]=momentum(0); | |
1558 | mom[1]=momentum(1); | |
1559 | mom[2]=momentum(2); | |
1560 | mom[3]=momentum(3); | |
1561 | Double_t tc = mom[0]*mom[0]+mom[1]*mom[1]; | |
1562 | Double_t rt = TMath::Sqrt(tc); | |
1563 | theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg; | |
1564 | phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg; | |
1565 | gMC->Gmtod(pos,localPos,1); | |
1566 | gMC->Gmtod(mom,localMom,2); | |
1567 | ||
1568 | gMC->CurrentVolOffID(2,copy); | |
1569 | vol[0]=copy; | |
1570 | idvol=vol[0]-1; | |
1571 | ||
1572 | //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol]) | |
1573 | //->Sector(localPos[0], localPos[2]); | |
1574 | //printf("Sector:%d\n",sector); | |
1575 | ||
1576 | /*if (gMC->TrackPid() == 50000051){ | |
1577 | fFeedbacks++; | |
1578 | printf("Feedbacks:%d\n",fFeedbacks); | |
1579 | }*/ | |
1580 | ||
1581 | ((AliRICHChamber*) (*fChambers)[idvol]) | |
1582 | ->SigGenInit(localPos[0], localPos[2], localPos[1]); | |
1583 | if(idvol<kNCH) { | |
1584 | ckovData[0] = gMC->TrackPid(); // particle type | |
1585 | ckovData[1] = pos[0]; // X-position for hit | |
1586 | ckovData[2] = pos[1]; // Y-position for hit | |
1587 | ckovData[3] = pos[2]; // Z-position for hit | |
1588 | ckovData[4] = theta; // theta angle of incidence | |
1589 | ckovData[5] = phi; // phi angle of incidence | |
1590 | ckovData[8] = (Float_t) fNPadHits; // first padhit | |
1591 | ckovData[9] = -1; // last pad hit | |
1592 | ckovData[13] = 4; // photon was detected | |
1593 | ckovData[14] = mom[0]; | |
1594 | ckovData[15] = mom[1]; | |
1595 | ckovData[16] = mom[2]; | |
1596 | ||
1597 | destep = gMC->Edep(); | |
1598 | gMC->SetMaxStep(kBig); | |
1599 | cherenkovLoss += destep; | |
1600 | ckovData[7]=cherenkovLoss; | |
1601 | ||
1602 | nPads = MakePadHits(localPos[0],localPos[2],cherenkovLoss,idvol,kCerenkov); | |
1603 | if (fNPadHits > (Int_t)ckovData[8]) { | |
1604 | ckovData[8]= ckovData[8]+1; | |
1605 | ckovData[9]= (Float_t) fNPadHits; | |
1606 | } | |
1607 | ||
1608 | ckovData[17] = nPads; | |
1609 | //printf("nPads:%d",nPads); | |
1610 | ||
1611 | //TClonesArray *Hits = RICH->Hits(); | |
1612 | AliRICHHit *mipHit = (AliRICHHit*) (fHits->UncheckedAt(0)); | |
1613 | if (mipHit) | |
1614 | { | |
1615 | mom[0] = current->Px(); | |
1616 | mom[1] = current->Py(); | |
1617 | mom[2] = current->Pz(); | |
1618 | Float_t mipPx = mipHit->fMomX; | |
1619 | Float_t mipPy = mipHit->fMomY; | |
1620 | Float_t mipPz = mipHit->fMomZ; | |
1621 | ||
1622 | Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2]; | |
1623 | Float_t rt = TMath::Sqrt(r); | |
1624 | Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz; | |
1625 | Float_t mipRt = TMath::Sqrt(mipR); | |
1626 | if ((rt*mipRt) > 0) | |
1627 | { | |
1628 | coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt); | |
1629 | } | |
1630 | else | |
1631 | { | |
1632 | coscerenkov = 0; | |
1633 | } | |
1634 | Float_t cherenkov = TMath::ACos(coscerenkov); | |
1635 | ckovData[18]=cherenkov; | |
1636 | } | |
1637 | //if (sector != -1) | |
1638 | //{ | |
1639 | AddHit(gAlice->CurrentTrack(),vol,ckovData); | |
1640 | AddCerenkov(gAlice->CurrentTrack(),vol,ckovData); | |
1641 | //} | |
1642 | } | |
1643 | } | |
1644 | } | |
1645 | } | |
1646 | ||
1647 | /***********************************************End of photon hits*********************************************/ | |
1648 | ||
1649 | ||
1650 | /**********************************************Charged particles treatment*************************************/ | |
1651 | ||
1652 | else if (gMC->TrackCharge()) | |
1653 | //else if (1 == 1) | |
1654 | { | |
1655 | //If MIP | |
1656 | /*if (gMC->IsTrackEntering()) | |
1657 | { | |
1658 | hits[13]=20;//is track entering? | |
1659 | }*/ | |
1660 | if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy)) | |
1661 | { | |
1662 | fFreonProd=1; | |
1663 | } | |
1664 | ||
1665 | if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) { | |
1666 | // Get current particle id (ipart), track position (pos) and momentum (mom) | |
1667 | ||
1668 | gMC->CurrentVolOffID(3,copy); | |
1669 | vol[0]=copy; | |
1670 | idvol=vol[0]-1; | |
1671 | ||
1672 | //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol]) | |
1673 | //->Sector(localPos[0], localPos[2]); | |
1674 | //printf("Sector:%d\n",sector); | |
1675 | ||
1676 | gMC->TrackPosition(position); | |
1677 | gMC->TrackMomentum(momentum); | |
1678 | pos[0]=position(0); | |
1679 | pos[1]=position(1); | |
1680 | pos[2]=position(2); | |
1681 | mom[0]=momentum(0); | |
1682 | mom[1]=momentum(1); | |
1683 | mom[2]=momentum(2); | |
1684 | mom[3]=momentum(3); | |
1685 | gMC->Gmtod(pos,localPos,1); | |
1686 | gMC->Gmtod(mom,localMom,2); | |
1687 | ||
1688 | ipart = gMC->TrackPid(); | |
1689 | // | |
1690 | // momentum loss and steplength in last step | |
1691 | destep = gMC->Edep(); | |
1692 | step = gMC->TrackStep(); | |
1693 | ||
1694 | // | |
1695 | // record hits when track enters ... | |
1696 | if( gMC->IsTrackEntering()) { | |
1697 | // gMC->SetMaxStep(fMaxStepGas); | |
1698 | Double_t tc = mom[0]*mom[0]+mom[1]*mom[1]; | |
1699 | Double_t rt = TMath::Sqrt(tc); | |
1700 | theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg; | |
1701 | phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg; | |
1702 | ||
1703 | ||
1704 | Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2]; | |
1705 | Double_t localRt = TMath::Sqrt(localTc); | |
1706 | localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg; | |
1707 | localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg; | |
1708 | ||
1709 | hits[0] = Float_t(ipart); // particle type | |
1710 | hits[1] = localPos[0]; // X-position for hit | |
1711 | hits[2] = localPos[1]; // Y-position for hit | |
1712 | hits[3] = localPos[2]; // Z-position for hit | |
1713 | hits[4] = localTheta; // theta angle of incidence | |
1714 | hits[5] = localPhi; // phi angle of incidence | |
1715 | hits[8] = (Float_t) fNPadHits; // first padhit | |
1716 | hits[9] = -1; // last pad hit | |
1717 | hits[13] = fFreonProd; // did id hit the freon? | |
1718 | hits[14] = mom[0]; | |
1719 | hits[15] = mom[1]; | |
1720 | hits[16] = mom[2]; | |
1721 | ||
1722 | tlength = 0; | |
1723 | eloss = 0; | |
1724 | fFreonProd = 0; | |
1725 | ||
1726 | Chamber(idvol).LocaltoGlobal(localPos,hits+1); | |
1727 | ||
1728 | ||
1729 | //To make chamber coordinates x-y had to pass localPos[0], localPos[2] | |
1730 | xhit = localPos[0]; | |
1731 | yhit = localPos[2]; | |
1732 | // Only if not trigger chamber | |
1733 | if(idvol<kNCH) { | |
1734 | // | |
1735 | // Initialize hit position (cursor) in the segmentation model | |
1736 | ((AliRICHChamber*) (*fChambers)[idvol]) | |
1737 | ->SigGenInit(localPos[0], localPos[2], localPos[1]); | |
1738 | } | |
1739 | } | |
1740 | ||
1741 | // | |
1742 | // Calculate the charge induced on a pad (disintegration) in case | |
1743 | // | |
1744 | // Mip left chamber ... | |
1745 | if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){ | |
1746 | gMC->SetMaxStep(kBig); | |
1747 | eloss += destep; | |
1748 | tlength += step; | |
1749 | ||
1750 | ||
1751 | // Only if not trigger chamber | |
1752 | if(idvol<kNCH) { | |
1753 | if (eloss > 0) | |
1754 | { | |
1755 | if(gMC->TrackPid() == kNeutron) | |
1756 | printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n"); | |
1757 | nPads = MakePadHits(xhit,yhit,eloss,idvol,kMip); | |
1758 | hits[17] = nPads; | |
1759 | //printf("nPads:%d",nPads); | |
1760 | } | |
1761 | } | |
1762 | ||
1763 | hits[6]=tlength; | |
1764 | hits[7]=eloss; | |
1765 | if (fNPadHits > (Int_t)hits[8]) { | |
1766 | hits[8]= hits[8]+1; | |
1767 | hits[9]= (Float_t) fNPadHits; | |
1768 | } | |
1769 | ||
1770 | //if(sector !=-1) | |
1771 | new(lhits[fNhits++]) AliRICHHit(fIshunt,gAlice->CurrentTrack(),vol,hits); | |
1772 | eloss = 0; | |
1773 | // | |
1774 | // Check additional signal generation conditions | |
1775 | // defined by the segmentation | |
1776 | // model (boundary crossing conditions) | |
1777 | } else if | |
1778 | (((AliRICHChamber*) (*fChambers)[idvol]) | |
1779 | ->SigGenCond(localPos[0], localPos[2], localPos[1])) | |
1780 | { | |
1781 | ((AliRICHChamber*) (*fChambers)[idvol]) | |
1782 | ->SigGenInit(localPos[0], localPos[2], localPos[1]); | |
1783 | if (eloss > 0) | |
1784 | { | |
1785 | if(gMC->TrackPid() == kNeutron) | |
1786 | printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n"); | |
1787 | nPads = MakePadHits(xhit,yhit,eloss,idvol,kMip); | |
1788 | hits[17] = nPads; | |
1789 | //printf("Npads:%d",NPads); | |
1790 | } | |
1791 | xhit = localPos[0]; | |
1792 | yhit = localPos[2]; | |
1793 | eloss = destep; | |
1794 | tlength += step ; | |
1795 | // | |
1796 | // nothing special happened, add up energy loss | |
1797 | } else { | |
1798 | eloss += destep; | |
1799 | tlength += step ; | |
1800 | } | |
1801 | } | |
1802 | } | |
1803 | /*************************************************End of MIP treatment**************************************/ | |
1804 | //} | |
ddae0931 | 1805 | } |
2e5f0f7b | 1806 | |
237c933d | 1807 | void AliRICH::FindClusters(Int_t nev,Int_t lastEntry) |
ddae0931 | 1808 | { |
2e5f0f7b | 1809 | |
ddae0931 | 1810 | // |
1811 | // Loop on chambers and on cathode planes | |
1812 | // | |
2e5f0f7b | 1813 | for (Int_t icat=1;icat<2;icat++) { |
1814 | gAlice->ResetDigits(); | |
1815 | gAlice->TreeD()->GetEvent(1); // spurious +1 ... | |
237c933d | 1816 | for (Int_t ich=0;ich<kNCH;ich++) { |
2e5f0f7b | 1817 | AliRICHChamber* iChamber=(AliRICHChamber*) (*fChambers)[ich]; |
237c933d | 1818 | TClonesArray *pRICHdigits = this->DigitsAddress(ich); |
1819 | if (pRICHdigits == 0) | |
2e5f0f7b | 1820 | continue; |
1821 | // | |
1822 | // Get ready the current chamber stuff | |
1823 | // | |
1824 | AliRICHResponse* response = iChamber->GetResponseModel(); | |
1825 | AliRICHSegmentation* seg = iChamber->GetSegmentationModel(); | |
1826 | AliRICHClusterFinder* rec = iChamber->GetReconstructionModel(); | |
1827 | if (seg) { | |
1828 | rec->SetSegmentation(seg); | |
1829 | rec->SetResponse(response); | |
237c933d | 1830 | rec->SetDigits(pRICHdigits); |
2e5f0f7b | 1831 | rec->SetChamber(ich); |
1832 | if (nev==0) rec->CalibrateCOG(); | |
1833 | rec->FindRawClusters(); | |
1834 | } | |
1835 | TClonesArray *fRch; | |
1836 | fRch=RawClustAddress(ich); | |
1837 | fRch->Sort(); | |
1838 | } // for ich | |
1839 | ||
1840 | gAlice->TreeR()->Fill(); | |
1841 | TClonesArray *fRch; | |
237c933d | 1842 | for (int i=0;i<kNCH;i++) { |
2e5f0f7b | 1843 | fRch=RawClustAddress(i); |
1844 | int nraw=fRch->GetEntriesFast(); | |
1845 | printf ("Chamber %d, raw clusters %d\n",i,nraw); | |
1846 | } | |
1847 | ||
1848 | ResetRawClusters(); | |
1849 | ||
1850 | } // for icat | |
1851 | ||
1852 | char hname[30]; | |
1853 | sprintf(hname,"TreeR%d",nev); | |
33984590 | 1854 | gAlice->TreeR()->Write(hname,kOverwrite,0); |
2e5f0f7b | 1855 | gAlice->TreeR()->Reset(); |
1856 | ||
1857 | //gObjectTable->Print(); | |
ddae0931 | 1858 | } |
1859 | ||
1860 | ||
1861 | //______________________________________________________________________________ | |
1862 | void AliRICH::Streamer(TBuffer &R__b) | |
1863 | { | |
1864 | // Stream an object of class AliRICH. | |
2e5f0f7b | 1865 | AliRICHChamber *iChamber; |
1866 | AliRICHSegmentation *segmentation; | |
1867 | AliRICHResponse *response; | |
ddae0931 | 1868 | TClonesArray *digitsaddress; |
2e5f0f7b | 1869 | TClonesArray *rawcladdress; |
1870 | TClonesArray *rechitaddress; | |
ddae0931 | 1871 | |
1872 | if (R__b.IsReading()) { | |
1873 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } | |
1874 | AliDetector::Streamer(R__b); | |
2e5f0f7b | 1875 | R__b >> fNPadHits; |
1876 | R__b >> fPadHits; // diff | |
1877 | R__b >> fNcerenkovs; | |
1878 | R__b >> fCerenkovs; // diff | |
ddae0931 | 1879 | R__b >> fDchambers; |
2e5f0f7b | 1880 | R__b >> fRawClusters; |
33984590 | 1881 | R__b >> fRecHits; //diff |
1882 | R__b >> fDebugLevel; //diff | |
ddae0931 | 1883 | R__b.ReadArray(fNdch); |
2e5f0f7b | 1884 | R__b.ReadArray(fNrawch); |
1885 | R__b.ReadArray(fNrechits); | |
1886 | // | |
ddae0931 | 1887 | R__b >> fChambers; |
1888 | // Stream chamber related information | |
237c933d | 1889 | for (Int_t i =0; i<kNCH; i++) { |
2e5f0f7b | 1890 | iChamber=(AliRICHChamber*) (*fChambers)[i]; |
ddae0931 | 1891 | iChamber->Streamer(R__b); |
2e5f0f7b | 1892 | segmentation=iChamber->GetSegmentationModel(); |
1893 | segmentation->Streamer(R__b); | |
1894 | response=iChamber->GetResponseModel(); | |
ddae0931 | 1895 | response->Streamer(R__b); |
2e5f0f7b | 1896 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
1897 | rawcladdress->Streamer(R__b); | |
1898 | rechitaddress=(TClonesArray*) (*fRecHits)[i]; | |
1899 | rechitaddress->Streamer(R__b); | |
ddae0931 | 1900 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; |
1901 | digitsaddress->Streamer(R__b); | |
1902 | } | |
452a64c6 | 1903 | R__b >> fDebugLevel; |
1904 | R__b >> fCkovNumber; | |
1905 | R__b >> fCkovQuarz; | |
1906 | R__b >> fCkovGap; | |
1907 | R__b >> fCkovCsi; | |
1908 | R__b >> fLostRfreo; | |
1909 | R__b >> fLostRquar; | |
1910 | R__b >> fLostAfreo; | |
1911 | R__b >> fLostAquarz; | |
1912 | R__b >> fLostAmeta; | |
1913 | R__b >> fLostCsi; | |
1914 | R__b >> fLostWires; | |
1915 | R__b >> fFreonProd; | |
1916 | R__b >> fMipx; | |
1917 | R__b >> fMipy; | |
1918 | R__b >> fFeedbacks; | |
1919 | R__b >> fLostFresnel; | |
ddae0931 | 1920 | |
1921 | } else { | |
1922 | R__b.WriteVersion(AliRICH::IsA()); | |
1923 | AliDetector::Streamer(R__b); | |
2e5f0f7b | 1924 | R__b << fNPadHits; |
1925 | R__b << fPadHits; // diff | |
1926 | R__b << fNcerenkovs; | |
1927 | R__b << fCerenkovs; // diff | |
ddae0931 | 1928 | R__b << fDchambers; |
2e5f0f7b | 1929 | R__b << fRawClusters; |
1930 | R__b << fRecHits; //diff | |
33984590 | 1931 | R__b << fDebugLevel; //diff |
237c933d | 1932 | R__b.WriteArray(fNdch, kNCH); |
1933 | R__b.WriteArray(fNrawch, kNCH); | |
1934 | R__b.WriteArray(fNrechits, kNCH); | |
ddae0931 | 1935 | // |
ddae0931 | 1936 | R__b << fChambers; |
1937 | // Stream chamber related information | |
237c933d | 1938 | for (Int_t i =0; i<kNCH; i++) { |
2e5f0f7b | 1939 | iChamber=(AliRICHChamber*) (*fChambers)[i]; |
ddae0931 | 1940 | iChamber->Streamer(R__b); |
2e5f0f7b | 1941 | segmentation=iChamber->GetSegmentationModel(); |
1942 | segmentation->Streamer(R__b); | |
1943 | response=iChamber->GetResponseModel(); | |
ddae0931 | 1944 | response->Streamer(R__b); |
2e5f0f7b | 1945 | rawcladdress=(TClonesArray*) (*fRawClusters)[i]; |
1946 | rawcladdress->Streamer(R__b); | |
1947 | rechitaddress=(TClonesArray*) (*fRecHits)[i]; | |
1948 | rechitaddress->Streamer(R__b); | |
ddae0931 | 1949 | digitsaddress=(TClonesArray*) (*fDchambers)[i]; |
1950 | digitsaddress->Streamer(R__b); | |
1951 | } | |
452a64c6 | 1952 | R__b << fDebugLevel; |
1953 | R__b << fCkovNumber; | |
1954 | R__b << fCkovQuarz; | |
1955 | R__b << fCkovGap; | |
1956 | R__b << fCkovCsi; | |
1957 | R__b << fLostRfreo; | |
1958 | R__b << fLostRquar; | |
1959 | R__b << fLostAfreo; | |
1960 | R__b << fLostAquarz; | |
1961 | R__b << fLostAmeta; | |
1962 | R__b << fLostCsi; | |
1963 | R__b << fLostWires; | |
1964 | R__b << fFreonProd; | |
1965 | R__b << fMipx; | |
1966 | R__b << fMipy; | |
1967 | R__b << fFeedbacks; | |
1968 | R__b << fLostFresnel; | |
fe4da5cc | 1969 | } |
ddae0931 | 1970 | } |
2e5f0f7b | 1971 | AliRICHPadHit* AliRICH::FirstPad(AliRICHHit* hit,TClonesArray *clusters ) |
ddae0931 | 1972 | { |
1973 | // | |
1974 | // Initialise the pad iterator | |
1975 | // Return the address of the first padhit for hit | |
1976 | TClonesArray *theClusters = clusters; | |
1977 | Int_t nclust = theClusters->GetEntriesFast(); | |
1978 | if (nclust && hit->fPHlast > 0) { | |
2e5f0f7b | 1979 | sMaxIterPad=Int_t(hit->fPHlast); |
1980 | sCurIterPad=Int_t(hit->fPHfirst); | |
1981 | return (AliRICHPadHit*) clusters->UncheckedAt(sCurIterPad-1); | |
ddae0931 | 1982 | } else { |
1983 | return 0; | |
fe4da5cc | 1984 | } |
ddae0931 | 1985 | |
fe4da5cc | 1986 | } |
1987 | ||
2e5f0f7b | 1988 | AliRICHPadHit* AliRICH::NextPad(TClonesArray *clusters) |
fe4da5cc | 1989 | { |
237c933d | 1990 | |
1991 | // Iterates over pads | |
1992 | ||
ddae0931 | 1993 | sCurIterPad++; |
1994 | if (sCurIterPad <= sMaxIterPad) { | |
2e5f0f7b | 1995 | return (AliRICHPadHit*) clusters->UncheckedAt(sCurIterPad-1); |
ddae0931 | 1996 | } else { |
1997 | return 0; | |
1998 | } | |
fe4da5cc | 1999 | } |
2000 | ||
fe4da5cc | 2001 | |
d28b5fc2 | 2002 | void AliRICH::Digitise(Int_t nev, Int_t flag, Option_t *option,Text_t *filename) |
fe4da5cc | 2003 | { |
ddae0931 | 2004 | // keep galice.root for signal and name differently the file for |
2005 | // background when add! otherwise the track info for signal will be lost ! | |
2e5f0f7b | 2006 | |
c90dd3e2 | 2007 | static Bool_t first=kTRUE; |
237c933d | 2008 | static TFile *pFile; |
2009 | char *addBackground = strstr(option,"Add"); | |
ddae0931 | 2010 | |
2e5f0f7b | 2011 | FILE* points; //these will be the digits... |
2012 | ||
2013 | points=fopen("points.dat","w"); | |
2014 | ||
2015 | AliRICHChamber* iChamber; | |
2016 | AliRICHSegmentation* segmentation; | |
ddae0931 | 2017 | |
d28b5fc2 | 2018 | Int_t digitse=0; |
ddae0931 | 2019 | Int_t trk[50]; |
2020 | Int_t chtrk[50]; | |
2021 | TObjArray *list=new TObjArray; | |
237c933d | 2022 | static TClonesArray *pAddress=0; |
2023 | if(!pAddress) pAddress=new TClonesArray("TVector",1000); | |
2e5f0f7b | 2024 | Int_t digits[5]; |
ddae0931 | 2025 | |
237c933d | 2026 | AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH"); |
2027 | AliRICHHitMap* pHitMap[10]; | |
2e5f0f7b | 2028 | Int_t i; |
237c933d | 2029 | for (i=0; i<10; i++) {pHitMap[i]=0;} |
2030 | if (addBackground ) { | |
ddae0931 | 2031 | if(first) { |
2032 | fFileName=filename; | |
2033 | cout<<"filename"<<fFileName<<endl; | |
237c933d | 2034 | pFile=new TFile(fFileName); |
ddae0931 | 2035 | cout<<"I have opened "<<fFileName<<" file "<<endl; |
2e5f0f7b | 2036 | fHits2 = new TClonesArray("AliRICHHit",1000 ); |
2037 | fClusters2 = new TClonesArray("AliRICHPadHit",10000); | |
c90dd3e2 | 2038 | first=kFALSE; |
ddae0931 | 2039 | } |
237c933d | 2040 | pFile->cd(); |
ddae0931 | 2041 | // Get Hits Tree header from file |
2042 | if(fHits2) fHits2->Clear(); | |
2043 | if(fClusters2) fClusters2->Clear(); | |
2e5f0f7b | 2044 | if(TrH1) delete TrH1; |
2045 | TrH1=0; | |
2046 | ||
ddae0931 | 2047 | char treeName[20]; |
2048 | sprintf(treeName,"TreeH%d",nev); | |
2e5f0f7b | 2049 | TrH1 = (TTree*)gDirectory->Get(treeName); |
2050 | if (!TrH1) { | |
ddae0931 | 2051 | printf("ERROR: cannot find Hits Tree for event:%d\n",nev); |
2052 | } | |
2053 | // Set branch addresses | |
2054 | TBranch *branch; | |
2055 | char branchname[20]; | |
2056 | sprintf(branchname,"%s",GetName()); | |
2e5f0f7b | 2057 | if (TrH1 && fHits2) { |
2058 | branch = TrH1->GetBranch(branchname); | |
ddae0931 | 2059 | if (branch) branch->SetAddress(&fHits2); |
2060 | } | |
2e5f0f7b | 2061 | if (TrH1 && fClusters2) { |
2062 | branch = TrH1->GetBranch("RICHCluster"); | |
ddae0931 | 2063 | if (branch) branch->SetAddress(&fClusters2); |
2064 | } | |
2065 | } | |
33984590 | 2066 | |
ddae0931 | 2067 | AliRICHHitMap* hm; |
2e5f0f7b | 2068 | Int_t countadr=0; |
33984590 | 2069 | Int_t counter=0; |
2070 | for (i =0; i<kNCH; i++) { | |
2071 | iChamber=(AliRICHChamber*) (*fChambers)[i]; | |
2072 | segmentation=iChamber->GetSegmentationModel(1); | |
2073 | pHitMap[i] = new AliRICHHitMapA1(segmentation, list); | |
2074 | } | |
2075 | // | |
2076 | // Loop over tracks | |
2077 | // | |
2078 | ||
2079 | TTree *treeH = gAlice->TreeH(); | |
2080 | Int_t ntracks =(Int_t) treeH->GetEntries(); | |
2081 | for (Int_t track=0; track<ntracks; track++) { | |
2082 | gAlice->ResetHits(); | |
2083 | treeH->GetEvent(track); | |
2084 | // | |
2085 | // Loop over hits | |
2086 | for(AliRICHHit* mHit=(AliRICHHit*)pRICH->FirstHit(-1); | |
2087 | mHit; | |
2088 | mHit=(AliRICHHit*)pRICH->NextHit()) | |
2089 | { | |
2090 | ||
2091 | digitse=0; | |
2092 | ||
2093 | Int_t nch = mHit->fChamber-1; // chamber number | |
2094 | if (nch >kNCH) continue; | |
2095 | iChamber = &(pRICH->Chamber(nch)); | |
2096 | ||
2097 | TParticle *current = (TParticle*)(*gAlice->Particles())[track]; | |
2098 | ||
2099 | Int_t particle = current->GetPdgCode(); | |
2100 | ||
2101 | //printf("Flag:%d\n",flag); | |
2102 | //printf("Track:%d\n",track); | |
2103 | //printf("Particle:%d\n",particle); | |
2104 | ||
2105 | if (flag == 0) | |
2106 | digitse=1; | |
2107 | ||
2108 | if (flag == 1) | |
2109 | if(TMath::Abs(particle) == 211 || TMath::Abs(particle) == 111) | |
2110 | digitse=1; | |
2111 | ||
2112 | if (flag == 2) | |
2113 | if(TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310 | |
2114 | || TMath::Abs(particle)==311) | |
2115 | digitse=1; | |
2116 | ||
2117 | if (flag == 3 && TMath::Abs(particle)==2212) | |
2118 | digitse=1; | |
2119 | ||
2120 | if (flag == 4 && TMath::Abs(particle)==13) | |
2121 | digitse=1; | |
2122 | ||
2123 | if (flag == 5 && TMath::Abs(particle)==11) | |
2124 | digitse=1; | |
2125 | ||
2126 | if (flag == 6 && TMath::Abs(particle)==2112) | |
2127 | digitse=1; | |
2128 | ||
2129 | ||
2130 | //printf ("Particle: %d, Flag: %d, Digitse: %d\n",particle,flag,digitse); | |
2131 | ||
2132 | ||
2133 | if (digitse) | |
ddae0931 | 2134 | { |
d28b5fc2 | 2135 | |
33984590 | 2136 | // |
2137 | // Loop over pad hits | |
2138 | for (AliRICHPadHit* mPad= | |
2139 | (AliRICHPadHit*)pRICH->FirstPad(mHit,fPadHits); | |
2140 | mPad; | |
2141 | mPad=(AliRICHPadHit*)pRICH->NextPad(fPadHits)) | |
d28b5fc2 | 2142 | { |
33984590 | 2143 | Int_t cathode = mPad->fCathode; // cathode number |
2144 | Int_t ipx = mPad->fPadX; // pad number on X | |
2145 | Int_t ipy = mPad->fPadY; // pad number on Y | |
2146 | Int_t iqpad = mPad->fQpad; // charge per pad | |
2147 | // | |
2148 | // | |
2149 | //printf("X:%d, Y:%d, Q:%d\n",ipx,ipy,iqpad); | |
2150 | ||
2151 | Float_t thex, they; | |
2152 | segmentation=iChamber->GetSegmentationModel(cathode); | |
2153 | segmentation->GetPadCxy(ipx,ipy,thex,they); | |
2154 | new((*pAddress)[countadr++]) TVector(2); | |
2155 | TVector &trinfo=*((TVector*) (*pAddress)[countadr-1]); | |
2156 | trinfo(0)=(Float_t)track; | |
2157 | trinfo(1)=(Float_t)iqpad; | |
2158 | ||
2159 | digits[0]=ipx; | |
2160 | digits[1]=ipy; | |
2161 | digits[2]=iqpad; | |
2162 | ||
2163 | AliRICHTransientDigit* pdigit; | |
2164 | // build the list of fired pads and update the info | |
2165 | if (!pHitMap[nch]->TestHit(ipx, ipy)) { | |
2166 | list->AddAtAndExpand(new AliRICHTransientDigit(nch,digits),counter); | |
2167 | pHitMap[nch]->SetHit(ipx, ipy, counter); | |
2168 | counter++; | |
2169 | pdigit=(AliRICHTransientDigit*)list->At(list->GetLast()); | |
2170 | // list of tracks | |
2171 | TObjArray *trlist=(TObjArray*)pdigit->TrackList(); | |
2172 | trlist->Add(&trinfo); | |
2173 | } else { | |
2174 | pdigit=(AliRICHTransientDigit*) pHitMap[nch]->GetHit(ipx, ipy); | |
2175 | // update charge | |
2176 | (*pdigit).fSignal+=iqpad; | |
2177 | // update list of tracks | |
2178 | TObjArray* trlist=(TObjArray*)pdigit->TrackList(); | |
2179 | Int_t lastEntry=trlist->GetLast(); | |
2180 | TVector *ptrkP=(TVector*)trlist->At(lastEntry); | |
2181 | TVector &ptrk=*ptrkP; | |
2182 | Int_t lastTrack=Int_t(ptrk(0)); | |
2183 | Int_t lastCharge=Int_t(ptrk(1)); | |
2184 | if (lastTrack==track) { | |
2185 | lastCharge+=iqpad; | |
2186 | trlist->RemoveAt(lastEntry); | |
2187 | trinfo(0)=lastTrack; | |
2188 | trinfo(1)=lastCharge; | |
2189 | trlist->AddAt(&trinfo,lastEntry); | |
2190 | } else { | |
2191 | trlist->Add(&trinfo); | |
2192 | } | |
2193 | // check the track list | |
2194 | Int_t nptracks=trlist->GetEntriesFast(); | |
2195 | if (nptracks > 2) { | |
2196 | printf("Attention - tracks: %d (>2)\n",nptracks); | |
2197 | //printf("cat,nch,ix,iy %d %d %d %d \n",icat+1,nch,ipx,ipy); | |
2198 | for (Int_t tr=0;tr<nptracks;tr++) { | |
2199 | TVector *pptrkP=(TVector*)trlist->At(tr); | |
2200 | TVector &pptrk=*pptrkP; | |
2201 | trk[tr]=Int_t(pptrk(0)); | |
2202 | chtrk[tr]=Int_t(pptrk(1)); | |
2203 | } | |
2204 | } // end if nptracks | |
2205 | } // end if pdigit | |
2206 | } //end loop over clusters | |
2207 | }// track type condition | |
2208 | } // hit loop | |
2209 | } // track loop | |
2210 | ||
2211 | // open the file with background | |
2212 | ||
2213 | if (addBackground ) { | |
2214 | ntracks =(Int_t)TrH1->GetEntries(); | |
2215 | //printf("background - icat,ntracks1 %d %d\n",icat,ntracks); | |
2216 | //printf("background - Start loop over tracks \n"); | |
2217 | // | |
2218 | // Loop over tracks | |
2219 | // | |
2220 | for (Int_t trak=0; trak<ntracks; trak++) { | |
2221 | if (fHits2) fHits2->Clear(); | |
2222 | if (fClusters2) fClusters2->Clear(); | |
2223 | TrH1->GetEvent(trak); | |
2224 | // | |
2225 | // Loop over hits | |
2226 | AliRICHHit* mHit; | |
2227 | for(int j=0;j<fHits2->GetEntriesFast();++j) | |
2228 | { | |
2229 | mHit=(AliRICHHit*) (*fHits2)[j]; | |
2230 | Int_t nch = mHit->fChamber-1; // chamber number | |
2231 | if (nch >6) continue; | |
2232 | iChamber = &(pRICH->Chamber(nch)); | |
2233 | Int_t rmin = (Int_t)iChamber->RInner(); | |
2234 | Int_t rmax = (Int_t)iChamber->ROuter(); | |
2235 | // | |
2236 | // Loop over pad hits | |
2237 | for (AliRICHPadHit* mPad= | |
2238 | (AliRICHPadHit*)pRICH->FirstPad(mHit,fClusters2); | |
2239 | mPad; | |
2240 | mPad=(AliRICHPadHit*)pRICH->NextPad(fClusters2)) | |
2241 | { | |
2242 | Int_t cathode = mPad->fCathode; // cathode number | |
2243 | Int_t ipx = mPad->fPadX; // pad number on X | |
2244 | Int_t ipy = mPad->fPadY; // pad number on Y | |
2245 | Int_t iqpad = mPad->fQpad; // charge per pad | |
2e5f0f7b | 2246 | |
33984590 | 2247 | Float_t thex, they; |
2248 | segmentation=iChamber->GetSegmentationModel(cathode); | |
2249 | segmentation->GetPadCxy(ipx,ipy,thex,they); | |
2250 | Float_t rpad=TMath::Sqrt(thex*thex+they*they); | |
2251 | if (rpad < rmin || iqpad ==0 || rpad > rmax) continue; | |
2252 | new((*pAddress)[countadr++]) TVector(2); | |
2253 | TVector &trinfo=*((TVector*) (*pAddress)[countadr-1]); | |
2254 | trinfo(0)=-1; // tag background | |
2255 | trinfo(1)=-1; | |
2256 | digits[0]=ipx; | |
2257 | digits[1]=ipy; | |
2258 | digits[2]=iqpad; | |
2259 | if (trak <4 && nch==0) | |
2260 | printf("bgr - pHitMap[nch]->TestHit(ipx, ipy),trak %d %d\n", | |
2261 | pHitMap[nch]->TestHit(ipx, ipy),trak); | |
2262 | AliRICHTransientDigit* pdigit; | |
2263 | // build the list of fired pads and update the info | |
2264 | if (!pHitMap[nch]->TestHit(ipx, ipy)) { | |
2265 | list->AddAtAndExpand(new AliRICHTransientDigit(nch,digits),counter); | |
2266 | ||
2267 | pHitMap[nch]->SetHit(ipx, ipy, counter); | |
2268 | counter++; | |
2269 | printf("bgr new elem in list - counter %d\n",counter); | |
2270 | ||
2271 | pdigit=(AliRICHTransientDigit*)list->At(list->GetLast()); | |
2272 | // list of tracks | |
2273 | TObjArray *trlist=(TObjArray*)pdigit->TrackList(); | |
2274 | trlist->Add(&trinfo); | |
2275 | } else { | |
2276 | pdigit=(AliRICHTransientDigit*) pHitMap[nch]->GetHit(ipx, ipy); | |
2277 | // update charge | |
2278 | (*pdigit).fSignal+=iqpad; | |
2279 | // update list of tracks | |
2280 | TObjArray* trlist=(TObjArray*)pdigit->TrackList(); | |
2281 | Int_t lastEntry=trlist->GetLast(); | |
2282 | TVector *ptrkP=(TVector*)trlist->At(lastEntry); | |
2283 | TVector &ptrk=*ptrkP; | |
2284 | Int_t lastTrack=Int_t(ptrk(0)); | |
2285 | if (lastTrack==-1) { | |
2286 | continue; | |
2287 | } else { | |
2288 | trlist->Add(&trinfo); | |
2289 | } | |
2290 | // check the track list | |
2291 | Int_t nptracks=trlist->GetEntriesFast(); | |
2292 | if (nptracks > 0) { | |
2293 | for (Int_t tr=0;tr<nptracks;tr++) { | |
2294 | TVector *pptrkP=(TVector*)trlist->At(tr); | |
2295 | TVector &pptrk=*pptrkP; | |
2296 | trk[tr]=Int_t(pptrk(0)); | |
2297 | chtrk[tr]=Int_t(pptrk(1)); | |
2298 | } | |
2299 | } // end if nptracks | |
2300 | } // end if pdigit | |
2301 | } //end loop over clusters | |
2302 | } // hit loop | |
2303 | } // track loop | |
ddae0931 | 2304 | TTree *fAli=gAlice->TreeK(); |
237c933d | 2305 | if (fAli) pFile =fAli->GetCurrentFile(); |
2306 | pFile->cd(); | |
33984590 | 2307 | } // if Add |
2308 | ||
2309 | Int_t tracks[10]; | |
2310 | Int_t charges[10]; | |
2311 | //cout<<"Start filling digits \n "<<endl; | |
2312 | Int_t nentries=list->GetEntriesFast(); | |
2313 | //printf(" \n \n nentries %d \n",nentries); | |
2314 | ||
2315 | // start filling the digits | |
2316 | ||
2317 | for (Int_t nent=0;nent<nentries;nent++) { | |
2318 | AliRICHTransientDigit *address=(AliRICHTransientDigit*)list->At(nent); | |
2319 | if (address==0) continue; | |
2320 | ||
2321 | Int_t ich=address->fChamber; | |
2322 | Int_t q=address->fSignal; | |
2323 | iChamber=(AliRICHChamber*) (*fChambers)[ich]; | |
2324 | AliRICHResponse * response=iChamber->GetResponseModel(); | |
2325 | Int_t adcmax= (Int_t) response->MaxAdc(); | |
2326 | ||
2327 | ||
2328 | // add white noise and do zero-suppression and signal truncation (new electronics,old electronics gaus 1.2,0.2) | |
2329 | //printf("Treshold: %d\n",iChamber->fTresh->GetHitIndex(address->fPadX,address->fPadY)); | |
2330 | Int_t pedestal = iChamber->fTresh->GetHitIndex(address->fPadX,address->fPadY); | |
ddae0931 | 2331 | |
33984590 | 2332 | //printf("Pedestal:%d\n",pedestal); |
2333 | //Int_t pedestal=0; | |
2334 | Float_t treshold = (pedestal + 4*1.7); | |
2335 | ||
2336 | Float_t meanNoise = gRandom->Gaus(1.7, 0.25); | |
2337 | Float_t noise = gRandom->Gaus(0, meanNoise); | |
2338 | q+=(Int_t)(noise + pedestal); | |
2339 | //q+=(Int_t)(noise); | |
2340 | // magic number to be parametrised !!! | |
2341 | if ( q <= treshold) | |
2342 | { | |
2343 | q = q - pedestal; | |
2344 | continue; | |
2e5f0f7b | 2345 | } |
33984590 | 2346 | q = q - pedestal; |
2347 | if ( q >= adcmax) q=adcmax; | |
2348 | digits[0]=address->fPadX; | |
2349 | digits[1]=address->fPadY; | |
2350 | digits[2]=q; | |
2351 | ||
2352 | TObjArray* trlist=(TObjArray*)address->TrackList(); | |
2353 | Int_t nptracks=trlist->GetEntriesFast(); | |
2354 | ||
2355 | // this was changed to accomodate the real number of tracks | |
2356 | if (nptracks > 10) { | |
2357 | cout<<"Attention - tracks > 10 "<<nptracks<<endl; | |
2358 | nptracks=10; | |
2359 | } | |
2360 | if (nptracks > 2) { | |
2361 | printf("Attention - tracks > 2 %d \n",nptracks); | |
2362 | //printf("cat,ich,ix,iy,q %d %d %d %d %d \n", | |
2363 | //icat,ich,digits[0],digits[1],q); | |
2364 | } | |
2365 | for (Int_t tr=0;tr<nptracks;tr++) { | |
2366 | TVector *ppP=(TVector*)trlist->At(tr); | |
2367 | TVector &pp =*ppP; | |
2368 | tracks[tr]=Int_t(pp(0)); | |
2369 | charges[tr]=Int_t(pp(1)); | |
2370 | } //end loop over list of tracks for one pad | |
2371 | if (nptracks < 10 ) { | |
2372 | for (Int_t t=nptracks; t<10; t++) { | |
2373 | tracks[t]=0; | |
2374 | charges[t]=0; | |
ddae0931 | 2375 | } |
33984590 | 2376 | } |
2377 | //write file | |
2378 | if (ich==2) | |
2379 | fprintf(points,"%4d, %4d, %4d\n",digits[0],digits[1],digits[2]); | |
2380 | ||
2381 | // fill digits | |
2382 | pRICH->AddDigits(ich,tracks,charges,digits); | |
2383 | } | |
2384 | gAlice->TreeD()->Fill(); | |
2385 | ||
2386 | list->Delete(); | |
2387 | for(Int_t ii=0;ii<kNCH;++ii) { | |
2388 | if (pHitMap[ii]) { | |
2389 | hm=pHitMap[ii]; | |
2390 | delete hm; | |
2391 | pHitMap[ii]=0; | |
2392 | } | |
2393 | } | |
2394 | ||
2395 | //TTree *TD=gAlice->TreeD(); | |
2396 | //Stat_t ndig=TD->GetEntries(); | |
2397 | //cout<<"number of digits "<<ndig<<endl; | |
2398 | TClonesArray *fDch; | |
2399 | for (int k=0;k<kNCH;k++) { | |
2400 | fDch= pRICH->DigitsAddress(k); | |
2401 | int ndigit=fDch->GetEntriesFast(); | |
2402 | printf ("Chamber %d digits %d \n",k,ndigit); | |
2403 | } | |
2404 | pRICH->ResetDigits(); | |
ddae0931 | 2405 | char hname[30]; |
2406 | sprintf(hname,"TreeD%d",nev); | |
33984590 | 2407 | gAlice->TreeD()->Write(hname,kOverwrite,0); |
2408 | ||
2409 | // reset tree | |
2410 | // gAlice->TreeD()->Reset(); | |
2e5f0f7b | 2411 | delete list; |
237c933d | 2412 | pAddress->Clear(); |
33984590 | 2413 | // gObjectTable->Print(); |
2e5f0f7b | 2414 | } |
ddae0931 | 2415 | |
237c933d | 2416 | AliRICH& AliRICH::operator=(const AliRICH& rhs) |
2417 | { | |
2418 | // Assignment operator | |
2419 | return *this; | |
2420 | ||
2421 | } | |
ddae0931 | 2422 | |
237c933d | 2423 | Int_t AliRICH::MakePadHits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res) |
2424 | { | |
2425 | // | |
2426 | // Calls the charge disintegration method of the current chamber and adds | |
2427 | // the simulated cluster to the root treee | |
2428 | // | |
2429 | Int_t clhits[kNCH]; | |
2430 | Float_t newclust[6][500]; | |
2431 | Int_t nnew; | |
2432 | ||
2433 | // | |
2434 | // Integrated pulse height on chamber | |
2435 | ||
2436 | clhits[0]=fNhits+1; | |
2437 | ||
2438 | ((AliRICHChamber*) (*fChambers)[idvol])->DisIntegration(eloss, xhit, yhit, nnew, newclust, res); | |
2439 | Int_t ic=0; | |
2440 | ||
2441 | // | |
2442 | // Add new clusters | |
2443 | for (Int_t i=0; i<nnew; i++) { | |
2444 | if (Int_t(newclust[3][i]) > 0) { | |
2445 | ic++; | |
2446 | // Cathode plane | |
2447 | clhits[1] = Int_t(newclust[5][i]); | |
2448 | // Cluster Charge | |
2449 | clhits[2] = Int_t(newclust[0][i]); | |
2450 | // Pad: ix | |
2451 | clhits[3] = Int_t(newclust[1][i]); | |
2452 | // Pad: iy | |
2453 | clhits[4] = Int_t(newclust[2][i]); | |
2454 | // Pad: charge | |
2455 | clhits[5] = Int_t(newclust[3][i]); | |
2456 | // Pad: chamber sector | |
2457 | clhits[6] = Int_t(newclust[4][i]); | |
2458 | ||
2459 | AddPadHit(clhits); | |
2460 | } | |
2461 | } | |
2462 | return nnew; | |
2463 | } | |
ddae0931 | 2464 |