ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Attributes | List of all members
LArDetectorToolNV Class Referencefinal

LArDetectorToolNV is a standard GeoModel tool, which calls LArDetectorFactory::create(), stores LArDetectorManager to the Detector Store and also registers a callback function align() 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 registerCallback ATLAS_NOT_THREAD_SAFE () override
 
virtual StatusCode align (IOVSVC_CALLBACK_ARGS) override
 
virtual GeoVDetectorManager * manager ()
 The Detector Node corresponding to this tool. More...
 
virtual const GeoVDetectorManager * manager () const
 

Protected Attributes

GeoVDetectorManager * m_detector
 

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 registers a callback function align() 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.

46  , m_barrelSaggingOn(false)
47  , m_barrelVisLimit(-1)
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 }

◆ ~LArDetectorToolNV()

LArDetectorToolNV::~LArDetectorToolNV ( )
virtualdefault

Member Function Documentation

◆ align()

StatusCode LArDetectorToolNV::align ( IOVSVC_CALLBACK_ARGS  )
overridevirtual

Reimplemented from GeoModelTool.

Definition at line 260 of file LArDetectorTool.cxx.

261 {
262  if(!m_applyAlignments) {
263  ATH_MSG_DEBUG("LAr alignments switched OFF");
264  return StatusCode::SUCCESS;
265  }
266 
267  if(m_manager==nullptr) {
268  ATH_MSG_ERROR(" LArDetDescrManager not created yet, cannot align !");
269  return StatusCode::FAILURE;
270  }
271 
272  if(detStore()->contains<DetCondKeyTrans>(LAR_ALIGN)) {
273  const DetCondKeyTrans* align{nullptr};
274  StatusCode sc = detStore()->retrieve(align, LAR_ALIGN);
275 
276  if(sc.isFailure()) {
277  ATH_MSG_ERROR(" Could not retrieve LAr DetCondKeyTrans ");
278  return sc;
279  }
280 
281  if(align==nullptr) {
282  ATH_MSG_ERROR("LAr DetCondKeyTrans ptr is null");
283  return StatusCode::FAILURE;
284  }
285 
286  ATH_MSG_DEBUG(" LAr DetCondKeyTrans retrieved ");
287  if(m_alignHelper.applyAlignments(detStore(),align,nullptr).isFailure()) {
288  ATH_MSG_ERROR("Failed to apply LAr alignments to GeoModel");
289  return StatusCode::FAILURE;
290  }
291  ATH_MSG_DEBUG("LAr Alignments applied successfully");
292  }
293  else {
294  ATH_MSG_DEBUG(" No LAr DetCondKeyTrans in SG, skipping align() ");
295  }
296 
297  return StatusCode::SUCCESS;
298 }

◆ ATLAS_NOT_THREAD_SAFE()

virtual StatusCode registerCallback LArDetectorToolNV::ATLAS_NOT_THREAD_SAFE ( )
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) {
231  if(proxy) proxy->reset();
232  }
233 
234  // Release manager from the detector store
236  if(proxy) {
237  proxy->reset();
238  m_manager = nullptr;
239  }
240 
241  return StatusCode::SUCCESS;
242 }

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

◆ manager() [1/2]

GeoVDetectorManager * GeoModelTool::manager ( )
virtualinherited

The Detector Node corresponding to this tool.

Definition at line 21 of file GeoModelTool.cxx.

21  {
22  return m_detector;
23 }

◆ manager() [2/2]

const GeoVDetectorManager * GeoModelTool::manager ( ) const
virtualinherited

Definition at line 24 of file GeoModelTool.cxx.

24  {
25  return m_detector;
26 }

Member Data Documentation

◆ m_activateFT

bool LArDetectorToolNV::m_activateFT
private

Definition at line 69 of file LArDetectorToolNV.h.

◆ m_alignHelper

LArAlignHelper LArDetectorToolNV::m_alignHelper
private

Definition at line 72 of file LArDetectorToolNV.h.

◆ m_applyAlignments

bool LArDetectorToolNV::m_applyAlignments
private

Definition at line 60 of file LArDetectorToolNV.h.

◆ m_barrelSaggingOn

bool LArDetectorToolNV::m_barrelSaggingOn
private

Definition at line 53 of file LArDetectorToolNV.h.

◆ m_barrelVisLimit

int LArDetectorToolNV::m_barrelVisLimit
private

Definition at line 54 of file LArDetectorToolNV.h.

◆ m_buildBarrel

bool LArDetectorToolNV::m_buildBarrel
private

Definition at line 57 of file LArDetectorToolNV.h.

◆ m_buildEndcap

bool LArDetectorToolNV::m_buildEndcap
private

Definition at line 58 of file LArDetectorToolNV.h.

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector
protectedinherited

Definition at line 36 of file GeoModelTool.h.

◆ m_EMECVariantInner

std::string LArDetectorToolNV::m_EMECVariantInner
private

Definition at line 66 of file LArDetectorToolNV.h.

◆ m_EMECVariantOuter

std::string LArDetectorToolNV::m_EMECVariantOuter
private

Definition at line 67 of file LArDetectorToolNV.h.

◆ m_enableMBTS

bool LArDetectorToolNV::m_enableMBTS
private

Definition at line 70 of file LArDetectorToolNV.h.

◆ m_fcalVisLimit

int LArDetectorToolNV::m_fcalVisLimit
private

Definition at line 55 of file LArDetectorToolNV.h.

◆ m_geometryConfig

std::string LArDetectorToolNV::m_geometryConfig
private

Definition at line 64 of file LArDetectorToolNV.h.

◆ m_manager

const LArDetectorManager* LArDetectorToolNV::m_manager
private

Definition at line 62 of file LArDetectorToolNV.h.


The documentation for this class was generated from the following files:
IRDBRecord::getInt
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition: GeoModelExperiment.cxx:21
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
LArGeo::VDetectorParameters::SetInstance
static void SetInstance(std::unique_ptr< VDetectorParameters >)
Definition: VDetectorParameters.cxx:24
DetCondKeyTrans
Class to hold set of HepGeom::Transform3D keyed by string value for storage in the conditions DB typi...
Definition: DetCondKeyTrans.h:27
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArDetectorToolNV::m_geometryConfig
std::string m_geometryConfig
Definition: LArDetectorToolNV.h:64
LArDetectorToolNV::m_alignHelper
LArAlignHelper m_alignHelper
Definition: LArDetectorToolNV.h:72
StoredAlignX
Definition: StoredAlignX.h:23
GeoModelExperiment
Definition: GeoModelExperiment.h:32
LArDetectorToolNV::m_activateFT
bool m_activateFT
Definition: LArDetectorToolNV.h:69
GeoModelTool::GeoModelTool
GeoModelTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor(s)
Definition: GeoModelTool.cxx:12
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
StoredPhysVol
Definition: StoredPhysVol.h:27
LArDetectorToolNV::m_fcalVisLimit
int m_fcalVisLimit
Definition: LArDetectorToolNV.h:55
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArDetectorToolNV::m_buildBarrel
bool m_buildBarrel
Definition: LArDetectorToolNV.h:57
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
LArGeo::LArDetectorFactoryLite
LArDetectorFactoryLite is invoked by the LArDetectorTool when the GeoModel description of LAr calorim...
Definition: LArDetectorFactoryLite.h:33
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
GeoModelTool::m_detector
GeoVDetectorManager * m_detector
Definition: GeoModelTool.h:36
LArAlignHelper::applyAlignments
StatusCode applyAlignments(const ServiceHandle< StoreGateSvc > &detStore, const DetCondKeyTrans *detCondKeyTrans, GeoAlignmentStore *alignmentStore) const
Definition: LArAlignHelper.cxx:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
LArDetectorToolNV::m_enableMBTS
bool m_enableMBTS
Definition: LArDetectorToolNV.h:70
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition: GeoModelExperiment.cxx:40
LArHVManager
This class provides access to the High Voltage throughout the LAr. High voltage conditions can also b...
Definition: LArHVManager.h:24
LArDetectorToolNV::m_EMECVariantOuter
std::string m_EMECVariantOuter
Definition: LArDetectorToolNV.h:67
IRDBRecord::isFieldNull
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArDetectorToolNV::m_manager
const LArDetectorManager * m_manager
Definition: LArDetectorToolNV.h:62
LArDetectorToolNV::m_barrelVisLimit
int m_barrelVisLimit
Definition: LArDetectorToolNV.h:54
LArDetectorToolNV::align
virtual StatusCode align(IOVSVC_CALLBACK_ARGS) override
Definition: LArDetectorTool.cxx:260
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
LAR_ALIGN
#define LAR_ALIGN
Definition: LArDetectorTool.cxx:39
merge.status
status
Definition: merge.py:17
LArGeo::LArDetectorFactory::setBarrelSagging
void setBarrelSagging(bool flag)
Definition: LArDetectorFactory.h:52
LArDetectorToolNV::m_applyAlignments
bool m_applyAlignments
Definition: LArDetectorToolNV.h:60
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
LArDetectorToolNV::m_buildEndcap
bool m_buildEndcap
Definition: LArDetectorToolNV.h:58
SG::DataProxy
Definition: DataProxy.h:44
LArDetectorToolNV::m_EMECVariantInner
std::string m_EMECVariantInner
Definition: LArDetectorToolNV.h:66
LArGeo::LArDetectorFactory
LArDetectorFactory builds GeoModel description of LAr calorimeter by calling relevant 'Construction' ...
Definition: LArDetectorFactory.h:28
LArGeo::LArDetectorFactoryLite::setBarrelSagging
void setBarrelSagging(bool flag)
Definition: LArDetectorFactoryLite.h:53
ServiceHandle< IGeoDbTagSvc >
LArDetectorToolNV::m_barrelSaggingOn
bool m_barrelSaggingOn
Definition: LArDetectorToolNV.h:53