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 () override
virtual GeoVDetectorManager * manager ()
virtual const GeoVDetectorManager * manager () const

Protected Attributes

GeoVDetectorManager * m_detector {nullptr}

Private Attributes

Gaudi::Property< bool > m_barrelSaggingOn {this,"SaggingBarrelAccordeon",false}
Gaudi::Property< int > m_barrelVisLimit {this,"BarrelCellVisLimit",-1}
Gaudi::Property< int > m_fcalVisLimit {this,"FCALVisLimit",-1}
Gaudi::Property< bool > m_buildBarrel {this,"BuildBarrel",true}
Gaudi::Property< bool > m_buildEndcap {this,"BuildEndcap",true}
Gaudi::Property< bool > m_applyAlignments {this,"ApplyAlignments",false}
const LArDetectorManagerm_manager {}
Gaudi::Property< std::string > m_geometryConfig {this,"GeometryConfig","FULL"}
Gaudi::Property< std::string > m_EMECVariantInner {this,"EMECVariantInner","Wheel"}
Gaudi::Property< std::string > m_EMECVariantOuter {this,"EMECVariantOuter","Wheel"}
Gaudi::Property< bool > m_activateFT {this,"ActivateFeedThrougs",true}
Gaudi::Property< bool > m_enableMBTS {this,"EnableMBTS",true}
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 29 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{
47}

◆ ~LArDetectorToolNV()

LArDetectorToolNV::~LArDetectorToolNV ( )
virtualdefault

Member Function Documentation

◆ align()

StatusCode LArDetectorToolNV::align ( )
overridevirtual

Reimplemented from GeoModelTool.

Definition at line 220 of file LArDetectorTool.cxx.

221{
222 if(!m_applyAlignments) {
223 ATH_MSG_DEBUG("LAr alignments switched OFF");
224 return StatusCode::SUCCESS;
225 }
226
227 if(!m_manager) {
228 ATH_MSG_ERROR(" LArDetDescrManager not created yet, cannot align !");
229 return StatusCode::FAILURE;
230 }
231
233 const DetCondKeyTrans* align{nullptr};
235 ATH_MSG_DEBUG(" LAr DetCondKeyTrans retrieved ");
236 if(m_alignHelper.applyAlignments(detStore(),align,nullptr).isFailure()) {
237 ATH_MSG_ERROR("Failed to apply LAr alignments to GeoModel");
238 return StatusCode::FAILURE;
239 }
240 ATH_MSG_DEBUG("LAr Alignments applied successfully");
241 }
242 else {
243 ATH_MSG_DEBUG(" No LAr DetCondKeyTrans in SG, skipping align() ");
244 }
245
246 return StatusCode::SUCCESS;
247}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
#define LAR_ALIGN
virtual StatusCode align() override
const LArDetectorManager * m_manager
Gaudi::Property< bool > m_applyAlignments
LArAlignHelper m_alignHelper
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ clear()

StatusCode LArDetectorToolNV::clear ( )
overridevirtual

Reimplemented from GeoModelTool.

Definition at line 170 of file LArDetectorTool.cxx.

171{
172 StoredPhysVol* storedPV{nullptr};
173 StatusCode status(StatusCode::SUCCESS);
174 std::vector<std::string> sgkeysFPV;
175 detStore()->keys<StoredPhysVol>(sgkeysFPV);
176 // First loop over all Full Physical volumes and initialize their global position informations
177 for (const std::string& stored : sgkeysFPV) {
178 status = detStore()->retrieve(storedPV,stored);
179 if(status.isFailure()) {
180 storedPV = nullptr;
181 continue;
182 }
183
184 if(storedPV) {
185 storedPV->getPhysVol()->getAbsoluteTransform();
186 storedPV->getPhysVol()->getDefAbsoluteTransform();
187 }
188 }
189
190 for (const std::string& stored : sgkeysFPV) {
191 status = detStore()->retrieve(storedPV,stored);
192 if(status.isFailure()) {
193 storedPV = nullptr;
194 continue;
195 }
196
197 if(storedPV) {
198 storedPV->getPhysVol()->clear();
199 }
200 }
201
202 // Release all Stored XF and Stored FPV from the detector store
203 std::vector<std::string> sgkeysAXF;
204 detStore()->keys<StoredAlignX>(sgkeysAXF);
205 for (const std::string& stored : sgkeysAXF) {
206 SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<StoredAlignX>::ID(),stored);
207 if(proxy) proxy->reset();
208 }
209
210 // Release manager from the detector store
211 SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<LArDetectorManager>::ID(),m_manager->getName());
212 if(proxy) {
213 proxy->reset();
214 m_manager = nullptr;
215 }
216
217 return StatusCode::SUCCESS;
218}
GeoFullPhysVol * getPhysVol()
Destructor.
::StatusCode StatusCode
StatusCode definition for legacy code.
status
Definition merge.py:16

◆ create()

StatusCode LArDetectorToolNV::create ( )
overridevirtual

