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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &)
 
void runAlgorithm (edm::Event &, const edm::EventSetup &)
 
 SubEventGenJetProducer (const edm::ParameterSet &ps)
 
virtual ~SubEventGenJetProducer ()
 
- Public Member Functions inherited from VirtualJetProducer
std::string jetType () const
 
 VirtualJetProducer (const edm::ParameterSet &iConfig)
 
virtual ~VirtualJetProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

virtual void inputTowers ()
 
- 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)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 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_
 
RangeDefPtr fjRangeDef_
 
bool fromHTTTopJetProducer_
 
double ghostArea_
 
double ghostEtaMax_
 
edm::EDGetTokenT< reco::VertexCollectioninput_vertex_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_
 
boost::shared_ptr< PileUpSubtractorsubtractor_
 
bool useDeterministicSeed_
 
bool useExplicitGhosts_
 
int verbosity_
 
reco::Particle::Point vertex_
 
double voronoiRfact_
 
bool writeCompound_
 

Private Attributes

edm::EDGetTokenT< reco::CandidateViewinput_cand_token_
 

Additional Inherited Members

- Public Types inherited from VirtualJetProducer
typedef boost::shared_ptr< fastjet::GhostedAreaSpec > ActiveAreaSpecPtr
 
typedef boost::shared_ptr< fastjet::AreaDefinition > AreaDefinitionPtr
 
typedef boost::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
 
typedef boost::shared_ptr< fastjet::JetDefinition > JetDefPtr
 
typedef boost::shared_ptr< fastjet::JetDefinition::Plugin > PluginPtr
 
typedef boost::shared_ptr< fastjet::RangeDefinition > RangeDefPtr
 
- 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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from VirtualJetProducer
static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void fillDescriptionsFromVirtualJetProducer (edm::ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 19 of file SubEventGenJetProducer.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file SubEventGenJetProducer.cc.

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

34  :
35  VirtualJetProducer( conf )
36 {
37  // mapSrc_ = conf.getParameter<edm::InputTag>( "srcMap");
38  ignoreHydro_ = conf.getUntrackedParameter<bool>("ignoreHydro", true);
39  produces<reco::BasicJetCollection>();
40  // the subjet collections are set through the config file in the "jetCollInstanceName" field.
41 
42  input_cand_token_ = consumes<reco::CandidateView>(src_);
43 
44 }
edm::EDGetTokenT< reco::CandidateView > input_cand_token_
VirtualJetProducer(const edm::ParameterSet &iConfig)
virtual cms::SubEventGenJetProducer::~SubEventGenJetProducer ( )
inlinevirtual

Definition at line 24 of file SubEventGenJetProducer.h.

References produce(), and runAlgorithm().

24 {}

Member Function Documentation

void SubEventGenJetProducer::inputTowers ( )
protectedvirtual

Reimplemented from VirtualJetProducer.

Definition at line 47 of file SubEventGenJetProducer.cc.

References reco::GenParticle::collisionId(), reco::Candidate::energy(), reco::Candidate::et(), edm::Ptr< T >::get(), hydroTag_, mps_fire::i, input, VirtualJetProducer::inputEMin_, VirtualJetProducer::inputEtMin_, VirtualJetProducer::inputs_, createfilelist::int, VirtualJetProducer::isAnomalousTower(), edm::isNotFinite(), LogDebug, reco::Candidate::pt(), reco::Candidate::px(), reco::Candidate::py(), reco::Candidate::pz(), and subInputs_.

Referenced by produce().

48 {
49  std::vector<edm::Ptr<reco::Candidate> >::const_iterator inBegin = inputs_.begin(),
50  inEnd = inputs_.end(), i = inBegin;
51  for (; i != inEnd; ++i ) {
52  reco::CandidatePtr input = inputs_[i - inBegin];
53  if (edm::isNotFinite(input->pt())) continue;
54  if (input->et() <inputEtMin_) continue;
55  if (input->energy()<inputEMin_) continue;
56  if (isAnomalousTower(input)) continue;
57 
58  edm::Ptr<reco::Candidate> p = inputs_[i - inBegin];
59  const GenParticle * pref = dynamic_cast<const GenParticle *>(p.get());
60  int subevent = pref->collisionId();
61  LogDebug("SubEventContainers")<<"SubEvent is : "<<subevent<<endl;
62  LogDebug("SubEventContainers")<<"SubSize is : "<<subInputs_.size()<<endl;
63 
64  if(subevent >= (int)subInputs_.size()){
65  hydroTag_.resize(subevent+1, -1);
66  subInputs_.resize(subevent+1);
67  LogDebug("SubEventContainers")<<"SubSize is : "<<subInputs_.size()<<endl;
68  LogDebug("SubEventContainers")<<"HydroTagSize is : "<<hydroTag_.size()<<endl;
69  }
70 
71  LogDebug("SubEventContainers")<<"HydroTag is : "<<hydroTag_[subevent]<<endl;
72  if(hydroTag_[subevent] != 0) hydroTag_[subevent] = (int)checkHydro(pref);
73 
74  subInputs_[subevent].push_back(fastjet::PseudoJet(input->px(),input->py(),input->pz(),
75  input->energy()));
76 
77  subInputs_[subevent].back().set_user_index(i - inBegin);
78 
79  }
80 
81 }
#define LogDebug(id)
virtual double pz() const =0
z coordinate of momentum vector
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:160
int collisionId() const
Definition: GenParticle.h:39
static std::string const input
Definition: EdmProvDump.cc:44
virtual bool isAnomalousTower(reco::CandidatePtr input)
virtual double et() const =0
transverse energy
virtual double energy() const =0
energy
virtual double py() const =0
y coordinate of momentum vector
bool isNotFinite(T x)
Definition: isFinite.h:10
std::vector< edm::Ptr< reco::Candidate > > inputs_
virtual double pt() const =0
transverse momentum
std::vector< std::vector< fastjet::PseudoJet > > subInputs_
virtual double px() const =0
x coordinate of momentum vector
void SubEventGenJetProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from VirtualJetProducer.

Definition at line 83 of file SubEventGenJetProducer.cc.

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

Referenced by ~SubEventGenJetProducer().

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]) continue;
116  fjJets_.clear();
117  fjInputs_.clear();
118  fjInputs_ = subInputs_[isub];
119  runAlgorithm( iEvent, iSetup );
120  }
121 
122  //Finalize
123  LogDebug("SubEventJetProducer") << "Wrote jets\n";
124 
125  iEvent.put(std::move(jets));
126  return;
127 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
std::vector< fastjet::PseudoJet > fjJets_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< reco::CandidateView > input_cand_token_
Ptr< value_type > ptrAt(size_type i) const
size_type size() const
std::vector< reco::GenJet > * subJets_
std::vector< fastjet::PseudoJet > fjInputs_
std::vector< edm::Ptr< reco::Candidate > > inputs_
vector< PseudoJet > jets
std::vector< std::vector< fastjet::PseudoJet > > subInputs_
def move(src, dest)
Definition: eostools.py:510
void runAlgorithm(edm::Event &, const edm::EventSetup &)
void SubEventGenJetProducer::runAlgorithm ( edm::Event ,
const edm::EventSetup  
)
virtual

Implements VirtualJetProducer.

Definition at line 129 of file SubEventGenJetProducer.cc.

References DEFINE_FWK_MODULE, VirtualJetProducer::fjClusterSeq_, VirtualJetProducer::fjInputs_, VirtualJetProducer::fjJetDefinition_, VirtualJetProducer::fjJets_, VirtualJetProducer::getConstituents(), metsig::jet, VirtualJetProducer::jetPtMin_, muons2muons_cfi::pu, reco::Jet::setJetArea(), reco::Jet::setPileup(), subJets_, VirtualJetProducer::vertex_, and reco::writeSpecific().

Referenced by produce(), and ~SubEventGenJetProducer().

130 {
131  // run algorithm
132  fjJets_.clear();
133 
134  fjClusterSeq_ = ClusterSequencePtr( new 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 
141  GenJet jet;
142  const fastjet::PseudoJet& fjJet = fjJets_[ijet];
143 
144  std::vector<fastjet::PseudoJet> fjConstituents =
145  sorted_by_pt(fjClusterSeq_->constituents(fjJet));
146 
147  std::vector<CandidatePtr> constituents =
148  getConstituents(fjConstituents);
149 
150  double px=fjJet.px();
151  double py=fjJet.py();
152  double pz=fjJet.pz();
153  double E=fjJet.E();
154  double jetArea=0.0;
155  double pu=0.;
156 
157  writeSpecific( jet,
158  Particle::LorentzVector(px, py, pz, E),
159  vertex_,
160  constituents, iSetup);
161 
162  jet.setJetArea (jetArea);
163  jet.setPileup (pu);
164 
165  subJets_->push_back(jet);
166  }
167 }
reco::Particle::Point vertex_
virtual std::vector< reco::CandidatePtr > getConstituents(const std::vector< fastjet::PseudoJet > &fjConstituents)
std::vector< fastjet::PseudoJet > fjJets_
virtual void setPileup(float fEnergy)
Set pileup energy contribution as calculated by algorithm.
Definition: Jet.h:108
std::vector< reco::GenJet > * subJets_
virtual void setJetArea(float fArea)
set jet area
Definition: Jet.h:103
std::vector< fastjet::PseudoJet > fjInputs_
ClusterSequencePtr fjClusterSeq_
Jets made from MC generator particles.
Definition: GenJet.h:24
fixed size matrix
boost::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
math::PtEtaPhiELorentzVectorF LorentzVector
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:41

Member Data Documentation

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

Definition at line 31 of file SubEventGenJetProducer.h.

Referenced by inputTowers(), and produce().

bool cms::SubEventGenJetProducer::ignoreHydro_
protected

Definition at line 33 of file SubEventGenJetProducer.h.

Referenced by produce(), and SubEventGenJetProducer().

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

Definition at line 42 of file SubEventGenJetProducer.h.

Referenced by produce(), and SubEventGenJetProducer().

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

Definition at line 32 of file SubEventGenJetProducer.h.

Referenced by produce().

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

Definition at line 29 of file SubEventGenJetProducer.h.

Referenced by inputTowers(), and produce().

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

Definition at line 30 of file SubEventGenJetProducer.h.

Referenced by produce(), and runAlgorithm().