CMS 3D CMS Logo

TtEvtBuilder< C > Class Template Reference

#include <TopQuarkAnalysis/TopEventProducers/interface/TtEvtBuilder.h>

Inheritance diagram for TtEvtBuilder< C >:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 TtEvtBuilder (const edm::ParameterSet &)
 default contructor
 ~TtEvtBuilder ()
 default destructor

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 produce function (this one is not even accessible for derived classes)

Private Attributes

int decayChnTop1_
 decay channels of the two top decay branches; to be filled according to WDecay::LeptonTypes in TtGenEvent
int decayChnTop2_
edm::InputTag disc_
int event_
 internal event counter for verbosity switch
edm::InputTag fitChi2_
edm::InputTag fitProb_
edm::InputTag genEvt_
 TtGenEvent.
edm::ParameterSet genMatch_
 input parameters for the kGenMatch hypothesis class extras
std::vector< std::string > hyps_
 vector of hypothesis class names
edm::ParameterSet kinFit_
 input parameters for the kKinFit hypothesis class extras
edm::InputTag meth_
edm::ParameterSet mvaDisc_
 input parameters for the kMVADisc hypothesis class extras
edm::InputTag sumDR_
edm::InputTag sumPt_
int verbosity_
 determine vebosity level (0 or >0 are supported)


Detailed Description

template<typename C>
class TtEvtBuilder< C >

Definition at line 27 of file TtEvtBuilder.h.


Constructor & Destructor Documentation

template<typename C>
TtEvtBuilder< C >::TtEvtBuilder ( const edm::ParameterSet cfg  )  [inline, explicit]

default contructor

Definition at line 75 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 >::meth_, TtEvtBuilder< C >::mvaDisc_, TtEvtBuilder< C >::sumDR_, and TtEvtBuilder< C >::sumPt_.

00075                                                         : event_(0),
00076   verbosity_   (cfg.getParameter<int>                      ("verbosity"    )),
00077   hyps_        (cfg.getParameter<std::vector<std::string> >("hypotheses"   )),
00078   genEvt_      (cfg.getParameter<edm::InputTag>            ("genEvent"     )),
00079   decayChnTop1_(cfg.getParameter<int>                      ("decayChannel1")),
00080   decayChnTop2_(cfg.getParameter<int>                      ("decayChannel2"))
00081 {
00082   // parameter subsets for kKinFit
00083   if( cfg.exists("kinFit") ) {
00084     kinFit_  = cfg.getParameter<edm::ParameterSet>("kinFit");
00085     fitChi2_ = kinFit_.getParameter<edm::InputTag>("chi2");
00086     fitProb_ = kinFit_.getParameter<edm::InputTag>("prob");
00087   }
00088   // parameter subsets for kGenMatch
00089   if( cfg.exists("genMatch") ) {
00090     genMatch_ = cfg.getParameter<edm::ParameterSet>("genMatch");
00091     sumPt_    = genMatch_.getParameter<edm::InputTag>("sumPt");
00092     sumDR_    = genMatch_.getParameter<edm::InputTag>("sumDR");
00093   }
00094   // parameter subsets for kMvaDisc
00095   if( cfg.exists("mvaDisc") ) {
00096     mvaDisc_ = cfg.getParameter<edm::ParameterSet>("mvaDisc");
00097     meth_    = mvaDisc_.getParameter<edm::InputTag>("meth");
00098     disc_    = mvaDisc_.getParameter<edm::InputTag>("disc");
00099   }
00100   // produces a TtEventEvent for:
00101   //  * TtSemiLeptonicEvent 
00102   //  * TtFullLeptonicEvent
00103   //  * TtFullHadronicEvent (still to be implemented)
00104   // from hypotheses and associated extra information
00105   produces<C>();
00106 }

template<typename C>
TtEvtBuilder< C >::~TtEvtBuilder (  )  [inline]

default destructor

Definition at line 34 of file TtEvtBuilder.h.

00034 {};


Member Function Documentation

template<typename C>
void TtEvtBuilder< C >::produce ( edm::Event evt,
const edm::EventSetup setup 
) [inline, private, virtual]

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

Implements edm::EDProducer.

Definition at line 110 of file TtEvtBuilder.h.

References funct::C, TtEvtBuilder< C >::decayChnTop1_, TtEvtBuilder< C >::decayChnTop2_, TtEvtBuilder< C >::disc_, event(), TtEvtBuilder< C >::event_, TtEvtBuilder< C >::fitChi2_, TtEvtBuilder< C >::fitProb_, TtGenEvtProducer_cfi::genEvt, TtEvtBuilder< C >::genEvt_, edm::Event::getByLabel(), h, TtEvtBuilder< C >::hyps_, getDQMSummary::key, TtEvent::kGenMatch, TtEvent::kKinFit, TtEvent::kMVADisc, TtEvtBuilder< C >::meth_, edm::Event::put(), TtEvtBuilder< C >::sumDR_, TtEvtBuilder< C >::sumPt_, and TtEvtBuilder< C >::verbosity_.

