1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
22 #include <TGeometry.h>
24 #include <TObjArray.h>
26 #include <TParticle.h>
33 #include "AliPoints.h"
35 #include "AliRICHParam.h"
36 #include "AliRICHClusterFinder.h"
37 #include "AliRICHDigitizer.h"
38 #include "AliRICHHitMapA1.h"
39 #include "AliRICHMerger.h"
40 #include "AliRICHRawCluster.h"
41 #include "AliRICHRecHit1D.h"
42 #include "AliRICHRecHit3D.h"
43 #include "AliRICHSDigit.h"
44 #include "AliRICHSegmentationV0.h"
45 #include "AliRICHTransientDigit.h"
47 #include "AliRunDigitizer.h"
48 #include "AliRICHSegmentationV1.h"
49 #include "AliRICHResponseV0.h"
52 ClassImp(AliRICHdigit)
55 //___________________________________________
59 <img src="gif/alirich.gif">
64 {//Default ctor should not contain any new operators
76 for (Int_t i=0; i<kNCH; i++){
84 //__________________________________________________________________________________________________
85 AliRICH::AliRICH(const char *name, const char *title)
86 :AliDetector(name,title)
88 if(GetDebug())Info("named ctor","Start.");
89 fpParam =new AliRICHParam;
90 fNcerenkovs =fNsdigits =0;//fNhits and fNdigits reset in AliDetector ctor
91 fHits =new TClonesArray("AliRICHhit",1000 ); gAlice->AddHitList(fHits);//hits
92 fCerenkovs =new TClonesArray("AliRICHCerenkov",1000);gAlice->AddHitList(fCerenkovs);//cerenkovs ??? to be removed
93 fSDigits =new TClonesArray("AliRICHdigit",100000);//sdigits
94 fDigits =new TClonesArray("AliRICHdigit",100000);//digits
97 fDchambers =new TObjArray(kNCH);//digits ??? to be removed
98 fRawClusters=new TObjArray(kNCH);//clusters
99 fRecHits1D =new TObjArray(kNCH);//recos Bari
100 fRecHits3D =new TObjArray(kNCH);//recos Lisbon
101 for(int i=0;i<kNCH;i++) {
102 fNdch[i]=fNrawch[i]=0;
103 fDchambers ->AddAt(new TClonesArray("AliRICHDigit",10000), i); //??? to be removed
104 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
105 fRecHits1D ->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
106 fRecHits3D ->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
108 SetMarkerColor(kRed);
109 fCkovNumber=fFreonProd=0;
112 if(GetDebug())Info("named ctor","Stop.");
113 }//AliRICH::AliRICH(const char *name, const char *title)
114 //__________________________________________________________________________________________________
117 if(GetDebug()) Info("dtor","Start.");
124 //PH Delete TObjArrays
130 fDchambers->Delete();
134 fRawClusters->Delete();
138 fRecHits1D->Delete();
142 fRecHits3D->Delete();
145 if(GetDebug()) Info("dtor","Stop.");
146 }//AliRICH::~AliRICH()
147 //__________________________________________________________________________________________________
148 void AliRICH::Hits2SDigits()
149 {//Create a list of sdigits corresponding to list of hits. Every hit generates sdigit.
150 if(GetDebug()) Info("Hit2SDigits","Start.");
152 for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++){//events loop
153 fLoader->GetRunLoader()->GetEvent(iEventN);
155 if(!fLoader->TreeH()) fLoader->LoadHits();
156 if(!fLoader->TreeS()) fLoader->MakeTree("S");
159 AliRICHSegmentationV1 *pSeg=new AliRICHSegmentationV1;
160 AliRICHResponseV0 *pRes=new AliRICHResponseV0;
162 Float_t dx=Param()->SigmaIntegration()*Param()->ChargeSpreadX();
163 Float_t dy=Param()->SigmaIntegration()*Param()->ChargeSpreadY();
166 for(int iPrimN=0;iPrimN<TreeH()->GetEntries();iPrimN++){//prims loop
167 fLoader->TreeH()->GetEntry(iPrimN);
168 for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){//hits loop
169 AliRICHhit *pHit=(AliRICHhit*)Hits()->At(iHitN);//get current hit
172 charge=Param()->TotalCharge(pHit->Particle(),pHit->Eloss(),pHit->Y()-Param()->SectorSizeY());
174 charge=Param()->TotalCharge(pHit->Particle(),pHit->Eloss(),pHit->Y()+Param()->SectorSizeY());
176 for(pSeg->FirstPad(pHit->X(),pHit->Y(),0,dx,dy);pSeg->MorePads();pSeg->NextPad()){//pads loop
178 AddSDigit(pHit->Chamber(),pSeg->Ix(),pSeg->Iy(),
179 Int_t(charge*TMath::Abs(pRes->IntXY(pSeg))),
180 iPrimN);//chamber-xpad-ypad-qdc-track1-2-3
187 fLoader->TreeS()->Fill();
188 fLoader->WriteSDigits("OVERWRITE");
191 fLoader->UnloadHits();
192 fLoader->UnloadSDigits();
193 if(GetDebug()) Info("Hit2SDigits","Stop.");
194 }//void AliRICH::Hits2SDigits()
195 //__________________________________________________________________________________________________
196 void AliRICH::SDigits2Digits()
197 {//Generate digits from sdigits.
198 if(GetDebug()) Info("SDigits2Digits","Start.");
200 AliRunDigitizer *pManager = new AliRunDigitizer(1,1);
201 pManager->SetInputStream(0,"galice.root");
202 pManager->Exec("deb");
203 if(GetDebug()) Info("SDigits2Digits","Stop.");
204 }//void AliRICH::SDigits2Digits()
205 //__________________________________________________________________________________________________
206 void AliRICH::Digits2Reco()
209 // Called from alirun, single event only.
210 if(GetDebug()) Info("Digits2Reco","Start.");
212 int nparticles = gAlice->GetNtrack();
213 cout << "Particles (RICH):" <<nparticles<<endl;
214 if (nparticles > 0) FindClusters(0);
216 }//void AliRICH::Digits2Reco()
217 //__________________________________________________________________________________________________
220 void AliRICH::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
221 {// Add a RICH digit to the list
223 TClonesArray &ldigits = *((TClonesArray*)fDchambers->At(id));
224 new(ldigits[fNdch[id]++]) AliRICHDigit(tracks,charges,digits);
227 void AliRICH::AddRawCluster(Int_t id, const AliRICHRawCluster& c)
228 {// Add a RICH digit to the list
230 TClonesArray &lrawcl = *((TClonesArray*)fRawClusters->At(id));
231 new(lrawcl[fNrawch[id]++]) AliRICHRawCluster(c);
233 //_____________________________________________________________________________
234 void AliRICH::AddRecHit1D(Int_t id, Float_t *rechit, Float_t *photons, Int_t *padsx, Int_t* padsy)
235 {// Add a RICH reconstructed hit to the list
237 TClonesArray &lrec1D = *((TClonesArray*)fRecHits1D->At(id));
238 new(lrec1D[fNrechits1D[id]++]) AliRICHRecHit1D(id,rechit,photons,padsx,padsy);
240 //_____________________________________________________________________________
241 void AliRICH::AddRecHit3D(Int_t id, Float_t *rechit, Float_t omega, Float_t theta, Float_t phi)
242 {// Add a RICH reconstructed hit to the list
244 TClonesArray &lrec3D = *((TClonesArray*)fRecHits3D->At(id));
245 new(lrec3D[fNrechits3D[id]++]) AliRICHRecHit3D(id,rechit,omega,theta,phi);
247 //______________________________________________________________________________
248 void AliRICH::BuildGeometry()
249 {//Builds a TNode geometry for event display
250 if(GetDebug())Info("BuildGeometry","Start.");
252 TNode *node, *subnode, *top;
253 top=gAlice->GetGeometry()->GetNode("alice");
255 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
257 Float_t wid=fpParam->SectorSizeX();
258 Float_t len=fpParam->SectorSizeY();
259 new TBRIK("PHOTO","PHOTO","void",wid/2,0.1,len/2);
261 for(int i=1;i<=kNCH;i++){
263 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());
264 node->SetLineColor(kRed);
266 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+fpParam->DeadZone(),5,len/2+fpParam->DeadZone()/2,"");
267 subnode->SetLineColor(kGreen);
268 fNodes->Add(subnode);
269 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,len/2+fpParam->DeadZone()/2,"");
270 subnode->SetLineColor(kGreen);
271 fNodes->Add(subnode);
272 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-fpParam->DeadZone(),5,len/2+fpParam->DeadZone()/2,"");
273 subnode->SetLineColor(kGreen);
274 fNodes->Add(subnode);
275 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+fpParam->DeadZone(),5,-len/2-fpParam->DeadZone()/2,"");
276 subnode->SetLineColor(kGreen);
277 fNodes->Add(subnode);
278 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-len/2 -fpParam->DeadZone()/2,"");
279 subnode->SetLineColor(kGreen);
280 fNodes->Add(subnode);
281 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-fpParam->DeadZone(),5,-len/2 - fpParam->DeadZone()/2,"");
282 subnode->SetLineColor(kGreen);
283 fNodes->Add(subnode);
286 if(GetDebug())Info("BuildGeometry","Stop.");
287 }//void AliRICH::BuildGeometry()
288 //______________________________________________________________________________
289 void AliRICH::CreateMaterials()
292 // *** DEFINITION OF AVAILABLE RICH MATERIALS ***
293 // ORIGIN : NICK VAN EIJNDHOVEN
294 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
295 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
296 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
298 Int_t isxfld = gAlice->Field()->Integ();
299 Float_t sxmgmx = gAlice->Field()->Max();
302 /************************************Antonnelo's Values (14-vectors)*****************************************/
304 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,
305 6.7e-9,6.88e-9,7.08e-9,7.3e-9,7.51e-9,7.74e-9,8e-9 };
306 Float_t rIndexQuarz[14] = { 1.528309,1.533333,
307 1.538243,1.544223,1.550568,1.55777,
308 1.565463,1.574765,1.584831,1.597027,
309 1.611858,1.6277,1.6472,1.6724 };
310 Float_t rIndexOpaqueQuarz[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
311 Float_t rIndexMethane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
312 Float_t rIndexGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
313 Float_t abscoFreon[14] = { 179.0987,179.0987,
314 179.0987,179.0987,179.0987,142.92,56.65,13.95,10.43,7.07,2.03,.5773,.33496,0. };
315 //Float_t abscoFreon[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
316 // 1e-5,1e-5,1e-5,1e-5,1e-5 };
317 Float_t abscoQuarz[14] = { 64.035,39.98,35.665,31.262,27.527,22.815,21.04,17.52,
318 14.177,9.282,4.0925,1.149,.3627,.10857 };
319 Float_t abscoOpaqueQuarz[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
320 1e-5,1e-5,1e-5,1e-5,1e-5 };
321 Float_t abscoCsI[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
322 1e-4,1e-4,1e-4,1e-4 };
323 Float_t abscoMethane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,
325 Float_t abscoGrid[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
326 1e-4,1e-4,1e-4,1e-4 };
327 Float_t efficAll[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
328 Float_t efficCsI[14] = { 6e-4,.005,.0075,.01125,.045,.117,.135,.16575,
329 .17425,.1785,.1836,.1904,.1938,.221 };
330 Float_t efficGrid[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
334 /**********************************End of Antonnelo's Values**********************************/
336 /**********************************Values from rich_media.f (31-vectors)**********************************/
339 //Photons energy intervals
343 ppckov[i] = (Float_t(i)*0.1+5.5)*1e-9;
347 //Refraction index for quarz
348 Float_t rIndexQuarz[26];
355 Float_t ene=ppckov[i]*1e9;
356 Float_t a=f1/(e1*e1 - ene*ene);
357 Float_t b=f2/(e2*e2 - ene*ene);
358 rIndexQuarz[i] = TMath::Sqrt(1. + a + b );
361 //Refraction index for opaque quarz, methane and grid
362 Float_t rIndexOpaqueQuarz[26];
363 Float_t rIndexMethane[26];
364 Float_t rIndexGrid[26];
367 rIndexOpaqueQuarz[i]=1;
368 rIndexMethane[i]=1.000444;
372 //Absorption index for freon
373 Float_t abscoFreon[26] = {179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987, 179.0987,
374 179.0987, 142.9206, 56.64957, 25.58622, 13.95293, 12.03905, 10.42953, 8.804196,
375 7.069031, 4.461292, 2.028366, 1.293013, .577267, .40746, .334964, 0., 0., 0.};
377 //Absorption index for quarz
378 /*Float_t Qzt [21] = {.0,.0,.005,.04,.35,.647,.769,.808,.829,.844,.853,.858,.869,.887,.903,.902,.902,
379 .906,.907,.907,.907};
380 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,
381 215.0,220.0,225.0,230.0,235.0,240.0,245.0,250.0};
382 Float_t abscoQuarz[31];
383 for (Int_t i=0;i<31;i++)
385 Float_t Xlam = 1237.79 / (ppckov[i]*1e9);
386 if (Xlam <= 160) abscoQuarz[i] = 0;
387 if (Xlam > 250) abscoQuarz[i] = 1;
390 for (Int_t j=0;j<21;j++)
392 if (Xlam > Wavl2[j] && Xlam < Wavl2[j+1])
394 Float_t Dabs = (Qzt[j+1] - Qzt[j])/(Wavl2[j+1] - Wavl2[j]);
395 Float_t Abso = Qzt[j] + Dabs*(Xlam - Wavl2[j]);
396 abscoQuarz[i] = -5.0/(TMath::Log(Abso));
402 /*Float_t abscoQuarz[31] = {49.64211, 48.41296, 47.46989, 46.50492, 45.13682, 44.47883, 43.1929 , 41.30922, 40.5943 ,
403 39.82956, 38.98623, 38.6247 , 38.43448, 37.41084, 36.22575, 33.74852, 30.73901, 24.25086,
404 17.94531, 11.88753, 5.99128, 3.83503, 2.36661, 1.53155, 1.30582, 1.08574, .8779708,
405 .675275, 0., 0., 0.};
407 for (Int_t i=0;i<31;i++)
409 abscoQuarz[i] = abscoQuarz[i]/10;
412 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,
413 19.266, 17.525, 15.878, 14.177, 11.719, 9.282, 6.62, 4.0925, 2.601, 1.149, .667, .3627,
414 .192, .1497, .10857};
416 //Absorption index for methane
417 Float_t abscoMethane[26];
420 abscoMethane[i]=AbsoCH4(ppckov[i]*1e9);
423 //Absorption index for opaque quarz, csi and grid, efficiency for all and grid
424 Float_t abscoOpaqueQuarz[26];
425 Float_t abscoCsI[26];
426 Float_t abscoGrid[26];
427 Float_t efficAll[26];
428 Float_t efficGrid[26];
431 abscoOpaqueQuarz[i]=1e-5;
440 Float_t efficCsI[26] = {0.000199999995, 0.000600000028, 0.000699999975, 0.00499999989, 0.00749999983, 0.010125,
441 0.0242999997, 0.0405000001, 0.0688500032, 0.105299994, 0.121500008, 0.141749993, 0.157949999,
442 0.162, 0.166050002, 0.167669997, 0.174299985, 0.176789999, 0.179279998, 0.182599992, 0.18592,
443 0.187579989, 0.189239994, 0.190899998, 0.207499996, 0.215799987};
447 //FRESNEL LOSS CORRECTION FOR PERPENDICULAR INCIDENCE AND
448 //UNPOLARIZED PHOTONS
452 efficCsI[i] = efficCsI[i]/(1.-Fresnel(ppckov[i]*1e9,1.,0));
455 /*******************************************End of rich_media.f***************************************/
462 Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon,
466 Int_t nlmatmet, nlmatqua;
467 Float_t wmatquao[2], rIndexFreon[26];
468 Float_t aquao[2], epsil, stmin, zquao[2];
470 Float_t radlal, densal, tmaxfd, deemax, stemax;
471 Float_t aal, zal, radlgri, densfre, radlhon, densgri, denshon,densqua, densmet, wmatfre[2], wmatmet[2], wmatqua[2];
473 Int_t *idtmed = fIdtmed->GetArray()-999;
475 // --- Photon energy (GeV)
476 // --- Refraction indexes
477 for (i = 0; i < 26; ++i) {
478 rIndexFreon[i] = ppckov[i] * .0172 * 1e9 + 1.177;
479 //rIndexFreon[i] = 1;
482 // --- Detection efficiencies (quantum efficiency for CsI)
483 // --- Define parameters for honeycomb.
484 // Used carbon of equivalent rad. lenght
491 // --- Parameters to include in GSMIXT, relative to Quarz (SiO2)
502 // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2)
513 // --- Parameters to include in GSMIXT, relative to Freon (C6F14)
524 // --- Parameters to include in GSMIXT, relative to methane (CH4)
535 // --- Parameters to include in GSMIXT, relative to anode grid (Cu)
542 // --- Parameters to include in GSMATE related to aluminium sheet
549 // --- Glass parameters
551 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
552 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
553 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
557 AliMaterial(1, "Air $", 14.61, 7.3, .001205, 30420., 67500);
558 AliMaterial(6, "HON", ahon, zhon, denshon, radlhon, 0);
559 AliMaterial(16, "CSI", ahon, zhon, denshon, radlhon, 0);
560 AliMixture(20, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
561 AliMixture(21, "QUAO", aquao, zquao, densquao, nlmatquao, wmatquao);
562 AliMixture(30, "FRE", afre, zfre, densfre, nlmatfre, wmatfre);
563 AliMixture(40, "MET", amet, zmet, densmet, nlmatmet, wmatmet);
564 AliMixture(41, "METG", amet, zmet, densmet, nlmatmet, wmatmet);
565 AliMaterial(11, "GRI", agri, zgri, densgri, radlgri, 0);
566 AliMaterial(50, "ALUM", aal, zal, densal, radlal, 0);
567 AliMixture(32, "GLASS",aglass, zglass, dglass, 5, wglass);
568 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
576 AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
577 AliMedium(2, "HONEYCOMB$", 6, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
578 AliMedium(3, "QUARZO$", 20, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
579 AliMedium(4, "FREON$", 30, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
580 AliMedium(5, "METANO$", 40, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
581 AliMedium(6, "CSI$", 16, 1, isxfld, sxmgmx,tmaxfd, stemax, deemax, epsil, stmin);
582 AliMedium(7, "GRIGLIA$", 11, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
583 AliMedium(8, "QUARZOO$", 21, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
584 AliMedium(9, "GAP$", 41, 1, isxfld, sxmgmx,tmaxfd, .1, -deemax, epsil, -stmin);
585 AliMedium(10, "ALUMINUM$", 50, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
586 AliMedium(11, "GLASS", 32, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
587 AliMedium(12, "PCB_COPPER", 31, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
590 gMC->SetCerenkov(idtmed[1000], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
591 gMC->SetCerenkov(idtmed[1001], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
592 gMC->SetCerenkov(idtmed[1002], 26, ppckov, abscoQuarz, efficAll,rIndexQuarz);
593 gMC->SetCerenkov(idtmed[1003], 26, ppckov, abscoFreon, efficAll,rIndexFreon);
594 gMC->SetCerenkov(idtmed[1004], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
595 gMC->SetCerenkov(idtmed[1005], 26, ppckov, abscoCsI, efficCsI, rIndexMethane);
596 gMC->SetCerenkov(idtmed[1006], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
597 gMC->SetCerenkov(idtmed[1007], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
598 gMC->SetCerenkov(idtmed[1008], 26, ppckov, abscoMethane, efficAll, rIndexMethane);
599 gMC->SetCerenkov(idtmed[1009], 26, ppckov, abscoGrid, efficGrid, rIndexGrid);
600 gMC->SetCerenkov(idtmed[1010], 26, ppckov, abscoOpaqueQuarz, efficAll, rIndexOpaqueQuarz);
602 //__________________________________________________________________________________________________
603 Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
606 //ENE(EV), PDOTI=COS(INC.ANG.), PDOTR=COS(POL.PLANE ROT.ANG.)
608 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,
609 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,
610 7.8,7.9,8.0,8.1,8.2,8.3,8.4,8.5};
611 Float_t csin[36] = {2.14,2.21,2.33,2.48,2.76,2.97,2.99,2.59,2.81,3.05,
612 2.86,2.53,2.55,2.66,2.79,2.96,3.18,3.05,2.84,2.81,2.38,2.11,
613 2.01,2.13,2.39,2.73,3.08,3.15,2.95,2.73,2.56,2.41,2.12,1.95,
615 Float_t csik[36] = {0.,0.,0.,0.,0.,0.196,0.408,0.208,0.118,0.49,0.784,0.543,
616 0.424,0.404,0.371,0.514,0.922,1.102,1.139,1.376,1.461,1.253,0.878,
617 0.69,0.612,0.649,0.824,1.347,1.571,1.678,1.763,1.857,1.824,1.824,
620 Int_t j=Int_t(xe*10)-49;
621 Float_t cn=csin[j]+((csin[j+1]-csin[j])/0.1)*(xe-en[j]);
622 Float_t ck=csik[j]+((csik[j+1]-csik[j])/0.1)*(xe-en[j]);
624 //FORMULAE FROM HANDBOOK OF OPTICS, 33.23 OR
625 //W.R. HUNTER, J.O.S.A. 54 (1964),15 , J.O.S.A. 55(1965),1197
627 Float_t sinin=TMath::Sqrt(1-pdoti*pdoti);
628 Float_t tanin=sinin/pdoti;
630 Float_t c1=cn*cn-ck*ck-sinin*sinin;
631 Float_t c2=4*cn*cn*ck*ck;
632 Float_t aO=TMath::Sqrt(0.5*(TMath::Sqrt(c1*c1+c2)+c1));
633 Float_t b2=0.5*(TMath::Sqrt(c1*c1+c2)-c1);
635 Float_t rs=((aO-pdoti)*(aO-pdoti)+b2)/((aO+pdoti)*(aO+pdoti)+b2);
636 Float_t rp=rs*((aO-sinin*tanin)*(aO-sinin*tanin)+b2)/((aO+sinin*tanin)*(aO+sinin*tanin)+b2);
639 //CORRECTION FACTOR FOR SURFACE ROUGHNESS
640 //B.J. STAGG APPLIED OPTICS, 30(1991),4113
643 Float_t lamb=1240/ene;
646 Float_t rO=TMath::Exp(-(4*TMath::Pi()*pdoti*sigraf/lamb)*(4*TMath::Pi()*pdoti*sigraf/lamb));
650 Float_t pdotr=0.8; //DEGREE OF POLARIZATION : 1->P , -1->S
651 fresn=0.5*(rp*(1+pdotr)+rs*(1-pdotr));
658 }//Float_t AliRICH::Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)
659 //__________________________________________________________________________________________________
660 Float_t AliRICH::AbsoCH4(Float_t x)
663 //KLOSCH,SCH4(9),WL(9),EM(9),ALENGTH(31)
664 Float_t sch4[9] = {.12,.16,.23,.38,.86,2.8,7.9,28.,80.}; //MB X 10^22
665 //Float_t wl[9] = {153.,152.,151.,150.,149.,148.,147.,146.,145};
666 Float_t em[9] = {8.1,8.158,8.212,8.267,8.322,8.378,8.435,8.493,8.55};
667 const Float_t kLosch=2.686763E19; // LOSCHMIDT NUMBER IN CM-3
668 const Float_t kIgas1=100, kIgas2=0, kOxy=10., kWater=5., kPressure=750.,kTemperature=283.;
669 Float_t pn=kPressure/760.;
670 Float_t tn=kTemperature/273.16;
673 // ------- METHANE CROSS SECTION -----------------
674 // ASTROPH. J. 214, L47 (1978)
680 if(x>=7.75 && x<=8.1)
682 Float_t c0=-1.655279e-1;
683 Float_t c1=6.307392e-2;
684 Float_t c2=-8.011441e-3;
685 Float_t c3=3.392126e-4;
686 sm=(c0+c1*x+c2*x*x+c3*x*x*x)*1.e-18;
692 while (x<=em[j] && x>=em[j+1])
695 Float_t a=(sch4[j+1]-sch4[j])/(em[j+1]-em[j]);
696 sm=(sch4[j]+a*(x-em[j]))*1e-22;
700 Float_t dm=(kIgas1/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
701 Float_t abslm=1./sm/dm;
703 // ------- ISOBUTHANE CROSS SECTION --------------
704 // i-C4H10 (ai) abs. length from curves in
705 // Lu-McDonald paper for BARI RICH workshop .
706 // -----------------------------------------------------------
715 if(x>=7.25 && x<7.375)
721 Float_t si = 1./(ai*kLosch*273.16/293.); // ISOB. CRO.SEC.IN CM2
722 Float_t di=(kIgas2/100.)*(1.-((kOxy+kWater)/1.e6))*kLosch*pn/tn;
727 // ---------------------------------------------------------
729 // transmission of O2
731 // y= path in cm, x=energy in eV
732 // so= cross section for UV absorption in cm2
733 // do= O2 molecular density in cm-3
734 // ---------------------------------------------------------
742 so=3.392709e-13 * TMath::Exp(2.864104 *x);
748 so=2.910039e-34 * TMath::Exp(10.3337*x);
755 Float_t a0=-73770.76;
757 Float_t a2=-11475.44;
759 Float_t a4=-86.07027;
761 so= a0+(a1*x)+(a2*x*x)+(a3*x*x*x)+(a4*x*x*x*x)+(a5*x*x*x*x*x);
765 Float_t dox=(kOxy/1e6)*kLosch*pn/tn;
770 // ---------------------------------------------------------
772 // transmission of H2O
774 // y= path in cm, x=energy in eV
775 // sw= cross section for UV absorption in cm2
776 // dw= H2O molecular density in cm-3
777 // ---------------------------------------------------------
782 Float_t b1=-15807.74;
784 Float_t b3=-285.4809;
789 Float_t sw= b0+(b1*x)+(b2*x*x)+(b3*x*x*x)+(b4*x*x*x*x);
791 Float_t dw=(kWater/1e6)*kLosch*pn/tn;
797 // ---------------------------------------------------------
799 Float_t alength=1./(1./abslm+1./absli+1./abslo+1./abslw);
802 //__________________________________________________________________________________________________
803 void AliRICH::ResetDigits()
804 {//Reset number of digits and the digits array for this detector
805 for ( int i=0;i<kNCH;i++ ) {
806 if (fDchambers && fDchambers->At(i)) fDchambers->At(i)->Clear();
807 if (fNdch) fNdch[i]=0;
810 //__________________________________________________________________________________________________
811 void AliRICH::ResetRawClusters()
812 {//Reset number of raw clusters and the raw clust array for this detector
813 for ( int i=0;i<kNCH;i++ ) {
814 if (fRawClusters->At(i)) ((TClonesArray*)fRawClusters->At(i))->Clear();
815 if (fNrawch) fNrawch[i]=0;
818 //__________________________________________________________________________________________________
819 void AliRICH::ResetRecHits1D()
820 {//Reset number of raw clusters and the raw clust array for this detector
821 for ( int i=0;i<kNCH;i++ ) {
822 if (fRecHits1D->At(i)) ((TClonesArray*)fRecHits1D->At(i))->Clear();
823 if (fNrechits1D) fNrechits1D[i]=0;
827 //__________________________________________________________________________________________________
828 void AliRICH::ResetRecHits3D()
829 {// Reset number of raw clusters and the raw clust array for this detector
830 for ( int i=0;i<kNCH;i++ ) {
831 if (fRecHits3D->At(i)) ((TClonesArray*)fRecHits3D->At(i))->Clear();
832 if (fNrechits3D) fNrechits3D[i]=0;
835 //__________________________________________________________________________________________________
836 void AliRICH::FindClusters(Int_t nev /*kir,Int_t lastEntry*/)
837 {// Loop on chambers and on cathode planes
838 for (Int_t icat=1;icat<2;icat++) {
839 gAlice->ResetDigits();
840 gAlice->TreeD()->GetEvent(0);
841 for (Int_t ich=0;ich<kNCH;ich++) {
842 AliRICHChamber* iChamber=(AliRICHChamber*)fChambers->At(ich);
843 TClonesArray *pRICHdigits = this->DigitsAddress(ich);
844 if (pRICHdigits == 0)
847 // Get ready the current chamber stuff
849 AliRICHResponse* response = iChamber->GetResponseModel();
850 AliSegmentation* seg = iChamber->GetSegmentationModel();
851 AliRICHClusterFinder* rec = iChamber->GetReconstructionModel();
853 rec->SetSegmentation(seg);
854 rec->SetResponse(response);
855 rec->SetDigits(pRICHdigits);
856 rec->SetChamber(ich);
857 if (nev==0) rec->CalibrateCOG();
858 rec->FindRawClusters();
861 fRch=RawClustAddress(ich);
865 gAlice->TreeR()->Fill();
867 for (int i=0;i<kNCH;i++) {
868 fRch=RawClustAddress(i);
869 fRch->GetEntriesFast();
877 sprintf(hname,"TreeR%d",nev);
878 gAlice->TreeR()->Write(hname,kOverwrite,0);
879 gAlice->TreeR()->Reset();
880 }//void AliRICH::FindClusters(Int_t nev)
881 //__________________________________________________________________________________________________
882 void AliRICH::MakeBranchInTreeD(TTree *treeD, const char *file)
883 {// Create TreeD branches for the RICH.
884 if(GetDebug())Info("MakeBranchInTreeD","Start.");
886 const Int_t kBufferSize = 4000;
890 // one branch for digits per chamber
892 for (Int_t i=0; i<kNCH ;i++) {
893 sprintf(branchname,"%sDigits%d",GetName(),i+1);
894 if (fDchambers && treeD) {
895 MakeBranchInTree(treeD,branchname, &((*fDchambers)[i]), kBufferSize, file);
896 // printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
900 //__________________________________________________________________________________________________
901 void AliRICH::MakeBranch(Option_t* option)
902 {//Create Tree branches for the RICH.
903 if(GetDebug())Info("MakeBranch","Start with option= %s.",option);
905 const Int_t kBufferSize = 4000;
909 const char *cH = strstr(option,"H");
910 const char *cD = strstr(option,"D");
911 const char *cR = strstr(option,"R");
912 const char *cS = strstr(option,"S");
915 if(!fHits) fHits=new TClonesArray("AliRICHhit",1000 );
916 if(!fCerenkovs) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
917 MakeBranchInTree(TreeH(),"RICHCerenkov", &fCerenkovs, kBufferSize, 0) ;
919 //kir if(!fSDigits) fSDigits = new TClonesArray("AliRICHdigit",100000);
920 //kir MakeBranchInTree(TreeH(),"RICHSDigits", &fSDigits, kBufferSize, 0) ;
922 AliDetector::MakeBranch(option);//this is after cH because we need to guarantee that fHits array is created
924 if(cS&&fLoader->TreeS()){
925 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
926 MakeBranchInTree(fLoader->TreeS(),"RICH",&fSDigits,kBufferSize,0) ;
930 if (cD&&fLoader->TreeD()){
932 fDchambers=new TObjArray(kNCH); // one branch for digits per chamber
934 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
937 for (i=0; i<kNCH ;i++)
939 sprintf(branchname,"%sDigits%d",GetName(),i+1);
940 MakeBranchInTree(fLoader->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, 0);
944 if (cR&&gAlice->TreeR()){//one branch for raw clusters per chamber
946 if (fRawClusters == 0x0 )
948 fRawClusters = new TObjArray(kNCH);
949 for (i=0; i<kNCH ;i++)
951 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
955 if (fRecHits1D == 0x0)
957 fRecHits1D = new TObjArray(kNCH);
958 for (i=0; i<kNCH ;i++)
960 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
964 if (fRecHits3D == 0x0)
966 fRecHits3D = new TObjArray(kNCH);
967 for (i=0; i<kNCH ;i++)
969 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
973 for (i=0; i<kNCH ;i++){
974 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
975 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, 0);
976 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
977 MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, 0);
978 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
979 MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits3D)[i]), kBufferSize, 0);
981 }//if (cR && gAlice->TreeR())
982 if(GetDebug())Info("MakeBranch","Stop.");
983 }//void AliRICH::MakeBranch(Option_t* option)
984 //______________________________________________________________________________
985 void AliRICH::SetTreeAddress()
986 {//Set branch address for the Hits and Digits Tree.
987 if(GetDebug())Info("SetTreeAddress","Start.");
994 TTree *treeH = fLoader->TreeH();
995 TTree *treeD = fLoader->TreeD();
996 TTree *treeR = fLoader->TreeR();
999 if(GetDebug())Info("SetTreeAddress","tree H is requested.");
1000 if(fHits==0x0) fHits=new TClonesArray("AliRICHhit",1000);
1002 branch = treeH->GetBranch("RICHCerenkov");
1004 if (fCerenkovs == 0x0) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
1005 branch->SetAddress(&fCerenkovs);
1008 //kir branch = treeH->GetBranch("RICHSDigits");
1011 //kir if (fSDigits == 0x0) fSDigits = new TClonesArray("AliRICHdigit",100000);
1012 //kir branch->SetAddress(&fSDigits);
1016 AliDetector::SetTreeAddress();//this is after TreeH because we need to guarantee that fHits array is created
1019 if(fLoader->TreeS()){
1020 if(GetDebug())Info("SetTreeAddress","tree S is requested.");
1021 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
1022 fLoader->TreeS()->GetBranch("RICH")->SetAddress(&fSDigits);
1027 if(GetDebug())Info("SetTreeAddress","tree D is requested.");
1029 if (fDchambers == 0x0)
1031 fDchambers = new TObjArray(kNCH);
1032 for (i=0; i<kNCH ;i++)
1034 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
1038 for (i=0; i<kNCH; i++) {
1039 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1041 branch = treeD->GetBranch(branchname);
1042 if (branch) branch->SetAddress(&((*fDchambers)[i]));
1048 if(GetDebug())Info("SetTreeAddress","tree R is requested.");
1050 if (fRawClusters == 0x0 )
1052 fRawClusters = new TObjArray(kNCH);
1053 for (i=0; i<kNCH ;i++)
1055 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
1059 if (fRecHits1D == 0x0)
1061 fRecHits1D = new TObjArray(kNCH);
1062 for (i=0; i<kNCH ;i++)
1064 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
1068 if (fRecHits3D == 0x0)
1070 fRecHits3D = new TObjArray(kNCH);
1071 for (i=0; i<kNCH ;i++)
1073 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
1077 for (i=0; i<kNCH; i++) {
1078 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1080 branch = treeR->GetBranch(branchname);
1081 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
1085 for (i=0; i<kNCH; i++) {
1086 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
1088 branch = treeR->GetBranch(branchname);
1089 if (branch) branch->SetAddress(&((*fRecHits1D)[i]));
1093 for (i=0; i<kNCH; i++) {
1094 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
1096 branch = treeR->GetBranch(branchname);
1097 if (branch) branch->SetAddress(&((*fRecHits3D)[i]));
1102 if(GetDebug())Info("SetTreeAddress","Stop.");
1103 }//void AliRICH::SetTreeAddress()
1104 //__________________________________________________________________________________________________
1105 void AliRICH::Print(Option_t *option)const
1107 TObject::Print(option);
1109 fChambers->Print(option);
1110 }//void AliRICH::Print(Option_t *option)const
1111 //__________________________________________________________________________________________________
1112 void AliRICH::CreateGeometry()
1113 {//Creates detailed geometry simulation (currently GEANT volumes tree)
1114 if(GetDebug())Info("CreateGeometry","Start.");
1115 //???????? to be removed to AliRICHParam?
1116 fpParam->RadiatorToPads(fpParam->FreonThickness()/2+fpParam->QuartzThickness()+fpParam->GapThickness());
1118 //Opaque quartz thickness
1119 Float_t oqua_thickness = .5;
1121 Float_t csi_width =fpParam->Nx()*fpParam->PadSizeX()+fpParam->DeadZone();
1122 Float_t csi_length=fpParam->Ny()*fpParam->PadSizeY()+2*fpParam->DeadZone();
1124 Int_t *idtmed = fIdtmed->GetArray()-999;
1131 //External aluminium box
1132 par[0]=68.8*kcm;par[1]=13*kcm;par[2]=70.86*kcm;//Original Settings
1133 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
1135 par[0]=66.3; par[1] = 13; par[2] = 68.35; //Original Settings
1136 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
1137 //Air 2 (cutting the lower part of the box)
1138 par[0]=1.25; par[1] = 3; par[2] = 70.86; //Original Settings
1139 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
1140 //Air 3 (cutting the lower part of the box)
1141 par[0]=66.3; par[1] = 3; par[2] = 1.2505; //Original Settings
1142 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
1144 par[0]=66.3;par[1]=0.188; par[2] = 68.35; //Original Settings
1145 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
1147 par[0]=66.3;par[1]=0.025;par[2]=68.35; //Original Settings
1148 //par[0] = 66.5; par[1] = .025; par[2] = 63.1;
1149 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
1151 par[0]=fpParam->QuartzWidth()/2;par[1]=fpParam->QuartzThickness()/2;par[2]=fpParam->QuartzLength()/2;
1152 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
1153 //Spacers (cylinders)
1154 par[0]=0.;par[1]=.5;par[2]=fpParam->FreonThickness()/2;
1155 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
1156 //Feet (freon slabs supports)
1157 par[0] = .7; par[1] = .3; par[2] = 1.9;
1158 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
1160 par[0]=fpParam->QuartzWidth()/2;par[1]= .2;par[2]=fpParam->QuartzLength()/2;
1161 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
1162 //Frame of opaque quartz
1163 par[0]=fpParam->OuterFreonWidth()/2;par[1]=fpParam->FreonThickness()/2;par[2]=fpParam->OuterFreonLength()/2;
1164 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
1165 par[0]=fpParam->InnerFreonWidth()/2;par[1]=fpParam->FreonThickness()/2;par[2]=fpParam->InnerFreonLength()/2;
1166 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
1168 par[0]=fpParam->OuterFreonWidth()/2 - oqua_thickness;
1169 par[1]=fpParam->FreonThickness()/2;
1170 par[2]=fpParam->OuterFreonLength()/2 - 2*oqua_thickness;
1171 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
1173 par[0]=fpParam->InnerFreonWidth()/2 - oqua_thickness;
1174 par[1]=fpParam->FreonThickness()/2;
1175 par[2]=fpParam->InnerFreonLength()/2 - 2*oqua_thickness;
1176 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
1178 par[0]=csi_width/2;par[1]=fpParam->GapThickness()/2;par[2]=csi_length/2;
1179 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
1181 par[0]=csi_width/2;par[1]=fpParam->ProximityGapThickness()/2;par[2] = csi_length/2;
1182 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
1184 par[0]=csi_width/2;par[1]=.25;par[2]=csi_length/2;
1185 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
1187 par[0] = 0.;par[1] = .001;par[2] = 20.;
1188 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
1192 par[0]=csi_width/2;par[1]=1.05;par[2]=1.05;
1193 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
1194 //Ceramic pick up (base)
1195 par[0]=csi_width/2;par[1]= .25;par[2]=1.05;
1196 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
1197 //Ceramic pick up (head)
1198 par[0] = csi_width/2;par[1] = .1;par[2] = .1;
1199 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
1201 //Aluminium supports for methane and CsI
1203 par[0]=csi_width/2;par[1]=fpParam->GapThickness()/2 + .25; par[2] = (68.35 - csi_length/2)/2;
1204 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
1206 par[0]=(66.3 - csi_width/2)/2;par[1]=fpParam->GapThickness()/2+.25;par[2]=csi_length/2+68.35-csi_length/2;
1207 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
1209 //Aluminium supports for freon
1211 par[0] = fpParam->QuartzWidth()/2; par[1] = .3; par[2] = (68.35 - fpParam->QuartzLength()/2)/2;
1212 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
1214 par[0] = (66.3 - fpParam->QuartzWidth()/2)/2; par[1] = .3;
1215 par[2] = fpParam->QuartzLength()/2 + 68.35 - fpParam->QuartzLength()/2;
1216 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
1218 par[0] = csi_width/2;par[1] = .25; par[2] = csi_length/4 -.5025;
1219 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
1221 //Backplane supports
1223 par[0] = 33.15;par[1] = 2;par[2] = 21.65;
1224 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
1226 par[0] = 9.05; par[1] = 2; par[2] = 4.4625;
1227 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
1229 par[0] = 5.7;par[1] = 2;par[2] = 4.4625;
1230 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
1231 //Place holes inside backplane support
1232 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
1233 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
1234 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
1235 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
1236 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1237 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1238 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1239 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1240 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
1241 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
1242 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1243 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
1244 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1245 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
1246 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1247 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
1248 //Place material inside RICH
1249 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
1250 gMC->Gspos("AIR2", 1, "RICH", 66.3 + 1.2505, 1.276-fpParam->GapThickness()/2-fpParam->QuartzThickness()-fpParam->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
1251 gMC->Gspos("AIR2", 2, "RICH", -66.3 - 1.2505,1.276-fpParam->GapThickness()/2-fpParam->QuartzThickness()-fpParam->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
1252 gMC->Gspos("AIR3", 1, "RICH", 0., 1.276-fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, -68.35 - 1.25, 0, "ONLY");
1253 gMC->Gspos("AIR3", 2, "RICH", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 68.35 + 1.25, 0, "ONLY");
1254 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
1255 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
1256 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
1257 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1258 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
1259 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1260 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
1261 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1262 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1263 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1264 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
1265 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()- .2, 0., 0, "ONLY");
1267 gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1268 gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
1269 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
1270 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
1272 Float_t supp_y = 1.276 - fpParam->GapThickness()/2- fpParam->QuartzThickness() -fpParam->FreonThickness() - .2 + .3; //y position of freon supports
1273 gMC->Gspos("SFLG", 1, "SRIC", fpParam->QuartzWidth()/2 + (66.3 - fpParam->QuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1274 gMC->Gspos("SFLG", 2, "SRIC", - fpParam->QuartzWidth()/2 - (66.3 - fpParam->QuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
1275 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, fpParam->QuartzLength()/2 + (68.35 - fpParam->QuartzLength()/2)/2, 0, "ONLY");
1276 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - fpParam->QuartzLength()/2 - (68.35 - fpParam->QuartzLength()/2)/2, 0, "ONLY");
1277 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
1279 Int_t nspacers = 30;
1280 for (i = 0; i < nspacers/3; i++) {
1281 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1282 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1284 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1285 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1286 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
1288 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1289 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1290 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1292 for (i = 0; i < nspacers/3; i++) {
1293 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
1294 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1296 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
1297 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1298 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
1300 for (i = (nspacers*2)/3; i < nspacers; ++i) {
1301 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
1302 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
1304 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
1305 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
1306 gMC->Gspos("OQF1", 1, "SRIC", fpParam->OuterFreonWidth()/2 + fpParam->InnerFreonWidth()/2 + 2, 1.276 - fpParam->GapThickness()/2- fpParam->QuartzThickness() -fpParam->FreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3)
1307 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()/2, 0., 0, "ONLY"); //Original settings
1308 gMC->Gspos("OQF1", 3, "SRIC", - (fpParam->OuterFreonWidth()/2 + fpParam->InnerFreonWidth()/2) - 2, 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness() - fpParam->FreonThickness()/2, 0., 0, "ONLY"); //Original settings (-31.3)
1309 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - fpParam->GapThickness()/2 - fpParam->QuartzThickness()/2, 0., 0, "ONLY");
1310 gMC->Gspos("GAP ", 1, "META", 0., fpParam->GapThickness()/2 - fpParam->ProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
1311 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
1312 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + fpParam->GapThickness()/2 + .25, 0., 0, "ONLY");
1313 //Wire support placing
1314 gMC->Gspos("WSG2", 1, "GAP ", 0., fpParam->ProximityGapThickness()/2 - .1, 0., 0, "ONLY");
1315 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
1316 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + fpParam->GapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
1318 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
1319 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
1320 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1321 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
1322 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1323 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + fpParam->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
1325 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + fpParam->GapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
1326 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + fpParam->GapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
1328 //place chambers into mother volume ALIC
1329 for(int i=1;i<=kNCH;i++){
1330 AliMatrix(idrotm[1000+i],C(i)->ThetaXd(),C(i)->PhiXd(),
1331 C(i)->ThetaYd(),C(i)->PhiYd(),
1332 C(i)->ThetaZd(),C(i)->PhiZd());
1333 gMC->Gspos("RICH",i,"ALIC",C(i)->X(),C(i)->Y(),C(i)->Z(),idrotm[1000+i], "ONLY");
1336 if(GetDebug())Info("CreateGeometry","Stop.");
1337 }//void AliRICH::CreateGeometry()
1338 //______________________________________________________________________________
1339 void AliRICH::CreateChambers()
1340 {//(re)create all RICH Chambers
1341 if(GetDebug())Info("CreateChambers","Start.");
1343 if(fChambers) delete fChambers;//recreate chambers
1344 fChambers=new TObjArray(kNCH);
1345 fChambers->SetOwner();
1346 for(int i=0;i<kNCH;i++){
1347 fChambers->AddAt(new AliRICHChamber(i+1,fpParam),i);
1350 if(GetDebug())Info("CreateChambers","Stop.");
1351 }//void AliRICH::CreateChambers()
1352 //__________________________________________________________________________________________________
1353 void AliRICH::GenerateFeedbacks(Float_t eloss)
1354 {// Generate FeedBack photons
1356 Float_t cthf, phif, enfp = 0, sthf;
1357 Float_t e1[3], e2[3], e3[3];
1358 Float_t vmod, uswop;
1359 Float_t dir[3], phi;
1360 Float_t pol[3], mom[4];
1361 //Determine number of feedback photons
1363 gMC->TrackPosition(x4);//This sould return the current track position
1364 Float_t charge=Param()->TotalCharge(gMC->TrackPid(),eloss,5*kcm);//??? Totsl Charge
1365 Int_t iNphotons=gMC->GetRandom()->Poisson(Param()->AlphaFeedback()*charge);
1366 Info("GenerateFeedbacks","N photons=%i",iNphotons);
1368 for(Int_t i=0;i<iNphotons;i++){
1370 gMC->GetRandom()->RndmArray(2,ranf); //Sample direction
1372 if(cthf<0) continue;
1373 sthf = TMath::Sqrt((1 - cthf) * (1 + cthf));
1374 phif = ranf[1] * 2 * TMath::Pi();
1376 if(Double_t randomNumber=gMC->GetRandom()->Rndm()<=0.57)
1378 else if(randomNumber<=0.7)
1384 dir[0] = sthf * TMath::Sin(phif); dir[1] = cthf; dir[2] = sthf * TMath::Cos(phif);
1385 gMC->Gdtom(dir, mom, 2);
1386 mom[0]*=enfp; mom[1]*=enfp; mom[2]*=enfp;
1387 mom[3] = TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
1390 e1[0]= 0; e1[1]=-dir[2]; e1[2]= dir[1];
1391 e2[0]=-dir[1]; e2[1]= dir[0]; e2[2]= 0;
1392 e3[0]= dir[1]; e3[1]= 0; e3[2]=-dir[0];
1395 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
1396 if (!vmod) for(j=0;j<3;j++) {
1402 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
1403 if (!vmod) for(j=0;j<3;j++) {
1410 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
1411 vmod=TMath::Sqrt(1/vmod);
1412 for(j=0;j<3;j++) e1[j]*=vmod;
1415 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
1416 vmod=TMath::Sqrt(1/vmod);
1417 for(j=0;j<3;j++) e2[j]*=vmod;
1419 phi = gMC->GetRandom()->Rndm()* 2 * TMath::Pi();
1420 for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi);
1421 gMC->Gdtom(pol, pol, 2);
1422 Int_t outputNtracksStored;
1423 gAlice->PushTrack(1, //do not transport
1424 gAlice->GetCurrentTrackNumber(),//parent track
1426 mom[0],mom[1],mom[2],mom[3], //track momentum
1427 x4.X(),x4.Y(),x4.Z(),x4.T(), //track origin
1428 pol[0],pol[1],pol[2], //polarization
1429 kPFeedBackPhoton,outputNtracksStored,1.0);
1432 }//Int_t AliRICH::FeedBackPhotons()
1433 //__________________________________________________________________________________________________
1434 static Int_t sMaxIterPad=0; // Static variables for the pad-hit iterator routines
1435 static Int_t sCurIterPad=0;
1437 //__________________________________________________________________________________________________
1438 AliRICHSDigit* AliRICH::FirstPad(AliRICHhit* hit,TClonesArray *clusters )
1439 {// Initialise the pad iterator Return the address of the first sdigit for hit
1440 TClonesArray *theClusters = clusters;
1441 Int_t nclust = theClusters->GetEntriesFast();
1442 if (nclust && hit->PHlast() > 0) {
1443 sMaxIterPad=Int_t(hit->PHlast());
1444 sCurIterPad=Int_t(hit->PHfirst());
1445 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
1451 //__________________________________________________________________________________________________
1452 AliRICHSDigit* AliRICH::NextPad(TClonesArray *clusters)
1453 {// Iterates over pads
1456 if (sCurIterPad <= sMaxIterPad) {
1457 return (AliRICHSDigit*) clusters->UncheckedAt(sCurIterPad-1);
1462 //__________________________________________________________________________________________________