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::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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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_
 
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
 
typedef WorkerT< EDProducerWorkerType
 
- 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 38 of file SubEventGenJetProducer.cc.

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

38  :
40 {
41  // mapSrc_ = conf.getParameter<edm::InputTag>( "srcMap");
42  ignoreHydro_ = conf.getUntrackedParameter<bool>("ignoreHydro", true);
43  produces<reco::BasicJetCollection>();
44  // the subjet collections are set through the config file in the "jetCollInstanceName" field.
45 }
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 48 of file SubEventGenJetProducer.cc.

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

Referenced by produce().

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

Reimplemented from VirtualJetProducer.

Definition at line 84 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_.

84  {
85  LogDebug("VirtualJetProducer") << "Entered produce\n";
86 
87  fjJets_.clear();
88  subInputs_.clear();
89  nSubParticles_.clear();
90  hydroTag_.clear();
91  inputs_.clear();
92 
93  // get inputs and convert them to the fastjet format (fastjet::PeudoJet)
95  iEvent.getByLabel(src_,inputsHandle);
96  for (size_t i = 0; i < inputsHandle->size(); ++i) {
97  inputs_.push_back(inputsHandle->ptrAt(i));
98  }
99  LogDebug("VirtualJetProducer") << "Got inputs\n";
100 
101  inputTowers();
102  // Convert candidates to fastjet::PseudoJets.
103  // Also correct to Primary Vertex. Will modify fjInputs_
104  // and use inputs_
105 
107 
108  std::auto_ptr<std::vector<GenJet> > jets(new std::vector<GenJet>() );
109  subJets_ = jets.get();
110 
111  LogDebug("VirtualJetProducer") << "Inputted towers\n";
112 
113  size_t nsub = subInputs_.size();
114 
115  for(size_t isub = 0; isub < nsub; ++isub){
116  if(ignoreHydro_ && hydroTag_[isub]) 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(jets);
127  return;
128 }
#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:85
vector< PseudoJet > jets
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
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 130 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().

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