CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
NjettinessAdder Class Reference

#include <NjettinessAdder.h>

Inheritance diagram for NjettinessAdder:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

enum  AxesDefinition_t {
  KT_Axes =0, CA_Axes, AntiKT_Axes, WTA_KT_Axes,
  WTA_CA_Axes, Manual_Axes, OnePass_KT_Axes, OnePass_CA_Axes,
  OnePass_AntiKT_Axes, OnePass_WTA_KT_Axes, OnePass_WTA_CA_Axes, OnePass_Manual_Axes,
  MultiPass_Axes, N_AXES_DEFINITIONS
}
 
enum  MeasureDefinition_t {
  NormalizedMeasure =0, UnnormalizedMeasure, OriginalGeometricMeasure, NormalizedCutoffMeasure,
  UnnormalizedCutoffMeasure, GeometricCutoffMeasure, N_MEASURE_DEFINITIONS
}
 
- 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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

float getTau (unsigned num, const edm::Ptr< reco::Jet > &object) const
 
 NjettinessAdder (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
virtual ~NjettinessAdder ()
 
- 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

double akAxesR0_
 
unsigned axesDefinition_
 
double beta_
 
unsigned measureDefinition_
 
std::vector< unsigned > Njets_
 
int nPass_
 
double R0_
 
double Rcutoff_
 
std::auto_ptr< fastjet::contrib::Njettiness > routine_
 
edm::InputTag src_
 
edm::EDGetTokenT< edm::View< reco::Jet > > src_token_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 15 of file NjettinessAdder.h.

Member Enumeration Documentation

Enumerator
KT_Axes 
CA_Axes 
AntiKT_Axes 
WTA_KT_Axes 
WTA_CA_Axes 
Manual_Axes 
OnePass_KT_Axes 
OnePass_CA_Axes 
OnePass_AntiKT_Axes 
OnePass_WTA_KT_Axes 
OnePass_WTA_CA_Axes 
OnePass_Manual_Axes 
MultiPass_Axes 
N_AXES_DEFINITIONS 

Definition at line 27 of file NjettinessAdder.h.

Enumerator
NormalizedMeasure 
UnnormalizedMeasure 
OriginalGeometricMeasure 
NormalizedCutoffMeasure 
UnnormalizedCutoffMeasure 
GeometricCutoffMeasure 
N_MEASURE_DEFINITIONS 

Definition at line 18 of file NjettinessAdder.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file NjettinessAdder.cc.

References akAxesR0_, AntiKT_Axes, axesDefinition_, beta_, CA_Axes, KT_Axes, measureDefinition_, MultiPass_Axes, gen::n, Njets_, nJettinessAdder_cfi::Njettiness, NormalizedCutoffMeasure, NormalizedMeasure, nPass_, OnePass_AntiKT_Axes, OnePass_CA_Axes, OnePass_KT_Axes, OnePass_WTA_CA_Axes, OnePass_WTA_KT_Axes, OriginalGeometricMeasure, R0_, Rcutoff_, routine_, UnnormalizedCutoffMeasure, UnnormalizedMeasure, WTA_CA_Axes, and WTA_KT_Axes.

6  :
7  src_(iConfig.getParameter<edm::InputTag>("src")),
9  Njets_(iConfig.getParameter<std::vector<unsigned> >("Njets")),
10  measureDefinition_(iConfig.getParameter<unsigned >("measureDefinition")),
11  beta_(iConfig.getParameter<double>("beta")),
12  R0_(iConfig.getParameter<double>("R0")),
13  Rcutoff_(iConfig.getParameter<double>("Rcutoff")),
14  axesDefinition_(iConfig.getParameter< unsigned >("axesDefinition")),
15  nPass_(iConfig.getParameter<int>("nPass")),
16  akAxesR0_(iConfig.getParameter<double>("akAxesR0"))
17 {
18  for ( std::vector<unsigned>::const_iterator n = Njets_.begin(); n != Njets_.end(); ++n )
19  {
20  std::ostringstream tauN_str;
21  tauN_str << "tau" << *n;
22 
23  produces<edm::ValueMap<float> >(tauN_str.str().c_str());
24  }
25 
26 
27  // Get the measure definition
28  fastjet::contrib::NormalizedMeasure normalizedMeasure (beta_,R0_);
29  fastjet::contrib::UnnormalizedMeasure unnormalizedMeasure (beta_);
30  fastjet::contrib::OriginalGeometricMeasure geometricMeasure (beta_);// changed in 1.020
31  fastjet::contrib::NormalizedCutoffMeasure normalizedCutoffMeasure (beta_,R0_,Rcutoff_);
32  fastjet::contrib::UnnormalizedCutoffMeasure unnormalizedCutoffMeasure(beta_,Rcutoff_);
33  //fastjet::contrib::GeometricCutoffMeasure geometricCutoffMeasure (beta_,Rcutoff_); // removed in 1.020
34 
35  fastjet::contrib::MeasureDefinition const * measureDef = 0;
36  switch ( measureDefinition_ ) {
37  case UnnormalizedMeasure : measureDef = &unnormalizedMeasure; break;
38  case OriginalGeometricMeasure : measureDef = &geometricMeasure; break;// changed in 1.020
39  case NormalizedCutoffMeasure : measureDef = &normalizedCutoffMeasure; break;
40  case UnnormalizedCutoffMeasure : measureDef = &unnormalizedCutoffMeasure; break;
41  //case GeometricCutoffMeasure : measureDef = &geometricCutoffMeasure; break; // removed in 1.020
42  case NormalizedMeasure : default : measureDef = &normalizedMeasure; break;
43  }
44 
45  // Get the axes definition
46  fastjet::contrib::KT_Axes kt_axes;
47  fastjet::contrib::CA_Axes ca_axes;
48  fastjet::contrib::AntiKT_Axes antikt_axes (akAxesR0_);
49  fastjet::contrib::WTA_KT_Axes wta_kt_axes;
50  fastjet::contrib::WTA_CA_Axes wta_ca_axes;
51  fastjet::contrib::OnePass_KT_Axes onepass_kt_axes;
52  fastjet::contrib::OnePass_CA_Axes onepass_ca_axes;
53  fastjet::contrib::OnePass_AntiKT_Axes onepass_antikt_axes (akAxesR0_);
54  fastjet::contrib::OnePass_WTA_KT_Axes onepass_wta_kt_axes;
55  fastjet::contrib::OnePass_WTA_CA_Axes onepass_wta_ca_axes;
56  fastjet::contrib::MultiPass_Axes multipass_axes (nPass_);
57 
58  fastjet::contrib::AxesDefinition const * axesDef = 0;
59  switch ( axesDefinition_ ) {
60  case KT_Axes : default : axesDef = &kt_axes; break;
61  case CA_Axes : axesDef = &ca_axes; break;
62  case AntiKT_Axes : axesDef = &antikt_axes; break;
63  case WTA_KT_Axes : axesDef = &wta_kt_axes; break;
64  case WTA_CA_Axes : axesDef = &wta_ca_axes; break;
65  case OnePass_KT_Axes : axesDef = &onepass_kt_axes; break;
66  case OnePass_CA_Axes : axesDef = &onepass_ca_axes; break;
67  case OnePass_AntiKT_Axes : axesDef = &onepass_antikt_axes; break;
68  case OnePass_WTA_KT_Axes : axesDef = &onepass_wta_kt_axes; break;
69  case OnePass_WTA_CA_Axes : axesDef = &onepass_wta_ca_axes; break;
70  case MultiPass_Axes : axesDef = &multipass_axes; break;
71  };
72 
73  routine_ = std::auto_ptr<fastjet::contrib::Njettiness> ( new fastjet::contrib::Njettiness( *axesDef, *measureDef ) );
74 
75 }
std::auto_ptr< fastjet::contrib::Njettiness > routine_
T getParameter(std::string const &) const
unsigned measureDefinition_
unsigned axesDefinition_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< unsigned > Njets_
edm::InputTag src_
edm::EDGetTokenT< edm::View< reco::Jet > > src_token_
virtual NjettinessAdder::~NjettinessAdder ( )
inlinevirtual

Definition at line 48 of file NjettinessAdder.h.

References getTau(), iEvent, pileupDistInMC::num, and produce().

48 {}

Member Function Documentation

float NjettinessAdder::getTau ( unsigned  num,
const edm::Ptr< reco::Jet > &  object 
) const

Definition at line 109 of file NjettinessAdder.cc.

References DEFINE_FWK_MODULE, reco::dp, edm::Ptr< T >::isAvailable(), edm::Ptr< T >::isNonnull(), gen::k, and routine_.

Referenced by produce(), and ~NjettinessAdder().

110 {
111  std::vector<fastjet::PseudoJet> FJparticles;
112  for (unsigned k = 0; k < object->numberOfDaughters(); ++k)
113  {
114  const reco::CandidatePtr & dp = object->daughterPtr(k);
115  if ( dp.isNonnull() && dp.isAvailable() )
116  FJparticles.push_back( fastjet::PseudoJet( dp->px(), dp->py(), dp->pz(), dp->energy() ) );
117  else
118  edm::LogWarning("MissingJetConstituent") << "Jet constituent required for N-subjettiness computation is missing!";
119  }
120 
121  return routine_->getTau(num, FJparticles);
122 }
std::auto_ptr< fastjet::contrib::Njettiness > routine_
bool isAvailable() const
Definition: Ptr.h:259
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:169
int k[5][pyjets_maxn]
auto dp
Definition: deltaR.h:22
void NjettinessAdder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 77 of file NjettinessAdder.cc.

References edm::Event::getByToken(), getTau(), fwrapper::jets, eostools::move(), gen::n, Njets_, edm::Event::put(), src_token_, and lumiQTWidget::t.

Referenced by ~NjettinessAdder().

77  {
78  // read input collection
80  iEvent.getByToken(src_token_, jets);
81 
82  for ( std::vector<unsigned>::const_iterator n = Njets_.begin(); n != Njets_.end(); ++n )
83  {
84  std::ostringstream tauN_str;
85  tauN_str << "tau" << *n;
86 
87  // prepare room for output
88  std::vector<float> tauN;
89  tauN.reserve(jets->size());
90 
91  for ( typename edm::View<reco::Jet>::const_iterator jetIt = jets->begin() ; jetIt != jets->end() ; ++jetIt ) {
92 
93  edm::Ptr<reco::Jet> jetPtr = jets->ptrAt(jetIt - jets->begin());
94 
95  float t=getTau( *n, jetPtr );
96 
97  tauN.push_back(t);
98  }
99 
100  auto outT = std::make_unique<edm::ValueMap<float>>();
101  edm::ValueMap<float>::Filler fillerT(*outT);
102  fillerT.insert(jets, tauN.begin(), tauN.end());
103  fillerT.fill();
104 
105  iEvent.put(std::move(outT),tauN_str.str().c_str());
106  }
107 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
vector< PseudoJet > jets
std::vector< unsigned > Njets_
float getTau(unsigned num, const edm::Ptr< reco::Jet > &object) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::EDGetTokenT< edm::View< reco::Jet > > src_token_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

double NjettinessAdder::akAxesR0_
private

Definition at line 67 of file NjettinessAdder.h.

Referenced by NjettinessAdder().

unsigned NjettinessAdder::axesDefinition_
private

Definition at line 65 of file NjettinessAdder.h.

Referenced by NjettinessAdder().

double NjettinessAdder::beta_
private

Definition at line 60 of file NjettinessAdder.h.

Referenced by NjettinessAdder().

unsigned NjettinessAdder::measureDefinition_
private

Definition at line 59 of file NjettinessAdder.h.

Referenced by NjettinessAdder().

std::vector<unsigned> NjettinessAdder::Njets_
private

Definition at line 56 of file NjettinessAdder.h.

Referenced by NjettinessAdder(), and produce().

int NjettinessAdder::nPass_
private

Definition at line 66 of file NjettinessAdder.h.

Referenced by NjettinessAdder().

double NjettinessAdder::R0_
private

Definition at line 61 of file NjettinessAdder.h.

Referenced by NjettinessAdder().

double NjettinessAdder::Rcutoff_
private

Definition at line 62 of file NjettinessAdder.h.

Referenced by NjettinessAdder().

std::auto_ptr<fastjet::contrib::Njettiness> NjettinessAdder::routine_
private

Definition at line 71 of file NjettinessAdder.h.

Referenced by getTau(), and NjettinessAdder().

edm::InputTag NjettinessAdder::src_
private

Definition at line 54 of file NjettinessAdder.h.

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

Definition at line 55 of file NjettinessAdder.h.

Referenced by produce().