File indexing completed on 2023-03-17 11:18:30
0001 #include "CATopJetTagger.h"
0002 #include "RecoJets/JetAlgorithms/interface/CATopJetHelper.h"
0003 #include "DataFormats/BTauReco/interface/CATopJetTagInfo.h"
0004
0005 using namespace std;
0006 using namespace reco;
0007 using namespace edm;
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 CATopJetTagger::CATopJetTagger(const edm::ParameterSet& iConfig)
0020 : src_(iConfig.getParameter<InputTag>("src")),
0021 TopMass_(iConfig.getParameter<double>("TopMass")),
0022 WMass_(iConfig.getParameter<double>("WMass")),
0023 verbose_(iConfig.getParameter<bool>("verbose")),
0024 input_jet_token_(consumes<edm::View<reco::Jet> >(src_)) {
0025 produces<CATopJetTagInfoCollection>();
0026 }
0027
0028 CATopJetTagger::~CATopJetTagger() {}
0029
0030
0031
0032
0033
0034
0035 void CATopJetTagger::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0036
0037 auto tagInfos = std::make_unique<CATopJetTagInfoCollection>();
0038
0039
0040 Handle<View<Jet> > pBasicJets;
0041 iEvent.getByToken(input_jet_token_, pBasicJets);
0042
0043
0044 View<Jet> const& hardJets = *pBasicJets;
0045
0046 CATopJetHelper helper(TopMass_, WMass_);
0047
0048
0049 View<Jet>::const_iterator ihardJet = hardJets.begin(), ihardJetEnd = hardJets.end();
0050 size_t iihardJet = 0;
0051 for (; ihardJet != ihardJetEnd; ++ihardJet, ++iihardJet) {
0052 if (verbose_)
0053 edm::LogInfo("CATopJetTagger") << "Processing ihardJet with pt = " << ihardJet->pt() << endl;
0054
0055
0056
0057 RefToBase<Jet> ref(pBasicJets, iihardJet);
0058
0059 CATopJetProperties properties = helper(*ihardJet);
0060
0061 CATopJetTagInfo tagInfo;
0062 tagInfo.insert(ref, properties);
0063 tagInfos->push_back(tagInfo);
0064 }
0065
0066 iEvent.put(std::move(tagInfos));
0067
0068 return;
0069 }
0070
0071
0072 DEFINE_FWK_MODULE(CATopJetTagger);