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