diff --git a/create_database/tuple_reader/BDtaunuDef.cc b/create_database/tuple_reader/BDtaunuDef.cc index 0eb4dfc..0d0d39f 100644 --- a/create_database/tuple_reader/BDtaunuDef.cc +++ b/create_database/tuple_reader/BDtaunuDef.cc @@ -7,6 +7,9 @@ using namespace bdtaunu; +// RecoDType +// --------- + RecoDTypeCatalogue::DType RecoDTypeCatalogue::search_d_catalogue(std::vector lund_list) const { std::vector word; @@ -25,6 +28,7 @@ RecoDTypeCatalogue::search_dstar_catalogue(std::vector lund_list) const { return dstar_catalogue.find(word); } + void RecoDTypeCatalogue::RegisterDecays() { // D catalogue @@ -167,12 +171,8 @@ RecoDTypeCatalogue::Alphabet RecoDTypeCatalogue::LundToAlphabet(int lund) const } - - - - - - +// McBType +// ------- McBTypeCatalogue::BMcType McBTypeCatalogue::search_catalogue(std::vector lund_list) const { diff --git a/create_database/tuple_reader/BDtaunuDef.h b/create_database/tuple_reader/BDtaunuDef.h index 1ef6d4e..19e96b9 100644 --- a/create_database/tuple_reader/BDtaunuDef.h +++ b/create_database/tuple_reader/BDtaunuDef.h @@ -4,19 +4,22 @@ #include #include -/*! \file bdtaunu_definitions.h - * \brief Constants defined for this analysis. +/** @file BDtaunuDef.h + * @brief Definitions of relevant quantities to the \f$B\rightarrow D\tau\nu\f$ analysis. + * + * Several types of quantities are defined in this file: + * * Constants used throughout the analysis. + * * Particle decay modes. * - * This file contains any constants and enumerations that are used - * throughout the analysis package. */ namespace bdtaunu { -const int UpsilonLund = 70553; -const int B0Lund = 511; -const int BcLund = 521; -const int D0Lund = 421; +// Lund ID of frequently encountered particles. +const int UpsilonLund = 70553; +const int B0Lund = 511; +const int BcLund = 521; +const int D0Lund = 421; const int DcLund = 411; const int Dstar0Lund = 423; const int DstarcLund = 413; @@ -32,6 +35,7 @@ const int gammaLund = 22; const int protonLund = 2212; const int neutronLund = 2112; + //! B meson flavors. enum class BFlavor { NoB = 0, /*!< No \f$B\f$ meson. */ @@ -40,6 +44,8 @@ enum class BFlavor { null = -1, /*!< Undefined */ }; + +//! \f$D/D^*\f$ modes that are reconstructed. class RecoDTypeCatalogue { public: @@ -73,7 +79,10 @@ class RecoDTypeCatalogue { }; + //! Given a vector of \f$D\f$ daughters, return its decay mode or null. DType search_d_catalogue(std::vector) const; + + //! Given a vector of \f$D^*\f$ daughters, return its decay mode or null. DstarType search_dstar_catalogue(std::vector) const; RecoDTypeCatalogue() { RegisterDecays(); } @@ -92,7 +101,7 @@ class RecoDTypeCatalogue { }; -//! Reconstructed tau decay modes. +//! \f$\tau\f$ modes that are reconstructed. enum class TauType { NoTau = 0, /*!< \f$ \tau^+\rightarrow \pi^+ \f$ */ tau_pi = 1, /*!< \f$ \tau^+\rightarrow \pi^+ \f$ */ @@ -103,9 +112,12 @@ enum class TauType { }; +//! Monte carlo truth \f$B\f$ meson types. class McBTypeCatalogue { public: + + //! See BDtaunuDef.cc for definitions. enum class BMcType { NoB = 0, Dtau = 1, @@ -119,6 +131,7 @@ class McBTypeCatalogue { null = -1, }; + //! Given a vector of \f$B^*\f$ daughters, return its MC type or null. BMcType search_catalogue(std::vector) const; McBTypeCatalogue() { RegisterDecays(); } diff --git a/create_database/tuple_reader/BDtaunuMcReader.cc b/create_database/tuple_reader/BDtaunuMcReader.cc index 4fcc3ce..4775f58 100644 --- a/create_database/tuple_reader/BDtaunuMcReader.cc +++ b/create_database/tuple_reader/BDtaunuMcReader.cc @@ -3,8 +3,8 @@ #include #include -#include "BDtaunuHelpers.h" #include "BDtaunuDef.h" +#include "BDtaunuUtils.h" #include "BDtaunuReader.h" #include "BDtaunuMcReader.h" #include "McGraphManager.h" diff --git a/create_database/tuple_reader/BDtaunuReader.cc b/create_database/tuple_reader/BDtaunuReader.cc index 6f2d9e0..0439a1a 100644 --- a/create_database/tuple_reader/BDtaunuReader.cc +++ b/create_database/tuple_reader/BDtaunuReader.cc @@ -9,7 +9,7 @@ #include #include "BDtaunuDef.h" -#include "BDtaunuHelpers.h" +#include "BDtaunuUtils.h" #include "RootReader.h" #include "BDtaunuReader.h" #include "UpsilonCandidate.h" diff --git a/create_database/tuple_reader/BDtaunuHelpers.cc b/create_database/tuple_reader/BDtaunuUtils.cc similarity index 98% rename from create_database/tuple_reader/BDtaunuHelpers.cc rename to create_database/tuple_reader/BDtaunuUtils.cc index 55a9b67..ac170a1 100644 --- a/create_database/tuple_reader/BDtaunuHelpers.cc +++ b/create_database/tuple_reader/BDtaunuUtils.cc @@ -4,7 +4,7 @@ #include #include -#include "BDtaunuHelpers.h" +#include "BDtaunuUtils.h" // Reads in __PDT_FILE_PATHNAME which contains one particle type on // each line in the format: "particle name" lundId, and puts the diff --git a/create_database/tuple_reader/BDtaunuHelpers.h b/create_database/tuple_reader/BDtaunuUtils.h similarity index 92% rename from create_database/tuple_reader/BDtaunuHelpers.h rename to create_database/tuple_reader/BDtaunuUtils.h index c944ad8..4ae8f7d 100644 --- a/create_database/tuple_reader/BDtaunuHelpers.h +++ b/create_database/tuple_reader/BDtaunuUtils.h @@ -1,7 +1,7 @@ #ifndef __HELPERS_H__ #define __HELPERS_H__ -/*! \file utilities.h +/*! \file BDtaunuUtils.h * \brief General utility functions. */ diff --git a/create_database/tuple_reader/GraphDef.cc b/create_database/tuple_reader/GraphDef.cc index 3bfaff9..4b9de4d 100644 --- a/create_database/tuple_reader/GraphDef.cc +++ b/create_database/tuple_reader/GraphDef.cc @@ -6,6 +6,9 @@ #include #include +// RecoIndexer +// ----------- + RecoGraph::RecoIndexer::RecoIndexer() : nY(0), nB(0), nD(0), nC(0), nh(0), nl(0), ngamma(0) {}; diff --git a/create_database/tuple_reader/GraphDef.h b/create_database/tuple_reader/GraphDef.h index 36625b3..9a04f0f 100644 --- a/create_database/tuple_reader/GraphDef.h +++ b/create_database/tuple_reader/GraphDef.h @@ -6,6 +6,15 @@ #include "BDtaunuDef.h" +/** @file GraphDef.h + * @brief Definition of graph quantities used in the tuple analysis. + * + * Several types of quantities are defined in this file: + * * Boost graph typedefs. + * * Graph satallite data. e.g. particle satellite data attached to vertices. + * + */ + namespace boost { enum vertex_lund_id_t { vertex_lund_id }; BOOST_INSTALL_PROPERTY(vertex, lund_id); @@ -18,8 +27,15 @@ namespace boost { BOOST_INSTALL_PROPERTY(vertex, block_index); } +namespace boost { + enum vertex_mc_index_t { vertex_mc_index }; + BOOST_INSTALL_PROPERTY(vertex, mc_index); +} + +//! Quantities for the reconstructed particle graph. namespace RecoGraph { +// Boost graph typedefs typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, boost::property::type LundI typedef typename boost::property_map::type RecoIndexPropertyMap; typedef typename boost::property_map::type BlockIndexPropertyMap; -struct RecoLepton { +//! Data attached to vertices of reconstructed leptons. +/** Leptons can be actual leptons or placeholder tau leptons + * which are either \f$\pi\f$ or \f$\rho\f$ mesons. + */ +struct Lepton { int l_block_idx = -1; int pi_block_idx = -1; int tau_mode = static_cast(bdtaunu::TauType::null); }; -struct RecoD { - RecoD() = default; +//! Data attached to vertices of reconstructed \f$D/D^*\f$ mesons. +/** This stores information for both \f$D\f$ and \f$D^*\f$ mesons. + * For \f$D^*\f$'s all entries are filled. For \f$D\f$'s, the `Dstar_mode` + * entry will indicate `NoDstar` as in RecoDTypeCatalogue::DstarType. + */ +struct D { + D() = default; int D_mode = static_cast(bdtaunu::RecoDTypeCatalogue::DType::null); int Dstar_mode = static_cast(bdtaunu::RecoDTypeCatalogue::DstarType::NoDstar); }; -struct RecoB { - RecoB() = default; +//! Data attached to vertices of reconstructed \f$B\f$ mesons. +struct B { + B() = default; int flavor = static_cast(bdtaunu::BFlavor::null); - RecoD *D = nullptr; - RecoLepton *Lepton = nullptr; + D *D = nullptr; + Lepton *Lepton = nullptr; }; -struct RecoY { - RecoY() = default; - RecoB *tagB = nullptr; - RecoB *sigB = nullptr; +//! Data attached to vertices of reconstructed \f$\Upsilon(4S)\f$ mesons. +struct Y { + Y() = default; + B *tagB = nullptr; + B *sigB = nullptr; }; + /** @brief This class assigns a unique index to each reconstructed particle. * * @detail @@ -106,22 +134,10 @@ class RecoIndexer { } - - - - - - - - - -namespace boost { - enum vertex_mc_index_t { vertex_mc_index }; - BOOST_INSTALL_PROPERTY(vertex, mc_index); -} - +//! Quantities for the MC truth particle graph. namespace McGraph { +// Boost graph typedefs typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, boost::property::adjacency_iterator AdjacencyIterato typedef typename boost::property_map::type LundIdPropertyMap; typedef typename boost::property_map::type McIndexPropertyMap; -struct McTau { - McTau() = default; +//! Data attached to vertices of \f$\tau\f$ leptons. +struct Tau { + Tau() = default; int mc_type = static_cast(bdtaunu::TauMcType::null); }; -struct McB { - McB() = default; +//! Data attached to vertices of \f$B\f$ mesons. +struct B { + B() = default; int flavor = static_cast(bdtaunu::BFlavor::null); int mc_type = static_cast(bdtaunu::McBTypeCatalogue::BMcType::null); - McTau *tau = nullptr; + Tau *tau = nullptr; }; -struct McY { - McY() = default; +//! Data attached to vertices of \f$\Upsilon(4S)\f$ mesons. +struct Y { + Y() = default; bool isBBbar = true; - McB *B1 = nullptr; - McB *B2 = nullptr; + B *B1 = nullptr; + B *B2 = nullptr; }; } diff --git a/create_database/tuple_reader/Makefile b/create_database/tuple_reader/Makefile index 56a05fd..c5b9969 100644 --- a/create_database/tuple_reader/Makefile +++ b/create_database/tuple_reader/Makefile @@ -14,7 +14,7 @@ PKG_LIBPATH = lib # package Contents SOURCES = BDtaunuDef.cc GraphDef.cc \ - BDtaunuHelpers.cc UpsilonCandidate.cc \ + BDtaunuUtils.cc UpsilonCandidate.cc \ RootReader.cc BDtaunuReader.cc BDtaunuMcReader.cc \ RecoGraphVisitors.cc RecoGraphManager.cc \ McGraphManager.cc McGraphVisitors.cc diff --git a/create_database/tuple_reader/McGraphManager.cc b/create_database/tuple_reader/McGraphManager.cc index 0b2a6f1..5169897 100644 --- a/create_database/tuple_reader/McGraphManager.cc +++ b/create_database/tuple_reader/McGraphManager.cc @@ -123,7 +123,7 @@ void McGraphManager::analyze_graph() { return; } -const McY* McGraphManager::get_mcY() const { +const Y* McGraphManager::get_mcY() const { if (Y_map.size()) { return &Y_map.begin()->second; } else { @@ -131,7 +131,7 @@ const McY* McGraphManager::get_mcY() const { } } -const McB* McGraphManager::get_mcB1() const { +const B* McGraphManager::get_mcB1() const { if (B_map.size()) { return &B_map.begin()->second; } else { @@ -139,7 +139,7 @@ const McB* McGraphManager::get_mcB1() const { } } -const McB* McGraphManager::get_mcB2() const { +const B* McGraphManager::get_mcB2() const { if (B_map.size()) { return &(++B_map.begin())->second; } else { diff --git a/create_database/tuple_reader/McGraphManager.h b/create_database/tuple_reader/McGraphManager.h index ef5e745..6c2553c 100644 --- a/create_database/tuple_reader/McGraphManager.h +++ b/create_database/tuple_reader/McGraphManager.h @@ -111,13 +111,13 @@ class McGraphManager : public GraphManager { void clear(); //! Returns pointer to the MC truth \f$\Upsilon(4S)\f$ if it exists, nullptr otherwise. - const McGraph::McY* get_mcY() const; + const McGraph::Y* get_mcY() const; //! Returns pointer to one of the MC truth \f$B\f$ if it exists, nullptr otherwise. - const McGraph::McB* get_mcB1() const; + const McGraph::B* get_mcB1() const; //! Returns pointer to the other MC truth \f$B\f$ if it exists, nullptr otherwise. - const McGraph::McB* get_mcB2() const; + const McGraph::B* get_mcB2() const; private: @@ -137,9 +137,9 @@ class McGraphManager : public GraphManager { void ClearGraph(); // Graph analysis - std::map Y_map; - std::map B_map; - std::map Tau_map; + std::map Y_map; + std::map B_map; + std::map Tau_map; void ClearAnalysis(); }; diff --git a/create_database/tuple_reader/McGraphVisitors.cc b/create_database/tuple_reader/McGraphVisitors.cc index 60ca695..afc1688 100644 --- a/create_database/tuple_reader/McGraphVisitors.cc +++ b/create_database/tuple_reader/McGraphVisitors.cc @@ -44,7 +44,7 @@ void McGraphDfsVisitor::finish_vertex(Vertex u, const Graph &g) { // 1. Pointers to the daughter B mesons. void McGraphDfsVisitor::AnalyzeY(const Vertex &u, const Graph &g) { - McY mcY; + Y mcY; AdjacencyIterator ai, ai_end; for (tie(ai, ai_end) = adjacent_vertices(u, g); ai != ai_end; ++ai) { @@ -72,7 +72,7 @@ void McGraphDfsVisitor::AnalyzeY(const Vertex &u, const Graph &g) { // 3. MC type. See GraphDef.h. void McGraphDfsVisitor::AnalyzeB(const Vertex &u, const Graph &g) { - McB mcB; + B mcB; if (abs(get(lund_map, u)) == B0Lund) { mcB.flavor = static_cast(BFlavor::B0); @@ -100,7 +100,7 @@ void McGraphDfsVisitor::AnalyzeB(const Vertex &u, const Graph &g) { // 1. MC type. See GraphDef.h. void McGraphDfsVisitor::AnalyzeTau(const Vertex &u, const Graph &g) { - McTau mcTau; + Tau mcTau; AdjacencyIterator ai, ai_end; for (tie(ai, ai_end) = adjacent_vertices(u, g); ai != ai_end; ++ai) { diff --git a/create_database/tuple_reader/RecoGraphManager.cc b/create_database/tuple_reader/RecoGraphManager.cc index 602b241..fafd978 100644 --- a/create_database/tuple_reader/RecoGraphManager.cc +++ b/create_database/tuple_reader/RecoGraphManager.cc @@ -92,13 +92,13 @@ void RecoGraphManager::analyze_graph() { } // Access statistics of the ith Y candidate that are computed from graph analysis. -const RecoY* RecoGraphManager::get_recoY(int i) const { +const Y* RecoGraphManager::get_recoY(int i) const { std::map::const_iterator reco_vertex_it; reco_vertex_it = reco_vertex_map.find(reco_indexer(bdtaunu::UpsilonLund, i)); assert(reco_vertex_it != reco_vertex_map.end()); - std::map::const_iterator y_it; + std::map::const_iterator y_it; y_it = Y_map.find(reco_vertex_it->second); assert(y_it != Y_map.end()); diff --git a/create_database/tuple_reader/RecoGraphManager.h b/create_database/tuple_reader/RecoGraphManager.h index 6e29e30..7a9ce08 100644 --- a/create_database/tuple_reader/RecoGraphManager.h +++ b/create_database/tuple_reader/RecoGraphManager.h @@ -136,7 +136,7 @@ class RecoGraphManager : public GraphManager { int get_reco_index(int lund, int i) const { return reco_indexer(lund, i); } //! Access information about the `i`th Y candidate. See GraphDef.h. - const RecoGraph::RecoY* get_recoY(int i) const; + const RecoGraph::Y* get_recoY(int i) const; private: @@ -156,10 +156,10 @@ class RecoGraphManager : public GraphManager { std::vector &CandDauLund); // Graph analysis - std::map Y_map; - std::map B_map; - std::map D_map; - std::map Lepton_map; + std::map Y_map; + std::map B_map; + std::map D_map; + std::map Lepton_map; void ClearAnalysis(); }; diff --git a/create_database/tuple_reader/RecoGraphVisitors.cc b/create_database/tuple_reader/RecoGraphVisitors.cc index 6377478..7107190 100644 --- a/create_database/tuple_reader/RecoGraphVisitors.cc +++ b/create_database/tuple_reader/RecoGraphVisitors.cc @@ -54,7 +54,7 @@ void RecoGraphDfsVisitor::finish_vertex(Vertex u, const Graph &g) { // 1. D reconstruction mode. See RecoDTypeCatalogue.h for the definitions. void RecoGraphDfsVisitor::AnalyzeD(const Vertex &u, const Graph &g) { - RecoD recoD; + D recoD; // Compute D reconstruction mode. Scan all of its daughters and // look up the mode in recoD_catalogue. @@ -77,7 +77,7 @@ void RecoGraphDfsVisitor::AnalyzeD(const Vertex &u, const Graph &g) { // 2. Daughter D meson's reconstructed mode. void RecoGraphDfsVisitor::AnalyzeDstar(const Vertex &u, const Graph &g) { - RecoD recoD; + D recoD; // Scan all daughters and do the following: // 1. Look up Dstar mode in recoD_catalogue. @@ -120,7 +120,7 @@ void RecoGraphDfsVisitor::AnalyzeDstar(const Vertex &u, const Graph &g) { // used to access PID information later. void RecoGraphDfsVisitor::AnalyzeLepton(const Vertex &u, const Graph &g) { - RecoLepton recoLepton; + Lepton recoLepton; // Scan all daughters AdjacencyIterator ai, ai_end; @@ -171,7 +171,7 @@ void RecoGraphDfsVisitor::AnalyzeLepton(const Vertex &u, const Graph &g) { // the cache of the supervisor class (See BDtaunuReader.h). void RecoGraphDfsVisitor::AnalyzeB(const Vertex &u, const Graph &g) { - RecoB recoB; + B recoB; if (abs(get(lund_map, u)) == bdtaunu::B0Lund) { recoB.flavor = static_cast(bdtaunu::BFlavor::B0); @@ -213,7 +213,7 @@ void RecoGraphDfsVisitor::AnalyzeB(const Vertex &u, const Graph &g) { // the cache of the supervisor class (See BDtaunuReader.h). void RecoGraphDfsVisitor::AnalyzeY(const Vertex &u, const Graph &g) { - RecoY recoY; + Y recoY; AdjacencyIterator ai, ai_end; for (tie(ai, ai_end) = adjacent_vertices(u, g); ai != ai_end; ++ai) {