ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalib::MuonCalibDefaultCalibrationSource Class Reference

#include <MuonCalibDefaultCalibrationSource.h>

Inheritance diagram for MuonCalib::MuonCalibDefaultCalibrationSource:
Collaboration diagram for MuonCalib::MuonCalibDefaultCalibrationSource:

Public Member Functions

 MuonCalibDefaultCalibrationSource (const std::string &t, const std::string &n, const IInterface *p)
 constructor
virtual ~MuonCalibDefaultCalibrationSource ()
StatusCode initialize ()
 initialize
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
bool InstertCalibration (CoolInserter *inserter, bool store_t0, bool store_rt)
 insert calibration
virtual void SetIOV (int &, int &) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
 interface method

Protected Member Functions

bool insert_calibration (bool store_t0, bool store_rt)
 insert calibration
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

CoolInserterm_inserter = nullptr

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode initialize_regions (const std::vector< std::string > &reg_str, std::vector< std::unique_ptr< RegionSelectorBase > > &reg)
void initialize_creation_flags (const std::vector< bool > &ts_applied, const std::vector< bool > &bf_applied, unsigned int n_regions, std::vector< unsigned int > &flags)
StatusCode load_rt_files ()
bool store_t0_fun ()
bool store_rt_fun ()
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::vector< std::string > m_t0_region_str
std::vector< float > m_t0
std::vector< bool > m_time_slewing_applied_t0
std::vector< bool > m_bfield_applied_t0
std::vector< std::string > m_rt_region_str
std::vector< std::string > m_rt_files
std::vector< bool > m_time_slewing_applied_rt
std::vector< bool > m_bfield_applied_rt
std::vector< unsigned int > m_creation_flags_t0
std::vector< unsigned int > m_creation_flags_rt
std::vector< std::unique_ptr< RegionSelectorBase > > m_t0_regions
std::vector< std::unique_ptr< RegionSelectorBase > > m_rt_regions
std::vector< std::map< int, SamplePoint > > m_rt_points
ServiceHandle< RegionSelectionSvcm_reg_sel_svc {this, "RegionSelectionSvc", "RegionSelectionSvc"}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 23 of file MuonCalibDefaultCalibrationSource.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuonCalibDefaultCalibrationSource()

MuonCalib::MuonCalibDefaultCalibrationSource::MuonCalibDefaultCalibrationSource ( const std::string & t,
const std::string & n,
const IInterface * p )

constructor

Definition at line 25 of file MuonCalibDefaultCalibrationSource.cxx.

25 :
26 AthAlgTool(t, n, p) {
27 declareInterface<IMuonCalibConditionsSource>(this);
28 declareProperty("T0Regions", m_t0_region_str);
29 declareProperty("T0", m_t0);
30 declareProperty("TimeSlewingAppliedT0", m_time_slewing_applied_t0);
31 declareProperty("BFieldCorrectionAppliedT0", m_bfield_applied_t0);
32 declareProperty("RtRegions", m_rt_region_str);
33 declareProperty("RtFiles", m_rt_files);
34 declareProperty("TimeSlewingAppliedRt", m_time_slewing_applied_rt);
35 declareProperty("BFieldCorrectionAppliedRt", m_bfield_applied_rt);
36 }
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~MuonCalibDefaultCalibrationSource()

MuonCalib::MuonCalibDefaultCalibrationSource::~MuonCalibDefaultCalibrationSource ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

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

◆ initialize()

StatusCode MuonCalib::MuonCalibDefaultCalibrationSource::initialize ( )

initialize

Definition at line 38 of file MuonCalibDefaultCalibrationSource.cxx.

