15#include "AthLinks/ElementLink.h"
30 declareInterface<IVertexFinder>(
this);
37 StatusCode
sc = AthAlgTool::initialize();
39 ATH_MSG_FATAL(
"Unable to initialize InDetConversionFinderTools");
40 return StatusCode::FAILURE;
45 return StatusCode::FAILURE;
52 return StatusCode::FAILURE;
59 return StatusCode::FAILURE;
66 return StatusCode::FAILURE;
73 return StatusCode::FAILURE;
80 return StatusCode::FAILURE;
85 return StatusCode::SUCCESS;
90 return StatusCode::SUCCESS;
94 std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
99 ATH_MSG_ERROR(
"Using Track Container not currently supported returning an empty conatiner");
104 InDetConversionContainer->setStore( InDetConversionContainerAux );
106 return std::make_pair(InDetConversionContainer,InDetConversionContainerAux);
110 std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
119 InDetConversionContainer->setStore(InDetConversionContainerAux);
121 int numConversions = 0;
129 std::vector<const xAOD::TrackParticle*> negSelectedTracks;
130 negSelectedTracks.clear();
131 std::vector<const xAOD::TrackParticle*> posSelectedTracks;
132 posSelectedTracks.clear();
133 std::vector<int> negIndx;
134 std::vector<int> posIndx;
139 for (iter = (*trk_coll).begin(); iter != (*trk_coll).end(); ++iter) {
144 if ((*iter)->charge() < 0) {
145 negSelectedTracks.push_back(*iter);
146 negIndx.push_back(0);
148 posSelectedTracks.push_back(*iter);
149 posIndx.push_back(0);
156 std::vector<const xAOD::TrackParticle*>::const_iterator iter_pos;
157 std::vector<const xAOD::TrackParticle*>::const_iterator iter_neg;
158 std::vector<Amg::Vector3D> positionList;
159 positionList.clear();
160 std::vector<const xAOD::TrackParticle*> trackParticleList;
161 trackParticleList.clear();
162 std::vector<const xAOD::TrackParticle*> singleTrackConvList;
163 singleTrackConvList.clear();
167 for (iter_pos = posSelectedTracks.begin();
168 iter_pos != posSelectedTracks.end();
173 for (iter_neg = negSelectedTracks.begin();
174 iter_neg != negSelectedTracks.end();
179 std::map<std::string, float> intersectionDecors;
186 intersectionDecors)) {
187 positionList.clear();
192 if (positionList.size() < 2) {
194 positionList.clear();
198 trackParticleList.push_back(*iter_pos);
199 trackParticleList.push_back(*iter_neg);
201 std::unique_ptr<xAOD::Vertex> myVertex =
203 trackParticleList.clear();
210 myVertex.get(), flag, positionList)) ||
213 myVertex.get(), flag, positionList,
type))) {
217 myVertex->clearTracks();
230 "Decorating vertex with values used in track pair selector");
231 for (
const auto& kv :
234 acc (*myVertex) = kv.second;
236 ATH_MSG_DEBUG(
"Decorating vertex with values used in vertex "
238 for (
const auto& kv : intersectionDecors) {
240 acc (*myVertex) = kv.second;
250 myVertex->addTrackAtVertex(newLinkPos);
251 myVertex->addTrackAtVertex(newLinkNeg);
257 InDetConversionContainer->
push_back(std::move(myVertex));
261 InDetConversionContainer->
push_back(std::move(myVertex));
270 ATH_MSG_DEBUG(
"VxCandidate failed the post selection cuts!");
276 positionList.clear();
279 ATH_MSG_DEBUG(
"Number of conversions found passing post selection cuts: "
284 for (
int ip = 0; ip < int(posIndx.size()); ++ip) {
285 if (posIndx[ip] == 0)
286 singleTrackConvList.push_back(posSelectedTracks[ip]);
288 for (
int in = 0; in < int(negIndx.size()); ++in) {
289 if (negIndx[in] == 0)
290 singleTrackConvList.push_back(negSelectedTracks[in]);
293 std::vector<const xAOD::TrackParticle*>::iterator itk;
294 std::vector<const xAOD::TrackParticle*>::iterator itke = singleTrackConvList.end();
296 for (itk = singleTrackConvList.begin(); itk != itke; ++itk) {
298 ATH_MSG_DEBUG(
"Track failed single track conversion selection");
302 (*itk), InDetConversionContainer);
313 ATH_MSG_DEBUG(
"Decorating single track vertex with dummy values "
314 "used in track pair selector");
320 ATH_MSG_DEBUG(
"Decorating single track vertex with dummy values "
321 "used in vertex point estimator");
327 ATH_MSG_DEBUG(
"Decorating single track vertex with dummy values "
328 "used in post selector");
334 ATH_MSG_DEBUG(
"Number successful reconstructed single track conversion: "
338 return std::make_pair(InDetConversionContainer,
339 InDetConversionContainerAux);
347 std::vector<Amg::Vector3D>& trackList,
350 std::map<std::string, float>& intersectionDecors)
const
372 if(nclusNeg>0 && nclusPos>0) flag= 0;
373 if((nclusNeg>0 && nclusPos==0) || (nclusNeg==0 && nclusPos>0)) flag = 1;
374 if(nclusNeg==0 && nclusPos==0) flag = 2;
375 if(
m_removeTrt && (flag==1 || flag==2))
return false;
384 &perPos, &perNeg, flag, errorcode, intersectionDecors));
388 double d_alpha = (startingPoint.adjoint()*v_direction)[0]/(startingPoint.mag()*v_direction.mag());
391 initPos = startingPoint;
392 double startingPointR = startingPoint.perp();
393 if(startingPointR<800.) {
410 ATH_MSG_WARNING(
"Track Particle does not contain first Measurement track parameters");
424 ATH_MSG_WARNING(
"Track Particle does not contain first Measurement track parameters");
430 double posR = trkPar_pos.
position().perp();
431 double negR = trkPar_neg.
position().perp();
432 double diffR = 1000.;
433 if((startingPointR-posR)<(startingPointR-negR)) diffR = startingPointR-posR;
434 else diffR = startingPointR-negR;
436 if(diffR<m_mindR || diffR>
m_maxdR)
return false;
443 trackList.push_back(trkPar_pos.
position());
444 trackList.push_back(trkPar_neg.
position());
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_FATAL(x,...)
Helper class to provide type-safe access to aux data.
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
DataModel_detail::const_iterator< DataVector > const_iterator
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ElementLink implementation for ROOT usage.
bool toContainedElement(BaseConstReference container, ElementType element)
Set link to point to given element (slowest).
static void decorateVertex(xAOD::Vertex &vertex, float inv_mass, float pt1, float pt2, float fR, float deltaPhiVtxTrk)
Decorate vertices with values used in post selector.
static std::vector< std::string > decorKeys()
Return list of keys used for decorations.
Helper class to provide type-safe access to aux data.
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
const Trk::CurvilinearParameters curvilinearParameters(unsigned int index) const
Returns a curvilinear representation of the parameters at 'index'.
xAOD::ParameterPosition parameterPosition(unsigned int index) const
Return the ParameterPosition of the parameters at 'index'.
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
size_t numberOfParameters() const
Returns the number of additional parameters stored in the TrackParticle.
void clearTracks()
Remove all tracks from the vertex.
void addTrackAtVertex(const ElementLink< TrackParticleContainer > &tr, float weight=1.0)
Add a new track to the vertex.
void setVertexType(VxType::VertexType vType)
Set the type of the vertex.
Eigen::Matrix< double, 3, 1 > Vector3D
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
@ V0Vtx
Vertex from V0 decay.
@ ConvVtx
Conversion vertex.
VertexAuxContainer_v1 VertexAuxContainer
Definition of the current jet auxiliary container.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ FirstMeasurement
Parameter defined at the position of the 1st measurement.