CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TtJetPartonMatch< C > Class Template Reference

#include <TtJetPartonMatch.h>

Inheritance diagram for TtJetPartonMatch< C >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 write jet parton match objects into the event More...
 
 TtJetPartonMatch (const edm::ParameterSet &)
 default conructor More...
 
 ~TtJetPartonMatch () override
 default destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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 & itemsToGetFrom (BranchType iType) 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

JetPartonMatching::algorithms readAlgorithm (const std::string &str)
 convert string for algorithm into corresponding enumerator type More...
 

Private Attributes

JetPartonMatching::algorithms algorithm_
 choice of algorithm More...
 
edm::EDGetTokenT< TtGenEventgenEvt_
 TtGenEvent collection input. More...
 
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
 jet collection input More...
 
double maxDist_
 
int maxNComb_
 
int maxNJets_
 
partons_
 partons More...
 
bool useDeltaR_
 switch to choose between deltaR/deltaTheta matching More...
 
bool useMaxDist_
 
int verbosity_
 verbosity level More...
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

template<typename C>
class TtJetPartonMatch< C >

Definition at line 44 of file TtJetPartonMatch.h.

Constructor & Destructor Documentation

◆ TtJetPartonMatch()

template<typename C >
TtJetPartonMatch< C >::TtJetPartonMatch ( const edm::ParameterSet cfg)
explicit

default conructor

Definition at line 84 of file TtJetPartonMatch.h.

85  : partons_(cfg.getParameter<std::vector<std::string> >("partonsToIgnore")),
86  genEvt_(consumes<TtGenEvent>(edm::InputTag("genEvt"))),
87  jets_(consumes<edm::View<reco::Jet> >(cfg.getParameter<edm::InputTag>("jets"))),
88  maxNJets_(cfg.getParameter<int>("maxNJets")),
89  maxNComb_(cfg.getParameter<int>("maxNComb")),
90  algorithm_(readAlgorithm(cfg.getParameter<std::string>("algorithm"))),
91  useDeltaR_(cfg.getParameter<bool>("useDeltaR")),
92  useMaxDist_(cfg.getParameter<bool>("useMaxDist")),
93  maxDist_(cfg.getParameter<double>("maxDist")),
94  verbosity_(cfg.getParameter<int>("verbosity")) {
95  // produces a vector of jet/lepton indices in the order of
96  // * TtSemiLepEvtPartons
97  // * TtFullHadEvtPartons
98  // * TtFullLepEvtPartons
99  // and vectors of the corresponding quality parameters
100  produces<std::vector<std::vector<int> > >();
101  produces<std::vector<double> >("SumPt");
102  produces<std::vector<double> >("SumDR");
103  produces<int>("NumberOfConsideredJets");
104 }

◆ ~TtJetPartonMatch()

template<typename C >
TtJetPartonMatch< C >::~TtJetPartonMatch ( )
override

default destructor

Definition at line 107 of file TtJetPartonMatch.h.

107 {}

Member Function Documentation

◆ produce()

template<typename C >
void TtJetPartonMatch< C >::produce ( edm::Event evt,
const edm::EventSetup setup 
)
overridevirtual

write jet parton match objects into the event

Implements edm::EDProducer.

Definition at line 110 of file TtJetPartonMatch.h.

