CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
NjettinessAdder Class Reference

#include <NjettinessAdder.h>

Inheritance diagram for NjettinessAdder:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

float getTau (int num, edm::Ptr< reco::PFJet > object) const
 
 NjettinessAdder (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
virtual ~NjettinessAdder ()
 
- 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
 
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 ()
 

Private Attributes

double cone_
 
edm::InputTag src_
 
edm::EDGetTokenT< edm::View
< reco::PFJet > > 
src_token_
 

Additional Inherited Members

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

Detailed Description

Definition at line 12 of file NjettinessAdder.h.

Constructor & Destructor Documentation

NjettinessAdder::NjettinessAdder ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 14 of file NjettinessAdder.h.

14  :
15  src_(iConfig.getParameter<edm::InputTag>("src")),
17  cone_(iConfig.getParameter<double>("cone"))
18  {
19  produces<edm::ValueMap<float> >("tau1");
20  produces<edm::ValueMap<float> >("tau2");
21  produces<edm::ValueMap<float> >("tau3");
22  }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< reco::PFJet > > src_token_
edm::InputTag src_
virtual NjettinessAdder::~NjettinessAdder ( )
inlinevirtual

Definition at line 24 of file NjettinessAdder.h.

24 {}

Member Function Documentation

float NjettinessAdder::getTau ( int  num,
edm::Ptr< reco::PFJet object 
) const

Definition at line 47 of file NjettinessAdder.cc.

References cone_, reco::LeafCandidate::energy(), edm::Ptr< T >::get(), gen::k, nJettinessAdder_cfi::Njettiness, reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::LeafCandidate::pz().

Referenced by produce().

48 {
49  std::vector<const reco::PFCandidate*> all_particles;
50  for (unsigned k =0; k < object->getPFConstituents().size(); k++)
51  all_particles.push_back( object->getPFConstituent(k).get() );
52 
53  std::vector<fastjet::PseudoJet> FJparticles;
54  for (unsigned particle = 0; particle < all_particles.size(); particle++){
55  const reco::PFCandidate *thisParticle = all_particles.at(particle);
56  FJparticles.push_back( fastjet::PseudoJet( thisParticle->px(), thisParticle->py(), thisParticle->pz(), thisParticle->energy() ) );
57  }
58  fastjet::contrib::NsubParameters paraNsub = fastjet::contrib::NsubParameters(1.0, cone_); //assume R=0.7 jet clusering used
59  fastjet::contrib::Njettiness routine(fastjet::contrib::Njettiness::onepass_kt_axes, paraNsub);
60  return routine.getTau(num, FJparticles);
61 }
virtual double energy() const GCC11_FINAL
energy
virtual double pz() const GCC11_FINAL
z coordinate of momentum vector
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:143
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
int k[5][pyjets_maxn]
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:38
void NjettinessAdder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 6 of file NjettinessAdder.cc.

References edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), getTau(), edm::helper::Filler< Map >::insert(), fwrapper::jets, edm::Event::put(), src_token_, and reco::t2.

6  {
7  // read input collection
9  iEvent.getByToken(src_token_, jets);
10 
11  // prepare room for output
12  std::vector<float> tau1; tau1.reserve(jets->size());
13  std::vector<float> tau2; tau2.reserve(jets->size());
14  std::vector<float> tau3; tau3.reserve(jets->size());
15 
16  for ( typename edm::View<reco::PFJet>::const_iterator jetIt = jets->begin() ; jetIt != jets->end() ; ++jetIt ) {
17  reco::PFJet newCand(*jetIt);
18  edm::Ptr<reco::PFJet> jetPtr = jets->ptrAt(jetIt - jets->begin());
19 
20  float t1=getTau(1, jetPtr );
21  float t2=getTau(2, jetPtr );
22  float t3=getTau(3, jetPtr );
23 
24  tau1.push_back(t1);
25  tau2.push_back(t2);
26  tau3.push_back(t3);
27  }
28 
29  std::auto_ptr<edm::ValueMap<float> > outT1(new edm::ValueMap<float>());
30  std::auto_ptr<edm::ValueMap<float> > outT2(new edm::ValueMap<float>());
31  std::auto_ptr<edm::ValueMap<float> > outT3(new edm::ValueMap<float>());
32  edm::ValueMap<float>::Filler fillerT1(*outT1);
33  edm::ValueMap<float>::Filler fillerT2(*outT2);
34  edm::ValueMap<float>::Filler fillerT3(*outT3);
35  fillerT1.insert(jets, tau1.begin(), tau1.end());
36  fillerT2.insert(jets, tau2.begin(), tau2.end());
37  fillerT3.insert(jets, tau3.begin(), tau3.end());
38  fillerT1.fill();
39  fillerT2.fill();
40  fillerT3.fill();
41 
42  iEvent.put(outT1,"tau1");
43  iEvent.put(outT2,"tau2");
44  iEvent.put(outT3,"tau3");
45 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
Jets made from PFObjects.
Definition: PFJet.h:21
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:18
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
vector< PseudoJet > jets
float getTau(int num, edm::Ptr< reco::PFJet > object) const
edm::EDGetTokenT< edm::View< reco::PFJet > > src_token_

Member Data Documentation

double NjettinessAdder::cone_
private

Definition at line 32 of file NjettinessAdder.h.

Referenced by getTau().

edm::InputTag NjettinessAdder::src_
private

Definition at line 30 of file NjettinessAdder.h.

edm::EDGetTokenT<edm::View<reco::PFJet> > NjettinessAdder::src_token_
private

Definition at line 31 of file NjettinessAdder.h.

Referenced by produce().