CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions
TTbar_P4Violation Class Reference

#include <TTbar_P4Violation.h>

Inheritance diagram for TTbar_P4Violation:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 TTbar_P4Violation (const edm::ParameterSet &)
 
 ~TTbar_P4Violation ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- 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 ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 43 of file TTbar_P4Violation.h.

Constructor & Destructor Documentation

TTbar_P4Violation::TTbar_P4Violation ( const edm::ParameterSet iConfig)
explicit

Definition at line 14 of file TTbar_P4Violation.cc.

15 {
16  //now do what ever initialization is needed
17 
18 }
TTbar_P4Violation::~TTbar_P4Violation ( )

Definition at line 21 of file TTbar_P4Violation.cc.

22 {
23 
24  // do anything here that needs to be done at desctruction time
25  // (e.g. close files, deallocate resources etc.)
26 
27 }

Member Function Documentation

void TTbar_P4Violation::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 109 of file TTbar_P4Violation.cc.

110 {
111 }
void TTbar_P4Violation::endJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 115 of file TTbar_P4Violation.cc.

115  {
116 }
void TTbar_P4Violation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 120 of file TTbar_P4Violation.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

120  {
121  //The following says we do not know what parameters are allowed so do no validation
122  // Please change this to state exactly what you do use, even if it is no parameters
124  desc.setUnknown();
125  descriptions.addDefault(desc);
126 }
void addDefault(ParameterSetDescription const &psetDescription)
bool TTbar_P4Violation::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDFilter.

Definition at line 36 of file TTbar_P4Violation.cc.

References funct::false, TtGenEvtProducer_cfi::genEvt, edm::Event::getByLabel(), and funct::true.

37 {
38  using namespace edm;
39 
40  // --- get TopQuarkAnalysis TtGenEvent
42  iEvent.getByLabel("genEvt", genEvt);
43 
44  if(!genEvt.isValid()) return false;
45 
46  const reco::GenParticle* top = 0;
47  const reco::GenParticle* antitop = 0;
48  const reco::GenParticle* bottom = 0;
49  const reco::GenParticle* antibottom = 0;
50  const reco::GenParticle* Wplus = 0;
51  const reco::GenParticle* Wmin = 0;
52 
53  top = genEvt->top();
54  antitop = genEvt->topBar();
55  bottom = genEvt->b();
56  antibottom = genEvt->bBar();
57  Wplus = genEvt->wPlus();
58  Wmin = genEvt->wMinus();
59 
60 
61  if(top && antitop && bottom && antibottom && Wplus && Wmin){
62  const reco::Particle::LorentzVector topP4 = bottom->p4() + Wplus->p4() ;
63  const reco::Particle::LorentzVector antitopP4 = antibottom->p4() + Wmin ->p4() ;
64 
65  double tolerance = 0.1 ;
66 
67  bool topViolated = false ;
68  bool antitopViolated = false ;
69 
70  if ( (top->p4().px() - topP4.px() > tolerance) ||
71  (top->p4().py() - topP4.py() > tolerance) ||
72  (top->p4().pz() - topP4.pz() > tolerance) ||
73  (top->p4().e () - topP4.e () > tolerance) ) {
74 
75  topViolated = true ;
76 
77  //printf( "momentum not conserved for top:\n" ) ;
78  //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n", top->p4().px(), top->p4().py(), top->p4().pz(), top->p4().e() ) ;
79  //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n", topP4.px(), topP4.py(), topP4.pz(), topP4.e() ) ;
80  }
81 
82  if ( (antitop->p4().px() - antitopP4.px() > tolerance) ||
83  (antitop->p4().py() - antitopP4.py() > tolerance) ||
84  (antitop->p4().pz() - antitopP4.pz() > tolerance) ||
85  (antitop->p4().e () - antitopP4.e () > tolerance) ) {
86 
87  antitopViolated = true ;
88 
89  //printf( "momentum not conserved for anti-top:\n" ) ;
90  //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n ", antitop->p4().px(), antitop->p4().py(), antitop->p4().pz(), antitop->p4().e() ) ;
91  //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n ", antitopP4.px(), antitopP4.py(), antitopP4.pz(), antitopP4.e() ) ;
92  }
93 
94  return (topViolated || antitopViolated);
95 
96 
97  // GOSSIE temp
98  bool bottomOK = true ;
99  bool antibottomOK = true ;
100  if ( fabs( bottom->p4().pz()) < 1. ) bottomOK = false ;
101  if ( fabs(antibottom->p4().pz()) < 1. ) antibottomOK = false ;
102  return (bottomOK && antibottomOK);
103  }
104  return false;
105 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:25