110  {
111  // will write
112  // * parton match
113  // * sumPt
114  // * sumDR
115  // to the event
116  std::unique_ptr<std::vector<std::vector<int> > > match(new std::vector<std::vector<int> >);
117  std::unique_ptr<std::vector<double> > sumPt(new std::vector<double>);
118  std::unique_ptr<std::vector<double> > sumDR(new std::vector<double>);
119  std::unique_ptr<int> pJetsConsidered(new int);
120 
121  // get TtGenEvent and jet collection from the event
123  evt.getByToken(genEvt_, genEvt);
124 
126  evt.getByToken(jets_, topJets);
127 
128  // fill vector of partons in the order of
129  // * TtFullLepEvtPartons
130  // * TtSemiLepEvtPartons
131  // * TtFullHadEvtPartons
132  std::vector<const reco::Candidate*> partons = partons_.vec(*genEvt);
133 
134  // prepare vector of jets
135  std::vector<const reco::Candidate*> jets;
136  for (unsigned int ij = 0; ij < topJets->size(); ++ij) {
137  // take all jets if maxNJets_ == -1; otherwise use
138  // maxNJets_ if maxNJets_ is big enough or use same
139  // number of jets as partons if maxNJets_ < number
140  // of partons
141  if (maxNJets_ != -1) {
142  if (maxNJets_ >= (int)partons.size()) {
143  if ((int)ij == maxNJets_)
144  break;
145  } else {
146  if (ij == partons.size())
147  break;
148  }
149  }
150  jets.push_back((const reco::Candidate*)&(*topJets)[ij]);
151  }
152  *pJetsConsidered = jets.size();
153 
154  // do the matching with specified parameters
156 
157  // print some info for each event
158  // if corresponding verbosity level set
159  if (verbosity_ > 0)
160  jetPartonMatch.print();
161 
162  for (unsigned int ic = 0; ic < jetPartonMatch.getNumberOfAvailableCombinations(); ++ic) {
163  if ((int)ic >= maxNComb_ && maxNComb_ >= 0)
164  break;
165  std::vector<int> matches = jetPartonMatch.getMatchesForPartons(ic);
166  partons_.expand(matches); // insert dummy indices for partons that were chosen to be ignored
167  match->push_back(matches);
168  sumPt->push_back(jetPartonMatch.getSumDeltaPt(ic));
169  sumDR->push_back(jetPartonMatch.getSumDeltaR(ic));
170  }
171  evt.put(std::move(match));
172  evt.put(std::move(sumPt), "SumPt");
173  evt.put(std::move(sumDR), "SumDR");
174  evt.put(std::move(pJetsConsidered), "NumberOfConsideredJets");
175 }

References TtGenEvtProducer_cfi::genEvt, edm::Event::getByToken(), JetPartonMatching::getMatchesForPartons(), JetPartonMatching::getNumberOfAvailableCombinations(), JetPartonMatching::getSumDeltaPt(), JetPartonMatching::getSumDeltaR(), singleTopDQM_cfi::jets, match(), patCandidatesForDimuonsSequences_cff::matches, eostools::move(), dqmAnalyzer_cff::partons, JetPartonMatching::print(), edm::Event::put(), TtFullHadEvtBuilder_cfi::sumDR, and TtFullHadEvtBuilder_cfi::sumPt.

◆ readAlgorithm()

template<typename C >
JetPartonMatching::algorithms TtJetPartonMatch< C >::readAlgorithm ( const std::string &  str)
private

convert string for algorithm into corresponding enumerator type

Definition at line 178 of file TtJetPartonMatch.h.

178  {
179  if (str == "totalMinDist")
181  else if (str == "minSumDist")
183  else if (str == "ptOrderedMinDist")
185  else if (str == "unambiguousOnly")
187  else
188  throw cms::Exception("Configuration") << "Chosen algorithm is not supported: " << str << "\n";
189 }

References Exception, JetPartonMatching::minSumDist, JetPartonMatching::ptOrderedMinDist, str, JetPartonMatching::totalMinDist, and JetPartonMatching::unambiguousOnly.

Member Data Documentation

◆ algorithm_

template<typename C >
JetPartonMatching::algorithms TtJetPartonMatch< C >::algorithm_
private

choice of algorithm

Definition at line 70 of file TtJetPartonMatch.h.

◆ genEvt_

template<typename C >
edm::EDGetTokenT<TtGenEvent> TtJetPartonMatch< C >::genEvt_
private

TtGenEvent collection input.

Definition at line 60 of file TtJetPartonMatch.h.

◆ jets_

template<typename C >
edm::EDGetTokenT<edm::View<reco::Jet> > TtJetPartonMatch< C >::jets_
private

jet collection input

Definition at line 62 of file TtJetPartonMatch.h.

◆ maxDist_

template<typename C >
double TtJetPartonMatch< C >::maxDist_
private

threshold for outliers in the case that useMaxDist_ =true

Definition at line 78 of file TtJetPartonMatch.h.

◆ maxNComb_

template<typename C >
int TtJetPartonMatch< C >::maxNComb_
private

