ATLAS Offline Software
Loading...
Searching...
No Matches
LArDetectorToolNV Class Referencefinal

LArDetectorToolNV is a standard GeoModel tool, which calls LArDetectorFactory::create(), stores LArDetectorManager to the Detector Store and also implements the align() function which applies misalignments on top of the 'regular' geometry. More...

#include <LArDetectorToolNV.h>

Inheritance diagram for LArDetectorToolNV:
Collaboration diagram for LArDetectorToolNV:

Public Member Functions

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

Protected Attributes

GeoVDetectorManager * m_detector {nullptr}

Private Attributes

bool m_barrelSaggingOn
int m_barrelVisLimit
int m_fcalVisLimit
bool m_buildBarrel
bool m_buildEndcap
bool m_applyAlignments
const LArDetectorManagerm_manager
std::string m_geometryConfig
std::string m_EMECVariantInner
std::string m_EMECVariantOuter
bool m_activateFT
bool m_enableMBTS
LArAlignHelper m_alignHelper

Detailed Description

LArDetectorToolNV is a standard GeoModel tool, which calls LArDetectorFactory::create(), stores LArDetectorManager to the Detector Store and also implements the align() function which applies misalignments on top of the 'regular' geometry.

Definition at line 32 of file LArDetectorToolNV.h.

Constructor & Destructor Documentation

◆ LArDetectorToolNV()

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

Definition at line 42 of file LArDetectorTool.cxx.

45 : GeoModelTool(type,name,parent)
46 , m_barrelSaggingOn(false)
48 , m_fcalVisLimit(-1)
49 , m_buildBarrel(true)
50 , m_buildEndcap(true)
51 , m_applyAlignments(false)
52 , m_manager{nullptr}
53 , m_geometryConfig("FULL")
54 , m_EMECVariantInner("Wheel")
55 , m_EMECVariantOuter("Wheel")
56 , m_activateFT(true)
57 , m_enableMBTS(true)
58{
59 declareProperty("SaggingBarrelAccordeon",m_barrelSaggingOn);
60 declareProperty("BarrelCellVisLimit", m_barrelVisLimit);
61 declareProperty("FCALVisLimit", m_fcalVisLimit);
62
63 declareProperty("BuildBarrel", m_buildBarrel);
64 declareProperty("BuildEndcap", m_buildEndcap);
65 declareProperty("ApplyAlignments", m_applyAlignments);
66 declareProperty("GeometryConfig", m_geometryConfig);
67 declareProperty("EMECVariantInner", m_EMECVariantInner);
68 declareProperty("EMECVariantOuter", m_EMECVariantOuter);
69 declareProperty("ActivateFeedThrougs", m_activateFT);
70 declareProperty("EnableMBTS", m_enableMBTS);
71}
std::string m_EMECVariantOuter
const LArDetectorManager * m_manager
std::string m_EMECVariantInner
std::string m_geometryConfig

◆ ~LArDetectorToolNV()

LArDetectorToolNV::~LArDetectorToolNV ( )
virtualdefault

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE() [1/2]

virtual StatusCode registerCallback GeoModelTool::ATLAS_NOT_THREAD_SAFE ( )
inlineoverridevirtualinherited

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

Definition at line 26 of file GeoModelTool.h.

26{return StatusCode::FAILURE;}

◆ ATLAS_NOT_THREAD_SAFE() [2/2]

virtual StatusCode align LArDetectorToolNV::ATLAS_NOT_THREAD_SAFE ( IOVSVC_CALLBACK_ARGS )
overridevirtual

Reimplemented from GeoModelTool.

◆ clear()

StatusCode LArDetectorToolNV::clear ( )
overridevirtual

Reimplemented from GeoModelTool.

Definition at line 194 of file LArDetectorTool.cxx.

195{
196 StoredPhysVol* storedPV{nullptr};
197 StatusCode status(StatusCode::SUCCESS);
198 std::vector<std::string> sgkeysFPV;
199 detStore()->keys<StoredPhysVol>(sgkeysFPV);
200 // First loop over all Full Physical volumes and initialize their global position informations
201 for (const std::string& stored : sgkeysFPV) {
202 status = detStore()->retrieve(storedPV,stored);
203 if(status.isFailure()) {
204 storedPV = nullptr;
205 continue;
206 }
207
208 if(storedPV) {
209 storedPV->getPhysVol()->getAbsoluteTransform();
210 storedPV->getPhysVol()->getDefAbsoluteTransform();
211 }
212 }
213
214 for (const std::string& stored : sgkeysFPV) {
215 status = detStore()->retrieve(storedPV,stored);
216 if(status.isFailure()) {
217 storedPV = nullptr;
218 continue;
219 }
220
221 if(storedPV) {
222 storedPV->getPhysVol()->clear();
223 }
224 }
225
226 // Release all Stored XF and Stored FPV from the detector store
227 std::vector<std::string> sgkeysAXF;
228 detStore()->keys<StoredAlignX>(sgkeysAXF);
229 for (const std::string& stored : sgkeysAXF) {
230 SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<StoredAlignX>::ID(),stored);
231 if(proxy) proxy->reset();
232 }
233
234 // Release manager from the detector store
235 SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<LArDetectorManager>::ID(),m_manager->getName());
236 if(proxy) {
237 proxy->reset();
238 m_manager = nullptr;
239 }
240
241 return StatusCode::SUCCESS;
242}
GeoFullPhysVol * getPhysVol()
Destructor.
::StatusCode StatusCode
StatusCode definition for legacy code.
status
Definition merge.py:16

◆ create()

StatusCode LArDetectorToolNV::create ( )
overridevirtual

Definition at line 76 of file LArDetectorTool.cxx.

77{
78 if(m_detector) {
79 ATH_MSG_FATAL("LAr GeoModel description has already been built. LArDetectorToolNV::create() cannot be called more than once!");
80 return StatusCode::FAILURE;
81 }
82
83 // Initialize the HV System:
84 LArHVManager* hvManager = new LArHVManager();;
85 ATH_CHECK(detStore()->record(hvManager,"LArHVManager"));
86
87 // Get the detector configuration.
88 ServiceHandle<IGeoDbTagSvc> geoDbTag("GeoDbTagSvc",name());
89 ATH_CHECK(geoDbTag.retrieve());
90
91 ServiceHandle<IRDBAccessSvc> accessSvc(geoDbTag->getParamSvcName(),name());
92 ATH_CHECK(accessSvc.retrieve());
93
94 GeoModelIO::ReadGeoModel* sqliteReader = geoDbTag->getSqliteReader();
95 std::string detectorKey{""};
96 std::string detectorNode{""};
97
98 if(!sqliteReader) {
99 // Geometry is constructed from the Geometry DB
100 std::string AtlasVersion = geoDbTag->atlasVersion();
101 std::string LArVersion = geoDbTag->LAr_VersionOverride();
102
103 detectorKey = LArVersion.empty() ? AtlasVersion : LArVersion;
104 detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
105 ATH_MSG_INFO("Keys for LAr are " << detectorKey << " " << detectorNode);
106 ATH_MSG_INFO("Building LAr version " << geoDbTag->LAr_Version()
107 << " while ATLAS version is " << AtlasVersion);
108 }
109
110 IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr("LArSwitches", detectorKey, detectorNode);
111 if ((*switchSet).size()==0) {
112 ATH_MSG_ERROR("Unable to retrieve LArSwitches from Geometry DB");
113 return StatusCode::FAILURE;
114 }
115
116 const IRDBRecord* switches = (*switchSet)[0];
117 m_barrelSaggingOn = switches->getInt("SAGGING");
118
119 if (!switches->isFieldNull("BARREL_ON")) {
120 m_buildBarrel = switches->getInt("BARREL_ON");
121 }
122
123 if (!switches->isFieldNull("ENDCAP_ON")) {
124 m_buildEndcap = switches->getInt("ENDCAP_ON");
125 }
126
127 ATH_MSG_INFO("LAr Geometry Options:" );
128 ATH_MSG_INFO(" Sagging = " << (m_barrelSaggingOn ? "true" : "false"));
129 ATH_MSG_INFO(" Barrel = " << (m_buildBarrel ? "ON" : "OFF"));
130 ATH_MSG_INFO(" Endcap = " << (m_buildEndcap ? "ON" : "OFF"));
131
132 // Locate the top level experiment node
133 GeoModelExperiment* theExpt = nullptr;
134 ATH_CHECK(detStore()->retrieve(theExpt,"ATLAS"));
135
136 // testbeam=0 Atlas
137 int testbeam = 0;
138
139 GeoIntrusivePtr<GeoPhysVol>world=theExpt->getPhysVol();
140 if(sqliteReader) {
141 // Geometry is constructed from SQLite file
142 LArGeo::LArDetectorFactoryLite theLArFactoryLite(detStore().operator->()
143 , accessSvc.operator->()
144 , sqliteReader
145 , hvManager);
146 theLArFactoryLite.setBarrelSagging(m_barrelSaggingOn);
147 theLArFactoryLite.create(world);
148 m_manager = theLArFactoryLite.getDetectorManager();
149
150 std::unique_ptr<LArGeo::VDetectorParameters> params = std::make_unique<LArGeo::RAL>();
152 }
153 else {
154 // Geometry is constructed from the Geometry DB
155
156 // testbeam=1 H8 test beam => build GeoModel in LArDetectorFactory
157 // testbeam=2 H6 test beam => don't build GeoModel in LArDetectorFactory
158 std::string LArTag = accessSvc->getChildTag("LAr",detectorKey,detectorNode);
159 if(LArTag.find("H8")!=std::string::npos) {
160 testbeam = 1 ;
161 }
162 else if(LArTag.find("H6")!=std::string::npos) {
163 testbeam = 2 ;
164 }
165
166 LArGeo::LArDetectorFactory theLArFactory(detStore().operator->()
167 , hvManager
168 , testbeam
169 , m_geometryConfig=="FULL");
170
171 theLArFactory.setBarrelSagging (m_barrelSaggingOn);
172 theLArFactory.setBarrelCellVisLimit (m_barrelVisLimit);
173 theLArFactory.setFCALVisLimit (m_fcalVisLimit);
174 theLArFactory.setBuildBarrel(m_buildBarrel);
175 theLArFactory.setBuildEndcap(m_buildEndcap);
176 theLArFactory.setEMECVariant(m_EMECVariantInner, m_EMECVariantOuter);
177 theLArFactory.setActivateFT(m_activateFT);
178 theLArFactory.setEnableMBTS(m_enableMBTS);
179
180 theLArFactory.create(world);
181 m_manager = theLArFactory.getDetectorManager();
182 if(m_geometryConfig!="RECO") {
183 // Save RDB Recordsets if we are not inside reco job
184 LArGeo::VDetectorParameters::SetInstance(theLArFactory.moveParameters());
185 }
186 }
187
188 ATH_CHECK(detStore()->record(m_manager,m_manager->getName()));
189 theExpt->addManager(m_manager);
190
191 return StatusCode::SUCCESS;
192}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
GeoVDetectorManager * m_detector
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
static void SetInstance(std::unique_ptr< VDetectorParameters >)
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ 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_activateFT

