CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
JetPlusTrackAddonSeedProducer Class Reference

#include <JetPlusTrackAddonSeedProducer.cc>

Inheritance diagram for JetPlusTrackAddonSeedProducer:
edm::stream::EDProducer<>

Public Member Functions

 JetPlusTrackAddonSeedProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const double dRcone_
 
const edm::EDGetTokenT< CaloTowerCollectioninput_ctw_token_
 
const edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jets_token_
 
const edm::EDGetTokenT< edm::View< reco::TrackJet > > input_trackjets_token_
 
const edm::EDGetTokenT< reco::VertexCollectioninput_vertex_token_
 
const edm::EDGetTokenT< std::vector< pat::PackedCandidate > > tokenPFCandidates_
 
const bool usePAT_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 48 of file JetPlusTrackAddonSeedProducer.cc.

Constructor & Destructor Documentation

◆ JetPlusTrackAddonSeedProducer()

JetPlusTrackAddonSeedProducer::JetPlusTrackAddonSeedProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 64 of file JetPlusTrackAddonSeedProducer.cc.

65  : dRcone_(iConfig.getParameter<double>("dRcone")),
66  usePAT_(iConfig.getParameter<bool>("UsePAT")),
67  input_jets_token_(consumes<edm::View<reco::CaloJet> >(iConfig.getParameter<edm::InputTag>("srcCaloJets"))),
68  input_trackjets_token_(consumes<edm::View<reco::TrackJet> >(iConfig.getParameter<edm::InputTag>("srcTrackJets"))),
69  input_vertex_token_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("srcPVs"))),
70  tokenPFCandidates_(consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("PFCandidates"))),
71  input_ctw_token_(consumes<CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("towerMaker"))) {
72  //register your products
73  produces<reco::CaloJetCollection>();
74 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
const edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jets_token_
const edm::EDGetTokenT< CaloTowerCollection > input_ctw_token_
const edm::EDGetTokenT< std::vector< pat::PackedCandidate > > tokenPFCandidates_
const edm::EDGetTokenT< edm::View< reco::TrackJet > > input_trackjets_token_

Member Function Documentation

◆ fillDescriptions()

void JetPlusTrackAddonSeedProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 76 of file JetPlusTrackAddonSeedProducer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and HLT_2022v14_cff::InputTag.

76  {
78  desc.add<double>("dRcone", 0.4);
79  desc.add<bool>("UsePAT", false);
80  desc.add<edm::InputTag>("srcCaloJets", edm::InputTag("ak4CaloJets"));
81  desc.add<edm::InputTag>("srcTrackJets", edm::InputTag("ak4TrackJets"));
82  desc.add<edm::InputTag>("srcPVs", edm::InputTag("primaryVertex"));
83  desc.add<edm::InputTag>("PFCandidates", edm::InputTag("PFCandidates"));
84  desc.add<edm::InputTag>("towerMaker", edm::InputTag("towerMaker"));
85  iDescriptions.addWithDefaultLabel(desc);
86 }

◆ produce()

void JetPlusTrackAddonSeedProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 89 of file JetPlusTrackAddonSeedProducer.cc.

References funct::abs(), HLTMuonOfflineAnalyzer_cfi::deltaR2, dRcone_, iEvent, input_ctw_token_, input_jets_token_, input_trackjets_token_, metsig::jet, PDWG_EXODelayedJetMET_cff::jets, M_PI, eostools::move(), reco::CaloJet::Specific::mTowersArea, packedPFCandidateRefMixer_cfi::pf, zmumugammaAnalyzer_cfi::pfCandidates, reco::Jet::setJetArea(), tokenPFCandidates_, and usePAT_.

89  {
90  using namespace edm;
91  // get stuff from Event
92  auto const& jets = iEvent.get(input_jets_token_);
93  auto const& jetsTrackJets = iEvent.get(input_trackjets_token_);
94  auto pCaloOut = std::make_unique<reco::CaloJetCollection>();
95 
96  for (auto const& jet : jetsTrackJets) {
97  int iflag = 0;
98  for (auto const& oldjet : jets) {
99  double dr2 = deltaR2(jet, oldjet);
100  if (dr2 < dRcone_ * dRcone_) {
101  iflag = 1;
102  }
103  } // Calojets
104 
105  if (iflag == 1)
106  continue;
107  double caloen = 0.;
108  double hadinho = 0.;
109  double hadinhb = 0.;
110  double hadinhe = 0.;
111  double hadinhf = 0.;
112  double emineb = 0.;
113  double eminee = 0.;
114  double eminhf = 0.;
115  double eefraction = 0.;
116  double hhfraction = 0.;
117  int ncand = 0;
118 
119  if (usePAT_) {
120  auto const& pfCandidates = iEvent.get(tokenPFCandidates_);
121  for (auto const& pf : pfCandidates) {
122  double dr2 = deltaR2(jet, pf);
123  if (dr2 > dRcone_ * dRcone_)
124  continue;
125  // jetconstit
126  caloen = caloen + pf.energy() * pf.caloFraction();
127  hadinho += 0.;
128  if (std::abs(pf.eta()) <= 1.4) {
129  hadinhb += pf.energy() * pf.caloFraction() * pf.hcalFraction();
130  emineb += pf.energy() * pf.caloFraction() * (1. - pf.hcalFraction());
131  } else if (std::abs(pf.eta()) < 3.) {
132  hadinhe += pf.energy() * pf.caloFraction() * pf.hcalFraction();
133  eminee += pf.energy() * pf.caloFraction() * (1. - pf.hcalFraction());
134  } else {
135  hadinhf += pf.energy() * pf.caloFraction() * pf.hcalFraction();
136  eminhf += pf.energy() * pf.caloFraction() * (1. - pf.hcalFraction());
137  }
138  ncand++;
139  } // pfcandidates
140  } else {
141  auto const& cts = iEvent.get(input_ctw_token_);
142  for (auto const& ct : cts) {
143  double dr2 = deltaR2(jet, ct);
144  if (dr2 > dRcone_ * dRcone_)
145  continue;
146  caloen = caloen + ct.energy();
147  hadinho += ct.energyInHO();
148  hadinhb += ct.energyInHB();
149  hadinhe += ct.energyInHE();
150  hadinhf += 0.5 * ct.energyInHF();
151  emineb += ct.energy() - ct.energyInHB() - ct.energyInHO();
152  eminee += ct.energy() - ct.energyInHE();
153  eminhf += 0.5 * ct.energyInHF();
154  ncand++;
155  }
156  }
157  eefraction = (emineb + eminee) / caloen;
158  hhfraction = (hadinhb + hadinhe + hadinhf + hadinho) / caloen;
159 
160  double trackp = jet.p();
161  if (caloen <= 0.)
162  caloen = 0.001;
163  math::XYZTLorentzVector pcalo4(caloen * jet.p4() / trackp);
164  reco::CaloJet::Specific calospe;
165  calospe.mTowersArea = ncand;
166  calospe.mHadEnergyInHO = hadinho;
167  calospe.mHadEnergyInHB = hadinhb;
168  calospe.mHadEnergyInHE = hadinhe;
169  calospe.mHadEnergyInHF = hadinhf;
170  calospe.mEmEnergyInEB = emineb;
171  calospe.mEmEnergyInEE = eminee;
172  calospe.mEmEnergyInHF = eminhf;
173  calospe.mEnergyFractionEm = eefraction / caloen;
174  calospe.mEnergyFractionHadronic = hhfraction / caloen;
175 
176  reco::CaloJet mycalo(pcalo4, jet.primaryVertex()->position(), calospe);
177  mycalo.setJetArea(M_PI * dRcone_ * dRcone_);
178  pCaloOut->push_back(mycalo);
179 
180  } // trackjets
181  iEvent.put(std::move(pCaloOut));
182 }
Jets made from CaloTowers.
Definition: CaloJet.h:27
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual void setJetArea(float fArea)
set jet area
Definition: Jet.h:101
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jets_token_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const edm::EDGetTokenT< CaloTowerCollection > input_ctw_token_
#define M_PI
const edm::EDGetTokenT< std::vector< pat::PackedCandidate > > tokenPFCandidates_
const edm::EDGetTokenT< edm::View< reco::TrackJet > > input_trackjets_token_
HLT enums.
float mTowersArea
Area of contributing CaloTowers.
Definition: CaloJet.h:70
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ dRcone_

const double JetPlusTrackAddonSeedProducer::dRcone_
private

Definition at line 55 of file JetPlusTrackAddonSeedProducer.cc.

Referenced by produce().

◆ input_ctw_token_

const edm::EDGetTokenT<CaloTowerCollection> JetPlusTrackAddonSeedProducer::input_ctw_token_
private

Definition at line 61 of file JetPlusTrackAddonSeedProducer.cc.

Referenced by produce().

◆ input_jets_token_

const edm::EDGetTokenT<edm::View<reco::CaloJet> > JetPlusTrackAddonSeedProducer::input_jets_token_
private

Definition at line 57 of file JetPlusTrackAddonSeedProducer.cc.

Referenced by produce().

◆ input_trackjets_token_

const edm::EDGetTokenT<edm::View<reco::TrackJet> > JetPlusTrackAddonSeedProducer::input_trackjets_token_
private

Definition at line 58 of file JetPlusTrackAddonSeedProducer.cc.

Referenced by produce().

◆ input_vertex_token_

const edm::EDGetTokenT<reco::VertexCollection> JetPlusTrackAddonSeedProducer::input_vertex_token_
private

Definition at line 59 of file JetPlusTrackAddonSeedProducer.cc.

◆ tokenPFCandidates_

const edm::EDGetTokenT<std::vector<pat::PackedCandidate> > JetPlusTrackAddonSeedProducer::tokenPFCandidates_
private

Definition at line 60 of file JetPlusTrackAddonSeedProducer.cc.

Referenced by produce().

◆ usePAT_

const bool JetPlusTrackAddonSeedProducer::usePAT_
private

Definition at line 56 of file JetPlusTrackAddonSeedProducer.cc.

Referenced by produce().