38 {
39 // get region selection service
40 ATH_CHECK(m_reg_sel_svc.retrieve());
41 // check matching lengths
42 if (m_t0_region_str.size() != m_t0.size()) {
43 ATH_MSG_FATAL("Configuration error: T0Regions and T0 have different size!");
44 return StatusCode::FAILURE;
45 }
46 if (m_rt_region_str.size() != m_rt_files.size()) {
47 ATH_MSG_FATAL("Configuration error: RtRegions and RtFiles have different size!");
48 return StatusCode::FAILURE;
49 }
50 // initialize regions
55 // load rt files
57 return StatusCode::SUCCESS;
58 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
std::vector< std::unique_ptr< RegionSelectorBase > > m_t0_regions
std::vector< std::unique_ptr< RegionSelectorBase > > m_rt_regions
StatusCode initialize_regions(const std::vector< std::string > &reg_str, std::vector< std::unique_ptr< RegionSelectorBase > > &reg)
void initialize_creation_flags(const std::vector< bool > &ts_applied, const std::vector< bool > &bf_applied, unsigned int n_regions, std::vector< unsigned int > &flags)

◆ initialize_creation_flags()

void MuonCalib::MuonCalibDefaultCalibrationSource::initialize_creation_flags ( const std::vector< bool > & ts_applied,
const std::vector< bool > & bf_applied,
unsigned int n_regions,
std::vector< unsigned int > & flags )
private

Definition at line 79 of file MuonCalibDefaultCalibrationSource.cxx.

81 {
82 for (unsigned int i = 0; i < n_regions; i++) {
83 unsigned int flag(0);
84 if (i < ts_applied.size() && ts_applied[i]) { flag |= MuonCalib::TIME_SLEWING_CORRECTION_APPLIED; }
85 if (i < bf_applied.size() && bf_applied[i]) { flag |= MuonCalib::B_FIELD_CORRECTIONS_APPLIED; }
86 flags.push_back(flag);
87 }
88 }
bool flag
Definition master.py:29

◆ initialize_regions()

StatusCode MuonCalib::MuonCalibDefaultCalibrationSource::initialize_regions ( const std::vector< std::string > & reg_str,
std::vector< std::unique_ptr< RegionSelectorBase > > & reg )
private

Definition at line 66 of file MuonCalibDefaultCalibrationSource.cxx.

67 {
68 for (const std::string &reg : reg_str) {
69 std::unique_ptr<RegionSelectorBase> r = RegionSelectorBase::GetRegion(reg);
70 if (!r) {
71 ATH_MSG_FATAL("Error in region " << reg);
72 return StatusCode::FAILURE;
73 }
74 reg_vec.emplace_back(std::move(r));
75 }
76 return StatusCode::SUCCESS;
77 }
static std::unique_ptr< RegionSelectorBase > GetRegion(const std::string &input)
create a region from a string
int r
Definition globals.cxx:22

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

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.

◆ insert_calibration()

bool MuonCalib::MuonCalibDefaultCalibrationSource::insert_calibration ( bool store_t0,
bool store_rt )
protectedvirtual

insert calibration

Implements MuonCalib::IMuonCalibConditionsSource.

Definition at line 60 of file MuonCalibDefaultCalibrationSource.cxx.

60 {
61 if (store_t0 && !store_t0_fun()) { return false; }
62 if (store_rt && !store_rt_fun()) { return false; }
63 return true;
64 }

◆ InstertCalibration()

bool MuonCalib::IMuonCalibConditionsSource::InstertCalibration ( CoolInserter * inserter,
bool store_t0,
bool store_rt )
inlineinherited

insert calibration

Definition at line 24 of file IMuonCalibConditionsSource.h.

24 {
25 m_inserter = inserter;
26 return insert_calibration(store_t0, store_rt);
27 }
virtual bool insert_calibration(bool store_t0, bool store_rt)=0

◆ interfaceID()

const InterfaceID & MuonCalib::IMuonCalibConditionsSource::interfaceID ( )
inlinestaticinherited

interface method

Definition at line 22 of file IMuonCalibConditionsSource.h.

static const InterfaceID IID_IMuonCalibConditionsSource("MuonCalib::IMuonCalibConditionsSource", 1, 0)

◆ load_rt_files()

StatusCode MuonCalib::MuonCalibDefaultCalibrationSource::load_rt_files ( )
inlineprivate

Definition at line 90 of file MuonCalibDefaultCalibrationSource.cxx.

90 {
91 for (const auto & fname : m_rt_files) {
92 std::string line;
93 std::ifstream rtf(fname.c_str());
94 if (!rtf.good()) {
95 ATH_MSG_FATAL("Cannot open rt file '" << fname << "'!");
96 return StatusCode::FAILURE;
97 }
98 std::map<int, SamplePoint> pts;
99 // read dummy line
100 std::getline(rtf, line);
101 int i(0);
102 while (!rtf.eof()) {
103 std::getline(rtf, line);
104 std::istringstream ln_str(line);
105 double r, t, s;
106 ln_str >> r;
107 ln_str >> t;
108 ln_str >> s;
109 if (rtf.eof()) break;
110 SamplePoint pt(t, r, s);
111 pts[i] = pt;
112 i++;
113 }
114 m_rt_points.push_back(pts);
115 }
116 return StatusCode::SUCCESS;
117 }
std::vector< std::map< int, SamplePoint > > m_rt_points

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

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()

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 > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
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)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ SetIOV()

virtual void MuonCalib::IMuonCalibConditionsSource::SetIOV ( int & ,
int &  ) const
inlinevirtualinherited

Reimplemented in MuonCalib::MuonCalibDbCalibrationSource.

Definition at line 28 of file IMuonCalibConditionsSource.h.

28{}

◆ store_rt_fun()

bool MuonCalib::MuonCalibDefaultCalibrationSource::store_rt_fun ( )
inlineprivate

Definition at line 135 of file MuonCalibDefaultCalibrationSource.cxx.

