ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MuonCalib::CalibrationOracleFileIOTool Class Reference

#include <CalibrationOracleFileIOTool.h>

Inheritance diagram for MuonCalib::CalibrationOracleFileIOTool:
Collaboration diagram for MuonCalib::CalibrationOracleFileIOTool:

Public Member Functions

 CalibrationOracleFileIOTool (const std::string &t, const std::string &n, const IInterface *p)
 constructor More...
 
StatusCode WriteT0 (const MdtTubeFitContainer *t0_output, const NtupleStationId &station_id, int iov_start, int iov_end) override
 initialisation More...
 
StatusCode WriteRt (const RtCalibrationOutput *rt_relation, std::shared_ptr< const IRtResolution > resolution, const NtupleStationId &station_id, int iov_start, int iov_end, bool, bool) override
 write rt More...
 
StatusCode LoadT0 (std::map< NtupleStationId, MdtStationT0Container * > &, int) override
 load t0s for iov More...
 
StatusCode LoadRt (std::map< NtupleStationId, IRtRelation * > &, std::map< NtupleStationId, IRtResolution * > &, int) override
 load rts for iov More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. 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
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 interface method More...
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

bool fill_rt (std::unique_ptr< RtDataFromFile::RtRelation > &rt, const std::shared_ptr< const IRtRelation > &new_rt, const std::shared_ptr< const MuonCalib::IRtResolution > &resolut)
 fill rt relation More...
 
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...
 

Private Attributes

std::string m_calib_dir
 path to calibration directory - job option 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
 

Detailed Description

Definition at line 17 of file CalibrationOracleFileIOTool.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

◆ CalibrationOracleFileIOTool()

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

constructor

Definition at line 40 of file CalibrationOracleFileIOTool.cxx.

40  :
41  AthAlgTool(t, n, p), m_calib_dir("oracle_calib") {
42  declareInterface<ICalibrationIOTool>(this);
43  declareProperty("outputLocation", m_calib_dir);
44  }

Member Function Documentation

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ 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.

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ 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

◆ fill_rt()

bool MuonCalib::CalibrationOracleFileIOTool::fill_rt ( std::unique_ptr< RtDataFromFile::RtRelation > &  rt,
const std::shared_ptr< const IRtRelation > &  new_rt,
const std::shared_ptr< const MuonCalib::IRtResolution > &  resolut 
)
inlineprivate

fill rt relation

Definition at line 121 of file CalibrationOracleFileIOTool.cxx.

122  {
124  // VARIABLES //
126  const CalibFunc::ParVec &rt_param = new_rt->parameters();
127  // parameters of the r-t relationship to be copied
128  std::shared_ptr<const RtChebyshev> rt_Chebyshev = std::dynamic_pointer_cast<const RtChebyshev>(new_rt);
129  std::shared_ptr<const RtRelationLookUp> rt_lookup = std::dynamic_pointer_cast<const RtRelationLookUp>(new_rt);
130 
132  // FILL THE r-t CLASS //
134 
135  // case 1: r-t relationship is stored in the class RtChebyshev //
136  if (rt_Chebyshev) {
137  unsigned int nb_points(100);
138  double t_length(rt_Chebyshev->tUpper() - rt_Chebyshev->tLower());
139  double bin_size(t_length / static_cast<double>(nb_points - 1));
140  for (unsigned int k = 0; k < nb_points; k++) {
141  double time(rt_Chebyshev->tLower() + k * bin_size);
142  double radius(rt_Chebyshev->radius(time));
143  double resol(0.0);
144  resol = resolut->resolution(time);
145  if (std::isnan(time) || std::isnan(radius) || std::isnan(resol)) {
146  ATH_MSG_FATAL("Filling nan into rt relation!");
147  // return false;
148  }
149  rt->addEntry(time, radius, resol);
150  }
151  }
152 
153  // case 2: r-t relationship is stored in the class RtRelationLookUp //
154  if (rt_lookup) {
155  double t_min(rt_param[0]);
156  double bin_size = rt_param[1];
157  unsigned int nb_points(rt_lookup->nPar() - 2);
158  for (unsigned int k = 0; k < nb_points; k++) {
159  double radius(rt_param[k + 2]);
160  double resol(0.0);
161 
162  resol = resolut->resolution(t_min + bin_size * k);
163  if (std::isnan(radius) || std::isnan(resol)) {
164  ATH_MSG_FATAL("Filling nan into rt relation!");
165  // return false;
166  }
167  rt->addEntry(t_min + bin_size * k, rt_param[k + 2], resol);
168  }
169  }
170 
172  // DECLARE THE NEW r-t RELATIONSHIP VALID //
174  rt->isValid(1);
175 
176  return true;
177  } // CalibrationOracleFileIOTool::fill_rt

◆ 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.

◆ interfaceID()

static const InterfaceID& MuonCalib::ICalibrationIOTool::interfaceID ( )
inlinestaticinherited

interface method

Definition at line 35 of file ICalibrationIOTool.h.

35  {
36  static const InterfaceID IID_CalibrationIOTool("MuonCalib::ICalibrationIOTool", 1, 0);
37  return IID_CalibrationIOTool;
38  }

◆ LoadRt()

StatusCode MuonCalib::CalibrationOracleFileIOTool::LoadRt ( std::map< NtupleStationId, IRtRelation * > &  rts,
std::map< NtupleStationId, IRtResolution * > &  res,
int  iov_id 
)
inlineoverridevirtual

load rts for iov

Parameters
rtsmap to be filled with rts
resmap to be filled with resolution
iov_idthe iov identifier, e.g. the run number. Note: This will, at the moment alwas be -1 (invalid). So the tool will have to determine the run number by itself (job option)

Implements MuonCalib::ICalibrationIOTool.

Definition at line 30 of file CalibrationOracleFileIOTool.h.

30  {
31  return StatusCode::FAILURE;
32  }

◆ LoadT0()

StatusCode MuonCalib::CalibrationOracleFileIOTool::LoadT0 ( std::map< NtupleStationId, MdtStationT0Container * > &  t0s,
int  iov_id 
)
inlineoverridevirtual

load t0s for iov

Parameters
t0smap to be filled with the t0 data
iov_idthe iov identifier, e.g. the run number. Note: This will, at the moment alwas be -1 (invalid). So the tool will have to determine the run number by itself (job option)

Implements MuonCalib::ICalibrationIOTool.

Definition at line 29 of file CalibrationOracleFileIOTool.h.

29 { return StatusCode::FAILURE; }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ 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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

◆ WriteRt()

StatusCode MuonCalib::CalibrationOracleFileIOTool::WriteRt ( const RtCalibrationOutput rt_relation,
std::shared_ptr< const IRtResolution resolution,
const NtupleStationId station_id,
int  iov_start,
int  iov_end,
bool  ,
bool   
)
overridevirtual

write rt

Implements MuonCalib::ICalibrationIOTool.

Definition at line 66 of file CalibrationOracleFileIOTool.cxx.

68  {
69  RtDataFromFile rt_data;
70  std::shared_ptr<const IRtRelation> new_rt = rt_relation->rt();
71  std::unique_ptr<RtDataFromFile::RtRelation> rt = std::make_unique<RtDataFromFile::RtRelation>();
72  int rt_region_id(0);
73  rt_data.setNRts(1);
74  rt_data.addRt(rt_region_id, rt.get(), rt_relation->fullInfo().get());
75  if (!fill_rt(rt, new_rt, resolution)) return StatusCode::FAILURE;
76  // write out the r-t relationship //
77  std::string location = "location";
78  int mdt_rt_id = 99;
79  std::string mdt_rt_map_t_id = "mdt_rt_map_t_id";
80  int mdt_rt_map_r_id = 99;
81  int mdt_rt_map_s_id = 99;
82  system(("mkdir -p " + m_calib_dir + "/rts").c_str());
83  std::string rt_dbfile_name(m_calib_dir + "/rts/DBrt_" + station_id.regionId() + ".dat");
84  std::string rtt_dbfile_name(m_calib_dir + "/rts/DBrt_" + station_id.regionId() + "_t.dat");
85  std::string rtr_dbfile_name(m_calib_dir + "/rts/DBrt_" + station_id.regionId() + "_r.dat");
86  std::string rts_dbfile_name(m_calib_dir + "/rts/DBrt_" + station_id.regionId() + "_s.dat");
87  FILE *db_rt_file;
88  db_rt_file = fopen(rt_dbfile_name.c_str(), "w");
89  FILE *db_rtt_file;
90  db_rtt_file = fopen(rtt_dbfile_name.c_str(), "w");
91  FILE *db_rtr_file;
92  db_rtr_file = fopen(rtr_dbfile_name.c_str(), "w");
93  FILE *db_rts_file;
94  db_rts_file = fopen(rts_dbfile_name.c_str(), "w");
95  if (db_rt_file == nullptr || db_rtt_file == nullptr || db_rtr_file == nullptr || db_rts_file == nullptr) {
96  ATH_MSG_FATAL("Cannot open output files");
97  if (db_rt_file) fclose(db_rt_file);
98  if (db_rtt_file) fclose(db_rtt_file);
99  if (db_rtr_file) fclose(db_rtr_file);
100  if (db_rts_file) fclose(db_rts_file);
101  return StatusCode::FAILURE;
102  }
103  ATH_MSG_INFO("Writing out r-t relationships in the files for calibration db.");
104  // for the time being the variables:
105  // mdt_rt_id,mdt_rt_map_t_id,mdt_rt_map_r_id,
106  // mdt_rt_map_s_id and location
107  // are dummy.
108  fprintf(db_rt_file, " %d,%d,%d,%d,%d,%s,", mdt_rt_id, station_id.FixedId(), -9999, iov_start, iov_end, location.c_str());
109  fprintf(db_rtt_file, " %s,%d,%d,", mdt_rt_map_t_id.c_str(), mdt_rt_id, mdt_rt_id);
110  fprintf(db_rtr_file, " %d,%d,%s,", mdt_rt_map_r_id, mdt_rt_id, mdt_rt_map_t_id.c_str());
111  fprintf(db_rts_file, " %d,%d,", mdt_rt_map_s_id, mdt_rt_id);
112  rt_data.write_forDB(db_rt_file, db_rtt_file, db_rtr_file, db_rts_file, rt_region_id);
113  ATH_MSG_INFO("r-t relationships wrote in the files for calibration db.");
114  fclose(db_rt_file);
115  fclose(db_rtt_file);
116  fclose(db_rtr_file);
117  fclose(db_rts_file);
118  return StatusCode::SUCCESS;
119  }

