CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TTbar_P4Violation.cc
Go to the documentation of this file.
2 
3 //
4 // constants, enums and typedefs
5 //
6 
7 //
8 // static data member definitions
9 //
10 
11 //
12 // constructors and destructor
13 //
15 {
16  //now do what ever initialization is needed
17 
18 }
19 
20 
22 {
23 
24  // do anything here that needs to be done at desctruction time
25  // (e.g. close files, deallocate resources etc.)
26 
27 }
28 
29 
30 //
31 // member functions
32 //
33 
34 // ------------ method called on each new Event ------------
35 bool
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 }
106 
107 // ------------ method called once each job just before starting event loop ------------
108 void
110 {
111 }
112 
113 // ------------ method called once each job just after ending the event loop ------------
114 void
116 }
117 
118 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
119 void
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 }
127 
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:243
void addDefault(ParameterSetDescription const &psetDescription)
virtual void beginJob()
virtual bool filter(edm::Event &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual void endJob()
TTbar_P4Violation(const edm::ParameterSet &)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:25