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

#include <UTPCMMClusterBuilderTool.h>

Inheritance diagram for Muon::UTPCMMClusterBuilderTool:
Collaboration diagram for Muon::UTPCMMClusterBuilderTool:

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

 UTPCMMClusterBuilderTool (const std::string &, const std::string &, const IInterface *)
 Default constructor. More...
 
virtual ~UTPCMMClusterBuilderTool ()=default
 Default destructor. More...
 
virtual StatusCode initialize () override
 standard initialize method More...
 
virtual 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...
 
virtual 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

using LaySortedPrds = std::array< std::vector< Muon::MMPrepData >, 8 >
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode runHoughTrafo (const std::vector< Muon::MMPrepData > &mmPrd, std::vector< double > &xpos, std::vector< int > &flag, std::vector< int > &idx_selected) const
 
StatusCode fillHoughTrafo (const std::vector< Muon::MMPrepData > &mmPrd, std::vector< double > &xpos, std::vector< int > &flag, std::unique_ptr< TH2D > &h_hough) const
 
StatusCode houghInitCummulator (std::unique_ptr< TH2D > &cummulator, double xmax, double xmin) const
 
StatusCode findAlphaMax (std::unique_ptr< TH2D > &h_hough, std::vector< std::tuple< double, double >> &maxPos) const
 
StatusCode selectTrack (const std::vector< Muon::MMPrepData > &mmPrd, std::vector< double > &xpos, std::vector< int > &flag, std::vector< std::tuple< double, double >> &tracks, std::vector< int > &idxGoodStrips) const
 
StatusCode transformParameters (double alpha, double d, double dRMS, double &slope, double &intercept, double &interceptRMS) const
 
StatusCode applyCrossTalkCut (std::vector< int > &idxSelected, const std::vector< MMPrepData > &MMPrdsOfLayer, std::vector< int > &flag, int &nStripsCut) const
 