00111 {
00112   C event;
00113 
00114   // set leptonic decay channels
00115   event.setLepDecays( WDecay::LeptonType(decayChnTop1_), WDecay::LeptonType(decayChnTop2_) );
00116 
00117   // set genEvent
00118   edm::Handle<TtGenEvent> genEvt;
00119   evt.getByLabel(genEvt_, genEvt);
00120   event.setGenEvent(genEvt);
00121 
00122   // add event hypotheses for all given 
00123   // hypothesis classes to the TtEvent
00124   typedef std::vector<std::string>::const_iterator EventHypo;
00125   for(EventHypo h=hyps_.begin(); h!=hyps_.end(); ++h){
00126     edm::Handle<int> key; 
00127     evt.getByLabel(*h, "Key", key);
00128 
00129     edm::Handle<std::vector<TtEvent::HypoCombPair> > hypMatchVec; 
00130     evt.getByLabel(*h, hypMatchVec);
00131 
00132     typedef std::vector<TtEvent::HypoCombPair>::const_iterator HypMatch;
00133     for(HypMatch hm=hypMatchVec->begin(); hm != hypMatchVec->end(); ++hm){
00134       event.addEventHypo((TtEvent::HypoClassKey&)*key, *hm);
00135     }
00136   }
00137 
00138   // set kKinFit extras
00139   if( event.isHypoAvailable(TtEvent::kKinFit) ) {
00140     edm::Handle<std::vector<double> > fitChi2;
00141     evt.getByLabel(fitChi2_, fitChi2);
00142     event.setFitChi2( *fitChi2 );
00143     
00144     edm::Handle<std::vector<double> > fitProb;
00145     evt.getByLabel(fitProb_, fitProb);
00146     event.setFitProb( *fitProb );
00147   }
00148 
00149   // set kGenMatch extras
00150   if( event.isHypoAvailable(TtEvent::kGenMatch) ) {
00151     edm::Handle<std::vector<double> > sumPt;
00152     evt.getByLabel(sumPt_, sumPt);
00153     event.setGenMatchSumPt( *sumPt );
00154 
00155     edm::Handle<std::vector<double> > sumDR;
00156     evt.getByLabel(sumDR_, sumDR);
00157     event.setGenMatchSumDR( *sumDR );
00158   }
00159 
00160   // set kMvaDisc extras
00161   if( event.isHypoAvailable(TtEvent::kMVADisc) ) {
00162     edm::Handle<TString> meth;
00163     evt.getByLabel(meth_, meth);
00164     event.setMvaMethod( (std::string) *meth );
00165 
00166     edm::Handle<std::vector<double> > disc;
00167     evt.getByLabel(disc_, disc);
00168     event.setMvaDiscriminators( *disc );
00169   }
00170 
00171   // print summary via MessageLogger for up
00172   // to verbosity events if verbosity_>0
00173   if(verbosity_==-1 || (verbosity_ > 0 && event_<verbosity_)){ 
00174     event.print();
00175   }
00176 
00177   // write object to root file 
00178   std::auto_ptr<C> pOut(new C);
00179   *pOut=event;
00180   evt.put(pOut);
00181 }


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

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

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

Definition at line 55 of file TtEvtBuilder.h.

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

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

Definition at line 71 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::produce(), and TtEvtBuilder< C >::TtEvtBuilder().

template<typename C>
int TtEvtBuilder< C >::event_ [private]

internal event counter for verbosity switch

Definition at line 45 of file TtEvtBuilder.h.

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

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

Definition at line 60 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::produce(), and TtEvtBuilder< C >::TtEvtBuilder().

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

Definition at line 61 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::produce(), and TtEvtBuilder< C >::TtEvtBuilder().

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

TtGenEvent.

Definition at line 51 of file TtEvtBuilder.h.

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

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

input parameters for the kGenMatch hypothesis class extras

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

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

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

input parameters for the kKinFit hypothesis class extras

Definition at line 59 of file TtEvtBuilder.h.

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

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

Definition at line 70 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::produce(), and TtEvtBuilder< C >::TtEvtBuilder().

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

input parameters for the kMVADisc hypothesis class extras

Definition at line 69 of file TtEvtBuilder.h.

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

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

Definition at line 66 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::produce(), and TtEvtBuilder< C >::TtEvtBuilder().

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

Definition at line 65 of file TtEvtBuilder.h.

Referenced by TtEvtBuilder< C >::produce(), and TtEvtBuilder< C >::TtEvtBuilder().

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

determine vebosity level (0 or >0 are supported)

Definition at line 47 of file TtEvtBuilder.h.

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


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:34:43 2009 for CMSSW by  doxygen 1.5.4