File indexing completed on 2024-04-06 11:57:32
0001 #include "DataFormats/Candidate/interface/Candidate.h"
0002 #include "AnalysisDataFormats/TopObjects/interface/TtGenEvent.h"
0003
0004 #include "AnalysisDataFormats/TopObjects/interface/TtSemiLepEvtPartons.h"
0005
0006 TtSemiLepEvtPartons::TtSemiLepEvtPartons(const std::vector<std::string>& partonsToIgnore) {
0007
0008 for (unsigned int i = 0; i < 4; 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) == "LightQ")
0013 ignorePartons_[LightQ] = true;
0014 else if ((*str) == "LightQBar")
0015 ignorePartons_[LightQBar] = true;
0016 else if ((*str) == "HadB")
0017 ignorePartons_[HadB] = true;
0018 else if ((*str) == "LepB")
0019 ignorePartons_[LepB] = true;
0020 else
0021 throw cms::Exception("Configuration")
0022 << "The following string in partonsToIgnore is not supported: " << (*str) << "\n";
0023 }
0024 }
0025
0026 std::vector<const reco::Candidate*> TtSemiLepEvtPartons::vec(const TtGenEvent& genEvt) const {
0027 std::vector<const reco::Candidate*> vec;
0028
0029 if (genEvt.isSemiLeptonic()) {
0030
0031
0032 vec.resize(4);
0033 vec[LightQ] = genEvt.hadronicDecayQuark() ? genEvt.hadronicDecayQuark() : dummyCandidatePtr();
0034 vec[LightQBar] = genEvt.hadronicDecayQuarkBar() ? genEvt.hadronicDecayQuarkBar() : dummyCandidatePtr();
0035 vec[HadB] = genEvt.hadronicDecayB() ? genEvt.hadronicDecayB() : dummyCandidatePtr();
0036 vec[LepB] = genEvt.leptonicDecayB() ? genEvt.leptonicDecayB() : dummyCandidatePtr();
0037 } else {
0038
0039 for (unsigned i = 0; i < 4; i++)
0040 vec.push_back(dummyCandidatePtr());
0041 }
0042
0043
0044 prune(vec);
0045
0046 return vec;
0047 }