StatusCode finalFit (const std::vector< Identifier > &ids, const std::vector< float > &stripsPos, const std::vector< float > &driftDists, const std::vector< AmgVector(2)> &driftDistErrors, double &x0, double &sigmaX0, double &fitAngle, double &chiSqProb) const
 
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 {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 Muon Detector Descriptor. More...
 
Gaudi::Property< bool > m_writeStripProperties {this, "writeStripProperties", true }
 
Gaudi::Property< double > m_alphaMin {this, "HoughAlphaMin", -90. }
 
Gaudi::Property< double > m_alphaMax {this, "HoughAlphaMax", 0. }
 
Gaudi::Property< double > m_alphaResolution {this, "HoughAlphaResolution", 1.}
 
Gaudi::Property< double > m_selectionCut {this, "HoughSelectionCut", 1. * Gaudi::Units::mm}
 
Gaudi::Property< double > m_dMin {this, "HoughDMin", 0.}
 
Gaudi::Property< double > m_dMax {this, "HoughDMax", 0.}
 
Gaudi::Property< double > m_dResolution {this, "HoughDResolution", 0.125}
 
Gaudi::Property< double > m_driftRange {this, "HoughExpectedDriftRange", 12.*Gaudi::Units::m}
 
Gaudi::Property< unsigned > m_houghMinCounts {this, "HoughMinCounts", 3}
 
Gaudi::Property< double > m_outerChargeRatioCut {this,"outerChargeRatioCut", 0.}
 charge ratio cut to supress cross talk More...
 
Gaudi::Property< int > m_maxStripsCut {this, "maxStripRemove", 4}
 
Gaudi::Property< bool > m_digiHasNegativeAngles {this, "digiHasNegativeAngle", true}
 
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 27 of file UTPCMMClusterBuilderTool.h.

Member Typedef Documentation

◆ LaySortedPrds

using Muon::UTPCMMClusterBuilderTool::LaySortedPrds = std::array<std::vector<Muon::MMPrepData>, 8>
private

Definition at line 49 of file UTPCMMClusterBuilderTool.h.

◆ 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

◆ UTPCMMClusterBuilderTool()

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

Default constructor.

Definition at line 30 of file UTPCMMClusterBuilderTool.cxx.

30  :
31  AthAlgTool(t, n, p) {
32  declareInterface<IMMClusterBuilderTool>(this);
33 }

◆ ~UTPCMMClusterBuilderTool()

virtual Muon::UTPCMMClusterBuilderTool::~UTPCMMClusterBuilderTool ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ applyCrossTalkCut()

StatusCode Muon::UTPCMMClusterBuilderTool::applyCrossTalkCut ( std::vector< int > &  idxSelected,
const std::vector< MMPrepData > &  MMPrdsOfLayer,
std::vector< int > &  flag,
int &  nStripsCut 
) const
private

Definition at line 348 of file UTPCMMClusterBuilderTool.cxx.

349  {
350  int N = idxSelected.size();
351  bool removedStrip = false;
352  ATH_MSG_DEBUG("starting to remove cross talk strips " << idxSelected << " flag " << flag);
353  if (N < 3 || nStripsCut >= m_maxStripsCut) {
354  ATH_MSG_DEBUG("first cut failed");
355  return StatusCode::FAILURE;
356  }
357  // reject outer strip for fit if charge ratio to second outer strip indicates strip charge is created by crosstalk only
358  double ratioLastStrip = 1.0 * MMPrdsOfLayer.at(idxSelected.at(N - 1)).charge() / MMPrdsOfLayer.at(idxSelected.at(N - 2)).charge();
359  double ratioFirstStrip = 1.0 * MMPrdsOfLayer.at(idxSelected.at(0)).charge() / MMPrdsOfLayer.at(idxSelected.at(1)).charge();
360  ATH_MSG_DEBUG("ratioLastStrip " << ratioLastStrip << " ratioFirstStrip " << ratioFirstStrip);
361  if (ratioLastStrip < m_outerChargeRatioCut) {
362  flag.at(idxSelected.at(N - 1)) = 2;
363  idxSelected.erase(idxSelected.begin() + (N - 1));
364  removedStrip = true;
365  nStripsCut++;
366  ATH_MSG_DEBUG("cutting last strip nStripCuts: " << nStripsCut << " flag " << flag << " idxSelected " << idxSelected);
367  }
368  if (idxSelected.size() < 3 || nStripsCut >= m_maxStripsCut) {
369  ATH_MSG_DEBUG("first cut failed");
370  return StatusCode::FAILURE;
371  }
372 
373  if (ratioFirstStrip < m_outerChargeRatioCut) {
374  flag.at(idxSelected.at(0)) = 2;
375  idxSelected.erase(idxSelected.begin() + 0);
376  removedStrip = true;
377  nStripsCut++;
378  ATH_MSG_DEBUG("cutting first strip nStripCuts: " << nStripsCut << " flag " << flag << " idxSelected " << idxSelected);
379  }
380  if (nStripsCut >= m_maxStripsCut) {
381  ATH_MSG_DEBUG("first cut failed");
382  return StatusCode::FAILURE;
383  }
384  ATH_MSG_DEBUG("return value " << (!removedStrip ? "FAILURE" : "SUCCESS"));
385  return (!removedStrip ? StatusCode::FAILURE : StatusCode::SUCCESS); // return success if at least one strip was removed
386 }

◆ 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

◆ fillHoughTrafo()

StatusCode Muon::UTPCMMClusterBuilderTool::fillHoughTrafo ( const std::vector< Muon::MMPrepData > &  mmPrd,
std::vector< double > &  xpos,
std::vector< int > &  flag,
std::unique_ptr< TH2D > &  h_hough 
) const
private

Definition at line 242 of file UTPCMMClusterBuilderTool.cxx.

243  {
244  for (size_t i_hit = 0; i_hit < mmPrd.size(); i_hit++) {
245  if (flag.at(i_hit) != 0) continue; // skip hits which have been already used or been rejected as cross talk
246  for (int i_alpha = 1; i_alpha < h_hough->GetNbinsX(); i_alpha++) {
247  double alpha = h_hough->GetXaxis()->GetBinCenter(i_alpha);
248  double d = xpos.at(i_hit) * std::cos(alpha) - mmPrd.at(i_hit).driftDist() * std::sin(alpha);
249  ATH_MSG_VERBOSE("Fill Hough alpha: " << alpha << " d " << d << " x " << xpos.at(i_hit) << " y " << mmPrd.at(i_hit).driftDist());
250  h_hough->Fill(alpha, d);
251  }
252  }
253  return StatusCode::SUCCESS;
254 }

◆ finalFit()

StatusCode Muon::UTPCMMClusterBuilderTool::finalFit ( const std::vector< Identifier > &  ids,
const std::vector< float > &  stripsPos,
const std::vector< float > &  driftDists,
const std::vector< AmgVector(2)> &  driftDistErrors,
double &  x0,
double &  sigmaX0,
double &  fitAngle,
double &  chiSqProb 
) const
private

Definition at line 388 of file UTPCMMClusterBuilderTool.cxx.

390  {
391  std::unique_ptr<TGraphErrors> fitGraph = std::make_unique<TGraphErrors>();
392  std::unique_ptr<TF1> ffit = std::make_unique<TF1>("ffit", "pol1");
393 
394  double xmin = 5000;
395  double xmax = -5000;
396  double xmean = std::accumulate(stripsPos.begin(), stripsPos.end(), 0.0) / stripsPos.size(); // get mean x value
397 
398  std::unique_ptr<TLinearFitter> lf = std::make_unique<TLinearFitter>(1, "1++x");
399 
400  for (size_t idx = 0; idx < stripsPos.size(); idx++) {
401  double xpos = stripsPos.at(idx) - xmean; // substract mean value from x to center fit around 0
402  if (xmin > xpos)
403  xmin = xpos;
404  else if (xmax < xpos)
405  xmax = xpos;
406  lf->AddPoint(&xpos, driftDists.at(idx));
407  fitGraph->SetPoint(fitGraph->GetN(), xpos, driftDists.at(idx));
408  fitGraph->SetPointError(fitGraph->GetN() - 1, std::sqrt(driftDistErrors.at(idx)[0]), std::sqrt(driftDistErrors.at(idx)[1]));
409  }
410  lf->Eval();
411 
412  if (m_idHelperSvc->mmIdHelper().gasGap(ids.at(0)) % 2 == 1 || !m_digiHasNegativeAngles) {
413  ffit->SetParLimits(1, -11.5, -0.15); // 5 to 81 degree
414  } else {
415  ffit->SetParLimits(1, 0.15, 11.5); // 5 to 81 degree
416  }
417  ffit->SetParameters(lf->GetParameter(0), lf->GetParameter(1));
418  TFitResultPtr s = fitGraph->Fit("ffit", "SMQ", "", xmin - .5, xmax + .5);
419 
420  double cov = (s->GetCovarianceMatrix())(0, 1);
421  ATH_MSG_DEBUG("covariance is: " << cov);
422  double fitSlope = ffit->GetParameter(1);
423  double dHalfGap = 2.52; // half the thickness of the gas gap
424  double interceptCorr = dHalfGap - ffit->GetParameter(0);
425  x0 = interceptCorr / fitSlope;
426  sigmaX0 =
427  (std::pow(ffit->GetParError(0) / interceptCorr, 2) + std::pow(ffit->GetParError(1) / fitSlope, 2) - 2. / (fitSlope * interceptCorr) * cov) *
428  std::pow(x0, 2);
429  x0 += xmean; // adding back mean value after error was calculated
430  fitAngle = std::tan(-1 / fitSlope);
431  chiSqProb = ffit->GetProb();
432 
433  {
434  ATH_MSG_DEBUG("==========uTPC fit Summary==============");
435 
436  ATH_MSG_DEBUG("Fit slope: " << ffit->GetParameter(1));
437 
438  ATH_MSG_DEBUG("Fit intercept:" << ffit->GetParameter(0));
439 
440  ATH_MSG_DEBUG("Fit status: " << s);
441 
442  ATH_MSG_DEBUG("Cluster position " << x0 << " +- " << sigmaX0);
443 
444  ATH_MSG_DEBUG("Fit angle: " << fitAngle << " " << fitAngle * 180. / M_PI);
445 
446  ATH_MSG_DEBUG("ChisSqProb" << chiSqProb);
447  ATH_MSG_DEBUG("nStrips:" << stripsPos.size());
448  ATH_MSG_DEBUG("gas gap:" << m_idHelperSvc->mmIdHelper().gasGap(ids.at(0)));
449  }
450  if (s != 0 && s != 4000) { // 4000 means fit succesfull but error optimization by minos failed; fit is still usable.
451  ATH_MSG_DEBUG("Final fit failed with error code " << s);
452  return StatusCode::FAILURE;
453  }
454  if ((m_idHelperSvc->mmIdHelper().gasGap(ids.at(0)) % 2 == 1 || !m_digiHasNegativeAngles) &&
455  (ffit->GetParameter(1) <= -11.49 || ffit->GetParameter(1) >= -0.151))
456  return StatusCode::FAILURE; // fit should have negativ slope for odd gas gaps
457  if (m_idHelperSvc->mmIdHelper().gasGap(ids.at(0)) % 2 == 0 && m_digiHasNegativeAngles &&
458  (ffit->GetParameter(1) >= 11.49 || ffit->GetParameter(1) <= 0.151))
459  return StatusCode::FAILURE; // fit should have positiv slope for even gas gaps
460  return StatusCode::SUCCESS;
461 }

◆ findAlphaMax()

StatusCode Muon::UTPCMMClusterBuilderTool::findAlphaMax ( std::unique_ptr< TH2D > &  h_hough,
std::vector< std::tuple< double, double >> &  maxPos 
) const
private

Definition at line 256 of file UTPCMMClusterBuilderTool.cxx.

257  {
258  unsigned int cmax = h_hough->GetMaximum();
259  if (cmax < m_houghMinCounts) {
260  ATH_MSG_DEBUG("cmax " << cmax << "smaller then m_houghMinCounts " << m_houghMinCounts);
261  return StatusCode::FAILURE;
262  }
263 
264  for (int i_binX = 0; i_binX <= h_hough->GetNbinsX(); i_binX++) {
265  for (int i_binY = 0; i_binY <= h_hough->GetNbinsY(); i_binY++) {
266  if (h_hough->GetBinContent(i_binX, i_binY) == cmax) {
267  ATH_MSG_DEBUG("Find Max Alpha: BinX "
268  << i_binX << " Alpha: " << h_hough->GetXaxis()->GetBinCenter(i_binX) / Gaudi::Units::degree
269  << " BinY: " << i_binY << " over threshold: " << h_hough->GetBinContent(i_binX, i_binY));
270  maxPos.emplace_back(h_hough->GetXaxis()->GetBinCenter(i_binX), h_hough->GetYaxis()->GetBinCenter(i_binY));
271  }
272  }
273  }
274  return StatusCode::SUCCESS;
275 }

◆ getCalibratedClusterPosition()

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

Implements Muon::IMMClusterBuilderTool.

Definition at line 463 of file UTPCMMClusterBuilderTool.cxx.

467  {
468 
469  std::vector<Identifier> ids;
470  std::vector<float> stripsPos;
471  std::vector<float> driftDists;
472  std::vector<AmgVector(2)> driftDistErrors;
473 
474  for (const NSWCalib::CalibratedStrip& strip : calibratedStrips) {
475  ids.push_back(strip.identifier);
476  stripsPos.push_back(strip.locPos.x());
477  driftDists.push_back(strip.distDrift);
478  driftDistErrors.emplace_back(strip.resTransDistDrift, strip.resLongDistDrift);
479  }
480 
481  double localClusterPosition = -9999;
482  double sigmaLocalClusterPosition = 0;
483  double finalFitAngle, finalFitChiSqProb;
484 
485  StatusCode sc = finalFit(ids, stripsPos, driftDists, driftDistErrors, localClusterPosition, sigmaLocalClusterPosition, finalFitAngle,
486  finalFitChiSqProb);
487  if (sc == StatusCode::FAILURE) return RIO_Author::unKnownAuthor;
488 
489  clusterLocalPosition[Trk::locX] = localClusterPosition;
490 
491  Amg::MatrixX covN(1, 1);
492  covN.coeffRef(0, 0) = sigmaLocalClusterPosition;
493  covMatrix = covN;
494  return RIO_Author::uTPCClusterBuilder;
495 }

◆ getClusters()

StatusCode Muon::UTPCMMClusterBuilderTool::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

Implements Muon::IMMClusterBuilderTool.

Definition at line 40 of file UTPCMMClusterBuilderTool.cxx.

42  {
43 
44  LaySortedPrds MMprdsPerLayer{};
45  for (MMPrepData& MMprd : MMprds) {
46  Identifier id = MMprd.identify();
47  int layer = 4 * (m_idHelperSvc->mmIdHelper().multilayer(id) - 1) + (m_idHelperSvc->mmIdHelper().gasGap(id) - 1);
48  ATH_MSG_DEBUG("Sorting PRD into layer layer: " << layer << " gas_gap " << m_idHelperSvc->mmIdHelper().gasGap(id) << "multilayer "
49  << m_idHelperSvc->mmIdHelper().multilayer(id));
50  MMprdsPerLayer.at(layer).push_back(std::move(MMprd));
51  }
52 
53  // sort MMPrds by channel
54  for (std::vector<MMPrepData>& prdInLay : MMprdsPerLayer) {
55  std::sort(prdInLay.begin(), prdInLay.end(), [this](const MMPrepData& a, const MMPrepData& b) {
56  return m_idHelperSvc->mmIdHelper().channel(a.identify()) < m_idHelperSvc->mmIdHelper().channel(b.identify());
57  });
58  }
59 
60  for (std::vector<MMPrepData>& MMprdsOfLayer : MMprdsPerLayer) {
61  std::vector<double> stripsLocalPosX;
62  stripsLocalPosX.reserve(MMprdsOfLayer.size());
63 
64  for (MMPrepData& MMprd : MMprdsOfLayer) {
65  Identifier id_prd = MMprd.identify();
66  int gasGap = m_idHelperSvc->mmIdHelper().gasGap(id_prd);
67  stripsLocalPosX.push_back(
68  ((gasGap % 2 == 0 && m_digiHasNegativeAngles) ? -1 : 1) *
69  MMprd.localPosition().x()); // flip local positions for even gas gaps to reduce hough space to positiv angles
70 
71  // determine angle to IP for debug reasons
72  double globalR = MMprd.globalPosition().perp();
73  double Tan = globalR / MMprd.globalPosition().z();
74  double angleToIp = std::atan(Tan) / Gaudi::Units::degree;
75 
76  ATH_MSG_DEBUG("Hit channel: " << m_idHelperSvc->toString(id_prd) << " time " << MMprd.time() << " drift dist "
77  << MMprd.driftDist() << " localPosX " <<Amg::toString(MMprd.localPosition())
78  << " angleToIp " << angleToIp);
79  }
80  if (MMprdsOfLayer.size() < 2) continue;
81 
82  // move hits to the origin of the coordinate system to exclude extrapolation error and to keep the size of the hough space small
83  double meanX = std::accumulate(stripsLocalPosX.begin(), stripsLocalPosX.end(), 0.0) / stripsLocalPosX.size();
84  ATH_MSG_DEBUG("Got mean element " << meanX);
85  std::for_each(stripsLocalPosX.begin(), stripsLocalPosX.end(), [meanX](double& d) { d -= meanX; });
86  ATH_MSG_VERBOSE(stripsLocalPosX);
87 
88  // vector of 0s, ones and twos to indicate if strip was already used (0=unused;1=used;2=rejected as cross talk)
89  std::vector<int> flag = std::vector<int>(MMprdsOfLayer.size(), 0);
90 
91  while (true) {
92  ATH_MSG_DEBUG("while true");
93  std::vector<int> idx_goodStrips;
94  StatusCode sc = runHoughTrafo(MMprdsOfLayer, stripsLocalPosX, flag, idx_goodStrips);
95 
96  ATH_MSG_DEBUG("Hough done");
97  // if(sc.isFailure()) break;
98  if (idx_goodStrips.size() < 3 || sc.isFailure()) {
99  // break; // should be already catched in runHough but for safety once more here
100  idx_goodStrips.clear();
101  for (size_t i_hit = 0; i_hit < MMprdsOfLayer.size(); i_hit++) {
102  if (flag.at(i_hit) == 0) idx_goodStrips.push_back(i_hit);
103  }
104  ATH_MSG_DEBUG("Hough Trafo failed, try to fit everything");
105  }
106 
107  // remove strips induced by crosstalk till no more strip was removed
108  int nStripsCutByCrosstalk = 0;
109  while (!applyCrossTalkCut(idx_goodStrips, MMprdsOfLayer, flag, nStripsCutByCrosstalk).isFailure()) {}
110  ATH_MSG_DEBUG("After cutting CT idx_goddStrips " << idx_goodStrips << " flag " << flag);
111 
112  std::vector<Identifier> stripsOfCluster;
113  std::vector<uint16_t> stripsOfClusterChannels;
114  std::vector<short int> stripsOfClusterTimes;
115  std::vector<int> stripsOfClusterCharges;
116  std::vector<float> stripsOfClusterDriftDists;
117  std::vector<AmgVector(2)> stripsOfClusterDriftDistErrors;
118  std::vector<float> stripsOfClusterLocalPos; // needed for the final fit function
119  stripsOfCluster.reserve(idx_goodStrips.size());
120  if (m_writeStripProperties) { stripsOfClusterChannels.reserve(idx_goodStrips.size()); }
121  stripsOfClusterTimes.reserve(idx_goodStrips.size());
122  stripsOfClusterCharges.reserve(idx_goodStrips.size());
123  stripsOfClusterDriftDists.reserve(idx_goodStrips.size());
124  stripsOfClusterDriftDistErrors.reserve(idx_goodStrips.size());
125  stripsOfClusterLocalPos.reserve(idx_goodStrips.size());
126 
127  ATH_MSG_DEBUG("Found good Strips: " << idx_goodStrips.size());
128 
129  for (int idx : idx_goodStrips) {
130  ATH_MSG_DEBUG("Setting good strip: " << idx << " size of strips flag: " << flag.size());
131  flag.at(idx) = 1;
132  ATH_MSG_DEBUG("Set Good strips");
133  stripsOfCluster.push_back(MMprdsOfLayer.at(idx).identify());
135  stripsOfClusterChannels.push_back(m_idHelperSvc->mmIdHelper().channel(MMprdsOfLayer.at(idx).identify()));
136  stripsOfClusterTimes.push_back(MMprdsOfLayer.at(idx).time());
137  stripsOfClusterCharges.push_back(MMprdsOfLayer.at(idx).charge());
138  }
139  stripsOfClusterDriftDists.push_back(MMprdsOfLayer.at(idx).driftDist());
140  const Amg::MatrixX cov{MMprdsOfLayer.at(idx).localCovariance()};
141  stripsOfClusterDriftDistErrors.emplace_back(cov(0,0), cov(1,1));
142  stripsOfClusterLocalPos.push_back(MMprdsOfLayer.at(idx).localPosition().x());
143  }
144 
145  double localClusterPosition = -9999;
146  double sigmaLocalClusterPosition = 0;
147  double finalFitAngle, finalFitChiSqProb;
148 
149  sc = finalFit(stripsOfCluster, stripsOfClusterLocalPos, stripsOfClusterDriftDists, stripsOfClusterDriftDistErrors,
150  localClusterPosition, sigmaLocalClusterPosition, finalFitAngle, finalFitChiSqProb);
151 
152  ATH_MSG_DEBUG("final fit done");
153 
154  if (sc.isFailure()) break;
155  ATH_MSG_DEBUG("Did final fit successfull");
156 
157  auto covN = Amg::MatrixX(1, 1);
158  covN.coeffRef(0, 0) = sigmaLocalClusterPosition;
159  ATH_MSG_DEBUG("Did set covN Matrix");
160  int idx = idx_goodStrips[0];
161  ATH_MSG_DEBUG("idx_goodStrips[0]: " << idx << " size: " << MMprdsOfLayer.size());
162  Amg::Vector2D localClusterPositionV(localClusterPosition,
163  MMprdsOfLayer.at(idx).localPosition().y()); // y position is the same for all strips
164  ATH_MSG_DEBUG("Did set local position");
165 
166  float driftDist = 0.0;
167 
168  std::unique_ptr<MMPrepData> prdN = std::make_unique<MMPrepData>(MMprdsOfLayer.at(idx).identify(),
169  MMprdsOfLayer.at(idx).collectionHash(),
170  std::move(localClusterPositionV),
171  std::move(stripsOfCluster),
172  std::move(covN),
173  MMprdsOfLayer.at(idx).detectorElement(),
174  0,
175  std::accumulate(stripsOfClusterCharges.begin(), stripsOfClusterCharges.end(), 0),
176  driftDist,
177  std::move(stripsOfClusterChannels),
178  std::move(stripsOfClusterTimes),
179  std::move(stripsOfClusterCharges));
180 
181  ATH_MSG_DEBUG("Did create new prd");
182 
183  ATH_MSG_DEBUG("Setting prd angle: " << finalFitAngle << " chi2 Prob: " << finalFitChiSqProb);
184 
186  prdN->setDriftDist(std::move(stripsOfClusterDriftDists), std::move(stripsOfClusterDriftDistErrors));
187 
188  prdN->setMicroTPC(finalFitAngle, finalFitChiSqProb);
189  ATH_MSG_DEBUG("Reading back prd angle: " << prdN->angle() << " chi2 Prob: " << prdN->chisqProb());
190  clustersVect.push_back(std::move(prdN));
191  ATH_MSG_DEBUG("pushedBack prdN");
192  int leftOverStrips = 0;
193  for (auto f : flag) {
194  if (f == 0) leftOverStrips++;
195  }
196  if (leftOverStrips < 3) break;
197  }
198  ATH_MSG_DEBUG("End of get clusters layer");
199  }
200  ATH_MSG_DEBUG("End of get clusters");
201  return StatusCode::SUCCESS;
202 }

◆ houghInitCummulator()

StatusCode Muon::UTPCMMClusterBuilderTool::houghInitCummulator ( std::unique_ptr< TH2D > &  cummulator,
double  xmax,
double  xmin 
) const
private

Definition at line 225 of file UTPCMMClusterBuilderTool.cxx.

225  {
226  ATH_MSG_VERBOSE("xmax: " << xmax << " xmin: " << xmin << " m_dResolution " << m_dResolution << " m_alphaMin " << m_alphaMin
227  << " m_alphaMax: " << m_alphaMax << " m_alphaResolution: " << m_alphaResolution);
228  double dmax = std::max(std::fabs(xmin), std::fabs(xmax));
229  dmax = std::sqrt(std::pow(dmax, 2) +
230  std::pow(m_driftRange, 2)); // rspace =sqrt(xmax*xmax+driftrange*driftrange) where driftrange is assumed to be 6mm
231  int nbinsd = static_cast<int>(1.0 * dmax * 2 / m_dResolution);
232  int nbinsa = static_cast<int>((1.0 * m_alphaMax - m_alphaMin) / m_alphaResolution);
233 
234  ATH_MSG_VERBOSE("Hough Using nBinsA " << nbinsa << " nBinsd " << nbinsd << " dmax " << dmax);
235 
236  h_hough = std::make_unique<TH2D>("h_hough", "h_hough", nbinsa, m_alphaMin * Gaudi::Units::degree, m_alphaMax * Gaudi::Units::degree,
237  nbinsd, -dmax, dmax);
238 
239  return StatusCode::SUCCESS;
240 }

