|
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;
118 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 147 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
153 return StatusCode::FAILURE;
166 for (
unsigned int n = 0;
n <
rts.nRts(); ++
n) {
167 std::unique_ptr<MuonCalib::RtDataFromFile::RtRelation> rt(
rts.getRt(
n));
174 if (
times.size() < 2) {
176 return StatusCode::FAILURE;
179 if (
times.size() != radii.size() ||
times.size() != reso.size()) {
181 return StatusCode::FAILURE;
184 double t_min =
times[0];
185 double bin_size =
times[1] - t_min;
188 return StatusCode::FAILURE;
194 rtPars.push_back(t_min);
195 rtPars.push_back(bin_size);
198 rtPars.insert(rtPars.end(), radii.begin(), radii.end());
204 resoPars.insert(resoPars.end(), reso.begin(), reso.end());
209 std::shared_ptr<MuonCalib::IRtRelation> rtRel{std::make_unique<RtRelationLookUp>(rtPars)};
210 std::shared_ptr<MuonCalib::IRtResolution> resoRel{std::make_unique<RtResolutionLookUp>(resoPars)};
220 RtRelationPtr MdtRt = std::make_unique<MuonCalib::MdtRtRelation>(rtRel, resoRel, 0.);
222 for(
auto itr = idHelper.detectorElement_begin();
223 itr!= idHelper.detectorElement_end();++itr){
225 if (writeCdo.hasDataForChannel(detElId, msgStream())) {
226 const MdtFullCalibData* dataObj = writeCdo.getCalibData(detElId, msgStream());
234 if (idHelper.multilayer(detElId) == 2) {
235 if (writeCdo.granularity() != RegionGranularity::OnePerMultiLayer)
continue;
236 const Identifier firstML = idHelper.multilayerID(detElId, 1);
237 if (writeCdo.hasDataForChannel(firstML, msgStream())) {
238 const MdtFullCalibData* dataObj = writeCdo.getCalibData(firstML, msgStream());
246 if (!writeCdo.storeData(detElId, storeMe, msgStream())) {
248 return StatusCode::FAILURE;
252 loadedRts[detElId] = MdtRt;
258 int npoints = rtRel->nPar() - 2;
260 for (
int ipt = 0; ipt <
npoints; ++ipt) {
261 double t = t_min + ipt * bin_size;
262 ATH_MSG_VERBOSE(
" " << ipt <<
" " <<
t <<
" " << rtRel->radius(
t) <<
" " << resoRel->resolution(
t));
269 return StatusCode::SUCCESS;
◆ defaultT0s()
Definition at line 597 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
606 for (;
it != it_end; ++
it) {
608 if (writeCdo.hasDataForChannel(*
it, msgStream())) {
617 if (!writeCdo.storeData(*
it, tubes, msgStream()))
return StatusCode::FAILURE;
623 unsigned int nlayers = tubes->
numLayers();
624 unsigned int ntubes = tubes->
numTubes();
625 int size = nml * nlayers * ntubes;
628 <<
" size " <<
size <<
" ml " << nml <<
" l " << nlayers <<
" t " << ntubes);
629 for (
unsigned int ml = 1; ml <= nml; ++ml) {
630 for (
unsigned int l = 1;
l <= nlayers; ++
l) {
631 for (
unsigned int t = 1;
t <= ntubes; ++
t) {
636 data.inversePropSpeed = inversePropSpeed;
642 return StatusCode::SUCCESS;
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode MdtCalibDbAlg::execute |
( |
const EventContext & |
ctx | ) |
const |
|
overridevirtual |
Definition at line 120 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
123 if (writeHandle.isValid()) {
124 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
125 <<
". In theory this should not be called, but may happen"
126 <<
" if multiple concurrent events are being processed out of order.");
127 return StatusCode::SUCCESS;
134 gran = RegionGranularity::OneRt;
136 ATH_MSG_DEBUG(
"Save one set of calibration constants per multi layer");
137 gran = RegionGranularity::OnePerMultiLayer;
138 }
else ATH_MSG_DEBUG(
"Save one set of calibration constants per chamber");
139 std::unique_ptr<MuonCalib::MdtCalibDataContainer> writeCdo = std::make_unique<MuonCalib::MdtCalibDataContainer>(
m_idHelperSvc.get(), gran);
143 ATH_CHECK(writeHandle.record(std::move(writeCdo)));
144 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 876 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
880 std::vector<Double_t>
x(sample_points.size(),0);
881 std::vector<Double_t>
y(sample_points.size(),0);
883 for (
unsigned int i = 0;
i < sample_points.size();
i++) {
884 x[
i] = sample_points[
i].x1();
885 y[
i] = sample_points[
i].x2();
887 TSpline3 sp(
"Rt Res Tmp",
x.data(),
y.data(), sample_points.size());
891 unsigned int nb_points(100);
892 std::vector<double> res_param(nb_points + 2);
893 Double_t
bin_width = (
x[sample_points.size() - 1] -
x[0]) /
static_cast<Double_t
>(nb_points);
897 for (
unsigned int k = 0;
k < nb_points;
k++) {
899 res_param[
k + 2] = sp.Eval(xx);
900 if (std::isnan(res_param[
k + 2])) {
901 TFile outf(
"kacke.root",
"RECREATE");
904 "encountered nan element");
907 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, SCT_CablingCondAlgFromCoraCool, SCT_ReadCalibDataTestAlg, SCT_CablingCondAlgFromText, InDet::SiSPGNNTrackMaker, 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 290 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
291 std::string
data{}, delim{};
296 return StatusCode::FAILURE;
300 data = *(
static_cast<const std::string *
>((attr[
"data"]).addressOfData()));
306 return StatusCode::FAILURE;
312 unsigned int numPoints{0};
315 channel[
"appliedRT"] = rt_ts_applied;
320 if(tokensHeader.size()< 2){
321 ATH_MSG_FATAL(
"Failed to deduce extract number of points & calib Identifier from "<<
header);
322 return StatusCode::FAILURE;
324 unsigned int calibId = tokensHeader[0];
325 numPoints = tokensHeader[1];
329 return StatusCode::FAILURE;
333 ATH_MSG_WARNING(
"The translation from the calibration ID with station: "
334 <<
id.stationNameString()<<
"("<<
id.
stationName()<<
") "
335 <<
" eta:"<<
id.
eta()<<
" phi: "<<
id.
phi());
340 channel[
"ml"] = idHelper.multilayer(athenaId);
341 channel[
"layer"] = idHelper.tubeLayer(athenaId);
342 channel[
"tube"] = idHelper.tube(athenaId);
346 std::vector<double> radii{},
times{}, resos{};
347 radii.reserve(numPoints);
348 times.reserve(numPoints);
349 resos.reserve(numPoints);
353 for (
unsigned int k = 0 ;
k < dataPoints.size(); ++
k) {
354 const double value = dataPoints[
k];
357 radii.push_back(
value);
363 resos.push_back(
value);
370 if (radii.size() != numPoints ||
371 times.size() != numPoints ||
372 resos.size() != numPoints) {
373 ATH_MSG_FATAL(
"Payload "<<
payload<<
" does not lead to the expected number of points "<<numPoints<<
" vs. "<<dataPoints.size());
374 return StatusCode::FAILURE;
376 channel[
"radii"] = std::move(radii);
378 channel[
"resolutions"] = std::move(resos);
380 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 646 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
652 return StatusCode::FAILURE;
656 data = *(
static_cast<const std::string *
>((attr[
"data"]).addressOfData()));
661 return StatusCode::FAILURE;
670 const std::string stName =
header.substr(2,3);
671 int eta{0},
phi{0}, nTubes{0};
674 const std::vector<std::string> headerTokens =
tokenize(
header,
",");
677 nTubes =
atoi(headerTokens[5]);
683 static std::atomic<bool> idWarningPrinted =
false;
684 if (!idWarningPrinted) {
686 <<
" is invalid. Skipping");
687 idWarningPrinted.store(
true, std::memory_order_relaxed);
689 return StatusCode::SUCCESS;
693 channel[
"appliedT0"] = t0_ts_applied;
699 std::vector<double> tzeros{}, meanAdcs{};
700 std::vector<int> statusCodes{};
703 for (
unsigned int k = 0;
k < payLoadData.size(); ++
k){
704 const double value = payLoadData[
k];
707 tzeros.push_back(
value);
710 statusCodes.push_back(
value);
713 meanAdcs.push_back(
value);
719 if (statusCodes.size() != tzeros.size() ||
720 statusCodes.size() != meanAdcs.size() ||
721 statusCodes.empty()) {
723 return StatusCode::FAILURE;
728 const int numMl = idHelper.numberOfMultilayers(chamID);
729 const Identifier secondMlID = idHelper.multilayerID(chamID, numMl);
730 const int tubesPerLay =
std::max(idHelper.tubeMax(chamID), idHelper.tubeMax(secondMlID));
731 const int numLayers =
std::max(idHelper.tubeLayerMax(chamID), idHelper.tubeLayerMax(secondMlID));
733 ATH_MSG_FATAL(
"Calibration database differs in terms of number of tubes for chamber "
735 <<
" vs. observed "<<nTubes);
736 return StatusCode::FAILURE;
739 for (
unsigned int k = 0;
k < tzeros.size(); ++
k) {
741 channelData[
"ml"] = ml;
742 channelData[
"layer"] =
layer;
743 channelData[
"tube"] =
tube;
744 channelData[
"t0"] = tzeros[
k];
745 channelData[
"meanAdc"] = meanAdcs[
k];
746 channelData[
"status"] = statusCodes[
k];
748 if (
tube > tubesPerLay){
756 calibData.push_back(std::move(channelData));
758 channel[
"calibConstants"] = std::move(calibData);
760 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 383 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
388 if (!readHandleRt.isValid()) {
390 return StatusCode::FAILURE;
398 itr != readHandleRt->end(); ++itr) {
405 return StatusCode::FAILURE;
409 data = *(
static_cast<const std::string *
>((atr[
"data"]).addressOfData()));
413 for (
auto &
it :
yy.items()) {
415 rtCalibJson.push_back(yx);
422 itr != readHandleRt->end(); ++itr) {
429 for (
const auto&
payload : rtCalibJson) {
430 const bool rt_ts_applied =
payload[
"appliedRT"];
432 const std::string stName =
payload[
"station"];
436 std::optional<double> innerTubeRadius =
getInnerTubeRadius(idHelper.multilayerID(athenaId, 1));
437 if (!innerTubeRadius)
continue;
440 const std::vector<double> radii =
payload[
"radii"];
442 const std::vector<double> resolutions =
payload[
"resolutions"];
455 std::vector<MuonCalib::SamplePoint> tr_points{}, ts_points{};
460 for (
unsigned int k = 0;
k < radii.size(); ++
k) {
466 radius = oldradius + rshift;
467 ATH_MSG_DEBUG(
"DEFORM RT: old radius " << oldradius <<
" new radius " <<
radius <<
" shift " << rshift
482 float sigma = resolutions[
k];
486 if (tr_point.
x2() < -99) {
487 multilayer_tmax_diff = tr_point.
x1();
488 }
else if (
k == 0 || (tr_points[
k - 1].
x1() < tr_point.
x1() && tr_points[
k - 1].x2() < tr_point.
x2())) {
489 tr_points.push_back(tr_point);
490 ts_points.push_back(ts_point);
495 if (ts_points.size() < 3) {
497 return StatusCode::FAILURE;
501 float sign(rt_ts_applied ? -1.0 : 1.0);
503 for (
auto & tr_point : tr_points) {
504 int slice_number =
static_cast<int>(std::floor(tr_point.
x2() / slice_width));
505 if (slice_number < 0) slice_number = 0;
517 ATH_MSG_VERBOSE(point.x1() <<
"|" << point.x2() <<
"|" << point.error());
525 if (!reso || !rt) {
continue; }
527 if (rt->
par(1) == 0.) {
531 return StatusCode::FAILURE;
534 if (multilayer_tmax_diff > -8e8) { rt->
SetTmaxDiff(multilayer_tmax_diff); }
536 RtRelationPtr rt_rel = std::make_unique<MuonCalib::MdtRtRelation>(std::move(rt), std::move(reso), 0.);
538 if (!writeCdo.
storeData(athenaId ,rt_rel, msgStream()))
return StatusCode::FAILURE;
540 loadedRtRel[athenaId] = rt_rel;
545 if (loadedRtRel.empty()) {
546 return StatusCode::SUCCESS;
549 ATH_MSG_DEBUG(
"Initializing " << loadedRtRel.size()<<
" b-field functions");
554 if (readCondHandleDb->hasDCS()) {
555 condDbData = readCondHandleDb.cptr();
557 ATH_MSG_INFO(
"Do not retrieve the HV from DCS. Fall back to 2730 & 3080");
562 for (
const auto& [athenaId, rtRelation] : loadedRtRel) {
563 CorrectionPtr corrFuncSet = std::make_unique<MuonCalib::MdtCorFuncSet>();
566 std::vector<double> corr_params(2);
567 bool loadDefault{
false};
572 if (corr_params[0] < std::numeric_limits<float>::epsilon()) {
576 }
else loadDefault =
true;
579 corr_params[0] = 2730.0;
581 corr_params[0] = 3080.0;
584 corr_params[1] = 0.11;
585 corrFuncSet->
setBField(std::make_unique<MuonCalib::BFieldCorFunc>(
"medium", corr_params, rtRelation->rt()));
590 if (!writeCdo.
storeData(athenaId, corrFuncSet, msgStream()))
return StatusCode::FAILURE;
593 return StatusCode::SUCCESS;
◆ loadTube()
Definition at line 762 of file MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCalibDbAlg.cxx.
772 itr != readHandleTube->end(); ++itr) {
779 return StatusCode::FAILURE;
783 data = *(
static_cast<const std::string *
>((atr[
"data"]).addressOfData()));
787 for (
auto &
it :
yy.items()) {
789 t0CalibJson.push_back(yx);
796 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"];
865 datatube.
adcCal = meanAdc;
866 const Identifier tubeId = idHelper.channelID(chId, ml,
l,
t);
867 tubes->
setCalib(std::move(datatube), tubeId, msgStream());
873 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)
float t0
< relative t0 in chamber (ns)
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]
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
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)
const std::string & key() const
Return the StoreGate ID for the referenced object.
StatusCode legacyTubePayloadToJSON(const coral::AttributeList &attr, nlohmann::json &json) const
#define THROW_EXCEPTION(MSG)
bool empty() const
Test if the key is blank.
Gaudi::Property< double > m_TsCorrectionT0
bool setCalib(SingleTubeCalib &&val, const Identifier &tubeId, MsgStream &msg)
set the calibration constants of a single tube
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
static RtRelationLookUp getRtRelationLookUp(const std::vector< SamplePoint > &sample_points)
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
float adcCal
quality flag for the SingleTubeCalib constants: 0 all ok, 1 no hits found, 2 too few hits,...
@ 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
float inversePropSpeed
multiplicative correction factor for ADC measurement w.r.t.
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
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
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)