maximal number of combinations for which the matching should be stored

Definition at line 68 of file TtJetPartonMatch.h.

◆ maxNJets_

template<typename C >
int TtJetPartonMatch< C >::maxNJets_
private

maximal number of jets to be considered for the matching

Definition at line 65 of file TtJetPartonMatch.h.

◆ partons_

template<typename C >
C TtJetPartonMatch< C >::partons_
private

partons

Definition at line 58 of file TtJetPartonMatch.h.

◆ useDeltaR_

template<typename C >
bool TtJetPartonMatch< C >::useDeltaR_
private

switch to choose between deltaR/deltaTheta matching

Definition at line 72 of file TtJetPartonMatch.h.

◆ useMaxDist_

template<typename C >
bool TtJetPartonMatch< C >::useMaxDist_
private

switch to choose whether an outlier rejection should be applied or not

Definition at line 75 of file TtJetPartonMatch.h.

◆ verbosity_

template<typename C >
int TtJetPartonMatch< C >::verbosity_
private

verbosity level

Definition at line 80 of file TtJetPartonMatch.h.

TtJetPartonMatch::jets_
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
jet collection input
Definition: TtJetPartonMatch.h:62
JetPartonMatching::unambiguousOnly
Definition: JetPartonMatching.h:16
TtJetPartonMatch::readAlgorithm
JetPartonMatching::algorithms readAlgorithm(const std::string &str)
convert string for algorithm into corresponding enumerator type
Definition: TtJetPartonMatch.h:178
TtJetPartonMatch::verbosity_
int verbosity_
verbosity level
Definition: TtJetPartonMatch.h:80
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
TtJetPartonMatch::useMaxDist_
bool useMaxDist_
Definition: TtJetPartonMatch.h:75
edm::Handle
Definition: AssociativeIterator.h:50
TtFullHadEvtBuilder_cfi.sumPt
sumPt
Definition: TtFullHadEvtBuilder_cfi.py:38
TtJetPartonMatch::maxNJets_
int maxNJets_
Definition: TtJetPartonMatch.h:65
str
#define str(s)
Definition: TestProcessor.cc:48
TtJetPartonMatch::maxNComb_
int maxNComb_
Definition: TtJetPartonMatch.h:68
dqmAnalyzer_cff.partons
partons
Definition: dqmAnalyzer_cff.py:27
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
TtJetPartonMatch::useDeltaR_
bool useDeltaR_
switch to choose between deltaR/deltaTheta matching
Definition: TtJetPartonMatch.h:72
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TtFullHadEvtBuilder_cfi.sumDR
sumDR
Definition: TtFullHadEvtBuilder_cfi.py:39
edm::View
Definition: CaloClusterFwd.h:14
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
looper.cfg
cfg
Definition: looper.py:297
reco::Candidate
Definition: Candidate.h:27
TtJetPartonMatch::maxDist_
double maxDist_
Definition: TtJetPartonMatch.h:78
eostools.move
def move(src, dest)
Definition: eostools.py:511
JetPartonMatching::totalMinDist
Definition: JetPartonMatching.h:16
JetPartonMatching::minSumDist
Definition: JetPartonMatching.h:16
Exception
Definition: hltDiff.cc:246
TtJetPartonMatch::partons_
C partons_
partons
Definition: TtJetPartonMatch.h:58
JetPartonMatching::ptOrderedMinDist
Definition: JetPartonMatching.h:16
patCandidatesForDimuonsSequences_cff.matches
matches
Definition: patCandidatesForDimuonsSequences_cff.py:131
TtJetPartonMatch::algorithm_
JetPartonMatching::algorithms algorithm_
choice of algorithm
Definition: TtJetPartonMatch.h:70
TtJetPartonMatch::genEvt_
edm::EDGetTokenT< TtGenEvent > genEvt_
TtGenEvent collection input.
Definition: TtJetPartonMatch.h:60
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
JetPartonMatching
Definition: JetPartonMatching.h:11
edm::InputTag
Definition: InputTag.h:15
TtGenEvtProducer_cfi.genEvt
genEvt
Definition: TtGenEvtProducer_cfi.py:7