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

#include <MuonSegmentAmbiCleaner.h>

Inheritance diagram for MuonSegmentAmbiCleaner:
Collaboration diagram for MuonSegmentAmbiCleaner:

Public Member Functions

 MuonSegmentAmbiCleaner (const std::string &, const std::string &, const IInterface *)
 
virtual ~MuonSegmentAmbiCleaner ()=default
 
virtual StatusCode initialize ()
 
virtual const Muon::MuonSegmentresolve (const Muon::MuonSegment *segment) const
 For one segment solve ambiguous RPC and TGC hits: different eta but same phi using the MDT extrapolated segment Makes and output a new segment dropping the ambiguous hits. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 
bool m_debug
 flag to print out debugging information More...
 
bool m_summary
 flag to print out a summary of what comes in and what comes out More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 17 of file MuonSegmentAmbiCleaner.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuonSegmentAmbiCleaner()

MuonSegmentAmbiCleaner::MuonSegmentAmbiCleaner ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 29 of file MuonSegmentAmbiCleaner.cxx.

30 {
31  declareInterface<IMuonSegmentCleaner>(this);
32 
33  m_debug = false;
34  declareProperty("DoDebug",m_debug);
35 
36  m_summary = false;
37  declareProperty("DoSummary",m_summary);
38 
39 }

◆ ~MuonSegmentAmbiCleaner()

virtual MuonSegmentAmbiCleaner::~MuonSegmentAmbiCleaner ( )
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  }

◆ declareProperty() [1/6]

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

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

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

◆ declareProperty() [2/6]

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

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

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

◆ declareProperty() [3/6]

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

Definition at line 259 of file AthCommonDataStore.h.

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

◆ declareProperty() [4/6]

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

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

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

◆ declareProperty() [5/6]

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

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

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

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

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

◆ detStore()

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

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

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

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

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

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

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

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode MuonSegmentAmbiCleaner::initialize ( )
virtual

Definition at line 41 of file MuonSegmentAmbiCleaner.cxx.

42 {
43  ATH_MSG_VERBOSE(" MuonSegmentiAmbiCleaner::Initializing ");
44  ATH_CHECK( m_idHelperSvc.retrieve() );
45  ATH_MSG_VERBOSE("End of Initializing");
46  return StatusCode::SUCCESS;
47 }

◆ inputHandles()

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

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Muon::IMuonSegmentCleaner::interfaceID ( )
inlinestaticinherited

Definition at line 31 of file IMuonSegmentCleaner.h.

31 { return IID_IMuonSegmentCleaner; }

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

◆ resolve()

const Muon::MuonSegment * MuonSegmentAmbiCleaner::resolve ( const Muon::MuonSegment segment) const
virtual

For one segment solve ambiguous RPC and TGC hits: different eta but same phi using the MDT extrapolated segment Makes and output a new segment dropping the ambiguous hits.

Implements Muon::IMuonSegmentCleaner.

Definition at line 49 of file MuonSegmentAmbiCleaner.cxx.

