]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHv1.cxx
22-dec-2003 NvE Event selection introduced in AliCollider.
[u/mrichter/AliRoot.git] / RICH / AliRICHv1.cxx
CommitLineData
53fd478b 1// **************************************************************************
2// * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3// * *
4// * Author: The ALICE Off-line Project. *
5// * Contributors are mentioned in the code where appropriate. *
6// * *
7// * Permission to use, copy, modify and distribute this software and its *
8// * documentation strictly for non-commercial purposes is hereby granted *
9// * without fee, provided that the above copyright notice appears in all *
10// * copies and that both the copyright notice and this permission notice *
11// * appear in the supporting documentation. The authors make no claims *
12// * about the suitability of this software for any purpose. It is *
13// * provided "as is" without express or implied warranty. *
14// **************************************************************************
c28632f0 15
c28632f0 16
53fd478b 17#include "AliRICHv1.h"
18#include "AliRICHParam.h"
19#include "AliRICHChamber.h"
237c933d 20#include <TParticle.h>
88cb7938 21#include <TRandom.h>
88cb7938 22#include <TVirtualMC.h>
d128c9d1 23#include <TPDGCode.h>
c28632f0 24
c60862bf 25#include <AliConst.h>
26#include <AliPDG.h>
27#include <AliRun.h>
5d12ce38 28#include <AliMC.h>
c28632f0 29
d128c9d1 30ClassImp(AliRICHv1)
31//______________________________________________________________________________
d128c9d1 32void AliRICHv1::StepManager()
53fd478b 33{
34//Full Step Manager
d128c9d1 35
ed3ceb24 36 Int_t copy;
c60862bf 37 static Int_t iCurrentChamber;
af3d25a6 38 static TLorentzVector x4,p4,mipInX4,mipOutX4;
c60862bf 39 Float_t pos[3],mom[4],localPos[3],localMom[4];
c60862bf 40 Float_t coscerenkov;
d128c9d1 41
5d12ce38 42 TParticle *current = (TParticle*)(*gAlice->GetMCApp()->Particles())[gAlice->GetMCApp()->GetCurrentTrackNumber()];
d128c9d1 43
c60862bf 44 Float_t cherenkovLoss=0;
d128c9d1 45
c60862bf 46 if(gMC->TrackPid()==kCerenkov){//C
47 Float_t ckovEnergy = current->Energy();
48 if(ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 ){//C+E
c60862bf 49 if(gMC->IsTrackEntering()){ //is track entering?
d128c9d1 50
c60862bf 51 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)){ //is it in csi?
c60862bf 52 gMC->TrackMomentum(p4); mom[0]=p4(0); mom[1]=p4(1); mom[2]=p4(2); mom[3]=p4(3);
d128c9d1 53 gMC->Gmtod(mom,localMom,2);
ed3ceb24 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();
d128c9d1 58
ed3ceb24 59 }//C+E+produced in Freon
d128c9d1 60 } //track entering?
c60862bf 61 }//C+E
62 }//C
d128c9d1 63
ed3ceb24 64 if((gMC->TrackPid()==kCerenkov||gMC->TrackPid()==kFeedback)&&gMC->CurrentVolID(copy)==gMC->VolId("CSI ")){//photon in CSI
c60862bf 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);
ed3ceb24 68 if(IsFresnelLoss()){ gMC->StopTrack(); return;}
69 gMC->CurrentVolOffID(2,copy);iCurrentChamber=copy;
c60862bf 70
71 gMC->Gmtod(pos,localPos,1); gMC->Gmtod(mom,localMom,2);
d128c9d1 72
ed3ceb24 73 cherenkovLoss += gMC->Edep();
d128c9d1 74
c60862bf 75 AliRICHhit *mipHit = (AliRICHhit*) (fHits->UncheckedAt(0));
76 if(mipHit){
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();
d128c9d1 79
c60862bf 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);
84 if((rt*mipRt) > 0)
85 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
86 else
87 coscerenkov = 0;
c60862bf 88 }
ed3ceb24 89 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),x4.Vect());//HIT for PHOTON in conditions CF+CSI+DE
90 GenerateFeedbacks(iCurrentChamber,cherenkovLoss);//CF+CSI+DE
c60862bf 91 }//CF+CSI+DE
ed3ceb24 92 }//CF in CSI
93
94//Treat charged particles
95 static Float_t eloss;
96 if(gMC->TrackCharge() && gMC->CurrentVolID(copy)==gMC->VolId("GAP ")){//MIP in GAP
97 gMC->CurrentVolOffID(3,copy); iCurrentChamber=copy;
af3d25a6 98 if(gMC->IsTrackEntering()||gMC->IsNewTrack()) {//MIP in GAP Entering
ed3ceb24 99 eloss=0;
af3d25a6 100 gMC->TrackPosition(mipInX4);
101 }else if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared()){//MIP in GAP Exiting
ed3ceb24 102 eloss+=gMC->Edep();//take into account last step dEdX
af3d25a6 103 gMC->TrackPosition(mipOutX4);
104 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),mipInX4.Vect(),mipOutX4.Vect(),eloss);//HIT for MIP for conditions: MIP in GAP Exiting
ed3ceb24 105 GenerateFeedbacks(iCurrentChamber,eloss);//MIP+GAP+Exit
106 }else//MIP in GAP going inside
107 eloss += gMC->Edep();
108 }//MIP in GAP
d128c9d1 109}//void AliRICHv1::StepManager()
ed3ceb24 110
111Bool_t AliRICHv1::IsFresnelLoss()
112{
113 return kFALSE;
114}