CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
cms::SubEventGenJetProducer Class Reference

#include <SubEventGenJetProducer.h>

Inheritance diagram for cms::SubEventGenJetProducer:
VirtualJetProducer edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
void runAlgorithm (edm::Event &, const edm::EventSetup &) override
 
 SubEventGenJetProducer (const edm::ParameterSet &ps)
 
 ~SubEventGenJetProducer () override
 
- Public Member Functions inherited from VirtualJetProducer
std::string jetType () const
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 VirtualJetProducer (const edm::ParameterSet &iConfig)
 
 ~VirtualJetProducer () 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
 

Protected Member Functions

void inputTowers () override
 
- Protected Member Functions inherited from VirtualJetProducer
virtual void addHTTTopJetTagInfoCollection (edm::Event &iEvent, const edm::EventSetup &iSetup, edm::OrphanHandle< reco::BasicJetCollection > &oh)
 
virtual void copyConstituents (const std::vector< fastjet::PseudoJet > &fjConstituents, reco::Jet *jet)
 
virtual std::vector< reco::CandidatePtrgetConstituents (const std::vector< fastjet::PseudoJet > &fjConstituents)
 
CaloGeometry const & getGeometry (edm::EventSetup const &) const
 
HcalTopology const & getTopology (edm::EventSetup const &) const
 
virtual bool isAnomalousTower (reco::CandidatePtr input)
 
bool makeBasicJet (const JetType::Type &fTag)
 
bool makeCaloJet (const JetType::Type &fTag)
 
bool makeGenJet (const JetType::Type &fTag)
 
bool makePFClusterJet (const JetType::Type &fTag)
 
bool makePFJet (const JetType::Type &fTag)
 
virtual void makeProduces (std::string s, std::string tag="")
 
bool makeTrackJet (const JetType::Type &fTag)
 
void offsetCorrectJets (std::vector< fastjet::PseudoJet > &orphanInput)
 
virtual void output (edm::Event &iEvent, edm::EventSetup const &iSetup)
 
template<typename T >
void writeCompoundJets (edm::Event &iEvent, edm::EventSetup const &iSetup)
 function template to write out the outputs More...
 
template<typename T >
void writeJets (edm::Event &iEvent, edm::EventSetup const &iSetup)
 
template<typename T >
void writeJetsWithConstituents (edm::Event &iEvent, edm::EventSetup const &iSetup)
 function template to write out the outputs More...
 

Protected Attributes

std::vector< int > hydroTag_
 
bool ignoreHydro_
 
std::unique_ptr< std::vector< reco::GenJet > > jets_
 
std::vector< int > nSubParticles_
 
std::vector< std::vector< fastjet::PseudoJet > > subInputs_
 
- Protected Attributes inherited from VirtualJetProducer
int activeAreaRepeats_
 
bool applyWeight_
 
bool doAreaDiskApprox_
 
bool doAreaFastjet_
 
bool doFastJetNonUniform_
 
bool doPUOffsetCorr_
 
bool doPVCorrection_
 
bool doRhoFastjet_
 
ActiveAreaSpecPtr fjActiveArea_
 
AreaDefinitionPtr fjAreaDefinition_
 
ClusterSequencePtr fjClusterSeq_
 
std::vector< fastjet::PseudoJet > fjInputs_
 
JetDefPtr fjJetDefinition_
 
std::vector< fastjet::PseudoJet > fjJets_
 
PluginPtr fjPlugin_
 
SelectorPtr fjSelector_
 
bool fromHTTTopJetProducer_ = false
 
double ghostArea_
 
double ghostEtaMax_
 
edm::EDGetTokenT< reco::VertexCollectioninput_vertex_token_
 
edm::EDGetTokenT< edm::ValueMap< float > > input_weights_token_
 
double inputEMin_
 
double inputEtMin_
 
std::vector< edm::Ptr< reco::Candidate > > inputs_
 
std::string jetAlgorithm_
 
std::string jetCollInstanceName_
 
double jetPtMin_
 
