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

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)
 
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::vector< int > nSubParticles_
 
std::vector< std::vector< fastjet::PseudoJet > > subInputs_
 
std::vector< reco::GenJet > * subJets_
 
- 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<>
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
 
- Static Public Member Functions inherited from VirtualJetProducer
static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void fillDescriptionsFromVirtualJetProducer (edm::ParameterSetDescription &desc)
 

Detailed Description

Definition at line 18 of file SubEventGenJetProducer.h.

Constructor & Destructor Documentation

◆ SubEventGenJetProducer()

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

Definition at line 38 of file SubEventGenJetProducer.cc.

38  : VirtualJetProducer(conf) {
39  // mapSrc_ = conf.getParameter<edm::InputTag>( "srcMap");
40  ignoreHydro_ = conf.getUntrackedParameter<bool>("ignoreHydro", true);
41  produces<reco::BasicJetCollection>();
42  // the subjet collections are set through the config file in the "jetCollInstanceName" field.
43 
44  input_cand_token_ = consumes<reco::CandidateView>(src_);
45 }

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

◆ ~SubEventGenJetProducer()

cms::SubEventGenJetProducer::~SubEventGenJetProducer ( )
inlineoverride

Definition at line 21 of file SubEventGenJetProducer.h.

21 {}

Member Function Documentation

◆ inputTowers()

void SubEventGenJetProducer::inputTowers ( )
overrideprotectedvirtual

Reimplemented from VirtualJetProducer.

Definition at line 47 of file SubEventGenJetProducer.cc.

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

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

◆ produce()

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

Definition at line 83 of file SubEventGenJetProducer.cc.

83  {
84  LogDebug("VirtualJetProducer") << "Entered produce\n";
85 
86  fjJets_.clear();
87  subInputs_.clear();
88  nSubParticles_.clear();
89  hydroTag_.clear();
90  inputs_.clear();
91 
92  // get inputs and convert them to the fastjet format (fastjet::PeudoJet)
94  iEvent.getByToken(input_cand_token_, inputsHandle);
95  for (size_t i = 0; i < inputsHandle->size(); ++i) {
96  inputs_.push_back(inputsHandle->ptrAt(i));
97  }
98  LogDebug("VirtualJetProducer") << "Got inputs\n";
99 
100  inputTowers();
101  // Convert candidates to fastjet::PseudoJets.
102  // Also correct to Primary Vertex. Will modify fjInputs_
103  // and use inputs_
104 
106 
107  auto jets = std::make_unique<std::vector<GenJet>>();
108  subJets_ = jets.get();
109 
110  LogDebug("VirtualJetProducer") << "Inputted towers\n";
111 
112  size_t nsub = subInputs_.size();
113 
114  for (size_t isub = 0; isub < nsub; ++isub) {
115  if (ignoreHydro_ && hydroTag_[isub])
116  continue;
117  fjJets_.clear();
118  fjInputs_.clear();
119  fjInputs_ = subInputs_[isub];
120  runAlgorithm(iEvent, iSetup);
121  }
122 
123  //Finalize
124  LogDebug("SubEventJetProducer") << "Wrote jets\n";
125 
126  iEvent.put(std::move(jets));
127  return;
128 }

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

◆ runAlgorithm()

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

Implements VirtualJetProducer.

Definition at line 130 of file SubEventGenJetProducer.cc.

130  {
131  // run algorithm
132  fjJets_.clear();
133 
134  fjClusterSeq_ = std::make_shared<fastjet::ClusterSequence>(fjInputs_, *fjJetDefinition_);
135  fjJets_ = fastjet::sorted_by_pt(fjClusterSeq_->inclusive_jets(jetPtMin_));
136 
137  using namespace reco;
138 
139  for (unsigned int ijet = 0; ijet < fjJets_.size(); ++ijet) {
140  GenJet jet;
141  const fastjet::PseudoJet& fjJet = fjJets_[ijet];
142 
143  std::vector<fastjet::PseudoJet> fjConstituents = sorted_by_pt(fjClusterSeq_->constituents(fjJet));
144 
145  std::vector<CandidatePtr> constituents = getConstituents(fjConstituents);
146 
147  double px = fjJet.px();
148  double py = fjJet.py();
149  double pz = fjJet.pz();
150  double E = fjJet.E();
151  double jetArea = 0.0;
152  double pu = 0.;
153 
154  writeSpecific(jet, Particle::LorentzVector(px, py, pz, E), vertex_, constituents, iSetup);
155 
156  jet.setJetArea(jetArea);
157  jet.setPileup(pu);
158 
159  subJets_->push_back(jet);
160  }
161 }

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

Referenced by produce().

Member Data Documentation

◆ hydroTag_

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

Definition at line 28 of file SubEventGenJetProducer.h.

Referenced by inputTowers(), and produce().

◆ ignoreHydro_

bool cms::SubEventGenJetProducer::ignoreHydro_
protected

