ATLAS Offline Software
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MuonAlign::AlignmentErrorTool Class Reference

#include <AlignmentErrorTool.h>

Inheritance diagram for MuonAlign::AlignmentErrorTool:
Collaboration diagram for MuonAlign::AlignmentErrorTool:

Classes

struct  deviationSummary_t
 

Public Member Functions

 AlignmentErrorTool (const std::string &, const std::string &, const IInterface *)
 
 ~AlignmentErrorTool () override=default
 
StatusCode initialize () override
 
void makeAlignmentDeviations (const Trk::Track &track, std::vector< Trk::AlignmentDeviation * > &deviations) const override
 Compute alignment deviations, given a track as input. 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 ()
 

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

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

ToolHandle< MuonCalib::IIdToFixedIdToolm_idTool {this, "idTool", "MuonCalib::IdToFixedIdTool"}
 
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 
SG::ReadCondHandleKey< MuonAlignmentErrorDatam_readKey {this, "ReadKey", "MuonAlignmentErrorData", "Key of MuonAlignmentErrorData"}
 
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 29 of file AlignmentErrorTool.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

◆ AlignmentErrorTool()

MuonAlign::AlignmentErrorTool::AlignmentErrorTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 28 of file AlignmentErrorTool.cxx.

28  : AthAlgTool(t, n, p) {
29  declareInterface<Trk::ITrkAlignmentDeviationTool>(this);
30 }

◆ ~AlignmentErrorTool()

MuonAlign::AlignmentErrorTool::~AlignmentErrorTool ( )
overridedefault

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

◆ initialize()

StatusCode MuonAlign::AlignmentErrorTool::initialize ( )
override

Definition at line 32 of file AlignmentErrorTool.cxx.

32  {
33  ATH_MSG_INFO("*****************************************");
34  ATH_MSG_INFO("AlignmentErrorTool::initialize()");
35 
36  ATH_CHECK(m_idTool.retrieve());
37  ATH_CHECK(m_idHelperSvc.retrieve());
39 
40  return StatusCode::SUCCESS;
41 }

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

const InterfaceID & Trk::ITrkAlignmentDeviationTool::interfaceID ( )
inlinestaticinherited

Definition at line 37 of file ITrkAlignmentDeviationTool.h.

38 {
39  return IID_ITrkAlignmentDeviationTool;
40 }

◆ makeAlignmentDeviations()

void MuonAlign::AlignmentErrorTool::makeAlignmentDeviations ( const Trk::Track track,
std::vector< Trk::AlignmentDeviation * > &  deviations 
) const
overridevirtual

Compute alignment deviations, given a track as input.

Implements Trk::ITrkAlignmentDeviationTool.

Definition at line 43 of file AlignmentErrorTool.cxx.

