87 {
89
90 std::vector<const xAOD::TrackParticle*> tmpp(particles);
93 if( tst != tmpp.end()) {
95 return {nullptr};
96 }
97
98 static const SG::ConstAccessor<float> vyAcc("vy");
99 bool fullxAOD=false; if(vyAcc.isAvailable(*particles[0])) fullxAOD=true;
100
102 BEAM.makePrivateStore();
104 std::vector<float> defaultCovar {0.015f*0.015f,0.f,0.015f*0.015f,0.f,0.f,1.e6};
106 float beamtiltX=0.;
107 float beamtiltY=0.;
109 beamcov.setIdentity();
110
112 BEAM.
setX(eventINFO->beamPosX());
113 BEAM.
setY(eventINFO->beamPosY());
114 BEAM.
setZ(eventINFO->beamPosZ());
115 beamcov(0,0) = eventINFO->beamPosSigmaX() * eventINFO->beamPosSigmaX();
116 beamcov(1,0) = beamcov(0,1) = eventINFO->beamPosSigmaXY();
117 beamcov(1,1) = eventINFO->beamPosSigmaY() * eventINFO->beamPosSigmaY();
118 beamcov(2,2) = eventINFO->beamPosSigmaZ() * eventINFO->beamPosSigmaZ()*1.e6;
120 beamtiltX= eventINFO->beamTiltXZ();
121 beamtiltY= eventINFO->beamTiltYZ();
122 }
123 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle {
m_beamSpotKey };
124
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);
133 }
140
141 const EventContext& ctx = Gaudi::Hive::currentContext();
142
143 if(fullxAOD){
144
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());
150 }
152 }
153
154
155
156
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() );
164 static const SG::ConstAccessor<float> vzAcc("vz");
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);
173 }
174
175
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());
181 }
183 }
#define AmgSymMatrix(dim)
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.
Vertex_v1 Vertex
Define the latest version of the vertex class.