Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Protected Attributes | List of all members
ZDC_DetTool Class Referencefinal

#include <ZDC_DetTool.h>

Inheritance diagram for ZDC_DetTool:
Collaboration diagram for ZDC_DetTool:

Public Member Functions

 ZDC_DetTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~ZDC_DetTool () override final
 
virtual StatusCode create () override final
 
virtual GeoVDetectorManager * manager ()
 
virtual const GeoVDetectorManager * manager () const
 
virtual StatusCode clear () override
 
virtual StatusCode registerCallback ATLAS_NOT_THREAD_SAFE () override
 
virtual StatusCode align (IOVSVC_CALLBACK_ARGS) override
 

Protected Attributes

GeoVDetectorManager * m_detector {nullptr}
 

Detailed Description

Definition at line 10 of file ZDC_DetTool.h.

Constructor & Destructor Documentation

◆ ZDC_DetTool()

ZDC_DetTool::ZDC_DetTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 21 of file ZDC_DetTool.cxx.

23 {
24 
25  if (msgLevel(MSG::DEBUG))
26  msg(MSG::DEBUG) << "INSIDE CONSTRUCTOR OF DETTOOL" << endmsg
27  << "INSIDE CONSTRUCTOR OF DETTOOL string& type " << type << endmsg
28  << "INSIDE CONSTRUCTOR OF DETTOOL std::string& name " << name << endmsg;
29 }

◆ ~ZDC_DetTool()

ZDC_DetTool::~ZDC_DetTool ( )
finaloverridevirtual

Definition at line 31 of file ZDC_DetTool.cxx.

32 {
33  // This will need to be modified once we register the Toy DetectorNode in the Transient Detector Store
34 
35  if (nullptr != m_detector) {
36 
37  delete m_detector;
38  m_detector = nullptr;
39  }
40 }

Member Function Documentation

◆ align()

virtual StatusCode GeoModelTool::align ( IOVSVC_CALLBACK_ARGS  )
inlineoverridevirtualinherited

Reimplemented in ALFA_DetectorTool, HGTD_DetectorTool, TRT_DetectorTool, LArDetectorToolNV, PixelDetectorTool, and SCT_DetectorTool.

Definition at line 27 of file GeoModelTool.h.

27 {return StatusCode::SUCCESS;}

◆ ATLAS_NOT_THREAD_SAFE()

virtual StatusCode registerCallback GeoModelTool::ATLAS_NOT_THREAD_SAFE ( )
inlineoverridevirtualinherited

Reimplemented in HGTD_DetectorTool, TRT_DetectorTool, PLRDetectorTool, BCMPrimeDetectorTool, and HGTD_GMX_DetectorTool.

Definition at line 26 of file GeoModelTool.h.

26 {return StatusCode::FAILURE;}

◆ clear()

virtual StatusCode GeoModelTool::clear ( )
inlineoverridevirtualinherited

◆ create()

StatusCode ZDC_DetTool::create ( )
finaloverridevirtual

Definition at line 42 of file ZDC_DetTool.cxx.

