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::CompoundJetProducer Class Reference

#include <CompoundJetProducer.h>

Inheritance diagram for cms::CompoundJetProducer:
VirtualJetProducer edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper cms::SubJetProducer

Public Member Functions

 CompoundJetProducer (const edm::ParameterSet &ps)
 
virtual ~CompoundJetProducer ()
 
- Public Member Functions inherited from VirtualJetProducer
std::string jetType () const
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 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 &)
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

virtual void inputTowers ()
 compound fastjet::PseudoJets More...
 
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...
 
- 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 runAlgorithm (edm::Event &iEvent, const edm::EventSetup &iSetup)=0
 
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
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< CompoundPseudoJetfjCompoundJets_
 
- 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 41 of file CompoundJetProducer.h.

Constructor & Destructor Documentation

CompoundJetProducer::CompoundJetProducer ( const edm::ParameterSet ps)

Definition at line 18 of file CompoundJetProducer.cc.

18  :
20 {
21 
22  produces<reco::BasicJetCollection>();
23  // the subjet collections are set through the config file in the "jetCollInstanceName" field.
24 }
tuple conf
Definition: dbtoconf.py:185
VirtualJetProducer(const edm::ParameterSet &iConfig)
virtual cms::CompoundJetProducer::~CompoundJetProducer ( )
inlinevirtual

Definition at line 47 of file CompoundJetProducer.h.

47 {}

Member Function Documentation

void CompoundJetProducer::inputTowers ( )
protectedvirtual

compound fastjet::PseudoJets

Reimplemented from VirtualJetProducer.

Definition at line 27 of file CompoundJetProducer.cc.

References fjCompoundJets_, and VirtualJetProducer::inputTowers().

28 {
29  fjCompoundJets_.clear();
31 }
virtual void inputTowers()
std::vector< CompoundPseudoJet > fjCompoundJets_
void CompoundJetProducer::output ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
protectedvirtual

Overridden output method. For the compound jet producer, this will call the "writeCompoundJets" function template.

Reimplemented from VirtualJetProducer.

Definition at line 33 of file CompoundJetProducer.cc.

References VirtualJetProducer::JetType::BasicJet, VirtualJetProducer::JetType::CaloJet, edm::hlt::Exception, VirtualJetProducer::JetType::GenJet, iEvent, VirtualJetProducer::jetTypeE, and VirtualJetProducer::JetType::PFJet.

34 {
35  // Write jets and constitutents. Will use fjJets_.
36  switch( jetTypeE ) {
37  case JetType::CaloJet :
38  writeCompoundJets<reco::CaloJet>( iEvent, iSetup );
39  break;
40  case JetType::PFJet :
41  writeCompoundJets<reco::PFJet>( iEvent, iSetup );
42  break;
43  case JetType::GenJet :
44  writeCompoundJets<reco::GenJet>( iEvent, iSetup );
45  break;
46  case JetType::BasicJet :
47  writeCompoundJets<reco::BasicJet>( iEvent, iSetup );
48  break;
49  default:
50  throw cms::Exception("InvalidInput") << "invalid jet type in CompoundJetProducer\n";
51  break;
52  };
53 
54 }
JetType::Type jetTypeE
int iEvent
Definition: GenABIO.cc:243
template<class T >
void CompoundJetProducer::writeCompoundJets ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
protected

function template to write out the outputs

Definition at line 58 of file CompoundJetProducer.cc.

References fjCompoundJets_, VirtualJetProducer::inputs_, metsig::jet, VirtualJetProducer::jetCollInstanceName_, point, edm::Event::put(), reco::Jet::setJetArea(), and reco::writeSpecific().

