1 ///////////////////////////////////////////////////////////////////////////////
3 // Ring Imaging Cherenkov //
4 // This class contains the basic functions for the Ring Imaging Cherenkov //
5 // detector. Functions specific to one particular geometry are //
6 // contained in the derived classes //
10 <img src="picts/AliRICHClass.gif">
15 ///////////////////////////////////////////////////////////////////////////////
29 //_____________________________________________________________________________
33 // Default constructor for RICH
50 //_____________________________________________________________________________
51 AliRICH::AliRICH(const char *name, const char *title)
52 : AliDetector(name,title)
55 // Standard constructor for RICH
62 // Allocate space for different components
63 fHits = new TClonesArray("AliRICHhit", 100);
64 fMips = new TClonesArray("AliRICHmip", 100);
65 fCkovs = new TClonesArray("AliRICHckov", 100);
66 fPadhits = new TClonesArray("AliRICHpadhit", 100);
68 // Set parameters to default value
79 //_____________________________________________________________________________
83 // Destructor for RICH
87 fMips->Delete(); delete fMips;
88 fCkovs->Delete(); delete fCkovs;
89 fPadhits->Delete(); delete fPadhits;
92 //_____________________________________________________________________________
93 void AliRICH::AddHit(Int_t track, Int_t *vol, Float_t *hits)
98 switch ((int) hits[0]) {
103 TClonesArray &lhits = *fHits;
104 new(lhits[fNhits++]) AliHit(fIshunt,track);
105 AliHit *lhit = (AliHit*) fHits->AddrAt(fNhits-1);
113 AddMipHit(track,vol,hits);
118 AddCkovHit(track,vol,hits);
123 AddPadHit(track,vol,hits);
130 printf("Error: AliRICH::AddHit flag %d not defined./n",(int) hits[0]);
135 //_____________________________________________________________________________
136 void AliRICH::AddMipHit(Int_t track, Int_t *vol, Float_t *hits)
138 // Adds a mip hit in the RICH.
139 TClonesArray &lhits = *fMips;
140 new(lhits[fNmips++]) AliRICHmip(fIshunt,track,vol,hits,
144 //_____________________________________________________________________________
145 void AliRICH::AddCkovHit(Int_t track, Int_t *vol, Float_t *hits)
148 // Adds a cerenkov hit in the RICH.
150 TClonesArray &lhits = *fCkovs;
151 AliRICHmip *lmip = (AliRICHmip*) fMips->AddrAt(fNmips-1);
153 // If this ckov come from a mip update the mip lastckov entry.
155 if (lmip->GetZ() != -999.0) {
156 fmipslocal = fNmips-1;
157 lmip->SetLastCkov(fNckovs);
159 new(lhits[fNckovs++]) AliRICHckov(fIshunt,track,vol,hits,
160 fmipslocal,fNpadhits);
163 //_____________________________________________________________________________
164 void AliRICH::AddPadHit(Int_t track, Int_t *vol, Float_t *hits)
167 // Adds pad hits in the RICH
169 TClonesArray &lhits = *fPadhits;
170 // Update the last padhit of the respective particle:
171 if ((int) hits[1]==50) { // a ckov
172 ((AliRICHckov *) fCkovs->AddrAt(fNckovs-1))->SetLastpad(fNpadhits);
173 new(lhits[fNpadhits++]) AliRICHpadhit(fIshunt,track,vol,hits,-1,fNckovs-1);
175 ((AliRICHmip *) fMips->AddrAt(fNmips-1))->SetLastpad(fNpadhits);
176 new(lhits[fNpadhits++]) AliRICHpadhit(fIshunt,track,vol,hits,fNmips-1,-1);
180 //_____________________________________________________________________________
181 void AliRICH::BuildGeometry()
184 // Builds a TNode geometry for event display
188 const int kColorRICH = kGreen;
190 Top=gAlice->GetGeometry()->GetNode("alice");
192 new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90);
193 new TRotMatrix("rot994","rot994",90,-20,90,70,0,0);
194 new TRotMatrix("rot995","rot995",90,0,90,90,0,0);
195 new TRotMatrix("rot996","rot996",90,20,90,110,0,0);
196 new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70);
197 new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90);
198 new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110);
199 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
201 Node = new TNode("RICH1","RICH1","S_RICH",0,471.8999,165.2599,"rot993");
202 Node->SetLineColor(kColorRICH);
205 Node = new TNode("RICH2","RICH2","S_RICH",171,470,0,"rot994");
206 Node->SetLineColor(kColorRICH);
209 Node = new TNode("RICH3","RICH3","S_RICH",0,500,0,"rot995");
210 Node->SetLineColor(kColorRICH);
213 Node = new TNode("RICH4","RICH4","S_RICH",-171,470,0,"rot996");
214 Node->SetLineColor(kColorRICH);
217 Node = new TNode("RICH5","RICH5","S_RICH",161.3999,443.3999,-165.3,"rot997");
218 Node->SetLineColor(kColorRICH);
221 Node = new TNode("RICH6","RICH6","S_RICH",0,471.8999,-165.3,"rot998");
222 Node->SetLineColor(kColorRICH);
225 Node = new TNode("RICH7","RICH7","S_RICH",-161.399,443.3999,-165.3,"rot999");
226 Node->SetLineColor(kColorRICH);
230 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
232 // Section for Rich Step
235 static Float_t sVloc[3];
236 static Float_t sVectIn[3];
237 static Float_t sDetot;
238 static Float_t sYanode[MAXPH];
239 static Float_t sXpad[MAXPH];
240 static Float_t sYpad[MAXPH];
247 static Float_t sDpad;
250 static Int_t sNsecon;
251 //static Float_t sQint[2];
256 static Int_t sIpx[MAXSEC];
257 static Int_t sIpy[MAXSEC];
258 static Int_t sIqpad[MAXSEC];
259 static Int_t sNphlink[MAXSEC];
260 static Int_t sNphoton;
262 static Int_t sNfeed, sNfeedd, sNdir;
264 static Float_t sPparent;
265 static Float_t sThincParent;
266 static Int_t sIloss[MAXPH];
267 static Int_t sIprod[MAXPH];
268 static Float_t sXphit[MAXPH];
269 static Float_t sYphit[MAXPH];
271 static Float_t sSycharge;
272 static Float_t sXsox, sYsox, sZsox;
274 static Int_t sMckov[MAXPH];
275 static Int_t idpartgx;
276 static Float_t phisx;
281 static Float_t thetasx;
284 //_____________________________________________________________________________
288 // Initialise RICH after that it has been built
290 const Float_t sconv=2*TMath::Sqrt(2*TMath::Log(2));
291 const Float_t yK3=1.20;
304 for(i=0;i<sNpx;i++) {
308 for(i=0;i<2*sNpy+1;i++) sYanode[i]=ansp/2+i*ansp;
311 sSycharge=4*TMath::ATanH(1/TMath::Sqrt(2*yK3))/TMath::Pi()
312 /(1-0.5*TMath::Sqrt(yK3))/sDpad/sconv;
317 //___________________________________________________________________________
318 void AliRICH::StepManager()
321 // Called at every step in the RICH
324 TGeant3 *geant3 = (TGeant3*) gMC;
326 const Float_t xshift[3] = { 41.3, 0, -41.3 };
327 static Float_t momentum[3];
328 const Int_t nrooth = 25;
330 static Int_t ixold=-1, iyold=-1;
332 // System generated locals
337 Float_t ranf[2], rrhh[nrooth], phiangle, cost, vmod;
353 //Float_t xtrig[200], ytrig[200];
358 // ILOSS = 0 NOT LOST
359 // 1 REFLECTED FREON-QUARZ
360 // 2 REFLECTED QUARZ-METHANE
361 // 3 REFLECTED METHANE-CSI
362 // 11 ABSORBED IN FREON
363 // 12 ABSORBED IN QUARZ
364 // 13 ABSORBED IN METHANE
366 // IPROD = 1 PRODUCED IN FREON
367 // IPROD = 2 PRODUCED IN QUARZ
369 // new (changed NROOTH from 10 to 25!!!!!!!!!!!!!)
372 Int_t *idtmed = fIdtmed->GetArray()-999;
374 //--------------------------------------------------------------------------
378 if (geant3->Gckine()->charge) {
380 // Charged particles treatment
381 if (fIritri && !geant3->Gctrak()->upwght) {
382 if (geant3->Gctmed()->numed == idtmed[fIritri-1]) {
383 if (geant3->Gcking()->ngkine > 0) {
384 strncpy((char *)&lcase,"HADR",4);
385 if (geant3->Gcking()->kcase == lcase) {
386 i1 = geant3->Gcking()->ngkine;
387 for (i = 1; i <= i1; ++i) {
388 gMC->Gmtod(geant3->Gckin3()->gpos[i-1], vxloc, 1);
389 gMC->Gmtod(geant3->Gcking()->gkin[i-1], dir, 2);
390 if (geant3->Gcking()->gkin[i-1][4] == 8. ||
391 geant3->Gcking()->gkin[i-1][4] == 9.) {
393 // Computing 2nd power
395 // Computing 2nd power
397 //theta = TMath::ATan2(TMath::Sqrt(r1*r1+r2*r2),dir[1]);
398 //xtrig[nmult - 1] = theta;
399 //ytrig[nmult - 1] = vxloc[1] + .25;
400 //itrig[nmult - 1] = (Int_t) geant3->Gcking()->gkin[i-1][4];
406 if ((geant3->Gctmed()->numed == idtmed[1006-1] &&
407 geant3->Gctrak()->inwvol == 2) ||
408 geant3->Gctrak()->istop) {
410 printf("NOT TRIGGERED\n");
418 geant3->Gctrak()->istory = 0;
419 geant3->Gctrak()->upwght = 0.;
420 geant3->Gcflag()->ieotri = 1;
425 printf("TRIGGERED %d\n",nmult);
429 // MIP inside Methane
430 if (geant3->Gctmed()->numed == idtmed[1009-1]) {
433 // If particle produced already Cerenkov Photons (istory=1)
434 // update the impact point only
435 if (geant3->Gctrak()->istory == 1) {
436 // Direction of incidence and where did it hit ?
437 gMC->Gmtod(geant3->Gctrak()->vect, sVloc, 1);
438 gMC->Gmtod(&geant3->Gctrak()->vect[3], dir, 2);
439 phiangle = TMath::ATan2(dir[2], dir[0]);
440 if (phiangle < 0.) phiangle += 2*TMath::Pi();
442 for (ll = 0; ll < i1; ++ll) rrhh[ll] = 0;
443 irivol[0] = geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 4];
444 irivol[1] = geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 4];
446 ihitrak = gAlice->CurrentTrack();
448 // flag to say this is update
449 rrhh[1] = sVloc[0] + sDlx;
451 rrhh[2] = sVloc[2] + sDly;
453 rrhh[3] = (Float_t) geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 4];
455 // Computing 2nd power
457 // Computing 2nd power
459 rrhh[4] = TMath::ATan2(TMath::Sqrt(r1 * r1 + r2 * r2), dir[1]);
462 // PRINT *, 'ITRA = ',ITRA,'ISTAK = ',ISTAK
463 AddHit(ihitrak,irivol,rrhh);
466 // Record particle properties
467 // If particle produced already Cerenkov Photons (istory=1)
469 // update the impact point only
470 if (geant3->Gctrak()->istory != 2) {
471 if (!geant3->Gctrak()->istory) {
474 // Is this a primary particle ?
476 //if (geant3->Gctrak()->upwght) iprimx = 0;
478 // Where did it come from ?
479 sXsox = geant3->Gckine()->vert[0];
480 sYsox = geant3->Gckine()->vert[1];
481 sZsox = geant3->Gckine()->vert[2];
484 psx = geant3->Gctrak()->vect[6];
486 // Particle type and parent
487 //idpartsx = geant3->Gckine()->ipart;
488 r1 = geant3->Gctrak()->upwght / 100.;
489 idpartgx = Int_t(r1+0.5);
490 if (!geant3->Gctrak()->upwght) {
491 sPparent = geant3->Gctrak()->vect[6];
492 sThincParent = thetasx;
495 // Direction of incidence and where did it hit ?
496 gMC->Gmtod(geant3->Gctrak()->vect, sVloc, 1);
497 gMC->Gmtod(&geant3->Gctrak()->vect[3], dir, 2);
498 // Computing 2nd power
500 // Computing 2nd power
502 thetasx = TMath::ATan2(TMath::Sqrt(r1 * r1 + r2 * r2), dir[1]);
503 phisx = TMath::ATan2(dir[2], dir[0]);
504 if (phisx < 0.) phisx += 2*TMath::Pi();
505 ysx = sVloc[2] + sDly;
506 xsx = sVloc[0] + sDlx;
507 nmodsx = geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 4];
510 for (ll = 0; ll < i1; ++ll) rrhh[ll] = 0;
511 irivol[0] = geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 4];
513 ihitrak = gAlice->CurrentTrack();
515 // Flag to say this is MIP
516 rrhh[1] = (Float_t) geant3->Gckine()->ipart;
519 rrhh[4] = (Float_t) nmodsx;
522 rrhh[6] = geant3->Gctrak()->tofg;
524 rrhh[7] = (Float_t) idpartgx;
528 // charge of current particle in electron charge unit;
529 rrhh[10] = geant3->Gckine()->charge;
531 // Zo of ckov generation
534 AddHit(ihitrak, irivol, rrhh);
537 // Earmark track as being recorded in methane gap
539 geant3->Gctrak()->istory = 2;
543 // Signal generation in methane gap
544 gMC->Gmtod(geant3->Gctrak()->vect, sVloc, 1);
545 gMC->Gmtod(geant3->Gckine()->vert, vxloc, 1);
546 ix = (Int_t) ((sVloc[0] + sDlx) / sDxp);
547 iy = (Int_t) ((sVloc[2] + sDly) / sDyp);
549 // Is this the first step?
550 if (ixold == -1 && iyold == -1) {
553 for(j=0;j<3;j++) sVectIn[j]=geant3->Gctrak()->vect[j];
557 if (geant3->Gctrak()->inwvol == 2 || geant3->Gctrak()->istop) {
558 sDetot += geant3->Gctrak()->destep;
559 if (sDetot > 0.) RichIntegration();
564 // Mip left current pad
565 } else if (ixold != ix || iyold != iy) {
566 if (sDetot > 0.) RichIntegration();
567 for(j=0;j<3;j++) sVectIn[j]=geant3->Gctrak()->vect[j];
568 sDetot = geant3->Gctrak()->destep;
572 sDetot += geant3->Gctrak()->destep;
577 // End charged particles treatment
579 // Treat photons produced in Freon and Quartz
580 if (geant3->Gckin2()->ngphot > 0 &&
581 (geant3->Gctmed()->numed == idtmed[1004-1] ||
582 geant3->Gctmed()->numed == idtmed[1003-1])) {
583 if (!geant3->Gctrak()->upwght) {
585 // If it is a primary, save all generated photons
586 i1 = geant3->Gckin2()->ngphot;
587 for (i = 1; i <= i1; ++i) {
589 if (sNphoton > MAXPH) {
591 printf("ATTENTION NPHOTON %d\n",sNphoton);
597 if (geant3->Gctmed()->numed == idtmed[1003-1]) medprod = 2;
599 // Production angle and energy
603 cost+=geant3->Gckin2()->xphot[i-1][3+j]*geant3->Gctrak()->vect[3+j];
604 vmod+=geant3->Gckin2()->xphot[i-1][3+j]*
605 geant3->Gckin2()->xphot[i-1][3+j];
608 sIloss[sNphoton - 1] = 22;
609 sIprod[sNphoton - 1] = medprod;
610 sXphit[sNphoton - 1] = 0.;
611 sYphit[sNphoton - 1] = 0.;
612 stwght = geant3->Gctrak()->upwght;
613 geant3->Gctrak()->upwght = (Float_t) sNphoton;
615 momentum[0]=geant3->Gckin2()->xphot[i-1][3]*
616 geant3->Gckin2()->xphot[i-1][6];
617 momentum[1]=geant3->Gckin2()->xphot[i-1][4]*
618 geant3->Gckin2()->xphot[i-1][6];
619 momentum[2]=geant3->Gckin2()->xphot[i-1][5]*
620 geant3->Gckin2()->xphot[i-1][6];
621 gAlice->SetTrack(0, gAlice->CurrentTrack(),
624 geant3->Gckin2()->xphot[i-1], //position
625 &geant3->Gckin2()->xphot[i-1][7], //polarisation
626 geant3->Gckin2()->xphot[i-1][10], //time of flight
628 sMckov[sNphoton - 1] = ncher;
629 geant3->Gctrak()->upwght = stwght;
632 stwght = geant3->Gctrak()->upwght;
633 geant3->Gctrak()->upwght = 0.;
635 geant3->Gctrak()->upwght = stwght;
638 // Particle did not yet pass the methane gap
639 if (geant3->Gctrak()->istory == 0) {
640 geant3->Gctrak()->istory = 1;
642 // Is this a primary particle ?
644 //if (geant3->Gctrak()->upwght) iprimx = 0;
646 // Where did it come from ?
647 sXsox = geant3->Gckine()->vert[0];
648 sYsox = geant3->Gckine()->vert[1];
649 sZsox = geant3->Gckine()->vert[2];
651 // Where did it hit ?
652 gMC->Gmtod(geant3->Gctrak()->vect, sVloc, 1);
653 gMC->Gmtod(&geant3->Gctrak()->vect[3], dir, 2);
654 ysx = sVloc[2] + sDly;
655 if (geant3->Gctmed()->numed == idtmed[1004-1]) {
656 nmodsx = geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 4];
657 xsx = sVloc[0] + sDlx +
658 xshift[geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 2] - 1];
659 } else if (geant3->Gctmed()->numed == idtmed[1003-1]) {
660 nmodsx = geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 3];
661 xsx = sVloc[0] + sDlx;
666 // Momentum and direction of incidence
667 psx = geant3->Gctrak()->vect[6];
668 // Computing 2nd power
670 // Computing 2nd power
672 thetasx = TMath::ATan2(TMath::Sqrt(r1 * r1 + r2 * r2), dir[1]);
673 phisx = TMath::ATan2(dir[2], dir[0]);
674 if (phisx < 0.) phisx += 2*TMath::Pi();
676 // Particle type and parent
677 //idpartsx = geant3->Gckine()->ipart;
678 r1 = geant3->Gctrak()->upwght / 100.;
679 idpartgx = Int_t(r1+0.5);
680 if (!geant3->Gctrak()->upwght) {
681 sPparent = geant3->Gctrak()->vect[6];
682 sThincParent = thetasx;
685 for (ll = 0; ll <nrooth; ++ll) rrhh[ll] = 0;
686 irivol[0] = geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 4];
688 ihitrak = gAlice->CurrentTrack();
690 // Flag to say that this is MIP
691 rrhh[1] = (Float_t) geant3->Gckine()->ipart;
694 rrhh[4] = (Float_t) nmodsx;
697 rrhh[6] = geant3->Gctrak()->tofg;
699 rrhh[7] = (Float_t) idpartgx;
703 // charge of current particle in electron charge unit;
704 rrhh[10] = geant3->Gckine()->charge;
706 // Zo of ckov generation
709 AddHit(ihitrak, irivol, rrhh);
714 // Current particle is cherenkov photon
715 if (geant3->Gckine()->ipart == 50) {
716 gMC->Gmtod(geant3->Gctrak()->vect, sVloc, 1);
717 // WRITE(6,* ) UPWGHT, VLOC(2), NUMED, DESTEP
718 // Photon crosses ch4-csi boundary
719 // take into account fresnel losses with complex refraction index
720 if (geant3->Gctrak()->inwvol == 1 && geant3->Gctmed()->numed == idtmed[1006-1]) {
722 // fresnel losses commented out for the moment
723 // make sure that qe correction for fresnel losses is also switched off !
725 // IF (ISTOP .EQ. 2) RETURN
726 // Put transmission of electrodes in by hand
727 gMC->Gmtod(&geant3->Gctrak()->vect[3], dir, 2);
728 cophi = TMath::Cos(TMath::ATan2(dir[0], dir[1]));
729 t = (1. - .025 / cophi) * (1. - .05 / cophi);
732 if (geant3->Gctrak()->upwght && Int_t(geant3->Gctrak()->upwght+0.5)<MAXPH)
733 sIloss[Int_t(geant3->Gctrak()->upwght+0.5) - 1] = 15;
734 geant3->Gctrak()->istop = 2;
739 // Photon lost energy in CsI
740 if (geant3->Gctrak()->destep > 0. && geant3->Gctmed()->numed == idtmed[1006-1]) {
741 geant3->Gctrak()->istop = 2;
742 r1 = geant3->Gctrak()->upwght / 100.;
743 if (Int_t(r1+0.5) > 50) {
748 // WRITE(6,*) 'PHOTON',UPWGHT, MAXPH
749 if (geant3->Gctrak()->upwght && Int_t(geant3->Gctrak()->upwght+0.5) < MAXPH)
750 sIloss[Int_t(geant3->Gctrak()->upwght+0.5) - 1] = 0;
751 // write(6,*) 'photon detected'
752 for(j=0;j<3;j++) sVectIn[j]=geant3->Gctrak()->vect[j];
754 // copied from miphit in Freon or Quartz
755 // Where did it hit ?
756 gMC->Gmtod(&geant3->Gctrak()->vect[3], dir, 2);
758 // Momentum and direction of incidence
759 for (ll = 0; ll < nrooth; ++ll) rrhh[ll]=0;
760 irivol[0] = geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 4];
762 irivol[1] = geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 4];
764 ihitrak = gAlice->CurrentTrack();
766 // Flag to say that this is CK
767 rrhh[1] = (Float_t) geant3->Gckine()->ipart;
768 rrhh[2] = sVloc[0] + sDlx;
769 rrhh[3] = sVloc[2] + sDly;
770 rrhh[4] = (Float_t) geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 3];
772 // Computing 2nd power
774 // Computing 2nd power
776 rrhh[5] = TMath::ATan2(TMath::Sqrt(r1 * r1 + r2 * r2), dir[1]);
778 rrhh[6] = geant3->Gctrak()->tofg;
780 r1 = geant3->Gctrak()->upwght / 100.;
781 rrhh[7] = (Float_t) Int_t(r1+0.5);
784 rrhh[8] = geant3->Gctrak()->getot;
787 AddHit(ihitrak, irivol, rrhh);
792 if (geant3->Gctrak()->upwght && Int_t(geant3->Gctrak()->upwght+0.5) < MAXPH)
794 // Losses by reflection and absorption and leaving detector
795 if (sIloss[Int_t(geant3->Gctrak()->upwght+0.5) - 1] == 22) {
796 i1 = geant3->Gctrak()->nmec;
797 for (i = 0; i < i1; ++i) {
799 if (geant3->Gctrak()->lmec[i] == 106) {
800 sIloss[Int_t(geant3->Gctrak()->upwght+0.5)-1]=10;
801 if (geant3->Gctmed()->numed == idtmed[1004-1])
802 sIloss[Int_t(geant3->Gctrak()->upwght+0.5)-1]=1;
804 if (geant3->Gctmed()->numed == idtmed[1003-1])
805 sIloss[Int_t(geant3->Gctrak()->upwght+0.5)-1]=2;
808 } else if (geant3->Gctrak()->lmec[i] == 101) {
809 geant3->Gctrak()->istop = 2;
810 sIloss[Int_t(geant3->Gctrak()->upwght+0.5)-1]=20;
811 if (geant3->Gctmed()->numed == idtmed[1004-1])
812 sIloss[Int_t(geant3->Gctrak()->upwght+0.5)-1]=11;
814 if (geant3->Gctmed()->numed == idtmed[1003-1])
815 sIloss[Int_t(geant3->Gctrak()->upwght+0.5)-1]=12;
817 if (geant3->Gctmed()->numed == idtmed[1005-1])
818 sIloss[Int_t(geant3->Gctrak()->upwght+0.5)-1]=13;
820 if (geant3->Gctmed()->numed == idtmed[1009-1])
821 sIloss[Int_t(geant3->Gctrak()->upwght+0.5)-1]=13;
823 if (geant3->Gctmed()->numed == idtmed[1001-1])
824 sIloss[Int_t(geant3->Gctrak()->upwght+0.5)-1]=14;
827 if (geant3->Gctmed()->numed == idtmed[1006-1])
828 sIloss[Int_t(geant3->Gctrak()->upwght+0.5)-1]=16;
831 // Photon goes out of tracking scope
832 } else if (geant3->Gctrak()->lmec[i] == 30)
833 sIloss[Int_t(geant3->Gctrak()->upwght+0.5)-1]=21;
842 //_____________________________________________________________________________
843 void AliRICH::RichIntegration()
846 // Integrates over RICH pads
849 TGeant3 *geant3 = (TGeant3*) gMC;
859 Int_t ixmin, ixmax, iymin, iymax;
864 Float_t y0a, qtot_check, xi1, xi2, yi1, yi2;
866 Int_t ihitrak, modulen;
867 //Int_t isec[MAXSEC];
868 // ILOSS = 0 NOT LOST
869 // 1 REFLECTED FREON-QUARZ
870 // 2 REFLECTED QUARZ-METHANE
871 // 3 REFLECTED METHANE-CSI
872 // 11 ABSORBED IN FREON
873 // 12 ABSORBED IN QUARZ
874 // 13 ABSORBED IN METHANE
876 // IPROD = 1 PRODUCED IN FREON
877 // IPROD = 2 PRODUCED IN QUARZ
878 // get charge for MIP or cherenkov photon
880 if (geant3->Gckine()->ipart == 50) {
882 modulen = geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 3];
886 modulen = geant3->Gcvolu()->number[geant3->Gcvolu()->nlevel - 4];
890 gMC->Gmtod(sVectIn, sVloc, 1);
891 if (TMath::Abs(sVloc[0]) >= sDlx) return;
893 if (TMath::Abs(sVloc[2]) >= sDly) return;
900 ixmin = (Int_t) ((x0 - fSxcharge * 5.) / sDxp) + 1;
901 if (ixmin < 1) ixmin = 1;
902 ixmax = (Int_t) ((x0 + fSxcharge * 5.) / sDxp) + 1;
903 if (ixmax > sNpx) ixmax = sNpx;
904 iymin = (Int_t) ((y0a - sSycharge * 5.) / sDyp) + 1;
905 if (iymin < 1) iymin = 1;
906 iymax = (Int_t) ((y0a + sSycharge * 5.) / sDyp) + 1;
907 if (iymax > sNpy) iymax = sNpy;
910 for (ix = ixmin; ix <= i1; ++ix) {
912 for (iy = iymin; iy <= i2; ++iy) {
913 xi1 = (sXpad[ix - 1] - x0) / sDpad;
914 xi2 = xi1 + sDxp / sDpad;
915 yi1 = (sYpad[iy - 1] - y0a) / sDpad;
916 yi2 = yi1 + sDyp / sDpad;
917 qp = qtot * FMathieson(xi1, xi2) * FMathieson(yi1, yi2);
918 iqp = (Int_t) TMath::Abs(qp);
919 qtot_check += TMath::Abs(qp);
921 // FILL COMMON FOR PADS
928 if (sNpads > MAXSEC) {
929 // write(6,*) 'attention npads',npads
932 sIpx[sNpads - 1] = ix;
933 sIpy[sNpads - 1] = iy;
934 sIqpad[sNpads - 1] = iqp;
935 // TAG THE ORIGIN OF THE CHARGE DEPOSITION
936 r1 = geant3->Gctrak()->upwght / 100.;
937 ifeed = Int_t(r1+0.5);
938 sNphlink[sNpads - 1] = 0;
939 if (geant3->Gckine()->ipart != 50) {
941 //isec[sNpads - 1] = sNsecon;
946 nph = Int_t(geant3->Gctrak()->upwght+0.5);
947 sNphlink[sNpads - 1] = nph;
948 sXphit[nph - 1] = sVloc[0];
949 sYphit[nph - 1] = sVloc[2];
950 //isec[sNpads - 1] = sNsecon + 100;
951 } else if (ifeed == 51) {
952 // FEEDBACK FROM CERENKOV
954 //isec[sNpads - 1] = sNsecon + 300;
955 } else if (ifeed == 52) {
958 //isec[sNpads - 1] = sNsecon + 200;
961 // Generate the hit for Root IO
962 for (ll = 0; ll < 25; ++ll) rrhh[ll] = 0;
966 // Flag to say this is a hit
972 rrhh[6] = (Float_t) idpartgx;
976 rrhh[10] = (Float_t) sIpx[sNpads - 1];
977 rrhh[11] = (Float_t) sIpy[sNpads - 1];
978 rrhh[12] = (Float_t) sIqpad[sNpads - 1];
979 ihitrak = gAlice->CurrentTrack();
980 if (sNphlink[sNpads - 1] > 0) {
982 rrhh[14] = sThincParent;
983 rrhh[15] = (Float_t) sIloss[nph - 1];
984 rrhh[16] = (Float_t) sIprod[nph - 1];
985 rrhh[17] = sXphit[nph - 1];
986 rrhh[18] = sYphit[nph - 1];
987 ihitrak = sMckov[nph - 1];
989 // This is the current position of the hit
990 rrhh[19] = geant3->Gctrak()->vect[0];
991 rrhh[20] = geant3->Gctrak()->vect[1];
992 rrhh[21] = geant3->Gctrak()->vect[2];
994 // PRINT *,'RXAHIT(oldhit)=[',RRHH(20),',',RRHH(21),',',
996 // PRINT *, 'ITRA = ',ITRA,'ISTAK = ',ISTAK
997 AddHit(ihitrak, irivol, rrhh);
999 for (ll = 0; ll < 25; ++ll) rrhh[ll] = 0;
1001 rrhh[1] = (Float_t) geant3->Gckine()->ipart;
1002 rrhh[2] = (Float_t) sIpx[sNpads - 1];
1003 rrhh[3] = (Float_t) sIpy[sNpads - 1];
1004 rrhh[4] = (Float_t) modulen;
1007 rrhh[6] = (Float_t) sIqpad[sNpads - 1];
1008 AddHit(ihitrak, irivol, rrhh);
1013 // IF (IPART .NE. 50) WRITE(6,*) 'CHECK',QTOT,QTOT_CHECK
1015 // GENERATE FEEDBACK PHOTONS
1017 source[0] = x0 - sDlx;
1018 source[1] = sVloc[1] - .2;
1019 source[2] = y0a - sDly;
1020 gMC->Gdtom(source, source, 1);
1021 FeedBack(source, qtot);
1025 //_____________________________________________________________________________
1026 void AliRICH::AnodicWires(Float_t &y0a)
1029 // Position of anodic wires
1035 Float_t ass_i, y0, ass_i1;
1039 i1 = (sNpy << 1) + 1;
1040 for (i = 1; i <= i1; ++i) {
1041 if (y0 > sYanode[i - 1] && y0 <= sYanode[i]) {
1042 ass_i1 = TMath::Abs(sYanode[i] - y0);
1043 ass_i = TMath::Abs(sYanode[i - 1] - y0);
1044 if (ass_i1 <= ass_i) y0a = sYanode[i];
1045 if (ass_i1 > ass_i) y0a = sYanode[i - 1];
1051 //_____________________________________________________________________________
1052 void AliRICH::GetChargeMip(Float_t &qtot)
1055 // Calculates the charge deposited by a MIP
1066 // NUMBER OF ELECTRONS
1068 nel = (Int_t) (sDetot * 1e9 / 26.);
1072 for (i = 1; i <= i1; ++i) {
1074 qtot -= fChslope * TMath::Log(ranf[0]);
1078 //_____________________________________________________________________________
1079 void AliRICH::GetCharge(Float_t &qtot)
1089 qtot = -fChslope * TMath::Log(ranf[0]);
1092 //_____________________________________________________________________________
1093 void AliRICH::FeedBack(Float_t *source, Float_t qtot)
1096 // Generate FeedBack photons
1099 TGeant3 *geant3 = (TGeant3*) gMC;
1105 Float_t cthf, ranf[2], phif, enfp = 0, sthf;
1107 Float_t e1[3], e2[3], e3[3];
1108 Float_t vmod, uswop;
1110 Float_t dir[3], phi;
1112 Float_t pol[3], supwght;
1114 // DETERMINE NUMBER OF FEEDBACK PHOTONS
1117 fp = fAlphaFeed * qtot;
1118 nfp = gRandom->Poisson(fp);
1122 geant3->Gckin2()->ngphot = 0;
1124 for (i = 1; i <= i1; ++i) {
1128 cthf = ranf[0] * 2. - 1.;
1129 if (cthf < 0.) continue;
1130 sthf = TMath::Sqrt((1. - cthf) * (cthf + 1.));
1131 phif = ranf[1] * 2 * TMath::Pi();
1132 ++geant3->Gckin2()->ngphot;
1133 if (geant3->Gckin2()->ngphot > 800) {
1134 printf("ATTENTION NGPHOT ! %d %f %d\n",
1135 geant3->Gckin2()->ngphot,fp,nfp);
1141 geant3->Gckin2()->xphot[geant3->Gckin2()->ngphot-1][j]=source[j];
1144 gMC->Rndm(&random, 1);
1145 if (random <= .57) {
1147 } else if (random > .57 && random <= .7) {
1149 } else if (random > .7) {
1152 geant3->Gckin2()->xphot[geant3->Gckin2()->ngphot-1][6] = enfp;
1153 dir[0] = sthf * TMath::Sin(phif);
1155 dir[2] = sthf * TMath::Cos(phif);
1156 gMC->Gdtom(dir, &geant3->Gckin2()->xphot[geant3->Gckin2()->ngphot-1][3], 2);
1172 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
1173 if (!vmod) for(j=0;j<3;j++) {
1179 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
1180 if (!vmod) for(j=0;j<3;j++) {
1187 for(j=0;j<3;j++) vmod+=e1[j]*e1[j];
1188 vmod=TMath::Sqrt(1/vmod);
1189 for(j=0;j<3;j++) e1[j]*=vmod;
1192 for(j=0;j<3;j++) vmod+=e2[j]*e2[j];
1193 vmod=TMath::Sqrt(1/vmod);
1194 for(j=0;j<3;j++) e2[j]*=vmod;
1197 phi = ranf[0] * 2 * TMath::Pi();
1198 r1 = TMath::Sin(phi);
1199 r2 = TMath::Cos(phi);
1200 for(j=0;j<3;j++) pol[j]=e1[j]*r1+e2[j]*r2;
1201 gMC->Gdtom(pol, &geant3->Gckin2()->xphot[geant3->Gckin2()->ngphot-1][7], 2);
1204 geant3->Gckin2()->xphot[geant3->Gckin2()->ngphot-1][10] = 0.;
1206 // PUT PHOTON ON THE STACK AND LABEL IT AS FEEDBACK (51,52)
1207 supwght = geant3->Gctrak()->upwght;
1208 r1 = geant3->Gctrak()->upwght / 100.;
1209 ifeed = Int_t(r1+0.5);
1211 if (geant3->Gckine()->ipart == 50 && ifeed != 52) {
1212 geant3->Gctrak()->upwght = 5100.;
1214 geant3->Gctrak()->upwght = 5200.;
1216 geant3->Gskpho(geant3->Gckin2()->ngphot);
1217 geant3->Gctrak()->upwght = supwght;
1220 geant3->Gckin2()->ngphot = 0;
1223 //_____________________________________________________________________________
1224 Float_t AliRICH::FMathieson(Float_t lambda1, Float_t lambda2)
1227 // Mathieson charge distribution
1229 // CALCULATES INTEGRAL OF GATTI/MATHIESON CHARGE DISTRIBUTION
1230 // FOR CPC AND CSC CHAMBERS
1231 // INTEGRATION LIMITS LAMBDA1,LAMBDA2= X/D WHERE D IS THE ANODE CATHODE
1233 // K3: GEOMETRY PARAMETER
1236 // const Float_t k1=0.2828;
1237 const Float_t k2=0.962;
1238 const Float_t k3=0.6;
1239 const Float_t k4=0.379;
1240 const Float_t sqrtk3=TMath::Sqrt(k3);
1243 u1 = tanh(lambda1 * k2) * sqrtk3;
1244 u2 = tanh(lambda2 * k2) * sqrtk3;
1246 return (atan(u2) - atan(u1)) * 2 * k4;
1251 //_____________________________________________________________________________
1252 void AliRICH::UpdateMipHit(Float_t *hits)
1255 // Update some parameters when the current mip hits the detector.
1257 TClonesArray &lhits = *fMips;
1258 AliRICHmip *lmip = (AliRICHmip *) lhits.AddrAt(fNmips-1);
1259 lmip->SetX ( hits[1]);
1260 lmip->SetY ( hits[2]);
1261 lmip->SetModule((int) hits[3]);
1262 lmip->SetTheta ( hits[4]);
1263 lmip->SetPhi ( hits[5]);
1266 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1268 //_____________________________________________________________________________
1269 void AliRICH::MakeBranch(Option_t *option)
1272 // Create a new branch in the current Root Tree.
1273 // The branch of fHits is automatically split
1275 AliDetector::MakeBranch(option);
1277 Int_t buffersize = 4000;
1278 if (gAlice->TreeH()) {
1280 gAlice->TreeH()->Branch("RICHmip",&fMips, buffersize);
1281 printf("Making Branch %s for mips\n","RICHmip");
1284 gAlice->TreeH()->Branch("RICHckov",&fCkovs, buffersize);
1285 printf("Making Branch %s for ckovs\n","RICHckov");
1288 gAlice->TreeH()->Branch("RICHpadhit",&fPadhits, buffersize);
1289 printf("Making Branch %s for padhits\n","RICHpadhit");
1294 //_____________________________________________________________________________
1295 void AliRICH::SetTreeAddress()
1298 // Set branch address for the Hits and Digits Tree.
1300 AliDetector::SetTreeAddress();
1302 TTree *treeH = gAlice->TreeH();
1305 branch = treeH->GetBranch("RICHmip");
1306 if (branch) branch->SetAddress(&fMips);
1309 branch = treeH->GetBranch("RICHckov");
1310 if (branch) branch->SetAddress(&fCkovs);
1313 branch = treeH->GetBranch("RICHpadhit");
1314 if (branch) branch->SetAddress(&fPadhits);
1319 //_____________________________________________________________________________
1320 void AliRICH::ResetHits()
1323 // Reset number of mips and the mips array for RICH
1325 AliDetector::ResetHits();
1327 if (fMips) fMips->Clear();
1328 // Reset number of Ckovs and the Ckovs array for RICH
1330 if (fCkovs) fCkovs->Clear();
1331 // Reset number of Padhits and the Padhits array for RICH
1333 if (fPadhits) fPadhits->Clear();
1336 //_____________________________________________________________________________
1337 Int_t AliRICH::DistancetoPrimitive(Int_t , Int_t )
1340 // Distance from mouse RICH on the display
1346 //_____________________________________________________________________________
1347 void AliRICH::PreTrack()
1350 // Called before transporting a track
1361 //_____________________________________________________________________________
1362 void AliRICH::Streamer(TBuffer &R__b)
1365 // Stream an object of class AliRICH.
1367 if (R__b.IsReading()) {
1368 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
1369 AliDetector::Streamer(R__b);
1373 R__b >> fMips; //diff
1374 R__b >> fCkovs; //diff
1375 R__b >> fPadhits; //diff
1381 R__b.WriteVersion(AliRICH::IsA());
1382 AliDetector::Streamer(R__b);
1386 R__b << fMips; //diff
1387 R__b << fCkovs; //diff
1388 R__b << fPadhits; //diff
1398 ///////////////////////////////////////////////////////////////////////////////
1400 // Ring Imaging Cherenkov //
1401 // This class contains version 1 of the Ring Imaging Cherenkov //
1405 <img src="picts/AliRICHv1Class.gif">
1409 ///////////////////////////////////////////////////////////////////////////////
1411 //_____________________________________________________________________________
1412 AliRICHv1::AliRICHv1() : AliRICH()
1415 // Default Constructor RICH for version 1
1419 //_____________________________________________________________________________
1420 AliRICHv1::AliRICHv1(const char *name, const char *title)
1421 : AliRICH(name,title)
1424 // Standard constructor for RICH version 1
1428 //_____________________________________________________________________________
1429 AliRICHv1::~AliRICHv1()
1432 // Standard destructor for RICH version 1
1436 //_____________________________________________________________________________
1437 void AliRICHv1::CreateGeometry()
1440 // Create the geometry for RICH version 1
1442 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
1443 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
1444 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
1448 <img src="picts/AliRICHv1.gif">
1453 <img src="picts/AliRICHv1Tree.gif">
1458 Int_t *idtmed = fIdtmed->GetArray()-999;
1465 // --- Define the RICH detector
1466 // External aluminium box
1470 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
1472 // Sensitive part of the whole RICH
1476 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
1482 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
1488 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
1494 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
1496 // Spacers (cylinders)
1500 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
1506 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
1508 // Frame of opaque quartz
1512 gMC->Gsvolu("OQUF", "BOX ", idtmed[1007], par, 3);
1514 // Little bar of opaque quartz
1518 gMC->Gsvolu("BARR", "BOX ", idtmed[1007], par, 3);
1524 gMC->Gsvolu("FREO", "BOX ", idtmed[1003], par, 3);
1530 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
1536 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
1542 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
1548 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
1550 // --- Places the detectors defined with GSVOLU
1551 // Place material inside RICH
1552 gMC->Gspos("SRIC", 1, "RICH", 0., 0., 0., 0, "ONLY");
1554 gMC->Gspos("ALUM", 1, "SRIC", 0., -6.075, 0., 0, "ONLY");
1555 gMC->Gspos("HONE", 1, "SRIC", 0., -5.862, 0., 0, "ONLY");
1556 gMC->Gspos("ALUM", 2, "SRIC", 0., -5.649, 0., 0, "ONLY");
1557 gMC->Gspos("OQUA", 1, "SRIC", 0., -5.424, 0., 0, "ONLY");
1559 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
1561 for (i = 1; i <= 9; ++i) {
1562 zs = (5 - i) * 14.4;
1563 gMC->Gspos("SPAC", i, "FREO", 6.7, 0., zs, idrotm[1019], "ONLY");
1565 for (i = 10; i <= 18; ++i) {
1566 zs = (14 - i) * 14.4;
1567 gMC->Gspos("SPAC", i, "FREO", -6.7, 0., zs, idrotm[1019], "ONLY");
1570 gMC->Gspos("FREO", 1, "OQUF", 0., 0., 0., 0, "ONLY");
1571 gMC->Gspos("OQUF", 1, "SRIC", 41.3, -4.724, 0., 0, "ONLY");
1572 gMC->Gspos("OQUF", 2, "SRIC", 0., -4.724, 0., 0, "ONLY");
1573 gMC->Gspos("OQUF", 3, "SRIC", -41.3, -4.724, 0., 0, "ONLY");
1574 gMC->Gspos("BARR", 1, "QUAR", 0., 0., -21.65, 0, "ONLY");
1575 gMC->Gspos("BARR", 2, "QUAR", 0., 0., 21.65, 0, "ONLY");
1576 gMC->Gspos("QUAR", 1, "SRIC", 0., -3.974, 0., 0, "ONLY");
1577 gMC->Gspos("GAP ", 1, "META", 0., 4.8, 0., 0, "ONLY");
1578 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
1579 gMC->Gspos("CSI ", 1, "SRIC", 0., 6.526, 0., 0, "ONLY");
1581 // Place RICH inside ALICE apparatus
1583 AliMatrix(idrotm[1000], 90., 0., 70.69, 90., 19.31, -90.);
1584 AliMatrix(idrotm[1001], 90., -20., 90., 70., 0., 0.);
1585 AliMatrix(idrotm[1002], 90., 0., 90., 90., 0., 0.);
1586 AliMatrix(idrotm[1003], 90., 20., 90., 110., 0., 0.);
1587 AliMatrix(idrotm[1004], 90., 340., 108.2, 70., 18.2, 70.);
1588 AliMatrix(idrotm[1005], 90., 0., 109.31, 90., 19.31, 90.);
1589 AliMatrix(idrotm[1006], 90., 20., 108.2, 110., 18.2, 110.);
1591 gMC->Gspos("RICH", 1, "ALIC", 0., 471.9, 165.26, idrotm[1000], "ONLY");
1592 gMC->Gspos("RICH", 2, "ALIC", 171., 470., 0., idrotm[1001], "ONLY");
1593 gMC->Gspos("RICH", 3, "ALIC", 0., 500., 0., idrotm[1002], "ONLY");
1594 gMC->Gspos("RICH", 4, "ALIC", -171., 470., 0., idrotm[1003], "ONLY");
1595 gMC->Gspos("RICH", 5, "ALIC", 161.4, 443.4, -165.3, idrotm[1004], "ONLY");
1596 gMC->Gspos("RICH", 6, "ALIC", 0., 471.9, -165.3, idrotm[1005], "ONLY");
1597 gMC->Gspos("RICH", 7, "ALIC", -161.4, 443.4, -165.3, idrotm[1006], "ONLY");
1601 //_____________________________________________________________________________
1602 void AliRICHv1::DrawModule()
1605 // Draw a shaded view of the Ring Imaging Cherenkov
1608 TGeant3 *geant3 = (TGeant3*) gMC;
1610 // Set everything unseen
1611 gMC->Gsatt("*", "seen", -1);
1613 // Set ALIC mother transparent
1614 gMC->Gsatt("ALIC","SEEN",0);
1616 // Set the volumes visible
1618 gMC->Gsatt("RICH","seen",0);
1619 gMC->Gsatt("SRIC","seen",0);
1620 gMC->Gsatt("HONE","seen",1);
1621 gMC->Gsatt("ALUM","seen",1);
1622 gMC->Gsatt("QUAR","seen",1);
1623 gMC->Gsatt("SPAC","seen",1);
1624 gMC->Gsatt("OQUA","seen",1);
1625 gMC->Gsatt("OQUF","seen",1);
1626 gMC->Gsatt("BARR","seen",1);
1627 gMC->Gsatt("FREO","seen",1);
1628 gMC->Gsatt("META","seen",1);
1629 gMC->Gsatt("GAP ","seen",1);
1630 gMC->Gsatt("CSI ","seen",1);
1631 gMC->Gsatt("GRID","seen",1);
1634 geant3->Gdopt("hide", "on");
1635 geant3->Gdopt("shad", "on");
1636 geant3->Gsatt("*", "fill", 7);
1637 geant3->SetClipBox(".");
1638 geant3->Gdopt("hide", "on");
1639 geant3->Gdopt("shad", "on");
1640 geant3->Gsatt("*", "fill", 7);
1641 geant3->SetClipBox(".");
1642 // geant3->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
1643 geant3->DefaultRange();
1644 gMC->Gdraw("alic", 60, 50, 0, 10, 0, .03, .03);
1645 geant3->Gdhead(1111, "Ring Imaging Cherenkov version 1");
1646 geant3->Gdman(16, 6, "MAN");
1647 geant3->Gdopt("hide", "off");
1650 //_____________________________________________________________________________
1651 void AliRICHv1::CreateMaterials()
1654 // *** DEFINITION OF AVAILABLE RICH MATERIALS ***
1655 // ORIGIN : NICK VAN EIJNDHOVEN
1656 // Modified by: N. Colonna (INFN - BARI, Nicola.Colonna@ba.infn.it)
1657 // R.A. Fini (INFN - BARI, Rosanna.Fini@ba.infn.it)
1658 // R.A. Loconsole (Bari University, loco@riscom.ba.infn.it)
1660 Int_t ISXFLD = gAlice->Field()->Integ();
1661 Float_t SXMGMX = gAlice->Field()->Max();
1663 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,
1664 6.7e-9,6.88e-9,7.08e-9,7.3e-9,7.51e-9,7.74e-9,8e-9 };
1665 Float_t rindex_quarz[14] = { 1.528309,1.533333,
1666 1.538243,1.544223,1.550568,1.55777,
1667 1.565463,1.574765,1.584831,1.597027,
1668 1.611858,1.6277,1.6472,1.6724 };
1669 Float_t rindex_quarzo[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1670 Float_t rindex_methane[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1671 Float_t rindex_gri[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1672 Float_t absco_freon[14] = { 179.0987,179.0987,
1673 179.0987,179.0987,179.0987,35.7,12.54,5.92,4.92,3.86,1.42,.336,.134,0. };
1674 Float_t absco_quarz[14] = { 20.126,16.27,13.49,11.728,9.224,8.38,7.44,7.17,
1675 6.324,4.483,1.6,.323,.073,0. };
1676 Float_t absco_quarzo[14] = { 1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,1e-5,
1677 1e-5,1e-5,1e-5,1e-5,1e-5 };
1678 Float_t absco_csi[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1679 1e-4,1e-4,1e-4,1e-4 };
1680 Float_t absco_methane[14] = { 1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,1e6,
1682 Float_t absco_gri[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
1683 1e-4,1e-4,1e-4,1e-4 };
1684 Float_t effic_all[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1685 Float_t effic_csi[14] = { 4.74e-4,.00438,.009,.0182,.0282,.0653,.1141,.163,
1686 .2101,.2554,.293,.376,.3861,.418 };
1687 Float_t effic_gri[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
1689 Float_t afre[2], agri, amet[2], aqua[2], ahon, zfre[2], zgri, zhon,
1693 Int_t nlmatmet, nlmatqua;
1694 Float_t wmatquao[2], rindex_freon[14];
1696 Float_t aquao[2], epsil, stmin, zquao[2];
1698 Float_t radlal, densal, tmaxfd, deemax, stemax;
1699 Float_t aal, zal, radlgri, densfre, radlhon, densgri, denshon,densqua, densmet, wmatfre[2], wmatmet[2], wmatqua[2];
1701 Int_t *idtmed = fIdtmed->GetArray()-999;
1703 TGeant3 *geant3 = (TGeant3*) gMC;
1705 // --- Photon energy (GeV)
1706 // --- Refraction indexes
1707 for (i = 0; i < 14; ++i) {
1708 rindex_freon[i] = ppckov[i] * .01095 * 1e9 + 1.2177;
1710 // need to be changed
1712 // --- Absorbtion lenghts (in cm)
1713 // DATA ABSCO_QUARZ /
1715 // & 29.85, 7.34, 4.134, 1.273, 0.722,
1716 // & 0.365, 0.365, 0.365, 0. /
1717 // need to be changed
1719 // --- Detection efficiencies (quantum efficiency for CsI)
1720 // --- Define parameters for honeycomb.
1721 // Used carbon of equivalent rad. lenght
1728 // --- Parameters to include in GSMIXT, relative to Quarz (SiO2)
1739 // --- Parameters to include in GSMIXT, relative to opaque Quarz (SiO2)
1750 // --- Parameters to include in GSMIXT, relative to Freon (C6F14)
1761 // --- Parameters to include in GSMIXT, relative to methane (CH4)
1772 // --- Parameters to include in GSMIXT, relative to anode grid (Cu)
1779 // --- Parameters to include in GSMATE related to aluminium sheet
1786 AliMaterial(1, "Air $", 14.61, 7.3, .001205, 30420., 67500);
1787 AliMaterial(6, "HON", ahon, zhon, denshon, radlhon, 0);
1788 AliMaterial(16, "CSI", ahon, zhon, denshon, radlhon, 0);
1789 AliMixture(20, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
1790 AliMixture(21, "QUAO", aquao, zquao, densquao, nlmatquao, wmatquao);
1791 AliMixture(30, "FRE", afre, zfre, densfre, nlmatfre, wmatfre);
1792 AliMixture(40, "MET", amet, zmet, densmet, nlmatmet, wmatmet);
1793 AliMixture(41, "METG", amet, zmet, densmet, nlmatmet, wmatmet);
1794 AliMaterial(11, "GRI", agri, zgri, densgri, radlgri, 0);
1795 AliMaterial(50, "ALUM", aal, zal, densal, radlal, 0);
1803 AliMedium(1, "DEFAULT MEDIUM AIR$", 1, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1804 AliMedium(2, "HONEYCOMB$", 6, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1805 AliMedium(3, "QUARZO$", 20, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1806 AliMedium(4, "FREON$", 30, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1807 AliMedium(5, "METANO$", 40, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1808 AliMedium(6, "CSI$", 16, 1, ISXFLD, SXMGMX,tmaxfd, stemax, deemax, epsil, stmin);
1809 AliMedium(7, "GRIGLIA$", 11, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1810 AliMedium(8, "QUARZOO$", 21, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1811 AliMedium(9, "GAP$", 41, 1, ISXFLD, SXMGMX,tmaxfd, .1, -deemax, epsil, -stmin);
1812 AliMedium(10, "ALUMINUM$", 50, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1815 // Switch on delta-ray production in the methane and freon gaps
1817 gMC->Gstpar(idtmed[1002], "LOSS", 1.);
1818 gMC->Gstpar(idtmed[1003], "LOSS", 1.);
1819 gMC->Gstpar(idtmed[1004], "LOSS", 1.);
1820 gMC->Gstpar(idtmed[1008], "LOSS", 1.);
1821 gMC->Gstpar(idtmed[1005], "LOSS", 1.);
1822 gMC->Gstpar(idtmed[1002], "HADR", 1.);
1823 gMC->Gstpar(idtmed[1003], "HADR", 1.);
1824 gMC->Gstpar(idtmed[1004], "HADR", 1.);
1825 gMC->Gstpar(idtmed[1008], "HADR", 1.);
1826 gMC->Gstpar(idtmed[1005], "HADR", 1.);
1827 gMC->Gstpar(idtmed[1002], "DCAY", 1.);
1828 gMC->Gstpar(idtmed[1003], "DCAY", 1.);
1829 gMC->Gstpar(idtmed[1004], "DCAY", 1.);
1830 gMC->Gstpar(idtmed[1008], "DCAY", 1.);
1831 gMC->Gstpar(idtmed[1005], "DCAY", 1.);
1832 geant3->Gsckov(idtmed[1000], 14, ppckov, absco_methane, effic_all, rindex_methane);
1833 geant3->Gsckov(idtmed[1001], 14, ppckov, absco_methane, effic_all, rindex_methane);
1834 geant3->Gsckov(idtmed[1002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);
1835 geant3->Gsckov(idtmed[1003], 14, ppckov, absco_freon, effic_all,rindex_freon);
1836 geant3->Gsckov(idtmed[1004], 14, ppckov, absco_methane, effic_all, rindex_methane);
1837 geant3->Gsckov(idtmed[1005], 14, ppckov, absco_csi, effic_csi, rindex_methane);
1838 geant3->Gsckov(idtmed[1006], 14, ppckov, absco_gri, effic_gri, rindex_gri);
1839 geant3->Gsckov(idtmed[1007], 14, ppckov, absco_quarzo, effic_all, rindex_quarzo);
1840 geant3->Gsckov(idtmed[1008], 14, ppckov, absco_methane, effic_all, rindex_methane);
1841 geant3->Gsckov(idtmed[1009], 14, ppckov, absco_gri, effic_gri, rindex_gri);
1844 ClassImp(AliRICHhit)
1846 //_____________________________________________________________________________
1847 AliRICHhit::AliRICHhit(Int_t shunt, Int_t track, Int_t *vol,
1848 Float_t *hits, Int_t fNpadhits) :
1852 // Standard constructor for RICH hit
1855 for (i=0;i<2;i++) fVolume[i] = vol[i];
1856 fTrack = (int) track;
1858 fPart = (int) hits[ 1];
1859 //AliHit information, position of the hit
1863 fFirstpad = fNpadhits;
1864 fLastpad = fNpadhits-1;
1867 fModule = (int) hits[ 4];
1869 fArrivaltime= hits[ 6];
1870 fFeed = (int) hits[ 7];
1873 ClassImp(AliRICHmip)
1875 //_____________________________________________________________________________
1876 AliRICHmip::AliRICHmip(Int_t shunt, Int_t track, Int_t *vol,
1877 Float_t *hits, Int_t fNckovs, Int_t fNpadhits) :
1878 AliRICHhit(shunt,track,vol,hits,fNpadhits)
1881 // Standard constructor for RICH Mip hit
1888 if ((int) hits[12]){
1889 fFirstCkov = fNckovs;
1890 fLastCkov = fNckovs-1;
1897 ClassImp(AliRICHckov)
1899 //_____________________________________________________________________________
1900 AliRICHckov::AliRICHckov(Int_t shunt, Int_t track, Int_t *vol,
1901 Float_t *hits, Int_t fNmips, Int_t fNpadhits) :
1902 AliRICHhit(shunt,track,vol,hits,fNpadhits)
1905 // Standard creator for RICH Cherenkov information
1908 fStop = (int) hits[9];
1914 ClassImp(AliRICHpadhit)
1917 //_____________________________________________________________________________
1918 AliRICHpadhit::AliRICHpadhit(Int_t shunt, Int_t track, Int_t *vol,
1919 Float_t *hits, Int_t fNmips, Int_t fNckovs):
1923 // Standard constructor for RICH pad hit
1926 for (i=0;i<2;i++) fVolume[i] = vol[i];
1929 fX = (int) hits[ 2];
1930 fY = (int) hits[ 3];
1931 fModule = (int) hits[ 4];
1932 fParentMip = fNmips;
1933 fParentCkov = fNckovs;
1934 fProd = (int) hits[ 5];
1936 fZ = -999.0; // Not implemented