From df6313f5150a6428a7dfaddcc1da8ecec8f069b8 Mon Sep 17 00:00:00 2001 From: dchao Date: Fri, 19 Sep 2014 17:33:02 -0700 Subject: [PATCH] Got rid of dependency on the non-class enum D Dstar modes --- create_database/tuple_reader/BDtaunuDef.h | 156 ------------------ .../tuple_reader/BDtaunuMcReader.cc | 6 +- .../tuple_reader/McBTypeCatalogue.h | 12 +- create_database/tuple_reader/Particles.h | 8 +- .../tuple_reader/RecoDTypeCatalogue.h | 46 +++--- .../tuple_reader/UpsilonCandidate.cc | 21 +-- 6 files changed, 52 insertions(+), 197 deletions(-) diff --git a/create_database/tuple_reader/BDtaunuDef.h b/create_database/tuple_reader/BDtaunuDef.h index 3fa7bd8..8b1af85 100644 --- a/create_database/tuple_reader/BDtaunuDef.h +++ b/create_database/tuple_reader/BDtaunuDef.h @@ -36,37 +36,6 @@ enum BFlavor { kUndefinedBFlavor = -1, /*!< Undefined */ }; -//! Reconstructed D decay modes. -enum DMode { - kDc_Kpipi = 1, /*!< \f$ D^+\rightarrow K^-\pi^+\pi^- \f$ */ - kDc_Kpipipi0 = 2, /*!< \f$ D^+\rightarrow K^-\pi^+\pi^-\pi^0 \f$ */ - kDc_KsK = 3, /*!< \f$ D^+\rightarrow K_s K^+ \f$ */ - kDc_Kspi = 4, /*!< \f$ D^+\rightarrow K_s\pi^+ \f$ */ - kDc_Kspipi0 = 5, /*!< \f$ D^+\rightarrow K_s\pi^+\pi^0 \f$ */ - kDc_Kspipipi = 6, /*!< \f$ D^+\rightarrow K_s\pi^+\pi^-\pi^+ \f$ */ - kDc_KKpi = 7, /*!< \f$ D^+\rightarrow K^+K^-\pi^+ \f$ */ - kD0_Kpi = 8, /*!< \f$ D^0\rightarrow K^-\pi^+ \f$ */ - kD0_Kpipi0 = 9, /*!< \f$ D^0\rightarrow K^-\pi^+\pi^0 \f$ */ - kD0_Kpipipi = 10, /*!< \f$ D^0\rightarrow K^-\pi^+\pi^+\pi^- \f$ */ - kD0_Kpipipipi0 = 11, /*!< \f$ D^0\rightarrow K^-\pi^+\pi^+\pi^-\pi^0 \f$ */ - kD0_Kspipi = 12, /*!< \f$ D^0\rightarrow K_s\pi^+\pi^- \f$ */ - kD0_Kspipipi0 = 13, /*!< \f$ D^0\rightarrow K_s\pi^+\pi^-\pi^0 \f$ */ - kD0_Kspi0 = 14, /*!< \f$ D^0\rightarrow K_s\pi^0 \f$ */ - kD0_KK = 15, /*!< \f$ D^0\rightarrow K^+K^- \f$ */ - kUndefinedDMode = -1, /*!< Undefined */ -}; - -//! Reconstructed D* decay modes. -enum DstarMode { - kNoDstar = 0, /*!< No \f$ D^* \f$ in \f$ B \f$ decay */ - kDstar0_D0pi0 = 1, /*!< \f$ D^{*0}\rightarrow D^0\pi^0 \f$ */ - kDstar0_D0gamma = 2, /*!< \f$ D^{*0}\rightarrow D^0\gamma \f$ */ - kDstarc_D0pi = 3, /*!< \f$ D^{*+}\rightarrow D^0\pi^+ \f$ */ - kDstarc_Dcpi0 = 4, /*!< \f$ D^{*+}\rightarrow D^+\pi^0 \f$ */ - kDstarc_Dcgamma = 5, /*!< \f$ D^{*+}\rightarrow D^+\gamma \f$ */ - kUndefinedDstarMode = -1, /*!< Undefined */ -}; - //! Reconstructed tau decay modes. enum TauMode { ktau_pi = 1, /*!< \f$ \tau^+\rightarrow \pi^+ \f$ */ @@ -109,64 +78,6 @@ enum SampleType { kUndefinedSampleType = -1, /*!< Undefined */ }; -//! Truth B MC Types. -/*! This labels truth \f$B\f$ mesons into various decay categories - * that will be helpful in characterizing whether the event is signal - * or background. - * - * The label is done by examining the \f$B\f$ meson's decay daughters. - * - * \f$B\f$ \f$\gamma\f$ daughters are currently ignored in determining - * the MC type. However, the energy of the photon with the highest energy - * is saved; one can use this to determine whether the event has radiative - * photons involved. Therefore, the following descriptions omit the - * \f$+n\gamma\f$, \f$n\geq0\f$, though this is needed to be technically - * correct. */ -enum BMcType { - - //! No truth \f$B\f$ mesons. - kCont = 0, - - //! Truth \f$B\f$ decays as \f$B\rightarrow D\tau\nu_\tau\f$. - kDtau = 1, - - //! Truth \f$B\f$ decays as \f$B\rightarrow D^{*}\tau\nu_\tau\f$. - kDstartau = 2, - - //! Truth \f$B\f$ decays as \f$B\rightarrow D\ell\nu_\ell\f$ - /*! \f$\ell=e,\,\mu\f$. */ - kDl = 3, - - //! Truth \f$B\f$ decays as \f$B\rightarrow D^{*}\ell\nu_\ell\f$ - /*! \f$\ell=e,\,\mu\f$. */ - kDstarl = 4, - - //! Truth \f$B\f$ decays as \f$B\rightarrow D^{**}\ell\nu_\ell X\f$ - /*! \f$X\f$ is any sequence of particles. */ - kDstarstar_res = 5, - - //! Truth \f$B\f$ decays as \f$B\rightarrow D^{(*)}n\pi^{\pm,0}\ell\nu_\ell X\f$ - /*! \f$X\f$ is any sequence of particles. */ - kDstarstar_nonres = 6, - - //! Truth \f$B\f$ decays as \f$B\rightarrow X\ell\nu_\ell\f$ - /*! \f$X\f$ is any sequence of particles not involving a charm meson. */ - kCharmless_SL = 7, - - //! Truth \f$B\f$ decays hadronically. Daughters contain no charm mesons. - k0Charm_Had = 8, - - //! Truth \f$B\f$ decays hadronically. Daughters contain 1 charm meson. - k1Charm_Had = 9, - - //! Truth \f$B\f$ decays hadronically. Daughters contain 2 charm mesons. - k2Charm_Had = 10, - - //! Undefined B MC type. Indicates error. - kUndefinedBMcType = -1, -}; - - //! Truth \f$\tau\f$ MC Types. See Details. /*! Truth \f$\tau\f$ MC Types for truth \f$B\f$'s decaying as * \f$B\rightarrow D^{(*)}\tau\nu_\tau\f$. Any other \f$B\f$ decay types @@ -191,73 +102,6 @@ enum TauMcType { }; -//! MC Event Types, Definition A. This will soon be obsolete. -/*! This labels Monte Carlo events into various signal and background - * truth categories. - * - * The categorization is based on the #BMcType of the two truth - * \f$B\f$ mesons. */ -enum McEventTypeA { - - //! \f$B\rightarrow D\tau\nu_\tau\f$ signal event. - /*! An event is in this category if there exists at least one truth \f$B\f$ - * which decays in the mode \f$B\rightarrow D\tau\nu_\tau\f$. - * If one truth \f$B\f$ is \f$B\rightarrow D\tau\nu_\tau\f$ and the other - * is \f$B\rightarrow D\tau\nu_\tau\f$, then it is assigned with probability - * 0.5 to either #kDtau_SigA or #kDstartau_SigA. */ - kDtau_SigA = 0, - - //! \f$B\rightarrow D^*\tau\nu_\tau\f$ signal event. - /*! An event is in this category there exists at least one truth \f$B\f$ - * which decays in the mode \f$B\rightarrow D^*\tau\nu_\tau\f$. - * If one truth \f$B\f$ is \f$B\rightarrow D\tau\nu_\tau\f$ and the other - * is \f$B\rightarrow D\tau\nu_\tau\f$, then it is assigned with probability - * 0.5 to either #kDtau_SigA or #kDstartau_SigA. */ - kDstartau_SigA = 1, - - //! \f$B\rightarrow D\ell\nu_\ell\f$ normalization event. - /*! An event is in this category if there exists at least one truth \f$B\f$ - * which decays in the mode \f$B\rightarrow D\ell\nu_\ell\f$, - * and the event is neither #kDtau_SigA, #kDstartau_SigA, or #kDstarstar_BkgA. - * - * If one truth \f$B\f$ is \f$B\rightarrow D\ell\nu_\ell\f$ and the other - * is \f$B\rightarrow D\ell\nu_\ell\f$, then it is assigned with probability - * 0.5 to either #kDl_NormA or #kDstarl_NormA. */ - kDl_NormA = 2, - - //! \f$B\rightarrow D^*\ell\nu_\ell\f$ normalization event. - /*! An event is in this category there exists at least one truth \f$B\f$ - * which decays in the mode \f$B\rightarrow D^*\ell\nu_\ell\f$, - * and the event is neither #kDtau_SigA, #kDstartau_SigA, or #kDstarstar_BkgA. - * - * If one truth \f$B\f$ is \f$B\rightarrow D\ell\nu_\ell\f$ and the other - * is \f$B\rightarrow D\ell\nu_\ell\f$, then it is assigned with probability - * 0.5 to either #kDl_NormA or #kDstarl_NormA. */ - kDstarl_NormA = 3, - - //! \f$D^{**}\f$ background event. - /*! The event has at least one truth \f$B\f$ with #BMcType #kDstarstar_SL, - * and the event is neither #kDtau_Sig or #kDstartau_Sig. */ - kDstarstar_BkgA = 4, - - //! Semileptonic background. - /*! Event when one truth \f$B\f$ mesons is either #k0Charm_Had, - * #k1Charm_Had, or #k2Charm_Had, and the other is either #kD_SL, - * #kDstarstar_SL, or #k0Charm_SL. */ - kSL_BkgA = 5, - - //! Hadronic background. - /*! Event when both truth \f$B\f$ mesons are either #k0Charm_Had, - * #k1Charm_Had, or #k2Charm_Had. */ - kHad_BkgA = 6, - - //! Continuum background. - kCont_BkgA = 7, - - //! Undefined MC event type. Indicates error. - kUndefinedMcEventTypeA = -1, -}; - } #endif diff --git a/create_database/tuple_reader/BDtaunuMcReader.cc b/create_database/tuple_reader/BDtaunuMcReader.cc index 31f8f51..b940abe 100644 --- a/create_database/tuple_reader/BDtaunuMcReader.cc +++ b/create_database/tuple_reader/BDtaunuMcReader.cc @@ -55,9 +55,9 @@ void BDtaunuMcReader::AllocateBuffer() { // Zeros out buffer elements void BDtaunuMcReader::ClearBuffer() { mcLen = -999; - continuum = false; - b1_mctype = static_cast(McBTypeCatalogue::BType::null); - b2_mctype = static_cast(McBTypeCatalogue::BType::null); + continuum = true; + b1_mctype = static_cast(McBTypeCatalogue::BType::NoB); + b2_mctype = static_cast(McBTypeCatalogue::BType::NoB); b1_tau_mctype = bdtaunu::kUndefinedTauMcType; b2_tau_mctype = bdtaunu::kUndefinedTauMcType; } diff --git a/create_database/tuple_reader/McBTypeCatalogue.h b/create_database/tuple_reader/McBTypeCatalogue.h index 454f005..1ffcdd4 100644 --- a/create_database/tuple_reader/McBTypeCatalogue.h +++ b/create_database/tuple_reader/McBTypeCatalogue.h @@ -14,8 +14,16 @@ class McBTypeCatalogue { }; enum class BType { - Dtau = 1, Dstartau, Dl, Dstarl, - Dstarstar_res, Dstarstar_nonres, SL, Had, null = -1, + NoB = 0, + Dtau = 1, + Dstartau, + Dl, + Dstarl, + Dstarstar_res, + Dstarstar_nonres, + SL, + Had, + null = -1, }; McBTypeCatalogue() { RegisterDecays(); } diff --git a/create_database/tuple_reader/Particles.h b/create_database/tuple_reader/Particles.h index 060aee1..e393496 100644 --- a/create_database/tuple_reader/Particles.h +++ b/create_database/tuple_reader/Particles.h @@ -3,6 +3,8 @@ #include "BDtaunuDef.h" #include "GraphDef.h" +#include "RecoDTypeCatalogue.h" +#include "McBTypeCatalogue.h" /** @file Particles.h * Information of specific types of particles that are computed @@ -28,8 +30,8 @@ struct RecoB { struct RecoD { RecoD() = default; - int D_mode = bdtaunu::kUndefinedDMode; - int Dstar_mode = bdtaunu::kUndefinedDstarMode; + int D_mode = static_cast(RecoDTypeCatalogue::DType::null); + int Dstar_mode = static_cast(RecoDTypeCatalogue::DstarType::NoDstar); }; struct RecoLepton { @@ -51,7 +53,7 @@ struct McY { struct McB { McB() = default; int flavor = bdtaunu::kUndefinedBFlavor; - int mc_type = bdtaunu::kUndefinedBMcType; + int mc_type = static_cast(McBTypeCatalogue::BType::null); McTau *tau = nullptr; }; diff --git a/create_database/tuple_reader/RecoDTypeCatalogue.h b/create_database/tuple_reader/RecoDTypeCatalogue.h index 31ed87c..dc0d23c 100644 --- a/create_database/tuple_reader/RecoDTypeCatalogue.h +++ b/create_database/tuple_reader/RecoDTypeCatalogue.h @@ -13,32 +13,32 @@ class RecoDTypeCatalogue { }; enum class DType { - Dc_Kpipi = 1, - Dc_Kpipipi0, - Dc_KsK, - Dc_Kspi, - Dc_Kspipi0, - Dc_Kspipipi, - Dc_KKpi, - D0_Kpi, - D0_Kpipi0, - D0_Kpipipi, - D0_Kpipipipi0, - D0_Kspipi, - D0_Kspipipi0, - D0_Kspi0, - D0_KK, - null = -1, + Dc_Kpipi = 1, /*!< \f$ D^+\rightarrow K^-\pi^+\pi^- \f$ */ + Dc_Kpipipi0 = 2, /*!< \f$ D^+\rightarrow K^-\pi^+\pi^-\pi^0 \f$ */ + Dc_KsK = 3, /*!< \f$ D^+\rightarrow K_s K^+ \f$ */ + Dc_Kspi = 4, /*!< \f$ D^+\rightarrow K_s\pi^+ \f$ */ + Dc_Kspipi0 = 5, /*!< \f$ D^+\rightarrow K_s\pi^+\pi^0 \f$ */ + Dc_Kspipipi = 6, /*!< \f$ D^+\rightarrow K_s\pi^+\pi^-\pi^+ \f$ */ + Dc_KKpi = 7, /*!< \f$ D^+\rightarrow K^+K^-\pi^+ \f$ */ + D0_Kpi = 8, /*!< \f$ D^0\rightarrow K^-\pi^+ \f$ */ + D0_Kpipi0 = 9, /*!< \f$ D^0\rightarrow K^-\pi^+\pi^0 \f$ */ + D0_Kpipipi = 10, /*!< \f$ D^0\rightarrow K^-\pi^+\pi^+\pi^- \f$ */ + D0_Kpipipipi0 = 11, /*!< \f$ D^0\rightarrow K^-\pi^+\pi^+\pi^-\pi^0 \f$ */ + D0_Kspipi = 12, /*!< \f$ D^0\rightarrow K_s\pi^+\pi^- \f$ */ + D0_Kspipipi0 = 13, /*!< \f$ D^0\rightarrow K_s\pi^+\pi^-\pi^0 \f$ */ + D0_Kspi0 = 14, /*!< \f$ D^0\rightarrow K_s\pi^0 \f$ */ + D0_KK = 15, /*!< \f$ D^0\rightarrow K^+K^- \f$ */ + null = -1, /*!< Undefined */ }; enum class DstarType { - NoDstar = 0, - Dstar0_D0pi0, - Dstar0_D0gamma, - Dstarc_D0pi, - Dstarc_Dcpi0, - Dstarc_Dcgamma, - null = -1, + NoDstar = 0, /*!< No \f$ D^* \f$ in \f$ B \f$ decay */ + Dstar0_D0pi0 = 1, /*!< \f$ D^{*0}\rightarrow D^0\pi^0 \f$ */ + Dstar0_D0gamma = 2, /*!< \f$ D^{*0}\rightarrow D^0\gamma \f$ */ + Dstarc_D0pi = 3, /*!< \f$ D^{*+}\rightarrow D^0\pi^+ \f$ */ + Dstarc_Dcpi0 = 4, /*!< \f$ D^{*+}\rightarrow D^+\pi^0 \f$ */ + Dstarc_Dcgamma = 5, /*!< \f$ D^{*+}\rightarrow D^+\gamma \f$ */ + null = -1, /*!< Undefined */ }; RecoDTypeCatalogue() { RegisterDecays(); } diff --git a/create_database/tuple_reader/UpsilonCandidate.cc b/create_database/tuple_reader/UpsilonCandidate.cc index a0f9c10..b8dcd0c 100644 --- a/create_database/tuple_reader/UpsilonCandidate.cc +++ b/create_database/tuple_reader/UpsilonCandidate.cc @@ -2,6 +2,7 @@ #include #include "BDtaunuDef.h" +#include "RecoDTypeCatalogue.h" #include "UpsilonCandidate.h" UpsilonCandidate::UpsilonCandidate() : @@ -19,8 +20,8 @@ UpsilonCandidate::UpsilonCandidate() : tag_deltaM(-999), tag_cosThetaDSoft(-999), tag_softP3MagCM(-999), - tag_d_mode(bdtaunu::kUndefinedDMode), - tag_dstar_mode(bdtaunu::kUndefinedDstarMode), + tag_d_mode(static_cast(RecoDTypeCatalogue::DType::null)), + tag_dstar_mode(static_cast(RecoDTypeCatalogue::DstarType::null)), l_ePidMap(0), l_muPidMap(0), sig_hp3(-999), @@ -33,8 +34,8 @@ UpsilonCandidate::UpsilonCandidate() : sig_softP3MagCM(-999), sig_hmass(-999), sig_vtxh(-999), - sig_d_mode(bdtaunu::kUndefinedDMode), - sig_dstar_mode(bdtaunu::kUndefinedDstarMode), + sig_d_mode(static_cast(RecoDTypeCatalogue::DType::null)), + sig_dstar_mode(static_cast(RecoDTypeCatalogue::DstarType::null)), sig_tau_mode(bdtaunu::kUndefinedTauMode), h_ePidMap(0), h_muPidMap(0) {} @@ -158,15 +159,15 @@ void UpsilonCandidate::copy_candidate(const UpsilonCandidate &cand) { int UpsilonCandidate::get_cand_type() const { assert(sig_tau_mode != bdtaunu::kUndefinedTauMode); - assert(tag_dstar_mode != bdtaunu::kUndefinedDstarMode); - assert(sig_dstar_mode != bdtaunu::kUndefinedDstarMode); + assert(tag_dstar_mode != static_cast(RecoDTypeCatalogue::DstarType::null)); + assert(sig_dstar_mode != static_cast(RecoDTypeCatalogue::DstarType::null)); int cand_type = 0; if (sig_tau_mode == bdtaunu::ktau_rho) cand_type += (1 << 2); - if (tag_dstar_mode != bdtaunu::kNoDstar) + if (tag_dstar_mode != static_cast(RecoDTypeCatalogue::DstarType::NoDstar)) cand_type += (1 << 1); - if (sig_dstar_mode != bdtaunu::kNoDstar) + if (sig_dstar_mode != static_cast(RecoDTypeCatalogue::DstarType::NoDstar)) cand_type += 1; return cand_type; @@ -178,12 +179,12 @@ int UpsilonCandidate::get_cand_type() const { int UpsilonCandidate::get_sample_type() const { assert(bflavor != bdtaunu::kUndefinedBFlavor); - assert(sig_dstar_mode != bdtaunu::kUndefinedDstarMode); + assert(sig_dstar_mode != static_cast(RecoDTypeCatalogue::DstarType::null)); int sample_type = 0; if (bflavor == bdtaunu::kB0) sample_type += (1 << 1); - if (sig_dstar_mode != bdtaunu::kNoDstar) + if (sig_dstar_mode != static_cast(RecoDTypeCatalogue::DstarType::NoDstar)) sample_type += 1; return sample_type;