Main method called for each event.
90 {
91
92
94
95 SG::WriteDecorHandle<xAOD::EventInfo, int> PV_count(
m_OrigPVNTracks, ctx);
97 if(!PV_count.isAvailable()) PV_count(0) = vertices->size();
98
100 SG::WriteDecorHandle<xAOD::EventInfo, int> PV0_count(
m_OrigNtype0, ctx);
101 SG::WriteDecorHandle<xAOD::EventInfo, int> PV1_count(
m_OrigNtype1, ctx);
102 SG::WriteDecorHandle<xAOD::EventInfo, int> PV2_count(
m_OrigNtype2, ctx);
103 SG::WriteDecorHandle<xAOD::EventInfo, int> PV3_count(
m_OrigNtype3, ctx);
105
106
107 constexpr int nvtypes = 5;
108 int nvtc[] = {0, 0, 0, 0, 0};
109 for (auto vtx : *vertices) {
111 if ( vt >=0 && vt < nvtypes ) {
113 } else {
114 nvtc[nvtypes-1]++;
115 }
116 }
117 if(!PV0_count.isAvailable()) PV0_count(0) = nvtc[0];
118 if(!PV1_count.isAvailable()) PV1_count(0) = nvtc[1];
119 if(!PV2_count.isAvailable()) PV2_count(0) = nvtc[2];
120 if(!PV3_count.isAvailable()) PV3_count(0) = nvtc[3];
121 if(!PVUnk_count.isAvailable()) PVUnk_count(0) = nvtc[4];
122 }
123
124
125
127 SG::WriteDecorHandle<xAOD::VertexContainer, int> d_nPVTracks(
m_d_nPVTracks, ctx);
128 if(!d_nPVTracks.isAvailable()){
129 for (auto vtx : *vertices) {
130 d_nPVTracks(*vtx) = (
int)vtx->nTrackParticles();
131 }
132 }
133 }
134
135
136
138 SG::WriteDecorHandle<xAOD::VertexContainer, float> d_pvSqrtPt2Sum(
m_OrigSqrtPt2Sum, ctx);
139 if(!d_pvSqrtPt2Sum.isAvailable()){
140 for (auto vtx : *vertices) {
141 float sqrtPt2Sum(0.);
142 for (auto tp : vtx->trackParticleLinks()) {
143 sqrtPt2Sum += std::sqrt(
pow((*tp)->pt(),2));
144 }
145 d_pvSqrtPt2Sum(*vtx) = sqrtPt2Sum;
146 }
147 }
148 }
149 }
150
154 if(!track_count.isAvailable()) track_count(0) = tracks->size();
155 }
159 if(!track_count.isAvailable()) track_count(0) = tracks->size();
160 }
161
162 return StatusCode::SUCCESS;
163 }
constexpr int pow(int base, int exp) noexcept
SG::WriteDecorHandleKey< xAOD::EventInfo > m_OrigPVNTracks
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_d_nPVTracks
SG::WriteDecorHandleKey< xAOD::EventInfo > m_OrigNTracksKeys
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_OrigSqrtPt2Sum
SG::WriteDecorHandleKey< xAOD::EventInfo > m_OrigNtypeUnknown
SG::WriteDecorHandleKey< xAOD::EventInfo > m_OrigNtype0
SG::WriteDecorHandleKey< xAOD::EventInfo > m_OrigNtype3
SG::WriteDecorHandleKey< xAOD::EventInfo > m_OrigNTracksLRTKeys
SG::WriteDecorHandleKey< xAOD::EventInfo > m_OrigNtype1
SG::WriteDecorHandleKey< xAOD::EventInfo > m_OrigNtype2