std::string jetType_
 
JetType::Type jetTypeE
 
unsigned int maxInputs_
 
unsigned int minSeed_
 
std::string moduleLabel_
 
unsigned int nExclude_
 
std::vector< double > puCenters_
 
std::string puSubtractorName_
 
double puWidth_
 
bool restrictInputs_
 
double rhoEtaMax_
 
double rParam_
 
edm::InputTag src_
 
edm::InputTag srcPVs_
 
std::shared_ptr< PileUpSubtractorsubtractor_
 
bool useDeterministicSeed_
 
bool useExplicitGhosts_
 
int verbosity_
 
reco::Particle::Point vertex_
 
double voronoiRfact_
 
edm::ValueMap< float > weights_
 
bool writeCompound_
 
bool writeJetsWithConst_
 

Private Attributes

edm::EDGetTokenT< reco::CandidateViewinput_cand_token_
 

Additional Inherited Members

- Public Types inherited from VirtualJetProducer
typedef std::shared_ptr< fastjet::GhostedAreaSpec > ActiveAreaSpecPtr
 
typedef std::shared_ptr< fastjet::AreaDefinition > AreaDefinitionPtr
 
typedef std::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
 
typedef std::shared_ptr< fastjet::JetDefinition > JetDefPtr
 
typedef std::shared_ptr< fastjet::JetDefinition::Plugin > PluginPtr
 
typedef std::shared_ptr< fastjet::Selector > SelectorPtr
 
- 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
 
- Static Public Member Functions inherited from VirtualJetProducer
static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void fillDescriptionsFromVirtualJetProducer (edm::ParameterSetDescription &desc)
 

Detailed Description

Definition at line 19 of file SubEventGenJetProducer.h.

Constructor & Destructor Documentation

◆ SubEventGenJetProducer()

SubEventGenJetProducer::SubEventGenJetProducer ( const edm::ParameterSet ps)

Definition at line 36 of file SubEventGenJetProducer.cc.

References edm::ParameterSet::getUntrackedParameter(), ignoreHydro_, input_cand_token_, and VirtualJetProducer::src_.

36  : VirtualJetProducer(conf) {
37  ignoreHydro_ = conf.getUntrackedParameter<bool>("ignoreHydro", true);
38 
39  // the subjet collections are set through the config file in the "jetCollInstanceName" field.
40 
41  input_cand_token_ = consumes<reco::CandidateView>(src_);
42 }
edm::EDGetTokenT< reco::CandidateView > input_cand_token_
VirtualJetProducer(const edm::ParameterSet &iConfig)

◆ ~SubEventGenJetProducer()

cms::SubEventGenJetProducer::~SubEventGenJetProducer ( )
inlineoverride

Definition at line 22 of file SubEventGenJetProducer.h.

22 {}

Member Function Documentation

◆ inputTowers()

void SubEventGenJetProducer::inputTowers ( )
overrideprotectedvirtual

Reimplemented from VirtualJetProducer.

Definition at line 44 of file SubEventGenJetProducer.cc.

References reco::GenParticle::collisionId(), hydroTag_, mps_fire::i, input, VirtualJetProducer::inputEMin_, VirtualJetProducer::inputEtMin_, VirtualJetProducer::inputs_, createfilelist::int, VirtualJetProducer::isAnomalousTower(), edm::isNotFinite(), LogDebug, AlCaHLTBitMon_ParallelJobs::p, and subInputs_.

Referenced by produce().