43 {
44  if (msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << " Building ZDC geometry " << endmsg;
45 
46  // Locate the top level experiment node
47  GeoModelExperiment* theExpt = nullptr;
48  if (StatusCode::SUCCESS != detStore()->retrieve(theExpt, "ATLAS")) {
49  if (msgLevel(MSG::ERROR)) msg(MSG::ERROR) << " Could not find GeoModelExperiment ATLAS " << endmsg;
50  return (StatusCode::FAILURE);
51  }
52 
53  // Create the ZDC Detector Factory
54  ZDC_DetFactory theZDCFactory(detStore().operator->());
55 
56  //Retrieve the ZDC geometry from the database
57 
58  const IZdcGeometryDB *theZdcGeoDB = ZdcGeoDBGeometryDB::getInstance();
59  const nlohmann::json& zdcGeo = theZdcGeoDB->getDB();
60 
61  /*************************************************
62  * Get the TAN/TAXN slots and hold onto the transform
63  **************************************************/
64  std::array<GeoTrf::Transform3D, 2> tanTrf;
65  for (auto slot : zdcGeo["TAN/TAXN"].items()) {
66  // Retrieve all of the values from the json file
67  int side = slot.value()["side"].get<int>();
68  int iside = side == -1 ? 0 : 1;
69  double x = slot.value()["x"].get<double>();
70  double y = slot.value()["y"].get<double>();
71  double z = slot.value()["z"].get<double>();
72  double height = slot.value()["height"].get<double>();
73  double width = slot.value()["width"].get<double>();
74  double depth = slot.value()["depth"].get<double>();
75  std::string name = slot.value()["name"].get<std::string>();
76  tanTrf.at(iside) = GeoTrf::Translate3D(x * Gaudi::Units::mm, y * Gaudi::Units::mm, z * Gaudi::Units::mm);
77 
78  // Add the TAN/TAXN slot to the factory
79  theZDCFactory.setTANSlot(iside, width, height, depth, tanTrf.at(iside), name);
80  }
81 
82  /*************************************************
83  * Add the ZDC/RPD/BRAN modules to the factory
84  **************************************************/
85  for (auto det : zdcGeo["Detector"].items()) {
86  std::unique_ptr<ZDC_ModuleBase> pDet;
87 
88  std::string name = det.value()["name"].get<std::string>();
89  int side = det.value()["side"].get<int>();
90  int iside = side == -1 ? 0 : 1;
91  int module = det.value()["module"].get<int>();
92  double x = det.value()["x"].get<double>();
93  double y = det.value()["y"].get<double>();
94  double z = det.value()["z"].get<double>();
95  double q = det.value()["q"].get<double>();
96  double i = det.value()["i"].get<double>();
97  double j = det.value()["j"].get<double>();
98  double k = det.value()["k"].get<double>();
99 
100  if (std::string(det.key()).find("ZDC") != std::string::npos) {
101  pDet = std::make_unique<ZDC_ZDCModule>( name, side, module, det.value()["type"].get<int>() );
102 
103  }else if (std::string(det.key()).find("RPD") != std::string::npos) {
104  pDet = std::make_unique<ZDC_RPDModule>( name, side, module );
105 
106  }else if (std::string(det.key()).find("BRAN") != std::string::npos) {
107  pDet = std::make_unique<ZDC_BRANModule>( name, side, module );
108 
109  }else {
110  if (msgLevel(MSG::ERROR)) msg(MSG::ERROR) << "Unknown detector type " << det.key() << endmsg;
111  return StatusCode::FAILURE;
112  }
113 
114  // Set the transform and subtract the TAN translation for this side since that's the mother volume of the detector
115  pDet->setTransform(GeoTrf::Translate3D(x - tanTrf.at(iside).translation().x(), y - tanTrf.at(iside).translation().y(), z - tanTrf.at(iside).translation().z()) * GeoTrf::Rotation3D(q, i, j, k) );
116 
117  // Add the module to the factory
118  theZDCFactory.addModule(std::move(pDet));
119  }
120 
121  if (nullptr == m_detector) { // Create the ZDCDetectorNode instance
122 
123  try {
124  // This strange way of casting is to avoid an utterly brain damaged compiler warning.
125  GeoPhysVol* world = &*theExpt->getPhysVol();
126  theZDCFactory.create(world);
127  }
128  catch (const std::bad_alloc&) {
129 
130  if (msgLevel(MSG::FATAL)) msg(MSG::FATAL) << "Could not create new ZDC DetectorNode!" << endmsg;
131  return StatusCode::FAILURE;
132  }
133 
134  // Register the ZDC DetectorNode instance with the Transient Detector Store
135  theExpt->addManager(theZDCFactory.getDetectorManager());
136  if(detStore()->record(theZDCFactory.getDetectorManager(),theZDCFactory.getDetectorManager()->getName())==StatusCode::SUCCESS){
137  return StatusCode::SUCCESS;}
138  else{
139  msg(MSG::FATAL) << "Could not register ZDC detector manager" << endmsg;}
140 
141  }
142 
143  return StatusCode::FAILURE;
144 }

◆ manager() [1/2]

virtual GeoVDetectorManager* GeoModelTool::manager ( )
inlinevirtualinherited

Definition at line 22 of file GeoModelTool.h.

22 {return m_detector;}

◆ manager() [2/2]

virtual const GeoVDetectorManager* GeoModelTool::manager ( ) const
inlinevirtualinherited

Definition at line 23 of file GeoModelTool.h.

23 {return m_detector;}

Member Data Documentation

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector {nullptr}
protectedinherited

Definition at line 30 of file GeoModelTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition: GeoModelExperiment.cxx:21
egammaParameters::depth
@ depth
pointing depth of the shower as calculated in egammaqgcld
Definition: egammaParamDefs.h:276
Amg::Rotation3D
Eigen::Quaternion< double > Rotation3D
Definition: GeoPrimitives.h:43
ZdcGeoDBGeometryDB::getInstance
static const IZdcGeometryDB * getInstance()
Definition: ZdcGeometryDB.cxx:24
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:18
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
json
nlohmann::json json
Definition: HistogramDef.cxx:9
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
GeoModelExperiment
Definition: GeoModelExperiment.h:32
x
#define x
ZDC_ModuleBase::setTransform
void setTransform(const GeoTrf::Transform3D trf)
Definition: ZDC_ModuleBase.h:38
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
IZdcGeometryDB
Definition: ZdcGeometryDB.h:12
TRT::Hit::side
@ side
Definition: HitInfo.h:83
python.PyAthena.module
module
Definition: PyAthena.py:131
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
test_pyathena.parent
parent
Definition: test_pyathena.py:15
GeoModelTool
Definition: GeoModelTool.h:16
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
GeoModelTool::m_detector
GeoVDetectorManager * m_detector
Definition: GeoModelTool.h:30
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:71
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition: GeoModelExperiment.cxx:40
y
#define y
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
ZDC_DetFactory
Definition: ZDC_DetFactory.h:26
DEBUG
#define DEBUG
Definition: page_access.h:11
extractSporadic.q
list q
Definition: extractSporadic.py:98
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
fitman.k
k
Definition: fitman.py:528