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::stream::EDProducer<> edm::stream::EDProducerBase 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::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
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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 ()
 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::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_
 
edm::EDGetTokenT
< reco::VertexCollection
input_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 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::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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 41 of file CompoundJetProducer.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file CompoundJetProducer.cc.

12  :
14 {
15 
16  produces<reco::BasicJetCollection>();
17  // the subjet collections are set through the config file in the "jetCollInstanceName" field.
18 }
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 21 of file CompoundJetProducer.cc.

References fjCompoundJets_, and VirtualJetProducer::inputTowers().

22 {
23  fjCompoundJets_.clear();
25 }
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 27 of file CompoundJetProducer.cc.

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

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

function template to write out the outputs

Definition at line 52 of file CompoundJetProducer.cc.

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

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