diff --git a/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql b/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql index fe71ab37918e3feb2cfb046ba97ce519e840f2c1..1a6007a9083d964582a0e04d3f97b88c74b081c9 100644 --- a/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql +++ b/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql @@ -133,9 +133,7 @@ DROP TABLE IF EXISTS "VETOSTATIONGENERAL_DATA"; CREATE TABLE IF NOT EXISTS "VETOSTATIONGENERAL_DATA" ( "VETOSTATIONGENERAL_DATA_ID" SLONGLONG UNIQUE, "NUMPLATES" INT, - "WIDTH" DOUBLE, - "LENGTH" DOUBLE, - "THICKNESS" DOUBLE + "PLATEPITCH" DOUBLE ); -- DROP TABLE IF EXISTS "VETOSTATIONGENERAL_DATA2TAG"; @@ -143,6 +141,21 @@ CREATE TABLE IF NOT EXISTS "VETOSTATIONGENERAL_DATA2TAG" ( "VETOSTATIONGENERAL_TAG_ID" SLONGLONG, "VETOSTATIONGENERAL_DATA_ID" SLONGLONG ); +DROP TABLE IF EXISTS "VETOPLATEGENERAL_DATA"; +CREATE TABLE IF NOT EXISTS "VETOPLATEGENERAL_DATA" ( + "VETOPLATEGENERAL_DATA_ID" SLONGLONG UNIQUE, + "NUMPMTS" INT, + "WIDTH" DOUBLE, + "LENGTH" DOUBLE, + "THICKNESS" DOUBLE, + "MATERIAL" TEXT +); +-- +DROP TABLE IF EXISTS "VETOPLATEGENERAL_DATA2TAG"; +CREATE TABLE IF NOT EXISTS "VETOPLATEGENERAL_DATA2TAG" ( + "VETOPLATEGENERAL_TAG_ID" SLONGLONG, + "VETOPLATEGENERAL_DATA_ID" SLONGLONG +); -- Tables for scintillator materials. -- Materials are recorded in two related nodes. -- One stores the name and density of the material. @@ -305,6 +318,7 @@ INSERT INTO "HVS_NODE" VALUES (102, "StdMatComponents", 100, 0, NULL); INSERT INTO "HVS_NODE" VALUES (103, "Elements", 100, 0, NULL); INSERT INTO "HVS_NODE" VALUES (1001, "VetoTopLevel", 11, 0, NULL); INSERT INTO "HVS_NODE" VALUES (1002, "VetoStationGeneral", 11, 0, NULL); +INSERT INTO "HVS_NODE" VALUES (1006, "VetoPlateGeneral", 11, 0, NULL); INSERT INTO "HVS_NODE" VALUES (1003, "ScintMaterials", 1, 0, NULL); INSERT INTO "HVS_NODE" VALUES (1004, "ScintMatComponents", 1, 0, NULL); INSERT INTO "HVS_NODE" VALUES (2003, "TrackerMaterials", 2, 0, NULL); @@ -330,6 +344,7 @@ INSERT INTO "HVS_TAG2NODE" VALUES (102, "StdMatComponents-00", 100007, NULL, 0, INSERT INTO "HVS_TAG2NODE" VALUES (103, "Elements-00", 100008, NULL, 0, 0, 1549238400000000000, NULL, 22); INSERT INTO "HVS_TAG2NODE" VALUES (1001, "VetoTopLevel-00", 100009, NULL, 0, 0, 1567123200000000000, NULL, 22); INSERT INTO "HVS_TAG2NODE" VALUES (1002, "VetoStationGeneral-00", 100010, NULL, 0, 0, 1567123200000000000, NULL, 22); +INSERT INTO "HVS_TAG2NODE" VALUES (1006, "VetoPlateGeneral-00", 100025, NULL, 0, 0, 1567209600000000000, NULL, 22); INSERT INTO "HVS_TAG2NODE" VALUES (1003, "ScintMaterials-00", 100011, NULL, 0, 0, 1549238400000000000, NULL, 22); INSERT INTO "HVS_TAG2NODE" VALUES (1004, "ScintMatComponents-00", 100012, NULL, 0, 0, 1549238400000000000, NULL, 22); INSERT INTO "HVS_TAG2NODE" VALUES (2003, "TrackerMaterials-00", 100021, NULL, 0, 0, 1550448000000000000, NULL, 22); @@ -355,6 +370,7 @@ INSERT INTO "HVS_LTAG2LTAG" VALUES (100, 100005, 102, 100007); INSERT INTO "HVS_LTAG2LTAG" VALUES (100, 100005, 103, 100008); INSERT INTO "HVS_LTAG2LTAG" VALUES (11, 100015, 1001, 100009); INSERT INTO "HVS_LTAG2LTAG" VALUES (11, 100015, 1002, 100010); +INSERT INTO "HVS_LTAG2LTAG" VALUES (11, 100015, 1006, 100025); INSERT INTO "HVS_LTAG2LTAG" VALUES (1, 100001, 1003, 100011); INSERT INTO "HVS_LTAG2LTAG" VALUES (1, 100001, 1004, 100012); INSERT INTO "HVS_LTAG2LTAG" VALUES (2, 100002, 2003, 100021); @@ -381,6 +397,7 @@ INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "StdMatComponents", "StdMatComp INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "Elements", "Elements-00", 100008); INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "VetoTopLevel", "VetoTopLevel-00", 100009); INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "VetoStationGeneral", "VetoStationGeneral-00", 100010); +INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "VetoPlateGeneral", "VetoPlateGeneral-00", 100025); INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "ScintMaterials", "ScintMaterials-00", 100011); INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "ScintMatComponents", "ScintMatComponents-00", 100012); INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "TrackerMaterials", "TrackerMaterials-00", 100021); @@ -937,9 +954,12 @@ INSERT INTO "VETOTOPLEVEL_DATA2TAG" VALUES (100009, 1); INSERT INTO "VETOTOPLEVEL_DATA2TAG" VALUES (100009, 2); -- -- -INSERT INTO "VETOSTATIONGENERAL_DATA" VALUES (0, 2, 300.0, 300.0, 20.0); +INSERT INTO "VETOSTATIONGENERAL_DATA" VALUES (0, 2, 100.0); INSERT INTO "VETOSTATIONGENERAL_DATA2TAG" VALUES (100010, 0); -- +INSERT INTO "VETOPLATEGENERAL_DATA" VALUES (0, 2, 300.0, 300.0, 20.0, "scint::Scintillator"); +INSERT INTO "VETOPLATEGENERAL_DATA2TAG" VALUES (100025, 0); +-- INSERT INTO "SCINTMATERIALS_DATA" VALUES (0, "Scintillator", 1.032); INSERT INTO "SCINTMATERIALS_DATA2TAG" VALUES (100011, 0); -- diff --git a/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt b/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt index 8dbe5940ab2cf7651e5e73fb4e278bb3e782392d..48678911bcc17daf7a1e922bbf1ea6427b1f1f56 100644 --- a/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt +++ b/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt @@ -40,5 +40,5 @@ atlas_add_component( GeoModelSvc # Install files from the package: atlas_install_headers( GeoModelSvc ) -atlas_install_joboptions( share/*.py ) +#atlas_install_joboptions( share/*.py ) diff --git a/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx b/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx index d95cd7e5a201da4b6e433d078a08b577dc6ebec5..b25d954a9fa6269e8d6cdba332d1b8b4f9a64cac 100644 --- a/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx +++ b/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx @@ -28,6 +28,7 @@ #include "GeoModelKernel/GeoPerfUtils.h" #include <fstream> +#include <filesystem> #include "AthenaKernel/ClassID_traits.h" #include "SGTools/DataProxy.h" @@ -47,6 +48,7 @@ GeoModelSvc::GeoModelSvc(const std::string& name,ISvcLocator* svc) m_useTagInfo(true), m_useCaloAlign(false), m_statisticsToFile(false), + m_geoExportFile(""), m_supportedGeometry(0), m_ignoreTagSupport(false) { @@ -67,6 +69,7 @@ GeoModelSvc::GeoModelSvc(const std::string& name,ISvcLocator* svc) declareProperty( "StatisticsToFile", m_statisticsToFile); declareProperty( "SupportedGeometry", m_supportedGeometry); declareProperty( "IgnoreTagSupport", m_ignoreTagSupport); + declareProperty( "GeoExportFile", m_geoExportFile); } GeoModelSvc::~GeoModelSvc() @@ -359,15 +362,33 @@ StatusCode GeoModelSvc::geoInit() theMaterialManager->printAll(); // Try to dump the geometry - PVConstLink world(worldPhys); - GMDBManager db("faserGeo.db"); - if (db.isOpen()) + if (m_geoExportFile != "") { - DumpGeoModelActionLocal dumpGraph(db); - world->exec(&dumpGraph); - dumpGraph.saveToDB(); + if (std::filesystem::exists(m_geoExportFile) && !std::filesystem::is_directory(m_geoExportFile)) + { + ATH_MSG_INFO("Removing existing version of " << m_geoExportFile ); + std::filesystem::remove(m_geoExportFile); + } + if (std::filesystem::is_directory(m_geoExportFile)) + { + ATH_MSG_WARNING("Requested export file is an existing directory."); + } + else if (std::filesystem::exists(m_geoExportFile)) + { + ATH_MSG_WARNING("File " << m_geoExportFile << " exists and could not removed for recreation."); + } + else + { + PVConstLink world(worldPhys); + GMDBManager db(m_geoExportFile.c_str()); + if (db.isOpen()) + { + DumpGeoModelActionLocal dumpGraph(db); + world->exec(&dumpGraph); + dumpGraph.saveToDB(); + } + } } - return StatusCode::SUCCESS; } diff --git a/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.h b/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.h index 10682709feb350230ac8f86614ecfe9b913cd067..b7b9f3615cb4d9ccf0d4459feef4d61d7bf0292c 100644 --- a/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.h +++ b/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.h @@ -88,6 +88,7 @@ private: bool m_useTagInfo; // Flag for TagInfo usage bool m_useCaloAlign; // Flag for using alignments for Calo bool m_statisticsToFile; // Flag for generating GeoModelStatistics file in the run directory + std::string m_geoExportFile; // Name of file to export GeoModel trees (constructed geometry) to int m_supportedGeometry; // Supported geometry flag is set in jobOpt and is equal to major release version bool m_ignoreTagSupport; // If true then don't check SUPPORT flag for ATLAS tag diff --git a/DetectorDescription/GeoModel/GeoModelSvc/src/components/GeoModelSvc_entries.cxx b/DetectorDescription/GeoModel/GeoModelSvc/src/components/GeoModelSvc_entries.cxx index eda713dbfd8ad653043574a80c2a6f3ce576ddd4..12f83ef779ed2992d181000f40fb90ee45ab0a44 100644 --- a/DetectorDescription/GeoModel/GeoModelSvc/src/components/GeoModelSvc_entries.cxx +++ b/DetectorDescription/GeoModel/GeoModelSvc/src/components/GeoModelSvc_entries.cxx @@ -3,4 +3,3 @@ DECLARE_COMPONENT( GeoModelSvc ) DECLARE_COMPONENT( GeoDbTagSvc ) - diff --git a/DetectorDescription/GeoModel/GeoModelTest/CMakeLists.txt b/DetectorDescription/GeoModel/GeoModelTest/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a60e824205d15a022bdbafc35ac3141ffe2602c --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelTest/CMakeLists.txt @@ -0,0 +1,29 @@ +################################################################################ +# Package: GeoModelTest +################################################################################ + +# Declare the package name: +atlas_subdir( GeoModelTest ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PRIVATE + Control/AthenaBaseComps + DetectorDescription/GeoModel/GeoModelInterfaces + DetectorDescription/GeoModel/GeoModelUtilities + Scintillator/ScintDetDescr/ScintReadoutGeometry + ) + +# External dependencies: +find_package( GeoModel ) + +# Component(s) in the package: +atlas_add_component( GeoModelTest + src/GeoModelTestAlg.cxx + src/components/GeoModelTest_entries.cxx + INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} + LINK_LIBRARIES ${GEOMODEL_LIBRARIES} AthenaBaseComps GeoModelUtilities ScintReadoutGeometry ) + +# Install files from the package: +#atlas_install_headers( GeoModelTest ) +atlas_install_joboptions( share/*.py ) + diff --git a/DetectorDescription/GeoModel/GeoModelSvc/share/geoDebug.py b/DetectorDescription/GeoModel/GeoModelTest/share/geoDebug.py similarity index 85% rename from DetectorDescription/GeoModel/GeoModelSvc/share/geoDebug.py rename to DetectorDescription/GeoModel/GeoModelTest/share/geoDebug.py index 8a4bbb99e0006f381c8c1f8039af811123ee2ef2..825ac57b6482edb4261c838111afa42df226856b 100644 --- a/DetectorDescription/GeoModel/GeoModelSvc/share/geoDebug.py +++ b/DetectorDescription/GeoModel/GeoModelTest/share/geoDebug.py @@ -22,9 +22,16 @@ from FaserGeoModel import GeoModelInit from GeoModelSvc.GeoModelSvcConf import GeoModelSvc GeoModelSvc = GeoModelSvc() GeoModelSvc.PrintMaterials = True +GeoModelSvc.GeoExportFile = "faserGeo.db" #DetFlags.Print() +from AthenaCommon.AlgSequence import AlgSequence +topSequence = AlgSequence() + +from GeoModelTest.GeoModelTestConf import GeoModelTestAlg +topSequence += GeoModelTestAlg() + from AthenaCommon.AppMgr import theApp theApp.EvtMax = 1 diff --git a/DetectorDescription/GeoModel/GeoModelTest/src/GeoModelTestAlg.cxx b/DetectorDescription/GeoModel/GeoModelTest/src/GeoModelTestAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9d777b6693506606afb5b1ec864b5fa6acd2e844 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelTest/src/GeoModelTestAlg.cxx @@ -0,0 +1,71 @@ +#include "GeoModelTestAlg.h" + +#include "GeoModelKernel/GeoVDetectorManager.h" +#include "GeoModelUtilities/GeoModelExperiment.h" + +#include "ScintReadoutGeometry/VetoDetectorManager.h" + + +GeoModelTestAlg::GeoModelTestAlg(const std::string& name, ISvcLocator* pSvcLocator) +: AthAlgorithm(name, pSvcLocator) { } + +GeoModelTestAlg::~GeoModelTestAlg() { } + +StatusCode GeoModelTestAlg::initialize() +{ + + return StatusCode::SUCCESS; +} + +StatusCode GeoModelTestAlg::execute() +{ + GeoModelExperiment* theExpt = nullptr; + std::vector<std::string> listOfManagers; + ATH_CHECK(detStore()->retrieve(theExpt, "FASER")); + if (theExpt != nullptr) + { + ATH_MSG_ALWAYS("Retrieved top-level FASER experiment geometry from DetStore."); + listOfManagers = theExpt->getListOfManagers(); + ATH_MSG_ALWAYS("Experiment has defined " << listOfManagers.size() << " detector managers:"); + for (auto mgr : listOfManagers) + { + const GeoVDetectorManager* pMgr = nullptr; + pMgr = theExpt->getManager(mgr); + if (pMgr != nullptr) + { + ATH_MSG_ALWAYS("Retrieved (generic) manager " << mgr << " from top-level experiment."); + } + else + { + ATH_MSG_ALWAYS("Failed to retrieve manager " << mgr); + return StatusCode::FAILURE; + } + } + } + else + { + ATH_MSG_ALWAYS("Failed to retrieve top-level FASER experiment geometry from DetStore."); + return StatusCode::FAILURE; + } + + // Test direct retrieval of typed managers from DetStore + const ScintDD::VetoDetectorManager* vetoMgr = nullptr; + ATH_CHECK(detStore()->retrieve(vetoMgr, "Veto")); + if (vetoMgr != nullptr) + { + ATH_MSG_ALWAYS("Retrieved (typed) Veto detector manager with " << vetoMgr->getNumTreeTops() << " treetops directly from DetStore."); + } + else + { + ATH_MSG_ALWAYS("Failed to retrieve (typed) Veto detector manager directly from DetStore."); + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + +StatusCode GeoModelTestAlg::finalize() +{ + + return StatusCode::SUCCESS; +} diff --git a/DetectorDescription/GeoModel/GeoModelTest/src/GeoModelTestAlg.h b/DetectorDescription/GeoModel/GeoModelTest/src/GeoModelTestAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..866968b1cbb0d5b153eb817fe6f27ca53d2951ec --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelTest/src/GeoModelTestAlg.h @@ -0,0 +1,16 @@ +#include "AthenaBaseComps/AthAlgorithm.h" + +// Minimalist algorithm to test retrieval of constructed geometry from DetStore + +class GeoModelTestAlg : public AthAlgorithm +{ + public: + GeoModelTestAlg(const std::string& name, ISvcLocator* pSvcLocator); + + virtual ~GeoModelTestAlg(); + + StatusCode initialize(); + StatusCode execute(); + StatusCode finalize(); + +}; \ No newline at end of file diff --git a/DetectorDescription/GeoModel/GeoModelTest/src/components/GeoModelTest_entries.cxx b/DetectorDescription/GeoModel/GeoModelTest/src/components/GeoModelTest_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5782f75d333abac058530ec9aee03a033d13dd5f --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelTest/src/components/GeoModelTest_entries.cxx @@ -0,0 +1,3 @@ +#include "../GeoModelTestAlg.h" + +DECLARE_COMPONENT( GeoModelTestAlg ) diff --git a/Legacy/LegacyBase/LegacyBase/selection.xml b/Legacy/LegacyBase/LegacyBase/selection.xml index 74b161e4da03a1582d9a2ade815f26648f2181b7..e45e094238edceb7d7bc8a7ca6c3496e7f7f482b 100644 --- a/Legacy/LegacyBase/LegacyBase/selection.xml +++ b/Legacy/LegacyBase/LegacyBase/selection.xml @@ -19,6 +19,7 @@ <class name="G4AttDef" /> </selection> <exclusion> + <class name="CLHEP::Hep3Vector" /> <class name="FaserSensorHit"> <method name="Draw"/> </class> diff --git a/Scintillator/ScintDetDescr/ScintIdDictFiles/data/IdDictScintillator.xml b/Scintillator/ScintDetDescr/ScintIdDictFiles/data/IdDictScintillator.xml index fbec1a8aa8e7fec1c1e5e20244125c1ad1dcf922..c2142072bac66070cbba81fb65f848b8e9cbc9d5 100644 --- a/Scintillator/ScintDetDescr/ScintIdDictFiles/data/IdDictScintillator.xml +++ b/Scintillator/ScintDetDescr/ScintIdDictFiles/data/IdDictScintillator.xml @@ -9,7 +9,7 @@ <region> <range field="part" value="Veto" /> <range field="station" minvalue="0" maxvalue="1" /> - <range field="plate" minvalue="0" maxvalue="0" /> + <range field="plate" minvalue="0" maxvalue="1" /> <range field="pmt" minvalue="0" maxvalue="0" /> </region> diff --git a/Scintillator/ScintDetDescr/ScintIdentifier/ScintIdentifier/VetoID.h b/Scintillator/ScintDetDescr/ScintIdentifier/ScintIdentifier/VetoID.h index 5a3801689840a9ca3d005d7e9d09d13053c8f8e0..2d3cb5ecd0ec5d39e46c99c57f8b59e19d13f56f 100644 --- a/Scintillator/ScintDetDescr/ScintIdentifier/ScintIdentifier/VetoID.h +++ b/Scintillator/ScintDetDescr/ScintIdentifier/ScintIdentifier/VetoID.h @@ -134,7 +134,7 @@ public: //@} - /// @name Optimized accessors - ASSUMES id IS a sct id, i.e. NOT pixel or other + /// @name Optimized accessors - ASSUMES id IS a veto id, i.e. NOT other //@{ /// wafer hash from id - optimized IdentifierHash plate_hash (Identifier plate_id) const; @@ -372,6 +372,13 @@ inline Identifier VetoID::plate_id ( IdentifierHash plate_hash ) const //---------------------------------------------------------------------------- inline IdentifierHash VetoID::plate_hash (Identifier plate_id) const { + // MsgStream log(m_msgSvc, "VetoID"); + // log << MSG::VERBOSE << "m_plate_vec size: " << m_plate_vec.size() << endmsg; + // log << MSG::VERBOSE << "input id = " << plate_id << endmsg; + // for (size_t i = 0; i < m_plate_vec.size(); i++) + // { + // log << MSG::VERBOSE << "Hash = " << i << " : ID = " << m_plate_vec[i] << endmsg; + // } id_vec_it it = std::lower_bound(m_plate_vec.begin(), m_plate_vec.end(), plate_id); diff --git a/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorDesign.h b/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorDesign.h index c04fb9d240fd1e875c29bf749240bc540c9e1b27..02500895db70cd9f16932945da2944dbc33a9b94 100644 --- a/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorDesign.h +++ b/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorDesign.h @@ -56,12 +56,9 @@ enum DetectorShape { class ScintDetectorDesign: public RCBase { public: enum Axis { - xAxis=0, yAxis, zAxis + xAxis = 0, yAxis, zAxis }; - enum Edge { - negative = -1, both, positive - }; /////////////////////////////////////////////////////////////////// // Public methods: /////////////////////////////////////////////////////////////////// @@ -72,17 +69,7 @@ public: ScintDetectorDesign( const double thickness, const double width, const double length, - const int cells, - const ScintDetectorDesign::Edge readoutSide); - - - ScintDetectorDesign( const double thickness, - const double width, - const double length, - const int cells, - const ScintDetectorDesign::Edge readoutSide, - const ScintDetectorDesign::Axis photonDirection, - const ScintDetectorDesign::Axis thicknessDirection); + const int cells ); /** Destructor: */ virtual ~ScintDetectorDesign(); @@ -95,20 +82,17 @@ public: ScintIntersect inDetector(const ScintLocalPosition &localPosition, double xTol, double yTol) const; - /** which axis in hit frame is the photon flight direction */ + /** which axis in hit frame is horizontal */ /** phi corresponds to "width" */ ScintDetectorDesign::Axis phiAxis() const; - /** which axis in hit frame is transverse to photon flight direction */ + /** which axis in hit frame is vertical */ /** eta corresponds to "length" */ ScintDetectorDesign::Axis etaAxis() const; - /** which axis in hit frame is thickness direction */ + /** which axis in hit frame is thickness/beam direction */ ScintDetectorDesign::Axis depthAxis() const; - /** ReadoutSide. */ - ScintDetectorDesign::Edge readoutSide() const; - /////////////////////////////////////////////////////////////////// // Pure virtual methods: /////////////////////////////////////////////////////////////////// @@ -117,7 +101,7 @@ public: +ve = inside -ve = outside */ virtual void distanceToDetectorEdge(const ScintLocalPosition &localPosition, - double &xDist, double &yDist) const = 0; + double &xDist, double &yDist) const; /** Method to calculate length of a module */ virtual double length() const; @@ -148,14 +132,13 @@ private: /////////////////////////////////////////////////////////////////// private: double m_thickness; // !< thickness of plate - double m_width; // !< dimension in "phi" direction (photon flight) + double m_width; // !< dimension in "phi" direction double m_length; // !< dimnesion in "eta" direction int m_cells; // !< number of pmts - ScintDetectorDesign::Edge m_readoutSide; - ScintDetectorDesign::Axis m_phiAxis; // which axis in hit frame corresponds to photon flight direction? - ScintDetectorDesign::Axis m_etaAxis; // which axis in hit frame is normal to photon flight direction? - ScintDetectorDesign::Axis m_depthAxis; // which axis in hit frame is depth? + ScintDetectorDesign::Axis m_phiAxis; // which axis in hit frame is horizontal ("width" axis) + ScintDetectorDesign::Axis m_etaAxis; // which axis in hit frame is vertical ("length" axis) + ScintDetectorDesign::Axis m_depthAxis; // which axis in hit frame is depth/beam? const Trk::RectangleBounds* m_bounds; @@ -195,9 +178,5 @@ inline ScintDetectorDesign::Axis ScintDetectorDesign::depthAxis() const { return m_depthAxis; } -inline ScintDetectorDesign::Edge ScintDetectorDesign::readoutSide() const { - return m_readoutSide; -} - } // namespace ScintDD #endif // SCINTREADOUTGEOMETRY_SCINTDETECTORDESIGN_H diff --git a/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorElement.h b/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorElement.h index 8a1868a9999e36cae87cb16178614ee5480997ef..27ac6a4b97d9ec47c33339e5ec163dbec657efae 100644 --- a/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorElement.h +++ b/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorElement.h @@ -61,20 +61,28 @@ namespace ScintDD { - Local hit frame:\n Local frame for hits. It is the same as local frame in G4 and GeoModel. I also refer to this as the local simulation frame. + In FASER: + - hitDepth = local z = global z (always beam direction) + - hitEta = local y = global y (always vertical up) + - hitPhi = local x (right-handed wrt y cross z, hence same as global x; left of beam direction) + (hitPhi, hitEta, hitDepth) is right-handed + In veto/preshower, photon direction is +hitEta = +y + In trigger, pmt number increases in +hitPhi direction = +x + In ATLAS (retained for reference): By convention elements are orientated such that: - hitDepth = local x - hitPhi = local y - hitEta = local z - . Directions of these correspond to the physical wafer. Consequently hitDepth and hitPhi axes go in different directions depending on the orientation of the module. The readout side is determined from design()->readoutSide(). - Local reconstruction frame:\n - - distPhi = local x - - distEta = local y - - distDepth = local z + - distPhi = local x (= global x in FASER) + - distEta = local y (= global y in FASER) + - distDepth = local z (= global z in FASER) . + (In ATLAS:) The directions of the axes are defined as - distPhi in direction of increasing phi - distEta in direction of increasing z in barrel and increasing r in endcap. diff --git a/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorManager.h b/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorManager.h index f5be56816690c4603ccf9f572e5914c58e0b97d5..b53ca47e5d149298f2d3e635a8c0099c973d9002 100644 --- a/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorManager.h +++ b/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintDetectorManager.h @@ -93,7 +93,7 @@ class ScintNumerology; // bool isSCT() const {return !isPixel();} /** Add alignable transforms. No access to these, they will be changed by manager: */ - virtual void addAlignableTransform (int level, const Identifier &id, GeoAlignableTransform *xf) = 0; + // virtual void addAlignableTransform (int level, const Identifier &id, GeoAlignableTransform *xf) = 0; /** Invalidate cache for all detector elements */ virtual void invalidateAll() const; diff --git a/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintLocalPosition.h b/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintLocalPosition.h index 38d01252b256e0621d8feaf86988e9a5e195cac8..69770e0b76f616a332e9a915d0421a250f14cacb 100644 --- a/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintLocalPosition.h +++ b/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/ScintLocalPosition.h @@ -43,10 +43,10 @@ namespace ScintDD { ScintLocalPosition(const Amg::Vector2D &position); /** Constructor with parameters: - position along x direction - position along y direction + position along eta direction + position along phi direction position along depth direction (default is 0) */ - ScintLocalPosition(const double x,const double y, + ScintLocalPosition(const double eta,const double phi, const double xDepth=0); /** Destructor: */ @@ -62,11 +62,11 @@ namespace ScintDD { // Const methods: /////////////////////////////////////////////////////////////////// - /** position along horizontal direction:*/ - double x() const; + /** position along local eta direction:*/ + double xEta() const; - /** position along vertical direction:*/ - double y() const; + /** position along local phi direction:*/ + double xPhi() const; /** Cylindrical coordinate r:*/ double r() const; @@ -81,9 +81,9 @@ namespace ScintDD { // Non-const methods: /////////////////////////////////////////////////////////////////// - void x(const double x); + void xEta(const double eta); - void y(const double y); + void xPhi(const double phi); void xDepth(const double xDepth); @@ -102,8 +102,8 @@ namespace ScintDD { /////////////////////////////////////////////////////////////////// private: - double m_x; //!< position along x direction - double m_y; //!< position along y direction + double m_eta; //!< position along eta direction + double m_phi; //!< position along phi direction double m_xDepth; //!< position along depth direction }; @@ -113,14 +113,14 @@ namespace ScintDD { inline ScintLocalPosition::~ScintLocalPosition() {} -inline double ScintLocalPosition::x() const +inline double ScintLocalPosition::xEta() const { - return m_x; + return m_eta; } -inline double ScintLocalPosition::y() const +inline double ScintLocalPosition::xPhi() const { - return m_y; + return m_phi; } inline double ScintLocalPosition::xDepth() const @@ -130,22 +130,22 @@ inline double ScintLocalPosition::xDepth() const inline double ScintLocalPosition::r() const { - return std::sqrt(m_x * m_x + m_y * m_y); + return std::sqrt(m_eta * m_eta + m_phi * m_phi); } inline double ScintLocalPosition::phi() const { - return std::atan2(m_y, m_x); + return std::atan2(m_phi, m_eta); } -inline void ScintLocalPosition::x(const double x) +inline void ScintLocalPosition::xEta(const double x) { - m_x=x; + m_eta=x; } -inline void ScintLocalPosition::y(const double y) +inline void ScintLocalPosition::xPhi(const double y) { - m_y=y; + m_phi=y; } inline void ScintLocalPosition::xDepth(const double xDepth) diff --git a/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/VetoDetectorManager.h b/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/VetoDetectorManager.h index 748ad5a499ec3a2260e2176987b132b5d6aa8bb8..86cc4d527edda32a658940cf9cb1f629dcdabdaf 100644 --- a/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/VetoDetectorManager.h +++ b/Scintillator/ScintDetDescr/ScintReadoutGeometry/ScintReadoutGeometry/VetoDetectorManager.h @@ -96,7 +96,7 @@ namespace ScintDD { const GeoVPhysVol * child); // DEPRECATED - virtual void addAlignableTransform (int, const Identifier &, GeoAlignableTransform *) override {}; // For backward compatibility + // virtual void addAlignableTransform (int, const Identifier &, GeoAlignableTransform *) override {}; // For backward compatibility /** Initialize the neighbours. This can only be done when all elements are built. */ virtual void initNeighbours() override; @@ -148,7 +148,7 @@ namespace ScintDD { typedef std::map<Identifier, ExtendedAlignableTransform *> AlignableTransformMap; std::vector< AlignableTransformMap > m_higherAlignableTransforms; std::vector< ExtendedAlignableTransform *> m_alignableTransforms; - std::vector< ExtendedAlignableTransform *> m_moduleAlignableTransforms; + // std::vector< ExtendedAlignableTransform *> m_moduleAlignableTransforms; const VetoID* m_idHelper; /** This variable switches the how the local alignment corrections are applied diff --git a/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintDetectorDesign.cxx b/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintDetectorDesign.cxx index 3c167351f53fc95745f0bc8f9540adb72c720a60..87dc6b6b860dba7bb48531349cf0d7033e85cba7 100644 --- a/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintDetectorDesign.cxx +++ b/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintDetectorDesign.cxx @@ -15,36 +15,24 @@ #include "ScintReadoutGeometry/ScintDetectorDesign.h" #include "ScintReadoutGeometry/ScintIntersect.h" +#include "ScintReadoutGeometry/ScintLocalPosition.h" #include "TrkSurfaces/RectangleBounds.h" namespace ScintDD { -// Constructor with parameters: +// Constructor: ScintDetectorDesign::ScintDetectorDesign( const double thickness, const double width, const double length, - const int cells, - const ScintDetectorDesign::Edge readoutSide ) : - ScintDetectorDesign(thickness, width, length, cells, readoutSide, Axis::yAxis, Axis::xAxis) -{ } /* same as ATLAS SCT axes */ - -// Constructor with axes: -ScintDetectorDesign::ScintDetectorDesign( const double thickness, - const double width, - const double length, - const int cells, - const ScintDetectorDesign::Edge readoutSide, - const ScintDetectorDesign::Axis photonDirection, - const ScintDetectorDesign::Axis thicknessDirection ) : + const int cells) : m_thickness(thickness), m_width{width}, m_length{length}, m_cells{cells}, - m_readoutSide(readoutSide), - m_phiAxis(photonDirection), /* same as ATLAS SCT for now */ - m_depthAxis(thicknessDirection) + m_phiAxis(Axis::xAxis), + m_etaAxis(Axis::yAxis), + m_depthAxis(Axis::zAxis) { - m_etaAxis = static_cast<Axis> ((xAxis + yAxis + zAxis) - (photonDirection + thicknessDirection)); - m_bounds = new Trk::RectangleBounds(0.5*width, 0.5*length); + m_bounds = new Trk::RectangleBounds(0.5*width, 0.5*length); } @@ -88,4 +76,26 @@ ScintDetectorDesign::bounds() const return *m_bounds; } +// Returns distance to nearest detector edge +// +ve = inside +// -ve = outside +void +ScintDetectorDesign::distanceToDetectorEdge(const ScintLocalPosition & localPosition, + double & etaDist, double & phiDist) const +{ + // As the calculation is symmetric around 0,0 we only have to test it for one side. + double xEta = abs(localPosition.xEta()); + double xPhi = abs(localPosition.xPhi()); + + double xEtaEdge = 0.5 * length(); + double xPhiEdge = 0.5 * width(); + + // Distance to top/bottom + etaDist = xEtaEdge - xEta; + + // Distance to right/left edge + phiDist = xPhiEdge - xPhi; + +} + } // namespace ScintDD diff --git a/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintDetectorElement.cxx b/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintDetectorElement.cxx index 41cd8606ea1ab5b7423594b8bb2784785af23449..84261bf175126471be0b889a6f5a5ea233f1fbf3 100644 --- a/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintDetectorElement.cxx +++ b/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintDetectorElement.cxx @@ -27,7 +27,6 @@ // #include "InDetReadoutGeometry/SiCellId.h" // #include "InDetReadoutGeometry/SiReadoutCellId.h" -// #include "ScintReadoutGeometry/VetoDetectorDesign.h" #include "ScintReadoutGeometry/ScintDetectorDesign.h" // #include "InDetReadoutGeometry/StripStereoAnnulusDesign.h" @@ -54,6 +53,7 @@ ScintDetectorElement::ScintDetectorElement(const Identifier &id, const GeoAlignmentStore* geoAlignStore) : TrkDetElementBase(geophysvol), m_id(id), + m_idHash(64000), m_design(design), m_commonItems(commonItems), m_cacheValid(false), @@ -155,15 +155,20 @@ ScintDetectorElement::updateCache() const m_centerCLHEP = Amg::EigenTransformToCLHEP(geoTransform) * centerGeoModel; m_center = Amg::Vector3D(m_centerCLHEP[0],m_centerCLHEP[1],m_centerCLHEP[2]); - // + // (In ATLAS:) // Determine directions depth, eta and phi axis in reconstruction local frame // ie depth away from interaction point // phi in direction of increasing phi // eta in direction of increasing z in barrel, and increasing r in endcap // - - // depthAxis, xAxis, and yAxis are defined to be x,y,z respectively for all detectors for hit local frame. - // depthAxis, xAxis, and yAxis are defined to be z,x,y respectively for all detectors for reco local frame. + // depthAxis, phiAxis, and etaAxis are defined to be x,y,z respectively for all detectors for hit local frame. + // depthAxis, phiAxis, and etaAxis are defined to be z,x,y respectively for all detectors for reco local frame. + // + // In FASER: + // depthAxis, phiAxis and etaAxis are defined to be z,x,y respectively for all detectors in hit local AND reco local frames + // This is accomplished simply by the fixed initialization of m_hitEta, m_hitPhi and m_hitDepth in ScintDetectorDesign + // + static const HepGeom::Vector3D<double> localAxes[3] = { HepGeom::Vector3D<double>(1,0,0), HepGeom::Vector3D<double>(0,1,0), @@ -188,12 +193,12 @@ ScintDetectorElement::updateCache() const HepGeom::Vector3D<double> globalEtaAxis(Amg::EigenTransformToCLHEP(geoTransform) * geoModelEtaAxis); // unit radial vector - HepGeom::Vector3D<double> unitR(m_center.x(), m_center.y(), 0.); + // HepGeom::Vector3D<double> unitR(m_center.x(), m_center.y(), 0.); - unitR.setMag(1.); + // unitR.setMag(1.); - HepGeom::Vector3D<double> nominalEta; - HepGeom::Vector3D<double> nominalNormal; + // HepGeom::Vector3D<double> nominalEta; + // HepGeom::Vector3D<double> nominalNormal; // HepGeom::Vector3D<double> nominalPhi(-unitR.y(), unitR.x(), 0); // In Barrel like geometry, the etaAxis is along increasing z, and normal is in increasing radial direction. @@ -220,8 +225,8 @@ ScintDetectorElement::updateCache() const // nominalEta.setZ(1); // nominalNormal = unitR; // } else { // endcap like - nominalNormal.setZ(-1); - nominalEta = unitR; + // nominalNormal.setZ(-1); + // nominalEta = unitR; // } // Determine if axes are to have their directions swapped. @@ -229,15 +234,15 @@ ScintDetectorElement::updateCache() const // // Depth axis. // - double depthDir = globalDepthAxis.dot(nominalNormal); - m_depthDirection = true; - if (depthDir < 0) { + // double depthDir = globalDepthAxis.dot(nominalNormal); + // m_depthDirection = true; + // if (depthDir < 0) { // if (m_design->depthSymmetric()) { - m_depthDirection = false; + // m_depthDirection = false; // } else { // if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Unable to swap local depth axis." << endmsg; // } - } + // } // if (std::abs(depthDir) < 0.5) { // Check that it is in roughly the right direction. // msg(MSG::ERROR) << "Orientation of local depth axis does not follow correct convention." << endmsg; // // throw std::runtime_error("Orientation of local depth axis does not follow correct convention."); @@ -248,7 +253,7 @@ ScintDetectorElement::updateCache() const // Phi axis (unclear how to handle for FASER - never swap for now) // // double phiDir = globalPhiAxis.dot(nominalPhi); - m_phiDirection = true; + // m_phiDirection = true; // if (phiDir < 0) { // if (m_design->phiSymmetric()) { // m_phiDirection = false; @@ -267,7 +272,7 @@ ScintDetectorElement::updateCache() const // Eta axis (unclear how to handle for FASER - never swap for now) // // double etaDir = globalEtaAxis.dot(nominalEta); - m_etaDirection = true; + // m_etaDirection = true; // if (etaDir < 0) { // if (m_design->etaSymmetric()) { // m_etaDirection = false; @@ -291,25 +296,25 @@ ScintDetectorElement::updateCache() const // Check that local frame is right-handed. (ie transform has no reflection) // This can be done by checking that the determinant is >0. - if (firstTimeTmp) { // Only need to check this once. - HepGeom::Transform3D & t = m_transformCLHEP; - double det = t(0,0) * (t(1,1)*t(2,2) - t(1,2)*t(2,1)) - - t(0,1) * (t(1,0)*t(2,2) - t(1,2)*t(2,0)) + - t(0,2) * (t(1,0)*t(2,1) - t(1,1)*t(2,0)); - if (det < 0) { + // if (firstTimeTmp) { // Only need to check this once. + // HepGeom::Transform3D & t = m_transformCLHEP; + // double det = t(0,0) * (t(1,1)*t(2,2) - t(1,2)*t(2,1)) - + // t(0,1) * (t(1,0)*t(2,2) - t(1,2)*t(2,0)) + + // t(0,2) * (t(1,0)*t(2,1) - t(1,1)*t(2,0)); + // if (det < 0) { // if (m_design->depthSymmetric()) { - if (msgLvl(MSG::DEBUG)) - msg(MSG::DEBUG) << "Local frame is left-handed, Swapping depth axis to make it right handed." - << endmsg; - m_depthDirection = !m_depthDirection; - m_transformCLHEP = Amg::EigenTransformToCLHEP(geoTransform) * recoToHitTransform(); - m_transform = Amg::CLHEPTransformToEigen(m_transformCLHEP); + // if (msgLvl(MSG::DEBUG)) + // msg(MSG::DEBUG) << "Local frame is left-handed, Swapping depth axis to make it right handed." + // << endmsg; + // m_depthDirection = !m_depthDirection; + // m_transformCLHEP = Amg::EigenTransformToCLHEP(geoTransform) * recoToHitTransform(); + // m_transform = Amg::CLHEPTransformToEigen(m_transformCLHEP); //m_transform = m_commonItems->solenoidFrame() * geoTransform * recoToHitTransform(); // } else { // if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Local frame is left-handed." << endmsg; // } - } - } + // } + // } // Initialize various cached members @@ -408,9 +413,10 @@ ScintDetectorElement::recoToHitTransform() const if (m_firstTime) updateCache(); // global = transform * recoLocal - // = transfromHit * hitLocal + // = transformHit * hitLocal // = transformHit * recoToHitTransform * recoLocal - // recoToHitTransform takes recoLocal to hitLocal + // + // (In ATLAS:) recoToHitTransform takes recoLocal to hitLocal // x,y,z -> y,z,x // equiv to a rotation around Y of 90 deg followed by a rotation around X of 90deg // diff --git a/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintLocalPosition.cxx b/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintLocalPosition.cxx index 0de06fe74cbabc17c08e28f6f5d6fb20a69d5228..fd36b55b3e911ad760dfb5058580eff351396c8b 100644 --- a/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintLocalPosition.cxx +++ b/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/ScintLocalPosition.cxx @@ -17,8 +17,8 @@ namespace ScintDD { // Default constructor: ScintLocalPosition::ScintLocalPosition() : - m_x(0), - m_y(0), + m_eta(0), + m_phi(0), m_xDepth(0) {} @@ -27,21 +27,21 @@ ScintLocalPosition::ScintLocalPosition() : // Constructor with parameters: ScintLocalPosition::ScintLocalPosition(const double x,const double y, const double xDepth) : - m_x(x), - m_y(y), + m_eta(x), + m_phi(y), m_xDepth(xDepth) {} ScintLocalPosition::ScintLocalPosition(const Amg::Vector2D &position) - : m_x(position[Trk::locX]), - m_y(position[Trk::locY]), + : m_eta(position[Trk::distEta]), + m_phi(position[Trk::distPhi]), m_xDepth(0) {} ScintLocalPosition::operator Amg::Vector2D(void) const { - return Amg::Vector2D(m_x, m_y); + return Amg::Vector2D(m_phi, m_eta); } @@ -49,8 +49,8 @@ ScintLocalPosition::operator Amg::Vector2D(void) const // addition of positions: ScintLocalPosition &ScintLocalPosition::operator+=(const ScintLocalPosition &position) { - m_x+=position.m_x; - m_y+=position.m_y; + m_eta+=position.m_eta; + m_phi+=position.m_phi; m_xDepth+=position.m_xDepth; return *this; } @@ -58,8 +58,8 @@ ScintLocalPosition &ScintLocalPosition::operator+=(const ScintLocalPosition &pos // scaling: ScintLocalPosition &ScintLocalPosition::operator*=(const double factor) { - m_x*=factor; - m_y*=factor; + m_eta*=factor; + m_phi*=factor; m_xDepth*=factor; return *this; } @@ -68,8 +68,8 @@ ScintLocalPosition &ScintLocalPosition::operator*=(const double factor) ScintLocalPosition &ScintLocalPosition::operator/=(const double factor) { if (0!=factor) { - m_x/=factor; - m_y/=factor; + m_eta/=factor; + m_phi/=factor; m_xDepth/=factor; } else {} return *this; diff --git a/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/VetoDetectorManager.cxx b/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/VetoDetectorManager.cxx index ac0b1acab6802ea9d4b841a456e611813d2a400d..3146c8cdda8439726880747b3c1f081faca99e96 100644 --- a/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/VetoDetectorManager.cxx +++ b/Scintillator/ScintDetDescr/ScintReadoutGeometry/src/VetoDetectorManager.cxx @@ -20,7 +20,7 @@ namespace ScintDD { - const int FIRST_HIGHER_LEVEL = 2; + const int FIRST_HIGHER_LEVEL = 1; VetoDetectorManager::VetoDetectorManager( StoreGateSvc* detStore ) : ScintDetectorManager(detStore, "Veto"), @@ -38,7 +38,7 @@ namespace ScintDD { if (m_idHelper) { m_elementCollection.resize(m_idHelper->plate_hash_max()); m_alignableTransforms.resize(m_idHelper->plate_hash_max()); - m_moduleAlignableTransforms.resize(m_idHelper->plate_hash_max()); + // m_moduleAlignableTransforms.resize(m_idHelper->plate_hash_max()); } } @@ -64,9 +64,9 @@ namespace ScintDD { delete m_alignableTransforms[k]; } - for (size_t l=0; l < m_moduleAlignableTransforms.size(); l++){ - delete m_moduleAlignableTransforms[l]; - } + // for (size_t l=0; l < m_moduleAlignableTransforms.size(); l++){ + // delete m_moduleAlignableTransforms[l]; + // } } unsigned int VetoDetectorManager::getNumTreeTops() const @@ -166,7 +166,6 @@ namespace ScintDD { // } } - const VetoID* VetoDetectorManager::getIdHelper() const { return m_idHelper; @@ -211,52 +210,49 @@ namespace ScintDD { ATH_MSG_WARNING("Frames other than global or local are not supported."); return false; } - - } else if (level == 1) { // module level - - // We retrieve it via a hashId. - IdentifierHash idHash = m_idHelper->plate_hash(id); - if (!idHash.is_valid()) return false; - - int idModuleHash = idHash; - // int idModuleHash = idHash / 2; - - // if (idHash%2) { - // ATH_MSG_WARNING("Side 1 wafer id used for module id"); + // } else if (level == 1) { // module level + + // // We retrieve it via a hashId. + // IdentifierHash idHash = m_idHelper->plate_hash(id); + // if (!idHash.is_valid()) return false; + + // int idModuleHash = idHash; + // // int idModuleHash = idHash / 2; + + // // if (idHash%2) { + // // ATH_MSG_WARNING("Side 1 wafer id used for module id"); + // // return false; + // // } + + // if (frame == ScintDD::global) { // global shift + // // Its a global transform + // return setAlignableTransformGlobalDelta(m_moduleAlignableTransforms[idModuleHash], delta, alignStore); + // } else if (frame == ScintDD::local) { // local shift + // ScintDetectorElement * element = m_elementCollection[idHash]; + // if (!element) return false; + + // // Its a local transform + // //See header file for definition of m_isLogical + // if( m_isLogical ){ + // //Ensure cache is up to date and use the alignment corrected local to global transform + // element->setCache(); + // return setAlignableTransformLocalDelta(m_moduleAlignableTransforms[idModuleHash], element->plateTransform(), delta, alignStore); + // } else + // //Use default local to global transform + // return setAlignableTransformLocalDelta(m_moduleAlignableTransforms[idModuleHash],element->defPlateTransform(), delta, alignStore); + + // } else { + // // other not supported + // ATH_MSG_WARNING("Frames other than global or local are not supported."); // return false; // } - - if (frame == ScintDD::global) { // global shift - // Its a global transform - return setAlignableTransformGlobalDelta(m_moduleAlignableTransforms[idModuleHash], delta, alignStore); - } else if (frame == ScintDD::local) { // local shift - ScintDetectorElement * element = m_elementCollection[idHash]; - if (!element) return false; - - // Its a local transform - //See header file for definition of m_isLogical - if( m_isLogical ){ - //Ensure cache is up to date and use the alignment corrected local to global transform - element->setCache(); - return setAlignableTransformLocalDelta(m_moduleAlignableTransforms[idModuleHash], element->plateTransform(), delta, alignStore); - } else - //Use default local to global transform - return setAlignableTransformLocalDelta(m_moduleAlignableTransforms[idModuleHash],element->defPlateTransform(), delta, alignStore); - - } else { - // other not supported - ATH_MSG_WARNING("Frames other than global or local are not supported."); - return false; - } - } else { // higher level - if (frame != ScintDD::global) { ATH_MSG_WARNING("Non global shift at higher levels is not supported."); return false; } - int index = level - FIRST_HIGHER_LEVEL; // level 0 and 1 is treated separately. + int index = level - FIRST_HIGHER_LEVEL; // level 0 is treated separately. if (index >= static_cast<int>(m_higherAlignableTransforms.size())) return false; // We retrieve it from a map. @@ -267,7 +263,6 @@ namespace ScintDD { // Its a global transform return setAlignableTransformGlobalDelta(iter->second, delta, alignStore); } - } void VetoDetectorManager::addAlignableTransform (int level, @@ -298,18 +293,16 @@ namespace ScintDD { if (idHash.is_valid()) { m_alignableTransforms[idHash]= new ExtendedAlignableTransform(transform, child); } - } else if (level == 1) { - // Module - IdentifierHash idHash = m_idHelper->plate_hash(id); - if (idHash.is_valid()) { - // m_moduleAlignableTransforms[idHash/2]=new ExtendedAlignableTransform(transform, child); - m_moduleAlignableTransforms[idHash]=new ExtendedAlignableTransform(transform, child); - } - + // } else if (level == 1) { + // // Module + // IdentifierHash idHash = m_idHelper->plate_hash(id); + // if (idHash.is_valid()) { + // // m_moduleAlignableTransforms[idHash/2]=new ExtendedAlignableTransform(transform, child); + // m_moduleAlignableTransforms[idHash]=new ExtendedAlignableTransform(transform, child); + // } } else { - - // Higher levels are saved in a map. NB level=0,1 is treated above. - int index = level - FIRST_HIGHER_LEVEL; // level 0 and 1 is treated separately. + // Higher levels are saved in a map. NB level=0 is treated above. + int index = level - FIRST_HIGHER_LEVEL; // level 0 is treated separately. if (index >= static_cast<int>(m_higherAlignableTransforms.size())) m_higherAlignableTransforms.resize(index+1); m_higherAlignableTransforms[index][id] = new ExtendedAlignableTransform(transform, child); } diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoDataBase.h b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoDataBase.h index 47173a8e4cd19d1a98429a6c2a8f568120d93399..cce56bba95689ae521b73a419d8c72a9fb0552f4 100644 --- a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoDataBase.h +++ b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoDataBase.h @@ -40,6 +40,7 @@ public: // const IRDBRecord* brlServPerLayer(int i) const; // const IRDBRecord* brlThermalShield() const; const IRDBRecord* stationGeneral() const; + const IRDBRecord* plateGeneral() const; // const IRDBRecord* brlFSI() const; // int brlFSISize() const; // const IRDBRecord* brlFSILocation(int i) const; @@ -117,6 +118,7 @@ private: // IRDBRecordset_ptr m_brlServPerLayer; // IRDBRecordset_ptr m_brlThermalShield; IRDBRecordset_ptr m_stationGeneral; + IRDBRecordset_ptr m_plateGeneral; // IRDBRecordset_ptr m_brlFSI; // IRDBRecordset_ptr m_brlFSILocation; // IRDBRecordset_ptr m_fwdSensor; diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoGeneralParameters.h b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoGeneralParameters.h index e4343af88cb8d7bdefd45926902bdd748c804bce..f53c7a885eee91aec0f8e4ece26f832b4d720795 100644 --- a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoGeneralParameters.h +++ b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoGeneralParameters.h @@ -27,7 +27,7 @@ public: double safety() const; //Default conditions. - double temperature() const; +// double temperature() const; // double biasVoltage() const; // double depletionVoltage() const; diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoGeometryManager.h b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoGeometryManager.h index f113d1f1b1427da8f0c7efe867636364a434261c..8f759df8367b2044c9462ce397fcd1dc46fd8f37 100644 --- a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoGeometryManager.h +++ b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoGeometryManager.h @@ -15,7 +15,7 @@ namespace ScintDD { } class VetoStationParameters; -// class VetoPlateParameters; +class VetoPlateParameters; class VetoDataBase; class VetoGeneralParameters; class VetoGeoModelAthenaComps; @@ -41,7 +41,7 @@ public: const ScintDD::ScintCommonItems * commonItems() const; const VetoStationParameters* stationParameters() const; -// const VetoPlateParameters* plateParameters() const; + const VetoPlateParameters* plateParameters() const; const VetoGeneralParameters* generalParameters() const; const ScintDD::DistortedMaterialManager* distortedMatManager() const; @@ -56,7 +56,7 @@ private: VetoDataBase* m_rdb; std::unique_ptr<VetoStationParameters> m_stationParameters; -// std::unique_ptr<VetoPlateParameters> m_plateParameters; + std::unique_ptr<VetoPlateParameters> m_plateParameters; std::unique_ptr<VetoGeneralParameters> m_generalParameters; std::unique_ptr<ScintDD::DistortedMaterialManager> m_distortedMatManager; diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoPlate.h b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoPlate.h new file mode 100644 index 0000000000000000000000000000000000000000..44e38a155f38741e44d902f6e230a119fc735172 --- /dev/null +++ b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoPlate.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef VETOGEOMODEL_VETOPLATE_H +#define VETOGEOMODEL_VETOPLATE_H + +#include "VetoGeoModel/VetoComponentFactory.h" + +#include <atomic> +#include <string> + +class GeoMaterial; +class GeoVPhysVol; +namespace ScintDD{class ScintDetectorDesign;} + +class VetoPlate: public VetoUniqueComponentFactory +{ +public: + VetoPlate(const std::string & name, + ScintDD::VetoDetectorManager* detectorManager, + const VetoGeometryManager* geometryManager, + VetoMaterialManager* materials); + +public: + const GeoMaterial * material() const {return m_material;} + double thickness() const {return m_thickness;} + double width() const {return m_width;} + double length() const {return m_length;} + + virtual GeoVPhysVol * build(VetoIdentifier id); + +private: + void getParameters(); + virtual const GeoLogVol * preBuild(); + void makeDesign(); + + const GeoMaterial * m_material; + double m_thickness; + double m_width; + double m_length; + + ScintDD::ScintDetectorDesign * m_design; + + mutable std::atomic_bool m_noElementWarning; +}; + +#endif // VETOGEOMODEL_VETOPLATE_H diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoPlateParameters.h b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoPlateParameters.h new file mode 100644 index 0000000000000000000000000000000000000000..bf359c5558c15cedecbe944c8e73b3aded53bbf1 --- /dev/null +++ b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoPlateParameters.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef VetoGeoModel_VetoPlateParameters_H +#define VetoGeoModel_VetoPlateParameters_H + +#include <string> + +class VetoDataBase; + +class VetoPlateParameters { + +public: + + // Constructor + VetoPlateParameters(VetoDataBase* rdb); + + // Barrel General + int platePmts() const; + double plateThickness() const; + double plateWidth() const; + double plateLength() const; + std::string plateMaterial() const; + + private: + VetoDataBase * m_rdb; + +}; + + +#endif // VetoGeoModel_VetoPlateParameters_H diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoStation.h b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoStation.h index 41c70fa310e49b0140384cfdceeed8399baf57da..b0650c7940f2e137baef981b1dab9a0cc2354a11 100644 --- a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoStation.h +++ b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoStation.h @@ -11,12 +11,14 @@ class GeoVPhysVol; class GeoFullPhysVol; class GeoLogVol; class VetoIdentifier; +class VetoPlate; class VetoStation : public VetoUniqueComponentFactory { public: VetoStation(const std::string & name, + VetoPlate* plate, ScintDD::VetoDetectorManager* detectorManager, const VetoGeometryManager* geometryManager, VetoMaterialManager* materials); @@ -24,6 +26,7 @@ public: public: int numPlates() const {return m_numPlates;} + double platePitch() const {return m_platePitch;} double thickness() const {return m_thickness;} double width() const {return m_width;} double length() const {return m_length;} @@ -31,23 +34,17 @@ public: private: void getParameters(); virtual const GeoLogVol * preBuild(); + + VetoPlate* m_plate; -// void buildThermalShield(GeoFullPhysVol * parent) const; -// void buildEMIShield(GeoFullPhysVol * parent) const; - - - int m_numPlates; - - double m_thickness; - double m_width; - double m_length; - -// double m_thermalShieldEndWallThickness; - -// double m_zClearance; + int m_numPlates; + double m_platePitch; -// bool m_isOldGeometry; + double m_thickness; + double m_width; + double m_length; + double m_safety; }; #endif // VETOGEOMODEL_VETOSTATION_H diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoStationParameters.h b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoStationParameters.h index 281e0c92258317c2bd7f8541b74c008326f679ec..173b4e99dc3f3ff85ac1c53a4db8246600ca4a90 100644 --- a/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoStationParameters.h +++ b/Scintillator/ScintDetDescr/VetoGeoModel/VetoGeoModel/VetoStationParameters.h @@ -174,9 +174,10 @@ public: // Barrel General int numPlates() const; - double stationThickness() const; - double stationWidth() const; - double stationLength() const; + double platePitch() const; + // double stationThickness() const; + // double stationWidth() const; + // double stationLength() const; // double cylinderLength() const; // double activeLength() const; // bool isOldGeometry() const; diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoDataBase.cxx b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoDataBase.cxx index 01c463acf96306b03f61fb5d73b58f8553b1bf2f..6d322cc2baebf5c570126cb5687349fc0a805948 100644 --- a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoDataBase.cxx +++ b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoDataBase.cxx @@ -101,6 +101,9 @@ VetoDataBase::VetoDataBase(const VetoGeoModelAthenaComps * athenaComps) m_stationGeneral = rdbSvc->getRecordsetPtr("VetoStationGeneral", versionTag, versionNode, "FASERDD"); msg(MSG::DEBUG) << "Table VetoStationGeneral Fetched" << endmsg; + m_plateGeneral = rdbSvc->getRecordsetPtr("VetoPlateGeneral", versionTag, versionNode, "FASERDD"); + msg(MSG::DEBUG) << "Table VetoPlateGeneral Fetched" << endmsg; + // m_brlFSI = rdbSvc->getRecordsetPtr("SctBrlFSI", versionTag, versionNode); // msg(MSG::DEBUG) << "Table SctBrlFSI Fetched" << endmsg; @@ -210,6 +213,7 @@ IRDBRecordset_ptr VetoDataBase::topLevelTable() const {return m_topLevel;} // const IRDBRecord* VetoDataBase::brlServPerLayer(int i) const {return (*m_brlServPerLayer)[i];} // const IRDBRecord* VetoDataBase::brlThermalShield() const {return (*m_brlThermalShield)[0];} const IRDBRecord* VetoDataBase::stationGeneral() const {return (*m_stationGeneral)[0];} +const IRDBRecord* VetoDataBase::plateGeneral() const {return (*m_plateGeneral)[0];} // const IRDBRecord* VetoDataBase::brlFSI() const {return (*m_brlFSI)[0];} // int VetoDataBase::brlFSISize() const {return m_brlFSI->size();} // const IRDBRecord* VetoDataBase::brlFSILocation(int i) const {return (*m_brlFSILocation)[i];} diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoDetectorFactory.cxx b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoDetectorFactory.cxx index bba7334b06b9646c0c22c67ce166560623ba0d8c..73f99499bf979393852c8f599ae4576e3d4d05d3 100644 --- a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoDetectorFactory.cxx +++ b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoDetectorFactory.cxx @@ -20,6 +20,7 @@ #include "ScintReadoutGeometry/ScintDetectorDesign.h" #include "VetoGeoModel/VetoStation.h" +#include "VetoGeoModel/VetoPlate.h" #include "VetoGeoModel/VetoDataBase.h" #include "VetoGeoModel/VetoGeoModelAthenaComps.h" @@ -156,6 +157,11 @@ void VetoDetectorFactory::create(GeoPhysVol *world) // bool absorberA_Present = vetoGeneral->partPresent(absorberA_Label); // bool absorberB_Present = vetoGeneral->partPresent(absorberB_Label); + // + // Plate is the same for all stations + // + VetoPlate plate("Plate", m_detectorManager, m_geometryManager, m_materials); + msg(MSG::DEBUG) << "Created Veto plate with dimensions (" << plate.thickness() << "," << plate.width() << "," << plate.length() << ")" << endmsg; // // Station A // @@ -165,7 +171,7 @@ void VetoDetectorFactory::create(GeoPhysVol *world) m_detectorManager->numerology().addStation(0); // Create the station - VetoStation stationA("VetoStationA", m_detectorManager, m_geometryManager, m_materials); + VetoStation stationA("VetoStationA", &plate, m_detectorManager, m_geometryManager, m_materials); VetoIdentifier id{m_geometryManager->athenaComps()->getIdHelper()}; id.setStation(0); GeoVPhysVol* stationA_PV = stationA.build(id); @@ -178,8 +184,8 @@ void VetoDetectorFactory::create(GeoPhysVol *world) scint->add(stationA_PV); m_detectorManager->addTreeTop(stationA_PV); - // Store alignable transform - m_detectorManager->addAlignableTransform(3, id.getPlateId(), stationA_Transform, stationA_PV); + // Store alignable transform for station (level = 1) + m_detectorManager->addAlignableTransform(1, id.getPlateId(), stationA_Transform, stationA_PV); } // @@ -191,7 +197,7 @@ void VetoDetectorFactory::create(GeoPhysVol *world) m_detectorManager->numerology().addStation(1); // Create the station - VetoStation stationB("VetoStationB", m_detectorManager, m_geometryManager, m_materials); + VetoStation stationB("VetoStationB", &plate, m_detectorManager, m_geometryManager, m_materials); VetoIdentifier id{m_geometryManager->athenaComps()->getIdHelper()}; id.setStation(1); GeoVPhysVol* stationB_PV = stationB.build(id); @@ -204,8 +210,8 @@ void VetoDetectorFactory::create(GeoPhysVol *world) scint->add(stationB_PV); m_detectorManager->addTreeTop(stationB_PV); - // Store alignable transform - m_detectorManager->addAlignableTransform(3, id.getPlateId(), stationB_Transform, stationB_PV); + // Store alignable transform for station (level = 1) + m_detectorManager->addAlignableTransform(1, id.getPlateId(), stationB_Transform, stationB_PV); } // // diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoGeometryManager.cxx b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoGeometryManager.cxx index 5fa1af13fc3318082fab7a43ae26f5667da57510..2b018e65920a0509db331c08efb22967766ddf70 100644 --- a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoGeometryManager.cxx +++ b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoGeometryManager.cxx @@ -8,7 +8,7 @@ #include "ScintIdentifier/VetoID.h" #include "ScintReadoutGeometry/ScintCommonItems.h" #include "VetoGeoModel/VetoStationParameters.h" -// #include "VetoGeoModel/VetoPlateParameters.h" +#include "VetoGeoModel/VetoPlateParameters.h" #include "VetoGeoModel/VetoDataBase.h" #include "VetoGeoModel/VetoGeneralParameters.h" #include "VetoGeoModel/VetoGeoModelAthenaComps.h" @@ -21,7 +21,7 @@ VetoGeometryManager::VetoGeometryManager(VetoDataBase* rdb) m_commonItems = new ScintDD::ScintCommonItems(m_athenaComps->getIdHelper()); m_stationParameters = std::make_unique<VetoStationParameters>(m_rdb); -// m_plateParameters = std::make_unique<VetoPlateParameters>(m_rdb); + m_plateParameters = std::make_unique<VetoPlateParameters>(m_rdb); m_generalParameters = std::make_unique<VetoGeneralParameters>(m_rdb); m_distortedMatManager = std::make_unique<ScintDD::DistortedMaterialManager>(); } @@ -67,11 +67,11 @@ VetoGeometryManager::stationParameters() const return m_stationParameters.get(); } -// const VetoPlateParameters * -// VetoGeometryManager::plateParameters() const -// { -// return m_plateParameters.get(); -// } +const VetoPlateParameters * +VetoGeometryManager::plateParameters() const +{ + return m_plateParameters.get(); +} const VetoGeneralParameters * VetoGeometryManager::generalParameters() const @@ -93,7 +93,7 @@ VetoGeometryManager::operator=(const VetoGeometryManager& right) { m_commonItems = right.m_commonItems; m_rdb = right.m_rdb; m_stationParameters.reset(new VetoStationParameters(m_rdb)); - // m_plateParameters.reset(new VetoPlateParameters(m_rdb)); + m_plateParameters.reset(new VetoPlateParameters(m_rdb)); m_generalParameters.reset(new VetoGeneralParameters(m_rdb)); m_distortedMatManager.reset(new ScintDD::DistortedMaterialManager()); } @@ -106,7 +106,7 @@ VetoGeometryManager::VetoGeometryManager(const VetoGeometryManager& right) { m_commonItems = right.m_commonItems; m_rdb = right.m_rdb; m_stationParameters.reset(new VetoStationParameters(m_rdb)); -// m_plateParameters.reset(new VetoPlateParameters(m_rdb)); + m_plateParameters.reset(new VetoPlateParameters(m_rdb)); m_generalParameters.reset(new VetoGeneralParameters(m_rdb)); m_distortedMatManager.reset(new ScintDD::DistortedMaterialManager()); } diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoPlate.cxx b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoPlate.cxx new file mode 100644 index 0000000000000000000000000000000000000000..96cd5edaaaac6a24f30d356379bbfb2e9649a166 --- /dev/null +++ b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoPlate.cxx @@ -0,0 +1,166 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "VetoGeoModel/VetoPlate.h" + +#include "VetoGeoModel/VetoGeometryManager.h" +#include "VetoGeoModel/VetoMaterialManager.h" + +#include "VetoGeoModel/VetoPlateParameters.h" + +#include "GeoModelKernel/GeoBox.h" +#include "GeoModelKernel/GeoLogVol.h" +#include "GeoModelKernel/GeoFullPhysVol.h" +#include "GeoModelKernel/GeoMaterial.h" + +#include "ScintReadoutGeometry/VetoDetectorManager.h" +#include "ScintReadoutGeometry/ScintDetectorDesign.h" +#include "ScintReadoutGeometry/ScintDetectorElement.h" +#include "ScintReadoutGeometry/ScintDD_Defs.h" +#include "ScintReadoutGeometry/ScintCommonItems.h" + +#include "GaudiKernel/SystemOfUnits.h" + +using namespace ScintDD; + +VetoPlate::VetoPlate(const std::string & name, + ScintDD::VetoDetectorManager* detectorManager, + const VetoGeometryManager* geometryManager, + VetoMaterialManager* materials) + : VetoUniqueComponentFactory(name, detectorManager, geometryManager, materials), + m_noElementWarning{true} +{ + getParameters(); + m_logVolume = preBuild(); +} + + +void +VetoPlate::getParameters() +{ + + const VetoPlateParameters * parameters = m_geometryManager->plateParameters(); + m_material = m_materials->getMaterial(parameters->plateMaterial()); + m_thickness = parameters->plateThickness(); + m_length = parameters->plateLength(); + m_width = parameters->plateWidth(); + +} + +const GeoLogVol * +VetoPlate::preBuild() +{ + + // Build the plate. Just a simple box. + // const GeoBox * plateShape = new GeoBox(0.5*m_thickness, 0.5*m_width, 0.5*m_length); + const GeoBox * plateShape = new GeoBox(0.5*m_width, 0.5*m_length, 0.5*m_thickness); + GeoLogVol * plateLog = new GeoLogVol(getName(), plateShape, m_material); + + // Make the scint design for this plate + makeDesign(); + + m_detectorManager->setDesign(m_design); + + return plateLog; +} + + +void +VetoPlate::makeDesign() +{ + //SiDetectorDesign::Axis etaAxis = SiDetectorDesign::zAxis; + //SiDetectorDesign::Axis phiAxis = SiDetectorDesign::yAxis; + //SiDetectorDesign::Axis depthAxis = SiDetectorDesign::xAxis; + + const VetoPlateParameters * parameters = m_geometryManager->plateParameters(); + +// double stripPitch = parameters->sensorStripPitch(); +// double stripLength = parameters->sensorStripLength(); +// int crystals = parameters->sensorNumWafers(); +// double distCenterToCenter = parameters->sensorDistCenterToCenter(); + + //int cells = parameters->sensorNumReadoutStrips(); + //int diodes = parameters->sensorNumStrips(); + //int shift = parameters->sensorStripShift(); + + // For consistency with older version we keep shift = 0. +// int cells = parameters->sensorNumReadoutStrips(); +// int diodes = cells; +// int shift = 0; + +// double totalDeadLength = distCenterToCenter - stripLength; + +// double xEtaStripPatternCenter = 0; +// double xPhiStripPatternCenter = 0; + +// // Readout direction is in same direction as local phi direction +// bool swapStripReadout = false; + +// // The readout side is at the +ve depth direction +// int readoutSide = +1; + +// m_design = new SCT_BarrelModuleSideDesign(m_thickness, +// crystals, +// diodes, +// cells, +// shift, +// swapStripReadout, +// InDetDD::holes, +// stripPitch, +// stripLength, +// xEtaStripPatternCenter, +// xPhiStripPatternCenter, +// totalDeadLength, +// readoutSide); + m_design = new ScintDetectorDesign(m_thickness, + m_length, + m_width, + parameters->platePmts()); + // + // Flags to signal if axis can be swapped. + // For rectangular detector these are all true. + // This is the default and no action is required. + // Can force axes not to be swapped by setting to false. + // + // bool phiSyGaudi::Units::mmetric = true; + // bool etaSyGaudi::Units::mmetric = true; + // bool depthSyGaudi::Units::mmetric = true; + // m_design->setSyGaudi::Units::mmetry(phiSyGaudi::Units::mmetric, etaSyGaudi::Units::mmetric, depthSyGaudi::Units::mmetric, + // +} + + + +GeoVPhysVol * +VetoPlate::build(VetoIdentifier id) +{ + GeoFullPhysVol * plate = new GeoFullPhysVol(m_logVolume); + + // Make detector element and add to collection + // Only do so if we have a valid id helper. + + //id.print(); // for debugging only + + const ScintCommonItems* commonItems = m_geometryManager->commonItems(); + + if (commonItems->getIdHelper()) { + + ScintDetectorElement * detElement; + + detElement = new ScintDetectorElement(id.getPlateId(), + m_design, + plate, + commonItems); + + // Add the detector element. + m_detectorManager->addDetectorElement(detElement); + + } else { + if (m_noElementWarning) { + std::cout << "WARNING!!!!: No Veto id helper and so no elements being produced." << std::endl; + m_noElementWarning = false; + } + } + return plate; +} diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoPlateParameters.cxx b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoPlateParameters.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d953dd75be6eb492c3ffc1791886830c1621dd6c --- /dev/null +++ b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoPlateParameters.cxx @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "VetoGeoModel/VetoPlateParameters.h" +#include "VetoGeoModel/VetoGeometryManager.h" + +#include "VetoGeoModel/VetoDataBase.h" + +#include "RDBAccessSvc/IRDBRecord.h" +#include "GaudiKernel/SystemOfUnits.h" + +#include <cmath> + + +VetoPlateParameters::VetoPlateParameters(VetoDataBase* rdb) +{ + m_rdb = rdb; +} + +// +// Plate General +// +int +VetoPlateParameters::platePmts() const +{ + return m_rdb->plateGeneral()->getInt("NUMPMTS"); +} + +double +VetoPlateParameters::plateWidth() const +{ + return m_rdb->plateGeneral()->getDouble("WIDTH") * Gaudi::Units::mm; +} + +double +VetoPlateParameters::plateLength() const +{ + return m_rdb->plateGeneral()->getDouble("LENGTH") * Gaudi::Units::mm; +} + +double +VetoPlateParameters::plateThickness() const +{ + return m_rdb->plateGeneral()->getDouble("THICKNESS") * Gaudi::Units::mm; +} + +std::string VetoPlateParameters::plateMaterial() const +{ + return m_rdb->plateGeneral()->getString("MATERIAL"); +} + diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoStation.cxx b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoStation.cxx index 7c48dcb65312150d1e33b7854b1343bd5bc450ba..9b3c274cc666e74ca01bbbfef0d535f3e33d3995 100644 --- a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoStation.cxx +++ b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoStation.cxx @@ -8,21 +8,14 @@ #include "VetoGeoModel/VetoGeometryManager.h" #include "VetoGeoModel/VetoStationParameters.h" +#include "VetoGeoModel/VetoGeneralParameters.h" #include "VetoGeoModel/VetoIdentifier.h" - -// #include "VetoGeoModel/VetoLayer.h" -// #include "VetoGeoModel/VetoModule.h" -// #include "VetoGeoModel/VetoSensor.h" -// #include "VetoGeoModel/VetoInterLink.h" -// #include "VetoGeoModel/VetoSpider.h" -// #include "VetoGeoModel/VetoPixelAttachment.h" +#include "VetoGeoModel/VetoPlate.h" #include "ScintReadoutGeometry/VetoDetectorManager.h" #include "ScintGeoModelUtils/ExtraMaterial.h" -// #include "GeoModelKernel/GeoTube.h" -// #include "GeoModelKernel/GeoTubs.h" #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoLogVol.h" #include "GeoModelKernel/GeoFullPhysVol.h" @@ -39,10 +32,12 @@ #include <iostream> VetoStation::VetoStation(const std::string & name, - ScintDD::VetoDetectorManager* detectorManager, - const VetoGeometryManager* geometryManager, - VetoMaterialManager* materials) - : VetoUniqueComponentFactory(name, detectorManager, geometryManager, materials) + VetoPlate* plate, + ScintDD::VetoDetectorManager* detectorManager, + const VetoGeometryManager* geometryManager, + VetoMaterialManager* materials) + : VetoUniqueComponentFactory(name, detectorManager, geometryManager, materials), + m_plate { plate } { getParameters(); m_logVolume = preBuild(); @@ -54,14 +49,19 @@ VetoStation::getParameters() { const VetoStationParameters * parameters = m_geometryManager->stationParameters(); - m_width = parameters->stationWidth(); - m_length = parameters->stationLength(); - m_thickness = parameters->stationThickness(); - m_numPlates = parameters->numPlates(); + m_numPlates = parameters->numPlates(); + m_platePitch = parameters->platePitch(); + + const VetoGeneralParameters* generalParameters = m_geometryManager->generalParameters(); + m_safety = generalParameters->safety(); + + m_width = m_plate->width() + m_safety; + m_length = m_plate->length() + m_safety; + // pitch includes thickness of one plate + m_thickness = (m_numPlates - 1) * m_platePitch + m_plate->thickness() + m_safety; // Set numerology m_detectorManager->numerology().setNumPlatesPerStation(m_numPlates); - } const GeoLogVol * @@ -102,6 +102,22 @@ VetoStation::build(VetoIdentifier id) // // We reduce to allow some alignment clearance // layerLength -= 2*m_zClearance; + double activeLength = m_length - m_safety/2; + double plateThickness = m_plate->thickness(); + for (int iPlate = 0; iPlate < m_numPlates; iPlate++) + { + station->add(new GeoNameTag("Plate#"+intToString(iPlate))); + station->add(new GeoIdentifierTag(iPlate)); + id.setPlate(iPlate); + GeoAlignableTransform* transform = new GeoAlignableTransform(GeoTrf::Translate3D(0.0, + 0.0, + (plateThickness - activeLength)/2 + iPlate * m_platePitch)); + station->add(transform); + GeoVPhysVol* platePV = m_plate->build(id); + station->add(platePV); + m_detectorManager->addAlignableTransform(0, id.getPlateId(), transform, platePV); + } + // for (int iLayer = 0; iLayer < m_numLayers; iLayer++) { // // Create the layers diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoStationParameters.cxx b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoStationParameters.cxx index 41b62b62f52d11ce2bc705e92b646916c8bd6717..da767000c088a4de99ca808f8eaac7a369a0ec2e 100644 --- a/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoStationParameters.cxx +++ b/Scintillator/ScintDetDescr/VetoGeoModel/src/VetoStationParameters.cxx @@ -827,23 +827,29 @@ VetoStationParameters::numPlates() const return m_rdb->stationGeneral()->getInt("NUMPLATES"); } -double -VetoStationParameters::stationWidth() const +double +VetoStationParameters::platePitch() const { - return m_rdb->stationGeneral()->getDouble("WIDTH") * Gaudi::Units::mm; + return m_rdb->stationGeneral()->getDouble("PLATEPITCH"); } -double -VetoStationParameters::stationLength() const -{ - return m_rdb->stationGeneral()->getDouble("LENGTH") * Gaudi::Units::mm; -} +// double +// VetoStationParameters::stationWidth() const +// { +// return m_rdb->stationGeneral()->getDouble("WIDTH") * Gaudi::Units::mm; +// } -double -VetoStationParameters::stationThickness() const -{ - return m_rdb->stationGeneral()->getDouble("THICKNESS") * Gaudi::Units::mm; -} +// double +// VetoStationParameters::stationLength() const +// { +// return m_rdb->stationGeneral()->getDouble("LENGTH") * Gaudi::Units::mm; +// } + +// double +// VetoStationParameters::stationThickness() const +// { +// return m_rdb->stationGeneral()->getDouble("THICKNESS") * Gaudi::Units::mm; +// } // double // SCT_BarrelParameters::cylinderLength() const