CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
JPTJetSlimmer Class Reference
Inheritance diagram for JPTJetSlimmer:
edm::stream::EDProducer<>

Public Member Functions

 JPTJetSlimmer (edm::ParameterSet const &params)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~JPTJetSlimmer () 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)
 

Protected Attributes

const std::string cut_
 
const StringCutObjectSelector< reco::Jetselector_
 
const edm::EDGetTokenT< edm::View< reco::CaloJet > > srcCaloToken_
 
const edm::EDGetTokenT< edm::View< reco::JPTJet > > srcToken_
 

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

Definition at line 20 of file JPTJetSlimmer.cc.

Constructor & Destructor Documentation

◆ JPTJetSlimmer()

JPTJetSlimmer::JPTJetSlimmer ( edm::ParameterSet const &  params)
inline

Definition at line 22 of file JPTJetSlimmer.cc.

23  : srcToken_(consumes<edm::View<reco::JPTJet> >(params.getParameter<edm::InputTag>("src"))),
24  srcCaloToken_(consumes<edm::View<reco::CaloJet> >(params.getParameter<edm::InputTag>("srcCalo"))),
25  cut_(params.getParameter<std::string>("cut")),
26  selector_(cut_) {
27  produces<reco::JPTJetCollection>();
28  produces<reco::CaloJetCollection>();
29  }
const edm::EDGetTokenT< edm::View< reco::JPTJet > > srcToken_
const edm::EDGetTokenT< edm::View< reco::CaloJet > > srcCaloToken_
const std::string cut_
const StringCutObjectSelector< reco::Jet > selector_

◆ ~JPTJetSlimmer()

JPTJetSlimmer::~JPTJetSlimmer ( )
inlineoverride

Definition at line 31 of file JPTJetSlimmer.cc.

31 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 84 of file JPTJetSlimmer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

84  {
85  // slimmedJPTJets
87  desc.add<edm::InputTag>("src", edm::InputTag("JetPlusTrackZSPCorJetAntiKt4"));
88  desc.add<edm::InputTag>("srcCalo", edm::InputTag("slimmedCaloJets"));
89  desc.add<std::string>("cut", "pt>20");
90  descriptions.add("slimmedJPTJets", desc);
91 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void JPTJetSlimmer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlineoverride

Definition at line 35 of file JPTJetSlimmer.cc.

References isolatedTracks_cfi::caloJets, runTheMatrix::const, HLTMuonOfflineAnalyzer_cfi::deltaR2, mps_fire::i, iEvent, reco::Jet::jetArea(), eostools::move(), selector_, srcCaloToken_, srcToken_, and reco::JPTJet::Specific::theCaloJetRef.

35  {
36  auto jptJets = std::make_unique<reco::JPTJetCollection>();
37  auto caloJets = std::make_unique<reco::CaloJetCollection>();
38 
41 
42  auto const& h_calojets = iEvent.get(srcCaloToken_);
43  auto const& h_jets = iEvent.get(srcToken_);
44 
45  for (auto const& ijet : h_jets) {
46  if (selector_(ijet)) {
47  // Add specific : only reference to CaloJet collection. It is necessary for
48  // recalibration JPTJet at MiniAod.
49  const edm::RefToBase<reco::Jet>& rawcalojet = ijet.getCaloJetRef();
50  int icalo = -1;
51  int i = 0;
52  for (auto const& icjet : h_calojets) {
53  double dr2 = deltaR2(icjet, *rawcalojet);
54  if (dr2 <= 0.001) {
55  icalo = i;
56  }
57  i++;
58  }
59  reco::JPTJet::Specific tmp_specific;
60  if (icalo < 0) {
61  // Add reference to the created CaloJet collection
62  reco::CaloJetRef myjet(pOut1RefProd, idxCaloJet++);
63  tmp_specific.theCaloJetRef = edm::RefToBase<reco::Jet>(myjet);
64  reco::CaloJet const* rawcalojetc = dynamic_cast<reco::CaloJet const*>(&*rawcalojet);
65  caloJets->push_back(*rawcalojetc);
66  const reco::Candidate::Point& orivtx = ijet.vertex();
67  reco::JPTJet newJPTJet(ijet.p4(), orivtx, tmp_specific, ijet.getJetConstituents());
68  float jetArea = ijet.jetArea();
69  newJPTJet.setJetArea(fabs(jetArea));
70  jptJets->push_back(newJPTJet);
71  }
72  }
73  }
75  iEvent.put(std::move(jptJets));
76  }
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:164
Jets made from CaloTowers.
Definition: CaloJet.h:27
const edm::EDGetTokenT< edm::View< reco::JPTJet > > srcToken_
virtual float jetArea() const
get jet area
Definition: Jet.h:103
const edm::EDGetTokenT< edm::View< reco::CaloJet > > srcCaloToken_
int iEvent
Definition: GenABIO.cc:224
Jets made from CaloJets corrected for ZSP and tracks.
Definition: JPTJet.h:28
const StringCutObjectSelector< reco::Jet > selector_
edm::RefToBase< reco::Jet > theCaloJetRef
Definition: JPTJet.h:46
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
def move(src, dest)
Definition: eostools.py:511
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects

Member Data Documentation

◆ cut_

const std::string JPTJetSlimmer::cut_
protected

Definition at line 81 of file JPTJetSlimmer.cc.

◆ selector_

const StringCutObjectSelector<reco::Jet> JPTJetSlimmer::selector_
protected

Definition at line 82 of file JPTJetSlimmer.cc.

Referenced by produce().

◆ srcCaloToken_

const edm::EDGetTokenT<edm::View<reco::CaloJet> > JPTJetSlimmer::srcCaloToken_
protected

Definition at line 80 of file JPTJetSlimmer.cc.

Referenced by produce().

◆ srcToken_

const edm::EDGetTokenT<edm::View<reco::JPTJet> > JPTJetSlimmer::srcToken_
protected

Definition at line 79 of file JPTJetSlimmer.cc.

Referenced by produce().