2 #include "gearimpl/Util.h"
3 #include "gearxml/GearXML.h"
4 #include "gear/GearMgr.h"
7 #include "geartgeo/TGeoGearDistanceProperties.h"
8 #include "geartgeo/TGeoGearPointProperties.h"
21 using namespace gear ;
25 void gear_unexpected(){
31 }
catch( std::exception& e) {
33 std::cout <<
" A runtime error has occured : "
36 <<
" the program will have to be terminated - sorry." << std::endl ;
43 Vector3D pointOnCylinder(
double theta,
double r,
double z,
double phi= __PHI0 ) ;
51 int main(
int argc,
char**argv){
54 std::set_terminate( gear_unexpected ) ;
57 std::cout <<
" testgear: Testprogram for gear classes. " << std::endl
58 <<
" usage: testgear input.xml " << std::endl ;
62 std::string fileName( argv[1] ) ;
66 GearMgr* gearMgr = gearXML.createGearMgr() ;
71 double r_in = tpcparams.
getDoubleVal(
"tpcInnerRadius")/10.;
72 double r_o = tpcparams.
getDoubleVal(
"tpcOuterRadius")/10.;
73 double wall_o = tpcparams.
getDoubleVal(
"tpcOuterWallThickness")/10.;
75 double Rtpc_i = r_in ;
77 double Rtpc_o_inner = r_o - wall_o ;
81 double Recal_i = ecalparamsB.
getExtent()[0]/10. - 3.0 ;
85 double Zecal=ecalparamsEC.
getExtent()[2]/10;
115 double thetaMin = 0. ;
116 double thetaMax = M_PI/2. ;
121 double dTheta = ( thetaMax - thetaMin ) / N ;
126 std::cerr <<
" ************** VXD cylinder r = " << ro_VXD <<
", z = " << zo_VXD << std::endl ;
127 std::cerr <<
" ************** SIT cylinder r = " << Rtpc_i <<
", z = " << Zecal << std::endl ;
128 std::cerr <<
" ************** TPC inner cylinder r = " << Rtpc_o_inner <<
", z = " << Ztpc_inner << std::endl ;
129 std::cerr <<
" ************** TPC cylinder r = " << Rtpc_o <<
", z = " << Zecal << std::endl ;
130 std::cerr <<
" ************** SET cylinder r = " << Recal_i <<
", z = " << Zecal << std::endl ;
135 std::cout <<
"itheta/d:theta/d:eta/d:nrvxd:nrsit/d:nrtpc_i/d:nrtpc/d:nrset/d:nrecal/d" << std::endl ;
137 for(
int i= 0 ; i < N ; ++i ) {
138 double theta = thetaMin + i * dTheta ;
143 double eta = ( theta == 0.0 ? 0. : - log( tan( theta / 2. ) ) );
144 double iTheta = theta / M_PI * 180 ;
150 double nrVXD = distProp.
getNRadlen( ip , pointOnCylinder( theta , ro_VXD , zo_VXD ) ) ;
152 double nrSIT = distProp.
getNRadlen( ip , pointOnCylinder( theta , Rtpc_i , Zecal ) ) ;
154 double nrTPC_i = distProp.
getNRadlen( ip , pointOnCylinder( theta , Rtpc_o_inner , Ztpc_inner ) ) ;
156 double nrTPC = distProp.
getNRadlen( ip , pointOnCylinder( theta , Rtpc_o , Zecal ) ) ;
158 double nrSET = distProp.
getNRadlen( ip , pointOnCylinder( theta , Recal_i , Zecal ) ) ;
164 double ecalL1_r = ( 1.85020000e+03 ) / 10. ;
165 double ecalL1_z = ( 2.45717250e+03 ) / 10. ;
167 gear::Vector3D ecalL1Point = pointOnCylinder( theta , ecalL1_r , ecalL1_z ) ;
169 if( ecalL1Point.
z() > 2.350000000e+03/10. ){
171 ecalL1Point =
Vector3D( ecalL1_z * tan( theta ) , __PHI0 , ecalL1_z , Vector3D::cylindrical ) ;
175 double nrECal = distProp.
getNRadlen( ip , ecalL1Point ) ;
182 gear::Vector3D dir = pointOnCylinder( theta , Recal_i , Zecal ) - ip ;
183 dir = ( 1. / dir.
r() ) * dir ;
186 std::vector<std::string> names =
187 distProp.
getMaterialNames( ip , pointOnCylinder( theta , Recal_i , Zecal ) ) ;
189 std::vector<double> radl ;
191 std::vector<double> thicks =
196 std::cerr <<
" ################################# materials between the two points : \n "
197 << ip <<
"\n" << pointOnCylinder( theta , Recal_i , Zecal )
198 <<
" theta " << theta * 180. /3.141592 <<
"\n"
199 <<
" dir vector " << dir <<
"\n"
200 <<
" ############################################################# "
205 for(
unsigned j=0 ; j < names.size() ; ++j){
207 lambda += thicks[j] ;
210 double rL = distProp.
getNRadlen( ip , local ) ;
212 std::cerr <<
" ------ " << names[j] <<
" - " << thicks[j] <<
" cm - "
221 std::cout << iTheta <<
" "
238 Vector3D pointOnCylinder(
double theta,
double r,
double z,
double phi){
240 double theta0 = atan2( r, z ) ;
247 Vector3D( r , phi , r / tan( theta ) , Vector3D::cylindrical ) :
248 Vector3D( z * tan( theta ) , phi , z , Vector3D::cylindrical ) ) ;
virtual double getShellOuterRadius() const =0
The outer radius of the support shell in mm.
Geometry properties of a vertex detector needed for reconstruction code.
virtual const TPCParameters & getTPCParameters() const =0
Get the TPCParameters.
Proposal for an abstract interface that defines the geometry properties of a TPC like detector needed...
virtual const ZPlanarParameters & getVXDParameters() const =0
Get the VXD parameters.
virtual double getNRadlen(const Vector3D &p0, const Vector3D &p1) const
The number of radiation lengths along the distance between [p0,p1] .
virtual const std::vector< std::string > & getMaterialNames(const Vector3D &p0, const Vector3D &p1) const
List of matrial names along the distance between [p0,p1]- WARNING: this method returns a reference to...
virtual const GearDistanceProperties & getDistanceProperties() const =0
Get the distance properties object.
Proposal for an abstract interface that defines geometry properties of a typical sampling calorimeter...
TGeo Implementation of the abstract interface that returns the (material) properties along a given di...
virtual double getShellGap() const =0
The length of the gap in mm (gap position at z=0)
virtual const std::vector< double > & getExtent() const =0
Extent of the calorimeter in the r-z-plane [ rmin, rmax, zmin, zmax ] in mm.
Implementation of GEAR using XML.
Simple three dimensional vector providing the components for cartesian, cylindrical and spherical coo...
virtual const std::vector< double > & getMaterialThicknesses(const Vector3D &p0, const Vector3D &p1) const
List of matrial thicknesses in mm along the distance between [p0,p1] - runs parallel to the array ret...
double z()
Cartesian cartesian z coordinate.
virtual const CalorimeterParameters & getEcalBarrelParameters() const =0
Get the Ecal barrel parameters.
virtual double getShellHalfLength() const =0
The half length (z) of the support shell in mm (w/o gap).
double r() const
Spherical r/magnitude.
Abstract interface for a manager class that returns the Gear classes for the relevant subdetectors...
virtual const CalorimeterParameters & getEcalEndcapParameters() const =0
Get the Ecal endcap parameters.
virtual double getMaxDriftLength() const =0
The maximum drift length in the TPC in mm.
virtual double getDoubleVal(const std::string &key) const =0
Double value for key.