ATLAS Offline Software
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Muon::SimpleMMClusterBuilderTool Class Reference

#include <SimpleMMClusterBuilderTool.h>

Inheritance diagram for Muon::SimpleMMClusterBuilderTool:
Collaboration diagram for Muon::SimpleMMClusterBuilderTool:

Public Types

using RIO_Author = MMClusterOnTrack::Author
 Refinement of the cluster position after the cluster calibration loop is ran with a complete external constraint (e.g. More...
 

Public Member Functions

 SimpleMMClusterBuilderTool (const std::string &, const std::string &, const IInterface *)
 
virtual ~SimpleMMClusterBuilderTool ()=default
 
StatusCode initialize () override
 
StatusCode getClusters (const EventContext &ctx, std::vector< Muon::MMPrepData > &&stripsVect, std::vector< std::unique_ptr< Muon::MMPrepData >> &clustersVect) const override
 Standard Interface to produce Micromega clusters from raw Input hits without external contstaint. More...
 
RIO_Author getCalibratedClusterPosition (const EventContext &ctx, const std::vector< NSWCalib::CalibratedStrip > &calibratedStrips, const Amg::Vector3D &directionEstimate, Amg::Vector2D &clusterLocalPosition, Amg::MatrixX &covMatrix) const override
 
 DeclareInterfaceID (Muon::IMMClusterBuilderTool, 1, 0)
 
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
 

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

StatusCode getClusterPosition (const EventContext &ctx, const Identifier &clustId, std::vector< Muon::MMPrepData > &stripsVect, Amg::Vector2D &clusterLocalPosition, Amg::MatrixX &covMatrix) const
 get cluster local position and covariance matrix 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

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
 
SG::ReadCondHandleKey< NswErrorCalibDatam_uncertCalibKey
 
Gaudi::Property< bool > m_writeStripProperties {this, "writeStripProperties", true}
 
Gaudi::Property< uintm_maxHoleSize {this, "maxHoleSize", 1}
 
Gaudi::Property< unsigned int > m_maxClusSize {this, "maxClusSize", 50}
 
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 19 of file SimpleMMClusterBuilderTool.h.

Member Typedef Documentation

◆ RIO_Author

Refinement of the cluster position after the cluster calibration loop is ran with a complete external constraint (e.g.

from the track fit). The cluster local position and the associated covariance are updated during this procedure Returns the Author of the ClusterBuilderTool, in case that the calibrated strip passes all internal constraints of the ClusterBuilder, otherwise Unknown author is returned. In the latter case, the Cluster should not be transformed into a calibrated RIO object.

Parameters
ctxEventContext used for StoreGate access
calibratedStripsCluster constitutents after the calibration stage
directionEstimateEstimate of the direction given in the local frame
clusterLocalPositionVector to which the final cluster position is saved to
covMatrixUncertainty associated with the local position

Definition at line 48 of file IMMClusterBuilderTool.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ SimpleMMClusterBuilderTool()

Muon::SimpleMMClusterBuilderTool::SimpleMMClusterBuilderTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 16 of file SimpleMMClusterBuilderTool.cxx.

16  :
17  AthAlgTool(t, n, p) {
18  declareInterface<IMMClusterBuilderTool>(this);
19 }

◆ ~SimpleMMClusterBuilderTool()

virtual Muon::SimpleMMClusterBuilderTool::~SimpleMMClusterBuilderTool ( )
virtualdefault

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  }

◆ DeclareInterfaceID()

Muon::IMMClusterBuilderTool::DeclareInterfaceID ( Muon::IMMClusterBuilderTool  ,
,
 
)
inherited

◆ 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

◆ getCalibratedClusterPosition()

RIO_Author Muon::SimpleMMClusterBuilderTool::getCalibratedClusterPosition ( const EventContext &  ctx,
const std::vector< NSWCalib::CalibratedStrip > &  calibratedStrips,
const Amg::Vector3D directionEstimate,
Amg::Vector2D clusterLocalPosition,
Amg::MatrixX covMatrix 
) const
overridevirtual

correct the precision coordinate of the local position based on the centroid calibration

