15 produces<reco::BasicJetCollection>();
28 writeCompoundJets<reco::CaloJet>(
iEvent, iSetup);
31 writeCompoundJets<reco::PFJet>(
iEvent, iSetup);
34 writeCompoundJets<reco::GenJet>(
iEvent, iSetup);
37 writeCompoundJets<reco::BasicJet>(
iEvent, iSetup);
40 throw cms::Exception(
"InvalidInput") <<
"invalid jet type in CompoundJetProducer\n";
49 auto jetCollection = std::make_unique<reco::BasicJetCollection>();
51 auto subjetCollection = std::make_unique<std::vector<T>>();
56 std::vector<std::vector<int>>
indices;
58 std::vector<math::XYZTLorentzVector> p4_hardJets;
60 std::vector<double> area_hardJets;
62 [[maybe_unused]]
const CaloGeometry* pGeometry =
nullptr;
63 [[maybe_unused]]
const HcalTopology* pTopology =
nullptr;
64 if constexpr (std::is_same_v<T, reco::CaloJet>) {
73 for (; it != iEnd; ++it) {
74 int jetIndex = it - iBegin;
75 fastjet::PseudoJet localJet = it->hardJet();
78 area_hardJets.push_back(it->hardJetArea());
81 std::vector<CompoundPseudoSubJet>::const_iterator itSubJetBegin = it->subjets().begin(), itSubJet = itSubJetBegin,
82 itSubJetEnd = it->subjets().end();
83 for (; itSubJet != itSubJetEnd; ++itSubJet) {
84 fastjet::PseudoJet subjet = itSubJet->subjet();
89 std::vector<reco::CandidatePtr> subjetConstituents;
92 std::vector<int>
const& subjetFastjetConstituentIndices = itSubJet->constituents();
93 std::vector<int>::const_iterator fastSubIt = subjetFastjetConstituentIndices.begin(),
94 transConstEnd = subjetFastjetConstituentIndices.end();
95 for (; fastSubIt != transConstEnd; ++fastSubIt) {
97 if (*fastSubIt < static_cast<int>(
inputs_.size()))
98 subjetConstituents.push_back(
inputs_[*fastSubIt]);
102 indices[jetIndex].push_back(subjetCollection->size());
106 if constexpr (std::is_same_v<T, reco::CaloJet>) {
111 jet.setJetArea(itSubJet->subjetArea());
112 subjetCollection->push_back(jet);
119 std::vector<math::XYZTLorentzVector>::const_iterator ip4 = p4_hardJets.begin(), ip4Begin = p4_hardJets.begin(),
120 ip4End = p4_hardJets.end();
122 for (; ip4 != ip4End; ++ip4) {
123 int p4_index = ip4 - ip4Begin;
124 std::vector<int>& ind = indices[p4_index];
125 std::vector<reco::CandidatePtr> i_hardJetConstituents;
127 for (std::vector<int>::const_iterator isub = ind.begin(); isub != ind.end(); ++isub) {
129 i_hardJetConstituents.push_back(candPtr);
133 toput.
setJetArea(area_hardJets[ip4 - ip4Begin]);
134 jetCollection->push_back(toput);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void writeCompoundJets(edm::Event &iEvent, edm::EventSetup const &iSetup)
function template to write out the outputs
virtual void inputTowers()
void output(edm::Event &iEvent, edm::EventSetup const &iSetup) override
void writeSpecific(reco::CaloJet &jet, reco::Particle::LorentzVector const &p4, reco::Particle::Point const &point, std::vector< reco::CandidatePtr > const &constituents, CaloGeometry const &geometry, HcalTopology const &topology)
Jets made from CaloTowers.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual void setJetArea(float fArea)
set jet area
std::string jetCollInstanceName_
std::vector< edm::Ptr< reco::Candidate > > inputs_
CaloGeometry const & getGeometry(edm::EventSetup const &) const
void inputTowers() override
compound fastjet::PseudoJets
math::XYZPoint Point
point in the space
std::vector< CompoundPseudoJet > fjCompoundJets_
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
HcalTopology const & getTopology(edm::EventSetup const &) const