CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
cms::SubEventGenJetProducer Class Reference

#include <SubEventGenJetProducer.h>

Inheritance diagram for cms::SubEventGenJetProducer:
VirtualJetProducer edm::EDProducer 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::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

virtual void inputTowers ()
 
- Protected Member Functions inherited from VirtualJetProducer
virtual void copyConstituents (const std::vector< fastjet::PseudoJet > &fjConstituents, reco::Jet *jet)
 
virtual std::vector
< reco::CandidatePtr
getConstituents (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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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
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_
 
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 rParam_
 
edm::InputTag src_
 
edm::InputTag srcPVs_
 
boost::shared_ptr
< PileUpSubtractor
subtractor_
 
bool useDeterministicSeed_
 
bool useExplicitGhosts_
 
int verbosity_
 
reco::Particle::Point vertex_
 
double voronoiRfact_
 
bool writeCompound_
 

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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
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 39 of file SubEventGenJetProducer.cc.

References edm::ParameterSet::getUntrackedParameter(), and ignoreHydro_.

39  :
41 {
42  // mapSrc_ = conf.getParameter<edm::InputTag>( "srcMap");
43  ignoreHydro_ = conf.getUntrackedParameter<bool>("ignoreHydro", true);
44  produces<reco::BasicJetCollection>();
45  // the subjet collections are set through the config file in the "jetCollInstanceName" field.
46 }
tuple conf
Definition: dbtoconf.py:185
VirtualJetProducer(const edm::ParameterSet &iConfig)
virtual cms::SubEventGenJetProducer::~SubEventGenJetProducer ( )
inlinevirtual

Definition at line 24 of file SubEventGenJetProducer.h.

24 {}

Member Function Documentation

void SubEventGenJetProducer::inputTowers ( )
protectedvirtual

Reimplemented from VirtualJetProducer.

Definition at line 49 of file SubEventGenJetProducer.cc.

References reco::GenParticle::collisionId(), edm::Ptr< T >::get(), hydroTag_, i, input, VirtualJetProducer::inputEMin_, VirtualJetProducer::inputEtMin_, VirtualJetProducer::inputs_, VirtualJetProducer::isAnomalousTower(), edm::isNotFinite(), LogDebug, and subInputs_.

Referenced by produce().

50 {
51  std::vector<edm::Ptr<reco::Candidate> >::const_iterator inBegin = inputs_.begin(),
52  inEnd = inputs_.end(), i = inBegin;
53  for (; i != inEnd; ++i ) {
54  reco::CandidatePtr input = inputs_[i - inBegin];
55  if (edm::isNotFinite(input->pt())) continue;
56  if (input->et() <inputEtMin_) continue;
57  if (input->energy()<inputEMin_) continue;
58  if (isAnomalousTower(input)) 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) hydroTag_[subevent] = (int)checkHydro(pref);
75 
76  subInputs_[subevent].push_back(fastjet::PseudoJet(input->px(),input->py(),input->pz(),
77  input->energy()));
78 
79  subInputs_[subevent].back().set_user_index(i - inBegin);
80 
81  }
82 
83 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
int collisionId() const
Definition: GenParticle.h:38
static std::string const input
Definition: EdmProvDump.cc:44
virtual bool isAnomalousTower(reco::CandidatePtr input)
bool isNotFinite(T x)
Definition: isFinite.h:10
std::vector< edm::Ptr< reco::Candidate > > inputs_
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:143
std::vector< std::vector< fastjet::PseudoJet > > subInputs_
void SubEventGenJetProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from VirtualJetProducer.

Definition at line 85 of file SubEventGenJetProducer.cc.

References VirtualJetProducer::fjInputs_, VirtualJetProducer::fjJets_, edm::Event::getByLabel(), hydroTag_, i, ignoreHydro_, VirtualJetProducer::inputs_, inputTowers(), fwrapper::jets, LogDebug, nSubParticles_, edm::Event::put(), runAlgorithm(), VirtualJetProducer::src_, subInputs_, and subJets_.

85  {
86  LogDebug("VirtualJetProducer") << "Entered produce\n";
87 
88  fjJets_.clear();
89  subInputs_.clear();
90  nSubParticles_.clear();
91  hydroTag_.clear();
92  inputs_.clear();
93 
94  // get inputs and convert them to the fastjet format (fastjet::PeudoJet)
96  iEvent.getByLabel(src_,inputsHandle);
97  for (size_t i = 0; i < inputsHandle->size(); ++i) {
98  inputs_.push_back(inputsHandle->ptrAt(i));
99  }
100  LogDebug("VirtualJetProducer") << "Got inputs\n";
101 
102  inputTowers();
103  // Convert candidates to fastjet::PseudoJets.
104  // Also correct to Primary Vertex. Will modify fjInputs_
105  // and use inputs_
106 
108 
109  std::auto_ptr<std::vector<GenJet> > jets(new std::vector<GenJet>() );
110  subJets_ = jets.get();
111 
112  LogDebug("VirtualJetProducer") << "Inputted towers\n";
113 
114  size_t nsub = subInputs_.size();
115 
116  for(size_t isub = 0; isub < nsub; ++isub){
117  if(ignoreHydro_ && hydroTag_[isub]) continue;
118  fjJets_.clear();
119  fjInputs_.clear();
120  fjInputs_ = subInputs_[isub];
121  runAlgorithm( iEvent, iSetup );
122  }
123 
124  //Finalize
125  LogDebug("SubEventJetProducer") << "Wrote jets\n";
126 
127  iEvent.put(jets);
128  return;
129 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< fastjet::PseudoJet > fjJets_
std::vector< reco::GenJet > * subJets_
std::vector< fastjet::PseudoJet > fjInputs_
std::vector< edm::Ptr< reco::Candidate > > inputs_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
vector< PseudoJet > jets
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< std::vector< fastjet::PseudoJet > > subInputs_
void runAlgorithm(edm::Event &, const edm::EventSetup &)
void SubEventGenJetProducer::runAlgorithm ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements VirtualJetProducer.

Definition at line 131 of file SubEventGenJetProducer.cc.

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

Referenced by produce().

132 {
133  // run algorithm
134  fjJets_.clear();
135 
136  fjClusterSeq_ = ClusterSequencePtr( new fastjet::ClusterSequence( fjInputs_, *fjJetDefinition_ ) );
137  fjJets_ = fastjet::sorted_by_pt(fjClusterSeq_->inclusive_jets(jetPtMin_));
138 
139  using namespace reco;
140 
141  for (unsigned int ijet=0;ijet<fjJets_.size();++ijet) {
142 
143  GenJet jet;
144  const fastjet::PseudoJet& fjJet = fjJets_[ijet];
145 
146  std::vector<fastjet::PseudoJet> fjConstituents =
147  sorted_by_pt(fjClusterSeq_->constituents(fjJet));
148 
149  std::vector<CandidatePtr> constituents =
150  getConstituents(fjConstituents);
151 
152  double px=fjJet.px();
153  double py=fjJet.py();
154  double pz=fjJet.pz();
155  double E=fjJet.E();
156  double jetArea=0.0;
157  double pu=0.;
158 
159  writeSpecific( jet,
160  Particle::LorentzVector(px, py, pz, E),
161  vertex_,
162  constituents, iSetup);
163 
164  jet.setJetArea (jetArea);
165  jet.setPileup (pu);
166 
167  subJets_->push_back(jet);
168  }
169 }
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
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:27
boost::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
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().

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