7#include "boost/tokenizer.hpp"
22 const std::string& prefix) {
25 std::istringstream stream(lines);
27 while ( std::getline(stream, line) ) {
28 if ( !ostr.empty() ) ostr +=
"\n";
29 ostr += prefix + line;
44 declareInterface< IBPhysTrackVertexMapTool >(
this );
67 ATH_MSG_DEBUG(
"Initializing xAOD::BPhysTrackVertexMapTool" );
92 return StatusCode::SUCCESS;
100 return StatusCode::SUCCESS;
105 ATH_MSG_DEBUG(
"logEvent in xAOD::BPhysTrackVertexMapTool" );
123 return StatusCode::SUCCESS;
141 ATH_MSG_DEBUG(
"BPhysTrackVertexMapTool::cacheEvent -- begin");
153 ATH_MSG_DEBUG(
"BPhysTrackVertexMapTool::cacheEvent: caching now: "
201 return StatusCode::SUCCESS;
208 std::vector<const xAOD::Vertex*>
217 std::vector<const xAOD::Vertex*> dummy;
226 std::vector<const xAOD::Vertex*>
235 std::vector<const xAOD::Vertex*> dummy;
244 std::vector<const xAOD::Vertex*>
253 std::vector<const xAOD::Vertex*> dummy;
262 void BPhysTrackVertexMapTool
279 vtxItr != pvc->
end(); ++vtxItr) {
290 vtxItr != rpvc->
end(); ++vtxItr) {
302 vtxItr != svc->end(); ++vtxItr) {
313 trkItr != tpc->
end(); ++trkItr) {
323 void BPhysTrackVertexMapTool
328 TrackToVertexMap_t::const_iterator it =
map.find(
track);
330 if ( it ==
map.end() ) {
331 map[
track] = std::vector<const xAOD::Vertex*>();
341 std::string f = std::format(
"PV{:03d}",
m_pvNameMap.size());
363 std::string f = std::format(
"SV{:03d}",
m_svNameMap.size());
386 bool withPV,
bool withRefPV,
389 std::string sind(indent,
' ');
390 std::string
str = std::format(
"{} {:<5} {} ({:10.4f}, {:10.4f}, {:10.4f}) VL ",
396 for (
auto vtx : it->second ) {
400 std::string f = std::format(
"\n{} {}", sind,
"NOPV");
408 for (
auto vtx : it->second ) {
412 std::string f = std::format(
"\n{} {}", sind,
"NORV");
419 for (
auto vtx : it->second ) {
423 std::string f2 = std::format(
"\n{} {}", sind,
"NOSV");
437 std::string sind(indent,
' ');
438 std::string
str = std::format(
"{} {:<5} {} ({:10.4f}, {:10.4f}, {:10.4f}) NT {:4d} VT {}",
439 sind,
pvName(vtx),
static_cast<const void*
>(vtx), vtx->
x(), vtx->
y(), vtx->
z(),
443 std::string f2 = std::format(
"\n{} {:4d} {}",
459 std::string sind(indent,
' ');
460 std::string
str = std::format(
"{} {:<5} {} ({:10.4f}, {:10.4f}, {:10.4f}) NT {:4d} VT {}",
461 sind,
refPVName(vtx),
static_cast<const void*
>(vtx), vtx->
x(), vtx->
y(), vtx->
z(),
480 std::string sind(indent,
' ');
481 std::string
str = std::format(
"{} {:<5} {} ({:10.4f}, {:10.4f}, {:10.4f}) NT {:4} VT {}",
482 sind,
svName(vtx),
static_cast<const void*
>(vtx), vtx->
x(), vtx->
y(), vtx->
z(),
484 if ( withMasses &&
m_hypoName !=
"__NONE__" ) {
487 for (
const std::string& hypoName : hypoNames ) {
489 float bMass = bhh.
mass();
490 float bMassErr = bhh.
massErr();
491 float bMucMass =
getFloat(hypoName+
"_MUCALC_mass", vtx);
492 float bMucMassErr =
getFloat(hypoName+
"_MUCALC_massErr", vtx);
493 if ( bMass > 0. || bMassErr > 0.
494 || bMucMass > 0. || bMucMassErr > 0. ) {
495 str += std::format(
"\n{} {:<10} : mass : ({:15.4f} +/- {:15.4f}) MeV",
496 sind, hypoName, bMass, bMassErr);
497 str += std::format(
"\n{} {:<10} : m(MUCALC): ({:15.4f} +/- {:15.4f}) MeV",
498 sind, hypoName, bMucMass, bMucMassErr);
522 std::string sind(indent,
' ');
523 str += sind +
"ID tracks: (" + std::to_string(tpc->
size()) +
")\n";
524 str += sind + std::string(80-indent,
'-');
527 trkItr != tpc->
end(); ++trkItr) {
543 std::string sind(indent,
' ');
544 str += sind +
"Primary vertices: (" + std::to_string(pvc->
size()) +
")\n";
545 str += sind + std::string(80-indent,
'-');
547 vtxItr != pvc->
end(); ++vtxItr) {
564 std::string sind(indent,
' ');
565 str += sind +
"Refitted primary vertices: (" + std::to_string(rpvc->
size()) +
")\n";
566 str += sind + std::string(80-indent,
'-');
568 vtxItr != rpvc->
end(); ++vtxItr) {
585 std::string sind(indent,
' ');
586 str += sind +
"Secondary vertices: (" + std::to_string(svc->size()) +
")\n";
587 str += sind + std::string(80-indent,
'-');
589 vtxItr != svc->end(); ++vtxItr) {
591 str +=
"\n" +
svToString(vtx, indent+2, withTracks, withMasses);
618 float res = -999999.;
628 std::vector<std::string> BPhysTrackVertexMapTool
629 ::getTokens(std::string input, std::string seperators) {
631 std::vector<std::string> tokens;
632 boost::char_separator<char> sep(seperators.c_str());
633 typedef boost::tokenizer<boost::char_separator<char> > Tokenizer_t;
634 Tokenizer_t tokenizer(input, sep);
635 for (
auto& token : tokenizer) {
636 tokens.push_back(token);
#define ATH_CHECK
Evaluate an expression and check for errors.
: B-physics xAOD helpers.
std::pair< std::vector< unsigned int >, bool > res
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
SG::Accessor< T, ALLOC > Accessor
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
float mass() const
Get invariant mass and its error.
float massErr() const
invariant mass error
uint32_t runNumber() const
The current event's run number.
uint64_t eventNumber() const
The current event's event number.
float z() const
Returns the z position.
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
float y() const
Returns the y position.
VxType::VertexType vertexType() const
The type of the vertex.
float x() const
Returns the x position.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
EventInfo_v1 EventInfo
Definition of the latest event info version.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
TrackParticleAuxContainer_v5 TrackParticleAuxContainer
Definition of the current TrackParticle auxiliary container.