11 const std::string& name,
12 const IInterface* parent) :
13 base_class(
type, name, parent)
21 return StatusCode::SUCCESS;
26 return StatusCode::SUCCESS;
31 const EventContext& ctx = Gaudi::Hive::currentContext();
45 <<
"' could not be retrieved from StoreGate!" );
46 return StatusCode::FAILURE;
51 <<
"' retrieved from StoreGate" );
60 <<
"' could not be retrieved from StoreGate!" );
61 return StatusCode::FAILURE;
66 <<
"' retrieved from StoreGate" );
71 std::set<int> goodTrackIDs;
75 for (; eleItr != eleItrEnd; ++eleItr)
80 ATH_MSG_DEBUG(
"Electron at eta = " << (*eleItr)->eta() <<
" phi = " << (*eleItr)->phi() );
84 std::set<int> eg_trackList =
findGoodTracks(trackCollection.cptr(), (*eleItr)->p4(),
m_dr );
88 goodTrackIDs.insert(eg_trackList.begin() , eg_trackList.end() ) ;
98 for (; phoItr != phoItrEnd; ++phoItr)
103 ATH_MSG_DEBUG(
"Photon at eta = " << (*phoItr)->eta() <<
" phi = " << (*phoItr)->phi() );
107 std::set<int> eg_trackList =
findGoodTracks(trackCollection.cptr(), (*phoItr)->p4(),
m_dr );
111 goodTrackIDs.insert(eg_trackList.begin() , eg_trackList.end() ) ;
121 ATH_MSG_DEBUG(
"Track thinning : tracks = " << trackCollection->size()
122 <<
" accepted = " << goodTrackIDs.size() );
124 return StatusCode::SUCCESS;
133 const TLorentzVector& candHepLorentz,
134 double maxDeltaR )
const
137 std::set<int> goodTracks;
142 for (; trackItr != trackItrEnd; ++trackItr)
146 if (!track){
continue; }
150 double trketa = 0.,trkphi = 0;
151 const Trk::Perigee* startPerigee = track->perigeeParameters();
152 trketa = startPerigee->
eta();
153 trkphi = startPerigee->parameters()[
Trk::phi0];
155 double deltaEta = trketa - candHepLorentz.Eta() ;
159 ATH_MSG_DEBUG(
"Thin Tracks: eta = " << trketa <<
" phi = " << trkphi <<
" deltaR = " <<
deltaR );
162 goodTracks.insert( i );
163 ATH_MSG_DEBUG(
" Track in the cone, adding: " <<
" eta=" << trketa <<
" phi=" << trkphi );
180 const std::set<int>& goodTrackIDs )
const
186 StatusCode
sc(StatusCode::SUCCESS);
190 std::vector<bool> mask(trackCollection->size());
193 unsigned long nTotal = 0;
194 unsigned long nKeep = 0;
195 unsigned long nReject = 0;
199 for ( std::size_t i=0; i<trackCollection->size(); ++i )
202 if ( goodTrackIDs.find( i ) != goodTrackIDs.end() )
215 ATH_MSG_DEBUG(
" EGammaTracksThinning statistics: tracks processed " << nTotal
216 <<
" kept = " << nKeep
217 <<
" rejected " << nReject );
220 trackCollection.
thin (mask);
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Handle for requesting thinning for a data object.
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
xAOD::ElectronContainer * electronContainer
xAOD::PhotonContainer * photonContainer
DataModel_detail::const_iterator< DataVector > const_iterator
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.
SG::ThinningHandleKey< TrackCollection > m_tracksCollectionName
virtual StatusCode finalize() override
std::set< int > findGoodTracks(const TrackCollection *trackCont, const TLorentzVector &candHepLorentz, double maxDeltaR) const
StringProperty m_streamName
Gaudi::Property< double > m_minEtEg
Gaudi::Property< double > m_dr
virtual StatusCode initialize() override
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsContainerKey
StatusCode thinTracks(SG::ThinningHandle< TrackCollection > &trackCont, const std::set< int > &goodTracks) const
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonsContainerKey
virtual StatusCode doThinning() const override
EGammaTracksThinning(const std::string &type, const std::string &name, const IInterface *parent)
void thin(size_t ndx)
Mark that index ndx in the container should be thinned away.
Handle for requesting thinning for a data object.
double eta() const
Access method for pseudorapidity - from momentum.
double deltaR(double eta1, double eta2, double phi1, double phi2)
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee