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_
 
std::vector< std::string > hyps_
 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)
 
- 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 82 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 >::kinFit_, TtEvtBuilder< C >::kinSolution_, TtEvtBuilder< C >::meth_, TtEvtBuilder< C >::mvaDisc_, TtEvtBuilder< C >::solWeight_, TtEvtBuilder< C >::sumDR_, TtEvtBuilder< C >::sumPt_, and TtEvtBuilder< C >::wrongCharge_.

82  :
83  verbosity_ (cfg.getParameter<int> ("verbosity" )),
84  hyps_ (cfg.getParameter<std::vector<std::string> >("hypotheses" )),
85  genEvt_ (cfg.getParameter<edm::InputTag> ("genEvent" )),
86  decayChnTop1_(cfg.getParameter<int> ("decayChannel1")),
87  decayChnTop2_(cfg.getParameter<int> ("decayChannel2"))
88 {
89  // parameter subsets for kKinFit
90  if( cfg.exists("kinFit") ) {
91  kinFit_ = cfg.getParameter<edm::ParameterSet>("kinFit");
94  }
95  // parameter subsets for kKinSolution
96  if( cfg.exists("kinSolution") ) {
97  kinSolution_ = cfg.getParameter<edm::ParameterSet>("kinSolution");
100  }
101  // parameter subsets for kGenMatch
102  if( cfg.exists("genMatch") ) {
103  genMatch_ = cfg.getParameter<edm::ParameterSet>("genMatch");
106  }
107  // parameter subsets for kMvaDisc
108  if( cfg.exists("mvaDisc") ) {
109  mvaDisc_ = cfg.getParameter<edm::ParameterSet>("mvaDisc");
112  }
113  // produces a TtEventEvent for:
114  // * TtSemiLeptonicEvent
115  // * TtFullLeptonicEvent
116  // * TtFullHadronicEvent
117  // from hypotheses and associated extra information
118  produces<C>();
119 }
T getParameter(std::string const &) const
edm::InputTag fitProb_
Definition: TtEvtBuilder.h:63
edm::InputTag sumDR_
Definition: TtEvtBuilder.h:73
edm::InputTag genEvt_
TtGenEvent.
Definition: TtEvtBuilder.h:53
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::ParameterSet genMatch_
Definition: TtEvtBuilder.h:71
edm::InputTag solWeight_
Definition: TtEvtBuilder.h:67
std::vector< std::string > hyps_
vector of hypothesis class names
Definition: TtEvtBuilder.h:51
edm::InputTag sumPt_
Definition: TtEvtBuilder.h:72
int verbosity_
vebosity level
Definition: TtEvtBuilder.h:49
edm::ParameterSet mvaDisc_
Definition: TtEvtBuilder.h:76
edm::ParameterSet kinFit_
Definition: TtEvtBuilder.h:61
edm::InputTag wrongCharge_
Definition: TtEvtBuilder.h:68
edm::ParameterSet kinSolution_
Definition: TtEvtBuilder.h:66
edm::InputTag disc_
Definition: TtEvtBuilder.h:78
edm::InputTag fitChi2_
Definition: TtEvtBuilder.h:62
edm::InputTag meth_
Definition: TtEvtBuilder.h:77
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 197 of file TtEvtBuilder.h.

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

Definition at line 202 of file TtEvtBuilder.h.

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

203 {
204 
205  // set kKinSolution extras
206  if( ttEvent.isHypoAvailable(TtEvent::kKinSolution) ) {
208  evt.getByLabel(solWeight_, solWeight);
209  ttEvent.setSolWeight( *solWeight );
210 
211  edm::Handle<bool> wrongCharge;
212  evt.getByLabel(wrongCharge_, wrongCharge);
213  ttEvent.setWrongCharge( *wrongCharge );
214  }
215 
216 }
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:67
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
void setSolWeight(const std::vector< double > &val)
set weight of kKinSolution hypothesis
edm::InputTag wrongCharge_
Definition: TtEvtBuilder.h:68
template<>
void TtEvtBuilder< TtSemiLeptonicEvent >::fillSpecific ( TtSemiLeptonicEvent ttEvent,
const edm::Event evt 
)
private

Definition at line 219 of file TtEvtBuilder.h.

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

