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;
248 myVertex->addTrackAtVertex(newLinkPos);
249 myVertex->addTrackAtVertex(newLinkNeg);
255 InDetConversionContainer->
push_back(std::move(myVertex));
259 InDetConversionContainer->
push_back(std::move(myVertex));
268 ATH_MSG_DEBUG(
"VxCandidate failed the post selection cuts!");
274 positionList.clear();
277 ATH_MSG_DEBUG(
"Number of conversions found passing post selection cuts: "
282 for (
int ip = 0; ip < int(posIndx.size()); ++ip) {
283 if (posIndx[ip] == 0)
284 singleTrackConvList.push_back(posSelectedTracks[ip]);
286 for (
int in = 0; in < int(negIndx.size()); ++in) {
287 if (negIndx[in] == 0)
288 singleTrackConvList.push_back(negSelectedTracks[in]);
291 std::vector<const xAOD::TrackParticle*>::iterator itk;
292 std::vector<const xAOD::TrackParticle*>::iterator itke = singleTrackConvList.end();
294 for (itk = singleTrackConvList.begin(); itk != itke; ++itk) {
296 ATH_MSG_DEBUG(
"Track failed single track conversion selection");
300 (*itk), InDetConversionContainer);
311 ATH_MSG_DEBUG(
"Decorating single track vertex with dummy values "
312 "used in track pair selector");
318 ATH_MSG_DEBUG(
"Decorating single track vertex with dummy values "
319 "used in vertex point estimator");
325 ATH_MSG_DEBUG(
"Decorating single track vertex with dummy values "
326 "used in post selector");
332 ATH_MSG_DEBUG(
"Number successful reconstructed single track conversion: "
336 return std::make_pair(InDetConversionContainer,
337 InDetConversionContainerAux);
345 std::vector<Amg::Vector3D>& trackList,
348 std::map<std::string, float>& intersectionDecors)
const
370 if(nclusNeg>0 && nclusPos>0) flag= 0;
371 if((nclusNeg>0 && nclusPos==0) || (nclusNeg==0 && nclusPos>0)) flag = 1;
372 if(nclusNeg==0 && nclusPos==0) flag = 2;
373 if(
m_removeTrt && (flag==1 || flag==2))
return false;
382 &perPos, &perNeg, flag, errorcode, intersectionDecors));
386 double d_alpha = (startingPoint.adjoint()*v_direction)[0]/(startingPoint.mag()*v_direction.mag());
389 initPos = startingPoint;
390 double startingPointR = startingPoint.perp();
391 if(startingPointR<800.) {
408 ATH_MSG_WARNING(
"Track Particle does not contain first Measurement track parameters");
422 ATH_MSG_WARNING(
"Track Particle does not contain first Measurement track parameters");
428 double posR = trkPar_pos.
position().perp();
429 double negR = trkPar_neg.
position().perp();
430 double diffR = 1000.;
431 if((startingPointR-posR)<(startingPointR-negR)) diffR = startingPointR-posR;
432 else diffR = startingPointR-negR;
434 if(diffR<m_mindR || diffR>
m_maxdR)
return false;
441 trackList.push_back(trkPar_pos.
position());
442 trackList.push_back(trkPar_neg.
position());
#define ATH_MSG_WARNING(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 data, ElementType element, IProxyDict *sg=0)
Set from element pointer and a reference to the container (storable)
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.