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 Member Functions | Private Attributes
TtEvtBuilder< C > Class Template Reference

Template class to fill the TtEvent structure. More...

#include "TopQuarkAnalysis/TopEventProducers/interface/TtEvtBuilder.h"

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

Public Member Functions

 TtEvtBuilder (const edm::ParameterSet &)
 default constructor More...
 
 ~TtEvtBuilder ()
 default destructor More...
 
- 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 ()
 

Private Member Functions

virtual void fillSpecific (C &, const edm::Event &)
 fill data members that are decay-channel specific More...
 
template<>
void fillSpecific (TtFullHadronicEvent &ttEvent, const edm::Event &evt)
 
template<>
void fillSpecific (TtFullLeptonicEvent &ttEvent, const edm::Event &evt)
 
template<>
void fillSpecific (TtSemiLeptonicEvent &ttEvent, const edm::Event &evt)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

int decayChnTop1_
 
int decayChnTop2_
 
edm::InputTag disc_
 
edm::InputTag fitChi2_
 
edm::InputTag fitProb_
 
edm::InputTag genEvt_
 TtGenEvent. More...
 
edm::ParameterSet genMatch_
 
edm::ParameterSet hitFit_
 
edm::InputTag hitFitChi2_
 
edm::InputTag hitFitMT_
 
edm::InputTag hitFitProb_
 
edm::InputTag hitFitSigMT_
 
std::vector< edm::InputTaghyps_
 vector of hypothesis class names More...
 
edm::ParameterSet kinFit_
 
edm::ParameterSet kinSolution_
 
edm::InputTag meth_
 
edm::ParameterSet mvaDisc_
 
edm::InputTag solWeight_
 
edm::InputTag sumDR_
 
edm::InputTag sumPt_
 
int verbosity_
 vebosity level More...
 
edm::InputTag wrongCharge_
 

Additional Inherited Members

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

Detailed Description

template<typename C>
class TtEvtBuilder< C >

Template class to fill the TtEvent structure.

Template class to fill the TtEvent structure for:

TtSemiLeptonicEvent TtFullLeptonicEvent TtFullHadronicEvent

event hypothesis, genEvent and extra information (if available) are read from the event and contracted into the TtEvent

Definition at line 29 of file TtEvtBuilder.h.

Constructor & Destructor Documentation

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

default constructor

Definition at line 89 of file TtEvtBuilder.h.

References TtEvtBuilder< C >::disc_, edm::ParameterSet::exists(), TtEvtBuilder< C >::fitChi2_, TtEvtBuilder< C >::fitProb_, TtEvtBuilder< C >::genMatch_, edm::ParameterSet::getParameter(), TtEvtBuilder< C >::hitFit_, TtEvtBuilder< C >::hitFitChi2_, TtEvtBuilder< C >::hitFitMT_, TtEvtBuilder< C >::hitFitProb_, TtEvtBuilder< C >::hitFitSigMT_, TtEvtBuilder< C >::kinFit_, TtEvtBuilder< C >::kinSolution_, TtEvtBuilder< C >::meth_, TtEvtBuilder< C >::mvaDisc_, TtEvtBuilder< C >::solWeight_, TtEvtBuilder< C >::sumDR_, TtEvtBuilder< C >::sumPt_, and TtEvtBuilder< C >::wrongCharge_.