43  {
44  ATH_MSG_DEBUG("AlignmentErrorTool::makeAlignmentDeviations()");
45 
47  const MuonAlignmentErrorData* readCdo{*readHandle};
48  if (!readCdo) {
49  ATH_MSG_ERROR("nullptr to the read conditions object");
50  return;
51  }
52  const auto& deviationVec = readCdo->getAlignmentErrorRules();
53  std::vector<deviationSummary_t> devSumVec;
54  devSumVec.reserve(deviationVec.size());
55  deviationSummary_t aDevSumm;
56  for (const auto & i : deviationVec) {
57  aDevSumm.translation = i.translation;
58  aDevSumm.rotation = i.rotation;
59  aDevSumm.stationName = i.stationName;
60  aDevSumm.multilayer = i.multilayer;
61  devSumVec.emplace_back(std::move(aDevSumm));
62  }
63 
64  const auto& MuonAlignmentErrorRuleCacheVec = readCdo->getMuonAlignmentErrorRuleCache();
65  const auto& map_struct = MuonAlignmentErrorRuleCacheVec[0];
66 
67  typedef Trk::TrackStates tsosc_t;
68  const tsosc_t* tsosc = track.trackStateOnSurfaces();
69 
70  // LOOP ON HITS ON TRACK //
71  unsigned int nPrecisionHits = 0;
72  for (const auto *tsos : *tsosc) {
73  if (!tsos->type(Trk::TrackStateOnSurface::Measurement)) {
74  continue;
75  }
76  const Trk::MeasurementBase* meas = tsos->measurementOnTrack();
77  const auto* rot = dynamic_cast<const Trk::RIO_OnTrack*>(meas);
78 
79  if (!rot) {
80  const auto* crot = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(meas);
81  if (crot) {
82  unsigned int index = crot->indexOfMaxAssignProb();
83  rot = &(crot->rioOnTrack(index));
84  }
85  }
86  if (!rot) continue;
87 
88  Identifier channelId = rot->identify();
89  if (!m_idHelperSvc->isMuon(channelId)) {
90  // the RIO_OnTrack Identifiers could also come from ID or Calo, but this tool is only interested in MS hits
91  ATH_MSG_VERBOSE("Given Identifier " << channelId.get_compact() << " is not a muon Identifier, continuing");
92  continue;
93  }
94 
95  // Keep only the precision coordinate hits
96  if (m_idHelperSvc->isRpc(channelId)
97  || m_idHelperSvc->isTgc(channelId)
98  || (m_idHelperSvc->isCsc(channelId) && m_idHelperSvc->cscIdHelper().measuresPhi(channelId) == 1)
99  || (m_idHelperSvc->issTgc(channelId) && m_idHelperSvc->stgcIdHelper().channelType(channelId) != sTgcIdHelper::sTgcChannelTypes::Strip)) {
100  continue;
101  }
102 
103  // To maintain backward compatibility with the old error CLOBs, activate
104  // the NSW hits only if specified in the CLOB, else disccard them
105  if (!readCdo->hasNswHits()
106  && (m_idHelperSvc->issTgc(channelId) || m_idHelperSvc->isMM(channelId))) {
107  continue;
108  }
109 
110  MuonCalib::MuonFixedLongId calibId = m_idTool->idToFixedLongId(channelId);
111  if (!calibId.isValid()) continue;
112 
113  ATH_MSG_DEBUG("Hit is in station " << calibId << " (MuonFixedLongId)");
114  ++nPrecisionHits;
115 
116  // Compute deviationSummary_t building blocks
117  const Trk::PrepRawData* prd = rot->prepRawData();
118  const Trk::Surface& sur = prd->detectorElement()->surface(prd->identify());
119 
120  double w2 = 1.0 / (rot->localCovariance()(Trk::loc1, Trk::loc1));
121  Amg::Vector3D hitP = tsos->trackParameters()->position();
122  Amg::Vector3D hitU = tsos->trackParameters()->momentum().unit();
123 
124  // Wire direction for MDT, strip direction for MM or sTGC
125  int icol = (calibId.is_mdt()||calibId.is_csc()) ? 2 : 1;
126  Amg::Vector3D hitV = sur.transform().rotation().col(icol);
127 
128  // Enforce orientation of the V vectors
129  static const Amg::Vector3D zATLAS(0., 0., 1.);
130  if (hitP.cross(zATLAS).dot(hitV)<0.0) {
131  hitV *= -1.0;
132  }
133 
134  // FOR CROSS-CHECK
135  bool is_matched = false;
136 
137  // Construct detector element identifier from channelId, remaining only chamber name and multilayer information
138  int multilayer = 1;
139  if (calibId.is_mdt()) {
140  multilayer = calibId.mdtMultilayer();
141  } else if (calibId.is_mmg()) {
142  multilayer = calibId.mmgMultilayer();
143  } else if (calibId.is_stg()) {
144  multilayer = calibId.stgMultilayer();
145  }
146 
147  Identifier key_id{};
148  if (m_idHelperSvc->isMdt(channelId)){
149  key_id = m_idHelperSvc->mdtIdHelper().channelID(channelId, multilayer, 1, 1);
150  }
151  if (m_idHelperSvc->isRpc(channelId)){
152  key_id = m_idHelperSvc->rpcIdHelper().elementID(channelId);
153  }
154  if (m_idHelperSvc->isMM(channelId)){
155  key_id = m_idHelperSvc->mmIdHelper().channelID(channelId, multilayer, 1, 1);
156  }
157  if (m_idHelperSvc->issTgc(channelId)){
158  key_id = m_idHelperSvc->stgcIdHelper().channelID(channelId, multilayer, 1, 0, 1);
159  }
160  if (m_idHelperSvc->isCsc(channelId)){
161  key_id = m_idHelperSvc->cscIdHelper().elementID(channelId);
162  }
163  if (m_idHelperSvc->isTgc(channelId)){
164  key_id = m_idHelperSvc->tgcIdHelper().elementID(channelId);
165  }
166 
167  // Find deviation (pointer) for current detector element
168  auto range = map_struct.id_rule_map.equal_range(key_id);
169  for (auto i = range.first; i != range.second; ++i){
171 
172  // ASSOCIATE EACH NUISANCE TO A LIST OF HITS
173  devSumVec[rule_idx].hits.push_back(rot);
174 
175  devSumVec[rule_idx].sumW2 += w2;
176  devSumVec[rule_idx].sumP += w2 * hitP;
177  devSumVec[rule_idx].sumU += w2 * hitU;
178  devSumVec[rule_idx].sumV += w2 * hitV;
179 
180  // FOR CROSS-CHECK
181  is_matched = true;
182 
183 
184  } // LOOP ON DEVIATIONS
185 
186  if (!is_matched) {
187  ATH_MSG_WARNING("The hits in the station " << calibId << " (MuonFixedLongId)"
188  << " couldn't be matched to any deviation regexp in the list.");
189  }
190 
191  } // LOOP ON TSOS
192 
193  // Nuisance parameters covering the complete track are not wanted. (MS/ID
194  // error treated differently for now). Removing the deviations covering the
195  // full track in further processing.
196  for (auto& dev : devSumVec) {
197  if (dev.hits.size() == nPrecisionHits) {
198  dev.hits.clear();
199  }
200  }
201 
202  // GET RID OF PERFECT OVERLAPS BY COMBINING ERRORS
203  std::vector<const Trk::RIO_OnTrack*> v1, v2;
204  for (auto iti = devSumVec.begin(); iti != devSumVec.end(); ++iti) {
205 
206  v1 = iti->hits;
207  if (v1.empty()) {
208  continue;
209  }
210 
211  std::stable_sort(v1.begin(), v1.end());
212 
213  for (auto itj = iti+1; itj != devSumVec.end(); ++itj) {
214 
215  if (iti->hits.size() != itj->hits.size()) {
216  continue;
217  }
218 
219  v2 = itj->hits;
220  std::stable_sort(v2.begin(), v2.end());
221 
222  if (v1 == v2) {
223  auto iDev = std::distance(devSumVec.begin(), iti);
224  auto jDev = std::distance(devSumVec.begin(), itj);
225  ATH_MSG_DEBUG("Found deviations " << iDev << " and " << jDev << " related to the same list of hits. Merging...");
226  ATH_MSG_DEBUG("old (translation, rotation) systematic uncertainties for "
227  << iDev << ": " << iti->translation << ", " << iti->rotation);
228  ATH_MSG_DEBUG("old (translation, rotation) systematic uncertainties for "
229  << jDev << ": " << itj->translation << ", " << itj->rotation);
230 
231  // MERGE THE TWO DEVIATIONS ASSOCIATED TO THE SAME LIST OF HITS //
232  double new_translation = std::hypot(iti->translation, itj->translation);
233  double new_rotation = std::hypot(iti->rotation, itj->rotation);
234 
235  // NOW PREPARE TO ERASE ONE OF THE TWO COPIES //
236  itj->hits.clear();
237 
238  // ASSIGN NEW TRASLATION/ROTATION TO THE REMAINING COPY //
239  iti->translation = new_translation;
240  iti->rotation = new_rotation;
241  ATH_MSG_DEBUG("New combined (translation, rotation) systematic uncertainties: " << new_translation << ", " << new_rotation);
242 
243  } // FIND AN OVERLAP IN THE HITS LISTS
244  } // SECOND LOOP ON DEVIATIONS
245  } // FIRST LOOP ON DEVIATIONS
246 
247 
248  // NOW BUILD THE DEVIATIONS
249  deviations.clear();
250  ATH_MSG_DEBUG("************************************");
251  ATH_MSG_DEBUG("FINAL LIST OF DEVIATIONS");
252  for (const auto & iDev : devSumVec) {
253  if (iDev.hits.empty()) {
254  continue;
255  }
256 
257  double rotation = iDev.rotation;
258  double translation = iDev.translation;
259 
260  Amg::Vector3D sumP = iDev.sumP;
261  Amg::Vector3D sumU = iDev.sumU;
262  Amg::Vector3D sumV = iDev.sumV;
263  double sumW2 = iDev.sumW2;
264 
265  sumP *= (1. / sumW2);
266  sumU *= (1. / sumW2);
267  sumV *= (1. / sumW2);
268 
269  if (translation >= 0.001 * Gaudi::Units::mm) {
270  std::size_t hitshash = 0;
271  for (const auto *it : iDev.hits) {
272  boost::hash_combine(hitshash, (it->identify()).get_compact());
273  }
274  deviations.push_back(
275  new AlignmentTranslationDeviation(sumU.cross(sumV), translation * Gaudi::Units::mm, iDev.hits));
276  deviations.back()->setHashOfHits(hitshash);
277 
278  ATH_MSG_DEBUG("A translation along ("
279  << sumU.x() << ", " << sumU.y() << ", " << sumU.z() << ") with sigma=" << translation * Gaudi::Units::mm
280  << " mm was applied to " << iDev.hits.size()
281  << " hits matching the station: " << iDev.stationName.str() << " and the multilayer "
282  << iDev.multilayer.str());
283  }
284  if (rotation >= 0.000001 * Gaudi::Units::rad) {
285  std::size_t hitshash = 0;
286  for (const auto *it : iDev.hits) {
287  boost::hash_combine(hitshash, (it->identify()).get_compact());
288  }
289  deviations.push_back(new AlignmentRotationDeviation(sumP, sumV, rotation * Gaudi::Units::rad, iDev.hits));
290  deviations.back()->setHashOfHits(hitshash);
291 
292  ATH_MSG_DEBUG("A rotation around the center = (" << sumP.x() << ", " << sumP.y() << ", " << sumP.z() << ") and axis = ("
293  << sumV.x() << ", " << sumV.y() << ", " << sumV.z()
294  << ") with sigma=" << rotation / Gaudi::Units::mrad << " mrad was applied to "
295  << iDev.hits.size() << " hits matching the station "
296  << iDev.stationName.str() << " and the multilayer "
297  << iDev.multilayer.str());
298  }
299 
300  } // LOOP ON NUISANCES
301 
302  ATH_MSG_DEBUG("******************************");
303  ATH_MSG_DEBUG("FINAL CHECKUP");
304  ATH_MSG_DEBUG("Found " << deviations.size() << " nuisances after duplicates merging");
305  ATH_MSG_DEBUG("******************************");
306 }

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

