ATLAS Offline Software
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
InDet::InDetPRDtoTrackMapToolGangedPixels Class Reference

Concrete Implementation of the IPRD_AssociationTool interface. More...

#include <InDetPRDtoTrackMapToolGangedPixels.h>

Inheritance diagram for InDet::InDetPRDtoTrackMapToolGangedPixels:
Collaboration diagram for InDet::InDetPRDtoTrackMapToolGangedPixels:

Classes

class  PRDtoTrackMap
 

Public Member Functions

 InDetPRDtoTrackMapToolGangedPixels (const std::string &, const std::string &, const IInterface *)
 
virtual ~InDetPRDtoTrackMapToolGangedPixels ()
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
virtual std::unique_ptr< Trk::PRDtoTrackMapcreatePRDtoTrackMap () const override
 
virtual std::unique_ptr< Trk::PRDtoTrackMapreduceToStorableMap (std::unique_ptr< Trk::PRDtoTrackMap > &&obj_in) const override
 
virtual StatusCode addPRDs (Trk::PRDtoTrackMap &virt_prd_to_track_map, const Trk::Track &track) const override
 add the PRDs from this track to the store More...
 
virtual std::vector< const Trk::PrepRawData * > getPrdsOnTrack (Trk::PRDtoTrackMap &virt_prd_to_track_map, const Trk::Track &track) const override
 returns a vector of PRDs belonging to the passed track. More...
 
virtual Trk::IPRDtoTrackMapTool::TrackSet findConnectedTracks (Trk::PRDtoTrackMap &virt_prd_to_track_map, const Trk::Track &track) const override
 returns set of tracks which share PRD with this one More...
 

Private Member Functions

void ensureType (Trk::PRDtoTrackMap &virt_prd_to_track_map) const
 

Private Attributes

SG::ReadHandleKey< PixelGangedClusterAmbiguitiesm_pixelClusterAmbiguitiesMapName {this, "PixelClusterAmbiguitiesMapName", "PixelClusterAmbiguitiesMap"}
 
BooleanProperty m_addTRToutliers {this, "addTRToutliers", false}
 add TRT outliers in the addTrack method to avoid splits due to rejected extensions More...
 

Detailed Description

Concrete Implementation of the IPRD_AssociationTool interface.

Definition at line 20 of file InDetPRDtoTrackMapToolGangedPixels.h.

Constructor & Destructor Documentation

◆ InDetPRDtoTrackMapToolGangedPixels()

InDet::InDetPRDtoTrackMapToolGangedPixels::InDetPRDtoTrackMapToolGangedPixels ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 19 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

22  : base_class(t,n,p)
23 { }

◆ ~InDetPRDtoTrackMapToolGangedPixels()

InDet::InDetPRDtoTrackMapToolGangedPixels::~InDetPRDtoTrackMapToolGangedPixels ( )
virtualdefault

Member Function Documentation

◆ addPRDs()

StatusCode InDet::InDetPRDtoTrackMapToolGangedPixels::addPRDs ( Trk::PRDtoTrackMap virt_prd_to_track_map,
const Trk::Track track 
) const
overridevirtual

add the PRDs from this track to the store

Parameters
trackall PRDs from 'track' will be added to PRD_AssociationTool's internal store.

Definition at line 79 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

80 {
81  ensureType(virt_prd_to_track_map);
82  PRDtoTrackMap &prd_to_track_map = static_cast<PRDtoTrackMap&>(virt_prd_to_track_map);
83  // test caching
84  Trk::PRDtoTrackMap::TrackPrepRawDataMap::const_iterator itvec = prd_to_track_map.m_trackPrepRawDataMap.find(&track);
85  if (itvec!=prd_to_track_map.m_trackPrepRawDataMap.end())
86  {
87  ATH_MSG_ERROR("track already found in cache, should not happen");
88  return StatusCode::FAILURE;
89  }
90  // get all prds on 'track'
91  std::vector< const Trk::PrepRawData* > prds = getPrdsOnTrack(prd_to_track_map, track );
92  // loop over PRD
93  for (const Trk::PrepRawData* prd : prds) {
94  prd_to_track_map.m_prepRawDataTrackMap.insert(std::make_pair(prd, &track) );
95  // test ganged ambiguity
96  if (prd->type(Trk::PrepRawDataType::PixelCluster)) {
97  const PixelCluster* pixel = static_cast<const PixelCluster*> (prd);
98  if (pixel->gangedPixel()) {
99  ATH_MSG_DEBUG( "Found ganged pixel, search for mirror" );
100  std::pair<PixelGangedClusterAmbiguities::const_iterator,
101  PixelGangedClusterAmbiguities::const_iterator> ambi = prd_to_track_map.m_gangedAmbis->equal_range(pixel);
102  for (; ambi.first != ambi.second ; ++(ambi.first) ) {
103  // add ambiguity as used by this track as well
104  if (msgLvl(MSG::DEBUG)) msg() << "Found mirror pixel, add mirror to association map" << endmsg;
105  prd_to_track_map.m_prepRawDataTrackMap.insert(std::make_pair(ambi.first->second, &track) );
106  }
107  }
108  }
109  }
110 
111  // cache this using m_trackPrepRawDataMap
112  prd_to_track_map.m_trackPrepRawDataMap.insert( std::make_pair(&track, prds) );
113 
114  ATH_MSG_DEBUG("Added PRDs from Track at ("<<&track<<") - map now has size: \t"
115  <<prd_to_track_map.m_prepRawDataTrackMap.size() );
116  return StatusCode::SUCCESS;
117 }

◆ createPRDtoTrackMap()

std::unique_ptr< Trk::PRDtoTrackMap > InDet::InDetPRDtoTrackMapToolGangedPixels::createPRDtoTrackMap ( ) const
overridevirtual

Definition at line 44 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

44  {
45  std::unique_ptr<PRDtoTrackMap> prd_to_track_map( new PRDtoTrackMap(m_pixelClusterAmbiguitiesMapName ) );
46 
48  << ", number of entries for this event:"
49  << (prd_to_track_map->m_gangedAmbis.isValid() ? prd_to_track_map->m_gangedAmbis->size() : -1) );
50  return std::unique_ptr<Trk::PRDtoTrackMap>(prd_to_track_map.release());
51 }

◆ ensureType()

void InDet::InDetPRDtoTrackMapToolGangedPixels::ensureType ( Trk::PRDtoTrackMap virt_prd_to_track_map) const
private

Definition at line 67 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

68 {
69  if (virt_prd_to_track_map.getType() != typeid(InDetPRDtoTrackMapToolGangedPixels::PRDtoTrackMap)) {
70  ATH_MSG_FATAL( "Type mismap between tool and map. Expecting " << typeid(InDetPRDtoTrackMapToolGangedPixels).name()
71  << " but got " << virt_prd_to_track_map.getType().name()
72  << " . The tool can only handle a map created by the same tool. ");
73  throw std::logic_error("Type mismap between tool and map");
74  }
75  assert( dynamic_cast<InDetPRDtoTrackMapToolGangedPixels::PRDtoTrackMap *>(&virt_prd_to_track_map) != nullptr );
76 }

◆ finalize()

StatusCode InDet::InDetPRDtoTrackMapToolGangedPixels::finalize ( )
overridevirtual

Definition at line 39 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

40 {
41  return StatusCode::SUCCESS;
42 }

◆ findConnectedTracks()

Trk::IPRDtoTrackMapTool::TrackSet InDet::InDetPRDtoTrackMapToolGangedPixels::findConnectedTracks ( Trk::PRDtoTrackMap virt_prd_to_track_map,
const Trk::Track track 
) const
overridevirtual

returns set of tracks which share PRD with this one

Parameters
trackthis Track must be known to this tool.
Returns
a set of tracks which share PRD/hits with the passed 'track'

Definition at line 121 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

123 {
124  ensureType(virt_prd_to_track_map);
125  PRDtoTrackMap &prd_to_track_map = static_cast<PRDtoTrackMap&>(virt_prd_to_track_map);
126 
127  TrackSet connectedTracks;
128 
129  std::vector< const Trk::PrepRawData* > prds = getPrdsOnTrack(virt_prd_to_track_map, track);
130  for (const Trk::PrepRawData* prd : prds) {
131  Trk::PRDtoTrackMap::ConstPrepRawDataTrackMapRange range = prd_to_track_map.onTracks(*prd);
132  // add them into the list
133  for ( ; range.first!=range.second; ++(range.first) )
134  connectedTracks.insert((range.first)->second);
135 
136  // test ganged ambiguity
137 
138  if (prd->type(Trk::PrepRawDataType::PixelCluster)) {
139  const PixelCluster* pixel = static_cast<const PixelCluster*> (prd);
140  if (pixel->gangedPixel()) {
141  std::pair<PixelGangedClusterAmbiguities::const_iterator,
142  PixelGangedClusterAmbiguities::const_iterator> ambi = prd_to_track_map.m_gangedAmbis->equal_range(pixel);
143  for (; ambi.first != ambi.second ; ++(ambi.first) ) {
144  range = prd_to_track_map.onTracks( *(ambi.first->second) );
145  // add them into the list
146  for ( ; range.first!=range.second; ++(range.first) )
147  connectedTracks.insert((range.first)->second);
148  }
149  }
150  }
151  }
152 
153  // don't forget to remove the input track
154  connectedTracks.erase(&track);
155 
156  ATH_MSG_VERBOSE("Added in connected tracks for track "<<&track
157  << "\tsize of list is "<<connectedTracks.size());
158 
159  return connectedTracks;
160 }

◆ getPrdsOnTrack()

std::vector< const Trk::PrepRawData * > InDet::InDetPRDtoTrackMapToolGangedPixels::getPrdsOnTrack ( Trk::PRDtoTrackMap virt_prd_to_track_map,
const Trk::Track track 
) const
overridevirtual

returns a vector of PRDs belonging to the passed track.

It's basically for the convenience of users and is created purely from the passed track. i.e. there is no caching if you do it multiple times on the same track, you're being inefficient!!

Parameters
trackthis Track will be iterated through and all PrepRawData added to a vector
Returns
vector of PrepRawData* belonging to 'track'. The PrepRawData should NOT be deleted
  • they belong to the Track (and thus the event).

Definition at line 164 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

166 {
167  ensureType(virt_prd_to_track_map);
168  PRDtoTrackMap &prd_to_track_map = static_cast<PRDtoTrackMap&>(virt_prd_to_track_map);
169  using PRDs_t = std::vector<const Trk::PrepRawData *>;
170 
171  // test caching
172  Trk::PRDtoTrackMap::TrackPrepRawDataMap::const_iterator itvec = prd_to_track_map.m_trackPrepRawDataMap.find(&track);
173  if (itvec!=prd_to_track_map.m_trackPrepRawDataMap.end())
174  {
175  ATH_MSG_VERBOSE("found track in cache, return cached PRD vector for track");
176  return itvec->second;
177  }
178 
179  if (track.measurementsOnTrack()==nullptr) {
180  ATH_MSG_WARNING("Track has no RoTs");
181  return {}; // return vector optimization
182  }
183 
184  // FIXME can I do this without copying the vector?
185  /* transform(
186  track.measurementsOnTrack()->begin(),
187  track.measurementsOnTrack()->end() ,
188  back_inserter(vec),
189  bind2nd(CreatePRD_VectorFromTrack(), &track) );*/
190 
191  // output vector
192  PRDs_t vec;
193  // size it
194  vec.reserve(track.measurementsOnTrack()->size());
195 
196  // get the PRDs for the measurements on track
197  DataVector<const Trk::MeasurementBase>::const_iterator it = track.measurementsOnTrack()->begin();
198  DataVector<const Trk::MeasurementBase>::const_iterator itEnd = track.measurementsOnTrack()->end();
199  for (;it!=itEnd;++it)
200  {
201  const auto *const meas{*it};
202  if (meas->type(Trk::MeasurementBaseType::RIO_OnTrack)) {
203  const Trk::RIO_OnTrack* rot = static_cast<const Trk::RIO_OnTrack*>(meas);
204  if(rot->prepRawData()) vec.push_back(rot->prepRawData());
205  }
206  }
207  ATH_MSG_DEBUG(" Getting "<<vec.size()<<" PRDs from track at:"<<&track);
208  // new mode, we add the outliers in the TRT
209  if (m_addTRToutliers) {
210  // get the PRDs for the measurements on track
211  for (const Trk::MeasurementBase* meas : *track.outliersOnTrack()){
212  // get the ROT, make sure it is not a pseudo measurement
213  if (meas->type(Trk::MeasurementBaseType::RIO_OnTrack)) {
214  const Trk::RIO_OnTrack* rot = static_cast<const Trk::RIO_OnTrack*>(meas);
215  // check if outlier is TRT ?
217  // add to the list, it is TRT
218  if(rot->prepRawData()) vec.push_back(rot->prepRawData());
219  }
220  }
221  }
222  ATH_MSG_DEBUG(" Getting "<<vec.size()<<" PRDs including TRT outlier from track at:"<<&track);
223  }
224 
225  return vec;
226 }

◆ initialize()

StatusCode InDet::InDetPRDtoTrackMapToolGangedPixels::initialize ( )
overridevirtual

Definition at line 28 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

29 {
30  bool has_ambi_map = m_pixelClusterAmbiguitiesMapName.initialize(!m_pixelClusterAmbiguitiesMapName.key().empty()).isSuccess();
31  if (!has_ambi_map && !m_pixelClusterAmbiguitiesMapName.key().empty()) {
32  ATH_MSG_WARNING("Could not retrieve "<< m_pixelClusterAmbiguitiesMapName.key() << " this is ok if pixel is off");
33  // @TODO introduce more robust method e.g. dummy tool if pixel is off ?
34  }
35 
36  return StatusCode::SUCCESS;
37 }

◆ reduceToStorableMap()

std::unique_ptr< Trk::PRDtoTrackMap > InDet::InDetPRDtoTrackMapToolGangedPixels::reduceToStorableMap ( std::unique_ptr< Trk::PRDtoTrackMap > &&  obj_in) const
overridevirtual

Definition at line 53 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

53  {
54  if (obj_in->getType()!=typeid(Trk::PRDtoTrackMap)) {
55  return std::move(obj_in);
56  }
57  if (obj_in->getType()!=typeid(InDet::InDetPRDtoTrackMapToolGangedPixels)) {
58  ATH_MSG_FATAL( "Type mismap between tool and map. Expecting " << typeid(InDet::InDetPRDtoTrackMapToolGangedPixels).name()
59  << " but got " << obj_in->getType().name()
60  << " . The tool can only handle a map created by the same tool. ");
61  }
62  Trk::PRDtoTrackMap *the_obj=static_cast<PRDtoTrackMap *>(obj_in.get());
63  return std::make_unique<Trk::PRDtoTrackMap>(std::move(*the_obj));
64 }

Member Data Documentation

◆ m_addTRToutliers

BooleanProperty InDet::InDetPRDtoTrackMapToolGangedPixels::m_addTRToutliers {this, "addTRToutliers", false}
private

add TRT outliers in the addTrack method to avoid splits due to rejected extensions

Definition at line 62 of file InDetPRDtoTrackMapToolGangedPixels.h.

◆ m_pixelClusterAmbiguitiesMapName

SG::ReadHandleKey<PixelGangedClusterAmbiguities> InDet::InDetPRDtoTrackMapToolGangedPixels::m_pixelClusterAmbiguitiesMapName {this, "PixelClusterAmbiguitiesMapName", "PixelClusterAmbiguitiesMap"}
private

Definition at line 59 of file InDetPRDtoTrackMapToolGangedPixels.h.


The documentation for this class was generated from the following files:
InDet::InDetPRDtoTrackMapToolGangedPixels::getPrdsOnTrack
virtual std::vector< const Trk::PrepRawData * > getPrdsOnTrack(Trk::PRDtoTrackMap &virt_prd_to_track_map, const Trk::Track &track) const override
returns a vector of PRDs belonging to the passed track.
Definition: InDetPRDtoTrackMapToolGangedPixels.cxx:164
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
PixelCluster
Definition: Trigger/TrigAccel/TrigCudaFitter/src/PixelCluster.h:8
Trk::PRDtoTrackMap
Definition: PRDtoTrackMap.h:17
InDet::InDetPRDtoTrackMapToolGangedPixels::InDetPRDtoTrackMapToolGangedPixels
InDetPRDtoTrackMapToolGangedPixels(const std::string &, const std::string &, const IInterface *)
Definition: InDetPRDtoTrackMapToolGangedPixels.cxx:19
skel.it
it
Definition: skel.GENtoEVGEN.py:396
CP::TrackSet
std::set< TrackPtr > TrackSet
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:72
Trk::RIO_OnTrack::rioType
virtual bool rioType(RIO_OnTrackType::Type type) const =0
Method checking the Rio On Track type.
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
InDet::InDetPRDtoTrackMapToolGangedPixels::m_addTRToutliers
BooleanProperty m_addTRToutliers
add TRT outliers in the addTrack method to avoid splits due to rejected extensions
Definition: InDetPRDtoTrackMapToolGangedPixels.h:62
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
Trk::PRDtoTrackMap::getType
virtual const std::type_info & getType() const
InDet::InDetPRDtoTrackMapToolGangedPixels
Concrete Implementation of the IPRD_AssociationTool interface.
Definition: InDetPRDtoTrackMapToolGangedPixels.h:21
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Trk::RIO_OnTrackType::TRT_DriftCircle
@ TRT_DriftCircle
Definition: RIO_OnTrack.h:59
Trk::PrepRawData
Definition: PrepRawData.h:62
Trk::MeasurementBase
Definition: MeasurementBase.h:58
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
InDet::InDetPRDtoTrackMapToolGangedPixels::ensureType
void ensureType(Trk::PRDtoTrackMap &virt_prd_to_track_map) const
Definition: InDetPRDtoTrackMapToolGangedPixels.cxx:67
Trk::PrepRawDataType::PixelCluster
@ PixelCluster
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::MeasurementBaseType::RIO_OnTrack
@ RIO_OnTrack
Definition: MeasurementBase.h:49
InDet::InDetPRDtoTrackMapToolGangedPixels::m_pixelClusterAmbiguitiesMapName
SG::ReadHandleKey< PixelGangedClusterAmbiguities > m_pixelClusterAmbiguitiesMapName
Definition: InDetPRDtoTrackMapToolGangedPixels.h:59
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DEBUG
#define DEBUG
Definition: page_access.h:11
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
SiliconTech::pixel
@ pixel
Trk::PRDtoTrackMap::ConstPrepRawDataTrackMapRange
std::pair< PrepRawDataTrackMap::const_iterator, PrepRawDataTrackMap::const_iterator > ConstPrepRawDataTrackMapRange
Definition: PRDtoTrackMap.h:44