|
ATLAS Offline Software
|
#include <MdtCalibOutputDbSvc.h>
Service which holds the results of the calibration algorithms. In its initial version the class can only write out the calibration to text files as it is currently performed in the calibration algorithms. The location of the output file is given in the job options file.
The name of the service is MdtCalibOutputDbSvc. MdtCalibOutputDbSvc is a singleton.
- Author
- Olive.nosp@m.r.Ko.nosp@m.rtner.nosp@m.@CER.nosp@m.N.CH
- Date
- 07.10.2006
Definition at line 46 of file MdtCalibOutputDbSvc.h.
◆ MdtCalibOutputDbSvc()
MdtCalibOutputDbSvc::MdtCalibOutputDbSvc |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
svc_locator |
|
) |
| |
◆ ~MdtCalibOutputDbSvc()
virtual MdtCalibOutputDbSvc::~MdtCalibOutputDbSvc |
( |
| ) |
|
|
virtualdefault |
◆ AddRunNumber()
void MdtCalibOutputDbSvc::AddRunNumber |
( |
int |
run_number | ) |
|
add a run number to the iov interval.
The interval will begin with the smallest run number, and end with the largest run number
Definition at line 108 of file MdtCalibOutputDbSvc.cxx.
◆ create_default_resolution()
Definition at line 282 of file MdtCalibOutputDbSvc.cxx.
289 std::vector<SamplePoint> res_points(100);
290 for (
unsigned int i = 0;
i < 100;
i++) {
291 double di =
static_cast<double>(
i);
293 double t_old = old_rel->
tLower() + (di / 100.0) * (old_rel->
tUpper() - old_rel->
tLower());
294 res_points[
i].set_x1(t_new);
296 if (res_points[
i].
x2() > 100 &&
i > 0) res_points[
i].set_x2(res_points[
i - 1].
x2());
297 res_points[
i].set_error(1);
305 double alpha[9] = {0.31476, -0.217661, 0.118337, -0.0374466, 0.00692553, -0.000764969, 4.97305E-05, -1.75457E-06, 2.59E-08};
311 par_vec[0] = rt->
tLower();
313 for (
unsigned int i = 0;
i < 100;
i++) {
317 for (
int l = 0;
l < 9;
l++) { resol = resol + alpha[
l] *
std::pow(
r,
l); }
318 par_vec[
i + 2] = resol;
322 par_vec[0] = rt->
tLower();
327 m_resolution = std::make_shared<MuonCalib::RtResolutionLookUp>(par_vec);
◆ finalize()
StatusCode MdtCalibOutputDbSvc::finalize |
( |
| ) |
|
|
virtual |
finalize method as required by the base class; the finalize method calls the method "save_calibration_results"
Definition at line 97 of file MdtCalibOutputDbSvc.cxx.
100 return StatusCode::SUCCESS;
◆ initialize()
StatusCode MdtCalibOutputDbSvc::initialize |
( |
| ) |
|
|
virtual |
initialize method as required by the base class
Definition at line 65 of file MdtCalibOutputDbSvc.cxx.
89 return StatusCode::SUCCESS;
◆ interfaceID()
static const InterfaceID& MdtCalibOutputDbSvc::interfaceID |
( |
| ) |
|
|
inlinestatic |
Methods required as defined in the base class "Service".
interface
Definition at line 58 of file MdtCalibOutputDbSvc.h.
59 static const InterfaceID IID_IMdtCalibOutputDbSvc(
"MdtCalibOutputDbSvc", 1, 0);
60 return IID_IMdtCalibOutputDbSvc;
◆ memorize() [1/2]
memorize the result of a particular calibration (given in result) for the calibration region "regionKey"; previous calibration result of the same type (e.g.
r-t relation calibration) will be overwritten internally if overwrite is true; the calibration which is memorized will only be saved for ever after a call to the method "saved_calibration_results"; method return true in case of success, false otherwise
Definition at line 118 of file MdtCalibOutputDbSvc.cxx.
◆ memorize() [2/2]
memorize the result of a particular calibration (given in result) for the calibration region "regionKey"; a previous calibration result of the same type (e.g.
r-t relation calibration) will be overwritten internally if overwrite is true; the calibration which is memorized will only be saved for ever after a call to the method "saved_calibration_results"; method return true in case of success, false otherwise; the user can pass a pointer to a resolution function which should be associated with the calibration output
Definition at line 130 of file MdtCalibOutputDbSvc.cxx.
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ postprocess_t0s()
Definition at line 228 of file MdtCalibOutputDbSvc.cxx.
231 if (
id.NMultilayers() < 0)
return t0;
233 for (
int i = 0;
i <
id.NMultilayers();
i++) {
234 if (n_layers <
id.NLayers(
i)) n_layers =
id.NLayers(
i);
244 bool has_bad_fits(
false);
245 for (
unsigned int ml = 0; ml <
t0->numMultilayers(); ml++) {
246 if (
static_cast<int>(ml) ==
id.NMultilayers())
break;
247 for (
unsigned int ly = 0; ly <
t0->numLayers(); ly++) {
248 if (
static_cast<int>(ly) == n_layers)
break;
249 for (
unsigned int tb = 0;
tb <
t0->numTubes();
tb++) {
250 if (
static_cast<int>(
tb) ==
n_tubes)
break;
254 if (
t0->getCalib(ml, ly,
tb)->statusCode == 0) {
256 mean_t0 +=
t0->getCalib(ml, ly,
tb)->t0;
268 for (
unsigned int ly = 0; ly < new_t0->
numLayers(); ly++) {
270 if (
t0->getCalib(ml, ly,
tb)->statusCode != 0) {
◆ queryInterface()
StatusCode MdtCalibOutputDbSvc::queryInterface |
( |
const InterfaceID & |
riid, |
|
|
void ** |
ppvUnknown |
|
) |
| |
|
virtual |
method required by the base class which is need to obtain a pointer to the service in the standard way
Definition at line 50 of file MdtCalibOutputDbSvc.cxx.
54 return AthService::queryInterface(riid, ppvUnknown);
57 return StatusCode::SUCCESS;
◆ reset()
void MdtCalibOutputDbSvc::reset |
( |
| ) |
|
◆ saveCalibrationResults()
StatusCode MdtCalibOutputDbSvc::saveCalibrationResults |
( |
| ) |
|
|
private |
write out all memorized results to text files (location specified in the job options) which can be uploaded to the calibration database; method returns true in case of success, false otherwise
Definition at line 142 of file MdtCalibOutputDbSvc.cxx.
143 if (!
m_results)
return StatusCode::SUCCESS;
148 ATH_MSG_ERROR(
"Null pointer to the read MuonDetectorManager conditions object");
149 return StatusCode::FAILURE;
168 if (!the_id.InitializeGeometry(
m_idHelperSvc->mdtIdHelper(), MuonDetMgr)) {
169 ATH_MSG_ERROR(
"Faild to get geometry for " << the_id.regionId());
173 std::shared_ptr<const T0CalibrationOutput> t0_output = std::dynamic_pointer_cast<const T0CalibrationOutput>(
m_results);
174 if (t0_output !=
nullptr) {
177 if (!t0_output->
GetMap().empty()) {
178 std::map<NtupleStationId, MdtTubeFitContainer *>::const_iterator mit(t0_output->
GetMap().find(
region_id));
179 if (mit != t0_output->
GetMap().end()) { new_t0s = mit->second; }
181 if (!new_t0s)
continue;
185 if (
sc.isFailure())
return sc;
189 bool real_resolution(
true), real_rt(
true);
190 std::shared_ptr<const RtCalibrationOutput> rt_output = std::dynamic_pointer_cast<const RtCalibrationOutput>(
m_results);
192 if (rt_output->
rt()) {
193 if (!rt_output->
rt()->HasTmaxDiff()) {
195 if (old_rel && old_rel->HasTmaxDiff()) {
196 std::const_pointer_cast<IRtRelation>(rt_output->
rt())->SetTmaxDiff(old_rel->
GetTmaxDiff());
203 real_resolution =
false;
209 if (
sc.isFailure())
return sc;
216 return StatusCode::SUCCESS;
◆ m_calib_output_tool
◆ m_DetectorManagerKey
Initial value:{this, "DetectorManagerKey", "MuonDetectorManager",
"Key of input MuonDetectorManager condition data"}
Definition at line 115 of file MdtCalibOutputDbSvc.h.
◆ m_flat_default_resolution
double MdtCalibOutputDbSvc::m_flat_default_resolution |
|
private |
◆ m_force_default_resolution
bool MdtCalibOutputDbSvc::m_force_default_resolution |
|
private |
◆ m_idHelperSvc
◆ m_input_service
◆ m_iov_end
int MdtCalibOutputDbSvc::m_iov_end |
|
private |
◆ m_iov_start
int MdtCalibOutputDbSvc::m_iov_start |
|
private |
◆ m_postprocess_calibration
bool MdtCalibOutputDbSvc::m_postprocess_calibration |
|
private |
◆ m_reg_sel_svc
◆ m_region_ids
◆ m_resolution
◆ m_results
The documentation for this class was generated from the following files:
bool m_postprocess_calibration
virtual double resolution(double t, double bgRate=0.0) const =0
returns resolution for a give time and background rate
void setImplementation(const std::string &impl)
set the name of the implementation used to fill this class
ToolHandle< MuonCalib::ICalibrationIOTool > m_calib_output_tool
ServiceHandle< MdtCalibInputSvc > m_input_service
ServiceHandle< RegionSelectionSvc > m_reg_sel_svc
void setGroupBy(const std::string &group_by)
std::vector< ALFA_RawData_p1 > t0
unsigned int numMultilayers() const
static const InterfaceID & interfaceID()
Methods required as defined in the base class "Service".
const SingleTubeCalib * getCalib(const Identifier &tubeId) const
return calibration constants of a single tube
bool setCalib(SingleTubeCalib &&val, const Identifier &tubeId, MsgStream &msg)
set the calibration constants of a single tube
unsigned int numLayers() const
std::shared_ptr< const MuonCalib::IMdtCalibrationOutput > m_results
::StatusCode StatusCode
StatusCode definition for legacy code.
std::vector< double > ParVec
std::map< NtupleStationId, MdtTubeFitContainer * > & GetMap()
virtual double tUpper() const =0
Returns the upper time covered by the r-t.
unsigned int numTubes() const
static RtResolutionLookUp getRtResolutionLookUp(const std::vector< SamplePoint > &sample_points)
double m_flat_default_resolution
virtual double radius(double t) const =0
returns drift radius for a given time
const MdtTubeFitContainer * t0s() const
std::vector< MuonCalib::NtupleStationId > m_region_ids
std::shared_ptr< const IRtRelation > rt() const
access to private attributes
StatusCode initialize(bool used=true)
generic interface for a resolution function
virtual double tLower() const =0
Returns the lower time covered by the r-t.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
void create_default_resolution(const std::shared_ptr< const MuonCalib::IRtRelation > &rt)
StatusCode saveCalibrationResults()
write out all memorized results to text files (location specified in the job options) which can be up...
Holds single-tube full calibration information of one chamber.
bool setFit(SingleTubeFit &&val, const Identifier &tubeId, MsgStream &log)
set the calibration constants of a single tube
double GetTmaxDiff() const
return the difference in total dirft time between the two multilayers (ML1 - ML2)
std::shared_ptr< const MuonCalib::IRtResolution > m_resolution
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
generic interface for a rt-relation
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
static const MuonCalib::MdtTubeFitContainer * postprocess_t0s(const MuonCalib::MdtTubeFitContainer *new_t0, const MuonCalib::NtupleStationId &id)
bool m_force_default_resolution