diff --git a/Service/GearSvc/src/GearSvc.cpp b/Service/GearSvc/src/GearSvc.cpp index 695e455499efff51aeca796bb0ee45bd1d8b7020..cf0d6ec9b44a4014462ec2ecf9f74499d3bdb90d 100644 --- a/Service/GearSvc/src/GearSvc.cpp +++ b/Service/GearSvc/src/GearSvc.cpp @@ -73,9 +73,15 @@ StatusCode GearSvc::initialize() info() << "Fill GEAR data from GeomSvc" << endmsg; m_gearMgr->setDetectorName("CRD_o1_v01"); - const dd4hep::Direction& field = geomSvc->lcdd()->field().magneticField(dd4hep::Position(0,0,0)); - gear::ConstantBField* b = new gear::ConstantBField(gear::Vector3D(field.x()/dd4hep::tesla, field.y()/dd4hep::tesla, field.z()/dd4hep::tesla)); - m_gearMgr->setBField(b); + if (m_field.value()==0) { + const dd4hep::Direction& field = geomSvc->lcdd()->field().magneticField(dd4hep::Position(0,0,0)); + gear::ConstantBField* b = new gear::ConstantBField(gear::Vector3D(field.x()/dd4hep::tesla, field.y()/dd4hep::tesla, field.z()/dd4hep::tesla)); + m_gearMgr->setBField(b); + } + else { + gear::ConstantBField* b = new gear::ConstantBField(gear::Vector3D(0, 0, m_field.value())); + m_gearMgr->setBField(b); + } dd4hep::DetElement world = geomSvc->getDD4HepGeo(); const std::map<std::string, dd4hep::DetElement>& subs = world.children(); @@ -211,8 +217,11 @@ StatusCode GearSvc::convertVXD(dd4hep::DetElement& vxd){ dd4hep::rec::MaterialManager matMgr( dd4hep::Detector::getInstance().world().volume() ) ; const dd4hep::rec::ZPlanarData::LayerLayout& l = vxdData->layers[0] ; - dd4hep::rec::Vector3D a( l.distanceSensitive + l.thicknessSensitive, l.phi0 , 0. , dd4hep::rec::Vector3D::cylindrical ) ; - dd4hep::rec::Vector3D b( l.distanceSupport + l.thicknessSupport, l.phi0 , 0. , dd4hep::rec::Vector3D::cylindrical ) ; + double offset = l.offsetSupport; + //dd4hep::rec::Vector3D a( l.distanceSensitive + l.thicknessSensitive, l.phi0 , 0. , dd4hep::rec::Vector3D::cylindrical ) ; + //dd4hep::rec::Vector3D b( l.distanceSupport + l.thicknessSupport, l.phi0 , 0. , dd4hep::rec::Vector3D::cylindrical ) ; + dd4hep::rec::Vector3D a( l.distanceSensitive + l.thicknessSensitive, l.offsetSupport, 2.*dd4hep::mm); + dd4hep::rec::Vector3D b( l.distanceSupport + l.thicknessSupport, l.offsetSupport, 2.*dd4hep::mm); const dd4hep::rec::MaterialVec& materials = matMgr.materialsBetween( a , b ) ; dd4hep::rec::MaterialData mat = ( materials.size() > 1 ? matMgr.createAveragedMaterial( materials ) : materials[0].first ) ; @@ -228,6 +237,25 @@ StatusCode GearSvc::convertVXD(dd4hep::DetElement& vxd){ mat.interactionLength()/dd4hep::mm); m_gearMgr->registerSimpleMaterial(VXDSupportMaterial); + if (vxdData->rOuterShell>vxdData->rInnerShell) { + dd4hep::rec::Vector3D a1( vxdData->rInnerShell, 0, 2.*dd4hep::mm); + dd4hep::rec::Vector3D b1( vxdData->rOuterShell, 0, 2.*dd4hep::mm); + const dd4hep::rec::MaterialVec& materials1 = matMgr.materialsBetween( a1 , b1 ) ; + dd4hep::rec::MaterialData mat1 = ( materials1.size() > 1 ? matMgr.createAveragedMaterial( materials1 ) : materials1[0].first ) ; + + std::cout << " ####### found materials between points : " << a1 << " and " << b1 << " : " ; + for( unsigned i=0,n=materials1.size();i<n;++i){ + std::cout << materials1[i].first.name() << "[" << materials1[i].second << "], " ; + } + std::cout << std::endl ; + std::cout << " averaged material : " << mat1 << std::endl ; + gear::SimpleMaterialImpl* VXDShellMaterial = new gear::SimpleMaterialImpl("VXDShellMaterial", mat1.A(), mat1.Z(), + mat1.density()/(dd4hep::kg/(dd4hep::g*dd4hep::m3)), + mat1.radiationLength()/dd4hep::mm, + mat1.interactionLength()/dd4hep::mm); + m_gearMgr->registerSimpleMaterial(VXDShellMaterial); + } + info() << vxdData->rInnerShell << " " << vxdData->rOuterShell << " " << vxdData->zHalfShell << " " << vxdData->gapShell << endmsg; for(int i=0,n=vxdData->layers.size(); i<n; i++){ const dd4hep::rec::ZPlanarData::LayerLayout& thisLayer = vxdData->layers[i]; @@ -702,7 +730,7 @@ StatusCode GearSvc::convertFTD(dd4hep::DetElement& ftd){ senRinner, senThickness, senLengthMin, senLengthMax, senWidth, 0); } m_gearMgr->setFTDParameters(ftdParam); - + info() << "nftd = " << nLayers << endmsg; return StatusCode::SUCCESS; } diff --git a/Utilities/KalDet/src/ild/common/MaterialDataBase.cc b/Utilities/KalDet/src/ild/common/MaterialDataBase.cc index f181b8b53de84a990f3b4351d455241e0a344bf8..277f17aead1dc94636e271a6f88c55343a642830 100644 --- a/Utilities/KalDet/src/ild/common/MaterialDataBase.cc +++ b/Utilities/KalDet/src/ild/common/MaterialDataBase.cc @@ -202,7 +202,6 @@ void MaterialDataBase::createMaterials(const gear::GearMgr& gearMgr, IGeomSvc* g TMaterial &ftdsupport = *new TMaterial(name.c_str(), "", A, Z, density, radlen, 0.) ; this->addMaterial(&ftdsupport, name); - // VXD Support Material if(geoSvc){ //obselete @@ -222,9 +221,18 @@ void MaterialDataBase::createMaterials(const gear::GearMgr& gearMgr, IGeomSvc* g name = vxd_sup_mat.getName() ; TMaterial &vxdsupport = *new TMaterial(name.c_str(), "", A, Z, density, radlen, 0.); this->addMaterial(&vxdsupport, name); + + const gear::SimpleMaterial& vxd_shell_mat = gearMgr.getSimpleMaterial("VXDShellMaterial"); + A = vxd_shell_mat.getA(); + Z = vxd_shell_mat.getZ(); + density = vxd_shell_mat.getDensity() * (1000.0/ 1000000.0); // kg/m^3 -> g/cm^3 + radlen = vxd_shell_mat.getRadLength() / 10.0 ; // mm -> cm + name = vxd_shell_mat.getName() ; + TMaterial &vxdshell = *new TMaterial(name.c_str(), "", A, Z, density, radlen, 0.); + this->addMaterial(&vxdshell, name); } catch( gear::UnknownParameterException& e){ - std::cout << "Error while read material from GeomSvc!" << std::endl; + std::cout << "Warning! cannot get material VXDSupportMaterial and VXDShellMaterial from GeomSvc! GearMgr=" << &gearMgr << std::endl; } } } diff --git a/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.cc b/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.cc index 3043a7f392acd79700a441c826b3cbd3f5f32522..3cf666966b6115eda29a39cb3a1c9f59d8843c48 100644 --- a/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.cc +++ b/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.cc @@ -45,7 +45,6 @@ ILDVXDKalDetector::ILDVXDKalDetector( const gear::GearMgr& gearMgr, IGeomSvc* ge TMaterial & beryllium = *MaterialDataBase::Instance().getMaterial("beryllium"); // needed for cryostat - TMaterial & aluminium = *MaterialDataBase::Instance().getMaterial("aluminium"); _vxd_Cryostat.exists = false; @@ -215,6 +214,12 @@ ILDVXDKalDetector::ILDVXDKalDetector( const gear::GearMgr& gearMgr, IGeomSvc* ge } } + if (_vxd_Cryostat.shellInnerR>0&&_vxd_Cryostat.shellThickness>0) { + TMaterial & shell = *MaterialDataBase::Instance().getMaterial("VXDShellMaterial"); + Add( new ILDCylinderMeasLayer(air, shell , _vxd_Cryostat.shellInnerR, _vxd_Cryostat.shelllHalfZ, 0, 0, 0, _bZ, dummy,-1,"VXDShellInnerWall" ) ); + Add( new ILDCylinderMeasLayer(shell, air , _vxd_Cryostat.shellInnerR+_vxd_Cryostat.shellThickness, _vxd_Cryostat.shelllHalfZ, 0, 0, 0, _bZ, dummy,-1,"VXDShellOuterWall" ) ); + } + if (_vxd_Cryostat.exists) { // build Cryostat according to mokka driver vxd04.cc @@ -357,6 +362,11 @@ void ILDVXDKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ _relative_position_of_measurement_surface = pVXDDetMain.getDoubleVal( "relative_position_of_measurement_surface" ); } catch (gear::UnknownParameterException& e) {} + + _vxd_Cryostat.shellInnerR = pVXDDetMain.getShellInnerRadius(); + _vxd_Cryostat.shellThickness = pVXDDetMain.getShellOuterRadius() - pVXDDetMain.getShellInnerRadius(); + _vxd_Cryostat.shelllHalfZ = pVXDDetMain.getShellHalfLength(); + try { const gear::GearParameters& pVXDInfra = gearMgr.getGearParameters("VXDInfra"); _vxd_Cryostat.alRadius = pVXDInfra.getDoubleVal( "CryostatAlRadius" ); @@ -365,16 +375,16 @@ void ILDVXDKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ _vxd_Cryostat.alZEndCap = pVXDInfra.getDoubleVal( "CryostatAlZEndCap" ); _vxd_Cryostat.alHalfZ = pVXDInfra.getDoubleVal( "CryostatAlHalfZ" ); - _vxd_Cryostat.shellInnerR = pVXDDetMain.getShellInnerRadius(); - _vxd_Cryostat.shellThickness = pVXDDetMain.getShellOuterRadius() - _vxd_Cryostat.shellInnerR; - _vxd_Cryostat.shelllHalfZ = pVXDDetMain.getShellHalfLength(); + //_vxd_Cryostat.shellInnerR = pVXDDetMain.getShellInnerRadius(); + //_vxd_Cryostat.shellThickness = pVXDDetMain.getShellOuterRadius() - _vxd_Cryostat.shellInnerR; + //_vxd_Cryostat.shelllHalfZ = pVXDDetMain.getShellHalfLength(); _vxd_Cryostat.exists = true; //std::cout << "VXDInfra: " << _vxd_Cryostat.alRadius << " " << _vxd_Cryostat.alThickness << " " << _vxd_Cryostat.alInnerR << " " << _vxd_Cryostat.alZEndCap << " " // << _vxd_Cryostat.alHalfZ << " " << _vxd_Cryostat.shellInnerR << " " << _vxd_Cryostat.shellThickness << " " << _vxd_Cryostat.shelllHalfZ << std::endl; } catch (gear::UnknownParameterException& e) { - std::cout << e.what() << std::endl ; + //std::cout << "ILDVXDKalDetector: " << e.what() << ", will not be built" << std::endl ; _vxd_Cryostat.exists = false; }