From 59b0c52be73a1306d984f26929ab348a4b937eca Mon Sep 17 00:00:00 2001 From: Dwayne Patrick Spiteri <dwayne.patrick.spiteri@cern.ch> Date: Thu, 2 Dec 2021 20:55:04 +0100 Subject: [PATCH 1/5] Addition of pixel cluster container to fastPixelDigiOutputExpected() --- Simulation/Digitization/python/DigiOutput.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Simulation/Digitization/python/DigiOutput.py b/Simulation/Digitization/python/DigiOutput.py index 120ea51dd1bb..a0ca304d647a 100644 --- a/Simulation/Digitization/python/DigiOutput.py +++ b/Simulation/Digitization/python/DigiOutput.py @@ -140,6 +140,7 @@ def getStreamRDO_ItemList(log): if fastPixelDigiOutputExpected(): StreamRDO_ItemList+=["InDet::SiClusterContainer#*"] StreamRDO_ItemList+=["InDet::PixelGangedClusterAmbiguities#*"] + StreamRDO_ItemList+=["InDet::PixelClusterContainer#*"] if standardPixelDigiOutputExpected(): StreamRDO_ItemList+=["PixelRDO_Container#*"] if DetFlags.digitize.SCT_on(): -- GitLab From a6e55bdadbcdf314694cd3aa4d0d577b06b5191a Mon Sep 17 00:00:00 2001 From: Dwayne Patrick Spiteri <dwayne.patrick.spiteri@cern.ch> Date: Mon, 29 Nov 2021 19:29:11 +0100 Subject: [PATCH 2/5] Implimenting N.Calace's to RectangleSegmentation class to solve TrkDigitization errors --- .../TrkDigEvent/src/RectangleSegmentation.cxx | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/Tracking/TrkDigitization/TrkDigEvent/src/RectangleSegmentation.cxx b/Tracking/TrkDigitization/TrkDigEvent/src/RectangleSegmentation.cxx index d4fa530bbbd5..60e607eeb4b5 100644 --- a/Tracking/TrkDigitization/TrkDigEvent/src/RectangleSegmentation.cxx +++ b/Tracking/TrkDigitization/TrkDigEvent/src/RectangleSegmentation.cxx @@ -107,7 +107,7 @@ void Trk::RectangularSegmentation::createSegmenationSurfaces(std::vector< std::s Trk::SharedObject<const Trk::SurfaceBounds> moduleBounds = std::make_shared<Trk::RectangleBounds>(m_activeBounds->halflengthX(),m_activeBounds->halflengthY()); // - they are separated by half a thickness in z Amg::Transform3D readoutPlaneTransform(Amg::Transform3D::Identity()); - std::unique_ptr<Amg::Transform3D> counterPlaneTransform(new Amg::Transform3D(Amg::Transform3D::Identity())); + Amg::Transform3D counterPlaneTransform(Amg::Transform3D::Identity()); // readout and counter readout bounds, the bounds of the readout plane are like the active ones Trk::SharedObject<const Trk::SurfaceBounds> readoutPlaneBounds = moduleBounds; Trk::SharedObject<const Trk::SurfaceBounds> counterPlaneBounds(nullptr); @@ -116,37 +116,31 @@ void Trk::RectangularSegmentation::createSegmenationSurfaces(std::vector< std::s // no lorentz angle and everything is straight-forward if (lorentzAngle == 0.){ counterPlaneBounds = moduleBounds; - counterPlaneTransform->translation() = Amg::Vector3D(0.,0.,-readoutDirection*halfThickness); + counterPlaneTransform.translation() = Amg::Vector3D(0.,0.,-readoutDirection*halfThickness); } else { // lorentz reduced Bounds double lorentzReducedHalfX = m_activeBounds->halflengthX() - std::abs(lorentzPlaneShiftX); - std::unique_ptr<Trk::RectangleBounds> lorentzRectBounds(new Trk::RectangleBounds(lorentzReducedHalfX,m_activeBounds->halflengthY())); - Trk::SharedObject<const Trk::SurfaceBounds> lorentzReducedBounds(&*lorentzRectBounds); + Trk::SharedObject<const Trk::SurfaceBounds> lorentzReducedBounds(std::make_shared<Trk::RectangleBounds>(lorentzReducedHalfX,m_activeBounds->halflengthY())); counterPlaneBounds = lorentzReducedBounds; // now we shift the counter plane in position - this depends on lorentz angle double counterPlaneShift = -readoutDirection*lorentzPlaneShiftX; - counterPlaneTransform->translation() = Amg::Vector3D(counterPlaneShift,0.,-readoutDirection*halfThickness); + counterPlaneTransform.translation() = Amg::Vector3D(counterPlaneShift,0.,-readoutDirection*halfThickness); } // - build the readout & counter readout surfaces - boundarySurfaces.push_back(std::shared_ptr<const Trk::PlaneSurface>(new Trk::PlaneSurface(readoutPlaneTransform,readoutPlaneBounds))); - boundarySurfaces.push_back(std::shared_ptr<const Trk::PlaneSurface>(new Trk::PlaneSurface(readoutPlaneTransform,readoutPlaneBounds))); + boundarySurfaces.push_back(std::make_shared<Trk::PlaneSurface>(readoutPlaneTransform,readoutPlaneBounds)); + boundarySurfaces.push_back(std::make_shared<Trk::PlaneSurface>(counterPlaneTransform,counterPlaneBounds)); // (B) - bin X and lorentz surfaces ----------------------------------------------------------- // easy stuff first, constant pitch size and double pitchX = 2.*m_activeBounds->halflengthX()/m_binsX; // now, let's create the SharedBounds of all surfaces marking x bins - choice fixes orientation of the matrix - std::unique_ptr<Trk::RectangleBounds> xBinRectBounds(new Trk::RectangleBounds(m_activeBounds->halflengthY(),halfThickness)); - Trk::SharedObject<const Trk::SurfaceBounds> xBinBounds(&*xBinRectBounds); + Trk::SharedObject<const Trk::SurfaceBounds> xBinBounds(std::make_shared<Trk::RectangleBounds>(m_activeBounds->halflengthY(),halfThickness)); // now, let's create the SharedBounds of all surfaces marking lorentz planes double lorentzPlaneHalfX = std::abs(halfThickness/std::cos(lorentzAngle)); - // teh bounds of the lorentz plane - Trk::SharedObject<const Trk::SurfaceBounds> lorentzPlaneBounds; - if (lorentzAngle==0.) { lorentzPlaneBounds = xBinBounds; } - else { - std::unique_ptr<Trk::RectangleBounds> lorentzHalfXRectBounds(new Trk::RectangleBounds(m_activeBounds->halflengthY(),lorentzPlaneHalfX)); - lorentzPlaneBounds = Trk::SharedObject<const Trk::SurfaceBounds>(&*lorentzHalfXRectBounds); - } + // the bounds of the lorentz plane + Trk::SharedObject<const Trk::SurfaceBounds> lorentzPlaneBounds = (lorentzAngle==0.) ? xBinBounds : + Trk::SharedObject<const Trk::SurfaceBounds>(std::make_shared<Trk::RectangleBounds>(m_activeBounds->halflengthY(),lorentzPlaneHalfX)); // now the rotation matrix for the xBins Amg::RotationMatrix3D xBinRotationMatrix; @@ -181,7 +175,7 @@ void Trk::RectangularSegmentation::createSegmenationSurfaces(std::vector< std::s Amg::Vector3D lorentzPlanePosition(cPosX-readoutDirection*lorentzPlaneShiftX, 0., 0.); Amg::Transform3D lorentzPlaneTransform(Amg::getTransformFromRotTransl(lorentzPlaneRotationMatrix,lorentzPlanePosition)); // lorentz plane surfaces - segmentationSurfacesX.push_back(std::shared_ptr<const Trk::PlaneSurface>(new Trk::PlaneSurface(lorentzPlaneTransform,lorentzPlaneBounds))); + segmentationSurfacesX.push_back(std::make_shared<Trk::PlaneSurface>(lorentzPlaneTransform,lorentzPlaneBounds)); } } @@ -192,17 +186,14 @@ void Trk::RectangularSegmentation::createSegmenationSurfaces(std::vector< std::s yBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ(); yBinRotationMatrix.col(2) = Amg::Vector3D(0.,-1.,0.); // easy stuff first, constant pitch in Y - //double pitchY = 2.*m_activeBounds->halflengthY()/m_binsY; // let's create the SharedBounds of all surfaces marking y bins - std::unique_ptr<Trk::RectangleBounds> yBinRectBounds(new Trk::RectangleBounds(m_activeBounds->halflengthX(),halfThickness)); - Trk::SharedObject<const Trk::SurfaceBounds> yBinBounds(&*yBinRectBounds); + Trk::SharedObject<const Trk::SurfaceBounds> yBinBounds(std::make_shared<Trk::RectangleBounds>(m_activeBounds->halflengthX(),halfThickness)); // reserve, it's always (number of bins-1) as the boundaries are within the boundarySurfaces segmentationSurfacesY.reserve(m_binsY); for (size_t ibiny = 0; ibiny <= m_binsY; ++ibiny){ // the position of the bin surface //Use the bin utility to find center of different surfaces double binPosY = m_binUtility->binningData().at(1).boundaries[ibiny]; - //double binPosY = -m_activeBounds->halflengthY()+ibiny*pitchY; Amg::Vector3D binSurfaceCenter(0.,binPosY,0.); Amg::Transform3D binTransform(Amg::getTransformFromRotTransl(yBinRotationMatrix,binSurfaceCenter)); // these are the boundaries -- GitLab From fcb01b40a407d366aa3bac116544febbb047e4d0 Mon Sep 17 00:00:00 2001 From: Dwayne Patrick Spiteri <dwayne.patrick.spiteri@cern.ch> Date: Fri, 19 Nov 2021 22:18:15 +0100 Subject: [PATCH 3/5] Partial update of FastSiDigitizationConfig.py for FastDigitization to run on the master branch --- .../python/FastSiDigitizationConfig.py | 63 ++++++++++++++++--- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py b/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py index cfb93d68ec44..db7e141f0528 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py @@ -31,7 +31,7 @@ def FastSCT_LastXing(): def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): from Digitization.DigitizationFlags import digitizationFlags from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags - + from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags ################################# # Config pixel conditions setup # ################################# @@ -44,7 +44,7 @@ def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): ################# if not hasattr(condSeq, "PixelConfigCondAlg"): from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg - from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags + #from PixelDigitization.PixelDigitizationConfig import PixelConfigCondAlg_MC IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_2016.dat" # ITk: if geoFlags.isSLHC(): @@ -70,6 +70,9 @@ def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): elif (geoFlags.IBLLayout() == "3D"): IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_Run2.dat" + #pixelConfigCondAlg = PixelConfigCondAlg_MC() + #pixelConfigCondAlg.CablingMapFileName=IdMappingDat + #condSeq += pixelConfigCondAlg condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", ReadDeadMapKey = "", CablingMapFileName=IdMappingDat) @@ -144,7 +147,7 @@ def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): if not hasattr(ToolSvc, "PixelLorentzAngleTool"): from SiLorentzAngleTool.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup - ToolSvc += PixelLorentzAngleToolSetup() + PixelLorentzAngleToolSetup() if not hasattr(condSeq, 'PixelDistortionAlg'): from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDistortionAlg @@ -155,10 +158,10 @@ def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): condSeq += PixeldEdxAlg(name="PixeldEdxAlg") PixeldEdxAlg.ReadFromCOOL = True - if not hasattr(ToolSvc, "PixelRecoDbTool"): - from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool - ToolSvc += PixelRecoDbTool() - ToolSvc.PixelRecoDbTool.InputSource = 1 + # if not hasattr(ToolSvc, "PixelRecoDbTool"): + # from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool + # ToolSvc += PixelRecoDbTool() + # ToolSvc.PixelRecoDbTool.InputSource = 1 from AthenaCommon import CfgMgr return CfgMgr.InDet__ClusterMakerTool(name,**kwargs) @@ -169,6 +172,7 @@ def commonPixelFastDigitizationConfig(name,**kwargs): # Import Digitization job properties from Digitization.DigitizationFlags import digitizationFlags + from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags # set the random service, stream name streamName = kwargs.setdefault("RndmEngine", "FastPixelDigitization") kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc() ) @@ -179,12 +183,53 @@ def commonPixelFastDigitizationConfig(name,**kwargs): if digitizationFlags.doXingByXingPileUp(): kwargs.setdefault("FirstXing", FastPixel_FirstXing()) kwargs.setdefault("LastXing", FastPixel_LastXing() ) - + + ################################# + # Config pixel conditions setup # + ################################# + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + ################# + # Module status # + ################# + if not hasattr(condSeq, "PixelConfigCondAlg"): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + #from PixelDigitization.PixelDigitizationConfig import PixelConfigCondAlg_MC + from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_2016.dat" + # ITk: + if geoFlags.isSLHC(): + IdMappingDat = "ITk_Atlas_IdMapping.dat" + if "BrlIncl4.0_ref" == commonGeoFlags.GeoType(): + IdMappingDat = "ITk_Atlas_IdMapping_InclBrl4.dat" + elif "IBrlExt4.0ref" == commonGeoFlags.GeoType(): + IdMappingDat = "ITk_Atlas_IdMapping_IExtBrl4.dat" + elif "BrlExt4.0_ref" == commonGeoFlags.GeoType(): + IdMappingDat = "ITk_Atlas_IdMapping_ExtBrl4.dat" + elif "BrlExt3.2_ref" == commonGeoFlags.GeoType(): + IdMappingDat = "ITk_Atlas_IdMapping_ExtBrl32.dat" + elif (geoFlags.isIBL() is False): + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping.dat" + else: + # Planar IBL + if (geoFlags.IBLLayout() == "planar"): + if (geoFlags.isDBM() is True): + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_inclIBL_DBM.dat" + else: + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_inclIBL.dat" + # Hybrid IBL plus DBM + elif (geoFlags.IBLLayout() == "3D"): + IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_Run2.dat" + + condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", + ReadDeadMapKey = "", + CablingMapFileName=IdMappingDat) + # SiLorentzAngleTool for PixelFastDigitizationTool from AthenaCommon.AppMgr import ToolSvc if not hasattr(ToolSvc, "PixelLorentzAngleTool"): from SiLorentzAngleTool.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup - ToolSvc += PixelLorentzAngleToolSetup() + PixelLorentzAngleToolSetup() kwargs.setdefault("LorentzAngleTool", ToolSvc.PixelLorentzAngleTool) from AthenaCommon import CfgMgr -- GitLab From 0a2a2679cfbd3a27513b755dcebc9a9abe9aa8df Mon Sep 17 00:00:00 2001 From: Dwayne Patrick Spiteri <dwayne.patrick.spiteri@cern.ch> Date: Fri, 19 Nov 2021 22:17:14 +0100 Subject: [PATCH 4/5] Cosmetic renaming of pathLenght and halfLenght variables to pathLength and halfLength. --- .../src/PixelFastDigitizationTool.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx index c1597d76d8f4..b491ed8f25b0 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx @@ -661,18 +661,18 @@ StatusCode PixelFastDigitizationTool::digitize(const EventContext& ctx) for (auto& dStep : digitizationSteps){ - double pathlenght = dStep.stepLength; + double pathlength = dStep.stepLength; // two options fro charge smearing: landau / gauss if ( m_pixSmearPathLength > 0. ) { // create the smdar parameter double sPar = m_pixSmearLandau ? m_pixSmearPathLength*CLHEP::RandLandau::shoot(m_randomEngine) : m_pixSmearPathLength*CLHEP::RandGaussZiggurat::shoot(m_randomEngine); - pathlenght *= (1.+sPar); + pathlength *= (1.+sPar); } - if (pathlenght < pixMinimalPathCut) continue; + if (pathlength < pixMinimalPathCut) continue; // position on the diode map Trk::DigitizationCell cell(dStep.stepCell.first,dStep.stepCell.second); @@ -686,7 +686,7 @@ StatusCode PixelFastDigitizationTool::digitize(const EventContext& ctx) Amg::Vector2D chargeCenterPosition = hitSiDetElement->rawLocalPositionOfCell(diode); const Identifier rdoId = hitSiDetElement->identifierOfPosition(chargeCenterPosition); - clusterPosition += pathlenght * chargeCenterPosition; + clusterPosition += pathlength * chargeCenterPosition; int currentEtaIndex = diode.etaIndex(); int currentPhiIndex = diode.phiIndex(); @@ -697,10 +697,10 @@ StatusCode PixelFastDigitizationTool::digitize(const EventContext& ctx) // record - positions, rdoList and totList - accumulatedPathLength += pathlenght; + accumulatedPathLength += pathlength; //Fail rdoList.push_back(rdoId); - totList.push_back(int(pathlenght*m_pixPathLengthTotConv)); + totList.push_back(int(pathlength*m_pixPathLengthTotConv)); } -- GitLab From 7fe4ea4c436047c039c80cdf60af9c1420bfa42c Mon Sep 17 00:00:00 2001 From: Dwayne Patrick Spiteri <dwayne.patrick.spiteri@cern.ch> Date: Fri, 19 Nov 2021 22:15:16 +0100 Subject: [PATCH 5/5] Cosmetic renaming of pathLenght and halfLenght variables to pathLength and halfLength. --- .../FastSiDigitization/src/PixelFastDigitizationTool.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx index b491ed8f25b0..6490da83a685 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx @@ -986,7 +986,7 @@ Trk::DigitizationModule* PixelFastDigitizationTool::buildDetectorModule(const In //Read from the SiDetectorElement information to build the digitization module const double halfThickness = hitSiDetElement->thickness() * 0.5; const double halfWidth = design->width() * 0.5; - const double halfLenght = design->length() * 0.5; + const double halfLength = design->length() * 0.5; int binsX = design->rows(); int binsY = design->columns(); @@ -996,7 +996,7 @@ Trk::DigitizationModule* PixelFastDigitizationTool::buildDetectorModule(const In float LongPitch =design->parameters(cell).width().xEta(); //std::cout<<"numberOfChip "<<numberOfChip<<" LongPitch "<<LongPitch<<std::endl; - ATH_MSG_VERBOSE("Retrieving infos: halfThickness = " << halfThickness << " --- halfWidth = " << halfWidth << " --- halfLenght = " << halfLenght ); + ATH_MSG_VERBOSE("Retrieving infos: halfThickness = " << halfThickness << " --- halfWidth = " << halfWidth << " --- halfLength = " << halfLength ); ATH_MSG_VERBOSE("Retrieving infos: binsX = " << binsX << " --- binsY = " << binsY << " --- numberOfChip = " << numberOfChip); int readoutDirection = design->readoutSide(); @@ -1017,7 +1017,7 @@ Trk::DigitizationModule* PixelFastDigitizationTool::buildDetectorModule(const In // << " -- element->hitPhiDirection() = " << hitSiDetElement->hitPhiDirection() << std::endl; // rectangle bounds - auto rectangleBounds = std::make_shared<const Trk::RectangleBounds>(halfWidth,halfLenght); + auto rectangleBounds = std::make_shared<const Trk::RectangleBounds>(halfWidth,halfLength); ATH_MSG_VERBOSE("Initialized rectangle Bounds"); // create the segmentation std::shared_ptr<const Trk::Segmentation> rectangleSegmentation(new Trk::RectangularSegmentation(std::move(rectangleBounds),(size_t)binsX,LongPitch,(size_t)binsY, numberOfChip)); @@ -1027,7 +1027,7 @@ Trk::DigitizationModule* PixelFastDigitizationTool::buildDetectorModule(const In halfThickness, readoutDirection, lorentzAngle); - ATH_MSG_VERBOSE("Building Rectangle Segmentation with dimensions (halfX, halfY) = (" << halfWidth << ", " << halfLenght << ")"); + ATH_MSG_VERBOSE("Building Rectangle Segmentation with dimensions (halfX, halfY) = (" << halfWidth << ", " << halfLength << ")"); // success return return digitizationModule; -- GitLab