33 for (
const auto* vertex : *vertices) {
42std::pair<float, float>
54 float zCommon = 0.0, zCommonError = 0.0;
57 double beamPosZ = eventInfo->
beamPosZ();
60 if( beamPosSigmaZ == 0 )
63 zCommon = beamPosZ / beamPosSigmaZ / beamPosSigmaZ;
64 zCommonError = 1.0 / beamPosSigmaZ / beamPosSigmaZ;
80 if (HPV_errz(*
photon) == 0.0) {
84 zCommonError += 1.0 / HPV_errz(*
photon) / HPV_errz(*
photon);
86 if (!zvertex.isAvailable(*
egamma) || !errz.isAvailable(*
egamma)) {
89 if (errz(*
egamma) == 0.0) {
103 zCommon /= zCommonError;
104 zCommonError = 1.0 / sqrt(zCommonError);
107 return std::make_pair(zCommon, zCommonError);
125 std::string s = Form(
"pt%lu", i + 1);
127 return (
acc.withDefault(conversionVertex, 0) > convPtCut);
135 if (conversionVertex ==
nullptr)
139 for (
size_t i = 0; i < NumberOfTracks; ++i) {
158 v.SetPtEtaPhiM(tp->pt(), tp->eta(), tp->phi(), 0.);
163 for (
unsigned int i = 0; i < accParameterPX(*tp).size(); ++i) {
165 v.SetPxPyPzE(accParameterPX(*tp)[i], accParameterPY(*tp)[i], 0, 0);
176 const std::string& derivationPrefix )
184 if (useAux and
pt.isAvailable(*vertex) and
eta.isAvailable(*vertex) and
phi.isAvailable(*vertex)) {
186 if(!std::isnan(
pt(*vertex)) and !std::isnan(
eta(*vertex)) and !std::isnan(
phi(*vertex))){
187 v.SetPtEtaPhiM(
pt(*vertex),
eta(*vertex),
phi(*vertex), 0.0);
191 using namespace asg::msgUserCode;
193 <<
"NaN detected in Vertex decorations (pt, eta, phi) = "
194 <<
" (" <<
pt(*vertex) <<
", " <<
eta(*vertex) <<
", " <<
phi(*vertex) <<
")");
196 <<
"Recompute sum tracks 4-momenta from associated TrackParticles");
202 for (
size_t i = 0; i < vertex->nTrackParticles(); ++i) {
203 tp = vertex->trackParticle(i);
217 std::string pw = (power == 1) ?
"sumPt" : Form(
"sumPt%d", power);
219 if (useAux and
acc.isAvailable(*vertex))
225 for (
size_t i = 0; i < vertex->nTrackParticles(); ++i) {
226 tp = vertex->trackParticle(i);
230 pt +=
pow(tp->pt() / 1e3, power);
Scalar eta() const
pseudorapidity method
Helper class to provide constant type-safe access to aux data.
constexpr int pow(int base, int exp) noexcept
SG::ConstAccessor< T, ALLOC > ConstAccessor
SG::Accessor< T, ALLOC > Accessor
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 beamPosZ() const
Z coordinate of the beam spot position.
float beamPosSigmaZ() const
The length of the beam spot in the Z direction.
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
@ Photon
The object is a photon.
Amg::Vector3D momentumAtVertex(const xAOD::Photon *, bool debug=false)
return the momentum at the vertex (which can be 0)
std::size_t numberOfSiHits(const xAOD::TrackParticle *tp)
return the number of Si hits in the track particle
TLorentzVector getTrackAtFirstMeasurement(const xAOD::TrackParticle *tp)
Return track at first measurment, useful as proxy to conversion vertex pT.
const xAOD::Vertex * getHardestVertex(const xAOD::VertexContainer *vertices)
Return vertex with highest sum pT^2.
float getVertexSumPt(const xAOD::Vertex *vertex, int power=1, bool useAux=true)
Loop over track particles associated with vertex and return scalar sum of pT^power in GeV (from auxda...
TLorentzVector getVertexMomentum(const xAOD::Vertex *vertex, bool useAux=true, const std::string &derivationPrefix="")
Return vector sum of tracks associated with vertex (from auxdata if available and useAux = true)
bool passConvSelection(const xAOD::Photon *photon, float convPtCut=2e3)
Check if photon is converted, and tracks have Si hits and pass selection.
std::pair< float, float > getZCommonAndError(const xAOD::EventInfo *eventInfo, const xAOD::EgammaContainer *egammas, float convPtCut=2e3)
Return zCommon and zCommonError.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
setRcore setEtHad setFside pt
EventInfo_v1 EventInfo
Definition of the latest event info version.
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.
Egamma_v1 Egamma
Definition of the current "egamma version".
Photon_v1 Photon
Definition of the current "egamma version".
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
EgammaContainer_v1 EgammaContainer
Definition of the current "egamma container version".
@ FirstMeasurement
Parameter defined at the position of the 1st measurement.
Tell the compiler to optimize assuming that FP may trap.
#define CXXUTILS_TRAPPING_FP