4 #include <Geant4/G4VPhysicalVolume.hh>
5 #include <Geant4/G4ThreeVector.hh>
6 #include <Geant4/G4Tubs.hh>
24 _neta(neta), _minEta(minEta), _maxEta(maxEta),
25 _nphi(nphi), _startPhi(startPhi), _deltaPhi(deltaPhi),
26 _radiusIn(radiusIn), _radiusOut(radiusOut),
29 if ( _maxEta < _minEta )
31 std::cout <<
" invalid eta, max<min"
32 <<
" etamin: " << _minEta
33 <<
" etamax: " << _maxEta
38 if ( (_radiusIn<0.0) || (_radiusOut<0.0) || (_radiusOut<_radiusIn) )
40 std::cout <<
" invalid radius parameters:"
41 <<
" radiusIn: " << radiusIn
42 <<
" radiusOut: " << radiusOut
47 double totalEta = _maxEta - _minEta;
48 double dEta = totalEta / _neta;
49 for(
unsigned int i=0; i<neta; i++)
52 double etaMin = _minEta + dEta * i;
53 double etaMax = etaMin + dEta;
56 double zmin = _centerZ + _radiusIn * std::sinh(etaMin);
57 double zmax = _centerZ + _radiusIn * std::sinh(etaMax);
59 double zpos = (zmin+zmax)/2.0;
60 double zhalf = (zmax-zmin)/2.0;
61 _zpos.push_back(zpos);
62 _zhalf.push_back(zhalf);
65 for(
unsigned int i=0; i<_nphi; i++)
67 _phi0.push_back(_startPhi+i*_deltaPhi);
68 _phi1.push_back(_startPhi+(i+1)*_deltaPhi);
73 for(
unsigned int i=0; i<_neta*_nphi; i++)
75 div_t q = div((
int)i, (
int)_nphi);
78 _ieta.push_back(ieta);
79 _iphi.push_back(iphi);
85 std::cout <<
"PHG4EtaPhiParameterization::~PHG4EtaPhiParameterization: Alas, poor Yorick! I knew him, Horatio"
92 os <<
"PhiEtaPhiParameterization: NETA x NPHI = " << _neta <<
" x " << _nphi << std::endl;
94 std::copy(_zpos.begin(),_zpos.end(),std::ostream_iterator<double>(os,
" "));
97 std::copy(_phi0.begin(),_phi0.end(),std::ostream_iterator<double>(os,
" "));
100 std::copy(_phi0.begin(),_phi0.end(),std::ostream_iterator<double>(os,
" "));
107 int iring = copyNo/_nphi;
108 G4ThreeVector origin(0,0,_zpos.at(iring));
109 physVol->SetTranslation(origin);
110 physVol->SetRotation(0);
115 const G4VPhysicalVolume*)
const
119 double phi = _phi0.at(iphi);
120 double dphi = _phi1.at(iphi) - phi;
121 ring.SetZHalfLength(_zhalf.at(ieta));
122 ring.SetInnerRadius(_radiusIn);
123 ring.SetOuterRadius(_radiusOut);
124 ring.SetStartPhiAngle(phi);
125 ring.SetDeltaPhiAngle(dphi);
void ComputeDimensions(G4Tubs &ring, const G4int copyNo, const G4VPhysicalVolume *physVol) const
void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const
virtual void Print(std::ostream &os=std::cout) const
int GetIPhi(int copyNo) const
virtual ~PHG4EtaPhiParameterization()
int GetIEta(int copyNo) const
PHG4EtaPhiParameterization(unsigned int neta, double minEta, double maxEta, unsigned int nphi, double startPhi, double deltaPhi, double radiusIn, double radiusOut, double centerZ)