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  genEvt_(iConfig.getParameter<edm::InputTag>("genEvt"))
16 {
17  genEvtToken_=consumes<TtGenEvent>(genEvt_);
18 
19 }
20 
21 
23 {
24 
25  // do anything here that needs to be done at desctruction time
26  // (e.g. close files, deallocate resources etc.)
27 
28 }
29 
30 
31 //
32 // member functions
33 //
34 
35 // ------------ method called on each new Event ------------
36 bool
38 {
39  using namespace edm;
40 
41  // --- get TopQuarkAnalysis TtGenEvent
44 
45  if(!genEvt.isValid()) return false;
46 
47  const reco::GenParticle* top = 0;
48  const reco::GenParticle* antitop = 0;
49  const reco::GenParticle* bottom = 0;
50  const reco::GenParticle* antibottom = 0;
51  const reco::GenParticle* Wplus = 0;
52  const reco::GenParticle* Wmin = 0;
53 
54  top = genEvt->top();
55  antitop = genEvt->topBar();
56  bottom = genEvt->b();
57  antibottom = genEvt->bBar();
58  Wplus = genEvt->wPlus();
59  Wmin = genEvt->wMinus();
60 
61 
62  if(top && antitop && bottom && antibottom && Wplus && Wmin){
63  const reco::Particle::LorentzVector topP4 = bottom->p4() + Wplus->p4() ;
64  const reco::Particle::LorentzVector antitopP4 = antibottom->p4() + Wmin ->p4() ;
65 
66  double tolerance = 0.1 ;
67 
68  bool topViolated = false ;
69  bool antitopViolated = false ;
70 
71  if ( (top->p4().px() - topP4.px() > tolerance) ||
72  (top->p4().py() - topP4.py() > tolerance) ||
73  (top->p4().pz() - topP4.pz() > tolerance) ||
74  (top->p4().e () - topP4.e () > tolerance) ) {
75 
76  topViolated = true ;
77 
78  //printf( "momentum not conserved for top:\n" ) ;
79  //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() ) ;
80  //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n", topP4.px(), topP4.py(), topP4.pz(), topP4.e() ) ;
81  }
82 
83  if ( (antitop->p4().px() - antitopP4.px() > tolerance) ||
84  (antitop->p4().py() - antitopP4.py() > tolerance) ||
85  (antitop->p4().pz() - antitopP4.pz() > tolerance) ||
86  (antitop->p4().e () - antitopP4.e () > tolerance) ) {
87 
88  antitopViolated = true ;
89 
90  //printf( "momentum not conserved for anti-top:\n" ) ;
91  //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() ) ;
92  //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n ", antitopP4.px(), antitopP4.py(), antitopP4.pz(), antitopP4.e() ) ;
93  }
94 
95  return (topViolated || antitopViolated);
96 
97 
98  // GOSSIE temp
99  bool bottomOK = true ;
100  bool antibottomOK = true ;
101  if ( fabs( bottom->p4().pz()) < 1. ) bottomOK = false ;
102  if ( fabs(antibottom->p4().pz()) < 1. ) antibottomOK = false ;
103  return (bottomOK && antibottomOK);
104  }
105  return false;
106 }
107 
108 // ------------ method called once each job just before starting event loop ------------
109 void
111 {
112 }
113 
114 // ------------ method called once each job just after ending the event loop ------------
115 void
117 }
118 
119 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
120 void
122  //The following says we do not know what parameters are allowed so do no validation
123  // Please change this to state exactly what you do use, even if it is no parameters
125  desc.setUnknown();
126  descriptions.addDefault(desc);
127 }
128 
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::InputTag genEvt_
int iEvent
Definition: GenABIO.cc:243
void addDefault(ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< TtGenEvent > genEvtToken_
virtual void beginJob()
virtual bool filter(edm::Event &, const edm::EventSetup &)
virtual void endJob()
volatile std::atomic< bool > shutdown_flag false
genEvt_(cfg.getParameter< edm::InputTag >("genEvent"))
TTbar_P4Violation(const edm::ParameterSet &)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:27