ATLAS Offline Software
Loading...
Searching...
No Matches
TrackCollHandle_TrackParticle.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_TrackParticle //
9// //
10// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11// Initial version: May 2008 //
12// //
14
18#include "VP1Base/IVP1System.h"
21#include <QStringList>
22
23//____________________________________________________________________
28
29//____________________________________________________________________
31public:
34 void possiblyUpdateGUI() {//Fixme: to TrackCollHandleBase
35 if (!((updateGUICounter++)%50)) {
36 theclass->systemBase()->updateGUI();
37 }
38 }
39};
40
41
42//____________________________________________________________________
44 const QString& name)
45 : TrackCollHandleBase(cd,name,TrackType::TrackParticle), m_d(new Imp)
46{
47 m_d->theclass = this;
48 m_d->updateGUICounter = 0;
49}
50
51//____________________________________________________________________
56
57//____________________________________________________________________
59{
60 //Get collection:
61 const Rec::TrackParticleContainer * coll(nullptr);
62 if (!VP1SGAccessHelper(systemBase()).retrieve(coll, name())) {
63 message("Error: Could not retrieve track particle collection with key="+name());
64 return false;
65 }
66
67 //Make appropriate trk::track handles:
70 for ( it = coll->begin() ; it != itEnd; ++it) {
71 m_d->possiblyUpdateGUI();
72 if (!*it) {
73 messageDebug("WARNING: Ignoring null TrackParticle pointer.");
74 continue;
75 }
76 if ((*it)->charge()==0.0) {
77 messageDebug("WARNING: Ignoring TrackParticle which claims to be neutral (charge()==0.0).");
78 continue;
79 }
81 }
82
83 return true;
84}
85
86//____________________________________________________________________
88{
89 if (!TrackCollHandleBase::cut(handle))
90 return false;
91
92 //Fixme: more?
93
94 return true;
95}
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.
void hintNumberOfTracksInEvent(unsigned)
const QString & name() const
virtual bool cut(TrackHandleBase *)
void addTrackHandle(TrackHandleBase *)
TrackCollHandleBase(TrackSysCommonData *, const QString &name, TrackType::Type)
static QStringList availableCollections(IVP1System *)
TrackCollHandle_TrackParticle(TrackSysCommonData *, const QString &name)
void message(const QString &) const
IVP1System * systemBase() const
void messageDebug(const QString &) const
QStringList getKeys() const