ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::GaussianDensityTestAlg Class Reference

#include <GaussianDensityTestAlg.h>

Inheritance diagram for Trk::GaussianDensityTestAlg:
Collaboration diagram for Trk::GaussianDensityTestAlg:

Public Member Functions

 GaussianDensityTestAlg (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters:
virtual ~GaussianDensityTestAlg ()
 Destructor:
virtual StatusCode initialize ()
virtual StatusCode execute ()
virtual StatusCode finalize ()
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

double ipSignificance (const Trk::TrackParameters *params, const Amg::Vector3D *vertex) const
StatusCode findTruth (double mode, const std::vector< Trk::ITrackLink * > &trackVector, std::vector< Amg::Vector3D > &truth, TH1 *h_truthDensity, TH1 *h_modeCheck) const
 GaussianDensityTestAlg ()
void selectTracks (const xAOD::TrackParticleContainer *trackParticles, std::vector< Trk::ITrackLink * > &trackVector)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static void analyzeTracks (const std::vector< Trk::ITrackLink * > &trackVector, std::vector< const Trk::TrackParameters * > &perigeeList)

Private Attributes

Gaudi::Property< double > m_significanceTruthCut
Gaudi::Property< int > m_truthVertexTracks
bool m_useBeamConstraint
bool m_firstEvent
ToolHandle< InDet::IInDetTrackSelectionToolm_trackFilter
ToolHandle< Trk::IVertexTrackDensityEstimatorm_estimator
ToolHandle< Trk::ITrackToVertexIPEstimatorm_ipEstimator
SG::ReadCondHandleKey< InDet::BeamSpotDatam_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
ServiceHandle< ITHistSvc > m_iTHistSvc
SG::ReadHandleKey< xAOD::TrackParticleContainerm_trackParticlesKey
 Data handle keys.
SG::ReadHandleKey< xAOD::TruthEventContainerm_truthEventsKey
SG::ReadHandleKey< xAOD::TruthPileupEventContainerm_pileupEventsKey
TH1 * m_h_density {}
 Histograms and trees.
TH1 * m_h_truthDensity {}
TH1 * m_h_truthVertices {}
TH1 * m_h_modeCheck {}
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 46 of file GaussianDensityTestAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ GaussianDensityTestAlg() [1/2]

Trk::GaussianDensityTestAlg::GaussianDensityTestAlg ( const std::string & name,
ISvcLocator * pSvcLocator )

Constructor with parameters:

Definition at line 31 of file GaussianDensityTestAlg.cxx.

32 :
33 ::AthAlgorithm( name, pSvcLocator ),
35 m_firstEvent(true),
36 m_iTHistSvc("THistSvc", name)
37{
38 //
39 // Property declaration
40 //
41}
AthAlgorithm()
Default constructor:
ServiceHandle< ITHistSvc > m_iTHistSvc

◆ ~GaussianDensityTestAlg()

Trk::GaussianDensityTestAlg::~GaussianDensityTestAlg ( )
virtualdefault

Destructor:

◆ GaussianDensityTestAlg() [2/2]

Trk::GaussianDensityTestAlg::GaussianDensityTestAlg ( )
private

Member Function Documentation

◆ analyzeTracks()

void Trk::GaussianDensityTestAlg::analyzeTracks ( const std::vector< Trk::ITrackLink * > & trackVector,
std::vector< const Trk::TrackParameters * > & perigeeList )
staticprivate

Definition at line 124 of file GaussianDensityTestAlg.cxx.

126{
127 for (auto *seedtrkAtVtxIter : trackVector)
128 {
129 perigeeList.push_back( seedtrkAtVtxIter->parameters() );
130 }
131}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

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

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

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

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

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

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode Trk::GaussianDensityTestAlg::execute ( )
virtual

Definition at line 82 of file GaussianDensityTestAlg.cxx.

83{
84 ATH_MSG_DEBUG ("Executing " << name() << "...");
85
86 SG::ReadHandle<xAOD::TrackParticleContainer> trackParticles(m_trackParticlesKey);
87
88 ATH_MSG_VERBOSE("Selecting tracks");
89 std::vector<Trk::ITrackLink*> trackVector;
90 selectTracks(trackParticles.cptr(), trackVector);
91
92 std::vector<const Trk::TrackParameters*> perigeeList;
93 analyzeTracks(trackVector, perigeeList);
94
95 ATH_MSG_VERBOSE("Using density estimator");
96 std::unique_ptr<Trk::IVertexTrackDensityEstimator::ITrackDensity> dens;
97 double mode = m_estimator->globalMaximum (perigeeList, dens);
98
99 if (m_firstEvent)
100 {
101 for (int i = 0; i < 800; i++)
102 {
103 double z = -200.0 + 0.25 + i*0.5;
104 double density = dens->trackDensity(z);
105 m_h_density->Fill((float) z, (float) density);
106 }
107 }
108 ATH_MSG_VERBOSE("Analyzing MC truth");
109 std::vector<Amg::Vector3D> truth;
110 ATH_CHECK( findTruth(mode, trackVector, truth, m_h_truthDensity, m_h_modeCheck) );
111 if (m_firstEvent)
112 {
113 ATH_MSG_VERBOSE("Filling truth vertex histogram");
114 for (auto& v : truth) m_h_truthVertices->Fill( v[2] );
115 }
116 m_firstEvent = false;
117 return StatusCode::SUCCESS;
118}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
TH1 * m_h_density
Histograms and trees.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticlesKey
Data handle keys.
ToolHandle< Trk::IVertexTrackDensityEstimator > m_estimator
StatusCode findTruth(double mode, const std::vector< Trk::ITrackLink * > &trackVector, std::vector< Amg::Vector3D > &truth, TH1 *h_truthDensity, TH1 *h_modeCheck) const
void selectTracks(const xAOD::TrackParticleContainer *trackParticles, std::vector< Trk::ITrackLink * > &trackVector)
static void analyzeTracks(const std::vector< Trk::ITrackLink * > &trackVector, std::vector< const Trk::TrackParameters * > &perigeeList)
@ z
global position (cartesian)
Definition ParamDefs.h:57
@ v
Definition ParamDefs.h:78

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode Trk::GaussianDensityTestAlg::finalize ( )
virtual

Definition at line 76 of file GaussianDensityTestAlg.cxx.

77{
78 ATH_MSG_INFO ("Finalizing " << name() << "...");
79 return StatusCode::SUCCESS;
80}
#define ATH_MSG_INFO(x)

◆ findTruth()

StatusCode Trk::GaussianDensityTestAlg::findTruth ( double mode,
const std::vector< Trk::ITrackLink * > & trackVector,
std::vector< Amg::Vector3D > & truth,
TH1 * h_truthDensity,
TH1 * h_modeCheck ) const
private

Definition at line 175 of file GaussianDensityTestAlg.cxx.

180{
181 double modeClosestDistance = std::numeric_limits<double>::max();
182
184
185 SG::ReadHandle<xAOD::TruthEventContainer> signalEvents(m_truthEventsKey);
186 if ( signalEvents.isValid() )
187 {
188 ATH_MSG_VERBOSE("Found signalEvents");
189 for (const xAOD::TruthEventBase* evt : *signalEvents)
190 {
191 const xAOD::TruthVertex* vLink = *(evt->truthVertexLink(0));
192 if (vLink == nullptr){
193 ATH_MSG_ERROR("Invalid truthVertexLink from signalEvents in GaussianDensityTestAlg::findTruth");
194 return StatusCode::FAILURE;
195 }
196 Amg::Vector3D vTruth(vLink->x(),vLink->y(),vLink->z());
197 int nGoodTracks = 0;
198 for (auto *trk : trackVector)
199 {
200 Trk::LinkToXAODTrackParticle* lxtp = dynamic_cast<Trk::LinkToXAODTrackParticle*>(trk);
201 if (lxtp)
202 {
203 bool isAssoc = truthParticleAssoc(**(*lxtp)).isValid();
204 if (isAssoc)
205 {
206 const auto& assocParticle = truthParticleAssoc(**(*lxtp));
207 ATH_MSG_VERBOSE("Found associated truth particle");
208 for (const auto& truthParticle : evt->truthParticleLinks())
209 {
210 if (!truthParticle.isValid()) continue;
211 if (assocParticle == truthParticle)
212 {
213 ATH_MSG_VERBOSE("Calling ipSignificance");
214 double significance = ipSignificance(trk->parameters(), &vTruth);
215 ATH_MSG_VERBOSE("ipSignificance returned " << significance);
216 if (significance <= m_significanceTruthCut)
217 {
218 ATH_MSG_VERBOSE("Adding good track");
219 nGoodTracks++;
220 const Trk::Perigee* perigee = dynamic_cast<const Trk::Perigee*>(trk->parameters());
221 if (perigee == nullptr) ATH_MSG_ERROR("Invalid Perigee");
222 if (m_firstEvent)
223 {
224 h_truthDensity->Fill(vLink->z());
225 ATH_MSG_VERBOSE("Filled truth density histogram");
226 }
227 }
228 break;
229 }
230 }
231 }
232 else
233 {
234 ATH_MSG_VERBOSE("No associated truth particle found");
235 }
236 }
237 }
238 if (nGoodTracks >= m_truthVertexTracks)
239 {
240 truth.push_back(vTruth);
241 if (abs(modeClosestDistance) > abs(mode - vTruth[2]))
242 modeClosestDistance = mode - vTruth[2];
243 }
244 }
245 }
246 else
247 {
248 ATH_MSG_WARNING("No TruthEventContainer found");
249 }
250
251 SG::ReadHandle<xAOD::TruthPileupEventContainer> pileupEvents(m_pileupEventsKey);
252 if ( pileupEvents.isValid() )
253 {
254 ATH_MSG_VERBOSE("Found pileupEvents");
255 for (const xAOD::TruthEventBase* evt : *pileupEvents)
256 {
257 const xAOD::TruthVertex* vLink = *(evt->truthVertexLink(0));
258 if (vLink == nullptr) {
259 ATH_MSG_ERROR("Invalid truthVertexLink from pileupEvents");
260 return StatusCode::FAILURE;
261 }
262 Amg::Vector3D vTruth(vLink->x(),vLink->y(),vLink->z());
263 int nGoodTracks = 0;
264 for (auto *trk : trackVector)
265 {
266 Trk::LinkToXAODTrackParticle* lxtp = dynamic_cast<Trk::LinkToXAODTrackParticle*>(trk);
267 if (lxtp)
268 {
269 bool isAssoc = truthParticleAssoc(**(*lxtp)).isValid();
270 if (isAssoc)
271 {
272 const auto& assocParticle = truthParticleAssoc(**(*lxtp));
273 ATH_MSG_VERBOSE("Found associated truth particle");
274 for (const auto& truthParticle : evt->truthParticleLinks())
275 {
276 if (!truthParticle.isValid()) continue;
277 if (assocParticle == truthParticle)
278 {
279 ATH_MSG_VERBOSE("Calling ipSignificance");
280 double significance = ipSignificance(trk->parameters(), &vTruth);
281 ATH_MSG_VERBOSE("ipSignificance returned " << significance);
282 if (significance <= m_significanceTruthCut)
283 {
284 ATH_MSG_VERBOSE("Adding good track");
285 nGoodTracks++;
286 const Trk::Perigee* perigee = dynamic_cast<const Trk::Perigee*>(trk->parameters());
287 if (perigee == nullptr) ATH_MSG_ERROR("Invalid Perigee");
288 if (m_firstEvent)
289 {
290 h_truthDensity->Fill(vLink->z());
291 ATH_MSG_VERBOSE("Filled truth density histogram");
292 }
293 }
294 break;
295 }
296 }
297 }
298 else
299 {
300 ATH_MSG_VERBOSE("No associated truth particle found");
301 }
302 }
303 }
304 if (nGoodTracks >= m_truthVertexTracks)
305 {
306 truth.push_back(vTruth);
307 if (abs(modeClosestDistance) > abs(mode - vTruth[2]))
308 modeClosestDistance = mode - vTruth[2];
309 }
310 }
311 }
312 else
313 {
314 ATH_MSG_WARNING("No TruthPileupEventContainer found");
315 }
316
317 h_modeCheck->Fill( modeClosestDistance );
318 return StatusCode::SUCCESS;
319 }
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
SG::ConstAccessor< T, ALLOC > ConstAccessor
Helper class to provide type-safe access to aux data.
Definition AuxElement.h:131
SG::ReadHandleKey< xAOD::TruthPileupEventContainer > m_pileupEventsKey
Gaudi::Property< int > m_truthVertexTracks
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventsKey
Gaudi::Property< double > m_significanceTruthCut
double ipSignificance(const Trk::TrackParameters *params, const Amg::Vector3D *vertex) const
float z() const
Vertex longitudinal distance along the beam line form the origin.
float y() const
Vertex y displacement.
float x() const
Vertex x displacement.
Eigen::Matrix< double, 3, 1 > Vector3D
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
TruthEventBase_v1 TruthEventBase
Typedef to implementation.
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15

◆ initialize()

StatusCode Trk::GaussianDensityTestAlg::initialize ( )
virtual

Definition at line 50 of file GaussianDensityTestAlg.cxx.

51{
52 ATH_MSG_INFO ("Initializing " << name() << "...");
53
54 ATH_CHECK( m_trackParticlesKey.initialize() );
55 ATH_CHECK( m_truthEventsKey.initialize() );
56 ATH_CHECK( m_pileupEventsKey.initialize() );
57
58 ATH_CHECK( m_estimator.retrieve() );
59 ATH_CHECK( m_trackFilter.retrieve() );
60 ATH_CHECK( m_ipEstimator.retrieve() );
61 ATH_CHECK(m_beamSpotKey.initialize());
62 // setup histograms/trees
63 m_h_density = new TH1F("Density", "Density", 800, -200.0, 200.0);
64 m_h_truthDensity = new TH1F("Truth", "Truth", 800, -200.0, 200.0);
65 m_h_truthVertices = new TH1F("TruthVertices", "TruthVertices", 800, -200.0, 200.0);
66 m_h_modeCheck = new TH1F("ModeOffset", "ModeOffset", 100, -2.0, 2.0);
67
68 CHECK( m_iTHistSvc->regHist("/file1/h/density", m_h_density) );
69 CHECK( m_iTHistSvc->regHist("/file1/h/truth", m_h_truthDensity) );
70 CHECK( m_iTHistSvc->regHist("/file1/h/truthvertices", m_h_truthVertices) );
71 CHECK( m_iTHistSvc->regHist("/file1/h/modeoffset", m_h_modeCheck) );
72
73 return StatusCode::SUCCESS;
74}
#define CHECK(...)
Evaluate an expression and check for errors.
ToolHandle< InDet::IInDetTrackSelectionTool > m_trackFilter
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
ToolHandle< Trk::ITrackToVertexIPEstimator > m_ipEstimator
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::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.

◆ ipSignificance()

double Trk::GaussianDensityTestAlg::ipSignificance ( const Trk::TrackParameters * params,
const Amg::Vector3D * vertex ) const
private

Definition at line 321 of file GaussianDensityTestAlg.cxx.

323 {
326 v.setPosition(*vertex);
327 v.setCovariancePosition(AmgSymMatrix(3)::Zero(3,3));
328 v.setFitQuality(0., 0.);
329
330 double significance = 0.0;
331 std::unique_ptr<ImpactParametersAndSigma> ipas = m_ipEstimator->estimate( params, &v );
332 if ( ipas != nullptr )
333 {
334 if ( ipas->sigmad0 > 0 && ipas->sigmaz0 > 0)
335 {
336 significance = sqrt( pow(ipas->IPd0/ipas->sigmad0,2) + pow(ipas->IPz0/ipas->sigmaz0,2) );
337 }
338 }
339 return significance;
340 }
#define AmgSymMatrix(dim)
constexpr int pow(int base, int exp) noexcept
void makePrivateStore()
Create a new (empty) private store for this object.
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::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< Algorithm > >::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< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
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)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ selectTracks()

