File indexing completed on 2024-04-06 11:57:31
0001 #include "DataFormats/Candidate/interface/Candidate.h"
0002 #include "AnalysisDataFormats/TopObjects/interface/TtGenEvent.h"
0003
0004 #include "AnalysisDataFormats/TopObjects/interface/TtFullHadEvtPartons.h"
0005
0006 TtFullHadEvtPartons::TtFullHadEvtPartons(const std::vector<std::string>& partonsToIgnore) {
0007
0008 for (unsigned int i = 0; i < 6; 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) == "B")
0017 ignorePartons_[B] = true;
0018 else if ((*str) == "LightP")
0019 ignorePartons_[LightP] = true;
0020 else if ((*str) == "LightPBar")
0021 ignorePartons_[LightPBar] = true;
0022 else if ((*str) == "BBar")
0023 ignorePartons_[BBar] = true;
0024 else
0025 throw cms::Exception("Configuration")
0026 << "The following string in partonsToIgnore is not supported: " << (*str) << "\n";
0027 }
0028 }
0029
0030 std::vector<const reco::Candidate*> TtFullHadEvtPartons::vec(const TtGenEvent& genEvt) const {
0031 std::vector<const reco::Candidate*> vec;
0032
0033 if (genEvt.isFullHadronic()) {
0034
0035
0036 vec.resize(6);
0037 vec[LightQ] = genEvt.daughterQuarkOfWPlus() ? genEvt.daughterQuarkOfWPlus() : dummyCandidatePtr();
0038 vec[LightQBar] = genEvt.daughterQuarkBarOfWPlus() ? genEvt.daughterQuarkBarOfWPlus() : dummyCandidatePtr();
0039 vec[B] = genEvt.b() ? genEvt.b() : dummyCandidatePtr();
0040 vec[LightP] = genEvt.daughterQuarkOfWMinus() ? genEvt.daughterQuarkOfWMinus() : dummyCandidatePtr();
0041 vec[LightPBar] = genEvt.daughterQuarkBarOfWMinus() ? genEvt.daughterQuarkBarOfWMinus() : dummyCandidatePtr();
0042 vec[BBar] = genEvt.bBar() ? genEvt.bBar() : dummyCandidatePtr();
0043 } else {
0044
0045 for (unsigned i = 0; i < 6; i++)
0046 vec.push_back(dummyCandidatePtr());
0047 }
0048
0049
0050 prune(vec);
0051
0052 return vec;
0053 }