Implements Muon::IMMClusterBuilderTool.

Definition at line 202 of file SimpleMMClusterBuilderTool.cxx.

206  {
208  double xPosCalib{0.}, totalCharge{0.};
209  for (const NSWCalib::CalibratedStrip& it : calibratedStrips) {
210  xPosCalib += it.charge * it.dx;
211  totalCharge += it.charge;
212  }
213  if (std::abs(totalCharge) < std::numeric_limits<float>::epsilon()) {
214  return RIO_Author::unKnownAuthor;
215  }
216 
217  xPosCalib /= totalCharge;
218 
219  ATH_MSG_DEBUG("position before calibration and correction: " << clusterLocalPosition[Trk::locX] << " " << xPosCalib);
220 
221  clusterLocalPosition[Trk::locX] = clusterLocalPosition[Trk::locX] + xPosCalib;
223  if (!errorCalibDB.isValid()) {
224  ATH_MSG_FATAL("Failed to retrieve the parameterized errors "<<m_uncertCalibKey.fullKey());
225  return RIO_Author::unKnownAuthor;
226  }
227 
228  NswErrorCalibData::Input errorCalibIn{};
229  errorCalibIn.clusterSize = calibratedStrips.size();
230  errorCalibIn.clusterAuthor = RIO_Author::SimpleClusterBuilder;
231  errorCalibIn.locPhi = dirEstimate.phi();
232  errorCalibIn.locTheta = dirEstimate.theta();
233  errorCalibIn.localPos = clusterLocalPosition;
234  errorCalibIn.stripId = calibratedStrips[errorCalibIn.clusterSize/2].identifier;
235 
236  const double localUncertainty = errorCalibDB->clusterUncertainty(errorCalibIn);
237 
238  covMatrix(0, 0) = localUncertainty * localUncertainty;
239 
240 
241  return RIO_Author::SimpleClusterBuilder;
242 }

◆ getClusterPosition()

StatusCode Muon::SimpleMMClusterBuilderTool::getClusterPosition ( const EventContext &  ctx,
const Identifier clustId,
std::vector< Muon::MMPrepData > &  stripsVect,
Amg::Vector2D clusterLocalPosition,
Amg::MatrixX covMatrix 
) const
private

get cluster local position and covariance matrix