89  :
90  verbosity_ (cfg.getParameter<int> ("verbosity" )),
91  hyps_ (cfg.getParameter<std::vector<edm::InputTag> >("hypotheses" )),
92  genEvt_ (cfg.getParameter<edm::InputTag> ("genEvent" )),
93  decayChnTop1_(cfg.getParameter<int> ("decayChannel1")),
94  decayChnTop2_(cfg.getParameter<int> ("decayChannel2"))
95 {
96  // parameter subsets for kKinFit
97  if( cfg.exists("kinFit") ) {
98  kinFit_ = cfg.getParameter<edm::ParameterSet>("kinFit");
101  }
102  // parameter subsets for kHitFit
103  if( cfg.exists("hitFit") ) {
104  hitFit_ = cfg.getParameter<edm::ParameterSet>("hitFit");
109  }
110  // parameter subsets for kKinSolution
111  if( cfg.exists("kinSolution") ) {
112  kinSolution_ = cfg.getParameter<edm::ParameterSet>("kinSolution");
115  }
116  // parameter subsets for kGenMatch
117  if( cfg.exists("genMatch") ) {
118  genMatch_ = cfg.getParameter<edm::ParameterSet>("genMatch");
121  }
122  // parameter subsets for kMvaDisc
123  if( cfg.exists("mvaDisc") ) {
124  mvaDisc_ = cfg.getParameter<edm::ParameterSet>("mvaDisc");
127  }
128  // produces a TtEventEvent for:
129  // * TtSemiLeptonicEvent
130  // * TtFullLeptonicEvent
131  // * TtFullHadronicEvent
132  // from hypotheses and associated extra information
133  produces<C>();
134 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > hyps_
vector of hypothesis class names
Definition: TtEvtBuilder.h:51
edm::InputTag fitProb_
Definition: TtEvtBuilder.h:63
edm::InputTag sumDR_
Definition: TtEvtBuilder.h:80
edm::InputTag genEvt_
TtGenEvent.
Definition: TtEvtBuilder.h:53
edm::InputTag hitFitProb_
Definition: TtEvtBuilder.h:68
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::ParameterSet genMatch_
Definition: TtEvtBuilder.h:78
edm::InputTag solWeight_
Definition: TtEvtBuilder.h:74
edm::InputTag sumPt_
Definition: TtEvtBuilder.h:79
int verbosity_
vebosity level
Definition: TtEvtBuilder.h:49
edm::ParameterSet mvaDisc_
Definition: TtEvtBuilder.h:83
edm::ParameterSet kinFit_
Definition: TtEvtBuilder.h:61
edm::InputTag wrongCharge_
Definition: TtEvtBuilder.h:75
edm::ParameterSet kinSolution_
Definition: TtEvtBuilder.h:73
edm::InputTag hitFitChi2_
Definition: TtEvtBuilder.h:67
edm::InputTag disc_
Definition: TtEvtBuilder.h:85
edm::InputTag hitFitMT_
Definition: TtEvtBuilder.h:69
edm::ParameterSet hitFit_
Definition: TtEvtBuilder.h:66
edm::InputTag fitChi2_
Definition: TtEvtBuilder.h:62
edm::InputTag meth_
Definition: TtEvtBuilder.h:84
edm::InputTag hitFitSigMT_
Definition: TtEvtBuilder.h:70
template<typename C >
TtEvtBuilder< C >::~TtEvtBuilder ( )
inline

default destructor

Definition at line 36 of file TtEvtBuilder.h.

36 {};

Member Function Documentation

template<typename C >
virtual void TtEvtBuilder< C >::fillSpecific ( C &  ,
const edm::Event  
)
privatevirtual

fill data members that are decay-channel specific

template<>
void TtEvtBuilder< TtFullHadronicEvent >::fillSpecific ( TtFullHadronicEvent ttEvent,
const edm::Event evt 
)
private

Definition at line 232 of file TtEvtBuilder.h.

233 {
234 }
template<>
void TtEvtBuilder< TtFullLeptonicEvent >::fillSpecific ( TtFullLeptonicEvent ttEvent,
const edm::Event evt 
)
private

Definition at line 237 of file TtEvtBuilder.h.

References edm::Event::getByLabel(), TtEvent::isHypoAvailable(), TtEvent::kKinSolution, TtFullLeptonicEvent::setSolWeight(), and TtFullLeptonicEvent::setWrongCharge().

238 {
239 
240  // set kKinSolution extras
241  if( ttEvent.isHypoAvailable(TtEvent::kKinSolution) ) {
243  evt.getByLabel(solWeight_, solWeight);
244  ttEvent.setSolWeight( *solWeight );
245 
246  edm::Handle<bool> wrongCharge;
247  evt.getByLabel(wrongCharge_, wrongCharge);
248  ttEvent.setWrongCharge( *wrongCharge );
249  }
250 
251 }
void setWrongCharge(const bool &val)
set right or wrong charge combination of kKinSolution hypothesis
bool isHypoAvailable(const std::string &key, const unsigned &cmb=0) const
Definition: TtEvent.h:60
edm::InputTag solWeight_
Definition: TtEvtBuilder.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
void setSolWeight(const std::vector< double > &val)
set weight of kKinSolution hypothesis
edm::InputTag wrongCharge_
Definition: TtEvtBuilder.h:75
template<>
void TtEvtBuilder< TtSemiLeptonicEvent >::fillSpecific ( TtSemiLeptonicEvent ttEvent,
const edm::Event evt 
)
private

Definition at line 254 of file TtEvtBuilder.h.

References edm::Event::getByLabel(), h, combine::key, TtEvent::setNumberOfConsideredJets(), and TtSemiLeptonicEvent::setNumberOfRealNeutrinoSolutions().

255 {
256 
257  typedef std::vector<edm::InputTag>::const_iterator EventHypo;
258  for(EventHypo h=hyps_.begin(); h!=hyps_.end(); ++h){
260  evt.getByLabel(h->label(), "Key", key);
261 
262  // set number of real neutrino solutions for all hypotheses
263  edm::Handle<int> numberOfRealNeutrinoSolutions;
264  evt.getByLabel(h->label(), "NumberOfRealNeutrinoSolutions", numberOfRealNeutrinoSolutions);
265  ttEvent.setNumberOfRealNeutrinoSolutions((TtEvent::HypoClassKey&)*key, *numberOfRealNeutrinoSolutions);
266 
267  // set number of considered jets for all hypotheses
268  edm::Handle<int> numberOfConsideredJets;
269  evt.getByLabel(h->label(), "NumberOfConsideredJets", numberOfConsideredJets);
270  ttEvent.setNumberOfConsideredJets((TtEvent::HypoClassKey&)*key, *numberOfConsideredJets);
271  }
272 
273 }
HypoClassKey
supported classes of event hypotheses
Definition: TtEvent.h:31
std::vector< edm::InputTag > hyps_
vector of hypothesis class names
Definition: TtEvtBuilder.h:51
void setNumberOfRealNeutrinoSolutions(const HypoClassKey &key, const int &nr)
set number of real neutrino solutions for a given hypo class
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void setNumberOfConsideredJets(const HypoClassKey &key, const unsigned int nJets)
set number of jets considered when building a given hypothesis
Definition: TtEvent.h:123
list key
Definition: combine.py:13
template<typename C >
void TtEvtBuilder< C >::produce ( edm::Event evt,
const edm::EventSetup setup 
)
privatevirtual

produce function (this one is not even accessible for derived classes)

Implements edm::EDProducer.

Definition at line 138 of file TtEvtBuilder.h.

References funct::C, fitChi2(), TtGenEvtProducer_cfi::genEvt, edm::Event::getByLabel(), h, combine::key, TtEvent::kGenMatch, TtEvent::kHitFit, TtEvent::kKinFit, TtEvent::kMVADisc, and edm::Event::put().

139 {
140  C ttEvent;
141 
142  // set leptonic decay channels
144 
145  // set genEvent (if available)
147  if ( genEvt_.label().size() > 0 )
148  if( evt.getByLabel(genEvt_, genEvt) )
149  ttEvent.setGenEvent(genEvt);
150 
151  // add event hypotheses for all given
152  // hypothesis classes to the TtEvent
153  typedef std::vector<edm::InputTag>::const_iterator EventHypo;
154  for(EventHypo h=hyps_.begin(); h!=hyps_.end(); ++h){
156  evt.getByLabel(h->label(), "Key", key);
157 
159  evt.getByLabel(*h, hypMatchVec);
160 
161  typedef std::vector<TtEvent::HypoCombPair>::const_iterator HypMatch;
162  for(HypMatch hm=hypMatchVec->begin(); hm != hypMatchVec->end(); ++hm){
163  ttEvent.addEventHypo((TtEvent::HypoClassKey&)*key, *hm);
164  }
165  }
166 
167  // set kKinFit extras
168  if( ttEvent.isHypoAvailable(TtEvent::kKinFit) ) {
170  evt.getByLabel(fitChi2_, fitChi2);
171  ttEvent.setFitChi2( *fitChi2 );
172 
174  evt.getByLabel(fitProb_, fitProb);
175  ttEvent.setFitProb( *fitProb );
176  }
177 
178  // set kHitFit extras
179  if( ttEvent.isHypoAvailable(TtEvent::kHitFit) ) {
180  edm::Handle<std::vector<double> > hitFitChi2;
181  evt.getByLabel(hitFitChi2_, hitFitChi2);
182  ttEvent.setHitFitChi2( *hitFitChi2 );
183 
184  edm::Handle<std::vector<double> > hitFitProb;
185  evt.getByLabel(hitFitProb_, hitFitProb);
186  ttEvent.setHitFitProb( *hitFitProb );
187 
189  evt.getByLabel(hitFitMT_, hitFitMT);
190  ttEvent.setHitFitMT( *hitFitMT );
191 
192  edm::Handle<std::vector<double> > hitFitSigMT;
193  evt.getByLabel(hitFitSigMT_, hitFitSigMT);
194  ttEvent.setHitFitSigMT( *hitFitSigMT );
195  }
196 
197  // set kGenMatch extras
198  if( ttEvent.isHypoAvailable(TtEvent::kGenMatch) ) {
200  evt.getByLabel(sumPt_, sumPt);
201  ttEvent.setGenMatchSumPt( *sumPt );
202 
204  evt.getByLabel(sumDR_, sumDR);
205  ttEvent.setGenMatchSumDR( *sumDR );
206  }
207 
208  // set kMvaDisc extras
209  if( ttEvent.isHypoAvailable(TtEvent::kMVADisc) ) {
211  evt.getByLabel(meth_, meth);
212  ttEvent.setMvaMethod( *meth );
213 
215  evt.getByLabel(disc_, disc);
216  ttEvent.setMvaDiscriminators( *disc );
217  }
218 
219  // fill data members that are decay-channel specific
220  fillSpecific(ttEvent, evt);
221 
222  // print summary via MessageLogger if verbosity_>0
223  ttEvent.print(verbosity_);
224 
225  // write object into the edm::Event
226  std::auto_ptr<C> pOut(new C);
227  *pOut=ttEvent;
228  evt.put(pOut);
229 }
HypoClassKey
supported classes of event hypotheses
Definition: TtEvent.h:31
std::vector< edm::InputTag > hyps_
vector of hypothesis class names
Definition: TtEvtBuilder.h:51
edm::InputTag fitProb_
Definition: TtEvtBuilder.h:63
edm::InputTag sumDR_
Definition: TtEvtBuilder.h:80
edm::InputTag genEvt_
TtGenEvent.
Definition: TtEvtBuilder.h:53
edm::InputTag hitFitProb_
Definition: TtEvtBuilder.h:68
static double fitChi2(const CachingVertex< 5 > &vtx)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
virtual void fillSpecific(C &, const edm::Event &)
fill data members that are decay-channel specific
edm::InputTag sumPt_
Definition: TtEvtBuilder.h:79
int verbosity_
vebosity level
Definition: TtEvtBuilder.h:49
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
edm::InputTag hitFitChi2_
Definition: TtEvtBuilder.h:67
edm::InputTag disc_
Definition: TtEvtBuilder.h:85
edm::InputTag hitFitMT_
Definition: TtEvtBuilder.h:69
std::string const & label() const
Definition: InputTag.h:42
edm::InputTag fitChi2_
Definition: TtEvtBuilder.h:62
list key
Definition: combine.py:13
edm::InputTag meth_
Definition: TtEvtBuilder.h:84
edm::InputTag hitFitSigMT_
Definition: TtEvtBuilder.h:70

Member Data Documentation

template<typename C >
int TtEvtBuilder< C >::decayChnTop1_
private

decay channels of the two top decay branches; to be filled according to WDecay::LeptonTypes in TtGenEvent

Definition at line 56 of file TtEvtBuilder.h.

template<typename C >
int TtEvtBuilder< C >::decayChnTop2_
private

Definition at line 57 of file TtEvtBuilder.h.

template<typename C >
edm::InputTag TtEvtBuilder< C >::disc_
private

Definition at line 85 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::InputTag TtEvtBuilder< C >::fitChi2_
private

Definition at line 62 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::InputTag TtEvtBuilder< C >::fitProb_
private

Definition at line 63 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::InputTag TtEvtBuilder< C >::genEvt_
private

TtGenEvent.

Definition at line 53 of file TtEvtBuilder.h.

template<typename C >
edm::ParameterSet TtEvtBuilder< C >::genMatch_
private

input parameters for the kGenMatch hypothesis class extras

Definition at line 78 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::ParameterSet TtEvtBuilder< C >::hitFit_
private

input parameters for the kHitFit hypothesis class extras

Definition at line 66 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::InputTag TtEvtBuilder< C >::hitFitChi2_
private

Definition at line 67 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::InputTag TtEvtBuilder< C >::hitFitMT_
private

Definition at line 69 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::InputTag TtEvtBuilder< C >::hitFitProb_
private

Definition at line 68 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::InputTag TtEvtBuilder< C >::hitFitSigMT_
private

Definition at line 70 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
std::vector<edm::InputTag> TtEvtBuilder< C >::hyps_
private

vector of hypothesis class names

Definition at line 51 of file TtEvtBuilder.h.

template<typename C >
edm::ParameterSet TtEvtBuilder< C >::kinFit_
private

input parameters for the kKinFit hypothesis class extras

Definition at line 61 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::ParameterSet TtEvtBuilder< C >::kinSolution_
private

input parameters for the kKinSolution hypothesis class extras

Definition at line 73 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::InputTag TtEvtBuilder< C >::meth_
private

Definition at line 84 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::ParameterSet TtEvtBuilder< C >::mvaDisc_
private

input parameters for the kMVADisc hypothesis class extras

Definition at line 83 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::InputTag TtEvtBuilder< C >::solWeight_
private

Definition at line 74 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::InputTag TtEvtBuilder< C >::sumDR_
private

Definition at line 80 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

template<typename C >
edm::InputTag TtEvtBuilder< C >::sumPt_
private

Definition at line 79 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().

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

vebosity level

Definition at line 49 of file TtEvtBuilder.h.

template<typename C >
edm::InputTag TtEvtBuilder< C >::wrongCharge_
private

Definition at line 75 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::TtEvtBuilder().