44  {
45  std::vector<edm::Ptr<reco::Candidate>>::const_iterator inBegin = inputs_.begin(), inEnd = inputs_.end(), i = inBegin;
46  for (; i != inEnd; ++i) {
47  reco::CandidatePtr input = inputs_[i - inBegin];
48  if (edm::isNotFinite(input->pt()))
49  continue;
50  if (input->et() < inputEtMin_)
51  continue;
52  if (input->energy() < inputEMin_)
53  continue;
55  continue;
56 
57  edm::Ptr<reco::Candidate> p = inputs_[i - inBegin];
58  const GenParticle* pref = dynamic_cast<const GenParticle*>(p.get());
59  int subevent = pref->collisionId();
60  LogDebug("SubEventContainers") << "SubEvent is : " << subevent << endl;
61  LogDebug("SubEventContainers") << "SubSize is : " << subInputs_.size() << endl;
62 
63  if (subevent >= (int)subInputs_.size()) {
64  hydroTag_.resize(subevent + 1, -1);
65  subInputs_.resize(subevent + 1);
66  LogDebug("SubEventContainers") << "SubSize is : " << subInputs_.size() << endl;
67  LogDebug("SubEventContainers") << "HydroTagSize is : " << hydroTag_.size() << endl;
68  }
69 
70  LogDebug("SubEventContainers") << "HydroTag is : " << hydroTag_[subevent] << endl;
71  if (hydroTag_[subevent] != 0)
72  hydroTag_[subevent] = (int)checkHydro(pref);
73 
74  subInputs_[subevent].push_back(fastjet::PseudoJet(input->px(), input->py(), input->pz(), input->energy()));
75 
76  subInputs_[subevent].back().set_user_index(i - inBegin);
77  }
78 }
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
static std::string const input
Definition: EdmProvDump.cc:50
virtual bool isAnomalousTower(reco::CandidatePtr input)
std::vector< edm::Ptr< reco::Candidate > > inputs_
int collisionId() const
Definition: GenParticle.h:36
std::vector< std::vector< fastjet::PseudoJet > > subInputs_
#define LogDebug(id)

◆ produce()

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

Definition at line 80 of file SubEventGenJetProducer.cc.

References VirtualJetProducer::fjInputs_, VirtualJetProducer::fjJets_, hydroTag_, mps_fire::i, iEvent, ignoreHydro_, input_cand_token_, VirtualJetProducer::inputs_, inputTowers(), jets_, LogDebug, eostools::move(), nsub, nSubParticles_, edm::View< T >::ptrAt(), runAlgorithm(), edm::View< T >::size(), and subInputs_.

80  {
81  LogDebug("VirtualJetProducer") << "Entered produce\n";
82 
83  fjJets_.clear();
84  subInputs_.clear();
85  nSubParticles_.clear();
86  hydroTag_.clear();
87  inputs_.clear();
88 
89  // get inputs and convert them to the fastjet format (fastjet::PeudoJet)
91  iEvent.getByToken(input_cand_token_, inputsHandle);
92  for (size_t i = 0; i < inputsHandle->size(); ++i) {
93  inputs_.push_back(inputsHandle->ptrAt(i));
94  }
95  LogDebug("VirtualJetProducer") << "Got inputs\n";
96 
97  inputTowers();
98  // Convert candidates to fastjet::PseudoJets.
99  // Also correct to Primary Vertex. Will modify fjInputs_
100  // and use inputs_
101 
103 
104  jets_ = std::make_unique<std::vector<GenJet>>();
105 
106  LogDebug("VirtualJetProducer") << "Inputted towers\n";
107 
108  size_t nsub = subInputs_.size();
109 
110  for (size_t isub = 0; isub < nsub; ++isub) {
111  if (ignoreHydro_ && hydroTag_[isub])
112  continue;
113  fjJets_.clear();
114  fjInputs_.clear();
115  fjInputs_ = subInputs_[isub];
116  runAlgorithm(iEvent, iSetup);
117  }
118 
119  //Finalize
120  LogDebug("SubEventJetProducer") << "Wrote jets\n";
121 
122  iEvent.put(std::move(jets_));
123  return;
124 }
Ptr< value_type > ptrAt(size_type i) const
void runAlgorithm(edm::Event &, const edm::EventSetup &) override
std::vector< fastjet::PseudoJet > fjJets_
edm::EDGetTokenT< reco::CandidateView > input_cand_token_
const int nsub
std::unique_ptr< std::vector< reco::GenJet > > jets_
size_type size() const
std::vector< fastjet::PseudoJet > fjInputs_
int iEvent
Definition: GenABIO.cc:224
std::vector< edm::Ptr< reco::Candidate > > inputs_
std::vector< std::vector< fastjet::PseudoJet > > subInputs_
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

