ATLAS Offline Software
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 //____________________________________________________________________
28 {
30 }
31 
32 //____________________________________________________________________
34 public:
37  void possiblyUpdateGUI() {//Fixme: to TrackCollHandleBase
38  if (!((updateGUICounter++)%50)) {
40  }
41  }
42 };
43 
44 
45 //____________________________________________________________________
47  const QString& name)
49 {
50  m_d->theclass = this;
51  m_d->updateGUICounter = 0;
52 }
53 
54 //____________________________________________________________________
56 {
57  delete m_d;
58 }
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) {
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TrackCollHandleBase
Definition: TrackCollHandleBase.h:49
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TrackCollHandle_xAODTrackParticle::TrackCollHandle_xAODTrackParticle
TrackCollHandle_xAODTrackParticle(TrackSysCommonData *, const QString &name)
Definition: TrackCollHandle_xAODTrackParticle.cxx:46
TrackCollHandle_xAODTrackParticle::~TrackCollHandle_xAODTrackParticle
virtual ~TrackCollHandle_xAODTrackParticle()
Definition: TrackCollHandle_xAODTrackParticle.cxx:55
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
skel.it
it
Definition: skel.GENtoEVGEN.py:423
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
TrackCollHandle_xAODTrackParticle::cut
virtual bool cut(TrackHandleBase *)
Definition: TrackCollHandle_xAODTrackParticle.cxx:103
TrackCollHandleBase::hintNumberOfTracksInEvent
void hintNumberOfTracksInEvent(unsigned)
Definition: TrackCollHandleBase.cxx:510
TrackHandle_xAODTrackParticle.h
VP1HelperClassBase::messageDebug
void messageDebug(const QString &) const
Definition: VP1HelperClassBase.cxx:65
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
TrackCollHandle_xAODTrackParticle::Imp
Definition: TrackCollHandle_xAODTrackParticle.cxx:33
VP1SGContentsHelper::getKeys
QStringList getKeys() const
Definition: VP1SGContentsHelper.h:55
TrackCollHandleBase::cut
virtual bool cut(TrackHandleBase *)
Definition: TrackCollHandleBase.cxx:316
TrackCollHandle_xAODTrackParticle::m_d
Imp * m_d
Definition: TrackCollHandle_xAODTrackParticle.h:40
IVP1System
Definition: IVP1System.h:36
TrackSysCommonData
Definition: TrackSysCommonData.h:47
TrackCollHandle_xAODTrackParticle
Definition: TrackCollHandle_xAODTrackParticle.h:20
TrackHandle_xAODTrackParticle
Definition: TrackHandle_xAODTrackParticle.h:28
TrackCollHandleBase::name
QString name() const
Definition: TrackCollHandleBase.cxx:310
TrackCollHandle_xAODTrackParticle::Imp::theclass
TrackCollHandle_xAODTrackParticle * theclass
Definition: TrackCollHandle_xAODTrackParticle.cxx:35
DataVector< xAOD::TrackParticle_v1 >
TrackCollHandle_xAODTrackParticle::load
virtual bool load()
Definition: TrackCollHandle_xAODTrackParticle.cxx:61
VP1HelperClassBase::systemBase
IVP1System * systemBase() const
Definition: VP1HelperClassBase.h:50
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrackCollHandleBase::addTrackHandle
void addTrackHandle(TrackHandleBase *)
Definition: TrackCollHandleBase.cxx:516
VP1SGContentsHelper
Definition: VP1SGContentsHelper.h:26
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
IVP1System::updateGUI
void updateGUI()
Definition: IVP1System.cxx:262
TrackCollHandle_xAODTrackParticle::availableCollections
static QStringList availableCollections(IVP1System *)
Definition: TrackCollHandle_xAODTrackParticle.cxx:27
TrackCollHandle_xAODTrackParticle.h
calibdata.cd
cd
Definition: calibdata.py:51
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
VP1SGAccessHelper
Definition: VP1SGAccessHelper.h:25
TrackHandleBase
Definition: TrackHandleBase.h:56
VP1SGAccessHelper.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TrackCollHandle_xAODTrackParticle::Imp::updateGUICounter
int updateGUICounter
Definition: TrackCollHandle_xAODTrackParticle.cxx:36
IVP1System.h
TrackParticleContainer.h
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
TrackCollHandle_xAODTrackParticle::Imp::possiblyUpdateGUI
void possiblyUpdateGUI()
Definition: TrackCollHandle_xAODTrackParticle.cxx:37
VP1SGContentsHelper.h
TrackType
Definition: TrackTypes.h:10