diff --git a/build_generic_db.cc b/build_generic_db.cc index 3fd21fc..b92ae9d 100644 --- a/build_generic_db.cc +++ b/build_generic_db.cc @@ -108,10 +108,10 @@ int main() { event_builder.set_run(run); event_builder.set_sp_mode(sp_modes[sp]); event_builder.set_event_weight(event_weights[pair(sp_modes[sp], run)]); - event_builder.set_b1mctype(rootreader.get_b1mctype()); - event_builder.set_b2mctype(rootreader.get_b2mctype()); - event_builder.set_b1_taumctype(rootreader.get_b1_taumctype()); - event_builder.set_b2_taumctype(rootreader.get_b2_taumctype()); + event_builder.set_b1_mctype(rootreader.get_b1_mctype()); + event_builder.set_b2_mctype(rootreader.get_b2_mctype()); + event_builder.set_b1_tau_mctype(rootreader.get_b1_tau_mctype()); + event_builder.set_b2_tau_mctype(rootreader.get_b2_tau_mctype()); event_builder.set_b1_dtau_max_photon_energy(rootreader.get_b1_dtau_max_photon_energy()); event_builder.set_b2_dtau_max_photon_energy(rootreader.get_b2_dtau_max_photon_energy()); event_builder.set_nTrk(rootreader.get_nTrk()); @@ -158,6 +158,8 @@ int main() { candidate_builder.set_sig_vtxh(curr_cand.get_sig_vtxh()); candidate_builder.set_sig_Dtype(curr_cand.get_sig_d_mode()); candidate_builder.set_sig_Dstartype(curr_cand.get_sig_dstar_mode()); + candidate_builder.set_tag_l_ePid(curr_cand.get_l_ePidMap()); + candidate_builder.set_tag_l_muPid(curr_cand.get_l_muPidMap()); candidate_builder.set_svm_score(svm_scorer.get_score()); candidate_builder.InsertTable(); diff --git a/create_database/BDtaunuMcReader.cc b/create_database/BDtaunuMcReader.cc index 7aa54ed..b836822 100644 --- a/create_database/BDtaunuMcReader.cc +++ b/create_database/BDtaunuMcReader.cc @@ -149,15 +149,15 @@ void BDtaunuMcReader::ClearColumnValues() { McB1.bflavor = kUndefinedBFlavor; McB1.mc_idx = -1; - McB1.bmctype = kUndefinedBMcType; + McB1.b_mctype = kUndefinedBMcType; + McB1.tau_mctype = kUndefinedTauMcType; McB1.dtau_max_photon_energy = -1; - McB1.taumctype = ktau_undefined_mc; McB2.bflavor = kUndefinedBFlavor; McB2.mc_idx = -1; - McB2.bmctype = kUndefinedBMcType; + McB2.b_mctype = kUndefinedBMcType; + McB2.tau_mctype = kUndefinedTauMcType; McB2.dtau_max_photon_energy = -1; - McB2.taumctype = ktau_undefined_mc; } // Find the MC B meson's from the mcLund array of the event. Determine @@ -207,19 +207,23 @@ void BDtaunuMcReader::DetermineBMcType(McBMeson &mcB) { // Return if no MC B mesons are in the event. if (mcB.mc_idx == -1) { - mcB.bmctype = kCont; + mcB.b_mctype = kCont; return; } // Count the number of daughters of the first generation B daughters // and record the lundId of relevant daughters. int n_daughters = 0; + + int n_ell, n_nu; + n_ell = n_nu = 0; + + int n_d, n_dstar, n_dstarstar, n_dstrange, n_pi, n_other; + n_d = n_dstar = n_dstarstar = n_dstrange = n_pi = n_other = 0; + int ell_lund, nu_lund; ell_lund = nu_lund = 0; - int n_ell, n_nu, n_d, n_dstar, n_dstarstar, n_dstrange, n_pi, n_other; - n_ell = n_nu = n_d = n_dstar = n_dstarstar = n_dstrange = n_pi = n_other = 0; - - int ell_idx = -1; + int ell_mcidx = -1; // Scan through the entire first generation daughter. int begin_dauIdx = dauIdx[mcB.mc_idx]; @@ -239,7 +243,7 @@ void BDtaunuMcReader::DetermineBMcType(McBMeson &mcB) { if (std::binary_search(ell.begin(), ell.end(), abs(mcLund[i]))) { n_ell += 1; ell_lund = abs(mcLund[i]); - ell_idx = i; + ell_mcidx = i; } else if (std::binary_search(nu.begin(), nu.end(), abs(mcLund[i]))) { n_nu += 1; nu_lund = abs(mcLund[i]); @@ -261,67 +265,67 @@ void BDtaunuMcReader::DetermineBMcType(McBMeson &mcB) { // Determine the B MC Type. See bdtaunu_definitions.h for the // definitions. if (n_ell == 1 && n_nu == 1) { - if (n_d == 1) { - if (n_daughters == 3) { - if (ell_lund == abs(lundIdMap["tau-"])) { - mcB.bmctype = kDtau; - } else { - mcB.bmctype = kDl; - } - } else if (n_pi > 0) { - mcB.bmctype = kDstarstar_nonres; - } else { - mcB.bmctype = kD_SL; - } - } else if (n_dstar == 1) { + if (n_d + n_dstar + n_dstarstar == 0) { + mcB.b_mctype = kCharmless_SL; + } else if (n_dstarstar > 0) { + mcB.b_mctype = kDstarstar_res; + } else { + assert(n_d + n_dstar == 1); if (n_daughters == 3) { if (ell_lund == abs(lundIdMap["tau-"])) { - mcB.bmctype = kDstartau; + if (n_d == 1) { + mcB.b_mctype = kDtau; + } else { + mcB.b_mctype = kDstartau; + } } else { - mcB.bmctype = kDstarl; + if (n_d == 1) { + mcB.b_mctype = kDl; + } else { + mcB.b_mctype = kDstarl; + } } - } else if (n_pi > 0) { - mcB.bmctype = kDstarstar_nonres; } else { - mcB.bmctype = kD_SL; + mcB.b_mctype = kDstarstar_nonres; } - } else if (n_dstarstar == 1) { - mcB.bmctype = kDstarstar_res; - } else if (n_d + n_dstar + n_dstarstar == 0) { - mcB.bmctype = k0D_SL; - } else { - mcB.bmctype = kUndefinedBMcType; } } else if (n_ell == 0 && n_nu == 0) { - int nD = n_dstarstar + n_dstrange + n_d; + int nD = n_d + n_dstar + n_dstarstar + n_dstrange; if (nD == 0) { - mcB.bmctype = k0Charm_Had; + mcB.b_mctype = k0Charm_Had; } else if (nD == 1) { - mcB.bmctype = k1Charm_Had; + mcB.b_mctype = k1Charm_Had; } else if (nD == 2) { - mcB.bmctype = k2Charm_Had; + mcB.b_mctype = k2Charm_Had; } else { - mcB.bmctype = kUndefinedBMcType; + mcB.b_mctype = kUndefinedBMcType; } } else { - mcB.bmctype = kUndefinedBMcType; + mcB.b_mctype = kUndefinedBMcType; } // Determine tau mc type - if (mcB.bmctype == kDtau || mcB.bmctype == kDstartau) { - mcB.taumctype = ktau_had_mc; + if (mcB.b_mctype == kDtau || mcB.b_mctype == kDstartau) { + mcB.tau_mctype = ktau_h_mc; - int begin_dauIdx = dauIdx[ell_idx]; - int end_dauIdx = begin_dauIdx + dauLen[ell_idx]; + int begin_dauIdx = dauIdx[ell_mcidx]; + int end_dauIdx = begin_dauIdx + dauLen[ell_mcidx]; for (int i = begin_dauIdx; i < end_dauIdx; i++) { - if (abs(mcLund[i]) == lundIdMap["e-"]) { - mcB.taumctype = ktau_e_mc; - } else if (abs(mcLund[i]) == lundIdMap["mu-"]) { - mcB.taumctype = ktau_mu_mc; + if (abs(mcLund[i]) == abs(lundIdMap["e-"])) { + mcB.tau_mctype = ktau_e_mc; + break; + } else if (abs(mcLund[i]) == abs(lundIdMap["mu-"])) { + mcB.tau_mctype = ktau_mu_mc; + break; + } else if (abs(mcLund[i]) == abs(lundIdMap["K-"])) { + mcB.tau_mctype = ktau_k_mc; + break; } else { continue; } } + } else { + mcB.tau_mctype = kUndefinedTauMcType; } } diff --git a/create_database/BDtaunuMcReader.h b/create_database/BDtaunuMcReader.h index 0b8998e..4f5e063 100644 --- a/create_database/BDtaunuMcReader.h +++ b/create_database/BDtaunuMcReader.h @@ -43,13 +43,15 @@ class BDtaunuMcReader : public BDtaunuReader { struct McBMeson { int bflavor; int mc_idx; - int bmctype; + int b_mctype; + int tau_mctype; double dtau_max_photon_energy; - int taumctype; McBMeson() : bflavor(kUndefinedBFlavor), - mc_idx(-1), bmctype(kUndefinedBMcType), - dtau_max_photon_energy(-1), taumctype(ktau_undefined_mc) {}; + mc_idx(-1), + b_mctype(kUndefinedBMcType), + tau_mctype(kUndefinedTauMcType), + dtau_max_photon_energy(-1) {}; } McB1, McB2; private: @@ -84,15 +86,26 @@ class BDtaunuMcReader : public BDtaunuReader { //! B MC type of first truth B. /*! Returns an int that corresponds to the #BMcType enum in */ - int get_b1mctype() const { return McB1.bmctype; } + int get_b1_mctype() const { return McB1.b_mctype; } //! B MC type of second truth B. /*! Returns an int that corresponds to the #BMcType enum in */ - int get_b2mctype() const { return McB2.bmctype; } + int get_b2_mctype() const { return McB2.b_mctype; } - int get_b1_taumctype() const { return McB1.taumctype; } - int get_b2_taumctype() const { return McB2.taumctype; } + //! tau MC type of first truth B + /*! Returns an int corresponding to #TauMcType enum. */ + int get_b1_tau_mctype() const { return McB1.tau_mctype; } + + //! tau MC type of second truth B + /*! Returns an int corresponding to #TauMcType enum. */ + int get_b2_tau_mctype() const { return McB2.tau_mctype; } + + //! Energy of the highest energy photon of first truth B. + /*! Returns -1 if no photons exist. */ double get_b1_dtau_max_photon_energy() const { return McB1.dtau_max_photon_energy; } + + //! Energy of the highest energy photon of second truth B. + /*! Returns -1 if no photons exist. */ double get_b2_dtau_max_photon_energy() const { return McB2.dtau_max_photon_energy; } }; diff --git a/create_database/BDtaunuReader.cc b/create_database/BDtaunuReader.cc index 349f39b..1c29f4f 100644 --- a/create_database/BDtaunuReader.cc +++ b/create_database/BDtaunuReader.cc @@ -97,6 +97,13 @@ void BDtaunuReader::Initialize() { YSigBhMass = new float[maximum_Y_candidates]; YSigBVtxProbh = new float[maximum_Y_candidates]; + lTrkIdx = new int[maximum_l_candidates]; + hTrkIdx = new int[maximum_h_candidates]; + eSelectorsMap = new int[maximum_h_candidates + maximum_l_candidates]; + muSelectorsMap = new int[maximum_h_candidates + maximum_l_candidates]; + KSelectorsMap = new int[maximum_h_candidates + maximum_l_candidates]; + piSelectorsMap = new int[maximum_h_candidates + maximum_l_candidates]; + Yd1Idx = new int[maximum_Y_candidates]; Yd2Idx = new int[maximum_Y_candidates]; Bd1Idx = new int[maximum_B_candidates]; @@ -160,6 +167,12 @@ void BDtaunuReader::SetBranchAddress() { tr->SetBranchAddress("YSigBsoftP3MagCM", YSigBsoftP3MagCM); tr->SetBranchAddress("YSigBhMass", YSigBhMass); tr->SetBranchAddress("YSigBVtxProbh", YSigBVtxProbh); + tr->SetBranchAddress("lTrkIdx", lTrkIdx); + tr->SetBranchAddress("hTrkIdx", hTrkIdx); + tr->SetBranchAddress("eSelectorsMap", eSelectorsMap); + tr->SetBranchAddress("muSelectorsMap", muSelectorsMap); + tr->SetBranchAddress("KSelectorsMap", KSelectorsMap); + tr->SetBranchAddress("piSelectorsMap", piSelectorsMap); tr->SetBranchAddress("Yd1Idx", Yd1Idx); tr->SetBranchAddress("Yd2Idx", Yd2Idx); tr->SetBranchAddress("Bd1Idx", Bd1Idx); @@ -218,6 +231,10 @@ void BDtaunuReader::FillUpsilonList() { bflavor, tag_dstar_mode, tag_d_mode, sig_dstar_mode, sig_d_mode, sig_tau_mode); + // Get PID info of the candidate. + int l_ePidMap, l_muPidMap; + ComputeCandidatePid(cand_idx, l_ePidMap, l_muPidMap); + // Construct an UpsilonCandidate object and fill in its features. UpsilonCandidate cand(eventId, cand_idx, YBPairEextra50[cand_idx], YBPairMmissPrime2[cand_idx], @@ -234,7 +251,8 @@ void BDtaunuReader::FillUpsilonList() { bflavor, tag_dstar_mode, tag_d_mode, sig_dstar_mode, sig_d_mode, - sig_tau_mode); + sig_tau_mode, + l_ePidMap, l_muPidMap); // Add it to the UpsilonList. upsilon_candidates.add_candidate(cand); @@ -319,6 +337,24 @@ void BDtaunuReader::ComputeCandidateDecay( } +void BDtaunuReader::ComputeCandidatePid( + int cand_idx, + int &l_ePidMap, int &l_muPidMap) { + + int tagBIdx = Yd1Idx[cand_idx]; + int lIdx = Bd2Idx[tagBIdx]; + int ltrkIdx = lTrkIdx[lIdx]; + + assert( + abs(Bd2Lund[tagBIdx]) == abs(lundIdMap["e+"]) || + abs(Bd2Lund[tagBIdx]) == abs(lundIdMap["mu+"]) + ); + + l_ePidMap = eSelectorsMap[ltrkIdx]; + l_muPidMap = muSelectorsMap[ltrkIdx]; + +} + BDtaunuReader::~BDtaunuReader() { delete[] YBPairMmissPrime2; @@ -341,6 +377,12 @@ BDtaunuReader::~BDtaunuReader() { delete[] YSigBsoftP3MagCM; delete[] YSigBhMass; delete[] YSigBVtxProbh; + delete[] lTrkIdx; + delete[] hTrkIdx; + delete[] eSelectorsMap; + delete[] muSelectorsMap; + delete[] KSelectorsMap; + delete[] piSelectorsMap; delete[] Yd1Idx; delete[] Yd2Idx; delete[] Bd1Idx; diff --git a/create_database/BDtaunuReader.h b/create_database/BDtaunuReader.h index fee2002..a2b60d7 100644 --- a/create_database/BDtaunuReader.h +++ b/create_database/BDtaunuReader.h @@ -56,6 +56,9 @@ class BDtaunuReader : public RootReader { float *YSigBCosThetaDSoftCM, *YSigBsoftP3MagCM; float *YSigBhMass, *YSigBVtxProbh; + int *lTrkIdx, *hTrkIdx; + int *eSelectorsMap, *muSelectorsMap, *KSelectorsMap, *piSelectorsMap; + protected: int nY, nB, nD; int ntau, nh, nl, ngamma; @@ -85,6 +88,10 @@ class BDtaunuReader : public RootReader { int Dd3_lundId, int Dd4_lundId, int Dd5_lundId); int DetermineTauMode(int taud1_lundId); + void ComputeCandidatePid( + int cand_idx, + int &l_ePidMap, int &l_muPidMap); + protected: virtual void Initialize(); diff --git a/create_database/CandidateSQLiteTableBuilder.cc b/create_database/CandidateSQLiteTableBuilder.cc index 088261a..e7d1ea8 100644 --- a/create_database/CandidateSQLiteTableBuilder.cc +++ b/create_database/CandidateSQLiteTableBuilder.cc @@ -43,6 +43,8 @@ CandidateSQLiteTableBuilder::CandidateSQLiteTableBuilder(sqlite3* database) : cand_level_feature_colnames.push_back(std::pair("sig_vtxh", "REAL")); cand_level_feature_colnames.push_back(std::pair("sig_Dtype", "INTEGER")); cand_level_feature_colnames.push_back(std::pair("sig_Dstartype", "INTEGER")); + cand_level_feature_colnames.push_back(std::pair("tag_l_ePid", "INTEGER")); + cand_level_feature_colnames.push_back(std::pair("tag_l_muPid", "INTEGER")); bestcand_colnames.push_back(std::pair("svm_score", "REAL")); } @@ -209,6 +211,10 @@ void CandidateSQLiteTableBuilder::BindColumns() { assert(db_status == SQLITE_OK); db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@sig_Dstartype"), sig_Dstartype); assert(db_status == SQLITE_OK); + db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@tag_l_ePid"), tag_l_ePid); + assert(db_status == SQLITE_OK); + db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@tag_l_muPid"), tag_l_muPid); + assert(db_status == SQLITE_OK); db_status = sqlite3_bind_double(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@svm_score"), svm_score); assert(db_status == SQLITE_OK); } diff --git a/create_database/CandidateSQLiteTableBuilder.h b/create_database/CandidateSQLiteTableBuilder.h index c1c469c..9887f29 100644 --- a/create_database/CandidateSQLiteTableBuilder.h +++ b/create_database/CandidateSQLiteTableBuilder.h @@ -53,6 +53,8 @@ class CandidateSQLiteTableBuilder : public SQLiteTableBuilder { double sig_vtxh; int sig_Dtype; int sig_Dstartype; + int tag_l_ePid; + int tag_l_muPid; double svm_score; @@ -94,6 +96,8 @@ class CandidateSQLiteTableBuilder : public SQLiteTableBuilder { void set_sig_vtxh(double value) { sig_vtxh = value; } void set_sig_Dtype(int value) { sig_Dtype = value; } void set_sig_Dstartype(int value) { sig_Dstartype = value; } + void set_tag_l_ePid(int value) { tag_l_ePid = value; } + void set_tag_l_muPid(int value) { tag_l_muPid = value; } void set_svm_score(double value) { svm_score = value; } }; diff --git a/create_database/McEventSQLiteTableBuilder.cc b/create_database/McEventSQLiteTableBuilder.cc index f1ebb44..2ea67ab 100644 --- a/create_database/McEventSQLiteTableBuilder.cc +++ b/create_database/McEventSQLiteTableBuilder.cc @@ -34,10 +34,10 @@ McEventSQLiteTableBuilder::McEventSQLiteTableBuilder(sqlite3* database, const ch meta_colnames.push_back(std::pair("ml_sample", "TEXT")); meta_colnames.push_back(std::pair("division", "TEXT")); meta_colnames.push_back(std::pair("mc_evttypeA", "INTEGER")); - meta_colnames.push_back(std::pair("b1mctype", "INTEGER")); - meta_colnames.push_back(std::pair("b2mctype", "INTEGER")); - meta_colnames.push_back(std::pair("b1_taumctype", "INTEGER")); - meta_colnames.push_back(std::pair("b2_taumctype", "INTEGER")); + meta_colnames.push_back(std::pair("b1_mctype", "INTEGER")); + meta_colnames.push_back(std::pair("b2_mctype", "INTEGER")); + meta_colnames.push_back(std::pair("b1_tau_mctype", "INTEGER")); + meta_colnames.push_back(std::pair("b2_tau_mctype", "INTEGER")); meta_colnames.push_back(std::pair("b1_dtau_max_photon_energy", "REAL")); meta_colnames.push_back(std::pair("b2_dtau_max_photon_energy", "REAL")); @@ -61,13 +61,13 @@ void McEventSQLiteTableBuilder::BindColumns() { assert(db_status == SQLITE_OK); db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@mc_evttypeA"), DetermineMcEventTypeDefA()); assert(db_status == SQLITE_OK); - db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@b1mctype"), b1mctype); + db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@b1_mctype"), b1_mctype); assert(db_status == SQLITE_OK); - db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@b2mctype"), b2mctype); + db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@b2_mctype"), b2_mctype); assert(db_status == SQLITE_OK); - db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@b1_taumctype"), b1_taumctype); + db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@b1_tau_mctype"), b1_tau_mctype); assert(db_status == SQLITE_OK); - db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@b2_taumctype"), b2_taumctype); + db_status = sqlite3_bind_int(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@b2_tau_mctype"), b2_tau_mctype); assert(db_status == SQLITE_OK); db_status = sqlite3_bind_double(insert_stmt, sqlite3_bind_parameter_index(insert_stmt, "@b1_dtau_max_photon_energy"), b1_dtau_max_photon_energy); assert(db_status == SQLITE_OK); @@ -76,72 +76,6 @@ void McEventSQLiteTableBuilder::BindColumns() { } int McEventSQLiteTableBuilder::DetermineMcEventTypeDefA() const { - - if (b1mctype == kCont && b2mctype == kCont) { - return kCont_BkgA; - } else if ((b1mctype == kDtau && b2mctype == kDstartau) || - (b1mctype == kDstartau && b2mctype == kDtau)) { - if ((truthB_idx_map.find(babar_event_id))->second == 0) { - return kDtau_SigA; - } else { - return kDstartau_SigA; - } - } else if (b1mctype == kDtau || b2mctype == kDtau) { - return kDtau_SigA; - } else if (b1mctype == kDstartau || b2mctype == kDstartau) { - return kDstartau_SigA; - } else if (b1mctype == kDstarstar_res || b2mctype == kDstarstar_res || - b1mctype == kDstarstar_nonres || b2mctype == kDstarstar_nonres ) { - return kDstarstar_BkgA; - } else if ((b1mctype == kDl && b2mctype == kDstarl) || - (b1mctype == kDstarl && b2mctype == kDl)) { - if ((truthB_idx_map.find(babar_event_id))->second == 0) { - return kDl_NormA; - } else { - return kDstarl_NormA; - } - } else if (b1mctype == kDl || b2mctype == kDl) { - return kDl_NormA; - } else if (b1mctype == kDstarl || b2mctype == kDstarl) { - return kDstarl_NormA; - } else { - int b1_dectype, b2_dectype; - b1_dectype = b2_dectype = -2; - - switch (b1mctype) { - case kD_SL: - case k0D_SL: - b1_dectype = 0; - break; - case k0Charm_Had: - case k1Charm_Had: - case k2Charm_Had: - b1_dectype = 1; - break; - } - - switch (b2mctype) { - case kD_SL: - case k0D_SL: - b2_dectype = 0; - break; - case k0Charm_Had: - case k1Charm_Had: - case k2Charm_Had: - b2_dectype = 1; - break; - } - - int dectype_sum = b1_dectype + b2_dectype; - switch (dectype_sum) { - case 0: - case 1: - return kSL_BkgA; - case 2: - return kHad_BkgA; - default: - return kUndefinedMcEventTypeA; - } - } + return -1; } diff --git a/create_database/McEventSQLiteTableBuilder.h b/create_database/McEventSQLiteTableBuilder.h index 35b01cd..a1f4b7e 100644 --- a/create_database/McEventSQLiteTableBuilder.h +++ b/create_database/McEventSQLiteTableBuilder.h @@ -12,8 +12,8 @@ class McEventSQLiteTableBuilder : public EventSQLiteTableBuilder { private: - int b1mctype, b2mctype; - int b1_taumctype, b2_taumctype; + int b1_mctype, b2_mctype; + int b1_tau_mctype, b2_tau_mctype; double b1_dtau_max_photon_energy, b2_dtau_max_photon_energy; int sp_mode; double event_weight; @@ -31,10 +31,10 @@ class McEventSQLiteTableBuilder : public EventSQLiteTableBuilder { McEventSQLiteTableBuilder(sqlite3 *db, const char *assignment_fname); virtual ~McEventSQLiteTableBuilder(); - void set_b1mctype(int value) { b1mctype = value; } - void set_b2mctype(int value) { b2mctype = value; } - void set_b1_taumctype(int value) { b1_taumctype = value; } - void set_b2_taumctype(int value) { b2_taumctype = value; } + void set_b1_mctype(int value) { b1_mctype = value; } + void set_b2_mctype(int value) { b2_mctype = value; } + void set_b1_tau_mctype(int value) { b1_tau_mctype = value; } + void set_b2_tau_mctype(int value) { b2_tau_mctype = value; } void set_b1_dtau_max_photon_energy(double value) { b1_dtau_max_photon_energy = value; } void set_b2_dtau_max_photon_energy(double value) { b2_dtau_max_photon_energy = value; } void set_sp_mode(int spmode) { sp_mode = spmode; } diff --git a/create_database/UpsilonCandidate.cc b/create_database/UpsilonCandidate.cc index c8de4e1..db9d642 100644 --- a/create_database/UpsilonCandidate.cc +++ b/create_database/UpsilonCandidate.cc @@ -20,7 +20,8 @@ UpsilonCandidate::UpsilonCandidate() : bflavor(kUndefinedBFlavor), tag_dstar_mode(kUndefinedDstarMode), tag_d_mode(kUndefinedDMode), sig_dstar_mode(kUndefinedDstarMode), sig_d_mode(kUndefinedDMode), - sig_tau_mode(kUndefinedTauMode) { + sig_tau_mode(kUndefinedTauMode), + l_ePidMap(0), l_muPidMap(0) { } UpsilonCandidate::UpsilonCandidate( @@ -55,7 +56,45 @@ UpsilonCandidate::UpsilonCandidate( bflavor(bflavor), tag_dstar_mode(tag_dstar_mode), tag_d_mode(tag_d_mode), sig_dstar_mode(sig_dstar_mode), sig_d_mode(sig_d_mode), - sig_tau_mode(sig_tau_mode) { + sig_tau_mode(sig_tau_mode), + l_ePidMap(0), l_muPidMap(0) { +} + +UpsilonCandidate::UpsilonCandidate( + std::string &event_id, int candidate_idx, + float eextra50, float mmiss_prime2, + float tag_lp3, float sig_hp3, + float tag_cosBY, float sig_cosBY, + float tag_cosThetaDl, float sig_cosThetaDtau, + float sig_vtxB, + float cosThetaT, + float tag_Dmass, float tag_deltaM, + float tag_cosThetaDSoft, float tag_softP3MagCM, + float sig_Dmass, float sig_deltaM, + float sig_cosThetaDSoft, float sig_softP3MagCM, + float sig_hmass, float sig_vtxh, + int bflavor, + int tag_dstar_mode, int tag_d_mode, + int sig_dstar_mode, int sig_d_mode, + int sig_tau_mode, + int l_ePidMap, int l_muPidMap) : + eventId(event_id), event_candidate_index(candidate_idx), + eextra50(eextra50), mmiss_prime2(mmiss_prime2), + tag_lp3(tag_lp3), sig_hp3(sig_hp3), + tag_cosBY(tag_cosBY), sig_cosBY(sig_cosBY), + tag_cosThetaDl(tag_cosThetaDl), sig_cosThetaDtau(sig_cosThetaDtau), + sig_vtxB(sig_vtxB), + cosThetaT(cosThetaT), + tag_Dmass(tag_Dmass), tag_deltaM(tag_deltaM), + tag_cosThetaDSoft(tag_cosThetaDSoft), tag_softP3MagCM(tag_softP3MagCM), + sig_Dmass(sig_Dmass), sig_deltaM(sig_deltaM), + sig_cosThetaDSoft(sig_cosThetaDSoft), sig_softP3MagCM(sig_softP3MagCM), + sig_hmass(sig_hmass), sig_vtxh(sig_vtxh), + bflavor(bflavor), + tag_dstar_mode(tag_dstar_mode), tag_d_mode(tag_d_mode), + sig_dstar_mode(sig_dstar_mode), sig_d_mode(sig_d_mode), + sig_tau_mode(sig_tau_mode), + l_ePidMap(l_ePidMap), l_muPidMap(l_muPidMap) { } UpsilonCandidate::UpsilonCandidate(const UpsilonCandidate &cand) { @@ -91,6 +130,8 @@ void UpsilonCandidate::copy_candidate(const UpsilonCandidate &cand) { sig_dstar_mode = cand.sig_dstar_mode; sig_d_mode = cand.sig_d_mode; sig_tau_mode = cand.sig_tau_mode; + l_ePidMap = cand.l_ePidMap; + l_muPidMap = cand.l_muPidMap; } UpsilonCandidate & UpsilonCandidate::operator=(const UpsilonCandidate &cand) { diff --git a/create_database/UpsilonCandidate.h b/create_database/UpsilonCandidate.h index 735dc59..8c6ee39 100644 --- a/create_database/UpsilonCandidate.h +++ b/create_database/UpsilonCandidate.h @@ -24,6 +24,8 @@ class UpsilonCandidate { int tag_dstar_mode, tag_d_mode; int sig_dstar_mode, sig_d_mode; int sig_tau_mode; + + int l_ePidMap, l_muPidMap; void copy_candidate(const UpsilonCandidate &cand); @@ -50,6 +52,26 @@ class UpsilonCandidate { int sig_dstar_mode, int sig_d_mode, int sig_tau_mode); + //! Constructs candidate with specified attributes. + UpsilonCandidate( + std::string& eventId, int event_candidate_index, + float eextra50, float mmiss_prime2, + float tag_lp3, float sig_hp3, + float tag_cosBY, float sig_cosBY, + float tag_cosThetaDl, float sig_cosThetaDtau, + float sig_vtxB, + float cosThetaT, + float tag_Dmass, float tag_deltaM, + float tag_cosThetaDSoft, float tag_softP3MagCM, + float sig_Dmass, float sig_deltaM, + float sig_cosThetaDSoft, float sig_softP3MagCM, + float sig_hmass, float sig_vtxh, + int bflavor, + int tag_dstar_mode, int tag_d_mode, + int sig_dstar_mode, int sig_d_mode, + int sig_tau_mode, + int l_ePidMap, int l_muPidMap); + UpsilonCandidate(const UpsilonCandidate &cand); ~UpsilonCandidate() {}; @@ -186,6 +208,18 @@ class UpsilonCandidate { /*! Returns an int that corresponds to the #SampleType enum in * bdtaunu_definitions.h */ int get_sample_type() const; + + //! Electron PID map of tag lepton. + /*! Bit map is here: + * http://www.slac.stanford.edu/BFROOT/www/Physics/Tools/Pid/Selectors/r24c/selectors.html + */ + int get_l_ePidMap() const { return l_ePidMap; } + + //! Muon PID map of tag lepton. + /*! Bit map is here: + * http://www.slac.stanford.edu/BFROOT/www/Physics/Tools/Pid/Selectors/r24c/selectors.html + */ + int get_l_muPidMap() const { return l_muPidMap; } }; #endif diff --git a/include/bdtaunu_definitions.h b/include/bdtaunu_definitions.h index e08678e..d8295f2 100644 --- a/include/bdtaunu_definitions.h +++ b/include/bdtaunu_definitions.h @@ -164,7 +164,7 @@ enum TauMcType { ktau_h_mc = 3, //! Undefined \f$\tau\f$ MC type. - ktau_undefined_mc = -1, + kUndefinedTauMcType = -1, };