CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TTbar_Kinematics.cc
Go to the documentation of this file.
6 
7 using namespace edm;
9  hepmcCollection_(iConfig.getParameter<edm::InputTag>("hepmcCollection"))
10  ,genEventInfoProductTag_(iConfig.getParameter<edm::InputTag>("genEventInfoProductTag"))
11 {
12 
13  hepmcCollectionToken_=consumes<HepMCProduct>(hepmcCollection_);
14  genEventInfoProductTagToken_=consumes<GenEventInfoProduct>(genEventInfoProductTag_);
15 }
16 
17 
19 
20 
21 //
22 // member functions
23 //
24 
25 // ------------ method called for each event ------------
27 {
28 
29  // --- the MC weights ---
31  iEvent.getByToken(genEventInfoProductTagToken_, evt_info);
32  if(!evt_info.isValid()) return;
33  weight = evt_info->weight() ;
34 
35 
36 
39  iEvent.getByToken(hepmcCollectionToken_, evt);
40 
41  //Get EVENT
42  const HepMC::GenEvent *myGenEvent = evt->GetEvent();
43 
45  bool top(false), antitop(false), antibottom(false), bottom(false), Wplus(false), Wmin(false);
46  for(HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin(); iter != myGenEvent->particles_end(); iter++) {
47  if((*iter)->pdg_id()==PdtPdgMini::t || (*iter)->pdg_id()==PdtPdgMini::anti_t){
48  if( (*iter)->end_vertex()){
49  HepMC::GenVertex::particle_iterator des;
50  for(des = (*iter)->end_vertex()->particles_begin(HepMC::children);des!= (*iter)->end_vertex()->particles_end(HepMC::children);++des ){
51  if((*des)->pdg_id()==PdtPdgMini::b){
52  tlv_Bottom.SetPxPyPzE((*des)->momentum().px(),(*des)->momentum().py(),(*des)->momentum().pz(),(*des)->momentum().e());
53  bottom=true;
54  }
55  if((*des)->pdg_id()==PdtPdgMini::anti_b){
56  antibottom=true;
57  tlv_BottomBar.SetPxPyPzE((*des)->momentum().px(),(*des)->momentum().py(),(*des)->momentum().pz(),(*des)->momentum().e());
58  }
59  if((*des)->pdg_id()==PdtPdgMini::W_plus){
60  tlv_TopBar.SetPxPyPzE((*iter)->momentum().px(),(*iter)->momentum().py(),(*iter)->momentum().pz(),(*iter)->momentum().e()); antitop=true;
61  tlv_Wplus.SetPxPyPzE((*des)->momentum().px(),(*des)->momentum().py(),(*des)->momentum().pz(),(*des)->momentum().e()); Wplus=true;
62  }
63  if((*des)->pdg_id()==PdtPdgMini::W_minus){
64  tlv_Top.SetPxPyPzE((*iter)->momentum().px(),(*iter)->momentum().py(),(*iter)->momentum().pz(),(*iter)->momentum().e()); top=true;
65  tlv_Wmin.SetPxPyPzE((*des)->momentum().px(),(*des)->momentum().py(),(*des)->momentum().pz(),(*des)->momentum().e()); Wmin=true;
66  }
67  }
68  }
69  }
70  }
71 
72  tlv_TTbar = tlv_Top + tlv_TopBar ;
73 
74  //---topquarkquantities---
75  nEvt->Fill(0.5,weight);
76  if(top && antitop){
77  hTopPt->Fill(tlv_Top.Pt(),weight);
78  hTopPt->Fill(tlv_TopBar.Pt(),weight);
79 
80  hTopY->Fill(tlv_Top.Rapidity(),weight);
81  hTopY->Fill(tlv_TopBar.Rapidity(),weight);
82 
83  hTopMass->Fill(tlv_Top.M(),weight);
84  hTopMass->Fill(tlv_TopBar.M(),weight);
85 
86  //---ttbarpairquantities---
87  hTTbarPt->Fill(tlv_TTbar.Pt(),weight);
88  hTTbarY->Fill(tlv_TTbar.Rapidity(),weight);
89  hTTbarMass->Fill(tlv_TTbar.M(),weight);
90  }
91  if(bottom && antibottom){
92  hBottomPt->Fill(tlv_Bottom.Pt(),weight);
93  hBottomPt->Fill(tlv_BottomBar.Pt(),weight);
94 
95  hBottomEta->Fill(tlv_Bottom.Eta(),weight);
96  hBottomEta->Fill(tlv_BottomBar.Eta(),weight);
97 
98  //hBottomY->Fill(math::XYZTLorentzVector(bottom->momentum()).Rapidity(),weight);
99  //hBottomY->Fill(math::XYZTLorentzVector(antibottom->momentum()).Rapidity(),weight);
100 
101  hBottomY->Fill(tlv_Bottom.Rapidity(),weight);
102  hBottomY->Fill(tlv_BottomBar.Rapidity(),weight);
103 
104  hBottomPz->Fill(tlv_Bottom.Pz(),weight);
105  hBottomPz->Fill(tlv_BottomBar.Pz(),weight);
106 
107  hBottomE->Fill(tlv_Bottom.E(),weight);
108  hBottomE->Fill(tlv_BottomBar.E(),weight);
109 
110  hBottomMass->Fill(tlv_Bottom.M(),weight);
111  hBottomMass->Fill(tlv_BottomBar.M(),weight);
112 
113  hBottomPtPz->Fill(tlv_Bottom.Pt(),tlv_Bottom.Pz(),weight);
114  hBottomPtPz->Fill(tlv_BottomBar.Pt(),tlv_BottomBar.Pz(),weight);
115 
116  hBottomEtaPz->Fill(tlv_Bottom.Eta(),tlv_Bottom.Pz(),weight);
117  hBottomEtaPz->Fill(tlv_BottomBar.Eta(),tlv_BottomBar.Pz(),weight);
118 
119  hBottomEtaPt->Fill(tlv_Bottom.Eta(),tlv_Bottom.Pt(),weight);
120  hBottomEtaPt->Fill(tlv_BottomBar.Eta(),tlv_BottomBar.Pt(),weight);
121 
122  hBottomYPz->Fill(tlv_Bottom.Rapidity(),tlv_Bottom.Pz(),weight);
123  hBottomYPz->Fill(tlv_BottomBar.Rapidity(),tlv_BottomBar.Pz(),weight);
124 
125  hBottomMassPz->Fill(tlv_Bottom.M(),tlv_Bottom.Pz(),weight);
126  hBottomMassPz->Fill(tlv_BottomBar.M(),tlv_BottomBar.Pz(),weight);
127 
128  hBottomMassEta->Fill(tlv_Bottom.M(),tlv_Bottom.Eta(),weight);
129  hBottomMassEta->Fill(tlv_BottomBar.M(),tlv_BottomBar.Eta(),weight);
130 
131  hBottomMassY->Fill(tlv_Bottom.M(),tlv_Bottom.Rapidity(),weight);
132  hBottomMassY->Fill(tlv_BottomBar.M(),tlv_BottomBar.Rapidity(),weight);
133 
134  hBottomMassDeltaY->Fill(tlv_Bottom.M(),tlv_Bottom.Eta()-tlv_Bottom.Rapidity(),weight);
135  hBottomMassDeltaY->Fill(tlv_BottomBar.M(),tlv_BottomBar.Eta()-tlv_BottomBar.Rapidity(),weight);
136  }
137  if(Wplus && Wmin){
138  hWplusPz->Fill(tlv_Wplus.Pz(),weight);
139  hWminPz->Fill(tlv_Wmin.Pz(),weight);
140  }
141 }
142 
143 
144 // ------------ method called once each job just before starting event loop ------------
146  DQMHelper dqm(&i); i.setCurrentFolder("Generator/TTbar");
147 
148  nEvt = dqm.book1dHisto("nEvt", "n analyzed Events", 1, 0., 1.);
149 
150  hTopPt = dqm.book1dHisto("TTbar_TopPt","t quark transverse momentum",1000,0.,1000.); hTopPt->setAxisTitle("t quark transverse momentum");
151  hTopY = dqm.book1dHisto("TTbar_TopY","t quark rapidity",200,-5.,5.); hTopY->setAxisTitle("t quark rapidity");
152  hTopMass = dqm.book1dHisto("TTbar_TopMass","t quark mass",500,0.,500.); hTopMass->setAxisTitle("t quark mass");
153 
154  hTTbarPt = dqm.book1dHisto("TTbar_TTbarPt","tt pair transverse momentum",1000,0.,1000.); hTTbarPt->setAxisTitle("tt pair transverse momentum");
155  hTTbarY = dqm.book1dHisto("TTbar_TTbarY","tt pair rapidity",200,-5.,5.); hTTbarY->setAxisTitle("tt pair rapidity");
156  hTTbarMass = dqm.book1dHisto("TTbar_TTbarMass","tt pair mass",1000,0.,1000.); hTTbarMass->setAxisTitle("tt pair mass");
157 
158  hBottomPt = dqm.book1dHisto("TTbar_BottomPt","b quark transverse momentum",1000,0.,1000.); hBottomPt->setAxisTitle("b quark transverse momentum");
159  hBottomEta = dqm.book1dHisto("TTbar_BottomEta","b quark pseudo-rapidity",200,-5.,5.); hBottomEta->setAxisTitle("b quark pseudo-rapidity");
160  hBottomY = dqm.book1dHisto("TTbar_BottomY","b quark rapidity",200,-5.,5.); hBottomY->setAxisTitle("b quark rapidity");
161  hBottomPz = dqm.book1dHisto("TTbar_BottomPz","b quark longitudinal momentum",200,-100.,100.); hBottomPz->setAxisTitle("b quark longitudinal momentum");
162  hBottomE = dqm.book1dHisto("TTbar_BottomE","b quark energy",1000,0.,1000.); hBottomE->setAxisTitle("b quark energy");
163  hBottomMass = dqm.book1dHisto("TTbar_BottomMass","b quark mass",50,0.,5.); hBottomMass->setAxisTitle("b quark mass");
164 
165  hBottomPtPz = dqm.book2dHisto("TTbar_BottomPtPz","b quark longitudinal vs transverse momentum",1000,0.,1000.,200,-100.,100.); hBottomPtPz->setAxisTitle("P_{z} (GeV)",1);hBottomPtPz->setAxisTitle("P_{t} (GeV)",2);
166  hBottomEtaPz = dqm.book2dHisto("TTbar_BottomEtaPz","b quark longitudinal momentum vs pseudorapidity",200,-5.,5.,200,-100.,100.); hBottomEtaPz->setAxisTitle("#eta",1);hBottomEtaPz->setAxisTitle("P_{z} (GeV)",1);
167  hBottomEtaPt = dqm.book2dHisto("TTbar_BottomEtaPt"," quark transveral momentum vs pseudorapidity",200,-5.,5.,1000,0.,1000.); hBottomEtaPt->setAxisTitle("#eta");hBottomEtaPt->setAxisTitle("P_{t} (GeV)");
168  hBottomYPz = dqm.book2dHisto("TTbar_BottomYPz","b quark longitudinal momentum vs rapidity",200,-5.,5.,200,-100.,100.); hBottomYPz->setAxisTitle("Y");hBottomYPz->setAxisTitle("P_{z} (GeV)");
169  hBottomMassPz = dqm.book2dHisto("TTbar_BottomMassPz","b quark longitudinal momentum vs mass",50,0.,5.,200,-100.,100.); hBottomMassPz->setAxisTitle("M (GeV)");hBottomMassPz->setAxisTitle("P_{z} (GeV)");
170  hBottomMassEta = dqm.book2dHisto("TTbar_BottomMassEta","b quark pseudorapidity vs mass",50,0.,5.,200,-5.,5.); hBottomMassEta->setAxisTitle("M (GeV)");hBottomMassEta->setAxisTitle("#eta");
171  hBottomMassY = dqm.book2dHisto("TTbar_BottomMassY","b quark rapidity vs mass",50,0.,5.,200,-5.,5.); hBottomMassY->setAxisTitle("M (GeV)"); hBottomMassY->setAxisTitle("Y");
172  hBottomMassDeltaY = dqm.book2dHisto("TTbar_BottomMassDeltaY","b quark pseudorapidity - rapidity vs mass",50,0.,50.,2000,-5.,5.); hBottomMassDeltaY->setAxisTitle("M (GeV)");hBottomMassDeltaY->setAxisTitle("Y");
173 
174  hWplusPz = dqm.book1dHisto("TTbar_WplusPz","W+ boson longitudinal momentum",200,-100.,100.); hWplusPz->setAxisTitle("W+ boson longitudinal momentum");
175  hWminPz = dqm.book1dHisto("TTbar_WminPz","W- boson longitudinal momentum",200,-100.,100.); hWminPz->setAxisTitle("W- boson longitudinal momentum");
176 
177 }
178 
int i
Definition: DBlmapReader.cc:9
MonitorElement * hBottomYPz
MonitorElement * nEvt
TLorentzVector tlv_Bottom
virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< GenEventInfoProduct > genEventInfoProductTagToken_
MonitorElement * hBottomMass
MonitorElement * hBottomPtPz
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
MonitorElement * book2dHisto(const std::string &name, const std::string &title, int nx, double xmin, double xmax, int ny, double ymin, double ymax)
Definition: DQMHelper.cc:18
MonitorElement * hTTbarMass
MonitorElement * hBottomMassY
TLorentzVector tlv_Wplus
MonitorElement * hBottomEtaPt
void Fill(long long x)
MonitorElement * hBottomEta
TLorentzVector tlv_TopBar
int iEvent
Definition: GenABIO.cc:230
MonitorElement * hTopMass
MonitorElement * hTTbarY
TLorentzVector tlv_TTbar
MonitorElement * hWminPz
bool isValid() const
Definition: HandleBase.h:75
TLorentzVector tlv_BottomBar
MonitorElement * hBottomMassPz
MonitorElement * hBottomMassEta
edm::InputTag genEventInfoProductTag_
MonitorElement * hBottomPz
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * hTopY
TLorentzVector tlv_Wmin
MonitorElement * hTTbarPt
MonitorElement * book1dHisto(const std::string &name, const std::string &title, int n, double xmin, double xmax)
Definition: DQMHelper.cc:12
MonitorElement * hBottomMassDeltaY
MonitorElement * hBottomPt
MonitorElement * hTopPt
edm::EDGetTokenT< edm::HepMCProduct > hepmcCollectionToken_
TLorentzVector tlv_Top
MonitorElement * hBottomE
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * hWplusPz
edm::InputTag hepmcCollection_
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * hBottomEtaPz
TTbar_Kinematics(const edm::ParameterSet &)
Definition: Run.h:41
MonitorElement * hBottomY