|
ATLAS Offline Software
|
#include <PixelDistortionAlg.h>
|
| PixelDistortionAlg (const std::string &name, ISvcLocator *pSvcLocator) |
|
virtual | ~PixelDistortionAlg ()=default |
|
virtual StatusCode | initialize () override |
|
virtual StatusCode | execute () override |
|
virtual StatusCode | sysInitialize () override |
| Override sysInitialize. More...
|
|
virtual const DataObjIDColl & | extraOutputDeps () const override |
| Return the list of extra output dependencies. More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
const PixelID * | m_pixelID {nullptr} |
|
ServiceHandle< IAthRNGSvc > | m_rndmSvc {this, "RndmSvc", "AthRNGSvc"} |
| Random number service. More...
|
|
SG::ReadCondHandleKey< DetCondCFloat > | m_readKey {this, "ReadKey", "/Indet/PixelDist", "Input readout distortion folder"} |
|
SG::WriteCondHandleKey< PixelDistortionData > | m_writeKey {this, "WriteKey", "PixelDistortionData", "Output readout distortion data"} |
|
Gaudi::Property< int > | m_distortionInputSource {this, "DistortionInputSource", 4, "Source of module distortions: 0 (none), 1 (constant), 2 (text file), 3 (random), 4 (database)"} |
|
Gaudi::Property< int > | m_distortionVersion {this, "DistortionVersion", -1, "Version number for distortion model"} |
|
Gaudi::Property< bool > | m_writeToFile {this, "DistortionWriteToFile", false, "Record data in storegate"} |
|
Gaudi::Property< std::string > | m_inputFileName {this, "DistortionFileName", "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/TrackingCP/PixelDistortions/PixelDistortionsData_v2_BB.txt","Read distortions from this file"} |
|
DataObjIDColl | m_extendedExtraObjects |
|
StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) More...
|
|
StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) More...
|
|
std::vector< SG::VarHandleKeyArray * > | m_vhka |
|
bool | m_varHandleArraysDeclared |
|
Definition at line 27 of file PixelDistortionAlg.h.
◆ StoreGateSvc_t
◆ PixelDistortionAlg()
PixelDistortionAlg::PixelDistortionAlg |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ ~PixelDistortionAlg()
virtual PixelDistortionAlg::~PixelDistortionAlg |
( |
| ) |
|
|
virtualdefault |
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode PixelDistortionAlg::execute |
( |
| ) |
|
|
overridevirtual |
Definition at line 40 of file PixelDistortionAlg.cxx.
44 if (writeHandle.isValid()) {
45 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid.. In theory this should not be called, but may happen if multiple concurrent events are being processed out of order.");
46 return StatusCode::SUCCESS;
50 std::unique_ptr<PixelDistortionData> writeCdo(std::make_unique<PixelDistortionData>());
54 constexpr
int nmodule_max = 2048;
55 std::unordered_map<uint32_t,std::vector<float>> distortionMap;
56 std::unordered_map<uint32_t,unsigned long long>
ids;
60 for (
int i=0;
i<nmodule_max;
i++) {
61 distortionMap[
i].push_back(0.0);
62 distortionMap[
i].push_back(0.0);
63 distortionMap[
i].push_back(0.0);
69 for (
int i=0;
i<nmodule_max;
i++) {
70 distortionMap[
i].push_back(0.1);
71 distortionMap[
i].push_back(0.1);
78 ATH_MSG_ERROR(
"Distortion filename is empty not found! No pixel distortion will be applied.");
79 return StatusCode::FAILURE;
91 return StatusCode::FAILURE;
98 while (!
input.eof()) {
100 unsigned int hashID = 0;
107 input >> std::hex >> idmod >> std::dec;
115 for (
int i = 0;
i < distosize; ++
i) {
118 distortionMap[hashID].push_back(
data);
129 rngWrapper->
setSeed(
name(),Gaudi::Hive::currentContext());
130 CLHEP::HepRandomEngine *rndmEngine = *rngWrapper;
133 constexpr
double distortionRMSR{0.08};
134 constexpr
double distortionMeanTwist{-0.0005};
136 for (
int i=0;
i<nmodule_max;
i++) {
137 float r1 = CLHEP::RandGaussZiggurat::shoot(rndmEngine,distortionMeanR,distortionRMSR);
138 float r2 = CLHEP::RandGaussZiggurat::shoot(rndmEngine,r1,distortionRMSR/10.);
139 float twist = CLHEP::RandGaussZiggurat::shoot(rndmEngine,distortionMeanTwist,distortionMeanTwist);
149 if (readCdo==
nullptr) {
151 return StatusCode::FAILURE;
154 ATH_MSG_DEBUG(
"Size of DetCondCFloat " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->
size());
157 if (readCdo->
tag()==
"/Indet/PixelDist") {
159 ATH_MSG_INFO(
"Detected old version of pixel distortions data.");
162 bool gotVersion =
false;
165 std::string baseStr =
"/Indet/PixelDist_v";
166 if (readCdo->
tag().compare(0,baseStr.size(),baseStr)==0) {
167 std::istringstream istr(readCdo->
tag().substr(baseStr.size()));
176 ATH_MSG_WARNING(
"Unable to determine version number of pixel distortions data. Version string: " << readCdo->
tag());
179 writeCdo -> setVersion(
version);
182 int distosize = readCdo->
size();
184 for (
int i=0;
i<nmodule_max;
i++) {
187 const float *disto = readCdo->
find(modId);
192 for (
int j = 0; j < distosize; ++j) {
193 distortionMap[
i].push_back(disto[j]);
194 s << disto[j] <<
" ";
200 writeCdo -> setDistortionMap(distortionMap);
201 writeCdo -> setIds(
ids);
204 std::ofstream*
outfile =
new std::ofstream(
"output_distortion.txt");
205 for (
int i=0;
i<nmodule_max;
i++) {
206 if (!distortionMap[
i].
empty()) {
211 *
outfile <<
i <<
" " << distortionMap[
i].at(0) <<
" " << distortionMap[
i].at(1) <<
" " << distortionMap[
i].at(2) << std::endl;
219 const EventIDBase
start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
220 const EventIDBase
stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
223 if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
224 ATH_MSG_FATAL(
"Could not record PixelDistortionData " << writeHandle.key() <<
" with EventRange " << rangeW <<
" into Conditions Store");
225 return StatusCode::FAILURE;
227 ATH_MSG_DEBUG(
"recorded new CDO " << writeHandle.key() <<
" with range " << rangeW <<
" into Conditions Store");
229 return StatusCode::SUCCESS;
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ extraOutputDeps()
const DataObjIDColl & AthAlgorithm::extraOutputDeps |
( |
| ) |
const |
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 50 of file AthAlgorithm.cxx.
57 return Algorithm::extraOutputDeps();
◆ initialize()
StatusCode PixelDistortionAlg::initialize |
( |
| ) |
|
|
overridevirtual |
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ renounce()
◆ renounceArray()
◆ sysInitialize()
StatusCode AthAlgorithm::sysInitialize |
( |
| ) |
|
|
overridevirtualinherited |
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_detStore
◆ m_distortionInputSource
Gaudi::Property<int> PixelDistortionAlg::m_distortionInputSource {this, "DistortionInputSource", 4, "Source of module distortions: 0 (none), 1 (constant), 2 (text file), 3 (random), 4 (database)"} |
|
private |
◆ m_distortionVersion
Gaudi::Property<int> PixelDistortionAlg::m_distortionVersion {this, "DistortionVersion", -1, "Version number for distortion model"} |
|
private |
◆ m_evtStore
◆ m_extendedExtraObjects
DataObjIDColl AthAlgorithm::m_extendedExtraObjects |
|
privateinherited |
◆ m_inputFileName
Gaudi::Property<std::string> PixelDistortionAlg::m_inputFileName {this, "DistortionFileName", "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/TrackingCP/PixelDistortions/PixelDistortionsData_v2_BB.txt","Read distortions from this file"} |
|
private |
◆ m_pixelID
◆ m_readKey
◆ m_rndmSvc
◆ m_varHandleArraysDeclared
◆ m_vhka
◆ m_writeKey
◆ m_writeToFile
Gaudi::Property<bool> PixelDistortionAlg::m_writeToFile {this, "DistortionWriteToFile", false, "Record data in storegate"} |
|
private |
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
DetCondCFloat is a class to hold sets of Identifiers and arrays of floats for detector element specif...
char data[hepevt_bytes_allocation_ATLAS]
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Gaudi::Property< int > m_distortionVersion
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
value_type get_compact() const
Get the compact id.
SG::WriteCondHandleKey< PixelDistortionData > m_writeKey
Gaudi::Property< bool > m_writeToFile
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual void setOwner(IDataHandleHolder *o)=0
SG::ReadCondHandleKey< DetCondCFloat > m_readKey
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
virtual StatusCode sysInitialize() override
Override sysInitialize.
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
::StatusCode StatusCode
StatusCode definition for legacy code.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
A wrapper class for event-slot-local random engines.
StatusCode initialize(bool used=true)
DataObjIDColl m_extendedExtraObjects
#define ATH_MSG_WARNING(x)
Gaudi::Property< std::string > m_inputFileName
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
const std::string & tag() const
AthAlgorithm()
Default constructor:
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
const float * find(const Identifier &ident) const
Gaudi::Property< int > m_distortionInputSource
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service.
const PixelID * m_pixelID