Definition at line 30 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 38 of file SubEventGenJetProducer.h.

Referenced by produce(), and SubEventGenJetProducer().

◆ nSubParticles_

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

Definition at line 29 of file SubEventGenJetProducer.h.

Referenced by produce().

◆ subInputs_

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

Definition at line 26 of file SubEventGenJetProducer.h.

Referenced by inputTowers(), and produce().

◆ subJets_

std::vector<reco::GenJet>* cms::SubEventGenJetProducer::subJets_
protected

Definition at line 27 of file SubEventGenJetProducer.h.

Referenced by produce(), and runAlgorithm().

reco::writeSpecific
void writeSpecific(reco::CaloJet &jet, reco::Particle::LorentzVector const &p4, reco::Particle::Point const &point, std::vector< reco::CandidatePtr > const &constituents, edm::EventSetup const &c)
Definition: JetSpecific.cc:34
mps_fire.i
i
Definition: mps_fire.py:355
input
static const std::string input
Definition: EdmProvDump.cc:48
reco::GenJet
Jets made from MC generator particles.
Definition: GenJet.h:23
reco::GenParticle::collisionId
int collisionId() const
Definition: GenParticle.h:36
cms::SubEventGenJetProducer::runAlgorithm
void runAlgorithm(edm::Event &, const edm::EventSetup &) override
Definition: SubEventGenJetProducer.cc:130
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
cms::SubEventGenJetProducer::input_cand_token_
edm::EDGetTokenT< reco::CandidateView > input_cand_token_
Definition: SubEventGenJetProducer.h:38
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cms::SubEventGenJetProducer::hydroTag_
std::vector< int > hydroTag_
Definition: SubEventGenJetProducer.h:28
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
GenParticle
Definition: GenParticle.py:1
VirtualJetProducer::vertex_
reco::Particle::Point vertex_
Definition: VirtualJetProducer.h:184
VirtualJetProducer::fjClusterSeq_
ClusterSequencePtr fjClusterSeq_
Definition: VirtualJetProducer.h:185
VirtualJetProducer::inputEtMin_
double inputEtMin_
Definition: VirtualJetProducer.h:153
VirtualJetProducer::VirtualJetProducer
VirtualJetProducer(const edm::ParameterSet &iConfig)
Definition: VirtualJetProducer.cc:113
cms::SubEventGenJetProducer::inputTowers
void inputTowers() override
Definition: SubEventGenJetProducer.cc:47
cms::SubEventGenJetProducer::subJets_
std::vector< reco::GenJet > * subJets_
Definition: SubEventGenJetProducer.h:27
nsub
const int nsub
Definition: CMTRawAnalyzer.h:421
VirtualJetProducer::inputs_
std::vector< edm::Ptr< reco::Candidate > > inputs_
Definition: VirtualJetProducer.h:183
edm::View::size
size_type size() const
VirtualJetProducer::src_
edm::InputTag src_
Definition: VirtualJetProducer.h:148
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
VirtualJetProducer::isAnomalousTower
virtual bool isAnomalousTower(reco::CandidatePtr input)
Definition: VirtualJetProducer.cc:499
VirtualJetProducer::jetPtMin_
double jetPtMin_
Definition: VirtualJetProducer.h:155
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
cms::SubEventGenJetProducer::ignoreHydro_
bool ignoreHydro_
Definition: SubEventGenJetProducer.h:30
cms::SubEventGenJetProducer::nSubParticles_
std::vector< int > nSubParticles_
Definition: SubEventGenJetProducer.h:29
edm::Ptr< Candidate >
reco::JetExtendedAssociation::LorentzVector
math::PtEtaPhiELorentzVectorF LorentzVector
Definition: JetExtendedAssociation.h:25
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
cms::SubEventGenJetProducer::subInputs_
std::vector< std::vector< fastjet::PseudoJet > > subInputs_
Definition: SubEventGenJetProducer.h:26
eostools.move
def move(src, dest)
Definition: eostools.py:511
VirtualJetProducer::getConstituents
virtual std::vector< reco::CandidatePtr > getConstituents(const std::vector< fastjet::PseudoJet > &fjConstituents)
Definition: VirtualJetProducer.cc:522
metsig::jet
Definition: SignAlgoResolutions.h:47
VirtualJetProducer::fjJets_
std::vector< fastjet::PseudoJet > fjJets_
Definition: VirtualJetProducer.h:192
VirtualJetProducer::fjJetDefinition_
JetDefPtr fjJetDefinition_
Definition: VirtualJetProducer.h:186
muons2muons_cfi.pu
pu
Definition: muons2muons_cfi.py:31
VirtualJetProducer::fjInputs_
std::vector< fastjet::PseudoJet > fjInputs_
Definition: VirtualJetProducer.h:191
edm::View::ptrAt
Ptr< value_type > ptrAt(size_type i) const
VirtualJetProducer::inputEMin_
double inputEMin_
Definition: VirtualJetProducer.h:154