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 ;
24 void gear_unexpected(){
30 }
catch( std::exception& e) {
32 std::cout <<
" A runtime error has occured : "
35 <<
" the program will have to be terminated - sorry." << std::endl ;
42 Vector3D pointOnCylinder(
double theta,
double r,
double z,
double phi=0.02 ) ;
49 dir = ( 1. / dir.
r() ) * dir ;
52 std::vector<std::string> names =
55 std::vector<double> radl ;
57 std::vector<double> thicks =
62 std::cerr <<
" ################################# materials between the two points : \n "
63 << start <<
"\n" << point
64 <<
" dir vector " << dir <<
"\n"
65 <<
" ############################################################# "
70 for(
unsigned j=0 ; j < names.size() ; ++j){
75 double rL = distProp.
getNRadlen( start, local ) ;
76 double iL = distProp.
getNIntlen( start, local ) ;
78 std::cerr <<
" ------ " << names[j] <<
" r: " << lambda <<
" - " << thicks[j] <<
" cm - " << rL <<
" - iL: " << iL
83 std::cerr <<
"\n ================================================================================\n \n " ;
100 int main(
int argc,
char**argv){
103 std::set_terminate( gear_unexpected ) ;
106 std::cout <<
" testgear: Testprogram for gear classes. " << std::endl
107 <<
" usage: testgear input.xml " << std::endl ;
111 std::string fileName( argv[1] ) ;
115 GearMgr* gearMgr = gearXML.createGearMgr() ;
129 float Cos12 = cos(M_PI/12.0);
130 float Cos16 = cos(M_PI/16.);
133 double Recal_i = ecalparamsB.
getExtent()[0]/10. ;
134 double Recal_o = ecalparamsB.
getExtent()[1]/10. ;
138 double Zecal_i=ecalparamsEC.
getExtent()[2]/10;
139 double Zecal_o=ecalparamsEC.
getExtent()[3]/10;
142 double Rhcal_i = hcalparamsB.
getExtent()[0]/10. ;
143 double Rhcal_o = hcalparamsB.
getExtent()[1]/10. ;
146 double Zhcal_i=hcalparamsEC.
getExtent()[2]/10;
147 double Zhcal_o=hcalparamsEC.
getExtent()[3]/10;
150 double Zcoil_o = parCoil.
getDoubleVal(
"Coil_cryostat_inner_cyl_half_z" )/10 ;
151 double Rcoil_i = parCoil.
getDoubleVal(
"Coil_cryostat_inner_cyl_inner_radius" )/10 ;
152 double Rcoil_o = parCoil.
getDoubleVal(
"Coil_cryostat_inner_cyl_outer_radius" )/10 ;
155 double Ryoke_i = yokeparamsB.
getExtent()[0]/10. ;
156 double Ryoke_o = yokeparamsB.
getExtent()[1]/10. ;
159 double Zyoke_o=yokeparamsEC.
getExtent()[3]/10;
161 double Zyoke_i=yokeplug.
getExtent()[2]/10;
168 Recal_o = ( Recal_o + Rhcal_i ) / 2. ;
169 Zecal_o = ( Zecal_o + Zhcal_i ) / 2. ;
171 Rhcal_o = ( Rhcal_o + Rcoil_i ) / 2. ;
172 Zhcal_o = ( Zhcal_o + Zyoke_i ) / 2. ;
174 Rcoil_o = ( Rcoil_o + Ryoke_i ) / 2. ;
203 double thetaMin = 0. ;
204 double thetaMax = M_PI/2. ;
209 double dTheta = ( thetaMax - thetaMin ) / N ;
215 std::cerr <<
" ************** SET cylinder r = " << Recal_i <<
", z = " << Zecal_i << std::endl ;
216 std::cerr <<
" ************** Ecal cylinder r = " << Recal_o <<
", z = " << Zecal_o << std::endl ;
217 std::cerr <<
" ************** Hcal cylinder r = " << Rhcal_o <<
", z = " << Zhcal_o << std::endl ;
218 std::cerr <<
" ************** Coil cylinder r = " << Rcoil_o <<
", z = " << Zcoil_o << std::endl ;
219 std::cerr <<
" ************** Yoke cylinder r = " << Ryoke_o <<
", z = " << Zyoke_o << std::endl ;
225 std::cout <<
"iTheta/d:theta/d:eta/d:nilSET/d:nilEcal/d:nilHcal/d:nilCoil/d:nilYoke/d" << std::endl ;
227 for(
int i= 0 ; i < N ; ++i ) {
228 double theta = thetaMin + i * dTheta ;
233 double eta = ( theta == 0.0 ? 0. : - log( tan( theta / 2. ) ) );
234 double iTheta = theta / M_PI * 180 ;
239 Vector3D pSET = pointOnCylinder( theta , Recal_i , Zecal_i ) ;
240 Vector3D pEcal = pointOnCylinder( theta , Recal_o , Zecal_o ) ;
241 Vector3D pHcal = pointOnCylinder( theta , Rhcal_o , Zhcal_o ) ;
242 Vector3D pCoil = pointOnCylinder( theta , Rcoil_o, Zcoil_o ) ;
243 Vector3D pYoke = pointOnCylinder( theta , Ryoke_o , Zyoke_o ) ;
245 double nilSET = distProp.
getNIntlen( ip , pSET ) ;
246 double nilEcal = distProp.
getNIntlen( ip , pEcal ) ;
247 double nilHcal = distProp.
getNIntlen( ip , pHcal ) ;
248 double nilCoil = distProp.
getNIntlen( ip , pCoil ) ;
249 double nilYoke = distProp.
getNIntlen( ip , pYoke ) ;
253 printMaterial( distProp , pSET , pEcal ) ;
254 printMaterial( distProp , pEcal , pHcal ) ;
255 printMaterial( distProp , pHcal , pCoil ) ;
256 printMaterial( distProp , pCoil , pYoke ) ;
291 std::cout << iTheta <<
" "
309 Vector3D pointOnCylinder(
double theta,
double r,
double z,
double phi){
311 double theta0 = atan2( r, z ) ;
318 Vector3D( r , phi , r / tan( theta ) , Vector3D::cylindrical ) :
319 Vector3D( z * tan( theta ) , phi , z , Vector3D::cylindrical ) ) ;
virtual const CalorimeterParameters & getHcalEndcapParameters() const =0
Get the Hcal endcap parameters.
virtual double getNRadlen(const Vector3D &p0, const Vector3D &p1) const
The number of radiation lengths along the distance between [p0,p1] .
virtual double getNIntlen(const Vector3D &p0, const Vector3D &p1) const
The number of interaction 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 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.
virtual const CalorimeterParameters & getYokeBarrelParameters() const =0
Get the Yoke barrel parameters.
Abstract interface for a set of parameters that can be used to describe the geometrical properties of...
Simple three dimensional vector providing the components for cartesian, cylindrical and spherical coo...
virtual const GearParameters & getGearParameters(const std::string &key) const =0
Get named parameters for key.
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...
virtual const CalorimeterParameters & getEcalBarrelParameters() const =0
Get the Ecal barrel parameters.
virtual const CalorimeterParameters & getYokePlugParameters() const =0
Get the Yoke plug parameters.
virtual const CalorimeterParameters & getYokeEndcapParameters() const =0
Get the Yoke endcap parameters.
virtual const CalorimeterParameters & getHcalBarrelParameters() const =0
Get the Hcal barrel parameters.
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 getDoubleVal(const std::string &key) const =0
Double value for key.