2 #include "gearimpl/GearMgrImpl.h"
3 #include "gearimpl/GearParametersImpl.h"
4 #include "gear/CalorimeterParameters.h"
5 #include "gear/ZPlanarParameters.h"
6 #include "gear/SiPlanesParameters.h"
7 #include "gear/TrackerPlanesParameters.h"
9 #include "gear/GearPointProperties.h"
10 #include "gear/GearDistanceProperties.h"
11 #include "gear/BField.h"
12 #include "gear/TPCParameters.h"
13 #include "gearimpl/TPCParametersImpl.h"
14 #include "gearimpl/CalorimeterParametersImpl.h"
15 #include "gearimpl/ZPlanarParametersImpl.h"
16 #include "gearimpl/FTDParametersImpl.h"
17 #include "gearimpl/SiPlanesParametersImpl.h"
18 #include "gearimpl/TrackerPlanesParametersImpl.h"
20 #include "gearimpl/ConstantBField.h"
21 #include "gearimpl/SimpleMaterialImpl.h"
28 GearMgrImpl::GearMgrImpl() :
30 _ecalBarrelParameters(0) ,
31 _ecalEndcapParameters(0) ,
32 _ecalPlugParameters(0) ,
33 _yokeBarrelParameters(0) ,
34 _yokeEndcapParameters(0) ,
35 _yokePlugParameters(0) ,
36 _hcalBarrelParameters(0) ,
37 _hcalEndcapParameters(0) ,
38 _hcalRingParameters(0) ,
41 _beamcalParameters(0) ,
46 _trackerplanesParameters(0) ,
47 _siplanesParameters(0) ,
49 _distanceProperties(0) ,
53 _surfaceStore =
new MeasurementSurfaceStore();
124 if( _tpcParameters )
delete _tpcParameters ;
125 if( _ecalBarrelParameters )
delete _ecalBarrelParameters ;
126 if( _ecalEndcapParameters )
delete _ecalEndcapParameters ;
127 if( _ecalPlugParameters )
delete _ecalPlugParameters ;
129 delete _yokeBarrelParameters ;
130 delete _yokeEndcapParameters ;
131 delete _yokePlugParameters ;
132 if( _hcalBarrelParameters )
delete _hcalBarrelParameters ;
133 if( _hcalEndcapParameters )
delete _hcalEndcapParameters ;
134 if( _hcalRingParameters )
delete _hcalRingParameters ;
135 if( _lcalParameters )
delete _lcalParameters;
136 if( _lhcalParameters )
delete _lhcalParameters;
137 if( _beamcalParameters )
delete _beamcalParameters;
138 if( _vxdParameters )
delete _vxdParameters ;
139 if( _sitParameters )
delete _sitParameters ;
140 if( _setParameters )
delete _setParameters ;
141 if( _ftdParameters )
delete _ftdParameters ;
142 if( _trackerplanesParameters )
delete _trackerplanesParameters ;
143 if( _siplanesParameters )
delete _siplanesParameters ;
144 if( _pointProperties )
delete _pointProperties ;
145 if( _distanceProperties )
delete _distanceProperties ;
146 if( _bField )
delete _bField ;
148 for( ParameterMap::iterator it = _map.begin() ; it != _map.end() ; ++ it ) {
152 for(MatMap::iterator it = _matMap.begin(), end = _matMap.end() ; it != end ; ++it ){
156 delete _surfaceStore ; _surfaceStore = 0 ;
171 if( _detectorName.size() == 0 )
175 return _detectorName ;
181 ParameterMap::const_iterator it = _map.find( key ) ;
182 if( it == _map.end() || it->second == 0 )
184 return * it->second ;
190 if( _tpcParameters == 0 )
193 return *_tpcParameters ;
208 if( _ecalBarrelParameters == 0 )
211 return *_ecalBarrelParameters ;
216 if( _ecalEndcapParameters == 0 )
219 return *_ecalEndcapParameters ;
225 if( _ecalPlugParameters == 0 )
228 return *_ecalPlugParameters ;
234 if( _yokeBarrelParameters == 0 )
237 return *_yokeBarrelParameters ;
242 if( _yokeEndcapParameters == 0 )
245 return *_yokeEndcapParameters ;
251 if( _yokePlugParameters == 0 )
254 return *_yokePlugParameters ;
262 if( _hcalBarrelParameters == 0 )
265 return *_hcalBarrelParameters ;
270 if( _hcalEndcapParameters == 0 )
273 return *_hcalEndcapParameters ;
279 if( _hcalRingParameters == 0 )
282 return *_hcalRingParameters ;
289 if( _lcalParameters == 0 )
292 return *_lcalParameters ;
298 if( _lhcalParameters == 0 )
301 return *_lhcalParameters ;
307 if( _beamcalParameters == 0 )
310 return *_beamcalParameters ;
316 if( _vxdParameters == 0 )
319 return *_vxdParameters ;
325 if( _ftdParameters == 0 )
328 return *_ftdParameters ;
334 if( _sitParameters == 0 )
337 return *_sitParameters ;
342 if( _setParameters == 0 )
345 return *_setParameters ;
351 if( _trackerplanesParameters == 0 )
354 return *_trackerplanesParameters ;
360 if( _siplanesParameters == 0 )
363 return *_siplanesParameters ;
369 if( _pointProperties == 0 )
372 return *_pointProperties ;
379 if( _distanceProperties == 0 )
382 return *_distanceProperties ;
388 if( parameters == 0 )
391 ParameterMap::iterator it = _map.find( key ) ;
393 if( it != _map.end() ) {
396 it->second = parameters ;
400 _map[ key ] = parameters ;
410 delete _tpcParameters ;
412 _tpcParameters = tpcParameters ;
422 _ecalBarrelParameters = ecalBarrelParameters ;
426 _ecalEndcapParameters = ecalEndcapParameters ;
431 _ecalPlugParameters = ecalPlugParameters ;
436 _yokeBarrelParameters = yokeBarrelParameters ;
440 _yokeEndcapParameters = yokeEndcapParameters ;
445 _yokePlugParameters = yokePlugParameters ;
451 _hcalBarrelParameters = hcalBarrelParameters ;
456 _hcalEndcapParameters = hcalEndcapParameters ;
461 _hcalRingParameters = hcalRingParameters ;
472 std::cout <<
"WARNING GearMgrImpl::setLcalParameters: added "
473 " missing parameter beam_crossing_angle 0.0 ! " << std::endl ;
482 _lcalParameters = lcalParameters ;
493 std::cout <<
"WARNING GearMgrImpl::setLHcalParameters: added "
494 " missing parameter beam_crossing_angle 0.0 ! " << std::endl ;
503 _lhcalParameters = lhcalParameters ;
510 beamcalParameters->
getDoubleVal(
"beam_crossing_angle") ;
514 std::cout <<
"WARNING GearMgrImpl::setBeamCalParameters: added "
515 " missing parameter beam_crossing_angle 0.0 ! " << std::endl ;
524 _beamcalParameters = beamcalParameters ;
529 _vxdParameters = vxdParameters ;
534 _ftdParameters = ftdParameters ;
539 _sitParameters = sitParameters ;
544 _setParameters = setParameters ;
549 _trackerplanesParameters = trackerplanesParameters ;
554 _siplanesParameters = siplanesParameters ;
559 _pointProperties = pointProperties ;
564 _distanceProperties = distanceProperties ;
570 _keys.reserve( _map.size() ) ;
572 for( ParameterMap::const_iterator it = _map.begin() ; it != _map.end() ; ++it ){
573 _keys.push_back( it->first ) ;
581 _matNames.reserve( _matMap.size() ) ;
583 for( MatMap::const_iterator it = _matMap.begin() ; it != _matMap.end() ; ++it ){
584 _matNames.push_back( it->first ) ;
593 MatMap::const_iterator it = _matMap.find( name ) ;
595 if( it == _matMap.end() ){
597 std::stringstream mess ;
598 mess <<
" GearMgrImpl::getSimpleMaterial - unknown material with name " << name <<
" ! " ;
609 MatMap::iterator it = _matMap.find( material->
getName() ) ;
611 if( it!= _matMap.end() ){
613 std::stringstream mess ;
614 mess <<
" GearMgrImpl::registerSimpleMaterial - material with name " << material->
getName() <<
" already registered ! " ;
619 _matMap[ material->
getName() ] = material ;
virtual void setPointProperties(GearPointProperties *pointProperties)
Set the point properties object.
virtual void setHcalRingParameters(CalorimeterParameters *hcalRingParameters)
Set the HcalRingParameters.
Implementation of GearParameters - a set off parameters that can be used to describe the geometrical ...
virtual const std::vector< std::string > & getGearParameterKeys() const
Keys of all GearParameters.
Geometry properties of a vertex detector needed for reconstruction code.
Abstract interface for a class that returns the (material) properties along a given distance between ...
virtual const TPCParameters & getTPCParameters() const
Get the TPCParameters.
virtual void setYokeBarrelParameters(CalorimeterParameters *yokeBarrelParameters)
Set the YokeBarrelParameters.
Proposal for an abstract interface that defines the geometry properties of a TPC like detector needed...
virtual void setHcalEndcapParameters(CalorimeterParameters *hcalEndcapParameters)
Set the HcalEndcapParameters.
virtual void setSITParameters(ZPlanarParameters *sitParameters)
Set the SITParameters.
virtual void setYokePlugParameters(CalorimeterParameters *yokePlugParameters)
Set the YokePlugParameters.
Base exception class for GEAR - all other exceptions extend this.
Abstract interface for a simple material description tjhat hold s the following properties: A...
virtual const CalorimeterParameters & getHcalEndcapParameters() const
Get the Hcal endcap parameters.
virtual const ZPlanarParameters & getVXDParameters() const
Get the VXD parameters.
virtual const BField & getBField() const
Get the BField.
virtual const std::vector< std::string > & getMaterialNames() const
Names of registered materials.
Proposal for an abstract interface that defines geometry properties of a typical sampling calorimeter...
virtual const CalorimeterParameters & getYokePlugParameters() const
Get the Yoke plug parameters.
virtual void setLHcalParameters(CalorimeterParameters *lhcalParameters)
Set the LHcalParameters.
virtual const TrackerPlanesParameters & getTrackerPlanesParameters() const
Get the TrackerPlanes parameters.
virtual const CalorimeterParameters & getBeamCalParameters() const
Get the BeamCal parameters.
virtual void setEcalBarrelParameters(CalorimeterParameters *ecalBarrelParameters)
Set the EcalBarrelParameters.
virtual void setSiPlanesParameters(SiPlanesParameters *siplanesParameters)
Set the SiPlanesParameters.
virtual const GearPointProperties & getPointProperties() const
Get the point properties object.
virtual void setLcalParameters(CalorimeterParameters *lcalParameters)
Set the LcalParameters.
virtual void setEcalPlugParameters(CalorimeterParameters *ecalPlugParameters)
Set the EcalPlugParameters.
virtual void registerSimpleMaterial(const SimpleMaterial *material)
Register the SimpleMaterial with SimpleMaterial::getName() - throws Exception if a material of the gi...
virtual const std::string & getDetectorName() const
The unique detector name - typically the model name used in the simulation program.
virtual void setVXDParameters(ZPlanarParameters *vxdParameters)
Set the VXDParameters.
void cleanup()
function to copy all internal variables, incl.
virtual const FTDParameters & getFTDParameters() const
Get the FTD parameters.
virtual const std::string & getName() const =0
The material name.
virtual const CalorimeterParameters & getEcalPlugParameters() const
Get the Ecal plug parameters.
virtual const GearDistanceProperties & getDistanceProperties() const
Get the distance properties object.
Abstract interface for a set of parameters that can be used to describe the geometrical properties of...
virtual const CalorimeterParameters & getHcalBarrelParameters() const
Get the Hcal barrel parameters.
UnknownParameterException call Processor::end().
virtual const CalorimeterParameters & getHcalRingParameters() const
Get the Hcal ring parameters.
virtual void setGearParameters(const std::string &key, GearParameters *parameters)
Set the GearParameters for the given key - overwrites any existing entries.
virtual const CalorimeterParameters & getLHcalParameters() const
Get the LHcal parameters.
virtual const CalorimeterParameters & getEcalEndcapParameters() const
Get the Ecal endcap parameters.
virtual const SiPlanesParameters & getSiPlanesParameters() const
Get the SiPlanes parameters.
virtual const CalorimeterParameters & getLcalParameters() const
Get the Lcal parameters.
virtual const ZPlanarParameters & getSITParameters() const
Get the SIT parameters.
virtual void setHcalBarrelParameters(CalorimeterParameters *hcalBarrelParameters)
Set the HcalBarrelParameters.
virtual const GearParameters & getGearParameters(const std::string &key) const
Get named parameters for key.
Geometry properties of a FTD detector needed for reconstruction code.
virtual void setSETParameters(ZPlanarParameters *setParameters)
Set the SETParameters.
virtual void setTPCParameters(TPCParameters *tpcParameters)
Set the TPCParameters.
virtual void setEcalEndcapParameters(CalorimeterParameters *ecalEndcapParameters)
Set the EcalEndcapParameters.
virtual void setTrackerPlanesParameters(TrackerPlanesParameters *trackerplanesParameters)
Set the TrackerPlanesParameters.
virtual void setYokeEndcapParameters(CalorimeterParameters *yokeEndcapParameters)
Set the YokeEndcapParameters.
virtual void setFTDParameters(FTDParameters *ftdParameters)
Set the FTDParameters.
virtual const ZPlanarParameters & getSETParameters() const
Get the SET parameters.
virtual const SimpleMaterial & getSimpleMaterial(const std::string name) const
Return the SimpleMaterial for the given name throws UnknownParameterException if no material is unkno...
virtual void setDistanceProperties(GearDistanceProperties *distanceProperties)
Set the distance properties object.
virtual void setBeamCalParameters(CalorimeterParameters *beamcalParameters)
Set the BeamCalParameters.
Geometry properties of a pixel beam telescope needed for reconstruction code.
virtual const CalorimeterParameters & getYokeBarrelParameters() const
Get the Yoke barrel parameters.
Geometry properties of a pixel beam telescope needed for reconstruction code.
virtual void setBField(BField *bField)
Set the b field object.
virtual const CalorimeterParameters & getEcalBarrelParameters() const
Get the Ecal barrel parameters.
virtual ~GearMgrImpl()
Destructor.
virtual const CalorimeterParameters & getYokeEndcapParameters() const
Get the Yoke endcap parameters.
Abstract interface for a class that returns the (material) properties of a given point in in world co...
virtual void setDoubleVal(const std::string &key, double val)
Double value for key.
virtual double getDoubleVal(const std::string &key) const =0
Double value for key.