get the Y local position from the first strip ( it's the same for all strips in the cluster)

Definition at line 153 of file SimpleMMClusterBuilderTool.cxx.

157  {
158 
160  if (!errorCalibDB.isValid()) {
161  ATH_MSG_FATAL("Failed to retrieve the parameterized errors "<<m_uncertCalibKey.fullKey());
162  return StatusCode::FAILURE;
163  }
164  covMatrix.setIdentity();
165  double weightedPosX{0.}, posY{0.}, totalCharge{0.};
167 
169  posY = stripsVec[0].localPosition().y();
170  for (const MMPrepData& strip : stripsVec) {
171  const double posX = strip.localPosition().x();
172  const double charge = strip.charge();
173  weightedPosX += posX * charge;
174  totalCharge += charge;
175  const Amg::Vector3D lDir{NswClustering::toLocal(strip)};
176  clusDir+= charge * lDir;
177  const Amg::Vector3D& globPos{strip.globalPosition()};
178  ATH_MSG_VERBOSE("Adding a strip to the centroid calculation "<<m_idHelperSvc->toString(strip.identify())
179  <<", charge=" << charge<<" global position: "<<Amg::toString(globPos, 2)
180  <<", theta: "<<globPos.theta()<<", eta: "<<globPos.eta()<<", phi: "<<globPos.phi()
181  <<" -- local direction theta: "<<lDir.theta()<<", eta: "<<lDir.eta()
182  <<", phi: "<<lDir.phi());
183  }
184  weightedPosX = weightedPosX / totalCharge;
185  clusterLocalPosition = Amg::Vector2D(weightedPosX, posY);
186 
187  NswErrorCalibData::Input errorCalibIn{};
188  errorCalibIn.stripId = clustId;
189  errorCalibIn.clusterAuthor = static_cast<unsigned>(MMPrepData::Author::SimpleClusterBuilder);
190  errorCalibIn.locPhi = clusDir.phi();
191  errorCalibIn.locTheta = clusDir.theta();
192  errorCalibIn.localPos = clusterLocalPosition;
193  errorCalibIn.clusterSize = stripsVec.size();
194 
195  ATH_MSG_VERBOSE(m_idHelperSvc->toString(clustId)<< " - local track direction: "<<errorCalibIn.locTheta);
196 
197  const double localUncertainty = errorCalibDB->clusterUncertainty(errorCalibIn);
198  covMatrix(0, 0) = localUncertainty * localUncertainty;
199  return StatusCode::SUCCESS;
200 }

◆ getClusters()

StatusCode Muon::SimpleMMClusterBuilderTool::getClusters ( const EventContext &  ctx,
std::vector< Muon::MMPrepData > &&  stripsVect,
std::vector< std::unique_ptr< Muon::MMPrepData >> &  clustersVect 
) const
overridevirtual

Standard Interface to produce Micromega clusters from raw Input hits without external contstaint.

Executes the clusterization algorithm & fills the results in the clusterVect Returns a failure in case of conditions or unexpected problems

Parameters
ctxEventContext used for StoreGate access
stripsVectVector of the single Micromega hits.
clusterVectOutput vector of the merged clusters

Find a strip in the same gas gap that's close around our seed

Merge all information together

get the local position from the cluster centroid

This cluster is essentially done. Update the Index to go to the next cluster

memory allocated dynamically for the PrepRawData is managed by Event Store

Implements Muon::IMMClusterBuilderTool.

Definition at line 27 of file SimpleMMClusterBuilderTool.cxx.

29  {
30  ATH_MSG_DEBUG("Size of the input vector: " << MMprds.size());
31  ATH_MSG_DEBUG("Size of the output vector: " << clustersVect.size());
32 
33  if (MMprds.empty()) {
34  ATH_MSG_DEBUG("Empty PRD collection: no clusterization");
35  return StatusCode::SUCCESS;
36  }
37  const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
38  std::sort(MMprds.begin(), MMprds.end(),
39  [&](const MMPrepData& a, const MMPrepData& b){
40  const Identifier ida = a.identify(), idb = b.identify();
41  const int mla = idHelper.multilayer(ida);
42  const int mlb = idHelper.multilayer(idb);
43  if (mla!=mlb) return mla<mlb;
44  const int gga = idHelper.gasGap(ida);
45  const int ggb = idHelper.gasGap(idb);
46  if (gga!=ggb) return gga<ggb;
47  return idHelper.channel(ida) < idHelper.channel(idb);
48  });
49 
50 
51  const IdentifierHash hash = MMprds.at(0).collectionHash();
52  const unsigned int n_input_prds = MMprds.size();
53  for (unsigned int mergeI = 0; mergeI < n_input_prds; ) {
54  const MMPrepData& primary_prd = MMprds[mergeI];
55  const Identifier id_prd = primary_prd.identify();
56  const Identifier gasGapId = m_idHelperSvc->gasGapId(id_prd);
57 
58  ATH_MSG_VERBOSE(" PrepData "<<m_idHelperSvc->toString(id_prd)<<" index: "<<mergeI<< " / " << n_input_prds
59  << " z " << primary_prd.globalPosition().z());
61  unsigned mergeJ{mergeI+1};
62 
63  while (mergeJ < n_input_prds &&
64  gasGapId == m_idHelperSvc->gasGapId(MMprds[mergeJ].identify()) &&
65  std::abs(idHelper.channel(MMprds[mergeJ].identify()) -
66  idHelper.channel(MMprds[mergeJ -1].identify()) ) <= static_cast<int>(m_maxHoleSize) + 1) {
67  ++mergeJ;
68  }
69  unsigned int clustSize = mergeJ - mergeI;
70  if (clustSize > m_maxClusSize) {
71  mergeI = mergeJ;
72  continue;
73  }
74  DEFINE_VECTOR(uint16_t, mergeStrips, clustSize);
75  DEFINE_VECTOR(Identifier, rdoList, clustSize);
76  DEFINE_VECTOR(short int, mergeStripsTime, clustSize);
77  DEFINE_VECTOR(int, mergeStripsCharge, clustSize);
78  DEFINE_VECTOR(float, mergeStripsDriftDists, clustSize);
79  DEFINE_VECTOR(AmgVector(2), mergeStripsDriftDistErrors, clustSize);
80  double totalCharge{0.0};
82  for (unsigned int mergeMe = mergeI; mergeMe < mergeJ; ++mergeMe) {
83  const MMPrepData& mergePrd = MMprds[mergeMe];
84  const Identifier mergedId = mergePrd.identify();
85  rdoList.push_back(mergedId);
86  mergeStrips.push_back(idHelper.channel(mergedId));
87  mergeStripsTime.push_back(mergePrd.time());
88  mergeStripsCharge.push_back(mergePrd.charge());
89  mergeStripsDriftDists.push_back(mergePrd.driftDist());
90  const Amg::MatrixX& cov{mergePrd.localCovariance()};
91  mergeStripsDriftDistErrors.emplace_back(cov(0,0), cov(1,1));
92 
93  totalCharge += mergePrd.charge();
94  }
95 
96  ATH_MSG_VERBOSE(" add merged MMprds nmerge " << clustSize );
97 
98 
99 
100  // start off from strip in the middle
101  unsigned int stripSum = 0;
102  for (unsigned short strip : mergeStrips) stripSum += strip;
103  stripSum /= mergeStrips.size();
104 
105  unsigned int centralIdx{mergeI};
106  for (unsigned int k = 0; k < mergeStrips.size(); ++k) {
107  ++centralIdx;
108  if (mergeStrips[k] == stripSum) break;
109  }
110  const Identifier clusterId = MMprds[centralIdx < mergeJ ? centralIdx : mergeI].identify();
111  ATH_MSG_VERBOSE(" Look for strip nr " << stripSum << " found at index " << centralIdx);
112 
116 
117  DEFINE_VECTOR(MMPrepData, stripsVec, clustSize);
118 
119  stripsVec.insert(stripsVec.begin(),std::make_move_iterator(MMprds.begin() + mergeI),
120  std::make_move_iterator(MMprds.begin() + mergeJ));
121 
123  mergeI = mergeJ;
124  Amg::MatrixX covMatrix(1,1);
125  Amg::Vector2D clusterLocalPosition{Amg::Vector2D::Zero()};
126  ATH_CHECK(getClusterPosition(ctx, clusterId, stripsVec, clusterLocalPosition, covMatrix));
127 
131  if (!m_writeStripProperties) mergeStrips.clear();
132  std::unique_ptr<MMPrepData> prdN = std::make_unique<MMPrepData>(clusterId,
133  hash,
134  std::move(clusterLocalPosition),
135  std::move(rdoList),
136  std::move(covMatrix),
137  stripsVec.front().detectorElement(),
138  0,
139  totalCharge,
140  0.f,
141  std::move(mergeStrips),
142  std::move(mergeStripsTime),
143  std::move(mergeStripsCharge));
144 
145  prdN->setDriftDist(std::move(mergeStripsDriftDists), std::move(mergeStripsDriftDistErrors));
147  clustersVect.push_back(std::move(prdN));
148  } // end loop MMprds[i]
149  return StatusCode::SUCCESS;
150 }

◆ initialize()

StatusCode Muon::SimpleMMClusterBuilderTool::initialize ( )
override

Definition at line 21 of file SimpleMMClusterBuilderTool.cxx.

21  {
22  ATH_CHECK(m_idHelperSvc.retrieve());
24  return StatusCode::SUCCESS;
25 }

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

◆ 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> Muon::SimpleMMClusterBuilderTool::m_idHelperSvc
private
Initial value:
{this, "MuonIdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc"}

Definition at line 46 of file SimpleMMClusterBuilderTool.h.

◆ m_maxClusSize

Gaudi::Property<unsigned int> Muon::SimpleMMClusterBuilderTool::m_maxClusSize {this, "maxClusSize", 50}
private

Definition at line 55 of file SimpleMMClusterBuilderTool.h.

◆ m_maxHoleSize

Gaudi::Property<uint> Muon::SimpleMMClusterBuilderTool::m_maxHoleSize {this, "maxHoleSize", 1}
private

Definition at line 54 of file SimpleMMClusterBuilderTool.h.

◆ m_uncertCalibKey

SG::ReadCondHandleKey<NswErrorCalibData> Muon::SimpleMMClusterBuilderTool::m_uncertCalibKey
private
Initial value:
{this, "ErrorCalibKey", "NswUncertData",
"Key of the parametrized NSW uncertainties"}

Definition at line 49 of file SimpleMMClusterBuilderTool.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.

◆ m_writeStripProperties

Gaudi::Property<bool> Muon::SimpleMMClusterBuilderTool::m_writeStripProperties {this, "writeStripProperties", true}
private

Definition at line 53 of file SimpleMMClusterBuilderTool.h.


The documentation for this class was generated from the following files:
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
DEFINE_VECTOR
#define DEFINE_VECTOR(dType, varName, nEles)
Definition: SimpleMMClusterBuilderTool.cxx:9
Trk::PrepRawDataType::MMPrepData
@ MMPrepData
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
Trk::locX
@ locX
Definition: ParamDefs.h:37
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Muon::SimpleMMClusterBuilderTool::m_uncertCalibKey
SG::ReadCondHandleKey< NswErrorCalibData > m_uncertCalibKey
Definition: SimpleMMClusterBuilderTool.h:49
Muon::SimpleMMClusterBuilderTool::getClusterPosition
StatusCode getClusterPosition(const EventContext &ctx, const Identifier &clustId, std::vector< Muon::MMPrepData > &stripsVect, Amg::Vector2D &clusterLocalPosition, Amg::MatrixX &covMatrix) const
get cluster local position and covariance matrix
Definition: SimpleMMClusterBuilderTool.cxx:153
skel.it
it
Definition: skel.GENtoEVGEN.py:396
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
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
beamspotman.posX
posX
Definition: beamspotman.py:1624
NswErrorCalibData::Input::clusterSize
unsigned int clusterSize
Cluster size.
Definition: NswErrorCalibData.h:37
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
keylayer_zslicemap.strip
strip
Definition: keylayer_zslicemap.py:151
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
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::covMatrix
covMatrix
Definition: TrackMeasurement_v1.cxx:19
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
Muon::SimpleMMClusterBuilderTool::m_maxHoleSize
Gaudi::Property< uint > m_maxHoleSize
Definition: SimpleMMClusterBuilderTool.h:54
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
NSWCalib::CalibratedStrip
Definition: INSWCalibTool.h:20
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
NswErrorCalibData::Input::stripId
Identifier stripId
Identifier of the strip.
Definition: NswErrorCalibData.h:27
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
charge
double charge(const T &p)
Definition: AtlasPID.h:538
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
beamspotman.posY
posY
Definition: beamspotman.py:1624
a
TList * a
Definition: liststreamerinfos.cxx:10
h
MmIdHelper
Definition: MmIdHelper.h:54
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
Muon::SimpleMMClusterBuilderTool::m_writeStripProperties
Gaudi::Property< bool > m_writeStripProperties
Definition: SimpleMMClusterBuilderTool.h:53
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
Muon::NswClustering::toLocal
Amg::Vector3D toLocal(const Trk::Surface &surf, const Amg::Vector3D &dir)
Rotates a direction vector into a local frame: x-axis : Parallell to the radial direction of the dete...
Definition: NswClusteringUtils.h:21
Muon::MMPrepData::Author::SimpleClusterBuilder
@ SimpleClusterBuilder
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
NswErrorCalibData::Input
Helper struct to be parsed to the object to derive the specific error of the cluster.
Definition: NswErrorCalibData.h:25
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
Muon::SimpleMMClusterBuilderTool::m_maxClusSize
Gaudi::Property< unsigned int > m_maxClusSize
Definition: SimpleMMClusterBuilderTool.h:55
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
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
Muon::SimpleMMClusterBuilderTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: SimpleMMClusterBuilderTool.h:46
Identifier
Definition: IdentifierFieldParser.cxx:14