void Trk::GaussianDensityTestAlg::selectTracks ( const xAOD::TrackParticleContainer * trackParticles,
std::vector< Trk::ITrackLink * > & trackVector )
private

Definition at line 133 of file GaussianDensityTestAlg.cxx.

135{
136 bool selectionPassed{false};
137 const InDet::BeamSpotData* beamspot = nullptr;
139 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
140 if(beamSpotHandle.isValid()) beamspot = beamSpotHandle.retrieve();
141 }
142 for (auto itr = trackParticles->begin(); itr != trackParticles->end(); ++itr) {
144 xAOD::Vertex beamposition;
145 beamposition.makePrivateStore();
146 beamposition.setPosition(beamspot->beamVtx().position());
147 beamposition.setCovariancePosition(beamspot->beamVtx().covariancePosition());
148 selectionPassed=static_cast<bool>(m_trackFilter->accept(**itr,&beamposition));
149 }
150 else
151 {
152 xAOD::Vertex null;
153 null.makePrivateStore();
154 null.setPosition(Amg::Vector3D(0,0,0));
155 AmgSymMatrix(3) vertexError;
156 vertexError.setZero();
157 null.setCovariancePosition(vertexError);
158 selectionPassed=static_cast<bool>(m_trackFilter->accept(**itr,&null));
159 }
160 if (selectionPassed)
161 {
162 ElementLink<xAOD::TrackParticleContainer> link;
163 link.setElement(*itr);
164 Trk::LinkToXAODTrackParticle * linkTT = new Trk::LinkToXAODTrackParticle(link);
165 linkTT->setStorableObject(*trackParticles);
166 trackVector.push_back(linkTT);
167 }
168 }
169}
if(febId1==febId2)
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
const Trk::RecVertex & beamVtx() const noexcept
const_pointer_type retrieve()
const Amg::Vector3D & position() const
return position of vertex
Definition Vertex.cxx:63
void setCovariancePosition(const AmgSymMatrix(3)&covariancePosition)
Sets the vertex covariance matrix.
void setPosition(const Amg::Vector3D &position)
Sets the 3-position.

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_beamSpotKey

SG::ReadCondHandleKey<InDet::BeamSpotData> Trk::GaussianDensityTestAlg::m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
private

Definition at line 122 of file GaussianDensityTestAlg.h.

122{ this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_estimator

ToolHandle< Trk::IVertexTrackDensityEstimator > Trk::GaussianDensityTestAlg::m_estimator
private
Initial value:
{ this, "Estimator", "Trk::GaussianTrackDensity",
"Track density function" }

Definition at line 114 of file GaussianDensityTestAlg.h.

114 { this, "Estimator", "Trk::GaussianTrackDensity",
115 "Track density function" };

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_firstEvent

bool Trk::GaussianDensityTestAlg::m_firstEvent
private

Definition at line 107 of file GaussianDensityTestAlg.h.

◆ m_h_density

TH1* Trk::GaussianDensityTestAlg::m_h_density {}
private

Histograms and trees.

Definition at line 137 of file GaussianDensityTestAlg.h.

137{};

◆ m_h_modeCheck

TH1* Trk::GaussianDensityTestAlg::m_h_modeCheck {}
private

Definition at line 140 of file GaussianDensityTestAlg.h.

140{};

◆ m_h_truthDensity

TH1* Trk::GaussianDensityTestAlg::m_h_truthDensity {}
private

Definition at line 138 of file GaussianDensityTestAlg.h.

138{};

◆ m_h_truthVertices

TH1* Trk::GaussianDensityTestAlg::m_h_truthVertices {}
private

Definition at line 139 of file GaussianDensityTestAlg.h.

139{};

◆ m_ipEstimator

ToolHandle< Trk::ITrackToVertexIPEstimator > Trk::GaussianDensityTestAlg::m_ipEstimator
private
Initial value:
{ this, "IPEstimator", "Trk::TrackToVertexIPEstimator",
"Impact point estimator" }

Definition at line 117 of file GaussianDensityTestAlg.h.

117 { this, "IPEstimator", "Trk::TrackToVertexIPEstimator",
118 "Impact point estimator" };

◆ m_iTHistSvc

ServiceHandle< ITHistSvc > Trk::GaussianDensityTestAlg::m_iTHistSvc
private

Definition at line 123 of file GaussianDensityTestAlg.h.

◆ m_pileupEventsKey

SG::ReadHandleKey<xAOD::TruthPileupEventContainer> Trk::GaussianDensityTestAlg::m_pileupEventsKey
private
Initial value:
{ this, "TruthPileupEvents", "TruthPileupEvents",
"Key for truth pileup event collection" }

Definition at line 132 of file GaussianDensityTestAlg.h.

132 { this, "TruthPileupEvents", "TruthPileupEvents",
133 "Key for truth pileup event collection" };

◆ m_significanceTruthCut

Gaudi::Property<double> Trk::GaussianDensityTestAlg::m_significanceTruthCut
private
Initial value:
{ this,
"SignificanceTruthCut",
3.0,
"Reco track must pass within this many sigma of pp vertex to be good" }

Definition at line 96 of file GaussianDensityTestAlg.h.

96 { this,
97 "SignificanceTruthCut",
98 3.0,
99 "Reco track must pass within this many sigma of pp vertex to be good" };

◆ m_trackFilter

ToolHandle< InDet::IInDetTrackSelectionTool > Trk::GaussianDensityTestAlg::m_trackFilter
private
Initial value:
{ this, "TrackSelector",
"InDet::InDetTrackSelectionTool/InDetDetailedTrackSelectionTool",
"Track selection tool" }

Definition at line 110 of file GaussianDensityTestAlg.h.

110 { this, "TrackSelector",
111 "InDet::InDetTrackSelectionTool/InDetDetailedTrackSelectionTool",
112 "Track selection tool" } ;

◆ m_trackParticlesKey

SG::ReadHandleKey<xAOD::TrackParticleContainer> Trk::GaussianDensityTestAlg::m_trackParticlesKey
private
Initial value:
{ this, "TrackParticles", "InDetTrackParticles",
"Input track particle collection" }

Data handle keys.

Definition at line 126 of file GaussianDensityTestAlg.h.

126 { this, "TrackParticles", "InDetTrackParticles",
127 "Input track particle collection" };

◆ m_truthEventsKey

SG::ReadHandleKey<xAOD::TruthEventContainer> Trk::GaussianDensityTestAlg::m_truthEventsKey
private
Initial value:
{ this, "TruthEvents", "TruthEvents",
"Key for truth event collection" }

Definition at line 129 of file GaussianDensityTestAlg.h.

129 { this, "TruthEvents", "TruthEvents",
130 "Key for truth event collection" };

◆ m_truthVertexTracks

Gaudi::Property<int> Trk::GaussianDensityTestAlg::m_truthVertexTracks
private
Initial value:
{ this,
"MinTruthVertexTracks",
2,
"Minimum associated reconstructed tracks for vertex to be considered visible" }

Definition at line 101 of file GaussianDensityTestAlg.h.

101 { this,
102 "MinTruthVertexTracks",
103 2,
104 "Minimum associated reconstructed tracks for vertex to be considered visible" };

◆ m_useBeamConstraint

bool Trk::GaussianDensityTestAlg::m_useBeamConstraint
private

Definition at line 106 of file GaussianDensityTestAlg.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: