diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelBarrelInclRefTool.h b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelBarrelInclRefTool.h index a9e86afe8c2fcb78043b768a9936d2aa661fbf21..35d43b28b317ae468b769c348f48f90a7df4a2a5 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelBarrelInclRefTool.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelBarrelInclRefTool.h @@ -40,6 +40,7 @@ class GeoPixelBarrelInclRefTool : virtual public IGeoPixelBarrelTool, public Ath virtual GeoVPhysVol* buildBarrel(const PixelGeoBuilderBasics*); std::vector getSvcRegions() const { return m_barrelSvcRegions; } + private: ToolHandle m_IDserviceTool; @@ -55,6 +56,7 @@ class GeoPixelBarrelInclRefTool : virtual public IGeoPixelBarrelTool, public Ath std::vector m_barrelSvcRegions; const GeoShape *addShape(const GeoShape* lastShape, const GeoShape* nextShape, const HepGeom::Transform3D & trans); + }; #endif diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelEndcapModuleSvcRef.h b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelEndcapModuleSvcRef.h index 84ef399e005540362ed6ca76e418d750dd0a34ae..dabbb4bcd87f6e46394cb2e98fa8ce9cc699bdb6 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelEndcapModuleSvcRef.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelEndcapModuleSvcRef.h @@ -53,6 +53,8 @@ class GeoPixelEndcapModuleSvcRef : public PixelGeoBuilder { GeoPhysVol *m_endcapFoam; GeoPhysVol *m_transFoam; + double m_CurlyMaterialFudge; + }; diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLadderInclRef.h b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLadderInclRef.h index 5d5522cfbe9edc21f46d83824b98e754e9a607f3..4448ab45eb356723e5eb55fcead27e869efd62c1 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLadderInclRef.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLadderInclRef.h @@ -15,6 +15,8 @@ #include "GaudiKernel/ToolHandle.h" #include "PixelInterfaces/IPixelServicesTool.h" +#include "BarrelInclinedRef/PixelInclRefStaveXMLHelper.h" + namespace InDet{ class StaveTmp; } @@ -32,6 +34,11 @@ class GeoPixelLadderInclRef : public PixelGeoBuilder { public: GeoPixelLadderInclRef(const PixelGeoBuilderBasics* basics, const InDet::StaveTmp *staveTmp, int iLayer, int iLadder, int nSectors, int nSectorsLastLayer, int nSectorsNextLayer, double phiOfStaveZero, double phiOfStaveZeroLastLayer, HepGeom::Transform3D trf); + ~GeoPixelLadderInclRef(){ + for(auto it = m_staveDBHelpers.begin(); it != m_staveDBHelpers.end(); ++it) delete (*it); + m_staveDBHelpers.clear(); + } + virtual GeoVPhysVol* Build(); virtual void preBuild(); @@ -92,7 +99,10 @@ class GeoPixelLadderInclRef : public PixelGeoBuilder { std::string m_barrelModuleType; double m_barrelModuleGap; double m_barrelModuleTilt; + double m_barrelModuleZeroTilt; + double m_barrelModuleZoffset; double m_barrelModuleDZ; + double m_barrelZMax; double m_moduleTilt; int m_endcapModuleNumber; @@ -101,7 +111,9 @@ class GeoPixelLadderInclRef : public PixelGeoBuilder { double m_endcapModuleGap; double m_endcapInclAngle; double m_endcapModuleRshift; + double m_endcapModuleROffset; double m_endcapModuleRtilt; + double m_endcapModuleZoffset; std::vector > m_endcapModPos; int m_transitionModuleNumber; @@ -128,6 +140,8 @@ class GeoPixelLadderInclRef : public PixelGeoBuilder { ServiceHandle m_pixelDesignSvc; ToolHandle m_IDserviceTool; + std::vector m_staveDBHelpers; + }; #endif diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLadderPlanarRef.h b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLadderPlanarRef.h index c76ec666237b73574f5cb041835444179a50ed40..a15ad7d7d445a445745757e23807a41e3c245389 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLadderPlanarRef.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLadderPlanarRef.h @@ -15,6 +15,7 @@ #include "GaudiKernel/ToolHandle.h" #include "PixelInterfaces/IPixelServicesTool.h" + namespace InDet{ class StaveTmp; } @@ -33,6 +34,7 @@ class GeoPixelLadderPlanarRef : public PixelGeoBuilder { public: GeoPixelLadderPlanarRef(const PixelGeoBuilderBasics* basics, const InDet::StaveTmp *staveTmp, int iLayer, HepGeom::Transform3D trf); virtual GeoVPhysVol* Build(); + GeoVPhysVol* BuildPigtail(); virtual void preBuild(); double thickness() const {return m_thickness;} diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLayerInclRefTool.h b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLayerInclRefTool.h index a03fe4ccf5d4a12c2dd4b3bc329c28eb8931da77..5a19d041c3b92cec5194cf63da8dc44c7722f60e 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLayerInclRefTool.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLayerInclRefTool.h @@ -33,7 +33,7 @@ class GeoPixelLayerInclRefTool : virtual public IGeoPixelLayerTool, public AthAl GeoVPhysVol* getPhysVol() const { return m_physVol; } std::vector getSvcRegions() const { return m_layerSvcRegions; } - + private: GeoVPhysVol* m_physVol; @@ -51,6 +51,7 @@ class GeoPixelLayerInclRefTool : virtual public IGeoPixelLayerTool, public AthAl ServiceHandle m_xmlReader; ToolHandle m_validationTool; bool m_validationMode; + }; #endif diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLayerPlanarRefTool.h b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLayerPlanarRefTool.h index 0f4b24de3cae6b7fd4a0e60753ce10c4f429901e..cd69edff84f40745270b2dded16b0085cc8a965f 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLayerPlanarRefTool.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelLayerPlanarRefTool.h @@ -32,7 +32,7 @@ class GeoPixelLayerPlanarRefTool : virtual public IGeoPixelLayerTool, public Ath GeoVPhysVol* getPhysVol() const { return m_physVol; } std::vector getSvcRegions() const { return m_layerSvcRegions; } - + private: GeoVPhysVol* m_physVol; @@ -48,6 +48,7 @@ class GeoPixelLayerPlanarRefTool : virtual public IGeoPixelLayerTool, public Ath std::vector m_layerSvcRegions; ServiceHandle m_xmlReader; + }; #endif diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/PixelInclRefStaveXMLHelper.h b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/PixelInclRefStaveXMLHelper.h index fb118f378e5f887bca54fcba884e32876112e630..67e41ac0d9ace58aa95cabe14ca91a2ed0b11da7 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/PixelInclRefStaveXMLHelper.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/PixelInclRefStaveXMLHelper.h @@ -28,12 +28,18 @@ class PixelInclRefStaveXMLHelper : public GeoXMLUtils, public PixelGeoBuilder double getStaveSupportThick() const; std::string getStaveSupportMaterial(int shapeIndex = 0) const; std::string getStaveSupportCornerMaterial(int shapeIndex = 0) const; + std::string getStaveSupportEOSMaterial(int shapeIndex = 0) const; + std::string getPigtailMaterial(int shapeIndex = 0) const; + double getPigtailAngle(int shapeIndex = 0) const; + double getPigtailDR(int shapeIndex = 0) const; + double getMaterialFudge() const; double getServiceOffsetX() const; double getServiceECOffsetX() const; double getServiceOffsetY() const; std::string getSvcRoutingPos() const; double getMountainEdge() const; double getMountainWidth() const; + double getCurlyMaterialFudge() const; std::string getStaveSupportType() const; int getNStaveShapes() const; diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelBarrelInclRefTool.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelBarrelInclRefTool.cxx index 132dd0ed769446ac1234b6890ae2f8b78902840c..e8495ec66016d535be063b06d3d630231ba77ff0 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelBarrelInclRefTool.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelBarrelInclRefTool.cxx @@ -11,6 +11,7 @@ #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoPara.h" #include "GeoModelKernel/GeoTube.h" +#include "GeoModelKernel/GeoTubs.h" #include "GeoModelKernel/GeoLogVol.h" #include "GeoModelKernel/GeoNameTag.h" #include "GeoModelKernel/GeoIdentifierTag.h" @@ -127,7 +128,7 @@ GeoVPhysVol* GeoPixelBarrelInclRefTool::buildBarrel(const PixelGeoBuilderBasics* { msg(MSG::DEBUG)<<"GeoBarrelInclRef : GeoVPhysVol* GeoPixelBarrelInclRefTool::Build( )"<matMgr(); m_msg = basics->msgStream(); @@ -209,6 +210,87 @@ GeoVPhysVol* GeoPixelBarrelInclRefTool::buildBarrel(const PixelGeoBuilderBasics* } + if(!cylBarrel) { + std::vector hlenList = genDBHelper.getBarrelHalfLengthList(); + std::vector radiusList = genDBHelper.getBarrelRadiusList(); + + std::vector zoffsetList = genDBHelper.getBarrelSupportZOffsetList(); + std::vector thicknessList = genDBHelper.getBarrelSupportThicknessList(); + std::vector materialList = genDBHelper.getBarrelSupportMaterialList(); + std::vector rmininnerList = genDBHelper.getBarrelSupportRminInnerList(); + std::vector rmaxinnerList = genDBHelper.getBarrelSupportRmaxInnerList(); + std::vector rminouterList = genDBHelper.getBarrelSupportRminOuterList(); + std::vector rmaxouterList = genDBHelper.getBarrelSupportRmaxOuterList(); + std::vector nsectorsList = genDBHelper.getBarrelSupportNSectorsList(); + std::vector sphiList = genDBHelper.getBarrelSupportSPhiList(); + std::vector dphiList = genDBHelper.getBarrelSupportDPhiList(); + + for (int side=-1; side<=1; side=side+2) + { + for(int i=0; i<(int)rmininnerList.size(); i++) + { + double halflen = hlenList[0]; + + double zoffset = zoffsetList[i]; + double thickness = thicknessList[i]; + double zpos = (halflen - (thickness/1.99) - zoffset) * side; + std::string matName = materialList[i]; + + double rmin_inner = rmininnerList[i]; + double rmax_inner = rmaxinnerList[i]; + double rmin_outer = rminouterList[i]; + double rmax_outer = rmaxouterList[i]; + + int nsectors = nsectorsList[i]; + double sphiSvc = sphiList[i]; + double dphiSvc = dphiList[i]; + + const GeoTube* supTube_inner = new GeoTube(rmin_inner,rmax_inner,thickness*.5); + double matVolume_inner = supTube_inner->volume(); + const GeoMaterial* supMat_inner = m_matMgr->getMaterial(matName); + ATH_MSG_DEBUG("Density = " << supMat_inner->getDensity() << " Mass = " << ( matVolume_inner * supMat_inner->getDensity() )); + GeoLogVol* _supLog_inner = new GeoLogVol("supLog_inner",supTube_inner,supMat_inner); + GeoPhysVol* supPhys_inner = new GeoPhysVol(_supLog_inner); + GeoTransform* xform_inner = new GeoTransform( HepGeom::Translate3D(0., 0., zpos) ); + barrelPhys->add(xform_inner); + barrelPhys->add(supPhys_inner); + + for (int i_sector = 0; i_sector < nsectors; i_sector++) { + + if ((360. / nsectors) < dphiSvc) { + ATH_MSG_WARNING("Arms will overlap. Do not implement them."); + continue; + } + + double Sphi = (sphiSvc + 360. / nsectors * i_sector) * CLHEP::deg; + double Dphi = dphiSvc * CLHEP::deg; + + const GeoShape* supTubs_arm = new GeoTubs(rmax_inner,rmin_outer,thickness*.5,Sphi,Dphi); + double matVolume_arm = supTubs_arm->volume(); + const GeoMaterial* supMat_arm = m_matMgr->getMaterial(matName); + ATH_MSG_DEBUG("Density = " << supMat_arm->getDensity() << " Mass = " << ( matVolume_arm * supMat_arm->getDensity() )); + GeoLogVol* _supLog_arm = new GeoLogVol("supLog_arm",supTubs_arm,supMat_arm); + GeoPhysVol* supPhys_arm = new GeoPhysVol(_supLog_arm); + GeoTransform* xform_arm = new GeoTransform( HepGeom::Translate3D(0., 0., zpos) ); + barrelPhys->add(xform_arm); + barrelPhys->add(supPhys_arm); + + } + + const GeoTube* supTube_outer = new GeoTube(rmin_outer,rmax_outer,thickness*.5); + double matVolume_outer = supTube_outer->volume(); + const GeoMaterial* supMat_outer = m_matMgr->getMaterial(matName); + ATH_MSG_DEBUG("Density = " << supMat_outer->getDensity() << " Mass = " << ( matVolume_outer * supMat_outer->getDensity() )); + GeoLogVol* _supLog_outer = new GeoLogVol("supLog_outer",supTube_outer,supMat_outer); + GeoPhysVol* supPhys_outer = new GeoPhysVol(_supLog_outer); + GeoTransform* xform_outer = new GeoTransform( HepGeom::Translate3D(0., 0., zpos) ); + barrelPhys->add(xform_outer); + barrelPhys->add(supPhys_outer); + + } + } + } + if(m_IDserviceTool){ m_IDserviceTool->buildAndPlace("B", barrelPhys); } diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEndcapModuleSvcRef.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEndcapModuleSvcRef.cxx index 82cc0bf198be2790f9e2bfbd099c449dcc5487dd..c1ec1b606a109bcded4b34915c1814aa154530a9 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEndcapModuleSvcRef.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEndcapModuleSvcRef.cxx @@ -44,6 +44,8 @@ void GeoPixelEndcapModuleSvcRef::preBuild() m_svcRouting = staveDBHelper.getSvcRoutingPos()=="inner" ? -1. : 1.; msg(MSG::DEBUG) <<"Local support width "<addVertex(foam1x,foam1y); shapeBrep->addVertex(foam2x,foam2y); @@ -135,7 +137,7 @@ void GeoPixelEndcapModuleSvcRef::buildFoamModules() else { // first time this material is required, check the base material first std::ostringstream baseMatName; baseMatName << inclinedSupportMaterialNameBase <<"_Fixed_Weight"; - GeoMaterial* baseMat = const_cast(matMgr()->getMaterialForVolume(baseMatName.str(), 1.)); // define base material + GeoMaterial* baseMat = const_cast(matMgr()->getMaterialForVolume(baseMatName.str(), 1.,"",m_CurlyMaterialFudge)); // define base material double matVolume = shapeBrep->volume(); double density = baseMat->getDensity()/matVolume; diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLadderInclRef.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLadderInclRef.cxx index 8cdd638835a06d896e750d981d4ef434bcb4355b..0cd0cbcc888511f35e1e528e0f0f0649315df211 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLadderInclRef.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLadderInclRef.cxx @@ -1,6 +1,9 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + #include "BarrelInclinedRef/GeoPixelLadderInclRef.h" #include "BarrelInclinedRef/GeoPixelStaveSupportInclRef.h" -#include "BarrelInclinedRef/PixelInclRefStaveXMLHelper.h" #include "BarrelInclinedRef/GeoPixelEndcapModuleSvcRef.h" #include "PixelGeoModelModule/GeoDetModulePixel.h" @@ -67,8 +70,12 @@ GeoPixelLadderInclRef::GeoPixelLadderInclRef(const PixelGeoBuilderBasics* basics msg(MSG::INFO) << "Service builder tool retrieved: " << m_IDserviceTool << endreq; } + m_staveDBHelpers.push_back(new PixelInclRefStaveXMLHelper(m_layer, getBasics())); + if (m_layer > 0) m_staveDBHelpers.push_back(new PixelInclRefStaveXMLHelper(m_layer-1, getBasics())); + // Build stave support and module m_svcMaterialCmpt=0; + preBuild(); } @@ -87,6 +94,8 @@ void GeoPixelLadderInclRef::preBuild( ) { msg(MSG::DEBUG) << "Pixel module builder tool retrieved: " << m_pixelModuleSvc << endreq; } + m_pixelModuleSvc->initModuleMap(getBasics()); + m_pixelDesignSvc->initModuleMap(getBasics()); std::string value; msg(MSG::DEBUG)<b_type; m_barrelModuleGap = m_staveTmp->b_gap; m_barrelModuleTilt = m_staveTmp->b_tilt; + m_barrelModuleZeroTilt = 1.e-10 * m_barrelModuleTilt; + if(m_barrelModuleTilt>0) m_barrelModuleZeroTilt /= fabs(m_barrelModuleTilt); + + m_barrelModuleZoffset = m_staveTmp->b_zoffset; m_endcapModuleNumber = 0; m_endcapModuleType = ""; @@ -113,9 +126,12 @@ void GeoPixelLadderInclRef::preBuild( ) { m_endcapModuleType = m_staveTmp->alp_type; m_endcapModuleGap = 0.; m_endcapInclAngle = m_staveTmp->alp_angle; + m_endcapModuleROffset = m_staveTmp->alp_roffset; m_endcapModuleRshift = m_staveTmp->alp_rshift; m_endcapModuleRtilt = m_staveTmp->alp_radialTilt; + m_endcapModuleZoffset = m_staveTmp->alp_zoffset; + m_transModulePos = m_staveTmp->trans_pos; if(m_transModulePos.size()>0){ m_transitionModuleNumber = (int)m_transModulePos.size(); @@ -132,6 +148,17 @@ void GeoPixelLadderInclRef::preBuild( ) { m_barrelModule = m_pixelModuleSvc->getModule(getBasics(),0,layerModuleIndex,m_barrelModuleType); m_barrelModuleDesign = m_pixelDesignSvc->getDesign(getBasics(),m_barrelModuleType); + m_barrelZMax = 9.99e99; + unsigned int index = (m_staveDBHelpers[0]->getSvcRoutingPos() == "inner") ? 1 : 0; + + if (m_staveDBHelpers[index]->getStaveSupportType() == "Longeron"){ + int nStaveShapes = m_staveDBHelpers[index]->getNStaveShapes(); + for (int iss = 0; iss < nStaveShapes; iss++) + if (m_barrelZMax > m_staveDBHelpers[index]->getBarrelZMax(iss)) m_barrelZMax = m_staveDBHelpers[index]->getBarrelZMax(iss); + } + else + m_barrelZMax = 0.5 * (m_barrelModuleNumber * (m_barrelModule->Length() + m_barrelModuleGap)); + msg(MSG::DEBUG)<<"-- Barrel modules : "<Length()+m_barrelModuleGap*(m_barrelModuleNumber-1))*.5; - PixelInclRefStaveXMLHelper staveDBHelper(m_layer, getBasics()); - m_svcRouting = staveDBHelper.getSvcRoutingPos(); - - double m_gapPlanarStave = staveDBHelper.getGapPlanarStave(); - double serviceOffsetX = staveDBHelper.getServiceOffsetX(); - double staveSupportThick = staveDBHelper.getStaveSupportThick(); - double ecMinRadialPos = m_endcapModuleRshift-maxTiltedModuleThick; - double ecMaxRadialPos = m_endcapModuleRshift; + m_svcRouting = m_staveDBHelpers[0]->getSvcRoutingPos(); + + m_gapPlanarStave = m_staveDBHelpers[0]->getGapPlanarStave(); + double serviceOffsetX = m_staveDBHelpers[0]->getServiceOffsetX(); + double staveSupportThick = m_staveDBHelpers[0]->getStaveSupportThick(); + double ecMinRadialPos = m_endcapModuleRshift-maxTiltedModuleThick-m_endcapModuleROffset; + double ecMaxRadialPos = m_endcapModuleRshift+m_endcapModuleROffset; double ecRadialPos = (m_svcRouting=="inner") ? ecMinRadialPos : ecMaxRadialPos; m_thicknessN = -(serviceOffsetX) + (0.5 * staveSupportThick); @@ -183,11 +209,11 @@ void GeoPixelLadderInclRef::preBuild( ) { m_thicknessP = serviceOffsetX + (0.5*staveSupportThick); if (ecRadialPos>0) m_thicknessP += ecRadialPos; - m_length = staveDBHelper.getStaveSupportLength() + 0.01; - m_width = staveDBHelper.getStaveSupportWidth(); + m_length = m_staveDBHelpers[0]->getStaveSupportLength() + 0.01; + m_width = m_staveDBHelpers[0]->getStaveSupportWidth(); if(m_width<0.01) m_width = m_barrelModule->Width()*.7; // <<------ This needs to be set properly in the xml - if (staveDBHelper.getStaveSupportType() == "Standard" ) { + if (m_staveDBHelpers[0]->getStaveSupportType() == "Standard" ) { m_staveSupport = new GeoPixelStaveSupportInclRef( getBasics(), m_layer, *m_barrelModule, m_barrelModuleTilt, 0., m_gapPlanarStave, ecMinRadialPos, ecMaxRadialPos, zEndOfNBarrelModulePos); } /* @@ -235,7 +261,7 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { m_svcMaterialCmpt = 0; double radiusMin = 999999.9; - double radiusMax = -999999.9; + double radiusMax = -999999.9; bool bVerbose = false; @@ -248,6 +274,9 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { int inclinedModTag = 500; // new sensor identifier tag for inclined modules + double rOffset = (m_sector%2==0) ? -0.5*m_endcapModuleROffset : 0.5*m_endcapModuleROffset; + double m_EndcapGlobalRshift = m_endcapModuleRshift+rOffset; + //-------------------------------------------------------- // Compute endcap module positions //-------------------------------------------------------- @@ -267,15 +296,17 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { double EcModThick_chip= m_endcapModule->getModuleSensorThick()*.5; double EcModHalfLen = m_endcapModule->getModuleSensorLength()*.5; + double zOffset = (m_sector%2==0) ? -0.5*m_endcapModuleZoffset : 0.5*m_endcapModuleZoffset; + for(int iPos=0; iPosThicknessP(); double yPos=m_endcapModPos[iPos].y(); - double zPos=m_endcapModPos[iPos].z(); + double zPos=m_endcapModPos[iPos].z() + zOffset; if(iPos==0&&m_transitionModuleNumber>0) { xPos=xPos+EcModHalfLen*vDir_transition.x()+EcModThick_chip*vDirPerp_transition.x(); - xPos+=m_endcapModuleRshift; + xPos+=m_EndcapGlobalRshift; zPos=zPos+EcModHalfLen*vDir_transition.y()+EcModThick_chip*vDirPerp_transition.y(); yPos-=m_transitionModule->Width()*.5; endcapModulePos.push_back(HepGeom::Point3D(xPos,yPos,zPos)); @@ -284,7 +315,7 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { } else { xPos=xPos+EcModHalfLen*vDir_endcap.x()+EcModThick_chip*vDirPerp_endcap.x(); - xPos+=m_endcapModuleRshift; + xPos+=m_EndcapGlobalRshift; zPos=zPos+EcModHalfLen*vDir_endcap.y()+EcModThick_chip*vDirPerp_endcap.y(); yPos=0.; endcapModulePos.push_back(HepGeom::Point3D(xPos,yPos,zPos)); @@ -321,11 +352,17 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { GeoPixelEndcapModuleSvcRef foamBuilder(getBasics(), m_width, m_layer, m_endcapModule, m_transitionModule, m_endcapInclAngle, m_transitionTiltAngle); GeoPhysVol* foamEndcap = dynamic_cast(foamBuilder.getEndcapFoam()); + //Adding correct staggering in r and z for the negative side + double zOffset = (m_sector%2==0) ? -0.5*m_endcapModuleZoffset : 0.5*m_endcapModuleZoffset; + double rOffset = (m_sector%2==0) ? 0.5*m_endcapModuleROffset : -0.5*m_endcapModuleROffset; + // Endcap servcie transforms - double zEndcapFoamShift = foamBuilder.getEndcapZshift()+.25; + double zEndcapFoamShift = foamBuilder.getEndcapZshift(); + zEndcapFoamShift += (m_svcRouting=="inner") ? -0.25 : 0.25; GeoPhysVol* foamTrans = dynamic_cast(foamBuilder.getTransFoam()); - double zTransFoamShift = foamBuilder.getTransZshift()+.25; - double xEndcapFoamShift = m_endcapModuleRshift - m_endcapModule->Length()*cos(m_endcapInclAngle) ; + double zTransFoamShift = foamBuilder.getTransZshift(); + zTransFoamShift += (m_svcRouting=="inner") ? -0.25 : 0.25; + double xEndcapFoamShift = m_EndcapGlobalRshift +2*rOffset - m_endcapModule->Length()*cos(m_endcapInclAngle) ; double xTransFoamShift = xEndcapFoamShift ; if (foamEndcap && !foamTrans) { @@ -355,9 +392,10 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { std::ostringstream modName; modName<<"_"<Build(0, m_layer, m_sector, iModuleCmpt, inclinedModTag , modName.str()); - xPos=endcapModulePos[endcapIterator].x(); + + xPos=endcapModulePos[endcapIterator].x()+2*rOffset; yPos=endcapModulePos[endcapIterator].y(); - zPos=-endcapModulePos[endcapIterator].z(); + zPos=-endcapModulePos[endcapIterator].z()+2*zOffset; if(bVerbose)std::cout<<"ENDCAP MODULE - ec : "<getIdHelper()->wafer_id(0, m_layer, m_sector, iModuleCmpt); @@ -478,9 +516,9 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { // Service box that containes all the module servcies running on the top of the stave if(m_IDserviceTool->svcRouteAuto()){ - double zInit=(iNeg==0)?-m_length*.5:-endcapModulePosTop[endcapIterator+1].z(); + double zInit=(iNeg==0)?-m_length*.495:-endcapModulePosTop[endcapIterator+1].z(); double zFinal=-endcapModulePosTop[endcapIterator].z(); - BuildAndPlaceModuleService(nbModuleSvc, zInit, zFinal, 0., ladderPhys, "endcap"); + BuildAndPlaceModuleService(nbModuleSvc, zInit, zFinal, m_barrelModuleZeroTilt, ladderPhys, "endcap"); } // Now store the xform by identifier: @@ -526,7 +564,8 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { //------------------------------------------------------ // Place the barrel modules //------------------------------------------------------ - double zNegStavePos= (m_barrelModuleNumber*m_barrelModule->Length()+m_barrelModuleGap*(m_barrelModuleNumber-1))*.5; + double zOffset = (m_sector%2==0) ? 0.5*m_barrelModuleZoffset : -0.5*m_barrelModuleZoffset; + double zNegStavePos= (m_barrelModuleNumber*m_barrelModule->Length()+m_barrelModuleGap*(m_barrelModuleNumber-1))*.5 + zOffset; zNegStavePos *=-1.; double zpos = zNegStavePos; @@ -584,7 +623,7 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { iModuleCmpt++; iBarrelModuleCmpt++; } - + // -------------------------------------------------------------------------- // BARREL CENTRAL REGION // -------------------------------------------------------------------------- @@ -640,31 +679,38 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { // Barrel module services double z0 = zpos-m_barrelModule->Length()*.5; double z1 = zpos+m_barrelModule->Length()*.5; - if(iBrl==0) z0 -= m_gapPlanarStave; + if(iBrl==0) z0 -= m_gapPlanarStave ; if(iBrl==m_barrelModuleNumber-1) z1 += m_gapPlanarStave; - BuildAndPlaceModuleService(nbModuleSvc, z0, z1 ,m_barrelModuleTilt, ladderPhys, "barrel"); + BuildAndPlaceModuleService(nbModuleSvc, z0, z1 ,m_barrelModuleTilt, ladderPhys, "barrel"); + // Barrel module to the first endcap module //if(m_transitionModuleNumber>0) { - if((iBrl==0||iBrl==m_barrelModuleNumber-1)&&m_endcapModuleNumber>0){ - double z0 = 0., z1=0.; - if(iBrl==0) { z0 = -endcapModulePos[0].z(); z1 = zpos - m_barrelModule->Length()*.5- m_gapPlanarStave; } - else if(iBrl==m_barrelModuleNumber-1) { z0 = zpos + m_barrelModule->Length()*.5+ m_gapPlanarStave; z1= endcapModulePos[0].z(); } - //BuildAndPlaceModuleService(nbModuleSvc, z0, z1 , m_barrelModuleTilt, ladderPhys, "endcap",ecSvcRadialPos); - BuildAndPlaceModuleService(nbModuleSvc, z0, z1 , 0., ladderPhys, "endcap"); + if(iBrl==0) { z0 = -endcapModulePos[0].z(); z1 = zpos - m_barrelModule->Length()*.5- m_gapPlanarStave + m_moduleSvcThickness; } + else if(iBrl==m_barrelModuleNumber-1) {z0 = zpos + m_barrelModule->Length()*.5+ m_gapPlanarStave-m_moduleSvcThickness; z1= endcapModulePos[0].z(); } + + if(iBrl==0 && (z1 - m_moduleSvcThickness) < -m_barrelZMax) z1 = -m_barrelZMax + m_moduleSvcThickness; + if(iBrl==m_barrelModuleNumber-1 && (z0 + m_moduleSvcThickness) > m_barrelZMax) z0 = m_barrelZMax - m_moduleSvcThickness; + + //BuildAndPlaceModuleService(nbModuleSvc, z0, z1 , m_barrelModuleTilt, ladderPhys, "endcap",ecSvcRadialPos); + BuildAndPlaceModuleService(nbModuleSvc, z0, z1 , m_barrelModuleZeroTilt, ladderPhys, "endcap"); // In case endcap modules are shifted in R - if(m_endcapModuleRshift){ + if(m_EndcapGlobalRshift){ double z0 = 0., z1=0.; - if(iBrl==0) { z0 = zpos - m_barrelModule->Length()*.5- m_gapPlanarStave; z1 = z0+m_moduleSvcThickness; } - else if(iBrl==m_barrelModuleNumber-1) { z1 = zpos + m_barrelModule->Length()*.5 + m_gapPlanarStave; z0 = z1-m_moduleSvcThickness; } + if(iBrl==0) { z1 = zpos - m_barrelModule->Length()*.5- m_gapPlanarStave + m_moduleSvcThickness; z0 = z1 - m_moduleSvcThickness; } + else if(iBrl==m_barrelModuleNumber-1) { z0 = zpos + m_barrelModule->Length()*.5+ m_gapPlanarStave-m_moduleSvcThickness; z1 = z0 + m_moduleSvcThickness;} + + if(iBrl==0 && z0 < -m_barrelZMax) { z0 = -m_barrelZMax; z1 = z0+m_moduleSvcThickness; } + else if(iBrl==m_barrelModuleNumber-1 && z1 > m_barrelZMax) { z1 = m_barrelZMax; z0 = z1-m_moduleSvcThickness;} + //BuildAndPlaceModuleService(nbModuleSvc, z0, z1 , m_barrelModuleTilt, ladderPhys, "radial"); - BuildAndPlaceModuleService(nbModuleSvc, z0, z1 , 0., ladderPhys, "radial"); + BuildAndPlaceModuleService(nbModuleSvc, z0, z1 , m_barrelModuleZeroTilt, ladderPhys, "radial"); } } - //} + //} } // Increment/decrement the number of module which services run on the top of the stave @@ -779,10 +825,14 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { GeoPixelEndcapModuleSvcRef foamBuilder(getBasics(), m_width, m_layer, m_endcapModule, m_transitionModule, m_endcapInclAngle, m_transitionTiltAngle); GeoPhysVol* foamEndcap = dynamic_cast(foamBuilder.getEndcapFoam()); - double zEndcapFoamShift = foamBuilder.getEndcapZshift()+.25; //m_endcapModule->ThicknessN()*sin(m_endcapInclAngle); + double zEndcapFoamShift = foamBuilder.getEndcapZshift(); //m_endcapModule->ThicknessN()*sin(m_endcapInclAngle); + zEndcapFoamShift += (m_svcRouting=="inner") ? -0.25 : 0.25; + GeoPhysVol* foamTrans = dynamic_cast(foamBuilder.getTransFoam()); - double zTransFoamShift = foamBuilder.getTransZshift()+.25; - double xEndcapFoamShift = m_endcapModuleRshift - m_endcapModule->Length()*cos(m_endcapInclAngle) ; + double zTransFoamShift = foamBuilder.getTransZshift(); + zTransFoamShift += (m_svcRouting=="inner") ? -0.25 : 0.25; + + double xEndcapFoamShift = m_EndcapGlobalRshift - m_endcapModule->Length()*cos(m_endcapInclAngle); double xTransFoamShift = xEndcapFoamShift ; if (foamEndcap && !foamTrans) { @@ -875,8 +925,8 @@ GeoVPhysVol* GeoPixelLadderInclRef::Build( ) { // Service box that containes all the module servcies running on the top of the stave if(m_IDserviceTool->svcRouteAuto()){ double zInit=endcapModulePosTop[iPos].z(); - double zFinal=(iPos0) { @@ -997,7 +1047,14 @@ GeoPhysVol* GeoPixelLadderInclRef::createServiceVolume(double length, double thi GeoBox * svcBox = new GeoBox(thick, width, length); msg(MSG::DEBUG) <<"Barrel module service material for layer "<hasMaterial(wg_matNameStave.str())) - svcMat = const_cast(matMgr()->getMaterial(wg_matNameStave.str())); // material already defined + if(matMgr()->hasMaterial(wg_matNameStave.str())) + svcMat = const_cast < GeoMaterial* > (matMgr()->getMaterial(wg_matNameStave.str())); // material already defined else svcMat = const_cast(matMgr()->getMaterialForVolumeLength(matNameStave, svcBox->volume(), 2*length, wg_matNameStave.str())); // define material } @@ -1026,8 +1083,10 @@ GeoPhysVol* GeoPixelLadderInclRef::createServiceVolume(double length, double thi if(matName=="None") return 0; if (matMgr()->hasMaterial(wg_matName.str())) svcMat = const_cast(matMgr()->getMaterial(wg_matName.str())); // material already defined - else - svcMat = const_cast(matMgr()->getMaterialForVolumeLength(matName, svcBox->volume(), 2*length, wg_matName.str())); // define material + else { + double fudge = m_IDserviceTool->getMaterialFudgeModuleSvc(m_layer); + svcMat = const_cast(matMgr()->getMaterialForVolumeLength(matName, svcBox->volume(), 2*length, wg_matName.str(),fudge)); // define material + } } if (svcMat==0) msg(MSG::DEBUG)<<"service material not defined for layer, sector: "<< m_layer<<":"< GeoPixelLadderInclRef:: ConstructAndPlaceModuleService(std:: double svcLength = zFinal - zInit; if(svcLength<=0) return svcBoundingBox; - // 2 helpers: services go on top half of longeron from last layer, or bottom half of longeron on this layer - std::vector staveDBHelpers; - staveDBHelpers.push_back(new PixelInclRefStaveXMLHelper(m_layer, getBasics())); - if (m_layer > 0) staveDBHelpers.push_back(new PixelInclRefStaveXMLHelper(m_layer-1, getBasics())); + double rOffset = (m_sector%2==0) ? -0.5*m_endcapModuleROffset : 0.5*m_endcapModuleROffset; + double m_EndcapGlobalRshift = m_endcapModuleRshift+rOffset; // Check for errors with use of "None" stave support type - if (staveDBHelpers[0]->getStaveSupportType() == "None") { + if (m_staveDBHelpers[0]->getStaveSupportType() == "None") { if (m_layer == 0) msg(MSG::WARNING) << "Cannot place service modules! No stave support on Layer 0. Check your XML!" << endreq; else{ - if (staveDBHelpers[1]->getStaveSupportType() != "Longeron") + if (m_staveDBHelpers[1]->getStaveSupportType() != "Longeron") msg(MSG::ERROR) << "Cannot build service modules! Layer " << m_layer << " has no stave support (Standard or Longeron). Check your XML!" << endreq; } } // Standard Stave built on this layer, index [0] - if (staveDBHelpers[0]->getStaveSupportType() == "Standard") { + if (m_staveDBHelpers[0]->getStaveSupportType() == "Standard") { double delta = .75; // delta defines the relative width of svc box - double xshift = staveDBHelpers[0]->getServiceOffsetX(); - double ec_xshift = staveDBHelpers[0]->getServiceECOffsetX(); + double xshift = m_staveDBHelpers[0]->getServiceOffsetX(); + double ec_xshift = m_staveDBHelpers[0]->getServiceECOffsetX(); double svcHalfThick = m_moduleSvcThickness*.5-0.001; double svcHalfWidth = m_barrelModule->Width()*delta*.5; double svcOffset = m_barrelModule->Width()*.5-svcHalfWidth; - if(locTilt<0) svcOffset = -svcOffset; + if(locTilt<0.) svcOffset = -svcOffset; double xPos_svc = 0.; - - if(type=="radial"){ - xPos_svc = (m_staveSupport->thicknessP_barrel()+m_staveSupport->thicknessP_endcap())*.5 - + 0.5*m_staveSupport->thickness()*fabs(sin(m_staveTmp->b_tilt)) -0.5; - svcHalfThick = fabs(m_staveSupport->thicknessP_barrel()-m_staveSupport->thicknessP_endcap())*0.5 - -m_staveSupport->thickness()*fabs(sin(m_staveTmp->b_tilt))*0.25; + double xPos_brl = 0.; + double xPos_ec = 0.; + if ( m_svcRouting=="outer" ){ + xPos_brl = m_staveSupport->thicknessP_barrel() + m_moduleSvcThickness*.5 + xshift; + xPos_ec = m_staveSupport->thicknessP_endcap() + m_moduleSvcThickness*.5 + xshift + ec_xshift; + } else { + double maxTiltedModuleThick=m_endcapModule->Length()*cos(m_endcapInclAngle); + xPos_brl = -m_staveSupport->thicknessP_barrel() - m_moduleSvcThickness*.5 - xshift; + xPos_ec = m_EndcapGlobalRshift - maxTiltedModuleThick - m_moduleSvcThickness*.5 - xshift - ec_xshift; + } + + if (type=="barrel") xPos_svc = xPos_brl; + else if (type=="endcap") xPos_svc = xPos_ec; + else if (type=="radial") { + xPos_svc = (xPos_brl + xPos_ec) * 0.5 + svcHalfWidth*fabs(sin(m_staveTmp->b_tilt))*0.5 + svcHalfThick*fabs(cos(m_staveTmp->b_tilt))*0.5; + svcHalfThick = fabs(xPos_brl - xPos_ec)*0.5 - svcHalfWidth*fabs(sin(m_staveTmp->b_tilt))*0.5 - svcHalfThick*(1+fabs(cos(m_staveTmp->b_tilt))*0.5); if (svcHalfThick<1.) return svcBoundingBox; } - else { - - if ( m_svcRouting=="outer" ) { - xPos_svc = (type=="barrel")? m_staveSupport->thicknessP_barrel():m_staveSupport->thicknessP_endcap(); - xPos_svc+= m_moduleSvcThickness*.5+xshift; - xPos_svc+= (type=="barrel") ? 0. : ec_xshift; // EC shift used on top of "global" shift - } else { // inner routing - float maxTiltedModuleThick=m_endcapModule->Length()*cos(m_endcapInclAngle); - xPos_svc = (type=="barrel")? -m_staveSupport->thicknessP_barrel() : m_endcapModuleRshift -maxTiltedModuleThick; - xPos_svc-= m_moduleSvcThickness*.5+xshift; - xPos_svc+= (type=="barrel") ? 0. : -ec_xshift; // EC shift used on top of "global" shift - } - } // Service location and dimensions svcBoundingBox.push_back(xPos_svc); svcBoundingBox.push_back(-svcOffset); svcBoundingBox.push_back(svcHalfWidth*sin(locTilt) + svcHalfThick*cos(locTilt)); svcBoundingBox.push_back(svcHalfWidth*cos(locTilt) + svcHalfThick*sin(locTilt)); - + if (build) { GeoPhysVol* svcPhys = createServiceVolume(svcLength*.5, svcHalfThick, svcHalfWidth, moduleNumber); if (!svcPhys) return svcBoundingBox; + GeoTransform* xform_svc = new GeoTransform(HepGeom::Translate3D(xPos_svc, -svcOffset, (zInit+zFinal)*.5)*HepGeom::RotateZ3D(locTilt)); volPhys->add(xform_svc); volPhys->add(svcPhys); } } - - // ========================== // Building longeron services // ========================== @@ -1127,10 +1180,10 @@ std::vector GeoPixelLadderInclRef:: ConstructAndPlaceModuleService(std:: double svcRouteDir = (m_svcRouting == "inner") ? 1.0 : -1.0; unsigned int index = (svcRouteDir > 0) ? 1 : 0; - if (staveDBHelpers[index]->getStaveSupportType() == "Longeron") { + if (m_staveDBHelpers[index]->getStaveSupportType() == "Longeron") { // deltaphi is calculated from n sectors on layer which "owns" the longeron, find nsectors for this layer // Apologies, but I can find no better way of getting this info - int owningLayer = staveDBHelpers[index]->getOwningLayer(); + int owningLayer = m_staveDBHelpers[index]->getOwningLayer(); int nSectors = 0; if (owningLayer == m_layer) nSectors = m_nSectors; else if (owningLayer == m_layer-1) nSectors = m_nSectorsLastLayer; @@ -1152,10 +1205,10 @@ std::vector GeoPixelLadderInclRef:: ConstructAndPlaceModuleService(std:: double phiOffsetLongeron = 9999999; int testLongeronIndex = 0; - double testLongeronPhi = (staveDBHelpers[index]->getStartPhi()*deltaPhi) ; + double testLongeronPhi = (m_staveDBHelpers[index]->getStartPhi()*deltaPhi) ; testLongeronPhi += (index == 1) ? m_phiOfStaveZeroLastLayer : m_phiOfStaveZero; double lastLongeronPhi = testLongeronPhi + 360*CLHEP::deg; - int nStaveShapes = staveDBHelpers[index]->getNStaveShapes(); + int nStaveShapes = m_staveDBHelpers[index]->getNStaveShapes(); while (testLongeronPhi < lastLongeronPhi) { double phiDiff = testLongeronPhi - sectorPhi; @@ -1167,7 +1220,7 @@ std::vector GeoPixelLadderInclRef:: ConstructAndPlaceModuleService(std:: } // Advance to next test longeron - testLongeronPhi += staveDBHelpers[index]->getPhiStepSize(longeronIndex)*deltaPhi; + testLongeronPhi += m_staveDBHelpers[index]->getPhiStepSize(longeronIndex)*deltaPhi; testLongeronIndex++; if (testLongeronIndex == nStaveShapes) testLongeronIndex = 0; } @@ -1178,37 +1231,46 @@ std::vector GeoPixelLadderInclRef:: ConstructAndPlaceModuleService(std:: if (type == "endcap") svcHalfThick *= 2.0; // = Barrel + Endcap service thickness // Useful longeron properties - double supRadialMidpoint = staveDBHelpers[index]->getRadialMidpointAtEOS(); - double supRadialLength = staveDBHelpers[index]->getRadialLengthAtEOS(longeronIndex); - double supShellThickness = staveDBHelpers[index]->getWallThickness (longeronIndex); - double supRadialExtHighR = staveDBHelpers[index]->getXStepHighR (longeronIndex); - double supRadialExtLowR = staveDBHelpers[index]->getXStepLowR (longeronIndex); + double supRadialMidpoint = m_staveDBHelpers[index]->getRadialMidpointAtEOS(); + double supRadialLength = m_staveDBHelpers[index]->getRadialLengthAtEOS(longeronIndex); + double supShellThickness = m_staveDBHelpers[index]->getWallThickness (longeronIndex); + double supRadialExtHighR = m_staveDBHelpers[index]->getXStepHighR (longeronIndex); + double supRadialExtLowR = m_staveDBHelpers[index]->getXStepLowR (longeronIndex); // stave support width - double supWidth = (svcRouteDir > 0) ? staveDBHelpers[index]->getTopWidthAtEOS(longeronIndex) : staveDBHelpers[index]->getBaseWidthAtEOS(longeronIndex); - supWidth = std::min(staveDBHelpers[index]->getBarrelWidth(longeronIndex), supWidth); + double supWidth = (svcRouteDir > 0) ? m_staveDBHelpers[index]->getTopWidthAtEOS(longeronIndex) : m_staveDBHelpers[index]->getBaseWidthAtEOS(longeronIndex); + supWidth = std::min(m_staveDBHelpers[index]->getBarrelWidth(longeronIndex), supWidth); // Alternating layers have overlapping services, offset one radially double svcOverlapOffset = 0.0; - if (fabs(phiOffsetLongeron) > 0.0001 && m_sector%2 == 0) svcOverlapOffset = (2.0*svcHalfThick) + 0.01; - + //if (fabs(phiOffsetLongeron) > 0.0001 && m_sector%2 == 0) svcOverlapOffset = (2.0*svcHalfThick) + 0.01; + if (fabs(phiOffsetLongeron) > 0.0001 && m_sector%2 == 0) svcOverlapOffset = (2.2*m_moduleSvcThickness); // Corrections to parameters - barrel offset, and radial link from barrel to eos double supBarrelExtension = 0.0; if (type == "barrel" || type == "radial" ) { supBarrelExtension = (svcRouteDir > 0) ? supRadialExtHighR : supRadialExtLowR; } + // Reducing svc width if it does not fit in longeron + if (fabs(phiOffsetLongeron) > 0.0001){ //two svc in one longeron + while((2.2*svcHalfWidth) > ((supWidth*0.5) - supShellThickness) && svcHalfWidth > 0.1) + svcHalfWidth*=0.98; + } + else{ // one svc in one longeron + while((1.1*svcHalfWidth) > ((supWidth*0.5) - supShellThickness) && svcHalfWidth > 0.1) + svcHalfWidth*=0.98; + } + + // Defining width for radial module double radialSvcOffset = 0.0; if (type == "radial") { - radialSvcOffset += (2.0* svcHalfThick); - if (svcOverlapOffset > 0.0) - svcHalfThick = (0.5*supBarrelExtension) + (2.0*svcHalfThick); - else - svcHalfThick = (0.5*supBarrelExtension) + (svcHalfThick); + radialSvcOffset += 2.0*svcHalfThick; + svcHalfThick = (0.5*supBarrelExtension) - svcHalfThick; } - + // svc routing inner = along outer half of longeron double radiusSvc = supRadialMidpoint + ((0.5*supRadialLength) - supShellThickness + supBarrelExtension - svcHalfThick - svcOverlapOffset - radialSvcOffset) * svcRouteDir; + //double radiusSvc = supRadialMidpoint + ((0.5*supRadialLength) - supShellThickness + supBarrelExtension - svcOverlapOffset - radialSvcOffset) * svcRouteDir; HepGeom::Point3D gServicePos = HepGeom::RotateZ3D( phiOffsetLongeron )*HepGeom::Point3D(radiusSvc, 0.0, 0.0); // Shift svc along longeron inside wall (so two services can be placed next to each other) @@ -1229,7 +1291,6 @@ std::vector GeoPixelLadderInclRef:: ConstructAndPlaceModuleService(std:: double yOffsetSvc = gServicePos.y() - gLadderPos.y(); double zOffsetSvc = (zInit+zFinal)*.5; - // Compute return vector: 0 = xOffsetSvc, 1 = yOffsetSvc, 2 = boundingBoxX, 3 = BounfdingBoxY svcBoundingBox.push_back(xOffsetSvc); svcBoundingBox.push_back(yOffsetSvc); @@ -1244,13 +1305,8 @@ std::vector GeoPixelLadderInclRef:: ConstructAndPlaceModuleService(std:: volPhys->add(xform_svc); volPhys->add(svcPhys); } + } - // Cleanup - for(auto it = staveDBHelpers.begin(); it != staveDBHelpers.end(); ++it) delete (*it); - staveDBHelpers.clear(); - return svcBoundingBox; } - - diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLadderPlanarRef.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLadderPlanarRef.cxx index 485b3dcc03b06b206e2728595a8a06d76ca7c042..a52bd01aa5c5a9d3d978cac9092d5b51f2a87fc5 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLadderPlanarRef.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLadderPlanarRef.cxx @@ -1,3 +1,7 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + #include "BarrelInclinedRef/GeoPixelLadderPlanarRef.h" #include "BarrelInclinedRef/GeoPixelStaveSupportInclRef.h" #include "BarrelInclinedRef/PixelInclRefStaveXMLHelper.h" @@ -27,6 +31,9 @@ #include "GeoModelKernel/GeoShapeUnion.h" #include "PathResolver/PathResolver.h" +#include "InDetTrackingGeometryXML/XMLReaderSvc.h" + + using std::max; GeoPixelLadderPlanarRef::GeoPixelLadderPlanarRef(const PixelGeoBuilderBasics* basics, const InDet::StaveTmp *staveTmp, @@ -92,6 +99,9 @@ void GeoPixelLadderPlanarRef::preBuild( ) { msg(MSG::INFO) << "Could not retrieve pixel module builder tool " << m_pixelModuleSvc << ", some services will not be built." << endreq; else msg(MSG::INFO) << "Pixel module builder tool retrieved: " << m_pixelModuleSvc << endreq; + + m_pixelModuleSvc->initModuleMap(getBasics()); + m_pixelDesignSvc->initModuleMap(getBasics()); // Access stave description xml file PixelInclRefStaveXMLHelper staveDBHelper(m_layer, getBasics()); @@ -144,7 +154,7 @@ void GeoPixelLadderPlanarRef::preBuild( ) { // double staveYoffset = staveTrf.getTranslation().y(); m_length = 2.*m_staveTmp->support_halflength; - + double thicknessN_tot = m_barrelModule->Thickness()*.5+.5; double thicknessP_tot = m_barrelModule->Thickness()*.5+fabs(staveXoffset)+thicknessN+thicknessP+m_moduleSvcThickness; @@ -169,6 +179,7 @@ void GeoPixelLadderPlanarRef::preBuild( ) { // ---------------------------------------------------------------------------- getBasics()->getDetectorManager()->numerology().setNumEtaModulesForLayer(m_layer,m_barrelModuleNumber); + // ---------------------------------------------------------------------------- // Ladder max size // ---------------------------------------------------------------------------- @@ -180,6 +191,53 @@ void GeoPixelLadderPlanarRef::preBuild( ) { } +//build pigtail +GeoVPhysVol* GeoPixelLadderPlanarRef::BuildPigtail() { + + //define volume for pigtails for each stave + PixelInclRefStaveXMLHelper staveDBHelper(m_layer, getBasics()); + std::string matNamePigtail= staveDBHelper.getPigtailMaterial(); + if(matNamePigtail == "nopg") return 0; + double delta = 0.75; + double anglePigtail = staveDBHelper.getPigtailAngle(m_sector)*CLHEP::deg; + double lengthPigtail = staveDBHelper.getPigtailDR()/cos(anglePigtail); + const double safety = 0.01*CLHEP::mm; + GeoBox * boxPigtail = new GeoBox(lengthPigtail*.5+safety,m_moduleSvcThickness*.5, m_length*.5); + + const GeoMaterial* air = matMgr()->getMaterial("std::Air"); + GeoLogVol* m_thePigtail= new GeoLogVol("Pigtail",boxPigtail,air); + GeoPhysVol* pigtailPhys = new GeoPhysVol(m_thePigtail); + // + // Place the barrel pigtail + //------------------------------------------------------ + + double xposShift = 0.; + double yposShift = 0.; + + for(int ii = 0; ii < m_barrelModuleNumber; ii++) + { + double xpos = 0.; + //double ypos = 0.; + double zpos = m_barrelModuleDZ*(ii - .5*(m_barrelModuleNumber-1)); + + GeoBox * pgBox = new GeoBox(lengthPigtail*.5,m_moduleSvcThickness*.5, m_barrelModule->Width()*delta*.5); + double pgVolume = pgBox->volume(); + const GeoMaterial* pgMaterial = matMgr()->getMaterialForVolume(matNamePigtail, pgVolume, ""); + + GeoLogVol* pgLog = new GeoLogVol("ModuleSvc",pgBox,pgMaterial); + GeoPhysVol* pgPhys = new GeoPhysVol(pgLog); + + double z_pg=zpos; + CLHEP::Hep3Vector pigtailpos(xpos+xposShift,yposShift,z_pg); + CLHEP::HepRotation pg_rm; + GeoAlignableTransform* xform_pg = new GeoAlignableTransform(HepGeom::TranslateX3D(xpos)*HepGeom::Transform3D(pg_rm,pigtailpos)); + pigtailPhys->add(xform_pg); + + pigtailPhys->add(pgPhys); + } + + return pigtailPhys; +} GeoVPhysVol* GeoPixelLadderPlanarRef::Build() { @@ -256,7 +314,7 @@ GeoVPhysVol* GeoPixelLadderPlanarRef::Build() { getBasics()->getDetectorManager()->addAlignableTransform(0,idwafer,xform,modulePhys); // Place the stave service scaled vs the number of modules (on the top of the stave support...) - if(m_IDserviceTool->svcRouteAuto()){ + if(m_IDserviceTool->svcRouteAuto() && m_staveSupport->getSvcRoutingPos() != "none"){ GeoBox * svcBox = new GeoBox(m_moduleSvcThickness*.5-0.001, m_barrelModule->Width()*.5, m_barrelModule->Length()*.5); std::string matName = m_IDserviceTool->getLayerModuleMaterialName(m_layer ,nbSvcModule); // material name stored in PixelServicesTool (material are built there) std::ostringstream wg_matName; @@ -289,7 +347,7 @@ GeoVPhysVol* GeoPixelLadderPlanarRef::Build() { GeoBox * svcBox = new GeoBox(m_moduleSvcThickness*.5-0.001, m_barrelModule->Width()*.5, length*.5); std::ostringstream wg_matName; wg_matName<(matMgr()->getMaterialForVolumeLength(matName, svcBox->volume(), length ,wg_matName.str())); // define material diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLayerInclRefTool.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLayerInclRefTool.cxx index 890147919b9440493941674a45a0d4082d5d2096..d3329643a0825ea961fb158bf989a2cd204ffd0d 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLayerInclRefTool.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelLayerInclRefTool.cxx @@ -1,4 +1,5 @@ #include "BarrelInclinedRef/PixelInclRefStaveXMLHelper.h" +#include "PixelLayoutUtils/PixelGeneralXMLHelper.h" #include "BarrelInclinedRef/GeoPixelLayerInclRefTool.h" #include "BarrelInclinedRef/GeoPixelSlimStaveSupportInclRef.h" #include "PixelInterfaces/IPixelLayerValidationTool.h" @@ -122,7 +123,7 @@ GeoVPhysVol* GeoPixelLayerInclRefTool::buildLayer(const PixelGeoBuilderBasics* b // // create a barrel layer // - + InDet::BarrelLayerTmp *layerTmp = m_xmlReader->getPixelBarrelLayerTemplate(m_layer); printf("************** BUILD LAYER %d\n", m_layer); @@ -161,6 +162,10 @@ GeoVPhysVol* GeoPixelLayerInclRefTool::buildLayer(const PixelGeoBuilderBasics* b // Register the number of stave defined for the layer basics->getDetectorManager()->numerology().setNumPhiModulesForLayer(m_layer,nSectors); + PixelGeneralXMLHelper genDBHelper("PIXEL_PIXELGENERAL_GEO_XML",basics); + double brl_rmin = genDBHelper.getBarrelRMin(); + double brl_rmax = genDBHelper.getBarrelRMax(); + GeoFullPhysVol* layerPhys = 0; // Loop over the sectors and place everything @@ -185,14 +190,13 @@ GeoVPhysVol* GeoPixelLayerInclRefTool::buildLayer(const PixelGeoBuilderBasics* b msg(MSG::DEBUG)<<"Layer "<nbOfPixelBarrelLayers())-1) rmax += fabs(staveHelperCurrLayer.getRadialMidpointAtEOS() - layerRadius); + if (m_layer == int(m_xmlReader->nbOfPixelBarrelLayers())-1) rmax = brl_rmax - 0.01; } // If previous layer used a longeron, extend this layer's envelope down to meet it @@ -200,13 +204,16 @@ GeoVPhysVol* GeoPixelLayerInclRefTool::buildLayer(const PixelGeoBuilderBasics* b PixelInclRefStaveXMLHelper staveHelperLastLayer(m_layer-1, basics); if (staveHelperLastLayer.getStaveSupportType() == "Longeron") rmin = staveHelperLastLayer.getRadialMidpointAtEOS(); } - + + if ( rmin < brl_rmin ) rmin = brl_rmin + 0.001; + if ( rmax > brl_rmax ) rmax = brl_rmax - 0.001; + // Now make the layer envelope msg(MSG::DEBUG)<<"Layer "<matMgr()->getMaterial("std::Air"); std::ostringstream lname; lname << "Layer" << m_layer; - const GeoTube* layerTube = new GeoTube(rmin,rmax,0.5*ladderLength); //solid + const GeoTube* layerTube = new GeoTube(rmin,rmax,0.5*(ladderLength)+staveOffset); //solid const GeoLogVol* layerLog = new GeoLogVol(lname.str(),layerTube,air); //log volume layerPhys = new GeoFullPhysVol(layerLog); // phys vol } @@ -266,7 +273,7 @@ GeoVPhysVol* GeoPixelLayerInclRefTool::buildLayer(const PixelGeoBuilderBasics* b ShellsToBuild.push_back(halfStaveType::OUTER); // Last layer is a special case - outer shell will be full longeron (inner+outer halves) - if (m_layer == m_xmlReader->nbOfPixelBarrelLayers()-1) ShellsToBuild.push_back(halfStaveType::INNER); + if (m_layer == int(m_xmlReader->nbOfPixelBarrelLayers()-1)) ShellsToBuild.push_back(halfStaveType::INNER); } @@ -320,7 +327,7 @@ void GeoPixelLayerInclRefTool::ComputeLayerThickness(const GeoPixelLadderInclRef // // Calculate layerThicknessN: Thickness from layer radius to min radius of envelope // Calculate layerThicknessP: Thickness from layer radius to max radius of envelope - // + // double ladderHalfThickN = pixelLadder.thicknessN(); double ladderHalfThickP = pixelLadder.thicknessP(); double ladderHalfWidth = pixelLadder.width()/2; @@ -328,7 +335,7 @@ void GeoPixelLayerInclRefTool::ComputeLayerThickness(const GeoPixelLadderInclRef << ladderHalfThickN << " "<< ladderHalfThickP << " " << ladderHalfWidth << " " << ladderTilt << " " << layerRadius << endreq; - double distToClosestPoint = 0.; + double distToClosestPoint = 0.; double radClosest = -ladderHalfThickN*cos(std::abs(ladderTilt))+layerRadius; if (ladderTilt!=0.) { @@ -338,8 +345,6 @@ void GeoPixelLayerInclRefTool::ComputeLayerThickness(const GeoPixelLadderInclRef // x1, y1 is the point on the center of ladder surface. double y1 = -ladderHalfThickN*sin(std::abs(ladderTilt)); - std::cout << "y1 = " << y1 << std::endl; - double x1 = -ladderHalfThickN*cos(std::abs(ladderTilt))+layerRadius; // x1, y2 is the point of closest approach. @@ -351,8 +356,9 @@ void GeoPixelLayerInclRefTool::ComputeLayerThickness(const GeoPixelLadderInclRef // distance of closest approach. radClosest = (y1 - grad*x1)/(sqrt(1+grad*grad)); } - //msg(MSG::DEBUG) << "Distance of closest approach: " << radClosest << endreq; - //msg(MSG::DEBUG) << "Distance along ladder surface from center to point of closest approach: " << distToClosestPoint << endreq; + + + // Calculate the radius of the corners of the ladder. HepGeom::Point3D ladderLowerCorner(-ladderHalfThickN, ladderHalfWidth, 0); @@ -363,16 +369,9 @@ void GeoPixelLayerInclRefTool::ComputeLayerThickness(const GeoPixelLadderInclRef m_layerThicknessN = layerRadius - ladderLowerCorner.perp(); m_layerThicknessP = ladderUpperCorner.perp() - layerRadius; // Will be recalculated below in case of additional services - // msg(MSG::DEBUG)<<"Max thickness : ladderhick "< staveTmp = m_xmlReader->getPixelStaveTemplate(m_layer); GeoPixelLadderPlanarRef pixelLadder(basics, staveTmp[0], m_layer, transRadiusAndTilt); ComputeLayerThickness(pixelLadder, ladderTilt, layerRadius); - - // Register the number of stave defined for the layer + basics->getDetectorManager()->numerology().setNumPhiModulesForLayer(m_layer,nSectors); - + GeoFullPhysVol* layerPhys = 0; + PixelInclRefStaveXMLHelper staveDBHelper(m_layer, basics); // Loop over the sectors and place everything // @@ -145,13 +140,32 @@ GeoVPhysVol* GeoPixelLayerPlanarRefTool::buildLayer(const PixelGeoBuilderBasics* // Build ladder pixelLadder.setSector(ii); + GeoVPhysVol *ladderPhys=pixelLadder.Build(); - + GeoVPhysVol *pigtailPhys=pixelLadder.BuildPigtail(); + if(ii==0){ double safety = 0.01 * CLHEP::mm; double rmin = layerRadius-m_layerThicknessN - safety; double rmax = layerRadius+m_layerThicknessP + safety; + //enlarge the rmax to ensure pigtails are included + if(pigtailPhys != 0){ + InDet::BarrelLayerTmp *lp1 = m_xmlReader->getPixelBarrelLayerTemplate(m_layer+1); + double lp1_radius = lp1->radius; + double lp1_tilt = lp1->stave_tilt; + HepGeom::Transform3D lp1_xform = HepGeom::TranslateX3D(lp1_radius)*HepGeom::RotateZ3D(lp1_tilt); + std::vector lp1_stave = m_xmlReader->getPixelStaveTemplate(m_layer+1); + GeoPixelLadderPlanarRef lp1_ladder(basics, lp1_stave[0], m_layer+1, lp1_xform); + + double lp1_thickN = lp1_ladder.thicknessN(); + double lp1_halfWidth = lp1_ladder.width()/2; + + HepGeom::Point3D lp1_lowerCorner(-lp1_thickN, lp1_halfWidth, 0); + lp1_lowerCorner = HepGeom::TranslateX3D(lp1_radius) * HepGeom::RotateZ3D(std::abs(lp1_tilt)) * lp1_lowerCorner; + + rmax = lp1_lowerCorner.perp() - safety; + } double ladderLength = pixelLadder.envLength() + 4*basics->epsilon(); // Ladder has length gmt_mgr->PixelLadderLength() + 2*m_epsilon // Now make the layer envelope @@ -174,14 +188,31 @@ GeoVPhysVol* GeoPixelLayerPlanarRefTool::buildLayer(const PixelGeoBuilderBasics* // Place the active ladders // std::ostringstream nameTag; - nameTag << "Ladder" << ii; + nameTag << "LadderL" << m_layer << "_" << ii; GeoNameTag * tag = new GeoNameTag(nameTag.str()); GeoTransform* xform = new GeoTransform(ladderTransform); layerPhys->add(tag); layerPhys->add(new GeoIdentifierTag(ii) ); layerPhys->add(xform); layerPhys->add(ladderPhys); //pixelLadder->Build()); - + //for pigtail + if(pigtailPhys!=0){ + double pigtailAngle = staveDBHelper.getPigtailAngle(ii); + double pigtailDR = staveDBHelper.getPigtailDR(); + double safety = 0.01 * CLHEP::mm; + + HepGeom::Transform3D transRadiusAndTiltAndPgAngle = HepGeom::TranslateX3D(layerRadius +m_layerThicknessP +pigtailDR*.5 +safety) * HepGeom::RotateZ3D(ladderTilt+pigtailAngle*CLHEP::deg); + HepGeom::Transform3D pigtailTransform = HepGeom::RotateZ3D(phiOfSector) * transRadiusAndTiltAndPgAngle; + + std::ostringstream nameTagPg; + nameTagPg << "PigtailL" << m_layer << "_" << ii; + GeoNameTag * tagPg = new GeoNameTag(nameTagPg.str()); + GeoTransform* xformPg = new GeoTransform(pigtailTransform); + layerPhys->add(tagPg); + layerPhys->add(new GeoIdentifierTag(ii) ); + layerPhys->add(xformPg); + layerPhys->add(pigtailPhys); + } } @@ -229,7 +260,7 @@ void GeoPixelLayerPlanarRefTool::ComputeLayerThickness(const GeoPixelLadderPlana m_layerThicknessN = layerRadius - ladderLowerCorner.perp(); m_layerThicknessP = ladderUpperCorner.perp() - layerRadius; // Will be recalculated below in case of additional services - + // msg(MSG::DEBUG)<<"Max thickness : ladderhick "< halfEosRadius) eosCornerThickness = 0.6; + + // No idea what this correction does... + double shapeCorr = (halfBarrelWidth + (eosBaseWidth + eosTopWidth)*0.25)*0.5; + shapeCorr = radialMidpoint - sqrt(radialMidpoint*radialMidpoint - shapeCorr*shapeCorr); + radialMidpoint -= shapeCorr; + double safety = 0.25; + radialMidpoint += (m_staveType == INNER) ? safety : -safety; + + halfBarrelRadius += (m_staveType == INNER) ? shapeCorr : -shapeCorr; + halfEosRadius += (m_staveType == INNER) ? shapeCorr : -shapeCorr; + // Construct an envelope volume - offset to enclose inner/outer stave + // Length of volume = envelope length minus a 0.05mm safety factor double envelopeWidth = std::max(std::max(eosTopWidth, eosBaseWidth), brlWidth); double envelopeOffset = (m_staveType == INNER) ? halfBarrelRadius/2.0 : -halfBarrelRadius/2.0; - GeoBox* longeronEnvelope = new GeoBox(halfBarrelRadius/2.0, envelopeWidth/2.0, brlZMax+eosLength); + GeoBox* longeronEnvelope = new GeoBox(halfBarrelRadius/2.0, envelopeWidth/2.0, (staveDBHelper.getStaveSupportLength() * 0.5) - 0.05); const GeoShape* envelopeShape = &((*longeronEnvelope) << HepGeom::Translate3D(envelopeOffset, 0.0, 0.0)); GeoLogVol* longeronLogVol = new GeoLogVol("Longeron", envelopeShape, matMgr()->getMaterial("special::Ether")); m_physVol = new GeoPhysVol(longeronLogVol); @@ -135,33 +149,33 @@ void GeoPixelSlimStaveSupportInclRef::preBuild() { eosWall1->addVertex(0.0, (0.5*eosBaseWidth) - outerOffsetMid); eosWall1->addVertex(0.0, (0.5*eosBaseWidth) - outerOffsetMid - fabs(wallThickness/sin(eosShellAngle)) ); - eosWall1->addVertex(halfEosRadius - cornerThickness*sin(eosShellAngle), (0.5*eosTopWidth) - cornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle) ); - eosWall1->addVertex(halfEosRadius - cornerThickness*sin(eosShellAngle), (0.5*eosTopWidth) - cornerThickness*cos(eosShellAngle)); + eosWall1->addVertex(halfEosRadius - eosCornerThickness*sin(eosShellAngle), (0.5*eosTopWidth) - eosCornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle) ); + eosWall1->addVertex(halfEosRadius - eosCornerThickness*sin(eosShellAngle), (0.5*eosTopWidth) - eosCornerThickness*cos(eosShellAngle)); - eosWall2->addVertex(halfEosRadius - wallThickness, -((0.5*eosTopWidth) - cornerThickness - wallThickness*cos(eosShellAngle))); - eosWall2->addVertex(halfEosRadius, -((0.5*eosTopWidth) - cornerThickness)); - eosWall2->addVertex(halfEosRadius, (0.5*eosTopWidth) - cornerThickness); - eosWall2->addVertex(halfEosRadius - wallThickness, (0.5*eosTopWidth) - cornerThickness - wallThickness*cos(eosShellAngle)); + eosWall2->addVertex(halfEosRadius - wallThickness, -((0.5*eosTopWidth) - eosCornerThickness - wallThickness*cos(eosShellAngle))); + eosWall2->addVertex(halfEosRadius, -((0.5*eosTopWidth) - eosCornerThickness)); + eosWall2->addVertex(halfEosRadius, (0.5*eosTopWidth) - eosCornerThickness); + eosWall2->addVertex(halfEosRadius - wallThickness, (0.5*eosTopWidth) - eosCornerThickness - wallThickness*cos(eosShellAngle)); - eosWall3->addVertex(halfEosRadius - cornerThickness*sin(eosShellAngle), -((0.5*eosTopWidth) - cornerThickness*cos(eosShellAngle))); - eosWall3->addVertex(halfEosRadius - cornerThickness*sin(eosShellAngle), -((0.5*eosTopWidth) - cornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle)) ); + eosWall3->addVertex(halfEosRadius - eosCornerThickness*sin(eosShellAngle), -((0.5*eosTopWidth) - eosCornerThickness*cos(eosShellAngle))); + eosWall3->addVertex(halfEosRadius - eosCornerThickness*sin(eosShellAngle), -((0.5*eosTopWidth) - eosCornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle)) ); eosWall3->addVertex(0.0, -((0.5*eosBaseWidth) - outerOffsetMid - fabs(wallThickness/sin(eosShellAngle))) ); eosWall3->addVertex(0.0, -((0.5*eosBaseWidth) - outerOffsetMid)); - eosCorner1->addVertex(halfEosRadius - cornerThickness*sin(eosShellAngle), (0.5*eosTopWidth) - cornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle) ); + eosCorner1->addVertex(halfEosRadius - eosCornerThickness*sin(eosShellAngle), (0.5*eosTopWidth) - eosCornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle) ); eosCorner1->addVertex(halfEosRadius - wallThickness, (0.5*eosTopWidth) - ((wallThickness/sin(eosShellAngle)) + wallThickness/tan(eosShellAngle) ) ); - eosCorner1->addVertex(halfEosRadius - wallThickness, (0.5*eosTopWidth) - cornerThickness - wallThickness*cos(eosShellAngle)); - eosCorner1->addVertex(halfEosRadius, (0.5*eosTopWidth) - cornerThickness); + eosCorner1->addVertex(halfEosRadius - wallThickness, (0.5*eosTopWidth) - eosCornerThickness - wallThickness*cos(eosShellAngle)); + eosCorner1->addVertex(halfEosRadius, (0.5*eosTopWidth) - eosCornerThickness); eosCorner1->addVertex(halfEosRadius, (0.5*eosTopWidth)); - eosCorner1->addVertex(halfEosRadius - cornerThickness*sin(eosShellAngle), (0.5*eosTopWidth) - cornerThickness*cos(eosShellAngle)); + eosCorner1->addVertex(halfEosRadius - eosCornerThickness*sin(eosShellAngle), (0.5*eosTopWidth) - eosCornerThickness*cos(eosShellAngle)); - eosCorner2->addVertex(halfEosRadius - cornerThickness*sin(eosShellAngle), -((0.5*eosTopWidth) - cornerThickness*cos(eosShellAngle))); + eosCorner2->addVertex(halfEosRadius - eosCornerThickness*sin(eosShellAngle), -((0.5*eosTopWidth) - eosCornerThickness*cos(eosShellAngle))); eosCorner2->addVertex(halfEosRadius, -((0.5*eosTopWidth))); - eosCorner2->addVertex(halfEosRadius, -((0.5*eosTopWidth) - cornerThickness)); - eosCorner2->addVertex(halfEosRadius - wallThickness, -((0.5*eosTopWidth) - cornerThickness - wallThickness*cos(eosShellAngle))); + eosCorner2->addVertex(halfEosRadius, -((0.5*eosTopWidth) - eosCornerThickness)); + eosCorner2->addVertex(halfEosRadius - wallThickness, -((0.5*eosTopWidth) - eosCornerThickness - wallThickness*cos(eosShellAngle))); eosCorner2->addVertex(halfEosRadius - wallThickness, -((0.5*eosTopWidth) - ((wallThickness/sin(eosShellAngle)) + wallThickness/tan(eosShellAngle) ) )); - eosCorner2->addVertex(halfEosRadius - cornerThickness*sin(eosShellAngle), -((0.5*eosTopWidth) - cornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle) )); + eosCorner2->addVertex(halfEosRadius - eosCornerThickness*sin(eosShellAngle), -((0.5*eosTopWidth) - eosCornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle) )); } @@ -200,35 +214,35 @@ void GeoPixelSlimStaveSupportInclRef::preBuild() { brlCorner2->addVertex(-halfBarrelRadius +cornerThickness, -(halfBarrelWidth)); // eos walls - eosWall1->addVertex((-1.0*halfEosRadius) + cornerThickness*sin(eosShellAngle), (0.5*eosBaseWidth) - cornerThickness*cos(eosShellAngle)); - eosWall1->addVertex((-1.0*halfEosRadius) + cornerThickness*sin(eosShellAngle), (0.5*eosBaseWidth) - cornerThickness*cos(eosShellAngle) - fabs(wallThickness/sin(eosShellAngle)) ); + eosWall1->addVertex((-1.0*halfEosRadius) + eosCornerThickness*sin(eosShellAngle), (0.5*eosBaseWidth) - eosCornerThickness*cos(eosShellAngle)); + eosWall1->addVertex((-1.0*halfEosRadius) + eosCornerThickness*sin(eosShellAngle), (0.5*eosBaseWidth) - eosCornerThickness*cos(eosShellAngle) - fabs(wallThickness/sin(eosShellAngle)) ); eosWall1->addVertex(0.0, 0.5*eosBaseWidth - outerOffsetMid - wallThickness/sin(eosShellAngle)); eosWall1->addVertex(0.0, 0.5*eosBaseWidth - outerOffsetMid); - eosWall2->addVertex((-1.0*halfEosRadius) + wallThickness, (0.5*eosBaseWidth) - cornerThickness - wallThickness*cos(eosShellAngle)); - eosWall2->addVertex((-1.0*halfEosRadius), (0.5*eosBaseWidth) - cornerThickness); - eosWall2->addVertex((-1.0*halfEosRadius), -((0.5*eosBaseWidth) - cornerThickness)); - eosWall2->addVertex((-1.0*halfEosRadius) + wallThickness, -((0.5*eosBaseWidth) - cornerThickness - wallThickness*cos(eosShellAngle))); + eosWall2->addVertex((-1.0*halfEosRadius) + wallThickness, (0.5*eosBaseWidth) - eosCornerThickness - wallThickness*cos(eosShellAngle)); + eosWall2->addVertex((-1.0*halfEosRadius), (0.5*eosBaseWidth) - eosCornerThickness); + eosWall2->addVertex((-1.0*halfEosRadius), -((0.5*eosBaseWidth) - eosCornerThickness)); + eosWall2->addVertex((-1.0*halfEosRadius) + wallThickness, -((0.5*eosBaseWidth) - eosCornerThickness - wallThickness*cos(eosShellAngle))); // As eos wall 1, but flipped y-coord and order reversed eosWall3->addVertex(0.0, -((0.5*eosBaseWidth) - outerOffsetMid)); eosWall3->addVertex(0.0, -((0.5*eosBaseWidth) - outerOffsetMid - wallThickness/sin(eosShellAngle))); - eosWall3->addVertex((-1.0*halfEosRadius) + cornerThickness*sin(eosShellAngle), -((0.5*eosBaseWidth) - cornerThickness*cos(eosShellAngle) - fabs(wallThickness/sin(eosShellAngle)) )); - eosWall3->addVertex((-1.0*halfEosRadius) + cornerThickness*sin(eosShellAngle), -((0.5*eosBaseWidth) - cornerThickness*cos(eosShellAngle))); + eosWall3->addVertex((-1.0*halfEosRadius) + eosCornerThickness*sin(eosShellAngle), -((0.5*eosBaseWidth) - eosCornerThickness*cos(eosShellAngle) - fabs(wallThickness/sin(eosShellAngle)) )); + eosWall3->addVertex((-1.0*halfEosRadius) + eosCornerThickness*sin(eosShellAngle), -((0.5*eosBaseWidth) - eosCornerThickness*cos(eosShellAngle))); - eosCorner1->addVertex((-1.0*halfEosRadius) + cornerThickness*sin(eosShellAngle), (0.5*eosBaseWidth) - cornerThickness*cos(eosShellAngle)); + eosCorner1->addVertex((-1.0*halfEosRadius) + eosCornerThickness*sin(eosShellAngle), (0.5*eosBaseWidth) - eosCornerThickness*cos(eosShellAngle)); eosCorner1->addVertex((-1.0*halfEosRadius), (0.5*eosBaseWidth)); - eosCorner1->addVertex((-1.0*halfEosRadius), (0.5*eosBaseWidth) - cornerThickness); - eosCorner1->addVertex((-1.0*halfEosRadius) + wallThickness, (0.5*eosBaseWidth) - cornerThickness - wallThickness*cos(eosShellAngle)); + eosCorner1->addVertex((-1.0*halfEosRadius), (0.5*eosBaseWidth) - eosCornerThickness); + eosCorner1->addVertex((-1.0*halfEosRadius) + wallThickness, (0.5*eosBaseWidth) - eosCornerThickness - wallThickness*cos(eosShellAngle)); eosCorner1->addVertex((-1.0*halfEosRadius) + wallThickness, (0.5*eosBaseWidth) - ((wallThickness/sin(eosShellAngle)) + wallThickness/tan(eosShellAngle) ) ); - eosCorner1->addVertex((-1.0*halfEosRadius) + cornerThickness*sin(eosShellAngle), (0.5*eosBaseWidth) - cornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle) ); + eosCorner1->addVertex((-1.0*halfEosRadius) + eosCornerThickness*sin(eosShellAngle), (0.5*eosBaseWidth) - eosCornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle) ); - eosCorner2->addVertex((-1.0*halfEosRadius) + cornerThickness*sin(eosShellAngle), -((0.5*eosBaseWidth) - cornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle) )); + eosCorner2->addVertex((-1.0*halfEosRadius) + eosCornerThickness*sin(eosShellAngle), -((0.5*eosBaseWidth) - eosCornerThickness*cos(eosShellAngle) - wallThickness/sin(eosShellAngle) )); eosCorner2->addVertex((-1.0*halfEosRadius) + wallThickness, -((0.5*eosBaseWidth) - ((wallThickness/sin(eosShellAngle)) + wallThickness/tan(eosShellAngle) ) )); - eosCorner2->addVertex((-1.0*halfEosRadius) + wallThickness, -((0.5*eosBaseWidth) - cornerThickness - wallThickness*cos(eosShellAngle))); - eosCorner2->addVertex((-1.0*halfEosRadius), -((0.5*eosBaseWidth) - cornerThickness)); + eosCorner2->addVertex((-1.0*halfEosRadius) + wallThickness, -((0.5*eosBaseWidth) - eosCornerThickness - wallThickness*cos(eosShellAngle))); + eosCorner2->addVertex((-1.0*halfEosRadius), -((0.5*eosBaseWidth) - eosCornerThickness)); eosCorner2->addVertex((-1.0*halfEosRadius), -((0.5*eosBaseWidth))); - eosCorner2->addVertex((-1.0*halfEosRadius) + cornerThickness*sin(eosShellAngle), -((0.5*eosBaseWidth) - cornerThickness*cos(eosShellAngle))); + eosCorner2->addVertex((-1.0*halfEosRadius) + eosCornerThickness*sin(eosShellAngle), -((0.5*eosBaseWidth) - eosCornerThickness*cos(eosShellAngle))); } @@ -238,25 +252,55 @@ void GeoPixelSlimStaveSupportInclRef::preBuild() { // Compute total volume for material density std::string suffix = (m_staveType == INNER) ? "INNER" : "OUTER"; - double wallVolume = brlWall1->volume() + brlWall2->volume() + brlWall3->volume() + (2.0*(eosWall1->volume() + eosWall2->volume() + eosWall3->volume())); - const GeoMaterial* wallMaterial = matMgr()->getMaterialForVolume(matNameWall, wallVolume, matNameWall+suffix); + double brlWallVolume = brlWall1->volume() + brlWall2->volume() + brlWall3->volume(); + const GeoMaterial* brlWallMaterial = matMgr()->getMaterialForVolume(matNameBrlWall, brlWallVolume, matNameBrlWall+suffix, matFudge); - double cornerVolume = brlCorner1->volume() + brlCorner2->volume() + 2.0*(eosCorner1->volume() + eosCorner2->volume()); - const GeoMaterial* cornerMaterial = matMgr()->getMaterialForVolume(matNameCorner, cornerVolume, matNameCorner+suffix); - + double brlCornerVolume = brlCorner1->volume() + brlCorner2->volume(); + const GeoMaterial* brlCornerMaterial = matMgr()->getMaterialForVolume(matNameBrlCorner, brlCornerVolume, matNameBrlCorner+suffix, matFudge); + + double eosVolume = 2.0*(eosWall1->volume() + eosWall2->volume() + eosWall3->volume() + eosCorner1->volume() + eosCorner2->volume()); + + // Logival and physical volumes of all solids - GeoLogVol* brlWall1LogVol = new GeoLogVol("brlWall1", brlWall1, wallMaterial); - GeoLogVol* brlWall2LogVol = new GeoLogVol("brlWall2", brlWall2, wallMaterial); - GeoLogVol* brlWall3LogVol = new GeoLogVol("brlWall3", brlWall3, wallMaterial); - GeoLogVol* brlCorner1LogVol = new GeoLogVol("brlCorner1", brlCorner1, cornerMaterial); - GeoLogVol* brlCorner2LogVol = new GeoLogVol("brlCorner2", brlCorner2, cornerMaterial); - - GeoLogVol* eosWall1LogVol = new GeoLogVol("eosWall1", eosWall1, wallMaterial); - GeoLogVol* eosWall2LogVol = new GeoLogVol("eosWall2", eosWall2, wallMaterial); - GeoLogVol* eosWall3LogVol = new GeoLogVol("eosWall3", eosWall3, wallMaterial); - GeoLogVol* eosCorner1LogVol = new GeoLogVol("eosCorner1", eosCorner1, cornerMaterial); - GeoLogVol* eosCorner2LogVol = new GeoLogVol("eosCorner2", eosCorner2, cornerMaterial); + GeoLogVol* brlWall1LogVol = new GeoLogVol("brlWall1", brlWall1, brlWallMaterial); + GeoLogVol* brlWall2LogVol = new GeoLogVol("brlWall2", brlWall2, brlWallMaterial); + GeoLogVol* brlWall3LogVol = new GeoLogVol("brlWall3", brlWall3, brlWallMaterial); + GeoLogVol* brlCorner1LogVol = new GeoLogVol("brlCorner1", brlCorner1, brlCornerMaterial); + GeoLogVol* brlCorner2LogVol = new GeoLogVol("brlCorner2", brlCorner2, brlCornerMaterial); + + GeoLogVol* eosWall1LogVol; + GeoLogVol* eosWall2LogVol; + GeoLogVol* eosWall3LogVol; + GeoLogVol* eosCorner1LogVol; + GeoLogVol* eosCorner2LogVol; + + if(matNameEos!=""){ + + ATH_MSG_WARNING("###########################################################################"); + ATH_MSG_WARNING("##Still using temporary hack for EOS material - if you see this message, tell ITK software##"); + ATH_MSG_WARNING("###########################################################################"); + const GeoMaterial* eosMaterial = matMgr()->getMaterialForVolume(matNameEos, eosVolume, matNameEos+suffix, matFudge); + + eosWall1LogVol = new GeoLogVol("eosWall1", eosWall1, eosMaterial); + eosWall2LogVol = new GeoLogVol("eosWall2", eosWall2, eosMaterial); + eosWall3LogVol = new GeoLogVol("eosWall3", eosWall3, eosMaterial); + eosCorner1LogVol = new GeoLogVol("eosCorner1", eosCorner1, eosMaterial); + eosCorner2LogVol = new GeoLogVol("eosCorner2", eosCorner2, eosMaterial); + + } + else{ + + ATH_MSG_WARNING("###########################################################################"); + ATH_MSG_WARNING("##Still using temporary hack for ESO material - if you see this message, tell ITK software##"); + ATH_MSG_WARNING("###########################################################################"); + + eosWall1LogVol = new GeoLogVol("eosWall1", eosWall1, brlWallMaterial); + eosWall2LogVol = new GeoLogVol("eosWall2", eosWall2, brlWallMaterial); + eosWall3LogVol = new GeoLogVol("eosWall3", eosWall3, brlWallMaterial); + eosCorner1LogVol = new GeoLogVol("eosCorner1", eosCorner1, brlCornerMaterial); + eosCorner2LogVol = new GeoLogVol("eosCorner2", eosCorner2, brlCornerMaterial); + } GeoPhysVol* brlWall1PhysVol = new GeoPhysVol(brlWall1LogVol); GeoPhysVol* brlWall2PhysVol = new GeoPhysVol(brlWall2LogVol); diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelStaveSupportInclRef.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelStaveSupportInclRef.cxx index 07385643469c93e6514153cdfa48fdaf27f3ad16..4c851f21a0c81c0cf82e47855bb903a3ee8c0c90 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelStaveSupportInclRef.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelStaveSupportInclRef.cxx @@ -54,6 +54,7 @@ void GeoPixelStaveSupportInclRef::preBuild() { double width = staveDBHelper.getStaveSupportWidth(); double length = staveDBHelper.getStaveSupportLength(); std::string matName = staveDBHelper.getStaveSupportMaterial(); + double matFudge = staveDBHelper.getMaterialFudge(); double xOffset = staveDBHelper.getServiceOffsetX(); double yOffset = staveDBHelper.getServiceOffsetY(); if(m_barrelTilt<0) yOffset=-yOffset; @@ -72,7 +73,7 @@ void GeoPixelStaveSupportInclRef::preBuild() { if(m_barrelZMax<0) { GeoBox * shape = new GeoBox(0.5*thickness, 0.5*width, 0.5*length); - const GeoMaterial* material = matMgr()->getMaterialForVolume(matName,shape->volume()); + const GeoMaterial* material = matMgr()->getMaterialForVolume(matName,shape->volume(),"",matFudge); GeoLogVol* logVol = new GeoLogVol("StaveSupport",shape,material); m_thicknessP = xOffset + 0.5*thickness; @@ -135,7 +136,7 @@ void GeoPixelStaveSupportInclRef::preBuild() { lastShape = addShape(lastShape, lat_box, latC_trf); double shapeVolume = middle_box->volume() + 2.0*( eos_box->volume() + lat_box->volume()); - const GeoMaterial* material = matMgr()->getMaterialForVolume(matName, shapeVolume ); + const GeoMaterial* material = matMgr()->getMaterialForVolume(matName,shapeVolume,"",matFudge); GeoLogVol* logVol = new GeoLogVol("StaveSupport",lastShape,material); m_thicknessP = xOffset_stave + 0.5*thickness; diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/PixelInclRefStaveXMLHelper.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/PixelInclRefStaveXMLHelper.cxx index 52546bf58987c08a280e1196295965ae91b9d409..06c6244c1ef7a29257c8350dff1fa246610e3a69 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/PixelInclRefStaveXMLHelper.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/PixelInclRefStaveXMLHelper.cxx @@ -3,6 +3,8 @@ #include "PathResolver/PathResolver.h" #include "PixelLayoutUtils/DBXMLUtils.h" +#include "CLHEP/Evaluator/Evaluator.h" + PixelInclRefStaveXMLHelper::PixelInclRefStaveXMLHelper(int layer, const PixelGeoBuilderBasics* basics): GeoXMLUtils(), PixelGeoBuilder(basics), @@ -88,6 +90,28 @@ double PixelInclRefStaveXMLHelper::getStaveSupportThick() const return getDouble("PixelStaveGeo", m_layerIndices, "LadderThickness"); } +//for pigtail +std::string PixelInclRefStaveXMLHelper::getPigtailMaterial(int shapeIndex) const +{ + std::vector vec = getVectorString("PixelStaveGeo", m_layerIndices, "PigtailMaterialGeo"); + if (vec.size() != 0) return vec.at(shapeIndex); + return ""; +} + +double PixelInclRefStaveXMLHelper::getPigtailAngle(int shapeIndex) const +{ + std::vector vec = getVectorDouble("PixelStaveGeo", m_layerIndices, "PigtailAngle"); +if (vec.size() != 0) return vec.at(shapeIndex); +return 0.0; +} + +double PixelInclRefStaveXMLHelper::getPigtailDR(int shapeIndex) const +{ + std::vector vec = getVectorDouble("PixelStaveGeo", m_layerIndices, "PigtailDR"); +if (vec.size() != 0) return vec.at(shapeIndex); +return 0.0; +} + std::string PixelInclRefStaveXMLHelper::getStaveSupportMaterial(int shapeIndex) const { std::vector vec = getVectorString("PixelStaveGeo", m_layerIndices, "StaveSupportMaterialGeo"); @@ -104,6 +128,42 @@ std::string PixelInclRefStaveXMLHelper::getStaveSupportCornerMaterial(int shapeI //return getString("PixelStaveGeo", m_layerIndices, "StaveSupportMaterialGeo"); } +std::string PixelInclRefStaveXMLHelper::getStaveSupportEOSMaterial(int shapeIndex) const +{ + std::vector vec = getVectorString("PixelStaveGeo", m_layerIndices, "StaveSupportEOSMaterialGeo"); + if (vec.size() != 0) return vec.at(shapeIndex); + return ""; +} + +double PixelInclRefStaveXMLHelper::getMaterialFudge() const +{ + bool foundFudges=false; + std::vector nodes = getNodeList("PixelStaveGeos"); + for (unsigned int i=0; i fudges = getNodeList("MaterialFudgeFactors"); + for (unsigned int i=0; i nodes = getNodeList("PixelStaveGeos"); + for (unsigned int i=0; i fudges = getNodeList("MaterialFudgeFactors"); + for (unsigned int i=0; i m_pixelModuleSvc; ServiceHandle m_pixelDesignSvc; - }; #endif diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/EndcapRingRef/PixelRingSupportXMLHelper.h b/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/EndcapRingRef/PixelRingSupportXMLHelper.h index d4e561f497702c25c7521275035d021f5874c1a8..60182011e1debaf5505b67483150cdba54931810 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/EndcapRingRef/PixelRingSupportXMLHelper.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/EndcapRingRef/PixelRingSupportXMLHelper.h @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - #ifndef PixelRingSupportXMLHelper_H #define PixelRingSupportXMLHelper_H @@ -25,6 +21,9 @@ class PixelRingSupportXMLHelper : public GeoXMLUtils, public PixelGeoBuilder { double getRingSupportRMin(int iSupport) const; double getRingSupportRMax(int iSupport) const; double getRingSupportThickness(int iSupport) const; + int getRingSupportNSectors(int iSupport) const; + double getRingSupportSPhi(int iSupport) const; + double getRingSupportDPhi(int iSupport) const; std::string getRingSupportMaterial(int iSupport) const; int getNbLayerSupport(int layer); diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/GeoPixelEndcapECRingRefTool.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/GeoPixelEndcapECRingRefTool.cxx index 7d89025192da0b2e8b458464fc015ba8b21898b7..f684d5f2d1876f4e12a3b28a6c9fdcd1012c59a8 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/GeoPixelEndcapECRingRefTool.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/GeoPixelEndcapECRingRefTool.cxx @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - #include "EndcapRingRef/GeoPixelEndcapECRingRefTool.h" #include "EndcapRingRef/GeoPixelLayerECRingRefTool.h" #include "PixelLayoutUtils/PixelGeneralXMLHelper.h" @@ -219,9 +215,7 @@ GeoVPhysVol* GeoPixelEndcapECRingRefTool::buildEndcap(const PixelGeoBuilderBasic ecPhys = new GeoFullPhysVol(endcapLog); } - - // Set numerology - basics->getDetectorManager()->numerology().setNumDisks(m_nlayers); + basics->getDetectorManager()->numerology().setNumDisks(m_nlayers); // Retrieve the PixelServiceTool diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/GeoPixelLayerECRingRefTool.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/GeoPixelLayerECRingRefTool.cxx index d98d45e15dce0da007fc8370236ba2ce8ee829fe..4f640170b72258fc4b80e205b4b4e99c00872a2a 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/GeoPixelLayerECRingRefTool.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/GeoPixelLayerECRingRefTool.cxx @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - #include "EndcapRingRef/GeoPixelLayerECRingRefTool.h" #include "EndcapRingRef/GeoPixelRingECRingRef.h" #include "EndcapRingRef/PixelRingSupportXMLHelper.h" @@ -177,7 +173,6 @@ void GeoPixelLayerECRingRefTool::preBuild(const PixelGeoBuilderBasics* basics, i rLayerMax = std::max(rLayerMax,ringB.getRingRMax()); zLayerMin = std::min(zLayerMin,ringPosition+halfZoffset-halfSplitOffset+ringB.getRingZMin()); zLayerMax = std::max(zLayerMax,ringPosition+halfZoffset+halfSplitOffset+ringB.getRingZMax()); - } // Open link to the xml file that describes the layer services @@ -192,6 +187,16 @@ void GeoPixelLayerECRingRefTool::preBuild(const PixelGeoBuilderBasics* basics, i zLayerMax = std::max(zLayerMax,z[1]); } + nbSvcSupport = ringHelper.getNbSupport(m_layer); + for(int iSvc=0; iSvcgetDetectorManager()->numerology().setNumPhiModulesForDiskRing(layer,iRing,numModules); - + + int tmp_layer = layer; + int tmp_ring = iRing; + int tmp_endcapId = 2*m_endcapSide; + + basics->getDetectorManager()->numerology().setNumPhiModulesForDiskRing(tmp_layer,tmp_ring,numModules); + + } - + // Build layer envelope const GeoMaterial* air = basics->matMgr()->getMaterial("std::Air"); @@ -314,9 +325,9 @@ GeoVPhysVol* GeoPixelLayerECRingRefTool::buildLayer(const PixelGeoBuilderBasics* zPos += (isTwdBSShift) ? -halfSplitOffset : halfSplitOffset; bool swap = false; - if (halfIsEven and (splitMode==MIDDLE or splitMode==GOOD) and not isTwdBSShift) + if (halfIsEven && (splitMode==MIDDLE || splitMode==GOOD) && !isTwdBSShift) swap = true; - else if (not halfIsEven and ((splitMode==MIDDLE and isTwdBSShift) or splitMode==GOOD)) + else if (!halfIsEven && ((splitMode==MIDDLE && isTwdBSShift) || splitMode==GOOD)) swap = true; if (swap) @@ -338,30 +349,50 @@ GeoVPhysVol* GeoPixelLayerECRingRefTool::buildLayer(const PixelGeoBuilderBasics* } } - - if(i%2==0 and nbSvcSupport>0){ - // std::cout<<" -> I should add some supports for disc i = " << i << std::endl; - // Add ring supports - int iSvc = i/20){ + if (splitMode==NONE && i==0) { + // Add ring supports + for (int iSvc = 0; iSvc < nbSvcSupport; iSvc++){ + double rminSvc = ringHelper.getRingSupportRMin(iSvc); + double rmaxSvc = ringHelper.getRingSupportRMax(iSvc); + double thick = ringHelper.getRingSupportThickness(iSvc); + int nsectors = ringHelper.getRingSupportNSectors(iSvc); + double sphiSvc = ringHelper.getRingSupportSPhi(iSvc); + double dphiSvc = ringHelper.getRingSupportDPhi(iSvc); + std::string matName = ringHelper.getRingSupportMaterial(iSvc); + + for (int i_sector = 0; i_sector < nsectors; i_sector++) { + + if ((360. / nsectors) < dphiSvc) { + ATH_MSG_WARNING("Arms will overlap. Do not implement them."); + continue; + } + + double Sphi = (sphiSvc + 360. / nsectors * i_sector) * CLHEP::deg; + double Dphi = dphiSvc * CLHEP::deg; + + const GeoShape* supTubs = (nsectors>1) ? dynamic_cast (new GeoTubs(rminSvc,rmaxSvc,thick*.5,Sphi,Dphi)) : dynamic_cast (new GeoTube(rminSvc,rmaxSvc,thick*.5)); + double matVolume = supTubs->volume(); + const GeoMaterial* supMat = basics->matMgr()->getMaterialForVolume(matName,matVolume); + ATH_MSG_DEBUG("Density = " << supMat->getDensity() << " Mass = " << ( matVolume * supMat->getDensity() )); + GeoLogVol* _supLog = new GeoLogVol("supLog",supTubs,supMat); + GeoPhysVol* supPhys = new GeoPhysVol(_supLog); + GeoTransform* xform = new GeoTransform( HepGeom::Translate3D(0., 0., (m_ringPos[i]+m_ringPos[i+1])*.5-zMiddle)); + ecPhys->add(xform); + ecPhys->add(supPhys); + } + } + } - if (splitMode==NONE) { - - const GeoTube* supTube = new GeoTube(rminSvc,rmaxSvc,thick*.5); - double matVolume = supTube->volume(); - const GeoMaterial* supMat = basics->matMgr()->getMaterialForVolume(matName,matVolume); - ATH_MSG_DEBUG("Density = " << supMat->getDensity() << " Mass = " << ( matVolume * supMat->getDensity() )); - GeoLogVol* _supLog = new GeoLogVol("supLog",supTube,supMat); - GeoPhysVol* supPhys = new GeoPhysVol(_supLog); - GeoTransform* xform = new GeoTransform( HepGeom::Translate3D(0., 0., (m_ringPos[i]+m_ringPos[i+1])*.5-zMiddle)); - ecPhys->add(xform); - ecPhys->add(supPhys); - - } else { + if (splitMode!=NONE && i%2==0){ // here starts if we have the 2 tubs when we split the rings + int iSvc = i/2 +#include "InDetTrackingGeometryXML/XMLReaderSvc.h" +#include "InDetTrackingGeometryXML/XMLGeoTemplates.h" + GeoPixelRingECRingRef::GeoPixelRingECRingRef(int iLayer, int iRing, double ringRadius, double ringOuterRadius, double zOffset, double phiOffset, @@ -68,7 +71,10 @@ void GeoPixelRingECRingRef::preBuild(const PixelGeoBuilderBasics* basics ) // Retrieve PixelModuleSvc (svc that builds and store the modules) StatusCode sc = m_pixelModuleSvc.retrieve(); if(sc.isFailure()) - std::cout << "Could not retrieve pixel module builder tool " << m_pixelModuleSvc << ", some services will not be built." << std::endl; + basics->msgStream()<initModuleMap(basics); + m_pixelDesignSvc->initModuleMap(basics); // Open link to the xml file that describes the rings PixelRingSupportXMLHelper ringHelper(basics); @@ -83,19 +89,13 @@ void GeoPixelRingECRingRef::preBuild(const PixelGeoBuilderBasics* basics ) double thickHyb = ringModule->ThicknessN(); double thickChip = ringModule->ThicknessP(); - m_halfLength = (thickHyb+thickChip)*.5; + m_halfLength = ringModule->Thickness()/2.; m_ringRMin = rmin-0.001; m_ringRMax = rmax+0.001; - m_ringZMin = -thickHyb; - m_ringZMax = thickChip; - if(m_front_back==-1){ - m_ringZMin = -thickChip; - m_ringZMax = thickHyb; - } - m_ringZMin-=0.001; - m_ringZMax+=0.001; + m_ringZMin = -std::max(thickHyb,thickChip) - 0.001; + m_ringZMax = std::max(thickHyb,thickChip) + 0.001; // In case the sensor length is smaller than the module length... // This is the radius of the center of the active sensor (also center of the module) @@ -178,17 +178,11 @@ GeoVPhysVol* GeoPixelRingECRingRef::Build(const PixelGeoBuilderBasics* basics, i if (phi> CLHEP::pi*CLHEP::rad) phi -= 2*CLHEP::pi*CLHEP::rad; if (phi<-CLHEP::pi*CLHEP::rad) phi += 2*CLHEP::pi*CLHEP::rad; - // cout<<"GPRing: Layer="<< iLayer<<" ring="<< iring <<" nmods="<< nmodules - // <<", imod="<< imod <<", phiId="<< phiId - // <<", angle="<< angle - // <<" LayerSide="<< (gmt_mgr->isAside() ? 'A' : 'C') - // <<" LayerFace="<< (gmt_mgr->isLayerFront()?"front":"back") - // << endl; - + // Rotate the module to switch to a radial plane HepGeom::Transform3D initModule = HepGeom::RotateY3D(90.*CLHEP::deg); if(m_front_back==1 || m_ringSide<0 ) initModule = HepGeom::RotateX3D(180.*CLHEP::deg) * initModule; - + HepGeom::Point3D modulePos(moduleRadius*cos(phi),moduleRadius*sin(phi),zModuleShift); HepGeom::Transform3D moduleTrf = HepGeom::Translate3D(modulePos)*HepGeom::RotateZ3D(phi)*initModule; @@ -197,19 +191,24 @@ GeoVPhysVol* GeoPixelRingECRingRef::Build(const PixelGeoBuilderBasics* basics, i modName<<"_"<<2*endcapSide<<"_"<Build(endcapId, m_layer, phiId, m_ringId, 600, modName.str()); + std::ostringstream ostr; ostr << "Layer" << m_layer << "_Sector" << m_ringId; ringPhys->add(new GeoNameTag(ostr.str())); ringPhys->add(new GeoIdentifierTag(phiId)); ringPhys->add(xform); ringPhys->add(modulePhys); - - // Build and store DetectorElement - Identifier idwafer = basics->getIdHelper()->wafer_id(endcapId, m_layer, phiId, m_ring); + + int tmp_layer = m_layer; + int tmp_ring = m_ring; + int tmp_endcapId = endcapId; + + //endcapId = tmp_endcapId; m_layer = tmp_layer; m_ring = tmp_ring; + Identifier idwafer = basics->getIdHelper()->wafer_id(tmp_endcapId, tmp_layer, phiId, tmp_ring); InDetDD::SiDetectorElement* element = new InDetDD::SiDetectorElement( idwafer, ringModuleDesign, modulePhys, basics->getCommonItems()); basics->getDetectorManager()->addDetectorElement(element); - + // Now store the xform by identifier: alignement studies basics->getDetectorManager()->addAlignableTransform(0,idwafer,xform,modulePhys); } @@ -233,14 +232,11 @@ std::pair GeoPixelRingECRingRef::BuildSplit(const Pix GeoDetModulePixel* ringModule = m_pixelModuleSvc->getModule(basics,2,m_layer,m_moduleType); InDetDD::PixelModuleDesign* ringModuleDesign = m_pixelDesignSvc->getDesign(basics,m_moduleType); - double zModuleShift = m_ringZShift; double halflength = m_halfLength+.001; - if(m_front_back==1) zModuleShift*=-1; // This is the radius of the center of the active sensor (also center of the module) double moduleRadius = m_radius + ringModule->getModuleSensorLength()*.5; - int nmodules = m_numModules; // in case no modules are defined for the ring @@ -283,6 +279,7 @@ std::pair GeoPixelRingECRingRef::BuildSplit(const Pix std::ostringstream logStrTwdBS; logStrTwdBS << logStr.str() << "TwdBS"; GeoLogVol* _ringLogTwdBS = new GeoLogVol(logStrTwdBS.str(),ringTubsTwdBS,air); + std::ostringstream logStrAwayBS; logStrAwayBS << logStr.str() << "AwayBS"; GeoLogVol* _ringLogAwayBS = new GeoLogVol(logStrAwayBS.str(),ringTubsAwayBS,air); @@ -300,7 +297,6 @@ std::pair GeoPixelRingECRingRef::BuildSplit(const Pix // Fi stagger is non zero, alternating modules are stagger low/high. double local_front_back = (imod%2 ? -1 : 1); if(m_front_back==local_front_back) { - // // Build both endcaps the same but re-number phiId in endcap C to // get correct offline numbering. Endcap C is obtained by @@ -314,16 +310,23 @@ std::pair GeoPixelRingECRingRef::BuildSplit(const Pix // Rotate the module to switch to a radial plane HepGeom::Transform3D initModule = HepGeom::RotateY3D(90.*CLHEP::deg); - - if(m_front_back==1 || m_ringSide<0 ) initModule = HepGeom::RotateX3D(180.*CLHEP::deg) * initModule; - + + double zModuleShift = m_ringZShift; + if(m_front_back==1 || m_ringSide<0 ) { + initModule = HepGeom::RotateX3D(180.*CLHEP::deg) * initModule; + zModuleShift *= -1; + } + bool rotate = false; if ((nmodules/2)%2==0 and (m_mode==MIDDLE or m_mode==GOOD) and not isTwd) rotate = true; else if ((nmodules/2)%2==1 and ((m_mode==MIDDLE and isTwd) or m_mode==GOOD)) rotate = true; - - if (rotate) initModule = HepGeom::RotateX3D(180.*CLHEP::deg) * initModule; + + if (rotate) { + initModule = HepGeom::RotateX3D(180.*CLHEP::deg) * initModule; + zModuleShift *= -1; + } double phi = angle; if (phi> CLHEP::pi*CLHEP::rad) phi -= 2*CLHEP::pi*CLHEP::rad; @@ -331,15 +334,14 @@ std::pair GeoPixelRingECRingRef::BuildSplit(const Pix HepGeom::Point3D modulePos(moduleRadius*cos(phi),moduleRadius*sin(phi),zModuleShift); HepGeom::Transform3D moduleTrf = HepGeom::Translate3D(modulePos)*HepGeom::RotateZ3D(phi)*initModule; - + // Build and place the module - 600 is the new geoTagId for ITk endcap ring sensors std::ostringstream modName; modName<<"_"<<2*endcapSide<<"_"<Build(endcapId, m_layer, phiId, m_ringId, 600, modName.str()); std::ostringstream ostr; - ostr << "Layer" << m_layer << "_Sector" << m_ringId; - ostr << "Layer" << m_layer << "_Sector" << m_ringId; + ostr << "Layer" << m_layer << "_Sector" << m_ringId << "_Module" << modName.str(); if (isTwd) { ringPhysTwdBS->add(new GeoNameTag(ostr.str())); @@ -355,12 +357,17 @@ std::pair GeoPixelRingECRingRef::BuildSplit(const Pix } // Build and store DetectorElement - Identifier idwafer = basics->getIdHelper()->wafer_id(endcapId, m_layer, phiId, m_ring); + + int tmp_layer = m_layer; + int tmp_ring = m_ring; + int tmp_endcapId = endcapId; + + Identifier idwafer = basics->getIdHelper()->wafer_id(tmp_endcapId, tmp_layer, phiId, tmp_ring); InDetDD::SiDetectorElement* element = new InDetDD::SiDetectorElement( idwafer, ringModuleDesign, - modulePhys, basics->getCommonItems()); + modulePhys, basics->getCommonItems()); basics->getDetectorManager()->addDetectorElement(element); - - // Now store the xform by identifier: alignement studies + + // Now store the xform by identifier: alignement studies basics->getDetectorManager()->addAlignableTransform(0,idwafer,xform,modulePhys); } } diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/PixelRingSupportXMLHelper.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/PixelRingSupportXMLHelper.cxx index 3c9dd09acbe4e116801f264056bd4ba53671dc7c..8a151f8329df2c6f4d00770bd513c312d7b375f9 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/PixelRingSupportXMLHelper.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/EndcapRingRef/src/PixelRingSupportXMLHelper.cxx @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - #include "EndcapRingRef/PixelRingSupportXMLHelper.h" #include "PathResolver/PathResolver.h" @@ -81,6 +77,29 @@ double PixelRingSupportXMLHelper::getRingSupportThickness(int iSupport) const return v[index]; } +int PixelRingSupportXMLHelper::getRingSupportNSectors(int iSupport) const +{ + std::vector v = getVectorInt("PixelRingSupportGeo",m_ringGeoIndex,"nsectors"); + if (v.size()<1) return 1; + int index = (v.size()==1)? 0 : iSupport; + return v[index]; +} + +double PixelRingSupportXMLHelper::getRingSupportSPhi(int iSupport) const +{ + std::vector v = getVectorDouble("PixelRingSupportGeo",m_ringGeoIndex,"sphi"); + if (v.size()<1) return 0.; + int index = (v.size()==1)? 0 : iSupport; + return v[index]; +} + +double PixelRingSupportXMLHelper::getRingSupportDPhi(int iSupport) const +{ + std::vector v = getVectorDouble("PixelRingSupportGeo",m_ringGeoIndex,"dphi"); + if (v.size()<1) return 360.; + int index = (v.size()==1)? 0 : iSupport; + return v[index]; +} std::string PixelRingSupportXMLHelper::getRingSupportMaterial(int iSupport) const { @@ -97,6 +116,8 @@ int PixelRingSupportXMLHelper::getNbLayerSupport(int layer) if(!m_bXMLfileExist) return 0; int layerIndex = getChildValue_Index("PixelLayerSupport", "Layer", layer); + if(layerIndex < 0) return 0; + std::string ringGeoName = getString("PixelLayerSupport", layerIndex, "LayerSupportGeo"); m_ringGeoIndex = (ringGeoName!="None")? getChildValue_Index("PixelLayerSupportGeo", "name", -1, ringGeoName) : -1; @@ -111,6 +132,8 @@ std::vector PixelRingSupportXMLHelper::getNbLayerSupportIndex(int layer) if(!m_bXMLfileExist) return layers; int layerIndex = getChildValue_Index("PixelLayerSupport", "Layer", layer); + if (layerIndex < 0) return layers; + std::string ringGeoName = getString("PixelLayerSupport", layerIndex, "LayerSupportGeo"); // using the first name support to get the layer index diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelGeoModelModule/PixelGeoModelModule/GeoDetModulePixelMap.h b/InnerDetector/InDetDetDescr/PixelLayouts/PixelGeoModelModule/PixelGeoModelModule/GeoDetModulePixelMap.h index 45d978f95ae6a1079a8571b86b8693b215eacfd0..cb684f5a103a5b762bf2248fb8685f0cc21bf9b9 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelGeoModelModule/PixelGeoModelModule/GeoDetModulePixelMap.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelGeoModelModule/PixelGeoModelModule/GeoDetModulePixelMap.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef GEOPIXELGEODETMODULEMAP_H @@ -14,16 +14,19 @@ #include "PixelLayoutUtils/GeoXMLUtils.h" using namespace xercesc; +class PixelGeoBuilderBasics; class GeoDetModulePixelMap : public GeoXMLUtils { public: - GeoDetModulePixelMap(bool bModule=true); + GeoDetModulePixelMap();//default constructor + GeoDetModulePixelMap(const PixelGeoBuilderBasics*, bool bModule=true); void preBuild(); int getModuleIndex(std::string moduleType) const; private: + const PixelGeoBuilderBasics* m_basics; bool m_bModule; std::map m_moduleMap; diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelGeoModelModule/src/GeoDetModulePixelMap.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/PixelGeoModelModule/src/GeoDetModulePixelMap.cxx index 4633d2cd6fbfa36e759ce844a2e1324c40934e8c..a14e70b10316210d63cb5c18825dcf570d31a066 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelGeoModelModule/src/GeoDetModulePixelMap.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelGeoModelModule/src/GeoDetModulePixelMap.cxx @@ -1,10 +1,11 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "PixelGeoModelModule/GeoDetModulePixelMap.h" #include "PixelGeoModel/PixelGeoBuilder.h" +#include "PixelLayoutUtils/DBXMLUtils.h" #include "InDetGeoModelUtils/InDetMaterialManager.h" #include "Identifier/Identifier.h" @@ -25,8 +26,17 @@ using std::max; +GeoDetModulePixelMap::GeoDetModulePixelMap(): + GeoXMLUtils(), + m_basics(nullptr), + m_bModule(false) +{ + //try this to make compiler happy... +} -GeoDetModulePixelMap::GeoDetModulePixelMap(bool bModule): +GeoDetModulePixelMap::GeoDetModulePixelMap(const PixelGeoBuilderBasics * basics,bool bModule): + GeoXMLUtils(), + m_basics(basics), m_bModule(bModule) { preBuild(); @@ -34,11 +44,6 @@ GeoDetModulePixelMap::GeoDetModulePixelMap(bool bModule): void GeoDetModulePixelMap::preBuild() { - // std::cout<<" GeoDetModule* GeoDetModulePixelMap::build"<ReadInputDataFromDB(); + bool bParsed = false; + if(readXMLfromDB) + { + m_basics->msgStream()<<"XML input : DB CLOB "<msgStream()<<"XML input : from file "<msgStream()<<"XML file "<(moduleName,iModule) ); } @@ -84,6 +99,7 @@ int GeoDetModulePixelMap::getModuleIndex(std::string moduleType) const for (auto it = m_moduleMap.begin(); it != m_moduleMap.end(); it++) { if(moduleType.compare(it->first)==0) return it->second; } + m_basics->msgStream()<msgStream()<initModuleMap(basics); + m_pixelDesignSvc->initModuleMap(basics); // XML file reader PixelRingSupportXMLHelper ringHelper; diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/GeoPixelXMLMaterial.h b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/GeoPixelXMLMaterial.h index ed42a46c5c98266f0e3da704a67d369f8101bf89..74ada73fb46f6a0a1ca6837c05aad9a29e77bc2b 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/GeoPixelXMLMaterial.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/GeoPixelXMLMaterial.h @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - #ifndef GeoPixelXMLMaterial_H #define GeoPixelXMLMaterial_H diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/GeoXMLUtils.h b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/GeoXMLUtils.h index 90b8928de517b6ef42bdc967774d6649a99a262b..835fa460e636d15817df929805fb673d6a771dfd 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/GeoXMLUtils.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/GeoXMLUtils.h @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - /////////////////////////////////////////////////////////////////// // XMLUtil.h, (c) ATLAS Detector software /////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/PixelGeneralXMLHelper.h b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/PixelGeneralXMLHelper.h index a7db490a89aefce04efd49aa953c8e577add46f4..6e7a0cc5c0c0f62a20cc385af61b392215e61086 100644 --- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/PixelGeneralXMLHelper.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/PixelGeneralXMLHelper.h @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - #ifndef PixelGeneralXMLHelper_H #define PixelGeneralXMLHelper_H @@ -34,6 +30,17 @@ class PixelGeneralXMLHelper : public GeoXMLUtils, public PixelGeoBuilder { std::vector getBarrelRadiusList() const; std::vector getBarrelHalfLengthList() const; + std::vector getBarrelSupportZOffsetList() const; + std::vector getBarrelSupportThicknessList() const; + std::vector getBarrelSupportMaterialList() const; + std::vector getBarrelSupportRminInnerList() const; + std::vector getBarrelSupportRmaxInnerList() const; + std::vector getBarrelSupportRminOuterList() const; + std::vector getBarrelSupportRmaxOuterList() const; + std::vector getBarrelSupportNSectorsList() const; + std::vector getBarrelSupportSPhiList() const; + std::vector getBarrelSupportDPhiList() const; + double getEndcapRMin() const; double getEndcapRMax() const; double getEndcapZMin() const; diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/GeoPixelXMLMaterial.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/GeoPixelXMLMaterial.cxx index e4eaae6bff54e9990428df814eda72874eb09fe6..569b4a23754f0c3277c1a2e56ac59c2179f7872d 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/GeoPixelXMLMaterial.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/GeoPixelXMLMaterial.cxx @@ -1,7 +1,3 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - // Build detailed stave support : face plate + carbon foam + cable flex + cooling pipe + end blocks // This is built one time per layer. @@ -62,8 +58,7 @@ GeoVPhysVol* GeoPixelXMLMaterial::Build(std::string prefix) int nbMaterial = getChildCount("PixelMaterials", 0, "Material"); msg(MSG::DEBUG) <<"MATERIAL NUMBER : "< PixelGeneralXMLHelper::getBarrelHalfLengthList() const return getVectorDouble("PixelBarrelEnvelope", 0, "HalfLengthList"); } +std::vector PixelGeneralXMLHelper::getBarrelSupportZOffsetList() const +{ + return getVectorDouble("PixelBarrelSupport", 0, "ZOffsetList"); +} + +std::vector PixelGeneralXMLHelper::getBarrelSupportThicknessList() const +{ + return getVectorDouble("PixelBarrelSupport", 0, "ThicknessList"); +} + +std::vector PixelGeneralXMLHelper::getBarrelSupportMaterialList() const +{ + return getVectorString("PixelBarrelSupport", 0, "MaterialList"); +} + +std::vector PixelGeneralXMLHelper::getBarrelSupportRminInnerList() const +{ + return getVectorDouble("PixelBarrelSupport", 0, "RminInnerList"); +} + +std::vector PixelGeneralXMLHelper::getBarrelSupportRmaxInnerList() const +{ + return getVectorDouble("PixelBarrelSupport", 0, "RmaxInnerList"); +} + +std::vector PixelGeneralXMLHelper::getBarrelSupportRminOuterList() const +{ + return getVectorDouble("PixelBarrelSupport", 0, "RminOuterList"); +} + +std::vector PixelGeneralXMLHelper::getBarrelSupportRmaxOuterList() const +{ + return getVectorDouble("PixelBarrelSupport", 0, "RmaxOuterList"); +} + +std::vector PixelGeneralXMLHelper::getBarrelSupportNSectorsList() const +{ + return getVectorInt("PixelBarrelSupport", 0, "NSectorsList"); +} + +std::vector PixelGeneralXMLHelper::getBarrelSupportSPhiList() const +{ + return getVectorDouble("PixelBarrelSupport", 0, "SPhiList"); +} + +std::vector PixelGeneralXMLHelper::getBarrelSupportDPhiList() const +{ + return getVectorDouble("PixelBarrelSupport", 0, "DPhiList"); +} + double PixelGeneralXMLHelper::getEndcapRMin() const { return getDouble("PixelEndcapEnvelope", 0, "RadiusMin"); diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/PixelModuleTool/PixelDesignBuilder.h b/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/PixelModuleTool/PixelDesignBuilder.h index a3e6bc062195bb5212f158dc3f92ed4d19a31f2c..6568467a6f552efaf61cbf2c1a39f69728745ded 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/PixelModuleTool/PixelDesignBuilder.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/PixelModuleTool/PixelDesignBuilder.h @@ -54,13 +54,14 @@ class PixelDesignBuilder: public AthService, virtual public IPixelDesignSvc, p int circuitsPhi, int circuitsEta, int diodeRowPerCirc, int diodeColPerCirc); - + void initModuleMap(const PixelGeoBuilderBasics*); + private: static std::vector s_designs; InDetDD::PixelModuleDesign* build( const PixelGeoBuilderBasics* basics, int moduleIndex); - GeoDetModulePixelMap m_moduleMap; + const GeoDetModulePixelMap * m_moduleMap; }; inline const InterfaceID & PixelDesignBuilder::interfaceID(){ diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/PixelModuleTool/PixelModuleBuilder.h b/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/PixelModuleTool/PixelModuleBuilder.h index 0fa21713fac6442e201015f0e6fa5c62bc280472..2cd0bc16dee10028ffe1cda940b5808c4069c25e 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/PixelModuleTool/PixelModuleBuilder.h +++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/PixelModuleTool/PixelModuleBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef PixelModuleBuilder_H @@ -18,6 +18,8 @@ #include "PixelGeoModelModule/GeoDetModulePixelMap.h" #include "PixelGeoComponent/GeoDetModule.h" +#include "PixelLayoutUtils/GeoXMLUtils.h" + #include #include @@ -58,6 +60,8 @@ class PixelModuleBuilder: public AthService, virtual public IPixelModuleSvc { double getWidth(int moduleIndex) const; double getLength(int moduleIndex) const; int getChipNumber(int moduleIndex) const; + + void initModuleMap(const PixelGeoBuilderBasics*); private: @@ -66,7 +70,7 @@ class PixelModuleBuilder: public AthService, virtual public IPixelModuleSvc { static std::vector s_geometries_geocomp; GeoDetModulePixel* build(const PixelGeoBuilderBasics* basics, int moduleindex, int brl_ec=-1, int layerdisk=-1); - GeoDetModulePixelMap m_moduleMap; + const GeoDetModulePixelMap * m_moduleMap; }; diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/src/PixelDesignBuilder.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/src/PixelDesignBuilder.cxx index 2a7659fa47cfb4201f94eb208c20838707396a8f..2c2d4dd3f6890581d7dda8d797cfb4a30dc2bf2a 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/src/PixelDesignBuilder.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/src/PixelDesignBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "PixelModuleTool/PixelDesignBuilder.h" @@ -23,17 +23,24 @@ using namespace InDetDD; std::vector PixelDesignBuilder::s_designs; -PixelDesignBuilder::PixelDesignBuilder( const std::string& name, ISvcLocator* pSvcLocator ) : +PixelDesignBuilder::PixelDesignBuilder( const std::string& name, ISvcLocator* pSvcLocator) : AthService(name, pSvcLocator), - GeoXMLUtils() + GeoXMLUtils(), + m_moduleMap(nullptr) { s_designs.clear(); - m_moduleMap = GeoDetModulePixelMap(); } PixelDesignBuilder::~PixelDesignBuilder() { for(int i=0; i<(int)s_designs.size(); i++) delete s_designs[i]; + if(m_moduleMap) delete m_moduleMap; +} + +void PixelDesignBuilder::initModuleMap(const PixelGeoBuilderBasics* basics) +{ + m_moduleMap = new GeoDetModulePixelMap(basics); + } @@ -72,9 +79,6 @@ StatusCode PixelDesignBuilder::callBack(IOVSVC_CALLBACK_ARGS_P(/*I*/,/*keys*/)) PixelModuleDesign* PixelDesignBuilder::getDesign( const PixelGeoBuilderBasics* basics, int moduleIndex) { - // std::cout<<"PIXELDESIGNBUILDER per index : "< (int) s_designs.size()-1) { s_designs.resize( moduleIndex+1, 0); // prefill with zeros } @@ -89,9 +93,11 @@ PixelModuleDesign* PixelDesignBuilder::getDesign( const PixelGeoBuilderBasics* b PixelModuleDesign* PixelDesignBuilder::getDesign(const PixelGeoBuilderBasics* basics, std::string moduleType) { - int moduleIndex = m_moduleMap.getModuleIndex(moduleType); - - // std::cout<<"PIXELDESIGNBUILDER per type : "<msgStream()<getModuleIndex(moduleType); return getDesign(basics, moduleIndex); } diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/src/PixelModuleBuilder.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/src/PixelModuleBuilder.cxx index 81e190791f168f60706bdac312e38106bab8b71a..17c1695267c59e42b8091e930d9d92fea20786ca 100755 --- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/src/PixelModuleBuilder.cxx +++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelModuleTool/src/PixelModuleBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "PixelModuleTool/PixelModuleBuilder.h" @@ -17,17 +17,23 @@ std::vector PixelModuleBuilder::s_geometries; std::vector PixelModuleBuilder::s_geometries_geocomp; std::vector PixelModuleBuilder::s_geometries_index; -PixelModuleBuilder::PixelModuleBuilder( const std::string& name, ISvcLocator* pSvcLocator ) : - AthService(name, pSvcLocator) +PixelModuleBuilder::PixelModuleBuilder( const std::string& name, ISvcLocator* pSvcLocator) : + AthService(name, pSvcLocator), + m_moduleMap(nullptr) { s_geometries.clear(); - m_moduleMap = GeoDetModulePixelMap(); } - PixelModuleBuilder::~PixelModuleBuilder() { for(int i=0; i<(int)s_geometries.size(); i++) delete s_geometries[i]; + if(m_moduleMap) delete m_moduleMap; +} + +void PixelModuleBuilder::initModuleMap(const PixelGeoBuilderBasics* basics) +{ + m_moduleMap = new GeoDetModulePixelMap(basics); + } StatusCode PixelModuleBuilder::initialize() @@ -66,15 +72,15 @@ StatusCode PixelModuleBuilder::callBack(IOVSVC_CALLBACK_ARGS_P(/*I*/,/*keys*/)) // -------- GeoModel ---------------------------------------------------- -GeoDetModulePixel* PixelModuleBuilder::getModule(const PixelGeoBuilderBasics*, int /*moduleIndex*/) +GeoDetModulePixel* PixelModuleBuilder::getModule(const PixelGeoBuilderBasics* basics, int /*moduleIndex*/) { - std::cout<<"ERROR - try to retrieve module without specifying brl/ec and layer/disc"<msgStream()<msgStream()<msgStream()<getModuleIndex(moduleType); return getModule(basics, brl_ec, layerdisk, moduleIndex); } @@ -128,8 +137,11 @@ InDet::GeoDetModule* PixelModuleBuilder::getModuleGeoComp(const PixelGeoBuilderB InDet::GeoDetModule* PixelModuleBuilder::getModuleGeoComp(const PixelGeoBuilderBasics* basics, int brl_ec, int layerdisk, std::string moduleType) { - - int moduleIndex = m_moduleMap.getModuleIndex(moduleType); + if(!m_moduleMap) { + basics->msgStream()<getModuleIndex(moduleType); return getModuleGeoComp(basics, brl_ec, layerdisk, moduleIndex); }