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::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 &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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 231 of file TtEvtBuilder.h.

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

Definition at line 236 of file TtEvtBuilder.h.

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

237 {
238 
239  // set kKinSolution extras
240  if( ttEvent.isHypoAvailable(TtEvent::kKinSolution) ) {
242  evt.getByLabel(solWeight_, solWeight);
243  ttEvent.setSolWeight( *solWeight );
244 
245  edm::Handle<bool> wrongCharge;
246  evt.getByLabel(wrongCharge_, wrongCharge);
247  ttEvent.setWrongCharge( *wrongCharge );
248  }
249 
250 }
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:356
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 253 of file TtEvtBuilder.h.

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

254 {
255 
256  typedef std::vector<edm::InputTag>::const_iterator EventHypo;
257  for(EventHypo h=hyps_.begin(); h!=hyps_.end(); ++h){
259  evt.getByLabel(h->label(), "Key", key);
260 
261  // set number of real neutrino solutions for all hypotheses
262  edm::Handle<int> numberOfRealNeutrinoSolutions;
263  evt.getByLabel(h->label(), "NumberOfRealNeutrinoSolutions", numberOfRealNeutrinoSolutions);
264  ttEvent.setNumberOfRealNeutrinoSolutions((TtEvent::HypoClassKey&)*key, *numberOfRealNeutrinoSolutions);
265 
266  // set number of considered jets for all hypotheses
267  edm::Handle<int> numberOfConsideredJets;
268  evt.getByLabel(h->label(), "NumberOfConsideredJets", numberOfConsideredJets);
269  ttEvent.setNumberOfConsideredJets((TtEvent::HypoClassKey&)*key, *numberOfConsideredJets);
270  }
271 
272 }
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:356
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( evt.getByLabel(genEvt_, genEvt) )
148  ttEvent.setGenEvent(genEvt);
149 
150  // add event hypotheses for all given
151  // hypothesis classes to the TtEvent
152  typedef std::vector<edm::InputTag>::const_iterator EventHypo;
153  for(EventHypo h=hyps_.begin(); h!=hyps_.end(); ++h){
155  evt.getByLabel(h->label(), "Key", key);
156 
158  evt.getByLabel(*h, hypMatchVec);
159 
160  typedef std::vector<TtEvent::HypoCombPair>::const_iterator HypMatch;
161  for(HypMatch hm=hypMatchVec->begin(); hm != hypMatchVec->end(); ++hm){
162  ttEvent.addEventHypo((TtEvent::HypoClassKey&)*key, *hm);
163  }
164  }
165 
166  // set kKinFit extras
167  if( ttEvent.isHypoAvailable(TtEvent::kKinFit) ) {
169  evt.getByLabel(fitChi2_, fitChi2);
170  ttEvent.setFitChi2( *fitChi2 );
171 
173  evt.getByLabel(fitProb_, fitProb);
174  ttEvent.setFitProb( *fitProb );
175  }
176 
177  // set kHitFit extras
178  if( ttEvent.isHypoAvailable(TtEvent::kHitFit) ) {
179  edm::Handle<std::vector<double> > hitFitChi2;
180  evt.getByLabel(hitFitChi2_, hitFitChi2);
181  ttEvent.setHitFitChi2( *hitFitChi2 );
182 
183  edm::Handle<std::vector<double> > hitFitProb;
184  evt.getByLabel(hitFitProb_, hitFitProb);
185  ttEvent.setHitFitProb( *hitFitProb );
186 
188  evt.getByLabel(hitFitMT_, hitFitMT);
189  ttEvent.setHitFitMT( *hitFitMT );
190 
191  edm::Handle<std::vector<double> > hitFitSigMT;
192  evt.getByLabel(hitFitSigMT_, hitFitSigMT);
193  ttEvent.setHitFitSigMT( *hitFitSigMT );
194  }
195 
196  // set kGenMatch extras
197  if( ttEvent.isHypoAvailable(TtEvent::kGenMatch) ) {
199  evt.getByLabel(sumPt_, sumPt);
200  ttEvent.setGenMatchSumPt( *sumPt );
201 
203  evt.getByLabel(sumDR_, sumDR);
204  ttEvent.setGenMatchSumDR( *sumDR );
205  }
206 
207  // set kMvaDisc extras
208  if( ttEvent.isHypoAvailable(TtEvent::kMVADisc) ) {
210  evt.getByLabel(meth_, meth);
211  ttEvent.setMvaMethod( *meth );
212 
214  evt.getByLabel(disc_, disc);
215  ttEvent.setMvaDiscriminators( *disc );
216  }
217 
218  // fill data members that are decay-channel specific
219  fillSpecific(ttEvent, evt);
220 
221  // print summary via MessageLogger if verbosity_>0
222  ttEvent.print(verbosity_);
223 
224  // write object into the edm::Event
225  std::auto_ptr<C> pOut(new C);
226  *pOut=ttEvent;
227  evt.put(pOut);
228 }
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:85
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:356
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
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().