]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHv1.cxx
Corrections to obey the coding conventions
[u/mrichter/AliRoot.git] / RICH / AliRICHv1.cxx
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 // **************************************************************************
15
16
17 #include "AliRICHv1.h"
18 #include "AliRICHParam.h"
19 #include "AliRICHChamber.h"
20 #include <TParticle.h> 
21 #include <TRandom.h> 
22 #include <TVirtualMC.h>
23 #include <TPDGCode.h>
24
25 #include <AliConst.h>
26 #include <AliPDG.h>
27 #include <AliRun.h>
28 #include <AliMC.h>
29
30 ClassImp(AliRICHv1)    
31 //______________________________________________________________________________
32 void AliRICHv1::StepManager()
33 {
34 //Full Step Manager
35
36   Int_t          copy;
37   static Int_t   iCurrentChamber;
38   static TLorentzVector x4,p4,mipInX4,mipOutX4;
39   Float_t        pos[3],mom[4],localPos[3],localMom[4];
40   Float_t        coscerenkov;
41        
42   TParticle *current = (TParticle*)(*gAlice->GetMCApp()->Particles())[gAlice->GetMCApp()->GetCurrentTrackNumber()];
43  
44   Float_t cherenkovLoss=0;
45     
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?
50                     
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();
58                                 
59                       }//C+E+produced in Freon
60                   } //track entering?
61     }//C+E
62   }//C
63     
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;
70         
71         gMC->Gmtod(pos,localPos,1);     gMC->Gmtod(mom,localMom,2);
72
73         cherenkovLoss  += gMC->Edep();
74                     
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();
79                         
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;
88         }
89         AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),x4.Vect());//HIT for PHOTON in conditions CF+CSI+DE
90         GenerateFeedbacks(iCurrentChamber,cherenkovLoss);//CF+CSI+DE
91       }//CF+CSI+DE
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;
98     if(gMC->IsTrackEntering()||gMC->IsNewTrack()) {//MIP in GAP Entering
99       eloss=0;                                                           
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();
108   }//MIP in GAP
109 }//void AliRICHv1::StepManager()
110
111 Bool_t AliRICHv1::IsFresnelLoss()
112 {
113   return kFALSE;
114 }