Skip to content
Snippets Groups Projects
Commit ba4b1ba1 authored by Dave Casper's avatar Dave Casper
Browse files

Merge branch 'master-plate-factory' into 'master'

Creation and placement of scintillator planes in Veto

See merge request !22
parents aae9ad1a 1f0165f7
No related branches found
No related tags found
1 merge request!22Creation and placement of scintillator planes in Veto
Pipeline #1070909 passed
Showing
with 305 additions and 127 deletions
......@@ -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);
--
......
......@@ -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 )
......@@ -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;
}
......
......@@ -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
......
......@@ -3,4 +3,3 @@
DECLARE_COMPONENT( GeoModelSvc )
DECLARE_COMPONENT( GeoDbTagSvc )
################################################################################
# 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 )
......@@ -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
......
#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;
}
#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
#include "../GeoModelTestAlg.h"
DECLARE_COMPONENT( GeoModelTestAlg )
......@@ -19,6 +19,7 @@
<class name="G4AttDef" />
</selection>
<exclusion>
<class name="CLHEP::Hep3Vector" />
<class name="FaserSensorHit">
<method name="Draw"/>
</class>
......
......@@ -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>
......
......@@ -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);
......
......@@ -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
......@@ -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.
......
......@@ -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;
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......@@ -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
//
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment