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
 
bool m_addTRToutliers
 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 {
24  declareProperty( "PixelClusterAmbiguitiesMapName", m_pixelClusterAmbiguitiesMapName = "PixelClusterAmbiguitiesMap" );
25  declareProperty( "addTRToutliers", m_addTRToutliers = false);
26 }

◆ ~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 82 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

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

◆ createPRDtoTrackMap()

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

Definition at line 47 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

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

◆ ensureType()

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

Definition at line 70 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

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

◆ finalize()

StatusCode InDet::InDetPRDtoTrackMapToolGangedPixels::finalize ( )
overridevirtual

Definition at line 42 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

43 {
44  return StatusCode::SUCCESS;
45 }

◆ 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 124 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

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

◆ 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 167 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

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

◆ initialize()

StatusCode InDet::InDetPRDtoTrackMapToolGangedPixels::initialize ( )
overridevirtual

Definition at line 31 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

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

◆ reduceToStorableMap()

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

Definition at line 56 of file InDetPRDtoTrackMapToolGangedPixels.cxx.

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

Member Data Documentation

◆ m_addTRToutliers

bool InDet::InDetPRDtoTrackMapToolGangedPixels::m_addTRToutliers
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
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:167
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
PixelCluster
Definition: Trigger/TrigAccel/TrigCudaFitter/src/PixelCluster.h:7
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
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:423
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
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
InDet::InDetPRDtoTrackMapToolGangedPixels::m_addTRToutliers
bool m_addTRToutliers
add TRT outliers in the addTrack method to avoid splits due to rejected extensions
Definition: InDetPRDtoTrackMapToolGangedPixels.h:62
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:192
InDet::InDetPRDtoTrackMapToolGangedPixels::ensureType
void ensureType(Trk::PRDtoTrackMap &virt_prd_to_track_map) const
Definition: InDetPRDtoTrackMapToolGangedPixels.cxx:70
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
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
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