39 ATH_MSG_ERROR (
"Ghost matching is not a valid tau-track association scheme for trigger, use cone association. Aborting.");
40 return StatusCode::FAILURE;
49 return StatusCode::SUCCESS;
54 const EventContext &ctx = Gaudi::Hive::currentContext();
55 std::vector<const xAOD::TrackParticle*> tauTracks;
56 std::vector<const xAOD::TrackParticle*> wideTracks;
57 std::vector<const xAOD::TrackParticle*> otherTracks;
63 if (!trackPartInHandle.
isValid()) {
64 ATH_MSG_ERROR (
"Could not retrieve HiveDataObj with key " << trackPartInHandle.
key());
65 return StatusCode::FAILURE;
67 trackParticleCont = trackPartInHandle.
cptr();
71 std::vector<const xAOD::TrackParticle*> vecTrksLargeD0;
74 if (!trackPartInHandle.
isValid()) {
75 ATH_MSG_VERBOSE (
"Could not retrieve HiveDataObj with key " << trackPartInHandle.
key());
76 ATH_MSG_VERBOSE (
"LRT container " << trackPartInHandle.
key()<<
" is not being used for tau tracks");
79 largeD0TracksParticleCont = trackPartInHandle.
cptr();
80 vecTrksLargeD0 = std::vector<const xAOD::TrackParticle*>(largeD0TracksParticleCont->
begin(), largeD0TracksParticleCont->
end());
91 ATH_MSG_ERROR (
"Could not retrieve HiveDataObj with key " << jetContHandle.
key());
92 return StatusCode::FAILURE;
94 jetContainer = jetContHandle.
cptr();
97 std::vector<const xAOD::TrackParticle*> vecTrks;
98 vecTrks.reserve( trackParticleCont->
size() );
99 for (
auto trk : *trackParticleCont){
100 if (!
inEleRM()) { vecTrks.push_back(trk); }
103 auto original_id_track_link = acc_originalObject(*trk);
104 if (!original_id_track_link.isValid()) {
108 vecTrks.push_back(*original_id_track_link);
120 bool foundLRTCont = bool (largeD0TracksParticleCont !=
nullptr);
124 getTauTracksFromPV(pTau, vecTrksLargeD0, pVertex,
false,
nullptr, tauTracks, wideTracks, otherTracks);
133 bool alreadyUsed =
false;
134 for (std::vector<const xAOD::TrackParticle*>::iterator track_it = tauTracks.begin(); track_it != tauTracks.end() ;)
141 if( (*track_it) == tau_trk->track()) alreadyUsed =
true;
145 ATH_MSG_INFO(
"Found Already Used track new, now removing: " << *track_it );
146 track_it = tauTracks.erase(track_it);
153 for (
unsigned int i = 0; i < tauTracks.size(); ++i) {
157 <<
" eta " << trackParticle->
eta()
158 <<
" phi " << trackParticle->
phi());
173 track->addTrackLink(linkToTrackParticle);
175 track->setP4(trackParticle->
pt(), trackParticle->
eta(), trackParticle->
phi(), trackParticle->
m());
188 <<
" phi " << pTau.
track(i)->
phi());
193 for (
unsigned int i = 0; i < wideTracks.size(); ++i) {
197 <<
" eta " << trackParticle->
eta()
198 <<
" phi " << trackParticle->
phi());
211 track->addTrackLink(linkToTrackParticle);
213 track->setP4(trackParticle->
pt(), trackParticle->
eta(), trackParticle->
phi(), trackParticle->
m());
230 for (
unsigned int i = 0; i < otherTracks.size(); ++i) {
234 <<
" eta " << trackParticle->
eta()
235 <<
" phi " << trackParticle->
phi());
249 track->addTrackLink(linkToTrackParticle);
251 track->setP4(trackParticle->
pt(), trackParticle->
eta(), trackParticle->
phi(), trackParticle->
m());
252 float dR = track->p4().DeltaR(pTau.
p4());
273 vxbkp.makePrivateStore();
285 const auto& cov = beamSpotHandle->beamVtx().covariancePosition();
288 if(!tauTracks.empty()) {
289 vxbkp.
setZ(tauTracks.at(0)->z0());
307 assert (trackLink.getStorableObjectPointer() == &tauTrackCon);
309 dec_d0TJVA(*track) = track->track()->d0();
310 dec_z0sinthetaTJVA(*track) = track->z0sinThetaTJVA(pTau);
311 dec_d0SigTJVA(*track) = -999.;
312 dec_z0sinthetaSigTJVA(*track) = -999.;
316 std::unique_ptr<const Trk::ImpactParametersAndSigma> myIPandSigma
320 dec_d0TJVA(*track) = myIPandSigma->IPd0;
321 dec_z0sinthetaTJVA(*track) = myIPandSigma->IPz0SinTheta;
322 dec_d0SigTJVA(*track) = (myIPandSigma->sigmad0 != 0.) ?
static_cast<float>( myIPandSigma->IPd0 / myIPandSigma->sigmad0 ) : -999.f;
323 dec_z0sinthetaSigTJVA(*track) = (myIPandSigma->sigmaz0SinTheta != 0.) ?
static_cast<float>( myIPandSigma->IPz0SinTheta / myIPandSigma->sigmaz0SinTheta ) : -999.f;
333 if (
sc.isFailure() && !
sc.isRecoverable()) {
334 ATH_MSG_ERROR(
"couldn't extrapolate tracks to calo surface");
335 return StatusCode::FAILURE;
339 return StatusCode::SUCCESS;
348 double dR = pTau.
p4().DeltaR(trackParticle.
p4());
365 const std::vector<const xAOD::TrackParticle*>& vecTrackParticles,
367 const bool& useGhostTracks,
369 std::vector<const xAOD::TrackParticle*> &tauTracks,
370 std::vector<const xAOD::TrackParticle*> &wideTracks,
371 std::vector<const xAOD::TrackParticle*> &otherTracks)
const
373 std::vector<const xAOD::TrackParticle*> ghostTracks;
384 for (
uint i = 0; i < ghostTracks.size(); i++){
386 auto original_id_track_link = acc_originalTrack(*(ghostTracks[i]));
387 if (!original_id_track_link.isValid()) {
391 ghostTracks[i] = *original_id_track_link;
401 double dR = pTau.
p4().DeltaR(trackParticle->p4());
403 if (std::find(ghostTracks.begin(), ghostTracks.end(), trackParticle) == ghostTracks.end()) {
407 bool isSeedClosest =
false;
410 TLorentzVector jetLV;
411 jetLV.SetPtEtaPhiM(jetP4.Pt(), jetP4.Eta(), jetP4.Phi(), jetP4.M());
412 double dRjet = trackParticle->p4().DeltaR(jetLV);
415 isSeedClosest = (
jet == pTau.
jet());
418 if(!isSeedClosest)
continue;
424 tauTracks.push_back(trackParticle);
426 wideTracks.push_back(trackParticle);
428 otherTracks.push_back(trackParticle);
445 std::unique_ptr<Trk::CaloExtension> uniqueExtension;
448 assert (trackLink.getStorableObjectPointer() == &tauTrackCon);
451 if( !orgTrack )
continue;
452 trackIndex = orgTrack->index();
457 float etaHad = -10.0;
458 float phiHad = -10.0;
461 ATH_MSG_DEBUG(
"Try extrapolation of track with pt = " << orgTrack->
pt()
462 <<
", eta " << orgTrack->
eta()
463 <<
", phi" << orgTrack->
phi() );
469 caloExtension = (*particleCache)[trackIndex];
470 ATH_MSG_VERBOSE(
"Getting element " << trackIndex <<
" from the particleCache");
471 if( not caloExtension ){
473 "Calculating with the a CaloExtensionTool");
475 caloExtension = uniqueExtension.get();
482 caloExtension = uniqueExtension.get();
490 const std::vector<Trk::CurvilinearParameters>& clParametersVector = caloExtension->
caloLayerIntersections();
491 if (clParametersVector.empty()) {
496 bool validECal =
false;
497 bool validHCal =
false;
510 etaEM = cur.position().eta();
511 phiEM = cur.position().phi();
519 etaHad = cur.position().eta();
520 phiHad = cur.position().phi();
523 if( validECal and validHCal )
break;
526 if( not validECal and std::abs(orgTrack->
pt()) < 2.48 ){
530 if( not validHCal and orgTrack->
pt() > 2000. ){
535 <<
" phi="<<orgTrack->
phi()
536 <<
" to ECal eta=" << etaEM
538 <<
" HCal eta=" << etaHad
548 return StatusCode::SUCCESS;
554 std::vector<const xAOD::TrackParticle*> &tauTracks,
555 std::vector<const xAOD::TrackParticle*> &wideTracks,
556 std::vector<const xAOD::TrackParticle*> &otherTracks,
558 double maxDeltaZ0)
const
563 if (tauTracks.empty())
return;
567 float z0_leadTrk =
getZ0(ctx, leadTrack, tauOrigin);
569 if (z0_leadTrk >
MAX-1)
return;
571 ATH_MSG_VERBOSE(
"before z0 cut: #coreTracks=" << tauTracks.size() <<
", #wideTracks=" << wideTracks.size() <<
", #otherTracks=" << otherTracks.size());
573 std::vector<const xAOD::TrackParticle*>::iterator itr;
576 itr = tauTracks.begin()+1;
577 while (itr!=tauTracks.end()) {
578 float z0 =
getZ0(ctx, *itr, tauOrigin);
579 float deltaZ0=z0 - z0_leadTrk;
582 if ( std::abs(deltaZ0) < maxDeltaZ0 ) {++itr;}
584 otherTracks.push_back(*itr);
585 itr = tauTracks.erase(itr);
590 itr = wideTracks.begin();
591 while (itr!=wideTracks.end()) {
592 float z0 =
getZ0(ctx, *itr, tauOrigin);
593 float deltaZ0=z0 - z0_leadTrk;
596 if ( std::abs(deltaZ0) < maxDeltaZ0 ) { ++itr; }
598 otherTracks.push_back(*itr);
599 itr = wideTracks.erase(itr);
603 ATH_MSG_VERBOSE(
"after z0 cut: #coreTracks=" << tauTracks.size() <<
", #wideTracks=" << wideTracks.size() <<
", #otherTracks=" << otherTracks.size());
616 if (!track)
return MAX;
618 std::unique_ptr<Trk::Perigee> perigee;
619 if (vertex) perigee =
m_trackToVertexTool->perigeeAtVertex(ctx, *track, vertex->position());
627 return static_cast<float>(perigee->parameters()[
Trk::z0]);
632 const std::bitset<xAOD::NumberOfTrackRecoInfo> patternReco = track->patternRecoInfo();
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
double charge(const T &p)
provides Calorimeter Sampling enum
value_type push_back(value_type pElem)
Add an element to the end of the collection.
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.
ElementLink implementation for ROOT usage.
bool toContainedElement(BaseConstReference container, ElementType element)
Set link to point to given element (slowest).
Helper class to provide type-safe access to aux data.
Helper class to provide constant type-safe access to aux data.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
SG::ReadHandleKey< CaloExtensionCollection > m_ParticleCacheKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackPartInputContainer
TauTrackType tauTrackType(const xAOD::TauJet &tauJet, const xAOD::TrackParticle &trackParticle, const xAOD::Vertex *primaryVertex) const
Gaudi::Property< double > m_ghostTrackDR
virtual StatusCode initialize() override
Algorithm functions.
StatusCode extrapolateToCaloSurface(const EventContext &ctx, xAOD::TauJet &pTau, xAOD::TauTrackContainer &tauTrackCon) const
Extrapolate track eta and phi to the calorimeter middle surface.
void getTauTracksFromPV(const xAOD::TauJet &tauJet, const std::vector< const xAOD::TrackParticle * > &vecTrackParticles, const xAOD::Vertex *primaryVertex, const bool &useGhostTracks, const xAOD::JetContainer *jetContainer, std::vector< const xAOD::TrackParticle * > &tauTracks, std::vector< const xAOD::TrackParticle * > &wideTracks, std::vector< const xAOD::TrackParticle * > &otherTracks) const
std::set< CaloSampling::CaloSample > m_HadSamplings
ToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimator
SG::ReadHandleKey< xAOD::JetContainer > m_jetContainer
std::set< CaloSampling::CaloSample > m_EMSamplings
TauTrackType
Enumerator defining type of tau track.
ToolHandle< Trk::ITrackSelectorTool > m_trackSelectorTool_tau
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_largeD0TracksInputContainer
Gaudi::Property< double > m_maxJetDr_wide
Gaudi::Property< float > m_z0maxDelta
virtual StatusCode executeTrackFinder(xAOD::TauJet &pTau, xAOD::TauTrackContainer &tauTrackCon) const override
Gaudi::Property< bool > m_applyZ0cut
Gaudi::Property< double > m_maxJetDr_tau
Gaudi::Property< bool > m_bypassExtrapolator
Gaudi::Property< bool > m_useGhostTracks
void removeOffsideTracksWrtLeadTrk(const EventContext &ctx, std::vector< const xAOD::TrackParticle * > &tauTracks, std::vector< const xAOD::TrackParticle * > &wideTracks, std::vector< const xAOD::TrackParticle * > &otherTracks, const xAOD::Vertex *tauOrigin, double maxDeltaZ0) const
TauTrackFinder(const std::string &name)
Constructor and Destructor.
ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtensionTool
tools
float getZ0(const EventContext &ctx, const xAOD::TrackParticle *track, const xAOD::Vertex *vertex) const
Some internally used functions.
Gaudi::Property< bool > m_removeDuplicateCoreTracks
bool isLargeD0Track(const xAOD::TrackParticle *track) const
ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool
Helper method to sort tracks.
Tracking class to hold the extrapolation through calorimeter Layers Both the caloEntryLayerIntersecti...
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
helper class to encode and decode a TrackParametersIdentifier
bool isEntryToVolume(TrackParametersIdentifier id) const
returns true if the id belongs to the volume entrance
CaloSampling::CaloSample caloSample(TrackParametersIdentifier id) const
CaloSample encoded in id, returns CaloSampling::Unknown if id is not valid.
std::vector< const T * > getAssociatedObjects(const std::string &name) const
get associated objects as a vector<object> this compact form throws an exception if the object is not...
virtual FourMom_t p4() const
The full 4-momentum of the particle.
const TauTrack * track(size_t i, TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged, int *container_index=0) const
Get the pointer to a given tauTrack associated with this tau /*container index needed by trackNonCons...
void setDetail(TauJetParameters::Detail detail, int value)
const Vertex * vertex() const
size_t nAllTracks() const
const TauTrackLinks_t & allTauTrackLinks() const
void addTauTrackLink(const ElementLink< TauTrackContainer > &tr)
add a TauTrack to the tau
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
void setDetail(TauJetParameters::TrackDetail detail, float value)
const TrackParticle * track() const
virtual double m() const override final
The invariant mass of the particle..
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .).
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float charge() const
Returns the charge.
void setCovariancePosition(const AmgSymMatrix(3)&covariancePosition)
Sets the vertex covariance matrix.
void setZ(float value)
Sets the z position.
void setX(float value)
Sets the x position.
void setY(float value)
Sets the y position.
void setPosition(const Amg::Vector3D &position)
Sets the 3-position.
VxType::VertexType vertexType() const
The type of the vertex.
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
Jet_v1 Jet
Definition of the current "jet version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
TauTrack_v1 TauTrack
Definition of the current version.
TauJet_v3 TauJet
Definition of the current "tau version".
@ JetConstitScaleMomentum
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
TauTrackContainer_v1 TauTrackContainer
Definition of the current TauTrack container version.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
@ SiSpacePointsSeedMaker_LargeD0
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.