◆ initialize()

StatusCode Muon::UTPCMMClusterBuilderTool::initialize ( )
overridevirtual

standard initialize method

Definition at line 35 of file UTPCMMClusterBuilderTool.cxx.

35  {
36  ATH_CHECK(m_idHelperSvc.retrieve());
37  return StatusCode::SUCCESS;
38 }

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

◆ runHoughTrafo()

StatusCode Muon::UTPCMMClusterBuilderTool::runHoughTrafo ( const std::vector< Muon::MMPrepData > &  mmPrd,
std::vector< double > &  xpos,
std::vector< int > &  flag,
std::vector< int > &  idx_selected 
) const
private

Definition at line 204 of file UTPCMMClusterBuilderTool.cxx.

205  {
206  ATH_MSG_DEBUG("beginning of runHoughTrafo() with: " << xpos.size() << " hits");
207  double maxX = *std::max_element(xpos.begin(), xpos.end());
208  double minX = *std::min_element(xpos.begin(), xpos.end());
209  std::unique_ptr<TH2D> h_hough = nullptr;
210  StatusCode sc = houghInitCummulator(h_hough, maxX, minX);
211 
212  if (sc.isFailure()) return sc;
213  sc = fillHoughTrafo(mmPrd, xpos, flag, h_hough);
214  ATH_MSG_DEBUG("filled Hough");
215  if (sc.isFailure()) return sc;
216 
217  std::vector<std::tuple<double, double>> houghPeaks;
218  sc = findAlphaMax(h_hough, houghPeaks);
219  if (sc.isFailure()) return sc;
220  ATH_MSG_DEBUG("Found HoughPeaks");
221  sc = selectTrack(mmPrd, xpos, flag, houghPeaks, idx_selected);
222  if (sc.isFailure()) return sc;
223  return StatusCode::SUCCESS;
224 }