◆ runAlgorithm()

void SubEventGenJetProducer::runAlgorithm ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements VirtualJetProducer.

Definition at line 126 of file SubEventGenJetProducer.cc.

References VirtualJetProducer::fjClusterSeq_, VirtualJetProducer::fjInputs_, VirtualJetProducer::fjJetDefinition_, VirtualJetProducer::fjJets_, VirtualJetProducer::getConstituents(), metsig::jet, VirtualJetProducer::jetPtMin_, jets_, displacedMuons_cfi::pu, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, VirtualJetProducer::vertex_, and reco::writeSpecific().

Referenced by produce().

126  {
127  // run algorithm
128  fjJets_.clear();
129 
130  fjClusterSeq_ = std::make_shared<fastjet::ClusterSequence>(fjInputs_, *fjJetDefinition_);
131  fjJets_ = fastjet::sorted_by_pt(fjClusterSeq_->inclusive_jets(jetPtMin_));
132 
133  using namespace reco;
134 
135  for (unsigned int ijet = 0; ijet < fjJets_.size(); ++ijet) {
136  GenJet jet;
137  const fastjet::PseudoJet& fjJet = fjJets_[ijet];
138 
139  std::vector<fastjet::PseudoJet> fjConstituents = sorted_by_pt(fjClusterSeq_->constituents(fjJet));
140 
141  std::vector<CandidatePtr> constituents = getConstituents(fjConstituents);
142 
143  double px = fjJet.px();
144  double py = fjJet.py();
145  double pz = fjJet.pz();
146  double E = fjJet.E();
147  double jetArea = 0.0;
148  double pu = 0.;
149 
150  writeSpecific(jet, Particle::LorentzVector(px, py, pz, E), vertex_, constituents);
151 
152  jet.setJetArea(jetArea);
153  jet.setPileup(pu);
154 
155  jets_->push_back(jet);
156  }
157 }
reco::Particle::Point vertex_
virtual std::vector< reco::CandidatePtr > getConstituents(const std::vector< fastjet::PseudoJet > &fjConstituents)
std::vector< fastjet::PseudoJet > fjJets_
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)
Definition: JetSpecific.cc:32
std::unique_ptr< std::vector< reco::GenJet > > jets_
std::vector< fastjet::PseudoJet > fjInputs_
ClusterSequencePtr fjClusterSeq_
Jets made from MC generator particles.
Definition: GenJet.h:23
fixed size matrix
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

◆ hydroTag_

std::vector<int> cms::SubEventGenJetProducer::hydroTag_
protected

Definition at line 29 of file SubEventGenJetProducer.h.

Referenced by inputTowers(), and produce().

◆ ignoreHydro_

bool cms::SubEventGenJetProducer::ignoreHydro_
protected

Definition at line 31 of file SubEventGenJetProducer.h.

Referenced by produce(), and SubEventGenJetProducer().

◆ input_cand_token_

edm::EDGetTokenT<reco::CandidateView> cms::SubEventGenJetProducer::input_cand_token_
private

Definition at line 39 of file SubEventGenJetProducer.h.

Referenced by produce(), and SubEventGenJetProducer().

◆ jets_

std::unique_ptr<std::vector<reco::GenJet> > cms::SubEventGenJetProducer::jets_
protected

Definition at line 28 of file SubEventGenJetProducer.h.

Referenced by produce(), and runAlgorithm().

◆ nSubParticles_

std::vector<int> cms::SubEventGenJetProducer::nSubParticles_
protected

Definition at line 30 of file SubEventGenJetProducer.h.

Referenced by produce().

◆ subInputs_

std::vector<std::vector<fastjet::PseudoJet> > cms::SubEventGenJetProducer::subInputs_
protected

Definition at line 27 of file SubEventGenJetProducer.h.

Referenced by inputTowers(), and produce().