GetMedium replaced by CurrentMedium (I.Hrivnacova)
[u/mrichter/AliRoot.git] / RICH / AliRICHv0.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 #include "AliRICHv0.h"
17 #include "AliRICHChamber.h" 
18 #include <AliRun.h>
19 #include <AliMC.h>
20 #include <TVirtualMC.h>
21 #include <TPDGCode.h>
22 #include <TLorentzVector.h>
23 #include <TMath.h>
24
25 #include <TGeoManager.h>
26
27 ClassImp(AliRICHv0)
28
29 void AliRICHv0::StepManager()
30 {
31 //This StepManager is a provision for different test-learn activities on the current MC layer  
32   static Int_t iStepN;
33   const char *sParticle;
34   switch(gMC->TrackPid()){
35     case kProton:      sParticle="proton"    ;break;
36     case kNeutron:     sParticle="neutron"   ;break;
37     case kGamma:       sParticle="gamma"     ;break;
38     case kCerenkov:    sParticle="photon"    ;break;
39     case kPi0:         sParticle="Pi0"       ;break;  
40     case kPiPlus:      sParticle="Pi+"       ;break;  
41     case kPiMinus:     sParticle="Pi-"       ;break;  
42     case kElectron:    sParticle="electron"  ;break;  
43     default:           sParticle="not known" ;break;
44   }
45
46   Info(Form("Step %i",iStepN),"event=%i hunt=%i tid=%i pid=%i(%s) m=%f q=%3.1f dEdX=%9.3f",
47                             gMC->CurrentEvent(),
48                             fIshunt,
49                             gAlice->GetMCApp()->GetCurrentTrackNumber(),
50                             gMC->TrackPid(),
51                             sParticle,
52                             gMC->TrackMass(),
53                             gMC->TrackCharge(),
54                             gMC->Edep()*1e9);
55   Info("Flags","alive(%i) disap(%i) enter(%i) exit(%i) inside(%i) out(%i) stop(%i) new(%i)",
56                             gMC->IsTrackAlive(),
57                             gMC->IsTrackDisappeared(),
58                             gMC->IsTrackEntering(),
59                             gMC->IsTrackExiting(),
60                             gMC->IsTrackInside(),
61                             gMC->IsTrackOut(),
62                             gMC->IsTrackStop(),
63                             gMC->IsNewTrack());
64   Int_t copy0=0,copy1=0,copy2=0,copy3=0;
65   Int_t vid0=gMC->CurrentVolID(copy0);
66   Int_t vid1=gMC->CurrentVolOffID(1,copy1);
67   Int_t vid2=gMC->CurrentVolOffID(2,copy2);
68   Int_t vid3=gMC->CurrentVolOffID(3,copy3);
69   Info("Volumes","vid0=%i(%s)c%i vid1=%i(%s)c%i vid2=%i(%s)c%i vid3=%i(%s)c%i   %s-%s-%s-%s",
70                       vid0,gMC->VolName(vid0),copy0, 
71                       vid1,gMC->VolName(vid1),copy1, 
72                       vid2,gMC->VolName(vid2),copy2, 
73                       vid3,gMC->VolName(vid3),copy3, 
74                       gMC->CurrentVolName(),
75                       gMC->CurrentVolOffName(1),
76                       gMC->CurrentVolOffName(2),
77                       gMC->CurrentVolOffName(3));
78   
79   Float_t a,z,den,rad,abs; a=z=den=rad=abs=-1;
80   Int_t mid=gMC->CurrentMaterial(a,z,den,rad,abs);
81   Info("Material","id=%i a=%7.2f z=%7.2f den=%9.4f rad=%9.2f abs=%9.2f",mid,a,z,den,rad,abs);
82   
83   Int_t iTmedId=gMC->CurrentMedium();
84   const char *sTmed;
85   switch(iTmedId){
86     case kAir:        sTmed="Air"      ;break;
87     case kRoha:       sTmed="Rohacell" ;break;
88     case kSiO2:       sTmed="SiO2"     ;break;
89     case kC6F14:      sTmed="C6F14"    ;break;
90     case kGridCu:     sTmed="GridCu"   ;break;
91     case kOpSiO2:     sTmed="OpSiO2"   ;break;
92     case kGap:        sTmed="Gap"      ;break;
93     case kGlass:      sTmed="Glass"    ;break;
94     case kCu:         sTmed="Cu"       ;break;
95     case kSteel:      sTmed="Steel"    ;break;
96     case kPerpex:     sTmed="Perpex"   ;break;
97     case kCH4:        sTmed="CH4"      ;break;
98     case kCsI:        sTmed="CsI"      ;break;
99     case kAl:         sTmed="Al"       ;break;
100     case kW:          sTmed="W"        ;break;
101     default:          sTmed="not known";break;
102   }
103   Info("Medium","id=%i (%s)",iTmedId,sTmed);
104   
105   TLorentzVector x4; gMC->TrackPosition(x4);
106   Float_t glo[3],loc[3];
107   glo[0]=x4.X();glo[1]=x4.Y();glo[2]=x4.Z();  
108   gMC->Gmtod(glo,loc,1);
109   Info("X4 glo","(x,y,z)=(%+8.3f,%+8.3f,%+8.3f) (r,theta,phi)=(%8.3f,%8.3f,%8.3f)",
110                       glo[0],glo[1],glo[2],x4.Rho(),x4.Theta()*TMath::RadToDeg(),x4.Phi()*TMath::RadToDeg());  
111   Info("X4 loc","(x,y,z)=(%+8.3f,%+8.3f,%8.3f) by gMC->Gmtod()",loc[0],loc[1],loc[2]);  
112   static Int_t idGAP = gMC->VolId("GAP ");
113   if(idGAP==gMC->CurrentVolID(copy0)){
114     Int_t iChamber;
115     gMC->CurrentVolOffID(2,iChamber);
116     TVector2 x2=C(iChamber)->Mrs2Pc(x4);
117     Info("X4 loc","(%+8.3f,%+8.3f) by Mrs2Pc",      x2.X(),x2.Y());  
118   }
119   Info(Form("Step %i",iStepN++),"end of current step\n");
120 }//StepManager()