220 {
221 
222  // set number of real neutrino solutions for all hypotheses
223  typedef std::vector<std::string>::const_iterator EventHypo;
224  for(EventHypo h=hyps_.begin(); h!=hyps_.end(); ++h){
226  evt.getByLabel(*h, "Key", key);
227 
228  edm::Handle<int> numberOfRealNeutrinoSolutions;
229  evt.getByLabel(*h, "NumberOfRealNeutrinoSolutions", numberOfRealNeutrinoSolutions);
230 
231  ttEvent.setNumberOfRealNeutrinoSolutions((TtEvent::HypoClassKey&)*key, *numberOfRealNeutrinoSolutions);
232  }
233 
234 }
HypoClassKey
supported classes of event hypotheses
Definition: TtEvent.h:31
void setNumberOfRealNeutrinoSolutions(const HypoClassKey &key, const int &nr)
set number of real neutrino solutions for a given hypo class
std::vector< std::string > hyps_
vector of hypothesis class names
Definition: TtEvtBuilder.h:51
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
list key
Definition: combine.py:13
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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 123 of file TtEvtBuilder.h.

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

124 {
125  C ttEvent;
126 
127  // set leptonic decay channels
129 
130  // set genEvent (if available)
132  if( evt.getByLabel(genEvt_, genEvt) )
133  ttEvent.setGenEvent(genEvt);
134 
135  // add event hypotheses for all given
136  // hypothesis classes to the TtEvent
137  typedef std::vector<std::string>::const_iterator EventHypo;
138  for(EventHypo h=hyps_.begin(); h!=hyps_.end(); ++h){
140  evt.getByLabel(*h, "Key", key);
141 
143  evt.getByLabel(*h, hypMatchVec);
144 
145  typedef std::vector<TtEvent::HypoCombPair>::const_iterator HypMatch;
146  for(HypMatch hm=hypMatchVec->begin(); hm != hypMatchVec->end(); ++hm){
147  ttEvent.addEventHypo((TtEvent::HypoClassKey&)*key, *hm);
148  }
149  }
150 
151  // set kKinFit extras
152  if( ttEvent.isHypoAvailable(TtEvent::kKinFit) ) {
154  evt.getByLabel(fitChi2_, fitChi2);
155  ttEvent.setFitChi2( *fitChi2 );
156 
158  evt.getByLabel(fitProb_, fitProb);
159  ttEvent.setFitProb( *fitProb );
160  }
161 
162  // set kGenMatch extras
163  if( ttEvent.isHypoAvailable(TtEvent::kGenMatch) ) {
165  evt.getByLabel(sumPt_, sumPt);
166  ttEvent.setGenMatchSumPt( *sumPt );
167 
169  evt.getByLabel(sumDR_, sumDR);
170  ttEvent.setGenMatchSumDR( *sumDR );
171  }
172 
173  // set kMvaDisc extras
174  if( ttEvent.isHypoAvailable(TtEvent::kMVADisc) ) {
176  evt.getByLabel(meth_, meth);
177  ttEvent.setMvaMethod( *meth );
178 
180  evt.getByLabel(disc_, disc);
181  ttEvent.setMvaDiscriminators( *disc );
182  }
183 
184  // fill data members that are decay-channel specific
185  fillSpecific(ttEvent, evt);
186 
187  // print summary via MessageLogger if verbosity_>0
188  ttEvent.print(verbosity_);
189 
190  // write object into the edm::Event
191  std::auto_ptr<C> pOut(new C);
192  *pOut=ttEvent;
193  evt.put(pOut);
194 }
HypoClassKey
supported classes of event hypotheses
Definition: TtEvent.h:31
edm::InputTag fitProb_
Definition: TtEvtBuilder.h:63
edm::InputTag sumDR_
Definition: TtEvtBuilder.h:73
edm::InputTag genEvt_
TtGenEvent.
Definition: TtEvtBuilder.h:53
static double fitChi2(const CachingVertex< 5 > &vtx)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
virtual void fillSpecific(C &, const edm::Event &)
fill data members that are decay-channel specific
std::vector< std::string > hyps_
vector of hypothesis class names
Definition: TtEvtBuilder.h:51
edm::InputTag sumPt_
Definition: TtEvtBuilder.h:72
int verbosity_
vebosity level
Definition: TtEvtBuilder.h:49
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
edm::InputTag disc_
Definition: TtEvtBuilder.h:78
edm::InputTag fitChi2_
Definition: TtEvtBuilder.h:62
list key
Definition: combine.py:13
edm::InputTag meth_
Definition: TtEvtBuilder.h:77
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

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

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

template<typename C >
std::vector<std::string> 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 66 of file TtEvtBuilder.h.

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

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

Definition at line 77 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 76 of file TtEvtBuilder.h.

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

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

Definition at line 67 of file TtEvtBuilder.h.

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

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

Definition at line 73 of file TtEvtBuilder.h.

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

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

Definition at line 72 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 68 of file TtEvtBuilder.h.

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