◆ WriteT0()

StatusCode MuonCalib::CalibrationOracleFileIOTool::WriteT0 ( const MdtTubeFitContainer t0_output,
const NtupleStationId station_id,
int  iov_start,
int  iov_end 
)
overridevirtual

initialisation

write out t0

Implements MuonCalib::ICalibrationIOTool.

Definition at line 46 of file CalibrationOracleFileIOTool.cxx.

47  {
48  // create directory
49  system(("mkdir -p " + m_calib_dir + "/t0s").c_str());
50  // open file
51  std::string t0_dbfile_name(m_calib_dir + "/t0s/DB_t0" + station_id.regionId() + ".dat");
52  FILE *db_file;
53  db_file = fopen(t0_dbfile_name.c_str(), "w");
54  if (!db_file) {
55  ATH_MSG_FATAL("Cannot open output file!");
56  return StatusCode::FAILURE;
57  }
58  TubeDataFromFile t0_file;
59  t0_file.setNRegions(1);
60  t0_file.addTubes(0, t0_output);
61  t0_file.write_forDB(db_file, -9999, iov_start, iov_end);
62  fclose(db_file);
63  return StatusCode::SUCCESS;
64  }

Member Data Documentation

◆ m_calib_dir

std::string MuonCalib::CalibrationOracleFileIOTool::m_calib_dir
private

path to calibration directory - job option

Definition at line 36 of file CalibrationOracleFileIOTool.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_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:
MuonCalib::IRtResolution::resolution
virtual double resolution(double t, double bgRate=0.0) const =0
returns resolution for a give time and background rate
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
MuonCalib::CalibrationOracleFileIOTool::m_calib_dir
std::string m_calib_dir
path to calibration directory - job option
Definition: CalibrationOracleFileIOTool.h:36
MuonCalib::CalibrationOracleFileIOTool::fill_rt
bool fill_rt(std::unique_ptr< RtDataFromFile::RtRelation > &rt, const std::shared_ptr< const IRtRelation > &new_rt, const std::shared_ptr< const MuonCalib::IRtResolution > &resolut)
fill rt relation
Definition: CalibrationOracleFileIOTool.cxx:121
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Dedxcorrection::resolution
double resolution[nGasTypes][nParametersResolution]
Definition: TRT_ToT_Corrections.h:46
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
MuonCalib::CalibFunc::ParVec
std::vector< double > ParVec
Definition: CalibFunc.h:35
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
a
TList * a
Definition: liststreamerinfos.cxx:10
h
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
PixelModuleFeMask_create_db.iov_end
list iov_end
Definition: PixelModuleFeMask_create_db.py:75
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
PixelModuleFeMask_create_db.iov_start
list iov_start
Definition: PixelModuleFeMask_create_db.py:74
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528