 |
ATLAS Offline Software
|
Go to the documentation of this file.
18 ISvcLocator *pSvcLocator)
90 return StatusCode::SUCCESS;
95 const EventContext &ctx = Gaudi::Hive::currentContext();
130 std::map< const xAOD::Vertex*, std::vector<ElementLink<xAOD::JetContainer>> > jetsInVertex;
131 std::map< const xAOD::Jet*, std::map< const xAOD::Vertex*, int> > jetVertexPt;
135 jetsInVertex[
vertex] = {};
147 if( !jtrk )
continue;
149 if(jetTrackVertex) jetVertexPt[
jet][*jetTrackVertex] += jtrk->pt();
153 float maxPtFrac = -1;
157 if(jetVertexPt[
jet][
vertex] > maxPtFrac){
159 uniqueVertexAddress =
vertex;
167 jetsInVertex[uniqueVertexAddress].push_back(jetLink);
182 float weighted_sumDZ = 0;
183 float weighted_deltaZ = 0;
184 float weighted_modsumDZ = 0;
185 float weighted_z_asym = 0;
188 std::vector<float> track_deltaZ;
190 for (
size_t i = 0;
i <
vertex->nTrackParticles();
i++) {
194 if(!trackTmp)
continue;
197 track_deltaZ.push_back(
deltaZ);
199 float trk_weight =
vertex->trackWeight(
i);
200 weighted_deltaZ =
deltaZ * trk_weight;
203 modsumDZ += std::abs(
deltaZ);
204 weighted_sumDZ += weighted_deltaZ;
205 weighted_modsumDZ += std::abs(weighted_deltaZ);
209 z_asym = sumDZ / modsumDZ;
211 if (weighted_modsumDZ > 0) {
212 weighted_z_asym = weighted_sumDZ / weighted_modsumDZ;
215 float mean_Dz = sumDZ / track_deltaZ.size();
216 float number_tracks = track_deltaZ.size();
222 for (
auto i : track_deltaZ)
224 float z_zbar = (
i - mean_Dz);
229 if (number_tracks > 1 && z_var > 0) {
230 z_var /= (number_tracks - 1);
231 float z_sd = std::sqrt(z_var);
232 z_skew /= (number_tracks - 1) *
std::pow(z_sd, 3);
233 z_kurt /= (number_tracks - 1) *
std::pow(z_sd, 4);
242 dec_ntrk(*
vertex) = number_tracks;
248 dec_z_asym(*
vertex) = z_asym;
249 dec_weighted_z_asym(*
vertex) = weighted_z_asym;
250 dec_z_kurt(*
vertex) = z_kurt;
251 dec_z_skew(*
vertex) = z_skew;
255 if (std::isnan(acc_deltaZ(*
vertex))) {
257 dec_photon_deltaz(*
vertex) = 0;
264 dec_photon_deltaz(*
vertex) = 0;
267 if (std::isnan(acc_deltaPhi(*
vertex))) {
269 dec_photon_deltaPhi(*
vertex) = 0;
276 dec_photon_deltaPhi(*
vertex) = 0;
280 std::vector<ElementLink<xAOD::ElectronContainer>> electronLinks;
283 if(!id_trk)
continue;
285 if(!eleVertex)
continue;
290 electronLinks.push_back(elLink);
293 dec_electronLinks(*
vertex) = electronLinks;
295 std::vector<ElementLink<xAOD::PhotonContainer>> photonLinks;
300 photonLinks.push_back(phLink);
302 dec_photonLinks(*
vertex) = photonLinks;
307 std::vector<ElementLink<xAOD::MuonContainer>> muonLinks;
309 const auto *
tp =
muon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
313 if(!muonVertex)
continue;
315 if(*muonVertex ==
vertex){
318 muonLinks.push_back(muonLink);
321 ATH_MSG_DEBUG(
"Skipping muon as the track is not associated to any PV ");
326 dec_muonLinks(*
vertex) = muonLinks;
332 return StatusCode::SUCCESS;
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...
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonsInKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_caloPointingZKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_zCommonErrorKey
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
StatusCode initialize() override
SG::ReadHandleKey< xAOD::EventInfo > m_eventInKey
DataVector adapter that acts like it holds const pointers.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_photonLinksKey
float vz() const
The z origin for the parameters.
float z0() const
Returns the parameter.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_actualInterPerXing
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexInKey
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_ntrk
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
ToolHandle< GNNTool > m_gnnTool
ToolHandle< CP::TrackVertexAssociationTool > m_trkVtxAssociationTool
Handle class for reading a decoration on an object.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_sumPt
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_weighted_z_kurt
::StatusCode StatusCode
StatusCode definition for legacy code.
Handle class for adding a decoration to an object.
SG::ReadDecorHandleKey< xAOD::VertexContainer > m_deltaPhiKey
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_chi2Over_ndf
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ElementLink implementation for ROOT usage.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_photon_deltaPhi
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_z_asym
bool setElement(ElementType element)
Set to point to an element.
SG::ReadDecorHandleKey< xAOD::VertexContainer > m_deltaZKey
bool setStorableObject(BaseConstReference data, bool replace=false, IProxyDict *sg=0)
Set link to point to a new container (storable).
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_electronLinksKey
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_photon_deltaz
VertexDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_z_skew
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_weighted_z_asym
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
const xAOD::TrackParticle * getOriginalTrackParticle(const xAOD::Electron *el)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the electron.
SG::ReadHandleKey< xAOD::JetContainer > m_jetsInKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_zCommonKey
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_jetLinksKey
Class describing a TrackParticle.
StatusCode execute() override
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsInKey
constexpr int pow(int base, int exp) noexcept
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_muonLinksKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonsInKey
float actualInteractionsPerCrossing() const
Average interactions per crossing for the current BCID - for in-time pile-up.