Definition at line 52 of file LArDetectorTool.cxx.

53{
54 if(m_detector) {
55 ATH_MSG_FATAL("LAr GeoModel description has already been built. LArDetectorToolNV::create() cannot be called more than once!");
56 return StatusCode::FAILURE;
57 }
58
59 // Initialize the HV System:
60 LArHVManager* hvManager = new LArHVManager();;
61 ATH_CHECK(detStore()->record(hvManager,"LArHVManager"));
62
63 // Get the detector configuration.
64 ServiceHandle<IGeoDbTagSvc> geoDbTag("GeoDbTagSvc",name());
65 ATH_CHECK(geoDbTag.retrieve());
66
67 ServiceHandle<IRDBAccessSvc> accessSvc(geoDbTag->getParamSvcName(),name());
68 ATH_CHECK(accessSvc.retrieve());
69
70 GeoModelIO::ReadGeoModel* sqliteReader = geoDbTag->getSqliteReader();
71 std::string detectorKey{""};
72 std::string detectorNode{""};
73
74 if(!sqliteReader) {
75 // Geometry is constructed from the Geometry DB
76 std::string AtlasVersion = geoDbTag->atlasVersion();
77 std::string LArVersion = geoDbTag->LAr_VersionOverride();
78
79 detectorKey = LArVersion.empty() ? AtlasVersion : LArVersion;
80 detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
81 ATH_MSG_INFO("Keys for LAr are " << detectorKey << " " << detectorNode);
82 ATH_MSG_INFO("Building LAr version " << geoDbTag->LAr_Version()
83 << " while ATLAS version is " << AtlasVersion);
84 }
85
86 IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr("LArSwitches", detectorKey, detectorNode);
87 if ((*switchSet).size()==0) {
88 ATH_MSG_ERROR("Unable to retrieve LArSwitches from Geometry DB");
89 return StatusCode::FAILURE;
90 }
91
92 const IRDBRecord* switches = (*switchSet)[0];
93 m_barrelSaggingOn = switches->getInt("SAGGING");
94
95 if (!switches->isFieldNull("BARREL_ON")) {
96 m_buildBarrel = switches->getInt("BARREL_ON");
97 }
98
99 if (!switches->isFieldNull("ENDCAP_ON")) {
100 m_buildEndcap = switches->getInt("ENDCAP_ON");
101 }
102
103 ATH_MSG_INFO("LAr Geometry Options:" );
104 ATH_MSG_INFO(" Sagging = " << (m_barrelSaggingOn ? "true" : "false"));
105 ATH_MSG_INFO(" Barrel = " << (m_buildBarrel ? "ON" : "OFF"));
106 ATH_MSG_INFO(" Endcap = " << (m_buildEndcap ? "ON" : "OFF"));
107
108 // Locate the top level experiment node
109 GeoModelExperiment* theExpt = nullptr;
110 ATH_CHECK(detStore()->retrieve(theExpt,"ATLAS"));
111
112 // testbeam=0 Atlas
113 int testbeam = 0;
114
115 GeoIntrusivePtr<GeoPhysVol>world=theExpt->getPhysVol();
116 if(sqliteReader) {
117 // Geometry is constructed from SQLite file
118 LArGeo::LArDetectorFactoryLite theLArFactoryLite(detStore().operator->()
119 , accessSvc.operator->()
120 , sqliteReader
121 , hvManager);
122 theLArFactoryLite.setBarrelSagging(m_barrelSaggingOn);
123 theLArFactoryLite.create(world);
124 m_manager = theLArFactoryLite.getDetectorManager();
125
126 std::unique_ptr<LArGeo::VDetectorParameters> params = std::make_unique<LArGeo::RAL>();
128 }
129 else {
130 // Geometry is constructed from the Geometry DB
131
132 // testbeam=1 H8 test beam => build GeoModel in LArDetectorFactory
133 // testbeam=2 H6 test beam => don't build GeoModel in LArDetectorFactory
134 std::string LArTag = accessSvc->getChildTag("LAr",detectorKey,detectorNode);
135 if(LArTag.find("H8")!=std::string::npos) {
136 testbeam = 1 ;
137 }
138 else if(LArTag.find("H6")!=std::string::npos) {
139 testbeam = 2 ;
140 }
141
142 LArGeo::LArDetectorFactory theLArFactory(detStore().operator->()
143 , hvManager
144 , testbeam
145 , m_geometryConfig=="FULL");
146
147 theLArFactory.setBarrelSagging (m_barrelSaggingOn);
148 theLArFactory.setBarrelCellVisLimit (m_barrelVisLimit);
149 theLArFactory.setFCALVisLimit (m_fcalVisLimit);
150 theLArFactory.setBuildBarrel(m_buildBarrel);
151 theLArFactory.setBuildEndcap(m_buildEndcap);
152 theLArFactory.setEMECVariant(m_EMECVariantInner, m_EMECVariantOuter);
153 theLArFactory.setActivateFT(m_activateFT);
154 theLArFactory.setEnableMBTS(m_enableMBTS);
155
156 theLArFactory.create(world);
157 m_manager = theLArFactory.getDetectorManager();
158 if(m_geometryConfig!="RECO") {
159 // Save RDB Recordsets if we are not inside reco job
160 LArGeo::VDetectorParameters::SetInstance(theLArFactory.moveParameters());
161 }
162 }
163
164 ATH_CHECK(detStore()->record(m_manager,m_manager->getName()));
165 theExpt->addManager(m_manager);
166
167 return StatusCode::SUCCESS;
168}
#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.
Gaudi::Property< std::string > m_geometryConfig
Gaudi::Property< bool > m_buildEndcap
Gaudi::Property< std::string > m_EMECVariantInner
Gaudi::Property< int > m_barrelVisLimit
Gaudi::Property< std::string > m_EMECVariantOuter
Gaudi::Property< bool > m_barrelSaggingOn
Gaudi::Property< bool > m_enableMBTS
Gaudi::Property< bool > m_activateFT
Gaudi::Property< bool > m_buildBarrel
Gaudi::Property< int > m_fcalVisLimit
static void SetInstance(std::unique_ptr< VDetectorParameters >)

◆ manager() [1/2]

virtual GeoVDetectorManager * GeoModelTool::manager ( )
inlinevirtualinherited

Definition at line 21 of file GeoModelTool.h.

21{return m_detector;}

◆ manager() [2/2]

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

Definition at line 22 of file GeoModelTool.h.

22{return m_detector;}

Member Data Documentation

◆ m_activateFT

Gaudi::Property<bool> LArDetectorToolNV::m_activateFT {this,"ActivateFeedThrougs",true}
private

Definition at line 64 of file LArDetectorToolNV.h.

64{this,"ActivateFeedThrougs",true};

◆ m_alignHelper

LArAlignHelper LArDetectorToolNV::m_alignHelper
private

Definition at line 67 of file LArDetectorToolNV.h.

◆ m_applyAlignments

Gaudi::Property<bool> LArDetectorToolNV::m_applyAlignments {this,"ApplyAlignments",false}
private

Definition at line 55 of file LArDetectorToolNV.h.

55{this,"ApplyAlignments",false};

◆ m_barrelSaggingOn

Gaudi::Property<bool> LArDetectorToolNV::m_barrelSaggingOn {this,"SaggingBarrelAccordeon",false}
private

Definition at line 48 of file LArDetectorToolNV.h.

48{this,"SaggingBarrelAccordeon",false};

◆ m_barrelVisLimit

Gaudi::Property<int> LArDetectorToolNV::m_barrelVisLimit {this,"BarrelCellVisLimit",-1}
private

Definition at line 49 of file LArDetectorToolNV.h.

49{this,"BarrelCellVisLimit",-1};

◆ m_buildBarrel

Gaudi::Property<bool> LArDetectorToolNV::m_buildBarrel {this,"BuildBarrel",true}
private

Definition at line 52 of file LArDetectorToolNV.h.

52{this,"BuildBarrel",true};

◆ m_buildEndcap

Gaudi::Property<bool> LArDetectorToolNV::m_buildEndcap {this,"BuildEndcap",true}
private

Definition at line 53 of file LArDetectorToolNV.h.

53{this,"BuildEndcap",true};

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector {nullptr}
protectedinherited

Definition at line 28 of file GeoModelTool.h.

28{nullptr};

◆ m_EMECVariantInner

Gaudi::Property<std::string> LArDetectorToolNV::m_EMECVariantInner {this,"EMECVariantInner","Wheel"}
private

Definition at line 61 of file LArDetectorToolNV.h.

61{this,"EMECVariantInner","Wheel"};

◆ m_EMECVariantOuter

Gaudi::Property<std::string> LArDetectorToolNV::m_EMECVariantOuter {this,"EMECVariantOuter","Wheel"}
private

Definition at line 62 of file LArDetectorToolNV.h.

62{this,"EMECVariantOuter","Wheel"};

◆ m_enableMBTS

Gaudi::Property<bool> LArDetectorToolNV::m_enableMBTS {this,"EnableMBTS",true}
private

Definition at line 65 of file LArDetectorToolNV.h.

65{this,"EnableMBTS",true};

◆ m_fcalVisLimit

Gaudi::Property<int> LArDetectorToolNV::m_fcalVisLimit {this,"FCALVisLimit",-1}
private

Definition at line 50 of file LArDetectorToolNV.h.

50{this,"FCALVisLimit",-1};

◆ m_geometryConfig

Gaudi::Property<std::string> LArDetectorToolNV::m_geometryConfig {this,"GeometryConfig","FULL"}
private

Definition at line 59 of file LArDetectorToolNV.h.

59{this,"GeometryConfig","FULL"}; // FULL, SIMU, RECO

◆ m_manager

const LArDetectorManager* LArDetectorToolNV::m_manager {}
private

Definition at line 57 of file LArDetectorToolNV.h.

57{};

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