bool LArDetectorToolNV::m_activateFT
private

Definition at line 66 of file LArDetectorToolNV.h.

◆ m_alignHelper

LArAlignHelper LArDetectorToolNV::m_alignHelper
private

Definition at line 69 of file LArDetectorToolNV.h.

◆ m_applyAlignments

bool LArDetectorToolNV::m_applyAlignments
private

Definition at line 57 of file LArDetectorToolNV.h.

◆ m_barrelSaggingOn

bool LArDetectorToolNV::m_barrelSaggingOn
private

Definition at line 50 of file LArDetectorToolNV.h.

◆ m_barrelVisLimit

int LArDetectorToolNV::m_barrelVisLimit
private

Definition at line 51 of file LArDetectorToolNV.h.

◆ m_buildBarrel

bool LArDetectorToolNV::m_buildBarrel
private

Definition at line 54 of file LArDetectorToolNV.h.

◆ m_buildEndcap

bool LArDetectorToolNV::m_buildEndcap
private

Definition at line 55 of file LArDetectorToolNV.h.

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector {nullptr}
protectedinherited

Definition at line 30 of file GeoModelTool.h.

30{nullptr};

◆ m_EMECVariantInner

std::string LArDetectorToolNV::m_EMECVariantInner
private

Definition at line 63 of file LArDetectorToolNV.h.

◆ m_EMECVariantOuter

std::string LArDetectorToolNV::m_EMECVariantOuter
private

Definition at line 64 of file LArDetectorToolNV.h.

◆ m_enableMBTS

bool LArDetectorToolNV::m_enableMBTS
private

Definition at line 67 of file LArDetectorToolNV.h.

◆ m_fcalVisLimit

int LArDetectorToolNV::m_fcalVisLimit
private

Definition at line 52 of file LArDetectorToolNV.h.

◆ m_geometryConfig

std::string LArDetectorToolNV::m_geometryConfig
private

Definition at line 61 of file LArDetectorToolNV.h.

◆ m_manager

const LArDetectorManager* LArDetectorToolNV::m_manager
private

Definition at line 59 of file LArDetectorToolNV.h.


The documentation for this class was generated from the following files: