86 {
88
89 std::vector<const xAOD::TrackParticle*> tmpp(particles);
92 if( tst != tmpp.end()) {
94 return {nullptr};
95 }
96
97 static const SG::ConstAccessor<float> vyAcc("vy");
98 bool fullxAOD=false; if(vyAcc.isAvailable(*particles[0])) fullxAOD=true;
99
103 std::vector<float> defaultCovar {0.015f*0.015f,0.f,0.015f*0.015f,0.f,0.f,1.e6};
105 float beamtiltX=0.;
106 float beamtiltY=0.;
108 beamcov.setIdentity();
109
111 BEAM.
setX(eventINFO->beamPosX());
112 BEAM.
setY(eventINFO->beamPosY());
113 BEAM.
setZ(eventINFO->beamPosZ());
114 beamcov(0,0) = eventINFO->beamPosSigmaX() * eventINFO->beamPosSigmaX();
115 beamcov(1,0) = beamcov(0,1) = eventINFO->beamPosSigmaXY();
116 beamcov(1,1) = eventINFO->beamPosSigmaY() * eventINFO->beamPosSigmaY();
117 beamcov(2,2) = eventINFO->beamPosSigmaZ() * eventINFO->beamPosSigmaZ()*1.e6;
119 beamtiltX= eventINFO->beamTiltXZ();
120 beamtiltY= eventINFO->beamTiltYZ();
121 }
122 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle {
m_beamSpotKey };
123
124 if(beamSpotHandle.
isValid() && fullxAOD ){
126 BEAM.
setPosition(beamSpotHandle->beamVtx().position());
127 beamcov = beamSpotHandle->beamVtx().covariancePosition();
128 beamcov(2,2) *= 1.e6;
130 beamtiltX= beamSpotHandle->beamTilt(0);
131 beamtiltY= beamSpotHandle->beamTilt(1);
132 }
139
140 const EventContext& ctx = Gaudi::Hive::currentContext();
141
142 if(fullxAOD){
143
144 if( beamtiltX!=0. || beamtiltY!=0.) {
145 std::unique_ptr<xAOD::Vertex> iniVertex =
m_fitterSvc->fit(ctx,particles,BEAM);
146 if(!iniVertex) return {nullptr};
147 BEAM.
setX(BEAM.
x()+beamtiltX*iniVertex->z());
148 BEAM.
setY(BEAM.
y()+beamtiltY*iniVertex->z());
149 }
150 return std::unique_ptr<xAOD::Vertex>(
m_fitterSvc->fit(ctx,particles,BEAM));
151 }
152
153
154
155
157 std::unique_ptr< SG::AuxStoreInternal > pAux;
159 std::vector<const xAOD::TrackParticle*> wrkTrkC(NPRT);
160 pAux = std::make_unique< SG::AuxStoreInternal >();
161 TPC.setStore( pAux.get() );
163 static const SG::ConstAccessor<float> vzAcc("vz");
164 for(
int i=0;
i<NPRT;
i++){
166 if(!TPC[i])return {nullptr};
167 const float mvx= (eventINFO) ? eventINFO->beamPosX() : 0.;
168 const float mvy= (eventINFO) ? eventINFO->beamPosY() : 0.;
169 const float mvz= (vzAcc.isAvailable(*particles[i])) ?
particles[
i]->vz() : 0.;
170 TPC[
i]->setParametersOrigin( mvx, mvy, mvz);
172 }
173
174
175 if( beamtiltX!=0. || beamtiltY!=0.) {
176 std::unique_ptr<xAOD::Vertex> iniVertex =
m_fitterSvc->fit(ctx,wrkTrkC,BEAM);
177 if(!iniVertex) return {nullptr};
178 BEAM.
setX(BEAM.
x()+beamtiltX*iniVertex->z());
179 BEAM.
setY(BEAM.
y()+beamtiltY*iniVertex->z());
180 }
181 return std::unique_ptr<xAOD::Vertex>(
m_fitterSvc->fit(ctx,wrkTrkC,BEAM));
182 }
#define AmgSymMatrix(dim)
void makePrivateStore()
Create a new (empty) private store for this object.
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.