1 |
#ifndef PAMVMCTRKF77_H |
2 |
#define PAMVMCTRKF77_H |
3 |
|
4 |
#define grndmc GRNDMC |
5 |
#define gmtod GMTODC |
6 |
#define gdtom GDTOMC |
7 |
#define gufield GUFIELD |
8 |
#define errfcc ERRFCC |
9 |
#define vzeroi VZEROI |
10 |
#define vzeroc VZEROC |
11 |
|
12 |
#include <iostream> |
13 |
|
14 |
using std::cout; |
15 |
using std::endl; |
16 |
#include <TGeoManager.h> |
17 |
#include <TGeoMatrix.h> |
18 |
#include <TVirtualMC.h> |
19 |
#include <TRandom.h> |
20 |
#include <TMath.h> |
21 |
#include "PamVMCFieldMgr.h" |
22 |
#include "PamVMCRndMgr.h" |
23 |
extern "C"{ |
24 |
void grndmc_(Float_t*, Int_t& ); |
25 |
void gmtodc_(Float_t* , Float_t* , Int_t& ); |
26 |
void gdtomc_(Float_t* , Float_t* , Int_t& ); |
27 |
void gufield_(Float_t*, Float_t*); |
28 |
void errfcc_(Float_t&, Float_t&); |
29 |
void vzeroi_(Int_t*,Int_t&); |
30 |
void vzeroc_(Float_t*, Int_t&); |
31 |
} |
32 |
|
33 |
void grndmc_(Float_t* r, Int_t& n){ |
34 |
for (Int_t i=0; i<n; i++){ |
35 |
r[i] = (Float_t)PamVMCRndMgr::Instance()->GenRandom("TRKEXT"); |
36 |
} |
37 |
} |
38 |
|
39 |
void gmtodc_(Float_t* a, Float_t* b, Int_t& c){ |
40 |
Double_t master[3]; |
41 |
Double_t local[3]; |
42 |
|
43 |
for (Int_t i=0; i<3; ++i) master[i] = (Double_t) a[i]; |
44 |
|
45 |
Double_t * m = &master[0]; |
46 |
Double_t * l = &local[0]; |
47 |
|
48 |
gGeoManager->MasterToLocal(m,l); |
49 |
|
50 |
//cout<<"MasterToLocal"<<endl; |
51 |
for (Int_t i=0; i<3; ++i){ |
52 |
//cout<<master[i]<<" "<<local[i]<<endl; |
53 |
b[i] = (Float_t)local[i]; |
54 |
} |
55 |
c=c; |
56 |
} |
57 |
|
58 |
|
59 |
void gdtomc_(Float_t* a, Float_t* b, Int_t& c){ |
60 |
Double_t master[3]; |
61 |
Double_t local[3]; |
62 |
|
63 |
for (Int_t i=0; i<3; ++i) local[i] = (Double_t)a[i]; |
64 |
|
65 |
Double_t * m = &master[0]; |
66 |
Double_t * l = &local[0]; |
67 |
|
68 |
gGeoManager->LocalToMaster(l,m); |
69 |
|
70 |
//cout<<"LocalToMaster"<<endl; |
71 |
for (Int_t i=0; i<3; ++i) { |
72 |
//cout<<" "<<local[i]<<" "<<master[i]<<endl; |
73 |
b[i] = (Float_t)master[i]; |
74 |
} |
75 |
c=c; |
76 |
} |
77 |
|
78 |
void gufield_(Float_t *x, Float_t *b){ |
79 |
PamVMCFieldMgr::Instance()->Field(x,b); |
80 |
} |
81 |
|
82 |
void errfcc_(Float_t& in, Float_t& out){ |
83 |
out = (Float_t)TMath::Erfc(in); |
84 |
} |
85 |
|
86 |
void vzeroi_(Int_t* arr,Int_t& n){ |
87 |
for(Int_t i=0; i<n; i++) arr[i] = 0; |
88 |
} |
89 |
|
90 |
void vzeroc_(Float_t* arr,Int_t& n){ |
91 |
for(Int_t i=0; i<n; i++) arr[i] = 0.; |
92 |
} |
93 |
|
94 |
#endif //PamVMCTrkF77.h |