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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 }

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 76 of file JetPlusTrackAddonSeedProducer.cc.

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 }

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

◆ produce()

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

Definition at line 89 of file JetPlusTrackAddonSeedProducer.cc.

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 = -1 * 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 }

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

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().

reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
zmumugammaAnalyzer_cfi.pfCandidates
pfCandidates
Definition: zmumugammaAnalyzer_cfi.py:11
JetPlusTrackAddonSeedProducer::dRcone_
const double dRcone_
Definition: JetPlusTrackAddonSeedProducer.cc:55
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
JetPlusTrackAddonSeedProducer::input_jets_token_
const edm::EDGetTokenT< edm::View< reco::CaloJet > > input_jets_token_
Definition: JetPlusTrackAddonSeedProducer.cc:57
reco::Jet::setJetArea
virtual void setJetArea(float fArea)
set jet area
Definition: Jet.h:101
JetPlusTrackAddonSeedProducer::input_vertex_token_
const edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
Definition: JetPlusTrackAddonSeedProducer.cc:59
JetPlusTrackAddonSeedProducer::usePAT_
const bool usePAT_
Definition: JetPlusTrackAddonSeedProducer.cc:56
JetPlusTrackAddonSeedProducer::input_ctw_token_
const edm::EDGetTokenT< CaloTowerCollection > input_ctw_token_
Definition: JetPlusTrackAddonSeedProducer.cc:61
edm::View
Definition: CaloClusterFwd.h:14
JetPlusTrackAddonSeedProducer::input_trackjets_token_
const edm::EDGetTokenT< edm::View< reco::TrackJet > > input_trackjets_token_
Definition: JetPlusTrackAddonSeedProducer.cc:58
JetPlusTrackAddonSeedProducer::tokenPFCandidates_
const edm::EDGetTokenT< std::vector< pat::PackedCandidate > > tokenPFCandidates_
Definition: JetPlusTrackAddonSeedProducer.cc:60
reco::CaloJet::Specific::mTowersArea
float mTowersArea
Area of contributing CaloTowers.
Definition: CaloJet.h:70
iEvent
int iEvent
Definition: GenABIO.cc:224
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
packedPFCandidateRefMixer_cfi.pf
pf
Definition: packedPFCandidateRefMixer_cfi.py:4
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
metsig::jet
Definition: SignAlgoResolutions.h:47
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::CaloJet::Specific
Definition: CaloJet.h:32
edm::InputTag
Definition: InputTag.h:15