15#include "GaudiKernel/EventContext.h"
19 const std::string& name,
20 const IInterface* parent):
23 declareInterface<ITrkToLeptonPV>(
this);
36 return StatusCode::FAILURE;
43 return StatusCode::SUCCESS;
49 return StatusCode::SUCCESS;
56 const EventContext& ctx = Gaudi::Hive::currentContext();
59 std::vector<const xAOD::TrackParticle *> tpv(1,trk);
64 if( !eventINFO )
return {
nullptr};
65 std::unique_ptr< SG::AuxStoreInternal > pAux;
67 std::vector<const xAOD::TrackParticle*> wrkTrkC(1);
68 pAux = std::make_unique< SG::AuxStoreInternal >();
69 TPC.setStore( pAux.get() );
72 if(!TPC[0])
return {
nullptr};
74 const float mvx= (eventINFO) ? eventINFO->
beamPosX() : 0.;
75 const float mvy= (eventINFO) ? eventINFO->
beamPosY() : 0.;
78 TPC[0]->setParametersOrigin( mvx, mvy, mvz);
88 if(particles.empty())
return {
nullptr};
90 std::vector<const xAOD::TrackParticle*> tmpp(particles);
93 if( tst != tmpp.end()) {
99 bool fullxAOD=
false;
if(vyAcc.
isAvailable(*particles[0])) fullxAOD=
true;
102 BEAM.makePrivateStore();
104 std::vector<float> defaultCovar {0.015f*0.015f,0.f,0.015f*0.015f,0.f,0.f,1.e6};
109 beamcov.setIdentity();
125 if(beamSpotHandle.
isValid() && fullxAOD ){
127 BEAM.
setPosition(beamSpotHandle->beamVtx().position());
128 beamcov = beamSpotHandle->beamVtx().covariancePosition();
129 beamcov(2,2) *= 1.e6;
131 beamtiltX= beamSpotHandle->beamTilt(0);
132 beamtiltY= beamSpotHandle->beamTilt(1);
141 const EventContext& ctx = Gaudi::Hive::currentContext();
145 if( beamtiltX!=0. || beamtiltY!=0.) {
146 std::unique_ptr<xAOD::Vertex> iniVertex =
m_fitterSvc->fit(ctx,particles,BEAM);
147 if(!iniVertex)
return {
nullptr};
148 BEAM.
setX(BEAM.
x()+beamtiltX*iniVertex->z());
149 BEAM.
setY(BEAM.
y()+beamtiltY*iniVertex->z());
157 int NPRT=particles.size();
158 std::unique_ptr< SG::AuxStoreInternal > pAux;
160 std::vector<const xAOD::TrackParticle*> wrkTrkC(NPRT);
161 pAux = std::make_unique< SG::AuxStoreInternal >();
162 TPC.setStore( pAux.get() );
165 for(
int i=0; i<NPRT; i++){
167 if(!TPC[i])
return {
nullptr};
168 const float mvx= (eventINFO) ? eventINFO->
beamPosX() : 0.;
169 const float mvy= (eventINFO) ? eventINFO->
beamPosY() : 0.;
170 const float mvz= (vzAcc.
isAvailable(*particles[i])) ? particles[i]->vz() : 0.;
171 TPC[i]->setParametersOrigin( mvx, mvy, mvz);
176 if( beamtiltX!=0. || beamtiltY!=0.) {
177 std::unique_ptr<xAOD::Vertex> iniVertex =
m_fitterSvc->fit(ctx,wrkTrkC,BEAM);
178 if(!iniVertex)
return {
nullptr};
179 BEAM.
setX(BEAM.
x()+beamtiltX*iniVertex->z());
180 BEAM.
setY(BEAM.
y()+beamtiltY*iniVertex->z());
#define ATH_CHECK
Evaluate an expression and check for errors.
An auxiliary data store that holds data internally.
Helper class to provide constant type-safe access to aux data.
#define AmgSymMatrix(dim)
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
float beamPosSigmaY() const
The width of the beam spot in the Y direction.
float beamPosX() const
X coordinate of the beam spot position.
float beamPosSigmaXY() const
The beam spot shape's X-Y correlation.
float beamTiltYZ() const
The beam's tilt in radians in YZ.
float beamPosSigmaX() const
The width of the beam spot in the X direction.
float beamPosZ() const
Z coordinate of the beam spot position.
float beamPosSigmaZ() const
The length of the beam spot in the Z direction.
float beamPosY() const
Y coordinate of the beam spot position.
float beamTiltXZ() const
The beam's tilt in radians in XZ.
float vz() const
The z origin for the parameters.
float z() const
Returns the z position.
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.
float y() const
Returns the y position.
void setCovariance(const std::vector< float > &value)
Sets the covariance matrix as a simple vector of values.
void setPosition(const Amg::Vector3D &position)
Sets the 3-position.
float x() const
Returns the x position.
const std::vector< float > & covariance() const
Returns the covariance matrix as a simple vector of values.
DataModel_detail::iterator< DVL > unique(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of unique for DataVector/List.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
EventInfo_v1 EventInfo
Definition of the latest event info version.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".