ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
SiPropertiesTool
src
SCTSiPropertiesCondAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
SCTSiPropertiesCondAlg.h
"
6
7
#include "
Identifier/IdentifierHash.h
"
8
#include "
InDetIdentifier/SCT_ID.h
"
9
#include "
InDetReadoutGeometry/SiDetectorElement.h
"
10
11
#include <cmath>
12
#include <memory>
13
14
SCTSiPropertiesCondAlg::SCTSiPropertiesCondAlg
(
const
std::string& name, ISvcLocator* pSvcLocator)
15
: ::
AthCondAlgorithm
(name, pSvcLocator)
16
,
m_pHelper
{nullptr}
17
{
18
}
19
20
StatusCode
SCTSiPropertiesCondAlg::initialize
() {
21
ATH_MSG_DEBUG
(
"initialize "
<< name());
22
23
// SCT silicon conditions tool
24
ATH_CHECK
(
m_siCondTool
.retrieve());
25
26
// SCT ID helper
27
ATH_CHECK
(
detStore
()->retrieve(
m_pHelper
,
"SCT_ID"
));
28
29
// Read Cond Handles
30
ATH_CHECK
(
m_readKeyTemp
.initialize(!
m_forceGeoModel
));
31
ATH_CHECK
(
m_readKeyHV
.initialize(!
m_forceGeoModel
));
32
ATH_CHECK
(
m_SCTDetEleCollKey
.initialize());
33
if
(
m_forceGeoModel
){
34
ATH_MSG_INFO
(
"Configured to use GeoModel values of HV and Temp, not conditions"
);
35
}
36
// Write Cond Handle
37
ATH_CHECK
(
m_writeKey
.initialize());
38
39
return
StatusCode::SUCCESS;
40
}
41
42
StatusCode
SCTSiPropertiesCondAlg::execute
(
const
EventContext& ctx)
const
{
43
ATH_MSG_DEBUG
(
"execute "
<< name());
44
45
// Write Cond Handle
46
SG::WriteCondHandle<InDet::SiliconPropertiesVector>
writeHandle{
m_writeKey
, ctx};
47
// Do we have a valid Write Cond Handle for current time?
48
if
(writeHandle.
isValid
()) {
49
ATH_MSG_DEBUG
(
"CondHandle "
<< writeHandle.
fullKey
() <<
" is already valid."
50
<<
" In theory this should not be called, but may happen"
51
<<
" if multiple concurrent events are being processed out of order."
);
52
return
StatusCode::SUCCESS;
53
}
54
55
if
(!
m_forceGeoModel
){
56
// Read Cond Handle (temperature)
57
SG::ReadCondHandle<SCT_DCSFloatCondData>
readHandleTemp{
m_readKeyTemp
, ctx};
58
const
SCT_DCSFloatCondData
* readCdoTemp{*readHandleTemp};
59
if
(readCdoTemp==
nullptr
) {
60
ATH_MSG_FATAL
(
"Null pointer to the read conditions object"
);
61
return
StatusCode::FAILURE;
62
}
63
writeHandle.
addDependency
(readHandleTemp);
64
ATH_MSG_INFO
(
"Input is "
<< readHandleTemp.
fullKey
() <<
" with the range of "
<< readHandleTemp.
getRange
());
65
66
// Read Cond Handle (HV)
67
SG::ReadCondHandle<SCT_DCSFloatCondData>
readHandleHV{
m_readKeyHV
, ctx};
68
const
SCT_DCSFloatCondData
* readCdoHV{*readHandleHV};
69
if
(readCdoHV==
nullptr
) {
70
ATH_MSG_FATAL
(
"Null pointer to the read conditions object"
);
71
return
StatusCode::FAILURE;
72
}
73
writeHandle.
addDependency
(readHandleHV);
74
ATH_MSG_INFO
(
"Input is "
<< readHandleHV.
fullKey
() <<
" with the range of "
<< readHandleHV.
getRange
());
75
}
76
77
// Get SCT_DetectorElementCollection
78
SG::ReadCondHandle<InDetDD::SiDetectorElementCollection>
sctDetEle(
m_SCTDetEleCollKey
, ctx);
79
const
InDetDD::SiDetectorElementCollection
* elements(sctDetEle.
retrieve
());
80
if
(elements==
nullptr
) {
81
ATH_MSG_FATAL
(
m_SCTDetEleCollKey
.fullKey() <<
" could not be retrieved"
);
82
return
StatusCode::FAILURE;
83
}
84
writeHandle.
addDependency
(sctDetEle);
85
86
// Construct the output Cond Object and fill it in
87
std::unique_ptr<InDet::SiliconPropertiesVector> writeCdo{std::make_unique<InDet::SiliconPropertiesVector>()};
88
const
SCT_ID::size_type
wafer_hash_max{
m_pHelper
->wafer_hash_max()};
89
writeCdo->resize(wafer_hash_max);
90
for
(
SCT_ID::size_type
hash{0}; hash<wafer_hash_max; hash++) {
91
const
IdentifierHash
elementHash{
static_cast<
IdentifierHash::value_type
>
(hash)};
92
93
double
temperatureC{
m_siCondTool
->temperature(elementHash, ctx)};
94
95
if
(not ((temperatureC>
m_temperatureMin
) and (temperatureC<
m_temperatureMax
))) {
96
ATH_MSG_DEBUG
(
"Invalid temperature: "
97
<< temperatureC <<
" C. "
98
<<
"Setting to "
<<
m_temperatureDefault
<<
" C. "
99
<<
"Detector element hash: "
<< elementHash);
100
temperatureC =
m_temperatureDefault
;
101
}
102
103
double
temperature{temperatureC + 273.15};
104
double
deplVoltage{
m_siCondTool
->depletionVoltage(elementHash, ctx) * CLHEP::volt};
105
double
biasVoltage{
m_siCondTool
->biasVoltage(elementHash, ctx) * CLHEP::volt};
106
107
const
InDetDD::SiDetectorElement
* element{elements->
getDetectorElement
(elementHash)};
108
double
depletionDepth{element->
thickness
()};
109
if
(std::abs(biasVoltage)<std::abs(deplVoltage)) {
110
depletionDepth *= std::sqrt(std::abs(biasVoltage/deplVoltage));
111
}
112
double
meanElectricField{0.};
113
if
(depletionDepth>0.) {
114
meanElectricField = biasVoltage/depletionDepth;
115
}
116
117
writeCdo->setConditions(hash, temperature, meanElectricField);
118
}
119
120
// Record the output cond object
121
if
(writeHandle.
record
(std::move(writeCdo)).isFailure()) {
122
ATH_MSG_FATAL
(
"Could not record SCT_DCSFloatCondData "
<< writeHandle.
key
()
123
<<
" with EventRange "
<< writeHandle.
getRange
()
124
<<
" into Conditions Store"
);
125
return
StatusCode::FAILURE;
126
}
127
ATH_MSG_INFO
(
"recorded new CDO "
<< writeHandle.
key
() <<
" with range "
<< writeHandle.
getRange
() <<
" into Conditions Store"
);
128
129
return
StatusCode::SUCCESS;
130
}
131
132
StatusCode
SCTSiPropertiesCondAlg::finalize
()
133
{
134
ATH_MSG_DEBUG
(
"finalize "
<< name());
135
return
StatusCode::SUCCESS;
136
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
IdentifierHash.h
SCTSiPropertiesCondAlg.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
SiDetectorElement.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCondAlgorithm
Base class for conditions algorithms.
Definition
AthCondAlgorithm.h:22
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
IdentifierHash::value_type
unsigned int value_type
Definition
IdentifierHash.h:27
InDetDD::SiDetectorElementCollection
Class to hold the SiDetectorElement objects to be put in the detector store.
Definition
SiDetectorElementCollection.h:27
InDetDD::SiDetectorElementCollection::getDetectorElement
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Definition
SiDetectorElementCollection.cxx:9
InDetDD::SiDetectorElement
Class to hold geometrical description of a silicon detector element.
Definition
SiDetectorElement.h:109
InDetDD::SolidStateDetectorElementBase::thickness
double thickness() const
SCTSiPropertiesCondAlg::m_siCondTool
ToolHandle< ISiliconConditionsTool > m_siCondTool
Definition
SCTSiPropertiesCondAlg.h:41
SCTSiPropertiesCondAlg::m_pHelper
const SCT_ID * m_pHelper
ID helper for SCT.
Definition
SCTSiPropertiesCondAlg.h:42
SCTSiPropertiesCondAlg::m_temperatureMin
DoubleProperty m_temperatureMin
Definition
SCTSiPropertiesCondAlg.h:32
SCTSiPropertiesCondAlg::finalize
virtual StatusCode finalize() override final
Definition
SCTSiPropertiesCondAlg.cxx:132
SCTSiPropertiesCondAlg::SCTSiPropertiesCondAlg
SCTSiPropertiesCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
SCTSiPropertiesCondAlg.cxx:14
SCTSiPropertiesCondAlg::m_writeKey
SG::WriteCondHandleKey< InDet::SiliconPropertiesVector > m_writeKey
Definition
SCTSiPropertiesCondAlg.h:39
SCTSiPropertiesCondAlg::m_temperatureMax
DoubleProperty m_temperatureMax
Definition
SCTSiPropertiesCondAlg.h:33
SCTSiPropertiesCondAlg::m_SCTDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
Definition
SCTSiPropertiesCondAlg.h:38
SCTSiPropertiesCondAlg::m_temperatureDefault
DoubleProperty m_temperatureDefault
Definition
SCTSiPropertiesCondAlg.h:34
SCTSiPropertiesCondAlg::m_forceGeoModel
BooleanProperty m_forceGeoModel
Definition
SCTSiPropertiesCondAlg.h:35
SCTSiPropertiesCondAlg::initialize
virtual StatusCode initialize() override final
Definition
SCTSiPropertiesCondAlg.cxx:20
SCTSiPropertiesCondAlg::m_readKeyHV
SG::ReadCondHandleKey< SCT_DCSFloatCondData > m_readKeyHV
Definition
SCTSiPropertiesCondAlg.h:37
SCTSiPropertiesCondAlg::m_readKeyTemp
SG::ReadCondHandleKey< SCT_DCSFloatCondData > m_readKeyTemp
Definition
SCTSiPropertiesCondAlg.h:36
SCTSiPropertiesCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
SCTSiPropertiesCondAlg.cxx:42
SCT_DCSFloatCondData
Class for data object used in SCT_DCSConditions{HV,Temp}CondAlg, SCT_DCSConditionsTool,...
Definition
SCT_DCSFloatCondData.h:30
SCT_ID::size_type
Identifier::size_type size_type
Definition
SCT_ID.h:72
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::retrieve
const_pointer_type retrieve()
Definition
ReadCondHandle.h:161
SG::ReadCondHandle::fullKey
const DataObjID & fullKey() const
Definition
ReadCondHandle.h:60
SG::ReadCondHandle::getRange
const EventIDRange & getRange()
Definition
ReadCondHandle.h:241
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
SG::WriteCondHandle::getRange
const EventIDRange & getRange() const
Definition
WriteCondHandle.h:93
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition
WriteCondHandle.h:161
SG::WriteCondHandle::isValid
bool isValid() const
Definition
WriteCondHandle.h:252
SG::WriteCondHandle::fullKey
const DataObjID & fullKey() const
Definition
WriteCondHandle.h:45
Generated on
for ATLAS Offline Software by
1.17.0