◆ selectTrack()

StatusCode Muon::UTPCMMClusterBuilderTool::selectTrack ( const std::vector< Muon::MMPrepData > &  mmPrd,
std::vector< double > &  xpos,
std::vector< int > &  flag,
std::vector< std::tuple< double, double >> &  tracks,
std::vector< int > &  idxGoodStrips 
) const
private

Definition at line 277 of file UTPCMMClusterBuilderTool.cxx.

279  {
280  std::vector<double> chi2;
281  std::vector<std::vector<int>> allGoodStrips;
282  std::vector<int> ngoodStrips;
283  std::vector<std::tuple<int, double>> trackQuality; // touble holding the number of good strips and the chi2 for each track
284  for (auto track : tracks) {
285  double houghAngle = std::get<0>(track);
286  double houghD = std::get<1>(track);
287  double slope, intercept;
288  double interceptRMS;
289  double aRMS = 0;
290  StatusCode sc = transformParameters(houghAngle, houghD, aRMS, slope, intercept, interceptRMS);
291  if (sc.isFailure()) { return sc; }
292  std::vector<double> dist;
293  std::vector<int> indexUsedForDist, goodStrips;
294  for (size_t i_hit = 0; i_hit < xpos.size(); i_hit++) {
295  if (flag.at(i_hit) != 1) {
296  dist.push_back(mmPrd.at(i_hit).driftDist() - slope * xpos.at(i_hit) - intercept);
297  indexUsedForDist.push_back(i_hit);
298  }
299  }
300  ATH_MSG_VERBOSE("indexUsedForDist " << indexUsedForDist);
301  ATH_MSG_VERBOSE("distVec: " << dist);
302  dist.clear();
303  for (size_t i_hit : indexUsedForDist) {
304  double d = mmPrd.at(i_hit).driftDist() - slope * xpos.at(i_hit) - intercept;
305  ATH_MSG_VERBOSE("dist: " << d << " for index " << i_hit);
306  if (std::fabs(d) < m_selectionCut) {
307  dist.push_back(d * d / mmPrd.at(i_hit).localCovariance()(1, 1)); // determine chi2
308  goodStrips.push_back(i_hit);
309  }
310  }
311  {
312  ATH_MSG_DEBUG("Angle estimate =" << std::get<0>(track) << " " << std::get<0>(track) / Gaudi::Units::degree);
313 
314  ATH_MSG_DEBUG("restimate =" << std::get<1>(track));
315 
316  ATH_MSG_DEBUG("slope estimate =" << slope);
317 
318  ATH_MSG_DEBUG("intercept estimate =" << intercept);
319 
320  ATH_MSG_DEBUG("good strips =" << goodStrips);
321 
322  ATH_MSG_DEBUG("n good points =" << goodStrips.size());
323 
324  ATH_MSG_DEBUG("chi2 =" << std::accumulate(dist.begin(), dist.end(), 0.0) / (dist.size() - 2));
325  }
326  if (!goodStrips.empty()) {
327  allGoodStrips.push_back(goodStrips);
328  chi2.push_back(std::accumulate(dist.begin(), dist.end(), 0.0) / (dist.size() - 2));
329  trackQuality.emplace_back(goodStrips.size(), std::accumulate(dist.begin(), dist.end(), 0.0) / (dist.size() - 2));
330  }
331  }
332  if (chi2.empty()) return StatusCode::FAILURE;
333  int trackIndex = std::min_element(trackQuality.begin(), trackQuality.end(), sortTracks) - trackQuality.begin();
334  idxGoodStrips = allGoodStrips.at(trackIndex);
335  return StatusCode::SUCCESS;
336 }

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

◆ transformParameters()

StatusCode Muon::UTPCMMClusterBuilderTool::transformParameters ( double  alpha,
double  d,
double  dRMS,
double &  slope,
double &  intercept,
double &  interceptRMS 
) const
private

Definition at line 338 of file UTPCMMClusterBuilderTool.cxx.

339  {
340  slope = 1. / std::tan(alpha);
341  intercept = -d / std::sin(alpha);
342  interceptRMS = std::fabs(dRMS);
343  ATH_MSG_VERBOSE("transformParameters alpha: " << alpha << " d: " << d << " dRMS: " << dRMS << " slope: " << slope
344  << " intercept: " << intercept);
345  return StatusCode::SUCCESS;
346 }

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

Gaudi::Property<double> Muon::UTPCMMClusterBuilderTool::m_alphaMax {this, "HoughAlphaMax", 0. }
private

Definition at line 57 of file UTPCMMClusterBuilderTool.h.

◆ m_alphaMin

Gaudi::Property<double> Muon::UTPCMMClusterBuilderTool::m_alphaMin {this, "HoughAlphaMin", -90. }
private

Definition at line 56 of file UTPCMMClusterBuilderTool.h.

◆ m_alphaResolution

Gaudi::Property<double> Muon::UTPCMMClusterBuilderTool::m_alphaResolution {this, "HoughAlphaResolution", 1.}
private

