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 // **************************************************************************
17 #include "AliRICHv1.h"
18 #include "AliRICHParam.h"
19 #include "AliRICHChamber.h"
20 #include <TParticle.h>
22 #include <TVirtualMC.h>
31 //______________________________________________________________________________
32 void AliRICHv1::StepManager()
37 static Int_t iCurrentChamber;
38 static TLorentzVector x4,p4,mipInX4,mipOutX4;
39 Float_t pos[3],mom[4],localPos[3],localMom[4];
42 TParticle *current = (TParticle*)(*gAlice->GetMCApp()->Particles())[gAlice->GetMCApp()->GetCurrentTrackNumber()];
44 Float_t cherenkovLoss=0;
46 if(gMC->TrackPid()==kCerenkov){//C
47 Float_t ckovEnergy = current->Energy();
48 if(ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 ){//C+E
49 if(gMC->IsTrackEntering()){ //is track entering?
51 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)){ //is it in csi?
52 gMC->TrackMomentum(p4); mom[0]=p4(0); mom[1]=p4(1); mom[2]=p4(2); mom[3]=p4(3);
53 gMC->Gmtod(mom,localMom,2);
54 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
55 Double_t localTheta = TMath::ATan2(TMath::Sqrt(localTc),localMom[1]);
56 Double_t cotheta = TMath::Abs(TMath::Cos(localTheta));
57 if(gMC->GetRandom()->Rndm() < Fresnel(p4.E()*1e9,cotheta,1)) gMC->StopTrack();
59 }//C+E+produced in Freon
64 if((gMC->TrackPid()==kCerenkov||gMC->TrackPid()==kFeedback)&&gMC->CurrentVolID(copy)==gMC->VolId("CSI ")){//photon in CSI
65 if(gMC->Edep()>0.){//CF+CSI+DE
66 gMC->TrackPosition(x4); pos[0]=x4(0); pos[1]=x4(1); pos[2]=x4(2);
67 gMC->TrackMomentum(p4); mom[0]=p4(0); mom[1]=p4(1); mom[2]=p4(2); mom[3]=p4(3);
68 if(IsFresnelLoss()){ gMC->StopTrack(); return;}
69 gMC->CurrentVolOffID(2,copy);iCurrentChamber=copy;
71 gMC->Gmtod(pos,localPos,1); gMC->Gmtod(mom,localMom,2);
73 cherenkovLoss += gMC->Edep();
75 AliRICHhit *mipHit = (AliRICHhit*) (fHits->UncheckedAt(0));
77 mom[0] = current->Px(); mom[1] = current->Py(); mom[2] = current->Pz();
78 Float_t mipPx = mipHit->MomX(); Float_t mipPy = mipHit->MomY(); Float_t mipPz = mipHit->MomZ();
80 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
81 Float_t rt = TMath::Sqrt(r);
82 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
83 Float_t mipRt = TMath::Sqrt(mipR);
85 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
89 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),x4.Vect());//HIT for PHOTON in conditions CF+CSI+DE
90 GenerateFeedbacks(iCurrentChamber,cherenkovLoss);//CF+CSI+DE
94 //Treat charged particles
96 if(gMC->TrackCharge() && gMC->CurrentVolID(copy)==gMC->VolId("GAP ")){//MIP in GAP
97 gMC->CurrentVolOffID(3,copy); iCurrentChamber=copy;
98 if(gMC->IsTrackEntering()||gMC->IsNewTrack()) {//MIP in GAP Entering
100 gMC->TrackPosition(mipInX4);
101 }else if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared()){//MIP in GAP Exiting
102 eloss+=gMC->Edep();//take into account last step dEdX
103 gMC->TrackPosition(mipOutX4);
104 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),mipInX4.Vect(),mipOutX4.Vect(),eloss);//HIT for MIP for conditions: MIP in GAP Exiting
105 GenerateFeedbacks(iCurrentChamber,eloss);//MIP+GAP+Exit
106 }else//MIP in GAP going inside
107 eloss += gMC->Edep();
109 }//void AliRICHv1::StepManager()
111 Bool_t AliRICHv1::IsFresnelLoss()