 |
ATLAS Offline Software
|
MdtCalibDbAlg reads raw condition data and writes derived condition data to the condition store.
More...
#include <MdtCalibDbAlg.h>
|
| MdtCalibDbAlg (const std::string &name, ISvcLocator *pSvcLocator) |
|
virtual | ~MdtCalibDbAlg ()=default |
|
virtual StatusCode | initialize () override |
|
virtual StatusCode | execute (const EventContext &ctx) const override |
|
virtual bool | isReEntrant () const override |
|
virtual StatusCode | sysInitialize () override |
| Override sysInitialize. More...
|
|
virtual bool | isClonable () const override |
| Specify if the algorithm is clonable. More...
|
|
virtual unsigned int | cardinality () const override |
| Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
|
|
virtual StatusCode | sysExecute (const EventContext &ctx) override |
| Execute an algorithm. More...
|
|
virtual const DataObjIDColl & | extraOutputDeps () const override |
| Return the list of extra output dependencies. More...
|
|
virtual bool | filterPassed (const EventContext &ctx) const |
|
virtual void | setFilterPassed (bool state, const EventContext &ctx) const |
|
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 |
|
|
StatusCode | declareDependency (const EventContext &ctx, SG::WriteCondHandle< MuonCalib::MdtCalibDataContainer > &writeHandle) const |
|
StatusCode | loadRt (const EventContext &ctx, MuonCalib::MdtCalibDataContainer &writeCdo) const |
|
StatusCode | loadTube (const EventContext &ctx, MuonCalib::MdtCalibDataContainer &writeCdo) const |
|
StatusCode | defaultT0s (MuonCalib::MdtCalibDataContainer &writeCdoTube) const |
|
StatusCode | defaultRt (MuonCalib::MdtCalibDataContainer &writeCdoRt, LoadedRtMap &loadedRts) const |
|
std::optional< double > | getInnerTubeRadius (const Identifier &id) const |
|
StatusCode | legacyRtPayloadToJSON (const coral::AttributeList &attr, nlohmann::json &json) const |
| Parses the legacy payload for the RT functions to a json format. More...
|
|
StatusCode | legacyTubePayloadToJSON (const coral::AttributeList &attr, nlohmann::json &json) const |
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
|
ServiceHandle< Muon::IMuonIdHelperSvc > | m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"} |
|
ToolHandle< MuonCalib::IIdToFixedIdTool > | m_idToFixedIdTool {this, "IdToFixedIdTool", "MuonCalib::IdToFixedIdTool"} |
|
const MuonGM::MuonDetectorManager * | m_detMgr {nullptr} |
|
const MuonGMR4::MuonDetectorManager * | m_r4detMgr {nullptr} |
|
Gaudi::Property< bool > | m_useNewGeo |
|
Gaudi::Property< bool > | m_checkTubes {this, "checkTubes", true,"If true the number of tubes must agree between the conditions DB & geometry"} |
| only needed to retrieve information on number of tubes etc. (no alignment needed) More...
|
|
Gaudi::Property< bool > | m_newFormat2020 {this, "NewFormat2020", false, "Use the new calibration data format "} |
|
Gaudi::Property< bool > | m_create_b_field_function |
|
Gaudi::Property< bool > | m_createSlewingFunction |
|
Gaudi::Property< bool > | m_TimeSlewingCorrection {this, "TimeSlewingCorrection", false} |
|
Gaudi::Property< bool > | m_UseMLRt {this, "UseMLRt", false, "Enable use of ML-RTs from COOL"} |
|
Gaudi::Property< std::vector< float > > | m_MeanCorrectionVsR {this, "MeanCorrectionVsR", {}} |
|
Gaudi::Property< double > | m_TsCorrectionT0 {this, "TimeSlewCorrectionT0", 0.} |
|
Gaudi::Property< double > | m_defaultT0 {this, "defaultT0", 40., "default T0 value to be used in absence of DB information"} |
|
Gaudi::Property< double > | m_t0Shift {this, "T0Shift", 0., "for simulation: common shift of all T0s, in ns"} |
|
Gaudi::Property< double > | m_t0Spread {this, "T0Spread", 0., "for simulation: sigma for random smeraing of T0s, in ns"} |
|
Gaudi::Property< double > | m_rtShift {this, "RTShift", 0., "for simulations: maximum RT distortion, in mm"} |
|
Gaudi::Property< double > | m_rtScale {this, "RTScale", 1., "for simulations: a muliplicitive scale to the drift r"} |
|
Gaudi::Property< double > | m_prop_beta {this, "PropagationSpeedBeta", 1., "Speed of the signal propagation"} |
|
ServiceHandle< IAthRNGSvc > | m_AthRNGSvc {this, "AthRNGSvc", "AthRNGSvc"} |
|
StringProperty | m_randomStream {this, "RandomStream", "MDTCALIBDBALG"} |
|
ATHRNG::RNGWrapper * | m_RNGWrapper {nullptr} |
|
StringProperty | m_RTfileName |
|
SG::ReadCondHandleKey< CondAttrListCollection > | m_readKeyRt {this, "ReadKeyRt", "/MDT/RTBLOB", "DB folder containing the RT calibrations"} |
|
SG::ReadCondHandleKey< CondAttrListCollection > | m_readKeyTube {this, "ReadKeyTube", "/MDT/T0BLOB", "DB folder containing the tube constants"} |
|
SG::WriteCondHandleKey< MuonCalib::MdtCalibDataContainer > | m_writeKey |
|
SG::ReadCondHandleKey< MdtCondDbData > | m_readKeyDCS {this, "ReadKeyDCS", "MdtCondDbData", "Key of the input DCS data"} |
|
DataObjIDColl | m_extendedExtraObjects |
| Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks. More...
|
|
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 |
|
MdtCalibDbAlg reads raw condition data and writes derived condition data to the condition store.
Definition at line 33 of file MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/MdtCalibDbAlg.h.
◆ LoadedRtMap
◆ RtRelationPtr
◆ StoreGateSvc_t
◆ MdtCalibDbAlg()
MdtCalibDbAlg::MdtCalibDbAlg |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ ~MdtCalibDbAlg()
virtual MdtCalibDbAlg::~MdtCalibDbAlg |
( |
| ) |
|
|
virtualdefault |
◆ cardinality()
unsigned int AthReentrantAlgorithm::cardinality |
( |
| ) |
const |
|
overridevirtualinherited |
Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
Override this to return 0 for reentrant algorithms.
Override this to return 0 for reentrant algorithms.
Definition at line 55 of file AthReentrantAlgorithm.cxx.
◆ declareDependency()
Definition at line 96 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
101 if (
key.empty())
continue;
103 if (!readHandle.isValid()) {
104 ATH_MSG_FATAL(
"Failed to retrieve conditions object "<<readHandle.fullKey());
105 return StatusCode::FAILURE;
108 ATH_MSG_INFO(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdoRt->size()= " << readHandle->size());
109 ATH_MSG_INFO(
"Range of input is " << readHandle.getRange());
113 if (!readHandle.isValid()) {
115 return StatusCode::FAILURE;
117 if (readHandle->hasDCS()) {
120 return StatusCode::SUCCESS;
◆ 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);
◆ 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.
◆ 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.
◆ 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]
◆ defaultRt()
load the calibration constants of the second multilayer from the first one
Definition at line 149 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
155 return StatusCode::FAILURE;
168 for (
unsigned int n = 0;
n <
rts.nRts(); ++
n) {
169 std::unique_ptr<MuonCalib::RtDataFromFile::RtRelation> rt(
rts.getRt(
n));
176 if (
times.size() < 2) {
178 return StatusCode::FAILURE;
181 if (
times.size() != radii.size() ||
times.size() != reso.size()) {
183 return StatusCode::FAILURE;
186 double t_min =
times[0];
187 double bin_size =
times[1] - t_min;
190 return StatusCode::FAILURE;
196 rtPars.push_back(t_min);
197 rtPars.push_back(bin_size);
200 rtPars.insert(rtPars.end(), radii.begin(), radii.end());
206 resoPars.insert(resoPars.end(), reso.begin(), reso.end());
211 std::shared_ptr<MuonCalib::IRtRelation> rtRel{std::make_unique<RtRelationLookUp>(rtPars)};
212 std::shared_ptr<MuonCalib::IRtResolution> resoRel{std::make_unique<RtResolutionLookUp>(resoPars)};
222 RtRelationPtr MdtRt = std::make_unique<MuonCalib::MdtRtRelation>(rtRel, resoRel);
224 for(
auto itr = idHelper.detectorElement_begin();
225 itr!= idHelper.detectorElement_end();++itr){
227 if (writeCdo.hasDataForChannel(detElId, msgStream())) {
228 const MdtFullCalibData* dataObj = writeCdo.getCalibData(detElId, msgStream());
236 if (idHelper.multilayer(detElId) == 2) {
237 if (writeCdo.granularity() != RegionGranularity::OnePerMultiLayer)
continue;
238 const Identifier firstML = idHelper.multilayerID(detElId, 1);
239 if (writeCdo.hasDataForChannel(firstML, msgStream())) {
240 const MdtFullCalibData* dataObj = writeCdo.getCalibData(firstML, msgStream());
248 if (!writeCdo.storeData(detElId, storeMe, msgStream())) {
250 return StatusCode::FAILURE;
254 loadedRts[detElId] = MdtRt;
260 int npoints = rtRel->nPar() - 2;
262 for (
int ipt = 0; ipt <
npoints; ++ipt) {
263 double t = t_min + ipt * bin_size;
264 ATH_MSG_VERBOSE(
" " << ipt <<
" " <<
t <<
" " << rtRel->radius(
t) <<
" " << resoRel->resolution(
t));
271 return StatusCode::SUCCESS;
◆ defaultT0s()
Definition at line 599 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
605 for (;
it != it_end; ++
it) {
607 if (writeCdo.hasDataForChannel(*
it, msgStream())) {
616 if (!writeCdo.storeData(*
it, tubes, msgStream()))
return StatusCode::FAILURE;
622 unsigned int nlayers = tubes->
numLayers();
623 unsigned int ntubes = tubes->
numTubes();
624 int size = nml * nlayers * ntubes;
627 <<
" size " <<
size <<
" ml " << nml <<
" l " << nlayers <<
" t " << ntubes);
628 for (
unsigned int ml = 1; ml <= nml; ++ml) {
629 for (
unsigned int l = 1;
l <= nlayers; ++
l) {
630 for (
unsigned int t = 1;
t <= ntubes; ++
t) {
631 auto data = std::make_unique<MuonCalib::MdtTubeCalibContainer::SingleTubeCalib>();
640 return StatusCode::SUCCESS;
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode MdtCalibDbAlg::execute |
( |
const EventContext & |
ctx | ) |
const |
|
overridevirtual |
Definition at line 122 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
125 if (writeHandle.isValid()) {
126 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
127 <<
". In theory this should not be called, but may happen"
128 <<
" if multiple concurrent events are being processed out of order.");
129 return StatusCode::SUCCESS;
136 gran = RegionGranularity::OneRt;
138 ATH_MSG_DEBUG(
"Save one set of calibration constants per multi layer");
139 gran = RegionGranularity::OnePerMultiLayer;
140 }
else ATH_MSG_DEBUG(
"Save one set of calibration constants per chamber");
141 std::unique_ptr<MuonCalib::MdtCalibDataContainer> writeCdo = std::make_unique<MuonCalib::MdtCalibDataContainer>(
m_idHelperSvc.get(), gran);
145 ATH_CHECK(writeHandle.record(std::move(writeCdo)));
146 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 & AthReentrantAlgorithm::extraOutputDeps |
( |
| ) |
const |
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 79 of file AthReentrantAlgorithm.cxx.
86 return Algorithm::extraOutputDeps();
◆ filterPassed()
virtual bool AthReentrantAlgorithm::filterPassed |
( |
const EventContext & |
ctx | ) |
const |
|
inlinevirtualinherited |
◆ getInnerTubeRadius()
std::optional< double > MdtCalibDbAlg::getInnerTubeRadius |
( |
const Identifier & |
id | ) |
const |
|
private |
◆ getRtResolutionInterpolation()
Definition at line 875 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
879 std::vector<Double_t>
x(sample_points.size(),0);
880 std::vector<Double_t>
y(sample_points.size(),0);
882 for (
unsigned int i = 0;
i < sample_points.size();
i++) {
883 x[
i] = sample_points[
i].x1();
884 y[
i] = sample_points[
i].x2();
886 TSpline3 sp(
"Rt Res Tmp",
x.data(),
y.data(), sample_points.size());
890 unsigned int nb_points(100);
891 std::vector<double> res_param(nb_points + 2);
892 Double_t
bin_width = (
x[sample_points.size() - 1] -
x[0]) /
static_cast<Double_t
>(nb_points);
896 for (
unsigned int k = 0;
k < nb_points;
k++) {
898 res_param[
k + 2] = sp.Eval(xx);
899 if (std::isnan(res_param[
k + 2])) {
900 TFile outf(
"kacke.root",
"RECREATE");
903 "encountered nan element");
906 return std::make_unique<MuonCalib::RtResolutionLookUp>(std::move(res_param));
◆ initialize()
StatusCode MdtCalibDbAlg::initialize |
( |
| ) |
|
|
overridevirtual |
Definition at line 52 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
69 ATH_MSG_DEBUG(
" initialize Random Number Service: running with t0 shift "
74 ATH_MSG_ERROR(
"Could not get random number engine from AthRNGSvc. Abort.");
75 return StatusCode::FAILURE;
80 ATH_MSG_INFO(
"************************************" << std::endl
81 <<
" Running with Calibration Deformations! " << std::endl
82 <<
" For performance studies only!" << std::endl
83 <<
" **************************************");
94 return StatusCode::SUCCESS;
◆ 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.
◆ isClonable()
bool AthReentrantAlgorithm::isClonable |
( |
| ) |
const |
|
overridevirtualinherited |
Specify if the algorithm is clonable.
Reentrant algorithms are clonable.
Reimplemented in Simulation::BeamEffectsAlg, InDet::SiTrackerSpacePointFinder, InDet::SCT_Clusterization, InDet::SiSPSeededTrackFinder, SCTRawDataProvider, InDet::GNNSeedingTrackMaker, SCT_PrepDataToxAOD, RoIBResultToxAOD, InDet::SiSPGNNTrackMaker, SCT_CablingCondAlgFromCoraCool, SCT_ReadCalibDataTestAlg, SCT_CablingCondAlgFromText, SCT_ReadCalibChipDataTestAlg, SCT_TestCablingAlg, SCT_ConfigurationConditionsTestAlg, ITkPixelCablingAlg, ITkStripCablingAlg, SCTEventFlagWriter, SCT_ConditionsSummaryTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_TdaqEnabledTestAlg, SCT_SiliconConditionsTestAlg, SCTSiLorentzAngleTestAlg, SCT_ByteStreamErrorsTestAlg, SCT_ConditionsParameterTestAlg, SCT_FlaggedConditionTestAlg, SCT_StripVetoTestAlg, SCT_RawDataToxAOD, and SCTSiPropertiesTestAlg.
Definition at line 44 of file AthReentrantAlgorithm.cxx.
◆ isReEntrant()
virtual bool MdtCalibDbAlg::isReEntrant |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ legacyRtPayloadToJSON()
StatusCode MdtCalibDbAlg::legacyRtPayloadToJSON |
( |
const coral::AttributeList & |
attr, |
|
|
nlohmann::json & |
json |
|
) |
| const |
|
private |
Parses the legacy payload for the RT functions to a json format.
Extract first the number of points and the Calib identifier
Next convert the rt relations to
Another code beauty here. The legacy payload was structured such that a triplet of three numbers in the vector represents a single data point, the first one is the radius, the second one the time and the last one is the resolution
Check that we picked up the right amount of points
Definition at line 292 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
293 std::string
data{}, delim{};
298 return StatusCode::FAILURE;
302 data = *(
static_cast<const std::string *
>((attr[
"data"]).addressOfData()));
308 return StatusCode::FAILURE;
314 unsigned int numPoints{0};
317 channel[
"appliedRT"] = rt_ts_applied;
322 if(tokensHeader.size()< 2){
323 ATH_MSG_FATAL(
"Failed to deduce extract number of points & calib Identifier from "<<
header);
324 return StatusCode::FAILURE;
326 unsigned int calibId = tokensHeader[0];
327 numPoints = tokensHeader[1];
331 return StatusCode::FAILURE;
335 ATH_MSG_WARNING(
"The translation from the calibration ID with station: "
336 <<
id.stationNameString()<<
"("<<
id.
stationName()<<
") "
337 <<
" eta:"<<
id.
eta()<<
" phi: "<<
id.
phi());
342 channel[
"ml"] = idHelper.multilayer(athenaId);
343 channel[
"layer"] = idHelper.tubeLayer(athenaId);
344 channel[
"tube"] = idHelper.tube(athenaId);
348 std::vector<double> radii{},
times{}, resos{};
349 radii.reserve(numPoints);
350 times.reserve(numPoints);
351 resos.reserve(numPoints);
355 for (
unsigned int k = 0 ;
k < dataPoints.size(); ++
k) {
356 const double value = dataPoints[
k];
359 radii.push_back(
value);
365 resos.push_back(
value);
372 if (radii.size() != numPoints ||
373 times.size() != numPoints ||
374 resos.size() != numPoints) {
375 ATH_MSG_FATAL(
"Payload "<<
payload<<
" does not lead to the expected number of points "<<numPoints<<
" vs. "<<dataPoints.size());
376 return StatusCode::FAILURE;
378 channel[
"radii"] = std::move(radii);
380 channel[
"resolutions"] = std::move(resos);
382 return StatusCode::SUCCESS;
◆ legacyTubePayloadToJSON()
StatusCode MdtCalibDbAlg::legacyTubePayloadToJSON |
( |
const coral::AttributeList & |
attr, |
|
|
nlohmann::json & |
json |
|
) |
| const |
|
private |
A typical header looks like: T0BIL_1_-6,v0.0,1,288 BIL is the station name, the numbers next do the underscores represent the station phi and the station eta. That's followed by a mysterious version number which was never incremented throughout time – soo sad. The last two fields are the region number and the total number of tubes in the chamber.
The payload comes along in triplets. The first element of the triplet represents the T0 shift of the single tube, the second one the status and the last one the mean Adc value
pack everything into a json array
Definition at line 644 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
650 return StatusCode::FAILURE;
654 data = *(
static_cast<const std::string *
>((attr[
"data"]).addressOfData()));
659 return StatusCode::FAILURE;
668 const std::string stName =
header.substr(2,3);
669 int eta{0},
phi{0}, nTubes{0};
672 const std::vector<std::string> headerTokens =
tokenize(
header,
",");
675 nTubes =
atoi(headerTokens[5]);
681 static std::atomic<bool> idWarningPrinted =
false;
682 if (!idWarningPrinted) {
684 <<
" is invalid. Skipping");
685 idWarningPrinted.store(
true, std::memory_order_relaxed);
687 return StatusCode::SUCCESS;
691 channel[
"appliedT0"] = t0_ts_applied;
697 std::vector<double> tzeros{}, meanAdcs{};
698 std::vector<int> statusCodes{};
701 for (
unsigned int k = 0;
k < payLoadData.size(); ++
k){
702 const double value = payLoadData[
k];
705 tzeros.push_back(
value);
708 statusCodes.push_back(
value);
711 meanAdcs.push_back(
value);
717 if (statusCodes.size() != tzeros.size() ||
718 statusCodes.size() != meanAdcs.size() ||
719 statusCodes.empty()) {
721 return StatusCode::FAILURE;
726 const int numMl = idHelper.numberOfMultilayers(chamID);
727 const Identifier secondMlID = idHelper.multilayerID(chamID, numMl);
728 const int tubesPerLay =
std::max(idHelper.tubeMax(chamID), idHelper.tubeMax(secondMlID));
729 const int numLayers =
std::max(idHelper.tubeLayerMax(chamID), idHelper.tubeLayerMax(secondMlID));
731 ATH_MSG_FATAL(
"Calibration database differs in terms of number of tubes for chamber "
733 <<
" vs. observed "<<nTubes);
734 return StatusCode::FAILURE;
737 for (
unsigned int k = 0;
k < tzeros.size(); ++
k) {
739 channelData[
"ml"] = ml;
740 channelData[
"layer"] =
layer;
741 channelData[
"tube"] =
tube;
742 channelData[
"t0"] = tzeros[
k];
743 channelData[
"meanAdc"] = meanAdcs[
k];
744 channelData[
"status"] = statusCodes[
k];
746 if (
tube > tubesPerLay){
754 calibData.push_back(std::move(channelData));
756 channel[
"calibConstants"] = std::move(calibData);
758 return StatusCode::SUCCESS;
◆ loadRt()
List of loaded Rt relations to attach the proper corrections later
Athena Identifier
all the points in time,radius [RT] and time,sigma [resolution func]
Must have at least 3 points to have a valid RT
The Mdt conditions data is only of value if it's also DCS constants
SKip everything that's switched off
Definition at line 385 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
390 if (!readHandleRt.isValid()) {
392 return StatusCode::FAILURE;
400 itr != readHandleRt->end(); ++itr) {
407 return StatusCode::FAILURE;
411 data = *(
static_cast<const std::string *
>((atr[
"data"]).addressOfData()));
415 for (
auto &
it :
yy.items()) {
417 rtCalibJson.push_back(yx);
424 itr != readHandleRt->end(); ++itr) {
431 for (
const auto&
payload : rtCalibJson) {
432 const bool rt_ts_applied =
payload[
"appliedRT"];
434 const std::string stName =
payload[
"station"];
438 std::optional<double> innerTubeRadius =
getInnerTubeRadius(idHelper.multilayerID(athenaId, 1));
439 if (!innerTubeRadius)
continue;
442 const std::vector<double> radii =
payload[
"radii"];
444 const std::vector<double> resolutions =
payload[
"resolutions"];
457 std::vector<MuonCalib::SamplePoint> tr_points{}, ts_points{};
462 for (
unsigned int k = 0;
k < radii.size(); ++
k) {
468 radius = oldradius + rshift;
469 ATH_MSG_DEBUG(
"DEFORM RT: old radius " << oldradius <<
" new radius " <<
radius <<
" shift " << rshift
484 float sigma = resolutions[
k];
488 if (tr_point.
x2() < -99) {
489 multilayer_tmax_diff = tr_point.
x1();
490 }
else if (
k == 0 || (tr_points[
k - 1].
x1() < tr_point.
x1() && tr_points[
k - 1].x2() < tr_point.
x2())) {
491 tr_points.push_back(tr_point);
492 ts_points.push_back(ts_point);
497 if (ts_points.size() < 3) {
499 return StatusCode::FAILURE;
503 float sign(rt_ts_applied ? -1.0 : 1.0);
505 for (
auto & tr_point : tr_points) {
506 int slice_number =
static_cast<int>(std::floor(tr_point.
x2() / slice_width));
507 if (slice_number < 0) slice_number = 0;
519 ATH_MSG_VERBOSE(point.x1() <<
"|" << point.x2() <<
"|" << point.error());
527 if (!reso || !rt) {
continue; }
529 if (rt->
par(1) == 0.) {
533 return StatusCode::FAILURE;
536 if (multilayer_tmax_diff > -8e8) { rt->
SetTmaxDiff(multilayer_tmax_diff); }
538 RtRelationPtr rt_rel = std::make_unique<MuonCalib::MdtRtRelation>(std::move(rt), std::move(reso));
540 if (!writeCdo.
storeData(athenaId ,rt_rel, msgStream()))
return StatusCode::FAILURE;
542 loadedRtRel[athenaId] = rt_rel;
547 if (loadedRtRel.empty()) {
548 return StatusCode::SUCCESS;
551 ATH_MSG_DEBUG(
"Initializing " << loadedRtRel.size()<<
" b-field functions");
556 if (readCondHandleDb->hasDCS()) {
557 condDbData = readCondHandleDb.cptr();
559 ATH_MSG_INFO(
"Do not retrieve the HV from DCS. Fall back to 2730 & 3080");
564 for (
const auto& [athenaId, rtRelation] : loadedRtRel) {
565 CorrectionPtr corrFuncSet = std::make_unique<MuonCalib::MdtCorFuncSet>();
568 std::vector<double> corr_params(2);
569 bool loadDefault{
false};
574 if (corr_params[0] < std::numeric_limits<float>::epsilon()) {
578 }
else loadDefault =
true;
581 corr_params[0] = 2730.0;
583 corr_params[0] = 3080.0;
586 corr_params[1] = 0.11;
587 corrFuncSet->
setBField(std::make_unique<MuonCalib::BFieldCorFunc>(
"medium", corr_params, rtRelation->rt()));
592 if (!writeCdo.
storeData(athenaId, corrFuncSet, msgStream()))
return StatusCode::FAILURE;
595 return StatusCode::SUCCESS;
◆ loadTube()
Definition at line 760 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
770 itr != readHandleTube->end(); ++itr) {
777 return StatusCode::FAILURE;
781 data = *(
static_cast<const std::string *
>((atr[
"data"]).addressOfData()));
785 for (
auto &
it :
yy.items()) {
787 t0CalibJson.push_back(yx);
794 itr != readHandleTube->end(); ++itr) {
806 for (
const auto& chambChannel : t0CalibJson) {
807 const std::string stName = chambChannel[
"station"];
808 const int ieta = chambChannel[
"eta"];
809 const int iphi = chambChannel[
"phi"];
810 const bool t0_ts_applied = chambChannel[
"appliedT0"];
816 static std::atomic<bool> idWarningPrinted =
false;
817 if (!idWarningPrinted) {
818 ATH_MSG_WARNING(
"Element Identifier " << chId.get_compact() <<
" retrieved for station name " << stName
819 <<
" is not valid, skipping");
820 idWarningPrinted.store(
true, std::memory_order_relaxed);
834 if (!writeCdo.
storeData(chId, tubes, msgStream())) {
836 <<
" ID fields: "<<stName<<
","<<ieta<<
","<<iphi);
837 return StatusCode::FAILURE;
840 const nlohmann::json& tubeConstants = chambChannel[
"calibConstants"];
841 for (
const auto& tubeChannel : tubeConstants) {
842 const int ml = tubeChannel[
"ml"];
843 const int l = tubeChannel[
"layer"];
844 const int t = tubeChannel[
"tube"];
845 double tzero = tubeChannel[
"t0"];
852 double sh = CLHEP::RandGaussZiggurat::shoot(engine, 0.,
m_t0Spread);
854 ATH_MSG_VERBOSE(
"T0 spread " <<
sh <<
" t0 " << tzero <<
" id " << ml <<
" " <<
l <<
" " <<
t);
860 const double meanAdc = tubeChannel[
"meanAdc"];
861 auto datatube = std::make_unique<MuonCalib::MdtTubeCalibContainer::SingleTubeCalib>();
863 datatube->t0 = tzero;
864 datatube->adcCal = meanAdc;
865 const Identifier tubeId = idHelper.channelID(chId, ml,
l,
t);
866 tubes->
setCalib(std::move(datatube), tubeId, msgStream());
872 return StatusCode::SUCCESS;
◆ 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()
◆ setFilterPassed()
virtual void AthReentrantAlgorithm::setFilterPassed |
( |
bool |
state, |
|
|
const EventContext & |
ctx |
|
) |
| const |
|
inlinevirtualinherited |
◆ sysExecute()
StatusCode AthReentrantAlgorithm::sysExecute |
( |
const EventContext & |
ctx | ) |
|
|
overridevirtualinherited |
Execute an algorithm.
We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.
Definition at line 67 of file AthReentrantAlgorithm.cxx.
69 return Gaudi::Algorithm::sysExecute (ctx);
◆ sysInitialize()
StatusCode AthReentrantAlgorithm::sysInitialize |
( |
| ) |
|
|
overridevirtualinherited |
Override sysInitialize.
Override sysInitialize from the base class.
Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc
Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc
Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.
Reimplemented in InputMakerBase, and HypoBase.
Definition at line 96 of file AthReentrantAlgorithm.cxx.
107 if ( cs.retrieve().isFailure() ) {
109 return StatusCode::SUCCESS;
111 if (cs->regHandle(
this,*
h).isFailure()) {
112 sc = StatusCode::FAILURE;
113 ATH_MSG_ERROR(
"unable to register WriteCondHandle " <<
h->fullKey()
◆ 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_AthRNGSvc
◆ m_checkTubes
Gaudi::Property<bool> MdtCalibDbAlg::m_checkTubes {this, "checkTubes", true,"If true the number of tubes must agree between the conditions DB & geometry"} |
|
private |
◆ m_create_b_field_function
Gaudi::Property<bool> MdtCalibDbAlg::m_create_b_field_function |
|
private |
◆ m_createSlewingFunction
Gaudi::Property<bool> MdtCalibDbAlg::m_createSlewingFunction |
|
private |
◆ m_defaultT0
Gaudi::Property<double> MdtCalibDbAlg::m_defaultT0 {this, "defaultT0", 40., "default T0 value to be used in absence of DB information"} |
|
private |
◆ m_detMgr
◆ m_detStore
◆ m_evtStore
◆ m_extendedExtraObjects
DataObjIDColl AthReentrantAlgorithm::m_extendedExtraObjects |
|
privateinherited |
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Empty if no symlinks were found.
Definition at line 153 of file AthReentrantAlgorithm.h.
◆ m_idHelperSvc
◆ m_idToFixedIdTool
◆ m_MeanCorrectionVsR
Gaudi::Property<std::vector<float> > MdtCalibDbAlg::m_MeanCorrectionVsR {this, "MeanCorrectionVsR", {}} |
|
private |
◆ m_newFormat2020
Gaudi::Property<bool> MdtCalibDbAlg::m_newFormat2020 {this, "NewFormat2020", false, "Use the new calibration data format "} |
|
private |
◆ m_prop_beta
Gaudi::Property<double> MdtCalibDbAlg::m_prop_beta {this, "PropagationSpeedBeta", 1., "Speed of the signal propagation"} |
|
private |
◆ m_r4detMgr
◆ m_randomStream
StringProperty MdtCalibDbAlg::m_randomStream {this, "RandomStream", "MDTCALIBDBALG"} |
|
private |
◆ m_readKeyDCS
◆ m_readKeyRt
◆ m_readKeyTube
◆ m_RNGWrapper
◆ m_RTfileName
StringProperty MdtCalibDbAlg::m_RTfileName |
|
private |
◆ m_rtScale
Gaudi::Property<double> MdtCalibDbAlg::m_rtScale {this, "RTScale", 1., "for simulations: a muliplicitive scale to the drift r"} |
|
private |
◆ m_rtShift
Gaudi::Property<double> MdtCalibDbAlg::m_rtShift {this, "RTShift", 0., "for simulations: maximum RT distortion, in mm"} |
|
private |
◆ m_t0Shift
Gaudi::Property<double> MdtCalibDbAlg::m_t0Shift {this, "T0Shift", 0., "for simulation: common shift of all T0s, in ns"} |
|
private |
◆ m_t0Spread
Gaudi::Property<double> MdtCalibDbAlg::m_t0Spread {this, "T0Spread", 0., "for simulation: sigma for random smeraing of T0s, in ns"} |
|
private |
◆ m_TimeSlewingCorrection
Gaudi::Property<bool> MdtCalibDbAlg::m_TimeSlewingCorrection {this, "TimeSlewingCorrection", false} |
|
private |
◆ m_TsCorrectionT0
Gaudi::Property<double> MdtCalibDbAlg::m_TsCorrectionT0 {this, "TimeSlewCorrectionT0", 0.} |
|
private |
◆ m_UseMLRt
Gaudi::Property<bool> MdtCalibDbAlg::m_UseMLRt {this, "UseMLRt", false, "Enable use of ML-RTs from COOL"} |
|
private |
◆ m_useNewGeo
Gaudi::Property<bool> MdtCalibDbAlg::m_useNewGeo |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
◆ m_writeKey
The documentation for this class was generated from the following files:
Gaudi::Property< bool > m_create_b_field_function
def retrieve(aClass, aKey=None)
static std::string find_calib_file(const std::string &logical_file_name)
std::string replace(std::string s, const std::string &s2, const std::string &s3)
char data[hepevt_bytes_allocation_ATLAS]
void setInversePropSpeed(const float speed)
std::vector< double > tokenizeDouble(const std::string &the_str, std::string_view delimiter)
MuonCalib::MdtFullCalibData::RtRelationPtr RtRelationPtr
Gaudi::Property< double > m_rtScale
Scalar phi() const
phi method
static std::unique_ptr< IRtRelation > getRtRelationLookUp(const std::vector< SamplePoint > &sample_points)
Gaudi::Property< bool > m_useNewGeo
Gaudi::Property< double > m_rtShift
double innerTubeRadius() const
Returns the inner tube radius excluding the aluminium walls.
void setBField(std::unique_ptr< IMdtBFieldCorFunc > &&bField)
Gaudi::Property< double > m_defaultT0
Scalar eta() const
pseudorapidity method
std::vector< int > tokenizeInt(const std::string &the_str, std::string_view delimiter)
bool storeData(const Identifier &mlID, CorrectionPtr corrFuncSet, MsgStream &msg)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
std::vector< std::string > tokenize(const std::string &the_str, std::string_view delimiters)
Splits the string into smaller substrings.
Gaudi::Property< bool > m_createSlewingFunction
Manages the I/O of the Rt realtions from/to file.
std::vector< ALFA_RawData_p1 > t0
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
const MuonGM::MuonDetectorManager * m_detMgr
StringProperty m_randomStream
StatusCode loadTube(const EventContext &ctx, MuonCalib::MdtCalibDataContainer &writeCdo) const
unsigned int numMultilayers() const
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool msgLvl(const MSG::Level lvl) const
ServiceHandle< IAthRNGSvc > m_AthRNGSvc
static std::unique_ptr< MuonCalib::RtResolutionLookUp > getRtResolutionInterpolation(const std::vector< MuonCalib::SamplePoint > &sample_points)
#define ATH_MSG_VERBOSE(x)
void SetTmaxDiff(const double d)
set the difference in total drift time betwene the two multilayers (ML1 - ML2)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
const std::string & key() const
Return the StoreGate ID for the referenced object.
StatusCode legacyTubePayloadToJSON(const coral::AttributeList &attr, nlohmann::json &json) const
bool empty() const
Test if the key is blank.
Gaudi::Property< double > m_TsCorrectionT0
StatusCode loadRt(const EventContext &ctx, MuonCalib::MdtCalibDataContainer &writeCdo) const
class which holds the full set of calibration constants for a given tube
void set_error(const double merror)
Gaudi::Property< bool > m_TimeSlewingCorrection
std::optional< double > getInnerTubeRadius(const Identifier &id) const
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
double par(unsigned int index) const
virtual void setOwner(IDataHandleHolder *o)=0
SG::WriteCondHandleKey< MuonCalib::MdtCalibDataContainer > m_writeKey
unsigned int numLayers() const
void set_x2(const double mx2)
set the error of the x2 coordinate sample point to merror
Gaudi::Property< double > m_prop_beta
TubeContainerPtr tubeCalib
double x1() const
< get the x1 coordinate of the sample point
AthReentrantAlgorithm()
Default constructor:
StringProperty m_RTfileName
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
Gaudi::Property< bool > m_UseMLRt
bool readBlobAsString(const coral::Blob &, std::string &)
::StatusCode StatusCode
StatusCode definition for legacy code.
Helper struct to cache all dcs constants in a common place of the memory.
SG::ReadCondHandleKey< MdtCondDbData > m_readKeyDCS
std::vector< double > ParVec
StatusCode legacyRtPayloadToJSON(const coral::AttributeList &attr, nlohmann::json &json) const
Parses the legacy payload for the RT functions to a json format.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
unsigned int numTubes() const
Gaudi::Property< bool > m_newFormat2020
Gaudi::Property< double > m_t0Spread
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
double innerTubeRadius() const
Returns the inner tube radius.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
const MuonGMR4::MuonDetectorManager * m_r4detMgr
@ TIME_SLEWING_CORRECTION_APPLIED
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyRt
double x2() const
get the error on the x2 coordinate of the sample point
virtual StatusCode sysInitialize() override
Override sysInitialize.
StatusCode declareDependency(const EventContext &ctx, SG::WriteCondHandle< MuonCalib::MdtCalibDataContainer > &writeHandle) const
StatusCode initialize(bool used=true)
constexpr unsigned int numLayers()
const MdtFullCalibData * getCalibData(const Identifier &measId, MsgStream &msg) const
Returns the calibration data associated with this station
#define THROW_EXCEPTION(MESSAGE)
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
void set_x1(const double mx1)
set the x2 coordinate of the sample point to mx2
bool setCalib(SingleTubeCalibPtr val, const Identifier &tubeId, MsgStream &msg)
set the calibration constants of a single tube
SG::ReadCondHandleKey< CondAttrListCollection > m_readKeyTube
def time(flags, cells_name, *args, **kw)
#define ATH_MSG_WARNING(x)
ChanAttrListMap::const_iterator const_iterator
Gaudi::Property< std::vector< float > > m_MeanCorrectionVsR
Gaudi::Property< bool > m_checkTubes
only needed to retrieve information on number of tubes etc. (no alignment needed)
StatusCode defaultT0s(MuonCalib::MdtCalibDataContainer &writeCdoTube) const
ATHRNG::RNGWrapper * m_RNGWrapper
Gaudi::Property< double > m_t0Shift
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
unsigned int nPar() const
std::vector< Identifier >::const_iterator const_id_iterator
StatusCode defaultRt(MuonCalib::MdtCalibDataContainer &writeCdoRt, LoadedRtMap &loadedRts) const
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
bool hasDataForChannel(const Identifier &measId, MsgStream &msg) const
Checks whether a calibration data object is already present.
void setSlewing(std::unique_ptr< IMdtSlewCorFunc > &&slew)
static EventIDRange infiniteTime()
Produces an EventIDRange that is inifinite in Time and invalid in RunLumi.
ToolHandle< MuonCalib::IIdToFixedIdTool > m_idToFixedIdTool
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
std::vector< double > DataVec
std::map< Identifier, RtRelationPtr > LoadedRtMap
void addDependency(const EventIDRange &range)