Definition at line 58 of file UTPCMMClusterBuilderTool.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_digiHasNegativeAngles

Gaudi::Property<bool> Muon::UTPCMMClusterBuilderTool::m_digiHasNegativeAngles {this, "digiHasNegativeAngle", true}
private

Definition at line 71 of file UTPCMMClusterBuilderTool.h.

◆ m_dMax

Gaudi::Property<double> Muon::UTPCMMClusterBuilderTool::m_dMax {this, "HoughDMax", 0.}
private

Definition at line 61 of file UTPCMMClusterBuilderTool.h.

◆ m_dMin

Gaudi::Property<double> Muon::UTPCMMClusterBuilderTool::m_dMin {this, "HoughDMin", 0.}
private

Definition at line 60 of file UTPCMMClusterBuilderTool.h.

◆ m_dResolution

Gaudi::Property<double> Muon::UTPCMMClusterBuilderTool::m_dResolution {this, "HoughDResolution", 0.125}
private

Definition at line 62 of file UTPCMMClusterBuilderTool.h.

◆ m_driftRange

Gaudi::Property<double> Muon::UTPCMMClusterBuilderTool::m_driftRange {this, "HoughExpectedDriftRange", 12.*Gaudi::Units::m}
private

Definition at line 63 of file UTPCMMClusterBuilderTool.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_houghMinCounts

Gaudi::Property<unsigned> Muon::UTPCMMClusterBuilderTool::m_houghMinCounts {this, "HoughMinCounts", 3}
private

Definition at line 64 of file UTPCMMClusterBuilderTool.h.

◆ m_idHelperSvc

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

Muon Detector Descriptor.

Definition at line 51 of file UTPCMMClusterBuilderTool.h.

◆ m_maxStripsCut

Gaudi::Property<int> Muon::UTPCMMClusterBuilderTool::m_maxStripsCut {this, "maxStripRemove", 4}
private

Definition at line 69 of file UTPCMMClusterBuilderTool.h.

◆ m_outerChargeRatioCut

Gaudi::Property<double> Muon::UTPCMMClusterBuilderTool::m_outerChargeRatioCut {this,"outerChargeRatioCut", 0.}
private

charge ratio cut to supress cross talk

Definition at line 67 of file UTPCMMClusterBuilderTool.h.

◆ m_selectionCut

Gaudi::Property<double> Muon::UTPCMMClusterBuilderTool::m_selectionCut {this, "HoughSelectionCut", 1. * Gaudi::Units::mm}
private

Definition at line 59 of file UTPCMMClusterBuilderTool.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::UTPCMMClusterBuilderTool::m_writeStripProperties {this, "writeStripProperties", true }
private

Definition at line 53 of file UTPCMMClusterBuilderTool.h.


The documentation for this class was generated from the following files:
Muon::UTPCMMClusterBuilderTool::m_alphaMax
Gaudi::Property< double > m_alphaMax
Definition: UTPCMMClusterBuilderTool.h:57
TH2D::GetBinContent
double GetBinContent(int) const
Definition: rootspy.cxx:435
Muon::UTPCMMClusterBuilderTool::m_writeStripProperties
Gaudi::Property< bool > m_writeStripProperties
Definition: UTPCMMClusterBuilderTool.h:53
Muon::UTPCMMClusterBuilderTool::m_dResolution
Gaudi::Property< double > m_dResolution
Definition: UTPCMMClusterBuilderTool.h:62
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
Muon::UTPCMMClusterBuilderTool::applyCrossTalkCut
StatusCode applyCrossTalkCut(std::vector< int > &idxSelected, const std::vector< MMPrepData > &MMPrdsOfLayer, std::vector< int > &flag, int &nStripsCut) const
Definition: UTPCMMClusterBuilderTool.cxx:348
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
Muon::UTPCMMClusterBuilderTool::m_driftRange
Gaudi::Property< double > m_driftRange
Definition: UTPCMMClusterBuilderTool.h:63
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
max
#define max(a, b)
Definition: cfImp.cxx:41
Muon::UTPCMMClusterBuilderTool::finalFit
StatusCode finalFit(const std::vector< Identifier > &ids, const std::vector< float > &stripsPos, const std::vector< float > &driftDists, const std::vector< AmgVector(2)> &driftDistErrors, double &x0, double &sigmaX0, double &fitAngle, double &chiSqProb) const
Definition: UTPCMMClusterBuilderTool.cxx:388
Trk::locX
@ locX
Definition: ParamDefs.h:43
Muon::UTPCMMClusterBuilderTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Muon Detector Descriptor.
Definition: UTPCMMClusterBuilderTool.h:51
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
hist_file_dump.d
d
Definition: hist_file_dump.py:137
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Muon::UTPCMMClusterBuilderTool::LaySortedPrds
std::array< std::vector< Muon::MMPrepData >, 8 > LaySortedPrds
Definition: UTPCMMClusterBuilderTool.h:49
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
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
Muon::MMPrepData::Author::uTPCClusterBuilder
@ uTPCClusterBuilder
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Muon::UTPCMMClusterBuilderTool::m_houghMinCounts
Gaudi::Property< unsigned > m_houghMinCounts
Definition: UTPCMMClusterBuilderTool.h:64
Muon::UTPCMMClusterBuilderTool::transformParameters
StatusCode transformParameters(double alpha, double d, double dRMS, double &slope, double &intercept, double &interceptRMS) const
Definition: UTPCMMClusterBuilderTool.cxx:338
keylayer_zslicemap.strip
strip
Definition: keylayer_zslicemap.py:151
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Muon::UTPCMMClusterBuilderTool::selectTrack
StatusCode selectTrack(const std::vector< Muon::MMPrepData > &mmPrd, std::vector< double > &xpos, std::vector< int > &flag, std::vector< std::tuple< double, double >> &tracks, std::vector< int > &idxGoodStrips) const
Definition: UTPCMMClusterBuilderTool.cxx:277
AthCommonDataStore
Definition: AthCommonDataStore.h:52
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
Muon::UTPCMMClusterBuilderTool::m_alphaMin
Gaudi::Property< double > m_alphaMin
Definition: UTPCMMClusterBuilderTool.h:56
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Muon::UTPCMMClusterBuilderTool::m_selectionCut
Gaudi::Property< double > m_selectionCut
Definition: UTPCMMClusterBuilderTool.h:59
xmin
double xmin
Definition: listroot.cxx:60
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
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
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
master.flag
bool flag
Definition: master.py:29
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
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
TRT::Hit::globalR
@ globalR
Definition: HitInfo.h:37
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
Muon::UTPCMMClusterBuilderTool::findAlphaMax
StatusCode findAlphaMax(std::unique_ptr< TH2D > &h_hough, std::vector< std::tuple< double, double >> &maxPos) const
Definition: UTPCMMClusterBuilderTool.cxx:256
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
Muon::UTPCMMClusterBuilderTool::m_alphaResolution
Gaudi::Property< double > m_alphaResolution
Definition: UTPCMMClusterBuilderTool.h:58
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Muon::UTPCMMClusterBuilderTool::m_outerChargeRatioCut
Gaudi::Property< double > m_outerChargeRatioCut
charge ratio cut to supress cross talk
Definition: UTPCMMClusterBuilderTool.h:67
a
TList * a
Definition: liststreamerinfos.cxx:10
h
Muon::UTPCMMClusterBuilderTool::fillHoughTrafo
StatusCode fillHoughTrafo(const std::vector< Muon::MMPrepData > &mmPrd, std::vector< double > &xpos, std::vector< int > &flag, std::unique_ptr< TH2D > &h_hough) const
Definition: UTPCMMClusterBuilderTool.cxx:242
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
xmax
double xmax
Definition: listroot.cxx:61
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Muon::UTPCMMClusterBuilderTool::m_maxStripsCut
Gaudi::Property< int > m_maxStripsCut
Definition: UTPCMMClusterBuilderTool.h:69
Muon::UTPCMMClusterBuilderTool::houghInitCummulator
StatusCode houghInitCummulator(std::unique_ptr< TH2D > &cummulator, double xmax, double xmin) const
Definition: UTPCMMClusterBuilderTool.cxx:225
Muon::UTPCMMClusterBuilderTool::m_digiHasNegativeAngles
Gaudi::Property< bool > m_digiHasNegativeAngles
Definition: UTPCMMClusterBuilderTool.h:71
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:106
fitman.k
k
Definition: fitman.py:528
Muon::UTPCMMClusterBuilderTool::runHoughTrafo
StatusCode runHoughTrafo(const std::vector< Muon::MMPrepData > &mmPrd, std::vector< double > &xpos, std::vector< int > &flag, std::vector< int > &idx_selected) const
Definition: UTPCMMClusterBuilderTool.cxx:204
tauRecTools::sortTracks
bool sortTracks(const ElementLink< xAOD::TauTrackContainer > &l1, const ElementLink< xAOD::TauTrackContainer > &l2)
Definition: Reconstruction/tauRecTools/Root/HelperFunctions.cxx:54