ATLAS Offline Software
Loading...
Searching...
No Matches
Analysis::JetSecVertexingAlg Class Reference

#include <JetSecVertexingAlg.h>

Inheritance diagram for Analysis::JetSecVertexingAlg:
Collaboration diagram for Analysis::JetSecVertexingAlg:

Public Member Functions

 JetSecVertexingAlg (const std::string &name, ISvcLocator *pSvcLocator)
 Constructors and destructors.
virtual ~JetSecVertexingAlg ()=default
virtual StatusCode initialize () override
 Main routines specific to an ATHENA algorithm.
virtual StatusCode execute (const EventContext &ctx) const override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

StatusCode createSecVkalContainer (xAOD::VertexContainer *, std::vector< ElementLink< xAOD::VertexContainer > > *, const Trk::VxSecVKalVertexInfo *) const
StatusCode createJFContainer (xAOD::BTagVertexContainer *, std::vector< ElementLink< xAOD::BTagVertexContainer > > *, const Trk::VxJetFitterVertexInfo *, const xAOD::TrackParticleContainer *) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::string m_secVertexFinderBaseName
SG::ReadHandleKey< xAOD::JetContainer > m_JetCollectionName {this, "JetCollectionName", "", "Input jet container"}
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackCollectionName {this, "TrackCollectionName", "", "Input track container"}
SG::ReadHandleKey< xAOD::VertexContainer > m_VertexCollectionName {this, "vxPrimaryCollectionName", "", "Input primary vertex container"}
SG::ReadHandleKey< Trk::VxSecVertexInfoContainer > m_VxSecVertexInfoName {this, "BTagVxSecVertexInfoName", "", "Input VxSecVertexInfo container"}
SG::WriteHandleKey< xAOD::VertexContainer > m_BTagSVCollectionName {this, "BTagSVCollectionName", "", "Output BTagging secondary vertex container"}
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetSVLinkName { this, "JetSecVtxLinkName", "", "Element Link vector from jet to Vertex container"}
SG::WriteHandleKey< xAOD::BTagVertexContainer > m_BTagJFVtxCollectionName {this, "BTagJFVtxCollectionName", "", "Output BTagging Jet Fitter container"}
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 40 of file JetSecVertexingAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ JetSecVertexingAlg()

Analysis::JetSecVertexingAlg::JetSecVertexingAlg ( const std::string & name,
ISvcLocator * pSvcLocator )

Constructors and destructors.

Definition at line 31 of file JetSecVertexingAlg.cxx.

31 :
32 AthReentrantAlgorithm(name,pSvcLocator)
33 {
34 declareProperty("SecVtxFinderxAODBaseName", m_secVertexFinderBaseName);
35 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~JetSecVertexingAlg()

virtual Analysis::JetSecVertexingAlg::~JetSecVertexingAlg ( )
virtualdefault

Member Function Documentation

◆ createJFContainer()

StatusCode Analysis::JetSecVertexingAlg::createJFContainer ( xAOD::BTagVertexContainer * bTagJFVertexContainer,
std::vector< ElementLink< xAOD::BTagVertexContainer > > * JFVerticesLinks,
const Trk::VxJetFitterVertexInfo * myVertexInfoJetFitter,
const xAOD::TrackParticleContainer * theTrackParticleContainer ) const
private

found map

Definition at line 192 of file JetSecVertexingAlg.cxx.

195 {
196
197 //list of JFvertices
198 const std::vector<Trk::VxJetCandidate*>& JFvertices = myVertexInfoJetFitter->verticesJF();
199
200 int nVtx = 0;
201 if (!JFvertices.empty()) {
202 Trk::VxJetCandidate* vxjetcand = dynamic_cast< Trk::VxJetCandidate*>(JFvertices[0]);
203 if (!vxjetcand) {
204 ATH_MSG_WARNING("#BTAG# bad VxCandidate is not a VxJetCandidate");
205 return StatusCode::SUCCESS;
206 }
207
208 //compatibility with others SV
209 const Trk::VxClusteringTable* ClusteringTable = vxjetcand->getClusteringTable();
210 typedef std::map<Trk::VxVertexOnJetAxis*, std::vector<std::pair<Trk::VxVertexOnJetAxis*,float> > > map2vtx;
211 map2vtx inverseCompMap;
212
213 if (ClusteringTable !=nullptr) {
214 const std::map<float,Trk::PairOfVxVertexOnJetAxis>& mapPairVtxOnJetAxis = ClusteringTable->getCompatibilityPairOfVertices();
215 std::map<float,Trk::PairOfVxVertexOnJetAxis>::const_iterator mapiter = mapPairVtxOnJetAxis.begin();
216 for(;mapiter != mapPairVtxOnJetAxis.end(); ++mapiter){
217
218 Trk::VxVertexOnJetAxis* vtx1 = mapiter->second.first;
219 Trk::VxVertexOnJetAxis* vtx2 = mapiter->second.second;
220 float comp = mapiter->first;
221
222 std::pair<Trk::VxVertexOnJetAxis*,float> pair1(vtx1, comp);
223 std::pair<Trk::VxVertexOnJetAxis*,float> pair2(vtx1, comp);
224
225 inverseCompMap[vtx1].push_back(pair2);
226 inverseCompMap[vtx2].push_back(pair1);
227
228 }
229 }
230
231 //vtx on jet axis
232 const std::vector<Trk::VxVertexOnJetAxis*> Vtxonjetaxes = vxjetcand->getVerticesOnJetAxis();
233 ATH_MSG_DEBUG("#BTAG# VerticesOnJetAxis of VxJetCandidate size: " << Vtxonjetaxes.size());
234 std::vector<Trk::VxVertexOnJetAxis*>::const_iterator iterBegin = Vtxonjetaxes.begin();
235 std::vector<Trk::VxVertexOnJetAxis*>::const_iterator iterEnd = Vtxonjetaxes.end();
236 float comptoPV(0.);
237 double chi2(0.);
238 int ndf(0);
239 nVtx = Vtxonjetaxes.size();
240 std::map<Trk::VxVertexOnJetAxis*, ElementLink< xAOD::BTagVertexContainer> > oldnewmap;
241
242 for (std::vector<Trk::VxVertexOnJetAxis*>::const_iterator it=iterBegin; it!=iterEnd; ++it) {
243 //ndf, chi2 , comptoPV
244 const Trk::FitQuality& fitquality = (*it)->fitQuality();
245 chi2 = fitquality.chiSquared();
246 ndf = fitquality.numberDoF();
247 comptoPV = (*it)->getCompatibilityToPrimaryVtx();
248 const std::vector<Trk::VxTrackAtVertex*> & trackatVtx = (*it)->getTracksAtVertex();
249 std::vector<Trk::VxTrackAtVertex*>::const_iterator itrBegin = trackatVtx.begin();
250 std::vector<Trk::VxTrackAtVertex*>::const_iterator itrEnd = trackatVtx.end();
251 std::vector< float> tmpchi2;
252 std::vector< float> tmpndf;
253 std::vector< ElementLink< xAOD::TrackParticleContainer > > trkLinks;
254 std::vector< float> tmpRefPx;
255 std::vector< float> tmpRefPy;
256 std::vector< float> tmpRefPz;
257
258 //loop in trks
259 for (std::vector<Trk::VxTrackAtVertex*>::const_iterator itr=itrBegin; itr!=itrEnd; ++itr) {
260 //ndf, chi2
261 const Trk::FitQuality& trkquality = (*itr)->trackQuality();
262 double tpchi2 = trkquality.chiSquared();
263 int tpndf = trkquality.numberDoF();
264 tmpchi2.push_back(float(tpchi2));
265 tmpndf.push_back(float(tpndf));
266 //tracks links
267 Trk::ITrackLink* trklinks = (*itr)->trackOrParticleLink();
268 const Trk::LinkToXAODTrackParticle* trkLinkTPxAOD=dynamic_cast<const Trk::LinkToXAODTrackParticle *>(trklinks);
269 if (!trkLinkTPxAOD) {
270 ATH_MSG_WARNING("#BTAG# bad ITrackLink is not a LinkToXAODTrackParticle");
271 continue;
272 }
273 const xAOD::TrackParticle* myTrklink = **trkLinkTPxAOD;
274 ElementLink<xAOD::TrackParticleContainer> tpel;
275
276 tpel.toContainedElement(*theTrackParticleContainer, myTrklink);
277 trkLinks.push_back(tpel);
278
279 //reffited momentum
280 const Trk::TrackParameters* trkperigee = (*itr)->perigeeAtVertex();
281 Amg::Vector3D mytrack = trkperigee->momentum();
282 tmpRefPx.push_back(mytrack.x());
283 tmpRefPy.push_back(mytrack.y());
284 tmpRefPz.push_back(mytrack.z());
285
286 }
287
288 xAOD::BTagVertex* newbtagVtx = new xAOD::BTagVertex();
289 bTagJFVertexContainer->push_back(newbtagVtx);
290
291 newbtagVtx->setNDF(ndf);
292 newbtagVtx->setChi2(chi2);
293 newbtagVtx->setPV_compatibility(comptoPV);
294 newbtagVtx->setTrack_chi2(tmpchi2);
295 newbtagVtx->setTrack_NDF(tmpndf);
296 newbtagVtx->setTrack_links(trkLinks);
297 newbtagVtx->setTrack_refPx(tmpRefPx);
298 newbtagVtx->setTrack_refPy(tmpRefPy);
299 newbtagVtx->setTrack_refPz(tmpRefPz);
300
302 linkBTagVertex.toContainedElement(*bTagJFVertexContainer, newbtagVtx);
303 JFVerticesLinks->push_back(linkBTagVertex);
304 oldnewmap.insert(std::make_pair(*it,linkBTagVertex));
305 }
306
307 if(ClusteringTable !=nullptr){
308 for (std::vector<Trk::VxVertexOnJetAxis*>::const_iterator it=iterBegin; it!=iterEnd; ++it) {
309 std::vector< ElementLink< xAOD::BTagVertexContainer > > JFCompLinks;
310 std::vector<float> JFCompValues;
311
312 bool foundmap=true;
313 map2vtx::iterator itmap = inverseCompMap.find(*it);
314 if(itmap == inverseCompMap.end()){
315 ATH_MSG_DEBUG("#BTAG# JF compatibility value in map2vtx map not found ");
316 foundmap=false;
317 }
318
319 if(foundmap){
320
321 std::vector<std::pair<Trk::VxVertexOnJetAxis*,float> > tmpvectpair = itmap->second;
322
323 for(auto & icomppair : tmpvectpair){
324 std::map<Trk::VxVertexOnJetAxis*, ElementLink< xAOD::BTagVertexContainer> >::iterator JFOlNewIter = oldnewmap.find(icomppair.first);
325
326 if(JFOlNewIter == oldnewmap.end()){
327 ATH_MSG_DEBUG("#BTAG# JF compatibility vector not found ");
328 continue;
329 }
330
331 JFCompLinks.push_back(JFOlNewIter->second);
332 JFCompValues.push_back(icomppair.second);
333 }
334 }
335 }
336 }
337
338 const Trk::RecVertexPositions& recVtxposition = vxjetcand->getRecVertexPositions();
339 const Amg::VectorX& vtxPositions = recVtxposition.position();
340 const Amg::MatrixX& vtxCovMatrix = recVtxposition.covariancePosition();
341 ATH_MSG_DEBUG("#BTAGJF# size vtxPosition "<<vtxPositions.size());
342 std::vector< float > fittedPosition = std::vector<float>(nVtx+5,-1);
343 std::vector< float > fittedCov = std::vector<float>(nVtx+5,-1); //only store the diagonal terms
344 if (fittedPosition.size() < 5) std::abort(); // suppress cppcheck warnings
345 if(vtxPositions.rows()>4 ) {
346 fittedPosition[0] = vtxPositions[Trk::jet_xv]; //position x,y,z of PV
347 fittedPosition[1] = vtxPositions[Trk::jet_yv];
348 fittedPosition[2] = vtxPositions[Trk::jet_zv];
349 fittedPosition[3] = vtxPositions[Trk::jet_phi]; // direction of the jet axis
350 fittedPosition[4] = vtxPositions[Trk::jet_theta];
351
352 fittedCov[0] = vtxCovMatrix(0,0);
353 fittedCov[1] = vtxCovMatrix(1,1);
354 fittedCov[2] = vtxCovMatrix(2,2);
355 fittedCov[3] = vtxCovMatrix(3,3);
356 fittedCov[4] = vtxCovMatrix(4,4);
357
358 }
359
360 for(int i=0; i<nVtx; ++i){
361 fittedPosition[i+5] = vtxPositions[i+5]; //dist of vtxi on jet axis from PV
362 fittedCov[i+5] = vtxCovMatrix(i+5,i+5);
363 }
364
365 //trks at PV
366 const std::vector<Trk::VxTrackAtVertex*> & trackatPV = vxjetcand->getPrimaryVertex()->getTracksAtVertex();
367 std::vector<Trk::VxTrackAtVertex*>::const_iterator irBegin = trackatPV.begin();
368 std::vector<Trk::VxTrackAtVertex*>::const_iterator irEnd = trackatPV.end();
369 std::vector< float > tracksAtPVchi2;
370 std::vector< float > tracksAtPVndf;
371 std::vector< ElementLink< xAOD::TrackParticleContainer > > tracksAtPVlinks;
372
373 for (std::vector<Trk::VxTrackAtVertex*>::const_iterator it=irBegin; it!=irEnd; ++it) {
374 const Trk::FitQuality& trkquality = (*it)->trackQuality();
375 double tmpchi2 = trkquality.chiSquared();
376 int tmpndf = trkquality.numberDoF();
377 tracksAtPVchi2.push_back(float(tmpchi2));
378 tracksAtPVndf.push_back(float(tmpndf));
379 //links
380
381 Trk::ITrackLink* trklinks = (*it)->trackOrParticleLink();
382 const Trk::LinkToXAODTrackParticle* trkLinkTPxAOD = dynamic_cast<const Trk::LinkToXAODTrackParticle *>(trklinks);
383 if (!trkLinkTPxAOD) {
384 ATH_MSG_WARNING("#BTAG# bad ITrackLink is not a LinkToXAODTrackParticle");
385 continue;
386 }
387 const xAOD::TrackParticle* myTrklink = **trkLinkTPxAOD;
388 ElementLink<xAOD::TrackParticleContainer> tpel;
389 tpel.toContainedElement(*theTrackParticleContainer, myTrklink);
390 tracksAtPVlinks.push_back(tpel);
391 }
392 }
393 else { //No JF vertices
394 ATH_MSG_ERROR("#BTAG# No JF vertices. Minimum 1");
395 }
396
397 return StatusCode::SUCCESS;
398 }
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition FitQuality.h:60
double chiSquared() const
returns the of the overall track fit
Definition FitQuality.h:56
const Amg::Vector3D & momentum() const
Access method for the momentum.
Amg::MatrixX const & covariancePosition() const
return the covDeltaV matrix of the vertex fit
const Amg::VectorX & position() const
return position of vertex
const std::map< float, PairOfVxVertexOnJetAxis > & getCompatibilityPairOfVertices(void) const
Get back full compatibility info (only for reading).
Trk::VxClusteringTable *& getClusteringTable(void)
const std::vector< VxVertexOnJetAxis * > & getVerticesOnJetAxis(void) const
const VxVertexOnJetAxis * getPrimaryVertex(void) const
const Trk::RecVertexPositions & getRecVertexPositions() const
const std::vector< Trk::VxJetCandidate * > & verticesJF() const
const std::vector< VxTrackAtVertex * > & getTracksAtVertex(void) const
get Tracks At Vertex Method
void setTrack_chi2(const std::vector< float > &values)
set track chi2 values
void setTrack_NDF(const std::vector< float > &values)
set track NDF values
void setTrack_refPz(const std::vector< float > &values)
set track momentum z components
void setChi2(float value)
access the corresponding xAOD::BTagVertex
void setTrack_refPx(const std::vector< float > &values)
set track momentum x components
void setNDF(float value)
set fit NDF
void setTrack_links(const TPELinks_t &links)
set track ElementLinks
void setPV_compatibility(float value)
set compatibility with PV
void setTrack_refPy(const std::vector< float > &values)
set track momentum y components
double chi2(TH1 *h0, TH1 *h1)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
std::pair< HepMcParticleLink, CscMcData > pair2
std::pair< HepMcParticleLink,MuonMCData > pair1
ParametersBase< TrackParametersDim, Charged > TrackParameters
@ jet_zv
position x,y,z of primary vertex
BTagVertex_v1 BTagVertex
Definition of the current "BTagging version".
Definition BTagVertex.h:17
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ createSecVkalContainer()

StatusCode Analysis::JetSecVertexingAlg::createSecVkalContainer ( xAOD::VertexContainer * bTagVertexContainer,
std::vector< ElementLink< xAOD::VertexContainer > > * SVertexLinks,
const Trk::VxSecVKalVertexInfo * myVertexInfoVKal ) const
private

Definition at line 172 of file JetSecVertexingAlg.cxx.

173 {
174
175 std::vector<xAOD::Vertex*>::const_iterator verticesBegin = myVertexInfoVKal->vertices().begin();
176 std::vector<xAOD::Vertex*>::const_iterator verticesEnd = myVertexInfoVKal->vertices().end();
177
178 for (std::vector<xAOD::Vertex*>::const_iterator verticesIter=verticesBegin; verticesIter!=verticesEnd;++verticesIter) {
179 xAOD::Vertex* btagVtx = *verticesIter;
180 bTagVertexContainer->push_back(btagVtx);
181
182 ElementLink< xAOD::VertexContainer> linkBTagVertex;
183 linkBTagVertex.toContainedElement(*bTagVertexContainer, btagVtx);
184 SVertexLinks->push_back(linkBTagVertex);
185 }
186 ATH_MSG_DEBUG("#BTAG# SV container size: " << bTagVertexContainer->size());
187
188 return StatusCode::SUCCESS;
189 }
size_type size() const noexcept
Returns the number of elements in the collection.
const std::vector< xAOD::Vertex * > & vertices() const
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode Analysis::JetSecVertexingAlg::execute ( const EventContext & ctx) const
overridevirtual

Definition at line 53 of file JetSecVertexingAlg.cxx.

53 {
54 //retrieve the Jet container
55 SG::ReadHandle<xAOD::JetContainer> h_JetCollectionName (m_JetCollectionName,ctx);
56 if (!h_JetCollectionName.isValid()) {
57 ATH_MSG_ERROR( " cannot retrieve jet container with key " << m_JetCollectionName.key() );
58 return StatusCode::FAILURE;
59 }
60
61 SG::WriteHandle<xAOD::VertexContainer> h_BTagSVCollectionName;
62 SG::WriteHandle<xAOD::BTagVertexContainer> h_BTagJFVtxCollectionName;
63
65 /* Record the BTagging JF Vertex output container */
66 if ((basename == "JetFitter") || (basename == "JetFitterFlip")) {
67 ATH_MSG_DEBUG("#BTAG# Record the BTagging JF Vertex output container");
68 h_BTagJFVtxCollectionName = SG::WriteHandle<xAOD::BTagVertexContainer>(m_BTagJFVtxCollectionName, ctx);
69 ATH_CHECK( h_BTagJFVtxCollectionName.record(std::make_unique<xAOD::BTagVertexContainer>(),
70 std::make_unique<xAOD::BTagVertexAuxContainer>()) );
71 }
72
73 /* Record the BTagging Secondary Vertex output container */
74 if ((basename == "SV1") || (basename == "SV1Flip")) {
75 ATH_MSG_DEBUG("#BTAG# Record the BTagging Secondary Vertex output container");
76 h_BTagSVCollectionName = SG::WriteHandle<xAOD::VertexContainer>(m_BTagSVCollectionName, ctx);
77 ATH_CHECK( h_BTagSVCollectionName.record(std::make_unique<xAOD::VertexContainer>(),
78 std::make_unique<xAOD::VertexAuxContainer>()) );
79 }
80
81 if (h_JetCollectionName->empty()) {
82 ATH_MSG_DEBUG("#BTAG# Empty Jet collection");
83 return StatusCode::SUCCESS;
84 }
85
86 SG::ReadHandle<xAOD::TrackParticleContainer> h_TrackCollectionName (m_TrackCollectionName, ctx);
87 if (!h_TrackCollectionName.isValid()) {
88 ATH_MSG_ERROR( " cannot retrieve track container with key " << m_TrackCollectionName.key() );
89 return StatusCode::FAILURE;
90 }
91
92 const xAOD::TrackParticleContainer* theTrackParticleContainer = h_TrackCollectionName.ptr();
93
94 //retrieve primary vertex
95 SG::ReadHandle<xAOD::VertexContainer> h_VertexCollectionName (m_VertexCollectionName, ctx);
96 if (!h_VertexCollectionName.isValid()) {
97 ATH_MSG_ERROR( " cannot retrieve primary vertex container with key " << m_VertexCollectionName.key() );
98 return StatusCode::FAILURE;
99 }
100
101 //retrieve VxSecVertexInfo
102 SG::ReadHandle<Trk::VxSecVertexInfoContainer> h_VxSecVertexInfoName (m_VxSecVertexInfoName, ctx);
103 if (!h_VxSecVertexInfoName.isValid()) {
104 ATH_MSG_ERROR( " cannot retrieve secondary vertex container with key " << m_VxSecVertexInfoName.key() );
105 return StatusCode::FAILURE;
106 }
107 ATH_MSG_DEBUG("Size of VxSecVertexInfo: " << h_VxSecVertexInfoName->size());
108
109 if (h_VxSecVertexInfoName->size() != h_JetCollectionName->size()) {
110 ATH_MSG_ERROR("Size of jet container different than size of VxSecVertexInfo");
111 return StatusCode::FAILURE;
112 }
113
114 unsigned int nVertexes = h_VertexCollectionName->size();
115 if (nVertexes == 0) {
116 ATH_MSG_ERROR("#BTAG# Vertex container is empty");
117 return StatusCode::FAILURE;
118 }
119 Trk::VxSecVertexInfoContainer::const_iterator infoSVIter = h_VxSecVertexInfoName->begin();
120
121 if(basename == "SV1" || basename == "SV1Flip") { //SV1
122 SG::WriteDecorHandle<xAOD::JetContainer,std::vector<ElementLink< xAOD::VertexContainer> > > h_jetSVLinkName(m_jetSVLinkName, ctx);
123 for (const xAOD::Jet* jetToTag : *h_JetCollectionName) {
124 const Trk::VxSecVertexInfo* myVertexInfo = *infoSVIter++;
125 std::vector< ElementLink< xAOD::VertexContainer > > SVertexLinks;
126 if(myVertexInfo != nullptr) {
127 if(const Trk::VxSecVKalVertexInfo* myVertexInfoVKal = dynamic_cast<const Trk::VxSecVKalVertexInfo*>(myVertexInfo)) {
128 ATH_MSG_DEBUG("#BTAG# Found VKalVertexInfo information");
129 StatusCode sc = createSecVkalContainer(&(*h_BTagSVCollectionName), &SVertexLinks, myVertexInfoVKal);
130 if(sc.isFailure()){
131 ATH_MSG_ERROR("#BTAG# error filling variables from VxSecVKalVertexInfo " << m_VxSecVertexInfoName.key());
132 return sc;
133 }
134 }
135 else {
136 ATH_MSG_DEBUG("#BTAG# dynamic_cast failed for a non-nullptr myVertexInfo!");
137 }
138 }
139 h_jetSVLinkName(*jetToTag) = SVertexLinks;
140 }
141 }
142
143 else if(basename == "JetFitter" || basename == "JetFitterFlip") {
144 SG::WriteDecorHandle<xAOD::JetContainer,std::vector<ElementLink< xAOD::BTagVertexContainer> > > h_jetSVLinkName(m_jetSVLinkName, ctx);
145 for (const xAOD::Jet* jetToTag : *h_JetCollectionName) {
146 const Trk::VxSecVertexInfo* myVertexInfo = *infoSVIter++;
147 std::vector< ElementLink< xAOD::BTagVertexContainer > > JFVtxLinks;
148 if(myVertexInfo != nullptr) {
149 if(const Trk::VxJetFitterVertexInfo* myVertexInfoJetFitter = dynamic_cast<const Trk::VxJetFitterVertexInfo*>(myVertexInfo)) {
150 ATH_MSG_DEBUG("#BTAG# Found VxJetFitterVertexInfo information");
151 StatusCode sc = createJFContainer(&(*h_BTagJFVtxCollectionName), &JFVtxLinks, myVertexInfoJetFitter, theTrackParticleContainer);
152 if(sc.isFailure()){
153 ATH_MSG_ERROR("#BTAG# error filling variables from VxJetFitterVertexInfo " << m_VxSecVertexInfoName.key());
154 return sc;
155 }
156 }
157 else {
158 ATH_MSG_DEBUG("#BTAG# dynamic_cast failed for a non-nullptr myVertexInfo!");
159 }
160 }
161 h_jetSVLinkName(*jetToTag) = JFVtxLinks;
162 }
163 }
164
165 else {
166 ATH_MSG_ERROR("#BTAG# JetSecVertexingAlg encounters an unknown basename: " << basename);
167 }
168
169 return StatusCode::SUCCESS;
170 }
#define ATH_CHECK
Evaluate an expression and check for errors.
static Double_t sc
SG::ReadHandleKey< Trk::VxSecVertexInfoContainer > m_VxSecVertexInfoName
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackCollectionName
SG::ReadHandleKey< xAOD::VertexContainer > m_VertexCollectionName
SG::WriteHandleKey< xAOD::BTagVertexContainer > m_BTagJFVtxCollectionName
SG::WriteHandleKey< xAOD::VertexContainer > m_BTagSVCollectionName
SG::ReadHandleKey< xAOD::JetContainer > m_JetCollectionName
StatusCode createSecVkalContainer(xAOD::VertexContainer *, std::vector< ElementLink< xAOD::VertexContainer > > *, const Trk::VxSecVKalVertexInfo *) const
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetSVLinkName
StatusCode createJFContainer(xAOD::BTagVertexContainer *, std::vector< ElementLink< xAOD::BTagVertexContainer > > *, const Trk::VxJetFitterVertexInfo *, const xAOD::TrackParticleContainer *) const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:861
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
::StatusCode StatusCode
StatusCode definition for legacy code.
Jet_v1 Jet
Definition of the current "jet version".
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
std::string basename(std::string name)
Definition utils.cxx:207

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ initialize()

StatusCode Analysis::JetSecVertexingAlg::initialize ( )
overridevirtual

Main routines specific to an ATHENA algorithm.

Definition at line 37 of file JetSecVertexingAlg.cxx.

38 {
39 // This will check that the properties were initialized properly
40 // by job configuration.
41 ATH_CHECK( m_JetCollectionName.initialize() );
42 ATH_CHECK( m_TrackCollectionName.initialize() );
43 ATH_CHECK( m_VxSecVertexInfoName.initialize() );
44 ATH_CHECK( m_VertexCollectionName.initialize() );
45 ATH_CHECK( m_BTagSVCollectionName.initialize( (m_secVertexFinderBaseName == "SV1") || (m_secVertexFinderBaseName == "SV1Flip") ) );
46 ATH_CHECK( m_BTagJFVtxCollectionName.initialize( (m_secVertexFinderBaseName == "JetFitter") || (m_secVertexFinderBaseName == "JetFitterFlip") ) );
47 ATH_CHECK( m_jetSVLinkName.initialize() );
48
49 return StatusCode::SUCCESS;
50 }

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }

Member Data Documentation

◆ m_BTagJFVtxCollectionName

SG::WriteHandleKey<xAOD::BTagVertexContainer> Analysis::JetSecVertexingAlg::m_BTagJFVtxCollectionName {this, "BTagJFVtxCollectionName", "", "Output BTagging Jet Fitter container"}
private

Definition at line 64 of file JetSecVertexingAlg.h.

64{this, "BTagJFVtxCollectionName", "", "Output BTagging Jet Fitter container"};

◆ m_BTagSVCollectionName

SG::WriteHandleKey<xAOD::VertexContainer> Analysis::JetSecVertexingAlg::m_BTagSVCollectionName {this, "BTagSVCollectionName", "", "Output BTagging secondary vertex container"}
private

Definition at line 62 of file JetSecVertexingAlg.h.

62{this, "BTagSVCollectionName", "", "Output BTagging secondary vertex container"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_JetCollectionName

SG::ReadHandleKey<xAOD::JetContainer > Analysis::JetSecVertexingAlg::m_JetCollectionName {this, "JetCollectionName", "", "Input jet container"}
private

Definition at line 58 of file JetSecVertexingAlg.h.

58{this, "JetCollectionName", "", "Input jet container"};

◆ m_jetSVLinkName

SG::WriteDecorHandleKey<xAOD::JetContainer> Analysis::JetSecVertexingAlg::m_jetSVLinkName { this, "JetSecVtxLinkName", "", "Element Link vector from jet to Vertex container"}
private

Definition at line 63 of file JetSecVertexingAlg.h.

63{ this, "JetSecVtxLinkName", "", "Element Link vector from jet to Vertex container"};

◆ m_secVertexFinderBaseName

std::string Analysis::JetSecVertexingAlg::m_secVertexFinderBaseName
private

Definition at line 56 of file JetSecVertexingAlg.h.

◆ m_TrackCollectionName

SG::ReadHandleKey<xAOD::TrackParticleContainer > Analysis::JetSecVertexingAlg::m_TrackCollectionName {this, "TrackCollectionName", "", "Input track container"}
private

Definition at line 59 of file JetSecVertexingAlg.h.

59{this, "TrackCollectionName", "", "Input track container"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 387 of file AthCommonDataStore.h.

◆ m_VertexCollectionName

SG::ReadHandleKey<xAOD::VertexContainer> Analysis::JetSecVertexingAlg::m_VertexCollectionName {this, "vxPrimaryCollectionName", "", "Input primary vertex container"}
private

Definition at line 60 of file JetSecVertexingAlg.h.

60{this, "vxPrimaryCollectionName", "", "Input primary vertex container"};

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 386 of file AthCommonDataStore.h.

◆ m_VxSecVertexInfoName

SG::ReadHandleKey<Trk::VxSecVertexInfoContainer> Analysis::JetSecVertexingAlg::m_VxSecVertexInfoName {this, "BTagVxSecVertexInfoName", "", "Input VxSecVertexInfo container"}
private

Definition at line 61 of file JetSecVertexingAlg.h.

61{this, "BTagVxSecVertexInfoName", "", "Input VxSecVertexInfo container"};

The documentation for this class was generated from the following files: