ATLAS Offline Software
Loading...
Searching...
No Matches
CP::SSVWeightsAlg::EfficiencyMethodBhadronPtEtaBasedClass Class Reference
Collaboration diagram for CP::SSVWeightsAlg::EfficiencyMethodBhadronPtEtaBasedClass:

Public Member Functions

 EfficiencyMethodBhadronPtEtaBasedClass (const nlohmann::json &jsonConfig)
double getPIneff (const std::vector< const xAOD::TruthParticle * > &accepted_truthBh, const std::vector< bool > &truthBh_to_SSV_matched, double SF_eff) const

Private Attributes

std::vector< doublem_ptbins {}
std::map< std::string, std::map< std::string, std::vector< double > > > m_BhadronPtEtaEfficiencyMap {}
double m_upperboundpT = -999

Detailed Description

Definition at line 112 of file SSVWeightsAlg.h.

Constructor & Destructor Documentation

◆ EfficiencyMethodBhadronPtEtaBasedClass()

CP::SSVWeightsAlg::EfficiencyMethodBhadronPtEtaBasedClass::EfficiencyMethodBhadronPtEtaBasedClass ( const nlohmann::json & jsonConfig)

Definition at line 548 of file SSVWeightsAlg.cxx.

549 : m_ptbins(jsonConfig["efficiency_Bhadron_pT_eta_based"]["pt_bins"].get<std::vector<double>>())
550 {
551 // Extract information from JSON file for EfficiencyMethod EfficiencyMethodBhadronPtEtaBased
552 for (size_t i = 0; i < m_ptbins.size() - 1; ++i) {
553 std::string pT_bin_key = "pt_bin_" + std::to_string((int)m_ptbins[i]) + "_" + std::to_string((int)m_ptbins[i+1]);
554 m_BhadronPtEtaEfficiencyMap[pT_bin_key] = jsonConfig["efficiency_Bhadron_pT_eta_based"][pT_bin_key];
555 }
556 m_upperboundpT = m_ptbins[m_ptbins.size()-1];
557 }
std::map< std::string, std::map< std::string, std::vector< double > > > m_BhadronPtEtaEfficiencyMap
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130

Member Function Documentation

◆ getPIneff()

double CP::SSVWeightsAlg::EfficiencyMethodBhadronPtEtaBasedClass::getPIneff ( const std::vector< const xAOD::TruthParticle * > & accepted_truthBh,
const std::vector< bool > & truthBh_to_SSV_matched,
double SF_eff ) const

Definition at line 560 of file SSVWeightsAlg.cxx.

563 {
564 //construct missed truthBhs
565 const std::vector<const xAOD::TruthParticle*> missed_truthBhs = construct_not_matched_vectors(accepted_truthBhs, truthBh_to_SSV_matched);
566
567 //read off pt bins from JSON file
568 const std::vector<double> &ptbins = m_ptbins;
569
570 double P_ineff = 1;
571 for (size_t i = 0; i < missed_truthBhs.size(); ++i) {
572 //retrieve pt,eta of missed truthBh
573 double pt = missed_truthBhs[i]->pt();
574 double eta = std::abs(missed_truthBhs[i]->eta());
575 std::string pt_bin_of_truthBh = "";
576 // iterate pt bins to find appropriate efficiency bin for the truthBh pT
577 for (size_t j = 0; j < ptbins.size() - 1; ++j) {
578 if (pt >= ptbins[j] && pt < ptbins[j+1]) {
579 //construct pt bin name
580 pt_bin_of_truthBh = "pt_bin_" + std::to_string((int)ptbins[j]) + "_" + std::to_string((int)ptbins[j+1]);
581 }
582 else if (pt > m_upperboundpT){
583 pt_bin_of_truthBh = "pt_bin_" + std::to_string(m_upperboundpT) + "plus";
584 }
585 }
586 if (pt_bin_of_truthBh == ""){
587 //no pt bin found or no missed truthBh"
588 continue;
589 }
590 //retrieve eta and efficiency bins for the pT bin
591 const std::vector<double>& eta_bins = m_BhadronPtEtaEfficiencyMap.at(pt_bin_of_truthBh).at("eta");
592 const std::vector<double>& efficiencies = m_BhadronPtEtaEfficiencyMap.at(pt_bin_of_truthBh).at("efficiency");
593
594 double efficiency = 1;
595
596 //iterate eta bins to find appropriate eta bin for truthBh eta
597 for (size_t k = 0; k < eta_bins.size() - 1; ++k) {
598 double eta_low = eta_bins[k];
599 double eta_up = eta_bins[k+1];
600 if (eta >= eta_low && eta < eta_up) {
601 //eta bin found -> read off corresponding efficiency
603 }
604 }
605 //calculate P_ineff using the found efficiency
606 P_ineff = P_ineff*(1-SF_eff*efficiency)/(1-efficiency);
607 }
608 return P_ineff;
609 }
Scalar eta() const
pseudorapidity method
TEfficiency * efficiency(const std::string &effName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered TEfficiency.
static const std::vector< const xAOD::TruthParticle * > construct_not_matched_vectors(const std::vector< const xAOD::TruthParticle * > &truthBhs, const std::vector< bool > &matched_vector)
list efficiencies
translate the station name indices into the string staiton name
setRcore setEtHad setFside pt

Member Data Documentation

◆ m_BhadronPtEtaEfficiencyMap

std::map<std::string, std::map<std::string, std::vector<double> > > CP::SSVWeightsAlg::EfficiencyMethodBhadronPtEtaBasedClass::m_BhadronPtEtaEfficiencyMap {}
private

Definition at line 121 of file SSVWeightsAlg.h.

121{};

◆ m_ptbins

std::vector<double> CP::SSVWeightsAlg::EfficiencyMethodBhadronPtEtaBasedClass::m_ptbins {}
private

Definition at line 120 of file SSVWeightsAlg.h.

120{};

◆ m_upperboundpT

double CP::SSVWeightsAlg::EfficiencyMethodBhadronPtEtaBasedClass::m_upperboundpT = -999
private

Definition at line 122 of file SSVWeightsAlg.h.


The documentation for this class was generated from the following files: