File indexing completed on 2023-03-17 10:40:54
0001 #include "DataFormats/Candidate/interface/Candidate.h"
0002 #include "AnalysisDataFormats/TopObjects/interface/TtGenEvent.h"
0003
0004 #include "AnalysisDataFormats/TopObjects/interface/TtFullLepEvtPartons.h"
0005
0006 TtFullLepEvtPartons::TtFullLepEvtPartons(const std::vector<std::string>& partonsToIgnore) {
0007
0008 for (unsigned int i = 0; i < 2; i++)
0009 ignorePartons_.push_back(false);
0010
0011 for (std::vector<std::string>::const_iterator str = partonsToIgnore.begin(); str != partonsToIgnore.end(); ++str) {
0012 if ((*str) == "B")
0013 ignorePartons_[B] = true;
0014 else if ((*str) == "BBar")
0015 ignorePartons_[BBar] = true;
0016 else
0017 throw cms::Exception("Configuration")
0018 << "The following string in partonsToIgnore is not supported: " << (*str) << "\n";
0019 }
0020 }
0021
0022 std::vector<const reco::Candidate*> TtFullLepEvtPartons::vec(const TtGenEvent& genEvt) const {
0023 std::vector<const reco::Candidate*> vec;
0024
0025 if (genEvt.isFullLeptonic()) {
0026
0027
0028 vec.resize(2);
0029 vec[B] = genEvt.b() ? genEvt.b() : dummyCandidatePtr();
0030 vec[BBar] = genEvt.bBar() ? genEvt.bBar() : dummyCandidatePtr();
0031 } else {
0032
0033 for (unsigned i = 0; i < 2; i++)
0034 vec.push_back(dummyCandidatePtr());
0035 }
0036
0037
0038 prune(vec);
0039
0040 return vec;
0041 }