Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
Validation
EventGenerator
plugins
TTbar_P4Violation.cc
Go to the documentation of this file.
1
#include "
Validation/EventGenerator/interface/TTbar_P4Violation.h
"
2
3
//
4
// constants, enums and typedefs
5
//
6
7
//
8
// static data member definitions
9
//
10
11
//
12
// constructors and destructor
13
//
14
TTbar_P4Violation::TTbar_P4Violation
(
const
edm::ParameterSet
& iConfig)
15
{
16
//now do what ever initialization is needed
17
18
}
19
20
21
TTbar_P4Violation::~TTbar_P4Violation
()
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
36
TTbar_P4Violation::filter
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
37
{
38
using namespace
edm;
39
40
// --- get TopQuarkAnalysis TtGenEvent
41
Handle<TtGenEvent>
genEvt
;
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
109
TTbar_P4Violation::beginJob
()
110
{
111
}
112
113
// ------------ method called once each job just after ending the event loop ------------
114
void
115
TTbar_P4Violation::endJob
() {
116
}
117
118
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
119
void
120
TTbar_P4Violation::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
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
123
edm::ParameterSetDescription
desc;
124
desc.
setUnknown
();
125
descriptions.
addDefault
(desc);
126
}
127
TTbar_P4Violation::~TTbar_P4Violation
~TTbar_P4Violation()
Definition:
TTbar_P4Violation.cc:21
TTbar_P4Violation::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
TTbar_P4Violation.cc:120
funct::false
false
Definition:
Factorize.h:34
TTbar_P4Violation.h
edm::Handle
Definition:
AssociativeIterator.h:48
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:50
funct::true
true
Definition:
Factorize.h:183
TtGenEvtProducer_cfi.genEvt
tuple genEvt
Definition:
TtGenEvtProducer_cfi.py:7
iEvent
int iEvent
Definition:
GenABIO.cc:243
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:99
TTbar_P4Violation::beginJob
virtual void beginJob()
Definition:
TTbar_P4Violation.cc:109
edm::EventSetup
Definition:
EventSetup.h:44
TTbar_P4Violation::filter
virtual bool filter(edm::Event &, const edm::EventSetup &)
Definition:
TTbar_P4Violation.cc:36
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:356
reco::GenParticle
Definition:
GenParticle.h:21
TTbar_P4Violation::endJob
virtual void endJob()
Definition:
TTbar_P4Violation.cc:115
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition:
ParameterSetDescription.cc:54
edm::ParameterSet
Definition:
ParameterSet.h:35
edm::Event
Definition:
Event.h:50
TTbar_P4Violation::TTbar_P4Violation
TTbar_P4Violation(const edm::ParameterSet &)
Definition:
TTbar_P4Violation.cc:14
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition:
Particle.h:25
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:27
Generated for CMSSW Reference Manual by
1.8.5