]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICH.cxx
More improvements
[u/mrichter/AliRoot.git] / RICH / AliRICH.cxx
CommitLineData
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
2e5f0f7b 16#include <TArrayF.h>
543d5224 17#include <TGeometry.h>
116cbefd 18#include <TBRIK.h>
543d5224 19#include <TTUBE.h>
237c933d 20#include <TFile.h>
116cbefd 21#include <TNode.h>
22#include <TObjArray.h>
c60862bf 23#include <AliMagF.h>
fe4da5cc 24#include "AliRICH.h"
c021cb15 25#include "AliRICHParam.h"
a4622d0f 26#include "AliRICHRecHit1D.h"
c60862bf 27#include <AliRun.h>
28#include <AliRunDigitizer.h>
5d12ce38 29#include "AliMC.h"
30#include <TVirtualMC.h>
ddae0931 31
853634d3 32ClassImp(AliRICHhit)
c60862bf 33//__________________________________________________________________________________________________
34void AliRICHhit::Print(Option_t*)const
35{
36 Info("","chamber=%2i, PID=%9i, TID=%6i, eloss=%9.3f eV",fChamber,fPid,fTrack,fEloss*1e9);
37}//void AliRICHdigit::Print(Option_t *option)const
38//__________________________________________________________________________________________________
853634d3 39ClassImp(AliRICHdigit)
c60862bf 40//__________________________________________________________________________________________________
41void AliRICHdigit::Print(Option_t*)const
42{
43 Info("","ID=%6i, chamber=%2i, PadX=%3i, PadY=%3i, Qdc=%4i, TID1=%5i, TID2=%5i, TID3=%5i",
44 Id(),fChamber,fPadX,fPadY,fQdc,fTracks[0],fTracks[1],fTracks[2]);
45}//void AliRICHdigit::Print(Option_t *option)const
46//__________________________________________________________________________________________________
47
48ClassImp(AliRICH)
49//__________________________________________________________________________________________________
15d8311d 50// RICH manager class
c60862bf 51//BEGIN_HTML
15d8311d 52/*
53 <img src="gif/alirich.gif">
54*/
c60862bf 55//END_HTML
56//__________________________________________________________________________________________________
fe4da5cc 57AliRICH::AliRICH()
c60862bf 58 :AliDetector()
dfb4e77d 59{//Default ctor should not contain any new operators
c60862bf 60 fpParam =0;
543d5224 61 fChambers =0;
62//AliDetector ctor deals with Hits and Digits
c60862bf 63 fSdigits =0; fNsdigits =0;
64 fDigitsNew =0; for(int i=0;i<kNCH;i++) fNdigitsNew[i] =0;
65 fClusters =0; for(int i=0;i<kNCH;i++) fNclusters[i]=0;
66
67 fCerenkovs =0; fNcerenkovs =0;
68 fSpecials =0; fNspecials =0;
69 fDchambers =0; for(int i=0;i<kNCH;i++) fNdch[i]=0;
543d5224 70 fRawClusters=0; for(int i=0;i<kNCH;i++) fNrawch[i]=0;
c60862bf 71 fRecHits1D =0; for(int i=0;i<kNCH;i++) fNrechits1D[i]=0;
543d5224 72 fCkovNumber=fFreonProd=0;
15d8311d 73}//AliRICH::AliRICH()
c021cb15 74//__________________________________________________________________________________________________
fe4da5cc 75AliRICH::AliRICH(const char *name, const char *title)
dfb4e77d 76 :AliDetector(name,title)
77{//Named ctor
78 if(GetDebug())Info("named ctor","Start.");
c60862bf 79 fpParam = new AliRICHParam;
80 fChambers = 0; CreateChambers();
543d5224 81//AliDetector ctor deals with Hits and Digits (reset them to 0, does not create them)
5d12ce38 82 fHits= 0; CreateHits(); gAlice->GetMCApp()->AddHitList(fHits);
c60862bf 83 fSdigits= 0;
84 fDigitsNew= 0;
85 fClusters= 0;
86
5d12ce38 87 fCerenkovs= 0; CreateCerenkovsOld(); gAlice->GetMCApp()->AddHitList(fCerenkovs);
c60862bf 88 fSpecials= 0; CreateSpecialsOld();
89 fDchambers= 0; //CreateDigitsOld();
90 fRawClusters=0; //CreateRawClustersOld();
91 fRecHits1D= 0; //CreateRecos1Old();
c60862bf 92
93 fCkovNumber=fFreonProd=0;
dfb4e77d 94 if(GetDebug())Info("named ctor","Stop.");
95}//AliRICH::AliRICH(const char *name, const char *title)
c021cb15 96//__________________________________________________________________________________________________
fe4da5cc 97AliRICH::~AliRICH()
dfb4e77d 98{//dtor
99 if(GetDebug()) Info("dtor","Start.");
237c933d 100
c60862bf 101 if(fpParam) delete fpParam;
102 if(fChambers) delete fChambers;
103
104 if(fHits) delete fHits;
105 if(fSdigits) delete fSdigits;
106 if(fDigits) delete fDigits;
107 if(fDigitsNew) {fDigitsNew->Delete(); delete fDigitsNew;}
108 if(fClusters) {fClusters->Delete(); delete fClusters;}
109
110 if(fCerenkovs) delete fCerenkovs;
111 if(fSpecials) delete fSpecials;
112 if(fDchambers) {fDchambers->Delete(); delete fDchambers;}
113 if(fRawClusters) {fRawClusters->Delete(); delete fRawClusters;}
114 if(fRecHits1D) {fRecHits1D->Delete(); delete fRecHits1D;}
dfb4e77d 115 if(GetDebug()) Info("dtor","Stop.");
116}//AliRICH::~AliRICH()
c021cb15 117//__________________________________________________________________________________________________
3ea9cb08 118void AliRICH::Hits2SDigits()
c60862bf 119{//Create a list of sdigits corresponding to list of hits. Every hit generates one or more sdigits.
3ea9cb08 120 if(GetDebug()) Info("Hit2SDigits","Start.");
543d5224 121 GetLoader()->LoadHits();
853634d3 122
543d5224 123 for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++){//events loop
124 gAlice->GetRunLoader()->GetEvent(iEventN);
125
def88ef1 126 if(!GetLoader()->TreeS()) GetLoader()->MakeTree("S");
127 MakeBranch("S");
128
129 ResetSdigits(); ResetSpecialsOld();
543d5224 130 for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
131 GetLoader()->TreeH()->GetEntry(iPrimN);
132 for(Int_t i=0;i<Specials()->GetEntries();i++){//specials loop
133 Int_t padx= ((AliRICHSDigit*)Specials()->At(i))->PadX();
134 Int_t pady= ((AliRICHSDigit*)Specials()->At(i))->PadY();
135 Int_t qdc= ((AliRICHSDigit*)Specials()->At(i))->QPad();
136 Int_t hitN= ((AliRICHSDigit*)Specials()->At(i))->HitNumber()-1;//!!! important -1
137 Int_t chamber=((AliRICHhit*)Hits()->At(hitN))->C();
138 Int_t track=((AliRICHhit*)Hits()->At(hitN))->GetTrack();
139 AddSdigit(chamber,padx+Param()->NpadsX()/2,pady+Param()->NpadsY()/2,qdc,track);
140 }//specials loop
141 }//prims loop
142 GetLoader()->TreeS()->Fill();
143 GetLoader()->WriteSDigits("OVERWRITE");
144 if(GetDebug()) Info("Hit2SDigits","Event %i processed.",iEventN);
145 }//events loop
146 GetLoader()->UnloadHits(); GetLoader()->UnloadSDigits();
147 ResetHits(); ResetSdigits();
853634d3 148 if(GetDebug()) Info("Hit2SDigits","Stop.");
c021cb15 149}//void AliRICH::Hits2SDigits()
150//__________________________________________________________________________________________________
dfb4e77d 151void AliRICH::SDigits2Digits()
152{//Generate digits from sdigits.
153 if(GetDebug()) Info("SDigits2Digits","Start.");
543d5224 154
155 GetLoader()->LoadSDigits();
156
157 for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++){//events loop
158 gAlice->GetRunLoader()->GetEvent(iEventN);
c021cb15 159
def88ef1 160 if(!GetLoader()->TreeD()) GetLoader()->MakeTree("D"); MakeBranch("D"); //create TreeD with RICH branches
543d5224 161 ResetSdigits();ResetDigitsOld();//reset lists of sdigits and digits
162 GetLoader()->TreeS()->GetEntry(0);
163 Sdigits()->Sort();
164
165 Int_t kBad=-101;
166
167 Int_t tr[3],q[3],dig[5]; for(Int_t i=0;i<3;i++) tr[i]=q[i]=kBad; for(Int_t i=0;i<5;i++) dig[i]=kBad;
168 Int_t chamber=kBad,id=kBad,iNdigitsPerPad=kBad;//how many sdigits for a given pad
169
170 for(Int_t i=0;i<Sdigits()->GetEntries();i++){//sdigits loop (sorted)
171 AliRICHdigit *pSdig=(AliRICHdigit*)Sdigits()->At(i);
172 if(pSdig->Id()==id){//still the same pad
173 iNdigitsPerPad++;
174 dig[2]+=pSdig->Qdc();//sum up qdc
175 if(iNdigitsPerPad<=3)
176 tr[iNdigitsPerPad-1]=pSdig->T(0);
177 else
178 Info("","More then 3 sdigits for the given pad");
179 }else{//new pad, add the pevious one
180 if(id!=kBad) AddDigitOld(chamber,tr,q,dig);
181 chamber=pSdig->C();dig[0]=pSdig->X();dig[1]=pSdig->Y();dig[2]=pSdig->Qdc();tr[0]=pSdig->T(0);id=pSdig->Id();
182 iNdigitsPerPad=1;tr[1]=tr[2]=kBad;
183 }
184 }//sdigits loop (sorted)
def88ef1 185 if(Sdigits()->GetEntries()) AddDigitOld(chamber,tr,q,dig);//add the last digit
543d5224 186
187 GetLoader()->TreeD()->Fill();
188 GetLoader()->WriteDigits("OVERWRITE");
189 if(GetDebug()) Info("SDigits2Digits","Event %i processed.",iEventN);
190 }//events loop
191 GetLoader()->UnloadSDigits(); GetLoader()->UnloadDigits();
192 ResetSdigits(); ResetDigitsOld();
dfb4e77d 193 if(GetDebug()) Info("SDigits2Digits","Stop.");
194}//void AliRICH::SDigits2Digits()
c021cb15 195//__________________________________________________________________________________________________
34ead2dd 196void AliRICH::Digits2Reco()
c60862bf 197{//Generate clusters from digits then generate recos from clusters or digits
198 if(GetDebug()) Info("Digits2reco","Start.");
34ead2dd 199
dfb4e77d 200}//void AliRICH::Digits2Reco()
c021cb15 201//__________________________________________________________________________________________________
a4622d0f 202void AliRICH::AddRecHit1D(Int_t id, Float_t *rechit, Float_t *photons, Int_t *padsx, Int_t* padsy)
dfb4e77d 203{// Add a RICH reconstructed hit to the list
a4622d0f 204
2682e810 205 TClonesArray &lrec1D = *((TClonesArray*)fRecHits1D->At(id));
a4622d0f 206 new(lrec1D[fNrechits1D[id]++]) AliRICHRecHit1D(id,rechit,photons,padsx,padsy);
207}
a4622d0f 208//_____________________________________________________________________________
dfb4e77d 209void AliRICH::BuildGeometry()
3ea9cb08 210{//Builds a TNode geometry for event display
dfb4e77d 211 if(GetDebug())Info("BuildGeometry","Start.");
237c933d 212
3ea9cb08 213 TNode *node, *subnode, *top;
214 top=gAlice->GetGeometry()->GetNode("alice");
c24372d0 215
3ea9cb08 216 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
53d98323 217
c60862bf 218 Float_t wid=Param()->SectorSizeX();
219 Float_t len=Param()->SectorSizeY();
3ea9cb08 220 new TBRIK("PHOTO","PHOTO","void",wid/2,0.1,len/2);
221
c021cb15 222 for(int i=1;i<=kNCH;i++){
237c933d 223 top->cd();
c021cb15 224 node = new TNode(Form("RICH%i",i),Form("RICH%i",i),"S_RICH",C(i)->X(),C(i)->Y(),C(i)->Z(),C(i)->RotMatrixName());
3ea9cb08 225 node->SetLineColor(kRed);
91975aa2 226 node->cd();
c60862bf 227 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+Param()->DeadZone(),5,len/2+Param()->DeadZone()/2,"");
91975aa2 228 subnode->SetLineColor(kGreen);
229 fNodes->Add(subnode);
c60862bf 230 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,len/2+Param()->DeadZone()/2,"");
91975aa2 231 subnode->SetLineColor(kGreen);
232 fNodes->Add(subnode);
c60862bf 233 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-Param()->DeadZone(),5,len/2+Param()->DeadZone()/2,"");
91975aa2 234 subnode->SetLineColor(kGreen);
235 fNodes->Add(subnode);
c60862bf 236 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+Param()->DeadZone(),5,-len/2-Param()->DeadZone()/2,"");
91975aa2 237 subnode->SetLineColor(kGreen);
238 fNodes->Add(subnode);
c60862bf 239 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-len/2 -Param()->DeadZone()/2,"");
91975aa2 240 subnode->SetLineColor(kGreen);
241 fNodes->Add(subnode);
c60862bf 242 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-Param()->DeadZone(),5,-len/2 - Param()->DeadZone()/2,"");
91975aa2 243 subnode->SetLineColor(kGreen);
244 fNodes->Add(subnode);
237c933d 245 fNodes->Add(node);
3ea9cb08 246 }
dfb4e77d 247 if(GetDebug())Info("BuildGeometry","Stop.");
248}//void AliRICH::BuildGeometry()
c60862bf 249
250static Int_t kCSI=6;
251static Int_t kGAP=9;
dfb4e77d 252//______________________________________________________________________________
452a64c6 253void AliRICH::CreateMaterials()
254{
255 //
256 // *** DEFINITION OF AVAILABLE RICH MATERIALS ***
257 // ORIGIN : NICK VAN EIJNDHOVEN
258 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
259 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
260 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
261 //
452a64c6 262 Int_t i;
452a64c6 263
452a64c6 264 //Photons energy intervals
265 Float_t ppckov[26];
266 for (i=0;i<26;i++)
267 {
268 ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9;
452a64c6 269 }
270
271
272 //Refraction index for quarz
273 Float_t rIndexQuarz[26];
274 Float_t e1= 10.666;
275 Float_t e2= 18.125;
276 Float_t f1= 46.411;
277 Float_t f2= 228.71;
278 for (i=0;i<26;i++)
279 {
280 Float_t ene=ppckov[i]*1e9;
281 Float_t a=f1/(e1*e1 - ene*ene);
282 Float_t b=f2/(e2*e2 - ene*ene);
283 rIndexQuarz[i] = TMath::Sqrt(1. + a + b );
452a64c6 284 }
285
286 //Refraction index for opaque quarz, methane and grid
287 Float_t rIndexOpaqueQuarz[26];
288 Float_t rIndexMethane[26];
289 Float_t rIndexGrid[26];
290 for (i=0;i<26;i++)
291 {
292 rIndexOpaqueQuarz[i]=1;
293 rIndexMethane[i]=1.000444;
294 rIndexGrid[i]=1;
452a64c6 295 }
296
297 //Absorption index for freon
298 Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987,
299 179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196,
300 7.069031, 4.461292, 2.028366, 1.293013, .577267, .40746, .334964, 0., 0., 0.};
301
452a64c6 302
303 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,
304 19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627,
305 .192, .1497, .10857};
306
307 //Absorption index for methane
308 Float_t abscoMethane[26];
309 for (i=0;i<26;i++)
310 {
311 abscoMethane[i]=AbsoCH4(ppckov[i]*1e9);
452a64c6 312 }
313
314 //Absorption index for opaque quarz, csi and grid, efficiency for all and grid
315 Float_t abscoOpaqueQuarz[26];
316 Float_t abscoCsI[26];
317 Float_t abscoGrid[26];
318 Float_t efficAll[26];
319 Float_t efficGrid[26];
320 for (i=0;i<26;i++)
321 {
322 abscoOpaqueQuarz[i]=1e-5;
323 abscoCsI[i]=1e-4;
324 abscoGrid[i]=1e-4;
325 efficAll[i]=1;
326 efficGrid[i]=1;
452a64c6 327 }
328
329 //Efficiency for csi
330
331 Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
332 0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999,
333 0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592,
334 0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987};
335
336
337
338 //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND
339 //UNPOLARIZED PHOTONS
340
341 for (i=0;i<26;i++)
342 {
343 efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0));
452a64c6 344 }
345
346 /*******************************************End of rich_media.f***************************************/
452a64c6 347
c60862bf 348 Float_t rIndexFreon[26];
452a64c6 349
452a64c6 350
452a64c6 351 // --- Photon energy (GeV)
352 // --- Refraction indexes
353 for (i = 0; i < 26; ++i) {
354 rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
355 //rIndexFreon[i] = 1;
452a64c6 356 }
357
c60862bf 358
359 Float_t a=0,z=0,den=0,radl=0,absl=0;
360 Float_t tmaxfd=-10.0, deemax=-0.2, stemax=-0.1,epsil=0.001, stmin=-0.001;
361 Int_t isxfld = gAlice->Field()->Integ();
362 Float_t sxmgmx = gAlice->Field()->Max();
452a64c6 363
c60862bf 364 AliMaterial( 1, "Air $",a=14.61,z=7.3, den=0.001205,radl=30420.0,absl=67500);//(Air)
365 AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
452a64c6 366
c60862bf 367 AliMaterial( 6, "HON", a=12.01,z=6.0, den=0.1, radl=18.8, absl=0); //(C)-equivalent radl
368 AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
369
370 AliMaterial(16, "CSI", a=12.01,z=6.0, den=0.1, radl=18.8, absl=0); //CsI-radl equivalent
371 AliMedium(kCSI, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
372
373 AliMaterial(11, "GRI", a=63.54,z=29.0,den=8.96, radl=1.43, absl=0); //anode grid (Cu)
374 AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
375
376 AliMaterial(50, "ALUM", a=26.98,z=13.0,den=2.7, radl=8.9, absl=0); //aluminium sheet (Al)
377 AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
378
379 AliMaterial(31, "COPPER$", a=63.54,z=29.0,den=8.96, radl=1.4, absl=0); //(Cu)
380 AliMedium(12, "PCB_COPPER", 31, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
381
382 Float_t aQuartz[2]={28.09,16.0}; Float_t zQuartz[2]={14.00, 8.0}; Float_t wmatQuartz[2]={1,2};
383 AliMixture (20, "QUA",aQuartz,zQuartz,den=2.64,-2, wmatQuartz);//Quarz (SiO2) - trasnparent
384 AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
385
386 AliMixture (21, "QUAO",aQuartz, zQuartz, den=2.64, -2, wmatQuartz);//Quarz (SiO2) - opaque
387 AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
388
389 Float_t aFreon[2]={12,19}; Float_t zFreon[2]={6,9}; Float_t wmatFreon[2]={6,14};
390 AliMixture (30, "FRE",aFreon,zFreon,den=1.7,-2,wmatFreon);//Freon (C6F14)
391 AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
392
393 Float_t aMethane[2]={12.01,1}; Float_t zMethane[2]={6,1}; Float_t wmatMethane[2]={1,4};
394 AliMixture (40, "MET", aMethane, zMethane, den=7.17e-4,-2, wmatMethane);//methane (CH4)
395 AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
396
397 AliMixture (41, "METG", aMethane, zMethane, den=7.17e-4, -2, wmatMethane);
398 AliMedium(kGAP, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, 0.1, -deemax, epsil, -stmin);
399
400 Float_t aGlass[5]={12.01, 28.09, 16., 10.8, 23.};
401 Float_t zGlass[5]={ 6., 14., 8., 5., 11.};
402 Float_t wGlass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
403 AliMixture (32, "GLASS",aGlass, zGlass, den=1.74, 5, wGlass);//Glass 50%C+10.5%Si+35.5%O+3% + 1%
404 AliMedium(11, "GLASS", 32, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
405
406 Int_t *idtmed = fIdtmed->GetArray()-999;
407 gMC->SetCerenkov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
408 gMC->SetCerenkov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
409 gMC->SetCerenkov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll, rIndexQuarz);
410 gMC->SetCerenkov(idtmed[1003], 26, ppckov, abscoFreon, efficAll, rIndexFreon);
411 gMC->SetCerenkov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
412 gMC->SetCerenkov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane);
413 gMC->SetCerenkov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
414 gMC->SetCerenkov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
415 gMC->SetCerenkov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
416 gMC->SetCerenkov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
417 gMC->SetCerenkov(idtmed[1010], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
418}//void AliRICH::CreateMaterials()
c021cb15 419//__________________________________________________________________________________________________
452a64c6 420Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
421{
422
423 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
424
425 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,
426 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,
427 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
452a64c6 428 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
429 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
430 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
431 1.72,1.53};
452a64c6 432 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
433 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
434 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
435 1.714,1.498};
436 Float_t xe=ene;
437 Int_t j=Int_t(xe*10)-49;
438 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
439 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
440
441 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
442 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
443
444 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
445 Float_t tanin=sinin/pdoti;
446
447 Float_t c1=cn*cn-ck*ck-sinin*sinin;
448 Float_t c2=4*cn*cn*ck*ck;
449 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
450 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
451
452 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
453 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
454
455
456 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
457 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
458
459 Float_t sigraf=18.;
460 Float_t lamb=1240/ene;
461 Float_t fresn;
462
463 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
464
465 if(pola)
466 {
467 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
468 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
469 }
470 else
471 fresn=0.5*(rp+rs);
472
473 fresn = fresn*rO;
474 return(fresn);
c021cb15 475}//Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
476//__________________________________________________________________________________________________
452a64c6 477Float_t AliRICH::AbsoCH4(Float_t x)
478{
479
480 //KLOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31)
481 Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.}; //MB X 10^22
482 //Float_t wl[9] = {153.,152.,151.,150.,149.,148.,147.,146.,145};
483 Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55};
484 const Float_t kLosch=2.686763E19; // LOSCHMIDT NUMBER IN CM-3
485 const Float_t kIgas1=100, kIgas2=0, kOxy=10., kWater=5., kPressure=750.,kTemperature=283.;
486 Float_t pn=kPressure/760.;
487 Float_t tn=kTemperature/273.16;
488
489
490// ------- METHANE CROSS SECTION -----------------
491// ASTROPH. J. 214, L47 (1978)
492
493 Float_t sm=0;
494 if (x<7.75)
495 sm=.06e-22;
496
497 if(x>=7.75 && x<=8.1)
498 {
499 Float_t c0=-1.655279e-1;
500 Float_t c1=6.307392e-2;
501 Float_t c2=-8.011441e-3;
502 Float_t c3=3.392126e-4;
503 sm=(c0+c1*x+c2*x*x+c3*x*x*x)*1.e-18;
504 }
505
506 if (x> 8.1)
507 {
508 Int_t j=0;
509 while (x<=em[j] && x>=em[j+1])
510 {
511 j++;
512 Float_t a=(sch4[j+1]-sch4[j])/(em[j+1]-em[j]);
513 sm=(sch4[j]+a*(x-em[j]))*1e-22;
514 }
515 }
516
517 Float_t dm=(kIgas1/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
518 Float_t abslm=1./sm/dm;
519
520// ------- ISOBUTHANE CROSS SECTION --------------
521// i-C4H10 (ai) abs. length from curves in
522// Lu-McDonald paper for BARI RICH workshop .
523// -----------------------------------------------------------
524
525 Float_t ai;
526 Float_t absli;
527 if (kIgas2 != 0)
528 {
529 if (x<7.25)
530 ai=100000000.;
531
532 if(x>=7.25 && x<7.375)
533 ai=24.3;
534
535 if(x>=7.375)
536 ai=.0000000001;
537
538 Float_t si = 1./(ai*kLosch*273.16/293.); // ISOB. CRO.SEC.IN CM2
539 Float_t di=(kIgas2/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
540 absli =1./si/di;
541 }
542 else
543 absli=1.e18;
544// ---------------------------------------------------------
545//
546// transmission of O2
547//
548// y= path in cm, x=energy in eV
549// so= cross section for UV absorption in cm2
550// do= O2 molecular density in cm-3
551// ---------------------------------------------------------
552
553 Float_t abslo;
554 Float_t so=0;
555 if(x>=6.0)
556 {
557 if(x>=6.0 && x<6.5)
558 {
559 so=3.392709e-13 * TMath::Exp(2.864104 *x);
560 so=so*1e-18;
561 }
562
563 if(x>=6.5 && x<7.0)
564 {
565 so=2.910039e-34 * TMath::Exp(10.3337*x);
566 so=so*1e-18;
567 }
568
569
570 if (x>=7.0)
571 {
572 Float_t a0=-73770.76;
573 Float_t a1=46190.69;
574 Float_t a2=-11475.44;
575 Float_t a3=1412.611;
576 Float_t a4=-86.07027;
577 Float_t a5=2.074234;
578 so= a0+(a1*x)+(a2*x*x)+(a3*x*x*x)+(a4*x*x*x*x)+(a5*x*x*x*x*x);
579 so=so*1e-18;
580 }
581
582 Float_t dox=(kOxy/1e6)*kLosch*pn/tn;
583 abslo=1./so/dox;
584 }
585 else
586 abslo=1.e18;
587// ---------------------------------------------------------
588//
589// transmission of H2O
590//
591// y= path in cm, x=energy in eV
592// sw= cross section for UV absorption in cm2
593// dw= H2O molecular density in cm-3
594// ---------------------------------------------------------
595
596 Float_t abslw;
597
dfb4e77d 598 Float_t b0=29231.65;
599 Float_t b1=-15807.74;
600 Float_t b2=3192.926;
601 Float_t b3=-285.4809;
602 Float_t b4=9.533944;
452a64c6 603
dfb4e77d 604 if(x>6.75)
605 {
606 Float_t sw= b0+(b1*x)+(b2*x*x)+(b3*x*x*x)+(b4*x*x*x*x);
607 sw=sw*1e-18;
608 Float_t dw=(kWater/1e6)*kLosch*pn/tn;
609 abslw=1./sw/dw;
610 }
611 else
612 abslw=1.e18;
613
614// ---------------------------------------------------------
452a64c6 615
dfb4e77d 616 Float_t alength=1./(1./abslm+1./absli+1./abslo+1./abslw);
617 return (alength);
618}
c021cb15 619//__________________________________________________________________________________________________
dfb4e77d 620void AliRICH::MakeBranch(Option_t* option)
621{//Create Tree branches for the RICH.
622 if(GetDebug())Info("MakeBranch","Start with option= %s.",option);
623
624 const Int_t kBufferSize = 4000;
dfb4e77d 625
dfb4e77d 626 const char *cH = strstr(option,"H");
627 const char *cD = strstr(option,"D");
628 const char *cR = strstr(option,"R");
629 const char *cS = strstr(option,"S");
630
c60862bf 631 if(cH&&TreeH()){//H
632 CreateHits(); //branch will be created in AliDetector::MakeBranch
633 CreateCerenkovsOld(); MakeBranchInTree(TreeH(),"RICHCerenkov", &fCerenkovs, kBufferSize,0);
634 CreateSpecialsOld(); MakeBranchInTree(TreeH(),"RICHSpecials", &fSpecials,kBufferSize,0);
635 }//H
dfb4e77d 636 AliDetector::MakeBranch(option);//this is after cH because we need to guarantee that fHits array is created
637
c60862bf 638 if(cS&&fLoader->TreeS()){//S
639 CreateSdigits(); MakeBranchInTree(fLoader->TreeS(),"RICH",&fSdigits,kBufferSize,0) ;
640 }//S
dfb4e77d 641
c60862bf 642 if(cD&&fLoader->TreeD()){//D
543d5224 643 CreateDigits();
c60862bf 644 CreateDigitsOld();
543d5224 645 for(int i=0;i<kNCH;i++){
c60862bf 646 MakeBranchInTree(fLoader->TreeD(),Form("%sDigits%d",GetName(),i+1),&((*fDchambers)[i]),kBufferSize,0);
543d5224 647 MakeBranchInTree(fLoader->TreeD(),Form("%s%d",GetName(),i+1),&((*fDigitsNew)[i]),kBufferSize,0);
648 }
c60862bf 649 }//D
650
651 if(cR&&fLoader->TreeR()){//R
652 CreateRawClustersOld();
653 for(int i=0; i<kNCH ;i++)
654 MakeBranchInTree(fLoader->TreeR(),Form("%sRawClusters%d",GetName(),i+1), &((*fRawClusters)[i]), kBufferSize, 0);
655
656 CreateRecos1Old();
657 for(int i=0; i<kNCH ;i++)
394c3f6d 658 MakeBranchInTree(fLoader->TreeR(),Form("%sRecHits1D%d",GetName(),i+1),&((*fRecHits1D)[i]),kBufferSize,0);
c60862bf 659 }//R
dfb4e77d 660 if(GetDebug())Info("MakeBranch","Stop.");
c021cb15 661}//void AliRICH::MakeBranch(Option_t* option)
c60862bf 662//__________________________________________________________________________________________________
dfb4e77d 663void AliRICH::SetTreeAddress()
664{//Set branch address for the Hits and Digits Tree.
665 if(GetDebug())Info("SetTreeAddress","Start.");
c60862bf 666
dfb4e77d 667 TBranch *branch;
dfb4e77d 668
c60862bf 669 if(fLoader->TreeH()){//H
853634d3 670 if(GetDebug())Info("SetTreeAddress","tree H is requested.");
c60862bf 671 CreateHits();//branch map will be in AliDetector::SetTreeAddress
672 branch=fLoader->TreeH()->GetBranch("RICHCerenkov"); if(branch){CreateCerenkovsOld(); branch->SetAddress(&fCerenkovs);}
673 branch=fLoader->TreeH()->GetBranch("RICHSpecials"); if(branch){CreateSpecialsOld(); branch->SetAddress(&fSpecials);}
674 }//H
c021cb15 675 AliDetector::SetTreeAddress();//this is after TreeH because we need to guarantee that fHits array is created
676
c60862bf 677 if(fLoader->TreeS()){//S
853634d3 678 if(GetDebug())Info("SetTreeAddress","tree S is requested.");
c60862bf 679 branch=fLoader->TreeS()->GetBranch(GetName()); if(branch){CreateSdigits(); branch->SetAddress(&fSdigits);}
680 }//S
dfb4e77d 681
c60862bf 682 if(fLoader->TreeD()){//D
853634d3 683 if(GetDebug())Info("SetTreeAddress","tree D is requested.");
c60862bf 684 for(int i=0;i<kNCH;i++){
685 branch=fLoader->TreeD()->GetBranch(Form("%s%d",GetName(),i+1));
686 if(branch){CreateDigits(); branch->SetAddress(&((*fDigitsNew)[i]));}
dfb4e77d 687
c60862bf 688 branch=fLoader->TreeD()->GetBranch(Form("%sDigits%d",GetName(),i+1));
689 if(branch){CreateDigitsOld(); branch->SetAddress(&((*fDchambers)[i]));}
690 }//for
691 }//D
dfb4e77d 692
c60862bf 693 if(fLoader->TreeR()){//R
853634d3 694 if(GetDebug())Info("SetTreeAddress","tree R is requested.");
695
c60862bf 696 for(int i=0;i<kNCH;i++){
697 branch=fLoader->TreeR()->GetBranch(Form("%sClusters%d" ,GetName(),i+1));
698 if(branch){CreateClusters(); branch->SetAddress(&((*fRawClusters)[i]));}
dfb4e77d 699 }
c60862bf 700
701 for(int i=0;i<kNCH;i++) {
702 branch=fLoader->TreeR()->GetBranch(Form("%sRawClusters%d" ,GetName(),i+1));
703 if(branch){CreateRawClustersOld(); branch->SetAddress(&((*fRawClusters)[i]));}
dfb4e77d 704
c60862bf 705 branch=fLoader->TreeR()->GetBranch(Form("%sRecHits1D%d",GetName(),i+1));
706 if(branch){CreateRecos1Old(); branch->SetAddress(&((*fRecHits1D)[i]));}
c60862bf 707 }
708 }//R
dfb4e77d 709 if(GetDebug())Info("SetTreeAddress","Stop.");
710}//void AliRICH::SetTreeAddress()
c021cb15 711//__________________________________________________________________________________________________
dfb4e77d 712void AliRICH::Print(Option_t *option)const
713{
714 TObject::Print(option);
c60862bf 715 Param()->Dump();
c021cb15 716 fChambers->Print(option);
dfb4e77d 717}//void AliRICH::Print(Option_t *option)const
c021cb15 718//__________________________________________________________________________________________________
3ea9cb08 719void AliRICH::CreateGeometry()
720{//Creates detailed geometry simulation (currently GEANT volumes tree)
721 if(GetDebug())Info("CreateGeometry","Start.");
3ea9cb08 722//Opaque quartz thickness
723 Float_t oqua_thickness = .5;
724//CsI dimensions
c60862bf 725 Float_t pcX=Param()->PcSizeX();
726 Float_t pcY=Param()->PcSizeY();
3ea9cb08 727
728 Int_t *idtmed = fIdtmed->GetArray()-999;
729
730 Int_t i;
731 Float_t zs;
732 Int_t idrotm[1099];
733 Float_t par[3];
734
735//External aluminium box
c60862bf 736 par[0]=68.8*kcm;par[1]=13*kcm;par[2]=70.86*kcm; gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
3ea9cb08 737//Air
c60862bf 738 par[0]=66.3; par[1] = 13; par[2] = 68.35; gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
3ea9cb08 739//Air 2 (cutting the lower part of the box)
c60862bf 740 par[0]=1.25; par[1] = 3; par[2] = 70.86; gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
3ea9cb08 741//Air 3 (cutting the lower part of the box)
c60862bf 742 par[0]=66.3; par[1] = 3; par[2] = 1.2505; gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
3ea9cb08 743//Honeycomb
c60862bf 744 par[0]=66.3;par[1]=0.188; par[2] = 68.35; gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
3ea9cb08 745//Aluminium sheet
c60862bf 746 par[0]=66.3;par[1]=0.025;par[2]=68.35; gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
3ea9cb08 747 //par[0] = 66.5; par[1] = .025; par[2] = 63.1;
3ea9cb08 748//Quartz
c60862bf 749 par[0]=Param()->QuartzWidth()/2;par[1]=Param()->QuartzThickness()/2;par[2]=Param()->QuartzLength()/2;
3ea9cb08 750 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
751//Spacers (cylinders)
c60862bf 752 par[0]=0.;par[1]=.5;par[2]=Param()->FreonThickness()/2; gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
3ea9cb08 753//Feet (freon slabs supports)
c60862bf 754 par[0] = .7; par[1] = .3; par[2] = 1.9; gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
3ea9cb08 755//Opaque quartz
c60862bf 756 par[0]=Param()->QuartzWidth()/2;par[1]= .2;par[2]=Param()->QuartzLength()/2;
3ea9cb08 757 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
758//Frame of opaque quartz
c60862bf 759 par[0]=Param()->OuterFreonWidth()/2;par[1]=Param()->FreonThickness()/2;par[2]=Param()->OuterFreonLength()/2;
3ea9cb08 760 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
c60862bf 761 par[0]=Param()->InnerFreonWidth()/2;par[1]=Param()->FreonThickness()/2;par[2]=Param()->InnerFreonLength()/2;
3ea9cb08 762 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
763//Freon
c60862bf 764 par[0]=Param()->OuterFreonWidth()/2 - oqua_thickness;
765 par[1]=Param()->FreonThickness()/2;
766 par[2]=Param()->OuterFreonLength()/2 - 2*oqua_thickness;
3ea9cb08 767 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
768
c60862bf 769 par[0]=Param()->InnerFreonWidth()/2 - oqua_thickness;
770 par[1]=Param()->FreonThickness()/2;
771 par[2]=Param()->InnerFreonLength()/2 - 2*oqua_thickness;
3ea9cb08 772 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
773//Methane
c60862bf 774 par[0]=pcX/2;par[1]=Param()->GapThickness()/2;par[2]=pcY/2; gMC->Gsvolu("META","BOX ",idtmed[1004], par, 3);
3ea9cb08 775//Methane gap
c60862bf 776 par[0]=pcX/2;par[1]=Param()->ProximityGapThickness()/2;par[2]=pcY/2;gMC->Gsvolu("GAP ","BOX ",(*fIdtmed)[kGAP],par,3);
777//CsI PC
778 par[0]=pcX/2;par[1]=.25;par[2]=pcY/2; gMC->Gsvolu("CSI ", "BOX ", (*fIdtmed)[kCSI], par, 3);
3ea9cb08 779//Anode grid
c60862bf 780 par[0] = 0.;par[1] = .001;par[2] = 20.; gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
3ea9cb08 781
782//Wire supports
783//Bar of metal
c60862bf 784 par[0]=pcX/2;par[1]=1.05;par[2]=1.05; gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
3ea9cb08 785//Ceramic pick up (base)
c60862bf 786 par[0]=pcX/2;par[1]= .25;par[2]=1.05; gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
3ea9cb08 787//Ceramic pick up (head)
c60862bf 788 par[0] = pcX/2;par[1] = .1;par[2] = .1; gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
3ea9cb08 789
790//Aluminium supports for methane and CsI
791//Short bar
c60862bf 792 par[0]=pcX/2;par[1]=Param()->GapThickness()/2 + .25; par[2] = (68.35 - pcY/2)/2;
3ea9cb08 793 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
794//Long bar
c60862bf 795 par[0]=(66.3 - pcX/2)/2;par[1]=Param()->GapThickness()/2+.25;par[2]=pcY/2+68.35-pcY/2;
3ea9cb08 796 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
797
798//Aluminium supports for freon
799//Short bar
c60862bf 800 par[0] = Param()->QuartzWidth()/2; par[1] = .3; par[2] = (68.35 - Param()->QuartzLength()/2)/2;
3ea9cb08 801 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
802//Long bar
c60862bf 803 par[0] = (66.3 - Param()->QuartzWidth()/2)/2; par[1] = .3;
804 par[2] = Param()->QuartzLength()/2 + 68.35 - Param()->QuartzLength()/2;
3ea9cb08 805 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
806//PCB backplane
c60862bf 807 par[0] = pcX/2;par[1] = .25; par[2] = pcY/4 -.5025; gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
3ea9cb08 808
809//Backplane supports
810//Aluminium slab
c60862bf 811 par[0] = 33.15;par[1] = 2;par[2] = 21.65; gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
3ea9cb08 812//Big hole
c60862bf 813 par[0] = 9.05; par[1] = 2; par[2] = 4.4625; gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
3ea9cb08 814//Small hole
c60862bf 815 par[0] = 5.7;par[1] = 2;par[2] = 4.4625; gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
3ea9cb08 816//Place holes inside backplane support
817 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
818 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
819 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
820 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
821 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
822 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
823 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
824 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
825 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
826 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
827 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
828 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
829 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
830 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
831 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
832 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
833//Place material inside RICH
834 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
c60862bf 835 gMC->Gspos("AIR2", 1, "RICH", 66.3 + 1.2505, 1.276-Param()->GapThickness()/2-Param()->QuartzThickness()-Param()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
836 gMC->Gspos("AIR2", 2, "RICH", -66.3 - 1.2505,1.276-Param()->GapThickness()/2-Param()->QuartzThickness()-Param()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
837 gMC->Gspos("AIR3", 1, "RICH", 0., 1.276-Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, -68.35 - 1.25, 0, "ONLY");
838 gMC->Gspos("AIR3", 2, "RICH", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 68.35 + 1.25, 0, "ONLY");
839 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
840 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
841 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
842 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
843 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
844 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
845 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
846 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
847 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
848 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
849 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
850 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .2, 0., 0, "ONLY");
3ea9cb08 851// Methane supports
c60862bf 852 gMC->Gspos("SMLG", 1, "SRIC", pcX/2 + (66.3 - pcX/2)/2, 1.276 + .25, 0., 0, "ONLY");
853 gMC->Gspos("SMLG", 2, "SRIC", - pcX/2 - (66.3 - pcX/2)/2, 1.276 + .25, 0., 0, "ONLY");
854 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, pcY/2 + (68.35 - pcY/2)/2, 0, "ONLY");
855 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - pcY/2 - (68.35 - pcY/2)/2, 0, "ONLY");
3ea9cb08 856//Freon supports
c60862bf 857 Float_t supp_y = 1.276 - Param()->GapThickness()/2- Param()->QuartzThickness() -Param()->FreonThickness() - .2 + .3; //y position of freon supports
858 gMC->Gspos("SFLG", 1, "SRIC", Param()->QuartzWidth()/2 + (66.3 - Param()->QuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
859 gMC->Gspos("SFLG", 2, "SRIC", - Param()->QuartzWidth()/2 - (66.3 - Param()->QuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
860 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, Param()->QuartzLength()/2 + (68.35 - Param()->QuartzLength()/2)/2, 0, "ONLY");
861 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - Param()->QuartzLength()/2 - (68.35 - Param()->QuartzLength()/2)/2, 0, "ONLY");
3ea9cb08 862 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
863//Place spacers
864 Int_t nspacers = 30;
865 for (i = 0; i < nspacers/3; i++) {
866 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
867 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
868 }
869 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
870 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
871 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
872 }
873 for (i = (nspacers*2)/3; i < nspacers; ++i) {
874 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
875 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
876 }
877 for (i = 0; i < nspacers/3; i++) {
878 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
879 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
880 }
881 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
882 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
883 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
884 }
885 for (i = (nspacers*2)/3; i < nspacers; ++i) {
886 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
887 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
888 }
889 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
890 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
c60862bf 891 gMC->Gspos("OQF1", 1, "SRIC", Param()->OuterFreonWidth()/2 + Param()->InnerFreonWidth()/2 + 2, 1.276 - Param()->GapThickness()/2- Param()->QuartzThickness() -Param()->FreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3)
892 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()/2, 0., 0, "ONLY"); //Original settings
893 gMC->Gspos("OQF1", 3, "SRIC", - (Param()->OuterFreonWidth()/2 + Param()->InnerFreonWidth()/2) - 2, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()/2, 0., 0, "ONLY"); //Original settings (-31.3)
894 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness()/2, 0., 0, "ONLY");
895 gMC->Gspos("GAP ", 1, "META", 0., Param()->GapThickness()/2 - Param()->ProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
3ea9cb08 896 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
c60862bf 897 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + Param()->GapThickness()/2 + .25, 0., 0, "ONLY");
3ea9cb08 898//Wire support placing
c60862bf 899 gMC->Gspos("WSG2", 1, "GAP ", 0., Param()->ProximityGapThickness()/2 - .1, 0., 0, "ONLY");
3ea9cb08 900 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
c60862bf 901 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + Param()->GapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
3ea9cb08 902//Backplane placing
c60862bf 903 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
904 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
905 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
906 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
907 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
908 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
3ea9cb08 909//PCB placing
c60862bf 910 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + Param()->GapThickness()/2 + .5 + 1.05, pcX/4 + .5025 + 2.5, 0, "ONLY");
911 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + Param()->GapThickness()/2 + .5 + 1.05, -pcX/4 - .5025 - 2.5, 0, "ONLY");
3ea9cb08 912
913//place chambers into mother volume ALIC
c021cb15 914 for(int i=1;i<=kNCH;i++){
3ea9cb08 915 AliMatrix(idrotm[1000+i],C(i)->ThetaXd(),C(i)->PhiXd(),
916 C(i)->ThetaYd(),C(i)->PhiYd(),
917 C(i)->ThetaZd(),C(i)->PhiZd());
c021cb15 918 gMC->Gspos("RICH",i,"ALIC",C(i)->X(),C(i)->Y(),C(i)->Z(),idrotm[1000+i], "ONLY");
3ea9cb08 919 }
920
921 if(GetDebug())Info("CreateGeometry","Stop.");
922}//void AliRICH::CreateGeometry()
c60862bf 923//__________________________________________________________________________________________________
3ea9cb08 924void AliRICH::CreateChambers()
543d5224 925{//create all RICH Chambers on each call. Previous chambers deleted
926 if(fChambers) delete fChambers;
c60862bf 927 if(GetDebug())Info("CreateChambers","Creating RICH chambers.");
3ea9cb08 928 fChambers=new TObjArray(kNCH);
929 fChambers->SetOwner();
c60862bf 930 for(int i=0;i<kNCH;i++) fChambers->AddAt(new AliRICHChamber(i+1,Param()),i);
3ea9cb08 931}//void AliRICH::CreateChambers()
c021cb15 932//__________________________________________________________________________________________________
c60862bf 933void AliRICH::GenerateFeedbacks(Int_t iChamber,Float_t eloss)
c021cb15 934{// Generate FeedBack photons
935 Int_t j;
936 Float_t cthf, phif, enfp = 0, sthf;
937 Float_t e1[3], e2[3], e3[3];
938 Float_t vmod, uswop;
939 Float_t dir[3], phi;
940 Float_t pol[3], mom[4];
941//Determine number of feedback photons
942 TLorentzVector x4;
c60862bf 943 gMC->TrackPosition(x4);
944 Float_t charge=Param()->TotalCharge(gMC->TrackPid(),eloss,C(iChamber)->G2Ly(x4));//Total Charge
c021cb15 945 Int_t iNphotons=gMC->GetRandom()->Poisson(Param()->AlphaFeedback()*charge);
946 Info("GenerateFeedbacks","N photons=%i",iNphotons);
947//Generate photons
948 for(Int_t i=0;i<iNphotons;i++){
949 Double_t ranf[2];
950 gMC->GetRandom()->RndmArray(2,ranf); //Sample direction
951 cthf=ranf[0]*2-1.0;
952 if(cthf<0) continue;
953 sthf = TMath::Sqrt((1 - cthf) * (1 + cthf));
954 phif = ranf[1] * 2 * TMath::Pi();
955
956 if(Double_t randomNumber=gMC->GetRandom()->Rndm()<=0.57)
957 enfp = 7.5e-9;
958 else if(randomNumber<=0.7)
959 enfp = 6.4e-9;
960 else
961 enfp = 7.9e-9;
962
963
964 dir[0] = sthf * TMath::Sin(phif); dir[1] = cthf; dir[2] = sthf * TMath::Cos(phif);
965 gMC->Gdtom(dir, mom, 2);
966 mom[0]*=enfp; mom[1]*=enfp; mom[2]*=enfp;
967 mom[3] = TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
968
969 // Polarisation
970 e1[0]= 0; e1[1]=-dir[2]; e1[2]= dir[1];
971 e2[0]=-dir[1]; e2[1]= dir[0]; e2[2]= 0;
972 e3[0]= dir[1]; e3[1]= 0; e3[2]=-dir[0];
973
974 vmod=0;
975 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
976 if (!vmod) for(j=0;j<3;j++) {
977 uswop=e1[j];
978 e1[j]=e3[j];
979 e3[j]=uswop;
980 }
981 vmod=0;
982 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
983 if (!vmod) for(j=0;j<3;j++) {
984 uswop=e2[j];
985 e2[j]=e3[j];
986 e3[j]=uswop;
987 }
988
989 vmod=0;
990 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
991 vmod=TMath::Sqrt(1/vmod);
992 for(j=0;j<3;j++) e1[j]*=vmod;
993
994 vmod=0;
995 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
996 vmod=TMath::Sqrt(1/vmod);
997 for(j=0;j<3;j++) e2[j]*=vmod;
998
999 phi = gMC->GetRandom()->Rndm()* 2 * TMath::Pi();
1000 for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi);
1001 gMC->Gdtom(pol, pol, 2);
1002 Int_t outputNtracksStored;
5d12ce38 1003 gAlice->GetMCApp()->PushTrack(1, //do not transport
1004 gAlice->GetMCApp()->GetCurrentTrackNumber(),//parent track
c021cb15 1005 kFeedback, //PID
1006 mom[0],mom[1],mom[2],mom[3], //track momentum
1007 x4.X(),x4.Y(),x4.Z(),x4.T(), //track origin
1008 pol[0],pol[1],pol[2], //polarization
1009 kPFeedBackPhoton,outputNtracksStored,1.0);
1010
1011 }
1012}//Int_t AliRICH::FeedBackPhotons()
1013//__________________________________________________________________________________________________