ATLAS Offline Software
Loading...
Searching...
No Matches
TrackCollHandle_xAODTrackParticle.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Implementation of class TrackCollHandle_xAODTrackParticle //
9// //
10// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11// Initial version: May 2008 //
12// //
14
17
18//#include "xAODTrackParticle/TrackParticleContainer.h"
20
21#include "VP1Base/IVP1System.h"
24#include <QStringList>
25
26//____________________________________________________________________
31
32//____________________________________________________________________
34public:
37 void possiblyUpdateGUI() {//Fixme: to TrackCollHandleBase
38 if (!((updateGUICounter++)%50)) {
39 theclass->systemBase()->updateGUI();
40 }
41 }
42};
43
44
45//____________________________________________________________________
47 const QString& name)
49{
50 m_d->theclass = this;
51 m_d->updateGUICounter = 0;
52}
53
54//____________________________________________________________________
59
60//____________________________________________________________________
62{
63 //Get collection:
64 const xAOD::TrackParticleContainer * coll(nullptr);
65 if (!VP1SGAccessHelper(systemBase()).retrieve(coll, name())) {
66 message("Error: Could not retrieve track particle collection with key="+name());
67 return false;
68 }
69
70 // // Retrieve the xAOD particles:
71 // const xAOD::TrackParticleContainer* xaod = evtStore()->retrieve<const xAOD::TrackParticleContainer>( m_xAODTrackParticleCollection );
72
73 // Check that the auxiliary store association was made successfully:
74 if( ! coll->hasStore() ) {
75 message("No auxiliary store got associated to the xAODTrackParticle container with key: " +name());
76 }
77
78 // This is needed for now, until the issues around the DV code are
79 // sorted out...
80 const_cast< xAOD::TrackParticleContainer* >( coll )->setStore(
81 ( SG::IAuxStore* ) coll->getConstStore() );
82
83 //Make appropriate trk::track handles:
86 for ( it = coll->begin() ; it != itEnd; ++it) {
87 m_d->possiblyUpdateGUI();
88 if (!*it) {
89 messageDebug("WARNING: Ignoring null xAODTrackParticle pointer.");
90 continue;
91 }
92 if ((*it)->charge()==0.0) {
93 messageDebug("WARNING: Ignoring xAODTrackParticle which claims to be neutral (charge()==0.0).");
94 continue;
95 }
97 }
98
99 return true;
100}
101
102//____________________________________________________________________
104{
105 if (!TrackCollHandleBase::cut(handle))
106 return false;
107
108 //Fixme: more?
109
110 return true;
111}
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
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.
size_type size() const noexcept
Returns the number of elements in the collection.
Interface for non-const operations on an auxiliary store.
Definition IAuxStore.h:48
void hintNumberOfTracksInEvent(unsigned)
const QString & name() const
virtual bool cut(TrackHandleBase *)
void addTrackHandle(TrackHandleBase *)
TrackCollHandleBase(TrackSysCommonData *, const QString &name, TrackType::Type)
TrackCollHandle_xAODTrackParticle(TrackSysCommonData *, const QString &name)
static QStringList availableCollections(IVP1System *)
void message(const QString &) const
IVP1System * systemBase() const
void messageDebug(const QString &) const
QStringList getKeys() const
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".