59 {
60 
61  // get a list of output jets
62  std::auto_ptr<reco::BasicJetCollection> jetCollection( new reco::BasicJetCollection() );
63  // get a list of output subjets
64  std::auto_ptr<std::vector<T> > subjetCollection( new std::vector<T>() );
65 
66  // This will store the handle for the subjets after we write them
67  edm::OrphanHandle< std::vector<T> > subjetHandleAfterPut;
68  // this is the mapping of subjet to hard jet
69  std::vector< std::vector<int> > indices;
70  // this is the list of hardjet 4-momenta
71  std::vector<math::XYZTLorentzVector> p4_hardJets;
72  // this is the hardjet areas
73  std::vector<double> area_hardJets;
74 
75 
76  // Loop over the hard jets
77  std::vector<CompoundPseudoJet>::const_iterator it = fjCompoundJets_.begin(),
78  iEnd = fjCompoundJets_.end(),
79  iBegin = fjCompoundJets_.begin();
80  indices.resize( fjCompoundJets_.size() );
81  for ( ; it != iEnd; ++it ) {
82  int jetIndex = it - iBegin;
83  fastjet::PseudoJet localJet = it->hardJet();
84  // Get the 4-vector for the hard jet
85  p4_hardJets.push_back( math::XYZTLorentzVector(localJet.px(), localJet.py(), localJet.pz(), localJet.e() ));
86  area_hardJets.push_back( it->hardJetArea() );
87 
88  // create the subjet list
89  std::vector<CompoundPseudoSubJet>::const_iterator itSubJetBegin = it->subjets().begin(),
90  itSubJet = itSubJetBegin, itSubJetEnd = it->subjets().end();
91  for (; itSubJet != itSubJetEnd; ++itSubJet ){
92 
93  fastjet::PseudoJet subjet = itSubJet->subjet();
94  math::XYZTLorentzVector p4Subjet(subjet.px(), subjet.py(), subjet.pz(), subjet.e() );
96 
97  // This will hold ptr's to the subjets
98  std::vector<reco::CandidatePtr> subjetConstituents;
99 
100  // Get the transient subjet constituents from fastjet
101  std::vector<int> const & subjetFastjetConstituentIndices = itSubJet->constituents();
102  std::vector<int>::const_iterator fastSubIt = subjetFastjetConstituentIndices.begin(),
103  transConstEnd = subjetFastjetConstituentIndices.end();
104  for ( ; fastSubIt != transConstEnd; ++fastSubIt ) {
105  // Add a ptr to this constituent
106  if ( *fastSubIt < static_cast<int>(inputs_.size()) )
107  subjetConstituents.push_back( inputs_[*fastSubIt] );
108  }
109 
110  // This holds the subjet-to-hardjet mapping
111  indices[jetIndex].push_back( subjetCollection->size() );
112 
113 
114  // Add the concrete subjet type to the subjet list to write to event record
115  T jet;
116  reco::writeSpecific( jet, p4Subjet, point, subjetConstituents, iSetup);
117  jet.setJetArea( itSubJet->subjetArea() );
118  subjetCollection->push_back( jet );
119 
120  }
121  }
122  // put subjets into event record
123  subjetHandleAfterPut = iEvent.put( subjetCollection, jetCollInstanceName_ );
124 
125 
126  // Now create the hard jets with ptr's to the subjets as constituents
127  std::vector<math::XYZTLorentzVector>::const_iterator ip4 = p4_hardJets.begin(),
128  ip4Begin = p4_hardJets.begin(),
129  ip4End = p4_hardJets.end();
130 
131  for ( ; ip4 != ip4End; ++ip4 ) {
132  int p4_index = ip4 - ip4Begin;
133  std::vector<int> & ind = indices[p4_index];
134  std::vector<reco::CandidatePtr> i_hardJetConstituents;
135  // Add the subjets to the hard jet
136  for( std::vector<int>::const_iterator isub = ind.begin();
137  isub != ind.end(); ++isub ) {
138  reco::CandidatePtr candPtr( subjetHandleAfterPut, *isub, false );
139  i_hardJetConstituents.push_back( candPtr );
140  }
142  reco::BasicJet toput( *ip4, point, i_hardJetConstituents);
143  toput.setJetArea( area_hardJets[ip4 - ip4Begin] );
144  jetCollection->push_back( toput );
145  }
146 
147  // put hard jets into event record
148  iEvent.put( jetCollection);
149 
150 }
Jets made from CaloTowers.
Definition: BasicJet.h:21
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
std::string jetCollInstanceName_
std::vector< edm::Ptr< reco::Candidate > > inputs_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
math::XYZPoint Point
point in the space
Definition: Particle.h:29
std::vector< CompoundPseudoJet > fjCompoundJets_
long double T
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
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
std::vector< BasicJet > BasicJetCollection
collection of BasicJet objects

Member Data Documentation

std::vector<CompoundPseudoJet> cms::CompoundJetProducer::fjCompoundJets_
protected