From 21106ec3f2a36a60e30a422823fe31ea1655c186 Mon Sep 17 00:00:00 2001 From: Dave Casper <dcasper@localhost.localdomain> Date: Sun, 5 Apr 2020 17:28:51 -0700 Subject: [PATCH] Fix bug in spacepoint calculation and geometry overlap --- .../SimHitExample/src/SimHitAlg.cxx | 5 ++- .../SimHitExample/src/SimHitAlg.h | 1 + .../GeoModel/FaserGeoModel/data/geomDB.sql | 2 +- .../python/FaserISF_HepMC_ToolsConfigNew.py | 4 +- .../src/TrackerSpacePointFinder.cxx | 2 +- .../TrackerSpacePointMakerTool.h | 2 +- .../src/TrackerSpacePointMakerTool.cxx | 39 +++++++++++++------ 7 files changed, 38 insertions(+), 17 deletions(-) diff --git a/Control/CalypsoExample/SimHitExample/src/SimHitAlg.cxx b/Control/CalypsoExample/SimHitExample/src/SimHitAlg.cxx index 6e937ba7..91d65509 100644 --- a/Control/CalypsoExample/SimHitExample/src/SimHitAlg.cxx +++ b/Control/CalypsoExample/SimHitExample/src/SimHitAlg.cxx @@ -10,7 +10,9 @@ StatusCode SimHitAlg::initialize() // initialize a histogram // letter at end of TH1 indicated variable type (D double, F float etc) m_hist = new TH1D("eLoss", "SCT Hit Energy Loss", 100, 0, 1); //first string is root object name, second is histogram title - ATH_CHECK(histSvc()->regHist("/HIST/myhist", m_hist)); + m_module = new TH2D("module", "SCT Hit Module", 3, -1.5, 1.5, 4, -0.5, 3.5 ); + ATH_CHECK(histSvc()->regHist("/HIST/eloss", m_hist)); + ATH_CHECK(histSvc()->regHist("/HIST/modules", m_module)); // initialize data handle keys ATH_CHECK( m_mcEventKey.initialize() ); @@ -47,6 +49,7 @@ StatusCode SimHitAlg::execute() { hit.print(); m_hist->Fill( hit.energyLoss() ); + m_module->Fill( hit.getModule(), hit.getRow()); } return StatusCode::SUCCESS; diff --git a/Control/CalypsoExample/SimHitExample/src/SimHitAlg.h b/Control/CalypsoExample/SimHitExample/src/SimHitAlg.h index cfc1d0d3..fa275512 100644 --- a/Control/CalypsoExample/SimHitExample/src/SimHitAlg.h +++ b/Control/CalypsoExample/SimHitExample/src/SimHitAlg.h @@ -18,6 +18,7 @@ class SimHitAlg : public AthHistogramAlgorithm private: TH1* m_hist; // Example histogram + TH2* m_module; // Read handle keys for data containers // Any other event data can be accessed identically diff --git a/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql b/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql index 71879199..035bb19b 100644 --- a/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql +++ b/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql @@ -1404,7 +1404,7 @@ INSERT INTO "SCTTOPLEVEL_DATA2TAG" VALUES(106788,3); -- DROP TABLE IF EXISTS "SCTFASERGENERAL_DATA"; CREATE TABLE "SCTFASERGENERAL_DATA" ("SCTFASERGENERAL_DATA_ID" SLONGLONG, "NUMLAYERS" INT, "LAYERPITCH" DOUBLE, "ETAHALFPITCH" DOUBLE, "PHIHALFPITCH" DOUBLE, "DEPTHHALFPITCH" DOUBLE, "SIDEHALFPITCH" DOUBLE, UNIQUE ( "SCTFASERGENERAL_DATA_ID") ); -INSERT INTO "SCTFASERGENERAL_DATA" VALUES (0, 3, 65.0, 60.0, 30.0, 2.5, 2.5); +INSERT INTO "SCTFASERGENERAL_DATA" VALUES (0, 3, 65.0, 60.0, 30.0, 2.5, 5.0); DROP TABLE IF EXISTS "SCTFASERGENERAL_DATA2TAG"; CREATE TABLE "SCTFASERGENERAL_DATA2TAG" ( "SCTFASERGENERAL_TAG_ID" SLONGLONG ,"SCTFASERGENERAL_DATA_ID" SLONGLONG ); INSERT INTO "SCTFASERGENERAL_DATA2TAG" VALUES(106789, 0); diff --git a/Simulation/ISF/ISF_HepMC/FaserISF_HepMC_Tools/python/FaserISF_HepMC_ToolsConfigNew.py b/Simulation/ISF/ISF_HepMC/FaserISF_HepMC_Tools/python/FaserISF_HepMC_ToolsConfigNew.py index a9264e44..8b9637bf 100644 --- a/Simulation/ISF/ISF_HepMC/FaserISF_HepMC_Tools/python/FaserISF_HepMC_ToolsConfigNew.py +++ b/Simulation/ISF/ISF_HepMC/FaserISF_HepMC_Tools/python/FaserISF_HepMC_ToolsConfigNew.py @@ -165,8 +165,8 @@ def FaserTruthStrategyCfg(ConfigFlags, name="ISF_FaserTruthStrategy", **kwargs): FaserRegion.fFaserDipole, FaserRegion.fFaserCalorimeter, FaserRegion.fFaserCavern]) - kwargs.setdefault('ParentMinEkin', 1*MeV) - kwargs.setdefault('ChildMinEkin', 1*MeV) + # kwargs.setdefault('ParentMinEkin', 1*MeV) + # kwargs.setdefault('ChildMinEkin', 1*MeV) result.setPrivateTools(ISF__FaserTruthStrategy(name, **kwargs)) return result diff --git a/Tracker/TrackerRecAlgs/TrackerSpacePointFormation/src/TrackerSpacePointFinder.cxx b/Tracker/TrackerRecAlgs/TrackerSpacePointFormation/src/TrackerSpacePointFinder.cxx index a2355c4b..8a73c7fc 100755 --- a/Tracker/TrackerRecAlgs/TrackerSpacePointFormation/src/TrackerSpacePointFinder.cxx +++ b/Tracker/TrackerRecAlgs/TrackerSpacePointFormation/src/TrackerSpacePointFinder.cxx @@ -48,7 +48,7 @@ TrackerSpacePointFinder::TrackerSpacePointFinder(const std::string& name, // declareProperty("OverrideBeamSpot", m_overrideBS=false); declareProperty("VertexX", m_xVertex=0.); declareProperty("VertexY", m_yVertex=0.); - declareProperty("VertexZ", m_zVertex=-100.); + declareProperty("VertexZ", m_zVertex=0.); declareProperty("SpacePointCacheSCT", m_SpacePointCache_SCTKey=""); diff --git a/Tracker/TrackerRecTools/FaserSiSpacePointTool/FaserSiSpacePointTool/TrackerSpacePointMakerTool.h b/Tracker/TrackerRecTools/FaserSiSpacePointTool/FaserSiSpacePointTool/TrackerSpacePointMakerTool.h index 7d26b1b5..d6245810 100644 --- a/Tracker/TrackerRecTools/FaserSiSpacePointTool/FaserSiSpacePointTool/TrackerSpacePointMakerTool.h +++ b/Tracker/TrackerRecTools/FaserSiSpacePointTool/FaserSiSpacePointTool/TrackerSpacePointMakerTool.h @@ -93,7 +93,7 @@ namespace Tracker /// @name option to use closest approach of SCT strips as position for SpacePoint //@{ - BooleanProperty m_usePerpProj{this, "UsePerpendicularProjection", false}; + BooleanProperty m_usePerpProj{this, "UsePerpendicularProjection", true}; //@} /// @name ID helper diff --git a/Tracker/TrackerRecTools/FaserSiSpacePointTool/src/TrackerSpacePointMakerTool.cxx b/Tracker/TrackerRecTools/FaserSiSpacePointTool/src/TrackerSpacePointMakerTool.cxx index 738797a6..6dac89b8 100644 --- a/Tracker/TrackerRecTools/FaserSiSpacePointTool/src/TrackerSpacePointMakerTool.cxx +++ b/Tracker/TrackerRecTools/FaserSiSpacePointTool/src/TrackerSpacePointMakerTool.cxx @@ -106,19 +106,36 @@ Trk::SpacePoint* TrackerSpacePointMakerTool::makeSCT_SpacePoint(const Tracker::T to determine the position of the SpacePoint on element 1. This option is especially aimed at the use with cosmics data. */ - Amg::Vector3D mab(c - a); - double eaTeb = q.dot(r); - double denom = 1. - eaTeb*eaTeb; - if (fabs(denom)>10e-7){ - double lambda0 = (mab.dot(q) - mab.dot(r)*eaTeb)/denom; - point = a+lambda0*q; - ATH_MSG_VERBOSE( "Endpoints 1 : ( " << a.x() << " , " << a.y() << " , " << a.z() << " ) to (" << b.x() << " , " << b.y() << " , " << b.z() << " ) " ); - ATH_MSG_VERBOSE( "Endpoints 2 : ( " << c.x() << " , " << c.y() << " , " << c.z() << " ) to (" << d.x() << " , " << d.y() << " , " << d.z() << " ) " ); - ATH_MSG_VERBOSE( "Intersection: ( " << point.x() << " , " << point.y() << " , " << point.z() << " ) " ); - } else { - ATH_MSG_WARNING("Intersection failed"); + double det = Amg::Vector3D(q.cross(r)).z(); + if (fabs(det)>10e-7) + { + Amg::Vector3D s(a+b); + Amg::Vector3D t(c+d); + double lambda0 = r.cross(Amg::Vector3D(s-t)).z()/det; + point = (s + lambda0 * q)/2; + ATH_MSG_VERBOSE( "Endpoints 1 : ( " << a.x() << " , " << a.y() << " , " << a.z() << " ) to (" << b.x() << " , " << b.y() << " , " << b.z() << " ) " ); + ATH_MSG_VERBOSE( "Endpoints 2 : ( " << c.x() << " , " << c.y() << " , " << c.z() << " ) to (" << d.x() << " , " << d.y() << " , " << d.z() << " ) " ); + ATH_MSG_VERBOSE( "Intersection: ( " << point.x() << " , " << point.y() << " , " << point.z() << " ) " ); + } + else + { + ATH_MSG_WARNING("Alt Intersection failed"); ok = false; } + + // Amg::Vector3D mab(c - a); + // double eaTeb = q.dot(r); + // double denom = 1. - eaTeb*eaTeb; + // if (fabs(denom)>10e-7){ + // double lambda0 = (mab.dot(q) - mab.dot(r)*eaTeb)/denom; + // point = a+lambda0*q; + // ATH_MSG_VERBOSE( "Endpoints 1 : ( " << a.x() << " , " << a.y() << " , " << a.z() << " ) to (" << b.x() << " , " << b.y() << " , " << b.z() << " ) " ); + // ATH_MSG_VERBOSE( "Endpoints 2 : ( " << c.x() << " , " << c.y() << " , " << c.z() << " ) to (" << d.x() << " , " << d.y() << " , " << d.z() << " ) " ); + // ATH_MSG_VERBOSE( "Intersection: ( " << point.x() << " , " << point.y() << " , " << point.z() << " ) " ); + // } else { + // ATH_MSG_WARNING("Intersection failed"); + // ok = false; + // } } else { Amg::Vector3D s(a+b-2.*vertexVec); // twice the vector from vertex to midpoint Amg::Vector3D t(c+d-2.*vertexVec); // twice the vector from vertex to midpoint -- GitLab