57 {
59 ATH_MSG_FATAL(
"Incorrect number of Psi daughters (should be 3 or 4)");
60 return StatusCode::FAILURE;
61 }
62
63 constexpr int topoN = 3;
66 return StatusCode::FAILURE;
67 }
68 std::array<SG::WriteHandle<xAOD::VertexContainer>, topoN> VtxWriteHandles; int ikey(0);
70 VtxWriteHandles[ikey] = SG::WriteHandle<xAOD::VertexContainer>(key, ctx);
71 ATH_CHECK( VtxWriteHandles[ikey].record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()) );
72 ikey++;
73 }
74
75
76
77
80 if (pvContainer.cptr()->size()==0) {
81 ATH_MSG_WARNING(
"You have no primary vertices: " << pvContainer.cptr()->size());
82 return StatusCode::RECOVERABLE;
83 }
84
85
86
87
88 SG::WriteHandle<xAOD::VertexContainer> refPvContainer;
91 ATH_CHECK( refPvContainer.
record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()) );
92 }
93
94 std::vector<Trk::VxCascadeInfo*> cascadeinfoContainer;
95 std::vector<Trk::VxCascadeInfo*> cascadeinfoContainer_noConstr;
97
102
103
104 SG::AuxElement::Decorator<VertexLinkVector> CascadeLinksDecor("CascadeVertexLinks");
105 SG::AuxElement::Decorator<VertexLinkVector> PsiLinksDecor("PsiVertexLinks");
106 SG::AuxElement::Decorator<VertexLinkVector> JpsiLinksDecor("JpsiVertexLinks");
107 SG::AuxElement::Decorator<float> chi2_decor("ChiSquared");
108 SG::AuxElement::Decorator<int> ndof_decor("nDoF");
109 SG::AuxElement::Decorator<float> chi2_nc_decor("ChiSquared_nc");
110 SG::AuxElement::Decorator<int> ndof_nc_decor("nDoF_nc");
111 SG::AuxElement::Decorator<float> Pt_decor("Pt");
112 SG::AuxElement::Decorator<float> PtErr_decor("PtErr");
113 SG::AuxElement::Decorator<float> chi2_SV1_decor("ChiSquared_SV1");
114 SG::AuxElement::Decorator<float> chi2_nc_SV1_decor("ChiSquared_nc_SV1");
115 SG::AuxElement::Decorator<float> chi2_V1_decor("ChiSquared_V1");
116 SG::AuxElement::Decorator<int> ndof_V1_decor("nDoF_V1");
117 SG::AuxElement::Decorator<float> lxy_SV1_decor("lxy_SV1");
118 SG::AuxElement::Decorator<float> lxyErr_SV1_decor("lxyErr_SV1");
119 SG::AuxElement::Decorator<float> a0xy_SV1_decor("a0xy_SV1");
120 SG::AuxElement::Decorator<float> a0xyErr_SV1_decor("a0xyErr_SV1");
121 SG::AuxElement::Decorator<float> a0z_SV1_decor("a0z_SV1");
122 SG::AuxElement::Decorator<float> a0zErr_SV1_decor("a0zErr_SV1");
123 SG::AuxElement::Decorator<float> chi2_SV2_decor("ChiSquared_SV2");
124 SG::AuxElement::Decorator<float> chi2_nc_SV2_decor("ChiSquared_nc_SV2");
125 SG::AuxElement::Decorator<float> chi2_V2_decor("ChiSquared_V2");
126 SG::AuxElement::Decorator<int> ndof_V2_decor("nDoF_V2");
127 SG::AuxElement::Decorator<float> lxy_SV2_decor("lxy_SV2");
128 SG::AuxElement::Decorator<float> lxyErr_SV2_decor("lxyErr_SV2");
129 SG::AuxElement::Decorator<float> a0xy_SV2_decor("a0xy_SV2");
130 SG::AuxElement::Decorator<float> a0xyErr_SV2_decor("a0xyErr_SV2");
131 SG::AuxElement::Decorator<float> a0z_SV2_decor("a0z_SV2");
132 SG::AuxElement::Decorator<float> a0zErr_SV2_decor("a0zErr_SV2");
133
134
139
140 for(
size_t ic=0;
ic<cascadeinfoContainer.size();
ic++) {
141 Trk::VxCascadeInfo* cascade_info = cascadeinfoContainer[
ic];
142 if(cascade_info==nullptr) {
144 continue;
145 }
146
147 Trk::VxCascadeInfo* cascade_info_noConstr = cascadeinfoContainer_noConstr[
ic];
148
149 const std::vector<xAOD::Vertex*> &cascadeVertices = cascade_info->
vertices();
150 if(cascadeVertices.size() != topoN)
ATH_MSG_ERROR(
"Incorrect number of vertices");
151 if(cascadeVertices[0]==
nullptr || cascadeVertices[1]==
nullptr || cascadeVertices[2]==
nullptr)
ATH_MSG_ERROR(
"Error null vertex");
152
153 for(
int i=0;
i<topoN;
i++) VtxWriteHandles[i].
ptr()->push_back(cascadeVertices[i]);
154
156 const auto mainVertex = cascadeVertices[2];
157 const std::vector< std::vector<TLorentzVector> > &moms = cascade_info->
getParticleMoms();
158
159
160 std::vector<VertexLink> precedingVertexLinks;
164 if( vertexLink1.
isValid() ) precedingVertexLinks.push_back( vertexLink1 );
168 if( vertexLink2.
isValid() ) precedingVertexLinks.push_back( vertexLink2 );
169 CascadeLinksDecor(*mainVertex) = precedingVertexLinks;
170
171
173
177
178
179 std::vector<const xAOD::Vertex*> jpsiVerticestoLink;
180 if(jpsiVertex) jpsiVerticestoLink.push_back(jpsiVertex);
183
184 std::vector<const xAOD::Vertex*> psiVerticestoLink;
185 if(psiVertex) psiVerticestoLink.push_back(psiVertex);
188
189 xAOD::BPhysHypoHelper vtx(
m_hypoName, mainVertex);
190
191
193 vtx.setPass(true);
194
195
196
197
198
199
202
205
206 chi2_decor(*mainVertex) = cascade_info->
fitChi2();
207 ndof_decor(*mainVertex) = cascade_info->
nDoF();
208 chi2_nc_decor(*mainVertex) = cascade_info_noConstr ? cascade_info_noConstr->
fitChi2() : -999999.;
209 ndof_nc_decor(*mainVertex) = cascade_info_noConstr ? cascade_info_noConstr->
nDoF() : -1;
210
211
212 chi2_SV1_decor(*cascadeVertices[0]) =
m_V0Tools->chisq(cascadeVertices[0]);
213 chi2_nc_SV1_decor(*cascadeVertices[0]) = cascade_info_noConstr ?
m_V0Tools->chisq(cascade_info_noConstr->
vertices()[0]) : -999999.;
214 chi2_V1_decor(*cascadeVertices[0]) =
m_V0Tools->chisq(psiVertex);
215 ndof_V1_decor(*cascadeVertices[0]) =
m_V0Tools->ndof(psiVertex);
216 lxy_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->lxy(moms[0],cascadeVertices[0],mainVertex);
217 lxyErr_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->lxyError(moms[0],cascade_info->
getCovariance()[0],cascadeVertices[0],mainVertex);
218 a0z_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0z(moms[0],cascadeVertices[0],mainVertex);
219 a0zErr_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0zError(moms[0],cascade_info->
getCovariance()[0],cascadeVertices[0],mainVertex);
220 a0xy_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0xy(moms[0],cascadeVertices[0],mainVertex);
221 a0xyErr_SV1_decor(*cascadeVertices[0]) =
m_CascadeTools->a0xyError(moms[0],cascade_info->
getCovariance()[0],cascadeVertices[0],mainVertex);
222
223
224 chi2_SV2_decor(*cascadeVertices[1]) =
m_V0Tools->chisq(cascadeVertices[1]);
225 chi2_nc_SV2_decor(*cascadeVertices[1]) = cascade_info_noConstr ?
m_V0Tools->chisq(cascade_info_noConstr->
vertices()[1]) : -999999.;
226 chi2_V2_decor(*cascadeVertices[1]) =
m_V0Tools->chisq(jpsiVertex);
227 ndof_V2_decor(*cascadeVertices[1]) =
m_V0Tools->ndof(jpsiVertex);
228 lxy_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->lxy(moms[1],cascadeVertices[1],mainVertex);
229 lxyErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->lxyError(moms[1],cascade_info->
getCovariance()[1],cascadeVertices[1],mainVertex);
230 a0z_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0z(moms[1],cascadeVertices[1],mainVertex);
231 a0zErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0zError(moms[1],cascade_info->
getCovariance()[1],cascadeVertices[1],mainVertex);
232 a0xy_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0xy(moms[1],cascadeVertices[1],mainVertex);
233 a0xyErr_SV2_decor(*cascadeVertices[1]) =
m_CascadeTools->a0xyError(moms[1],cascade_info->
getCovariance()[1],cascadeVertices[1],mainVertex);
234
237 }
238
239
240
241 for (auto cascade_info : cascadeinfoContainer) delete cascade_info;
242 for (auto cascade_info_noConstr : cascadeinfoContainer_noConstr) delete cascade_info_noConstr;
243
244 return StatusCode::SUCCESS;
245 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_FATAL(x,...)
#define BPHYS_CHECK(EXP)
Useful CHECK macro.
StatusCode performSearch(std::vector< Trk::VxCascadeInfo * > *cascadeinfoContainer, std::vector< Trk::VxCascadeInfo * > *cascadeinfoContainer_noConstr, const EventContext &ctx) const
bool setElement(ElementType element)
Set link to point to an Element (slowest).
bool isValid() const
Check if the element can be found.
bool setStorableObject(BaseConstReference data, bool replace=false)
Set link storable to data object pointed by data (slower).
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
const std::vector< Amg::MatrixX > & getCovariance() const
const std::vector< std::vector< TLorentzVector > > & getParticleMoms() const
const std::vector< xAOD::Vertex * > & vertices() const
void setSVOwnership(bool Ownership)
ElementLink< xAOD::VertexContainer > VertexLink
Vertex_v1 Vertex
Define the latest version of the vertex class.