]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHv1.cxx
protection against truncated data
[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)
3582c1f9 31//__________________________________________________________________________________________________
d128c9d1 32void AliRICHv1::StepManager()
53fd478b 33{
34//Full Step Manager
d128c9d1 35
ed3ceb24 36 Int_t copy;
c60862bf 37 static Int_t iCurrentChamber;
3582c1f9 38
39//Treat photons
40 static TLorentzVector cerX4;
41 if((gMC->TrackPid()==kCerenkov||gMC->TrackPid()==kFeedback)&&gMC->CurrentVolID(copy)==gMC->VolId("CSI ")){//photon in CSI
42 if(gMC->Edep()>0.){//CF+CSI+DE
43 if(IsLostByFresnel()){ gMC->StopTrack(); return;}
44 gMC->TrackPosition(cerX4); gMC->CurrentVolOffID(2,iCurrentChamber);
c60862bf 45
3582c1f9 46 AddHit(iCurrentChamber,gAlice->GetMCApp()->GetCurrentTrackNumber(),cerX4.Vect(),cerX4.Vect());//HIT for PHOTON in conditions CF+CSI+DE
47 GenerateFeedbacks(iCurrentChamber);
48 }//CF+CSI+DE
ed3ceb24 49 }//CF in CSI
50
51//Treat charged particles
52 static Float_t eloss;
3582c1f9 53 static TLorentzVector mipInX4,mipOutX4;
ed3ceb24 54 if(gMC->TrackCharge() && gMC->CurrentVolID(copy)==gMC->VolId("GAP ")){//MIP in GAP
3582c1f9 55 gMC->CurrentVolOffID(3,iCurrentChamber);
56 if(gMC->IsTrackEntering()||gMC->IsNewTrack()) {//MIP in GAP entering or newly created
ed3ceb24 57 eloss=0;
af3d25a6 58 gMC->TrackPosition(mipInX4);
3582c1f9 59 }else if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared()){//MIP in GAP exiting or disappeared
ed3ceb24 60 eloss+=gMC->Edep();//take into account last step dEdX
af3d25a6 61 gMC->TrackPosition(mipOutX4);
3582c1f9 62 AddHit(iCurrentChamber,gAlice->GetMCApp()->GetCurrentTrackNumber(),mipInX4.Vect(),mipOutX4.Vect(),eloss);//HIT for MIP: MIP in GAP Exiting
ed3ceb24 63 GenerateFeedbacks(iCurrentChamber,eloss);//MIP+GAP+Exit
64 }else//MIP in GAP going inside
65 eloss += gMC->Edep();
66 }//MIP in GAP
3582c1f9 67}//StepManager()
68//__________________________________________________________________________________________________
69Bool_t AliRICHv1::IsLostByFresnel()
ed3ceb24 70{
3582c1f9 71 TLorentzVector p4;
72 Double_t mom[3],localMom[3];
73 gMC->TrackMomentum(p4); mom[0]=p4(0); mom[1]=p4(1); mom[2]=p4(2); mom[3]=p4(3);
74 gMC->Gmtod(mom,localMom,2);
75 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
76 Double_t localTheta = TMath::ATan2(TMath::Sqrt(localTc),localMom[1]);
77 Double_t cotheta = TMath::Abs(TMath::Cos(localTheta));
78 if(gMC->GetRandom()->Rndm() < Fresnel(p4.E()*1e9,cotheta,1)){
79 if(GetDebug()) Info("IsLostByFresnel","");
80 return kTRUE;
81 }else
82 return kFALSE;
83}//IsLostByFresnel()
84//__________________________________________________________________________________________________