|
ATLAS Offline Software
|
#include <MSVVariablesFactory.h>
|
| MSVVariablesFactory (const std::string &name, const std::string &n, const IInterface *p) |
|
virtual | ~MSVVariablesFactory ()=default |
|
virtual StatusCode | initialize () override |
|
virtual StatusCode | finalize () override |
|
virtual StatusCode | fillMSVVariables (const xAOD::Jet &, xAOD::BTagging *BTag, const Trk::VxSecVKalVertexInfo *myInfoVKal, xAOD::VertexContainer *btagVertex, const xAOD::Vertex &PV, std::string basename) const override |
|
virtual StatusCode | createMSVContainer (const xAOD::Jet &, const Trk::VxSecVKalVertexInfo *myInfoVKal, xAOD::VertexContainer *btagVertex, const xAOD::Vertex &PV) const override |
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
Definition at line 23 of file MSVVariablesFactory.h.
◆ StoreGateSvc_t
◆ MSVVariablesFactory()
Analysis::MSVVariablesFactory::MSVVariablesFactory |
( |
const std::string & |
name, |
|
|
const std::string & |
n, |
|
|
const IInterface * |
p |
|
) |
| |
◆ ~MSVVariablesFactory()
virtual Analysis::MSVVariablesFactory::~MSVVariablesFactory |
( |
| ) |
|
|
virtualdefault |
◆ createMSVContainer()
Implements Analysis::IMSVVariablesFactory.
Definition at line 57 of file MSVVariablesFactory.cxx.
64 std::vector< ElementLink< xAOD::VertexContainer > > MSVVertexLinks;
65 const std::vector<xAOD::Vertex*> myVertices = myVertexInfoVKal->vertices();
66 if(myVertices.empty()){
67 ATH_MSG_DEBUG(
"#BTAG# no MSV vertices...fill default values only... ");
77 return StatusCode::SUCCESS;
80 jetenergy = myVertexInfoVKal->energyTrkInJet();
82 for (
const auto&
vertex : myVertexInfoVKal->vertices()){
89 const std::vector<ElementLink<xAOD::TrackParticleContainer> > myTrackLinks =
vertex->trackParticleLinks();
90 if (myTrackLinks.empty()) {
91 ATH_MSG_WARNING(
"#BTAG# No Track Links attached to the track at the sec vertex... ");
94 const std::vector<Trk::VxTrackAtVertex> myTracks=
vertex->vxTrackAtVertex();
95 if (!myTracks.empty()) {
96 npsec=myTracks.size();
97 for (
const auto&
track : myTracks) {
100 sumpx += perigee->momentum().x();
101 sumpy += perigee->momentum().y();
102 sumpz += perigee->momentum().z();
103 sume += std::hypot(perigee->momentum().mag(), 139.5702);
110 CLHEP::HepLorentzVector vtxp4(sumpx,sumpy,sumpz,sume);
111 float efrac = (jetenergy>0) ? vtxp4.e()/jetenergy : 0;
120 double localdistnrm = 0;
121 std::vector<const xAOD::Vertex*> vecVtxHolder;
122 vecVtxHolder.push_back(
vertex);
124 ATH_MSG_DEBUG(
"Factory PVX x = " << priVtx->
x() <<
" y = " << priVtx->
y() <<
" z = " << priVtx->
z());
128 ATH_MSG_WARNING(
"#BTAG# Tagging requested, but no primary vertex supplied.");
132 vertex->setTrackParticleLinks(myTrackLinks);
136 return StatusCode::SUCCESS;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
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
◆ fillMSVVariables()
Implements Analysis::IMSVVariablesFactory.
Definition at line 139 of file MSVVariablesFactory.cxx.
147 float jetenergy = 0.;
151 std::vector< ElementLink< xAOD::VertexContainer > > MSVVertexLinks;
152 const std::vector<xAOD::Vertex*> myVertices = myVertexInfoVKal->vertices();
153 if(myVertices.empty()){
154 ATH_MSG_DEBUG(
"#BTAG# no MSV vertices...fill default values only... ");
156 BTag->setVariable<
float>(
basename,
"energyTrkInJet", jetenergy);
158 BTag->setVariable<
float>(
basename,
"normdist", distnrm);
159 BTag->setVariable<std::vector<ElementLink<xAOD::VertexContainer> > >(
basename,
"vertices", MSVVertexLinks);
170 return StatusCode::SUCCESS;
173 jetenergy = myVertexInfoVKal->energyTrkInJet();
174 n2t = myVertexInfoVKal->n2trackvertices();
176 BTag->setVariable<
float>(
basename,
"energyTrkInJet", jetenergy);
178 std::vector<const xAOD::Vertex*> vecVertices;
179 for (
const auto&
vertex : myVertexInfoVKal->vertices()) {
182 vecVertices.push_back(
vertex);
187 const std::vector<ElementLink<xAOD::TrackParticleContainer> > myTrackLinks =
vertex->trackParticleLinks();
188 if (myTrackLinks.empty()) {
189 ATH_MSG_WARNING(
"#BTAG# No Track Links attached to the track at the sec vertex... ");
192 const std::vector<Trk::VxTrackAtVertex> myTracks=
vertex->vxTrackAtVertex();
193 if (!myTracks.empty()) {
194 npsec=myTracks.size();
195 for (
const auto&
track : myTracks) {
198 sumpx += perigee->momentum().x();
199 sumpy += perigee->momentum().y();
200 sumpz += perigee->momentum().z();
201 sume += std::hypot(perigee->momentum().mag(), 139.5702);
208 CLHEP::HepLorentzVector vtxp4(sumpx,sumpy,sumpz,sume);
209 float efrac = (jetenergy>0) ? vtxp4.e()/jetenergy : 0;
218 double localdistnrm = 0;
219 std::vector<const xAOD::Vertex*> vecVtxHolder;
220 vecVtxHolder.push_back(
vertex);
222 ATH_MSG_DEBUG(
"Factory PVX x = " << priVtx->
x() <<
" y = " << priVtx->
y() <<
" z = " << priVtx->
z());
226 ATH_MSG_WARNING(
"#BTAG# Tagging requested, but no primary vertex supplied.");
230 vertex->setTrackParticleLinks(myTrackLinks);
234 MSVVertexLinks.push_back(linkBTagVertex);
237 BTag->setVariable<std::vector<ElementLink<xAOD::VertexContainer> > >(
basename,
"vertices", MSVVertexLinks);
243 ATH_MSG_WARNING(
"#BTAG# Tagging requested, but no primary vertex supplied.");
246 nvsec = vecVertices.size();
248 BTag->setVariable<
float>(
basename,
"normdist", distnrm);
250 return StatusCode::SUCCESS;
◆ finalize()
StatusCode Analysis::MSVVariablesFactory::finalize |
( |
| ) |
|
|
overridevirtual |
◆ get3DSignificance()
Definition at line 254 of file MSVVariablesFactory.cxx.
259 if(!secVertex.size())
return 0;
260 std::vector<Amg::Vector3D> positions;
264 sumWeights.setZero();
267 positions.push_back(
vertex->position());
268 weightMatrices.push_back(
vertex->covariancePosition().inverse());
269 weightTimesPosition += weightMatrices.back() * positions.back();
270 sumWeights += weightMatrices.back();
275 meanCovariance.setZero();
276 sumWeights.computeInverseWithCheck(meanCovariance, invertible);
281 Amg::Vector3D meanPosition = meanCovariance * weightTimesPosition;
282 AmgSymMatrix(3) covariance = meanCovariance + priVertex->covariancePosition();
284 double Lx = meanPosition[0]-priVertex->position().
x();
285 double Ly = meanPosition[1]-priVertex->position().
y();
286 double Lz = meanPosition[2]-priVertex->position().
z();
288 const double decaylength = sqrt(Lx*Lx + Ly*Ly + Lz*Lz);
289 const double inv_decaylength = 1. / decaylength;
290 double dLdLx = Lx * inv_decaylength;
291 double dLdLy = Ly * inv_decaylength;
292 double dLdLz = Lz * inv_decaylength;
293 double decaylength_err = sqrt(dLdLx*dLdLx*covariance(0,0) +
294 dLdLy*dLdLy*covariance(1,1) +
295 dLdLz*dLdLz*covariance(2,2) +
296 2.*dLdLx*dLdLy*covariance(0,1) +
297 2.*dLdLx*dLdLz*covariance(0,2) +
298 2.*dLdLy*dLdLz*covariance(1,2));
300 double decaylength_significance = 0.;
301 if (decaylength_err != 0.) decaylength_significance = decaylength/decaylength_err;
302 double L_proj_jetDir = jetDirection.
x()*Lx + jetDirection.
y()*Ly + jetDirection.
z()*Lz;
303 if (L_proj_jetDir < 0.) decaylength_significance *= -1.;
305 return decaylength_significance;
◆ initialize()
StatusCode Analysis::MSVVariablesFactory::initialize |
( |
| ) |
|
|
overridevirtual |
◆ inputHandles()
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.
◆ interfaceID()
static const InterfaceID& Analysis::IMSVVariablesFactory::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
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()
◆ renounceArray()
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_detStore
◆ m_evtStore
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
float x() const
Returns the x position.
bool toContainedElement(BaseConstReference data, ElementType element, IProxyDict *sg=0)
Set from element pointer and a reference to the container (storable)
Vertex_v1 Vertex
Define the latest version of the vertex class.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
void setVtxNtrk(xAOD::Vertex *, int value)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
void setEnergyFraction(xAOD::Vertex *, float value)
bool const RAWDATA *ch2 const
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
#define AmgSymMatrix(dim)
virtual void setOwner(IDataHandleHolder *o)=0
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
float z() const
Returns the z position.
void setVtxpt(xAOD::Vertex *, float value)
void setVtxeta(xAOD::Vertex *, float value)
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
ElementLink implementation for ROOT usage.
void setVtxphi(xAOD::Vertex *, float value)
void setVtxnormDist(xAOD::Vertex *, float value)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Eigen::Matrix< double, 3, 1 > Vector3D
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
float y() const
Returns the y position.
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
@ BTag
The object is a b-tagging object.
void setVertexMass(xAOD::Vertex *, float value)
double get3DSignificance(const xAOD::Vertex *priVertex, std::vector< const xAOD::Vertex * > &secVertex, const Amg::Vector3D jetDirection) const
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>