Member Data Documentation

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

ServiceHandle<Muon::IMuonIdHelperSvc> MuonAlign::AlignmentErrorTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 43 of file AlignmentErrorTool.h.

◆ m_idTool

ToolHandle<MuonCalib::IIdToFixedIdTool> MuonAlign::AlignmentErrorTool::m_idTool {this, "idTool", "MuonCalib::IdToFixedIdTool"}
private

Definition at line 42 of file AlignmentErrorTool.h.

◆ m_readKey

SG::ReadCondHandleKey<MuonAlignmentErrorData> MuonAlign::AlignmentErrorTool::m_readKey {this, "ReadKey", "MuonAlignmentErrorData", "Key of MuonAlignmentErrorData"}
private

Definition at line 62 of file AlignmentErrorTool.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::MuonFixedLongId::mmgMultilayer
int mmgMultilayer() const
Mmg specific:
Definition: MuonFixedLongId.h:1451
MuonCalib::MuonFixedLongId::is_mdt
bool is_mdt() const
Definition: MuonFixedLongId.h:774
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
index
Definition: index.py:1
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
skel.it
it
Definition: skel.GENtoEVGEN.py:396
MuonCalib::MuonFixedLongId::isValid
bool isValid() const
check validity of the identifier.
Definition: MuonFixedLongId.h:770
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
MuonCalib::MuonFixedLongId::is_mmg
bool is_mmg() const
Definition: MuonFixedLongId.h:790
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
MuonAlign::AlignmentErrorTool::m_idTool
ToolHandle< MuonCalib::IIdToFixedIdTool > m_idTool
Definition: AlignmentErrorTool.h:42
MuonCalib::MuonFixedLongId::is_stg
bool is_stg() const
Definition: MuonFixedLongId.h:794
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
python.SystemOfUnits.mrad
int mrad
Definition: SystemOfUnits.py:112
std::stable_sort
void stable_sort(std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, std::reverse_iterator< DataModel_detail::iterator< DVL > > end, Compare comp)
Specialization of stable_sort for DataVector/List.
Definition: DVL_algorithms.h:711
atlasStyleMacro.icol
int icol
Definition: atlasStyleMacro.py:13
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
MuonAlign::AlignmentErrorTool::m_readKey
SG::ReadCondHandleKey< MuonAlignmentErrorData > m_readKey
Definition: AlignmentErrorTool.h:62
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
MuonCalib::MuonFixedLongId::stgMultilayer
int stgMultilayer() const
Stg specific:
Definition: MuonFixedLongId.h:1516
MuonCalib::MuonFixedLongId
Definition: MuonFixedLongId.h:50
MuonAlignmentErrorData
MuonAlignmentErrorData is condition data which is derived and recorded by MuonAlignmentErrorDbAlg.
Definition: MuonAlignmentErrorData.h:21
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
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::rotation
rotation
Definition: TrackSurface_v1.cxx:15
Trk::CompetingRIOsOnTrack
Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.
Definition: CompetingRIOsOnTrack.h:64
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
Trk::TrkDetElementBase::surface
virtual const Surface & surface() const =0
Return surface associated with this detector element.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
DataVector< const Trk::TrackStateOnSurface >
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
MuonCalib::MuonFixedLongId::is_csc
bool is_csc() const
Definition: MuonFixedLongId.h:782
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
MuonAlign::AlignmentErrorTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: AlignmentErrorTool.h:43
Trk::PrepRawData
Definition: PrepRawData.h:62
Trk::MeasurementBase
Definition: MeasurementBase.h:58
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MuonAlignmentErrorData::MuonAlignmentErrorRuleIndex
size_t MuonAlignmentErrorRuleIndex
Definition: MuonAlignmentErrorData.h:31
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
ReadCellNoiseFromCoolCompare.v2
v2
Definition: ReadCellNoiseFromCoolCompare.py:364
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonCalib::MuonFixedLongId::mdtMultilayer
int mdtMultilayer() const
Mdt specific:
Definition: MuonFixedLongId.h:1070
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Trk::loc1
@ loc1
Definition: ParamDefs.h:34
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
Trk::Surface::transform
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Trk::TrackStateOnSurface::Measurement
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
Definition: TrackStateOnSurface.h:101
python.SystemOfUnits.rad
int rad
Definition: SystemOfUnits.py:111
fitman.k
k
Definition: fitman.py:528
Trk::PrepRawData::detectorElement
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
Identifier
Definition: IdentifierFieldParser.cxx:14