135 {
136 const std::vector<NtupleStationId> &regions(m_reg_sel_svc->GetStationsInRegions());
137 for (const auto & region : regions) {
138 MuonFixedId fid(region.FixedId());
139 for (unsigned int i = 0; i < m_rt_regions.size(); i++) {
140 if (m_rt_regions[i]->Result(fid)) {
141 m_inserter->StoreRtChamber(region, m_rt_points[i], std::string("default"), m_creation_flags_rt[i]);
142 break;
143 }
144 }
145 }
146 return true;
147 }
ICscStripFitter::Result Result
static const std::vector< std::string > regions

◆ store_t0_fun()

bool MuonCalib::MuonCalibDefaultCalibrationSource::store_t0_fun ( )
inlineprivate

Definition at line 119 of file MuonCalibDefaultCalibrationSource.cxx.

119 {
120 const std::vector<NtupleStationId> &regions(m_reg_sel_svc->GetStationsInRegions());
121 for (const auto & region : regions) {
122 MuonFixedId fid(region.FixedId());
123 for (unsigned int i = 0; i < m_t0_regions.size(); i++) {
124 if (m_t0_regions[i]->Result(fid)) {
125 m_inserter->StartT0Chamber(region);
126 while (m_inserter->AppendT0(m_t0[i], 5, 0.0)) {}
127 m_inserter->StoreT0Chamber(region, std::string("default"), m_creation_flags_t0[i]);
128 // break;
129 }
130 }
131 }
132 return true;
133 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_bfield_applied_rt

std::vector<bool> MuonCalib::MuonCalibDefaultCalibrationSource::m_bfield_applied_rt
private

Definition at line 44 of file MuonCalibDefaultCalibrationSource.h.

◆ m_bfield_applied_t0

std::vector<bool> MuonCalib::MuonCalibDefaultCalibrationSource::m_bfield_applied_t0
private

Definition at line 39 of file MuonCalibDefaultCalibrationSource.h.

◆ m_creation_flags_rt

std::vector<unsigned int> MuonCalib::MuonCalibDefaultCalibrationSource::m_creation_flags_rt
private

Definition at line 48 of file MuonCalibDefaultCalibrationSource.h.

◆ m_creation_flags_t0

std::vector<unsigned int> MuonCalib::MuonCalibDefaultCalibrationSource::m_creation_flags_t0
private

Definition at line 47 of file MuonCalibDefaultCalibrationSource.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_inserter

CoolInserter* MuonCalib::IMuonCalibConditionsSource::m_inserter = nullptr
protectedinherited

Definition at line 31 of file IMuonCalibConditionsSource.h.

◆ m_reg_sel_svc

ServiceHandle<RegionSelectionSvc> MuonCalib::MuonCalibDefaultCalibrationSource::m_reg_sel_svc {this, "RegionSelectionSvc", "RegionSelectionSvc"}
private

Definition at line 54 of file MuonCalibDefaultCalibrationSource.h.

54{this, "RegionSelectionSvc", "RegionSelectionSvc"};

◆ m_rt_files

std::vector<std::string> MuonCalib::MuonCalibDefaultCalibrationSource::m_rt_files
private

Definition at line 42 of file MuonCalibDefaultCalibrationSource.h.

◆ m_rt_points

std::vector<std::map<int, SamplePoint> > MuonCalib::MuonCalibDefaultCalibrationSource::m_rt_points
private

Definition at line 52 of file MuonCalibDefaultCalibrationSource.h.

◆ m_rt_region_str

std::vector<std::string> MuonCalib::MuonCalibDefaultCalibrationSource::m_rt_region_str
private

Definition at line 41 of file MuonCalibDefaultCalibrationSource.h.

◆ m_rt_regions

std::vector<std::unique_ptr<RegionSelectorBase> > MuonCalib::MuonCalibDefaultCalibrationSource::m_rt_regions
private

Definition at line 50 of file MuonCalibDefaultCalibrationSource.h.

◆ m_t0

std::vector<float> MuonCalib::MuonCalibDefaultCalibrationSource::m_t0
private

Definition at line 37 of file MuonCalibDefaultCalibrationSource.h.

◆ m_t0_region_str

std::vector<std::string> MuonCalib::MuonCalibDefaultCalibrationSource::m_t0_region_str
private

Definition at line 36 of file MuonCalibDefaultCalibrationSource.h.

◆ m_t0_regions

std::vector<std::unique_ptr<RegionSelectorBase> > MuonCalib::MuonCalibDefaultCalibrationSource::m_t0_regions
private

Definition at line 50 of file MuonCalibDefaultCalibrationSource.h.

◆ m_time_slewing_applied_rt

std::vector<bool> MuonCalib::MuonCalibDefaultCalibrationSource::m_time_slewing_applied_rt
private

Definition at line 43 of file MuonCalibDefaultCalibrationSource.h.

◆ m_time_slewing_applied_t0

std::vector<bool> MuonCalib::MuonCalibDefaultCalibrationSource::m_time_slewing_applied_t0
private

Definition at line 38 of file MuonCalibDefaultCalibrationSource.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: