11 const std::string& name,
12 const IInterface* parent) :
13 base_class(
type, name, parent)
21 return StatusCode::SUCCESS;
26 return StatusCode::SUCCESS;
44 <<
"' could not be retrieved from StoreGate!" );
45 return StatusCode::FAILURE;
50 <<
"' retrieved from StoreGate" );
59 <<
"' could not be retrieved from StoreGate!" );
60 return StatusCode::FAILURE;
65 <<
"' retrieved from StoreGate" );
70 std::set<int> goodTrackIDs;
74 for (; eleItr != eleItrEnd; ++eleItr)
79 ATH_MSG_DEBUG(
"Electron at eta = " << (*eleItr)->eta() <<
" phi = " << (*eleItr)->phi() );
83 std::set<int> eg_trackList =
findGoodTracks(trackCollection.cptr(), (*eleItr)->p4(),
m_dr );
87 goodTrackIDs.insert(eg_trackList.begin() , eg_trackList.end() ) ;
97 for (; phoItr != phoItrEnd; ++phoItr)
102 ATH_MSG_DEBUG(
"Photon at eta = " << (*phoItr)->eta() <<
" phi = " << (*phoItr)->phi() );
106 std::set<int> eg_trackList =
findGoodTracks(trackCollection.cptr(), (*phoItr)->p4(),
m_dr );
110 goodTrackIDs.insert(eg_trackList.begin() , eg_trackList.end() ) ;
120 ATH_MSG_DEBUG(
"Track thinning : tracks = " << trackCollection->size()
121 <<
" accepted = " << goodTrackIDs.size() );
123 return StatusCode::SUCCESS;
132 const TLorentzVector& candHepLorentz,
133 double maxDeltaR )
const
136 std::set<int> goodTracks;
141 for (; trackItr != trackItrEnd; ++trackItr)
145 if (!track){
continue; }
149 double trketa = 0.,trkphi = 0;
150 const Trk::Perigee* startPerigee = track->perigeeParameters();
151 trketa = startPerigee->
eta();
152 trkphi = startPerigee->parameters()[
Trk::phi0];
154 double deltaEta = trketa - candHepLorentz.Eta() ;
158 ATH_MSG_DEBUG(
"Thin Tracks: eta = " << trketa <<
" phi = " << trkphi <<
" deltaR = " <<
deltaR );
161 goodTracks.insert( i );
162 ATH_MSG_DEBUG(
" Track in the cone, adding: " <<
" eta=" << trketa <<
" phi=" << trkphi );
179 const std::set<int>& goodTrackIDs )
const
185 StatusCode
sc(StatusCode::SUCCESS);
189 std::vector<bool> mask(trackCollection->size());
192 unsigned long nTotal = 0;
193 unsigned long nKeep = 0;
194 unsigned long nReject = 0;
198 for ( std::size_t i=0; i<trackCollection->size(); ++i )
201 if ( goodTrackIDs.find( i ) != goodTrackIDs.end() )
214 ATH_MSG_DEBUG(
" EGammaTracksThinning statistics: tracks processed " << nTotal
215 <<
" kept = " << nKeep
216 <<
" rejected " << nReject );
219 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
EGammaTracksThinning(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode doThinning(const EventContext &ctx) const override
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