50 {
51  ATH_MSG_VERBOSE(" Executing MuonSegmentAmbiCleanerTools ");
52 
53  auto meas_keep = DataVector<const Trk::MeasurementBase>();
54 
55 // create new surface
56  Trk::PlaneSurface* psf = (segment->associatedSurface()).clone();
57  Amg::Transform3D globalToLocal = psf->transform().inverse();
58  Amg::Vector3D lSegmentPos = globalToLocal*(segment->globalPosition());
59  Amg::Vector3D lSegmentDir = globalToLocal*(segment->globalDirection());
60 
61 
62  const std::vector<const Trk::MeasurementBase*>& meas = segment->containedMeasurements();
63  std::vector<const Trk::MeasurementBase*>::const_iterator mit = meas.begin();
64  std::vector<const Trk::MeasurementBase*>::const_iterator mit_end = meas.end();
65  // loop over hits
66  int nphirpc = 0;
67  int nphitgc = 0;
68  int nphicsc = 0;
69  int netamdt = 0;
70  int netarpc = 0;
71  int netatgc = 0;
72  int netacsc = 0;
73 
74  std::vector<const Trk::RIO_OnTrack*> rots;
75  std::vector<const Trk::CompetingRIOsOnTrack*> crots; // lookup vector to check if rot is part of competing rio. vector contains 0 if not part of competing rio
76  rots.reserve(2*meas.size()); // factor 2, to be on safe side
77  crots.reserve(2*meas.size());
78 
79  for( ; mit!=mit_end;++mit ){
80 
81  //dynamic cast to either rio or competingrio:
82  const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(*mit);
83  if (rot)
84  {
85  rots.push_back(rot);
86  crots.push_back(nullptr);
87  }
88 
89  else
90  {
91  const Trk::CompetingRIOsOnTrack* crio = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(*mit);
92  if (crio)
93  {
94  for (unsigned int i = 0; i<crio->numberOfContainedROTs(); i++)
95  {
96  rot = &crio->rioOnTrack(i);
97  rots.push_back(rot);
98  crots.push_back(crio);
99  }
100  }
101  }
102  }
103 
104  unsigned int nMeas = rots.size();
105  unsigned int nphi = 0;
106 
107  // Vectors for the phi hits
108  std::vector <const Trk::RIO_OnTrack*> rots_phi(nMeas);
109  std::vector <const Trk::CompetingRIOsOnTrack*> crots_phi(nMeas);
110  std::vector <const Trk::MeasurementBase*> meas_phi(nMeas);
111  std::vector <double> dis_phi(nMeas); // distance to segment
112  std::vector <int> chambercode_phi(nMeas);
113  std::vector <int> stripcode_phi(nMeas);
114  std::vector <int> ok_phi(nMeas); // 0 Not selected 1 selected/
115  std::vector <int> det_phi(nMeas); // 1 = RPC 2 = TGC /
116  std::vector <Identifier> id_phi(nMeas); // 1 = RPC 2 = TGC /
117 
118  if (m_debug) std::cout << " MuonSegmentAmbiCleanerTool nMeas " << nMeas << " competing rios: " << crots.size() << std::endl;
119 
120  for (unsigned int i=0; i<rots.size(); i++){
121 
122  const Trk::RIO_OnTrack* rot = rots[i];
123  const Trk::PrepRawData* prd = rot->prepRawData();
124  Identifier id = prd->identify();
125  if( m_idHelperSvc->isMdt( rot->identify() ) ){
126  meas_keep.push_back(rot->clone());
127  netamdt++;
128  continue;
129  }else if( m_idHelperSvc->isRpc( rot->identify() ) ){
130  if( m_idHelperSvc->rpcIdHelper().measuresPhi(id) != 1) {
131  meas_keep.push_back(rot->clone());
132  netarpc++;
133  continue ;
134  }
135  }else if( m_idHelperSvc->isTgc( rot->identify() ) ){
136  if( m_idHelperSvc->tgcIdHelper().isStrip(id) != 1 ) {
137  meas_keep.push_back(rot->clone());
138  netatgc++;
139  continue;
140  }
141  }else if( m_idHelperSvc->isCsc( rot->identify() ) ){
142  meas_keep.push_back(rot->clone());
143  if( m_idHelperSvc->cscIdHelper().measuresPhi(id) != 1) {
144  netacsc++;
145  } else {
146  nphicsc++;
147  }
148  continue;
149  }
150 
151  //add Phi Hits
152  id_phi[nphi] = id;
153  rots_phi[nphi] = rot;
154  crots_phi[nphi] = crots[i];
155  chambercode_phi[nphi] = 0;
156  stripcode_phi[nphi] = 0;
157  ok_phi[nphi] = 0;
158  det_phi[nphi] = 0;
159  dis_phi[nphi] = 10000000;
160  if (m_idHelperSvc->isRpc( rot->identify())) {
161  nphirpc++;
162  int code = 1000000*(m_idHelperSvc->rpcIdHelper().stationName(id));
163  code = code + 2*((m_idHelperSvc->rpcIdHelper().doubletR(id))-1)+16*((m_idHelperSvc->rpcIdHelper().gasGap(id))-1);
164  chambercode_phi[nphi] = code;
165  stripcode_phi[nphi] = m_idHelperSvc->rpcIdHelper().strip(id);
166  ok_phi[nphi] = 1;
167  det_phi[nphi] = 1;
168  const Muon::RpcClusterOnTrack* rrot = dynamic_cast<const Muon::RpcClusterOnTrack*>(rot);
169  if( !rrot ){
170  ATH_MSG_WARNING("This is not a RpcClusterOnTrack!!! ");
171  continue;
172  }
173  const Muon::RpcPrepData* rprd = rrot->prepRawData();
174  Amg::Vector3D gHitPos = rprd->globalPosition();
175  Amg::Vector3D lHitPos = globalToLocal*gHitPos;
176 
177  // In the barrel local z is measured
178  double disRPC = lSegmentPos.z() - lHitPos.z() + lSegmentDir.z()*(lHitPos.y()-lSegmentPos.y())/lSegmentDir.y();
179  if (m_debug) {
180  std::cout << " ghit pos x " << gHitPos.x() << " y " << gHitPos.y() << " z " << gHitPos.z() << std::endl;
181  std::cout << " dis RPC " << disRPC << std::endl;
182  }
183  dis_phi[nphi] = disRPC;
184  } else if ( m_idHelperSvc->isTgc( rot->identify())) {
185  nphitgc++;
186  int code = 1000000*(m_idHelperSvc->tgcIdHelper().stationName(id))+100*(m_idHelperSvc->tgcIdHelper().stationEta(id)+10);
187  code = code + m_idHelperSvc->tgcIdHelper().gasGap(id);
188  chambercode_phi[nphi] = code;
189  stripcode_phi[nphi] = m_idHelperSvc->tgcIdHelper().channel(id);
190  ok_phi[nphi] = 1;
191  det_phi[nphi] = 2;
192 
193  const Muon::TgcClusterOnTrack* rrot = dynamic_cast<const Muon::TgcClusterOnTrack*>(rot);
194  if( !rrot ){
195  ATH_MSG_WARNING("This is not a TgcClusterOnTrack!!! ");
196  continue;
197  }
198  const Muon::TgcPrepData* rprd = rrot->prepRawData();
199  Amg::Vector3D gHitPos = rprd->globalPosition();
200  Amg::Vector3D lHitPos = globalToLocal*gHitPos;
201  // In the forward local y is measured
202  double disTGC = lSegmentPos.y() - lHitPos.y() + lSegmentDir.y()*(lHitPos.z()-lSegmentPos.z())/lSegmentDir.z();
203  if (m_debug) {
204  std::cout << " ghit pos x " << gHitPos.x() << " y " << gHitPos.y() << " z " << gHitPos.z() << std::endl;
205  std::cout << " dis TGC " << disTGC << std::endl;
206  }
207  dis_phi[nphi] = disTGC;
208  } else {
209  dis_phi[nphi] = 0.;
210  }
211  if (m_debug) std::cout << " Distance to segment " << dis_phi[nphi] << std::endl;
212  if (ok_phi[nphi] == 1 ) nphi++;
213  }
214 // Code to select and flag ambiguous phi hits
215 
216  bool changeSegment = false;
217  int nphirpcn = 0;
218  int nphitgcn = 0;
219  if (nphi > 0) {
220  for(unsigned int i = 0; i < nphi-1 ; ++i ) {
221  if (ok_phi[i] == 0) continue;
222  for(unsigned int j = i+1 ; j < nphi ; ++j ) {
223  if (ok_phi[j] == 0) continue;
224  bool ambi = false;
225  if ( stripcode_phi[i] == stripcode_phi[j] && chambercode_phi[i] == chambercode_phi[j] ) ambi = true;
226  if ( ambi ) {
227  Identifier id1 = id_phi[i];
228  Identifier id2 = id_phi[j];
229  if (det_phi[i] == 1 && det_phi[j] == 1 && m_debug) {
230  ATH_MSG_INFO(" RPC Station 1 eta " << m_idHelperSvc->rpcIdHelper().stationEta(id1) << " phi " << m_idHelperSvc->rpcIdHelper().stationPhi(id1));
231  ATH_MSG_INFO(" RPC Station 2 eta " << m_idHelperSvc->rpcIdHelper().stationEta(id2) << " phi " << m_idHelperSvc->rpcIdHelper().stationPhi(id2));
232  }
233  if (det_phi[i] == 2 && det_phi[j] == 2 && m_debug) {
234  ATH_MSG_INFO(" TGC Station 1 eta " << m_idHelperSvc->tgcIdHelper().stationEta(id1) << " phi " << m_idHelperSvc->tgcIdHelper().stationPhi(id1));
235  ATH_MSG_INFO(" TGC Station 2 eta " << m_idHelperSvc->tgcIdHelper().stationEta(id2) << " phi " << m_idHelperSvc->tgcIdHelper().stationPhi(id2));
236  }
237 
238  if (m_debug) { ATH_MSG_DEBUG(" Ambiguous " << " Distance1 " << dis_phi[i] << " Distance1 " << dis_phi[j]); }
239  if (dis_phi[i]!= 0.&& dis_phi[j]!=0) {
240  if ( fabs(dis_phi[i]) < fabs(dis_phi[j]) ) {
241  ok_phi[j] = 0;
242  } else {
243  ok_phi[i] = 0;
244  }
245  }
246  if (m_debug) {
247  if (det_phi[i] == 1) { ATH_MSG_DEBUG(" RPC Ambiguities "); }
248  if (det_phi[i] == 2) { ATH_MSG_DEBUG(" TGC Ambiguities "); }
249  ATH_MSG_DEBUG(" index " << i << " strip " << stripcode_phi [i] << " chambercode " << chambercode_phi[i] << " selected " << ok_phi[i] << " segment distance " << dis_phi[i]);
250  ATH_MSG_DEBUG(" index " << j << " strip " << stripcode_phi [j] << " chambercode " << chambercode_phi[j] << " selected " << ok_phi[j] << " segment distance " << dis_phi[j]);
251  }
252  }
253  }
254  }
255 
256  // if any phi hits belonging to a competing rio is removed, remove the pointer to the competing rio and only store the single phi hit
257 
258  for(unsigned int i = 0; i < nphi ; i++ ) {
259  if (ok_phi[i] == 0)
260  {
261  for(unsigned int j = 0; j < nphi ; j++ ) {
262  if (crots_phi[j] == crots_phi[i] && j!=i)
263  {
264  crots_phi[j]=nullptr;
265  }
266  }
267  crots_phi[i]=nullptr;
268  }
269  }
270 
271 // Put kept hits on segment
272 // Put selected phi hits on segment
273 
274  std::set <const Trk::CompetingRIOsOnTrack*> selected_crots;
275 
276  for (unsigned int i=0;i<nphi;++i){
277  if (ok_phi[i] == 1) {
278  if (!crots_phi[i]) // not a competing measurement
279  {
280  if (det_phi[i] == 1) nphirpcn++;
281  if (det_phi[i] == 2) nphitgcn++;
282  meas_keep.push_back(rots_phi[i]->clone());
283  }
284  else if (selected_crots.count(crots_phi[i]) == 0) // competing measurement not yet added
285  {
286  meas_keep.push_back(crots_phi[i]->clone());
287  selected_crots.insert(crots_phi[i]);
288  if (det_phi[i] == 1) nphirpcn++;
289  if (det_phi[i] == 2) nphitgcn++;
290  }
291  } if (ok_phi[i] == 0 && (det_phi[i] == 1||det_phi[i] == 2)) {
292  changeSegment = true;
293  }
294  }
295  }
296 
297  if ((m_summary&&changeSegment)||m_debug) {
298  std::cout << " Summary MuonSegmentAmbiCleaner (not accurate with competing rios!)" << std::endl;
299  std::cout << " Input Segment with " << netamdt << " MDT hits " << netacsc << " eta CSC hits " << netatgc << " eta TGC Hits " << netarpc << " eta RPC hits " << std::endl;
300  std::cout << " and " << nphicsc << " phi CSC hits " << nphitgc << " phi TGC Hits " << nphirpc << " phi RPC hits " << std::endl;
301  std::cout << " Output after Ambiguity removal " << nphitgcn << " phi TGC Hits " << nphirpcn << " phi RPC hits " << std::endl;
302  }
303 
304  // Make new segment with cleaned up rios
305 // MuonSegment( const Trk::LocalPosition& segLocPos, // 2 local position coordinates
306 // const Trk::LocalDirection* segLocDir, // 2 local direction coordinates
307 // const Trk::ErrorMatrix* segLocalErr, // 4 x 4 full local error
308 // Trk::PlaneSurface* psf, // plane surface to define frame
309 // std::vector<const Trk::RIO_OnTrack*>* crots, // vector of contained rios on track
310 // Trk::FitQuality* fqual);
311 
312 
313  const Trk::LocalDirection locSegmentDir(segment->localDirection());
314  Amg::Vector2D locSegmentPos(lSegmentPos.x(),lSegmentPos.y());
315  Trk::FitQuality* fitQuality = segment->fitQuality()->clone();
316  Muon::MuonSegment* newSegment = new Muon::MuonSegment(locSegmentPos,
317  locSegmentDir,
318  Amg::MatrixX(segment->localCovariance()),
319  psf,
320  std::move(meas_keep),
321  fitQuality);
322 
323  return newSegment;
324 } // execute

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

bool MuonSegmentAmbiCleaner::m_debug
private

flag to print out debugging information

Definition at line 36 of file MuonSegmentAmbiCleaner.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_idHelperSvc

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

Definition at line 33 of file MuonSegmentAmbiCleaner.h.

◆ m_summary

bool MuonSegmentAmbiCleaner::m_summary
private

flag to print out a summary of what comes in and what comes out

Definition at line 38 of file MuonSegmentAmbiCleaner.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::RIO_OnTrack::clone
virtual RIO_OnTrack * clone() const override=0
Pseudo-constructor, needed to avoid excessive RTTI.
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Muon::RpcPrepData::globalPosition
virtual const Amg::Vector3D & globalPosition() const override
Returns the global position.
Definition: RpcPrepData.h:218
Muon::TgcClusterOnTrack
Class to represent calibrated clusters formed from TGC strips.
Definition: TgcClusterOnTrack.h:46
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
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
Muon::RpcClusterOnTrack
Class to represent calibrated clusters formed from RPC strips.
Definition: RpcClusterOnTrack.h:35
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
xAOD::MuonSegment
MuonSegment_v1 MuonSegment
Reference the current persistent version:
Definition: Event/xAOD/xAODMuon/xAODMuon/MuonSegment.h:13
python.Utilities.clone
clone
Definition: Utilities.py:134
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
Muon::TgcClusterOnTrack::prepRawData
virtual const TgcPrepData * prepRawData() const
Returns the TgcPrepData - is a TRT_DriftCircle in this scope.
Definition: TgcClusterOnTrack.h:129
Trk::CompetingRIOsOnTrack::rioOnTrack
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
histSizes.code
code
Definition: histSizes.py:129
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:562
Trk::CompetingRIOsOnTrack::numberOfContainedROTs
virtual unsigned int numberOfContainedROTs() const =0
Number of RIO_OnTracks to be contained by this CompetingRIOsOnTrack.
lumiFormat.i
int i
Definition: lumiFormat.py:85
Muon::RpcPrepData
Class to represent RPC measurements.
Definition: RpcPrepData.h:35
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Trk::CompetingRIOsOnTrack
Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.
Definition: CompetingRIOsOnTrack.h:64
MuonSegmentAmbiCleaner::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonSegmentAmbiCleaner.h:33
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::FitQuality
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition: FitQuality.h:97
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
DataVector< const Trk::MeasurementBase >
Trk::LocalDirection
represents the three-dimensional global direction with respect to a planar surface frame.
Definition: LocalDirection.h:81
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
Trk::PrepRawData
Definition: PrepRawData.h:62
Muon::RpcClusterOnTrack::prepRawData
virtual const RpcPrepData * prepRawData() const override final
Returns the RpcPrepData - is a TRT_DriftCircle in this scope.
Definition: RpcClusterOnTrack.h:127
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::RIO_OnTrack::prepRawData
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
Trk::GsfMeasurementUpdator::fitQuality
FitQualityOnSurface fitQuality(const MultiComponentState &, const MeasurementBase &)
Method for determining the chi2 of the multi-component state and the number of degrees of freedom.
Definition: GsfMeasurementUpdator.cxx:845
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::PlaneSurface
Definition: PlaneSurface.h:64
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
Muon::TgcPrepData
Class to represent TGC measurements.
Definition: TgcPrepData.h:32
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
Muon::TgcPrepData::globalPosition
virtual const Amg::Vector3D & globalPosition() const override final
Returns the global position.
Definition: TgcPrepData.h:125
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
MuonSegmentAmbiCleaner::m_summary
bool m_summary
flag to print out a summary of what comes in and what comes out
Definition: MuonSegmentAmbiCleaner.h:38
Muon::MuonSegment
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:45
Trk::Surface::transform
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
NSWL1::globalToLocal
Polygon globalToLocal(const Polygon &pol, float z, const Trk::PlaneSurface &surf)
Definition: GeoUtils.cxx:103
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
MuonSegmentAmbiCleaner::m_debug
bool m_debug
flag to print out debugging information
Definition: MuonSegmentAmbiCleaner.h:36
fitman.k
k
Definition: fitman.py:528
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
Identifier
Definition: IdentifierFieldParser.cxx:14