6 #include "CLHEP/Units/defs.h"
7 #include "CLHEP/Units/PhysicalConstants.h"
15 hepmcCollection_(iPSet.getParameter<edm::
InputTag>(
"hepmcCollection")),
16 genparticleCollection_(iPSet.getParameter<edm::
InputTag>(
"genparticleCollection")),
17 genjetCollection_(iPSet.getParameter<edm::
InputTag>(
"genjetsCollection")),
18 matchPr_(iPSet.getParameter<double>(
"matchingPrecision")),
19 _lepStatus(iPSet.getParameter<double>(
"lepStatus")),
20 verbosity_(iPSet.getUntrackedParameter<unsigned int>(
"verbosity",0))
38 TH1::SetDefaultSumw2();
65 h_dr =
dbe->
book1D(
"h_dr",
"DeltaR between leptons and jets", 30, 0, 2);
139 mll=
dbe->
book1D(
"mll",
"ll mass (all combinations)", 50, 0, 200);
140 ptll=
dbe->
book1D(
"ptll",
"ll Transverse Momentum (all combinations)", 50, 0, 200);
142 ptlll=
dbe->
book1D(
"ptlll",
"lll Transverse Momentum ", 50, 0, 2000);
162 unsigned int initSize = 1000;
167 HepMC::GenEvent *myGenEvent =
new HepMC::GenEvent(*(evt->GetEvent()));
179 std::vector<const HepMC::GenParticle*> mothercoll;
180 std::vector<const HepMC::GenParticle*> GenLeptons;
181 std::vector<const HepMC::GenParticle*> GenNeutrinos;
182 mothercoll.reserve(initSize);
183 GenLeptons.reserve(initSize);
184 GenNeutrinos.reserve(initSize);
185 for (HepMC::GenEvent::particle_const_iterator iter = myGenEvent->particles_begin(); iter != myGenEvent->particles_end(); ++iter){
186 double id = (*iter)->pdg_id();
188 if((*iter)->status()==3&&(fabs(
id)==11 ||fabs(
id)==13) && (*iter)->momentum().perp()>20.&& fabs((*iter)->momentum().eta())<2.5){
191 if((*iter)->status()==1&&(fabs(
id)==16))taust3++;
192 if((*iter)->status()==3&&(
id==24))Wpst3++;
193 if((*iter)->status()==3&&(
id==-24))Wmst3++;
194 if((*iter)->status()==3&&(fabs(
id)==24 || fabs(
id)==23)){
195 mothercoll.push_back(*iter);
198 if((*iter)->status()==
_lepStatus && (*iter)->momentum().perp()>20.&& fabs((*iter)->momentum().eta())<2.5 ){
200 if (fabs(
id)==11 ||fabs(
id)==13){
201 GenLeptons.push_back(*iter);
203 if (fabs(
id)==12 ||fabs(
id)==14){
204 GenNeutrinos.push_back(*iter);
209 vector<TLorentzVector> wpluss;
210 vector<TLorentzVector> wmins;
211 vector<TLorentzVector>
z;
224 for(
unsigned int i = 0 ;
i< mothercoll.size();
i++){
225 double id = mothercoll[
i]->pdg_id();
233 for(
unsigned int k=0 ;
k< GenLeptons.size() ;
k++){
234 for(
unsigned int kl=0 ; kl< GenNeutrinos.size() ;kl++){
235 double lepton_px=GenLeptons[
k]->momentum().px();
236 double lepton_py=GenLeptons[
k]->momentum().py();
237 double lepton_pz=GenLeptons[
k]->momentum().pz();
238 double lepton_e=GenLeptons[
k]->momentum().e();
240 l.SetPxPyPzE(lepton_px,lepton_py,lepton_pz,lepton_e);
241 double nu_px=GenNeutrinos[kl]->momentum().px();
242 double nu_py=GenNeutrinos[kl]->momentum().py();
243 double nu_pz=GenNeutrinos[kl]->momentum().pz();
244 double nu_e=GenNeutrinos[kl]->momentum().e();
246 nu.SetPxPyPzE(nu_px,nu_py,nu_pz,nu_e);
247 double l_id= GenLeptons[
k]->pdg_id();
248 double nu_id= GenNeutrinos[kl]->pdg_id();
249 dr=
deltaR((l+nu).PseudoRapidity(),(l+nu).
Phi(),mothercoll[
i]->momentum().
eta(),mothercoll[
i]->momentum().
phi());
250 if((
id*l_id)<0 &&(l_id*nu_id)<0 &&( fabs(nu_id)== (fabs(l_id)+1) )&& dr<0.5){
251 if(dr<dr_min)dr_min=dr;
252 if(dr>dr_min)
continue;
256 for(
unsigned int k=0 ;
k< GenLeptons.size() ;
k++){
257 for(
unsigned int kl=0 ; kl< GenNeutrinos.size() ;kl++){
258 double lepton_px=GenLeptons[
k]->momentum().px();
259 double lepton_py=GenLeptons[
k]->momentum().py();
260 double lepton_pz=GenLeptons[
k]->momentum().pz();
261 double lepton_e=GenLeptons[
k]->momentum().e();
263 l.SetPxPyPzE(lepton_px,lepton_py,lepton_pz,lepton_e);
264 double nu_px=GenNeutrinos[kl]->momentum().px();
265 double nu_py=GenNeutrinos[kl]->momentum().py();
266 double nu_pz=GenNeutrinos[kl]->momentum().pz();
267 double nu_e=GenNeutrinos[kl]->momentum().e();
269 nu.SetPxPyPzE(nu_px,nu_py,nu_pz,nu_e);
270 double l_id= GenLeptons[
k]->pdg_id();
271 double nu_id= GenNeutrinos[kl]->pdg_id();
272 double der=
deltaR((l+nu).PseudoRapidity(),(l+nu).
Phi(),mothercoll[
i]->momentum().
eta(),mothercoll[
i]->momentum().
phi());
273 if((
id*l_id)<0 && (l_id*nu_id)<0 &&( fabs(nu_id)== (fabs(l_id)+1) )&& der==dr_min){
274 l_bcode[
i]=GenLeptons[
k]->barcode();
275 nu_bcode[
i]=GenNeutrinos[kl]->barcode();
276 if((
i==0)|| (
i==1 && (l_bcode[
i]!=l_bcode[
i-1]) && (nu_bcode[
i]!=nu_bcode[
i-1]) )||
277 (
i==2 && (l_bcode[
i]!=l_bcode[
i-1]) && (nu_bcode[
i]!=nu_bcode[
i-1]) && (l_bcode[
i]!=l_bcode[
i-2]) && (nu_bcode[
i]!=nu_bcode[
i-2]) )
281 wpluss.push_back((l+nu));
289 wmins.push_back((l+nu));
307 for(
unsigned int k=0 ;
k< GenLeptons.size() ;
k++){
308 for(
unsigned int kl=
k ; kl< GenLeptons.size() ;kl++){
310 double lepton_px=GenLeptons[
k]->momentum().px();
311 double lepton_py=GenLeptons[
k]->momentum().py();
312 double lepton_pz=GenLeptons[
k]->momentum().pz();
313 double lepton_e=GenLeptons[
k]->momentum().e();
315 l.SetPxPyPzE(lepton_px,lepton_py,lepton_pz,lepton_e);
316 double nu_px=GenLeptons[kl]->momentum().px();
317 double nu_py=GenLeptons[kl]->momentum().py();
318 double nu_pz=GenLeptons[kl]->momentum().pz();
319 double nu_e=GenLeptons[kl]->momentum().e();
321 nu.SetPxPyPzE(nu_px,nu_py,nu_pz,nu_e);
322 double l_id= GenLeptons[
k]->pdg_id();
323 double nu_id= GenLeptons[kl]->pdg_id();
324 dr=
deltaR((l+nu).PseudoRapidity(),(l+nu).
Phi(),mothercoll[
i]->momentum().
eta(),mothercoll[
i]->momentum().
phi());
325 if((l_id*nu_id)<0 &&( fabs(nu_id)== (fabs(l_id)) && dr<0.5)){
326 if(dr<dr_min)dr_min=dr;
327 if(dr>dr_min)
continue;
331 for(
unsigned int k=0 ;
k< GenLeptons.size() ;
k++){
332 for(
unsigned int kl=
k ; kl< GenLeptons.size() ;kl++){
334 double lepton_px=GenLeptons[
k]->momentum().px();
335 double lepton_py=GenLeptons[
k]->momentum().py();
336 double lepton_pz=GenLeptons[
k]->momentum().pz();
337 double lepton_e=GenLeptons[
k]->momentum().e();
339 l.SetPxPyPzE(lepton_px,lepton_py,lepton_pz,lepton_e);
340 double nu_px=GenLeptons[kl]->momentum().px();
341 double nu_py=GenLeptons[kl]->momentum().py();
342 double nu_pz=GenLeptons[kl]->momentum().pz();
343 double nu_e=GenLeptons[kl]->momentum().e();
345 nu.SetPxPyPzE(nu_px,nu_py,nu_pz,nu_e);
346 double l_id= GenLeptons[
k]->pdg_id();
347 double nu_id= GenLeptons[kl]->pdg_id();
348 double der=
deltaR((l+nu).PseudoRapidity(),(l+nu).
Phi(),mothercoll[
i]->momentum().
eta(),mothercoll[
i]->momentum().
phi());
349 if((l_id*nu_id)<0 &&( fabs(nu_id)== (fabs(l_id)) )&& der==dr_min ){
350 l_bcode[
i]=GenLeptons[
k]->barcode();
351 nu_bcode[
i]=GenLeptons[kl]->barcode();
352 if((
i==0)|| (
i==1 && (l_bcode[
i]!=l_bcode[
i-1]) && (nu_bcode[
i]!=nu_bcode[
i-1]) )||
353 (
i==2 && (l_bcode[
i]!=l_bcode[
i-1]) && (nu_bcode[
i]!=nu_bcode[
i-1]) && (l_bcode[
i]!=l_bcode[
i-2]) && (nu_bcode[
i]!=nu_bcode[
i-2]) )
360 h_yZ->
Fill((l+nu).Rapidity(),weight);
369 if((Wmin+Wpl)>3)
cout<<
"3ten fazla W adayı?!?"<<endl;
371 if( ((Wmin+Wpl)==3) || ((Wmin+Wpl)==2 && Z==1) || (( Wmin+Wpl )==1 && Z==2) || (Z==3) ){
374 for(
unsigned int i=0;
i<wmins.size();
i++){
380 for(
unsigned int i=0;
i<wpluss.size();
i++){
386 for(
unsigned int i=0;
i<z.size();
i++){
397 if(Wmin==2 && Wpl==1){
402 if(Wmin==1 && Wpl==2){
407 if(W1.M()<10. ||W2.M()<10.||W3.M()<10.)
cout<<taust3<<endl;
431 if((Wmin+Wpl)==2 && Z==1){
436 if(Wmin==1 &&Wpl==1){
440 if(Wmin==2 &&Wpl==0){
444 if(Wmin==0 &&Wpl==2){
474 if((Wmin+Wpl)==1 && Z==2){
520 if(Z1.M()<10. ||Z2.M()<10.||Z3.M()<10.)
cout<<taust3<<endl;
550 std::vector<const reco::GenJet*> selected_jets;
551 selected_jets.reserve(initSize);
558 int nJetsCentral = 0;
561 std::vector<double>
jetEta;
562 jetEta.reserve(initSize);
563 for (reco::GenJetCollection::const_iterator iter=genJets->begin();iter!=genJets->end();++iter){
565 bool matched_lepton=
false;
566 for(
unsigned int i=0 ;
i< GenLeptons.size() ;
i++){
567 dr=
deltaR(GenLeptons[
i]->momentum().
eta(),GenLeptons[
i]->momentum().
phi(),(*iter).eta(),(*iter).phi());
569 if(dr<0.5)matched_lepton=
true;
571 if(matched_lepton)
continue;
572 selected_jets.push_back(&*iter);
574 double pt = (*iter).pt();
576 if (pt > 1.) nJetso1++;
577 double eta = (*iter).eta();
578 if (std::fabs(eta) < 5.&&pt > 30.) nJetso30++;
579 if (std::fabs(eta) < 5.&&pt > 50.) nJetso50++;
580 if (std::fabs(eta) < 5.&&pt > 100.) nJetso100++;
581 if ( std::fabs(eta) < 2.5 ) nJetsCentral++;
582 jetEta.push_back(eta);
593 j1.SetPtEtaPhiE(selected_jets[0]->pt(),selected_jets[0]->
eta(),selected_jets[0]->
phi(),selected_jets[0]->
energy());
594 j2.SetPtEtaPhiE(selected_jets[1]->pt(),selected_jets[1]->
eta(),selected_jets[1]->
phi(),selected_jets[1]->
energy());
614 if ( jetEta.size() > 1 ) {
615 for (
unsigned int i = 0;
i < jetEta.size();
i++){
616 for (
unsigned int j =
i+1;
j < jetEta.size();
j++){
617 deltaEta =
std::min(deltaEta,std::fabs(jetEta[
i]-jetEta[
j]));
625 if(GenLeptons.size()>0 && GenNeutrinos.size()>0 ){
635 if(GenLeptons.size()>1 ){
636 for(
unsigned int i = 0;
i<GenLeptons.size();
i++){
637 for(
unsigned int j =
i;
j<GenLeptons.size();
j++){
639 TLorentzVector lep1(GenLeptons[
i]->momentum().
x(), GenLeptons[
i]->momentum().
y(), GenLeptons[
i]->momentum().
z(), GenLeptons[
i]->momentum().
t());
640 TLorentzVector lep2(GenLeptons[
j]->momentum().
x(), GenLeptons[
j]->momentum().
y(), GenLeptons[
j]->momentum().
z(), GenLeptons[
j]->momentum().
t());
641 mll->
Fill((lep1+lep2).M(),weight);
646 if(GenLeptons.size()>2 && GenNeutrinos.size()>2 ){
647 TLorentzVector lep1(GenLeptons[0]->momentum().
x(), GenLeptons[0]->momentum().
y(), GenLeptons[0]->momentum().
z(), GenLeptons[0]->momentum().
t());
648 TLorentzVector lep2(GenLeptons[1]->momentum().
x(), GenLeptons[1]->momentum().
y(), GenLeptons[1]->momentum().
z(), GenLeptons[1]->momentum().
t());
649 TLorentzVector lep3(GenLeptons[2]->momentum().
x(), GenLeptons[2]->momentum().
y(), GenLeptons[2]->momentum().
z(), GenLeptons[2]->momentum().
t());
650 TLorentzVector nu1(GenNeutrinos[0]->momentum().
x(), GenNeutrinos[0]->momentum().
y(), GenNeutrinos[0]->momentum().
z(), GenNeutrinos[0]->momentum().
t());
651 TLorentzVector nu2(GenNeutrinos[1]->momentum().
x(), GenNeutrinos[1]->momentum().
y(), GenNeutrinos[1]->momentum().
z(), GenNeutrinos[1]->momentum().
t());
652 TLorentzVector nu3(GenNeutrinos[2]->momentum().
x(), GenNeutrinos[2]->momentum().
y(), GenNeutrinos[2]->momentum().
z(), GenNeutrinos[2]->momentum().
t());
653 mlll->
Fill((lep1+lep2+lep3).M(),weight);
666 if ( (it)->production_vertex() && (it)->
status()==3) {
667 for ( HepMC::GenVertex::particle_iterator mother
668 = (it)->production_vertex()->particles_begin(
HepMC::parents);mother != (it)->production_vertex()->particles_end(
HepMC::parents); ++mother ) {
670 if((fabs((*mother)->pdg_id())==24))
id = (*mother)->barcode();
const double Z[kNumberCalorimeter]
MonitorElement * h_phiWminus
MonitorElement * genJetPt
MonitorElement * genJetEta
MonitorElement * h_yWminus_3b
int getParentBarcode(HepMC::GenParticle *it)
MonitorElement * h_phiWplus_3b
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
MonitorElement * genJetTotPt
MonitorElement * WW_TwoJEt_JetsM
#define DEFINE_FWK_MODULE(type)
edm::ESHandle< HepPDT::ParticleDataTable > fPDGTable
PDT table.
MonitorElement * h_sl_jet_pt
bool sortByPt(const HepMC::GenParticle *a, const HepMC::GenParticle *b)
MonitorElement * mtlllnununu
MonitorElement * genJetPhi
MonitorElement * ptlllnununu
MonitorElement * leading_l_pt
MonitorElement * genJetDeltaEtaMin
void getData(T &iHolder) const
MonitorElement * subleading_l_pt
MonitorElement * h_yWplus
MonitorElement * h_phiZZZ
MonitorElement * h_yWminus
MonitorElement * h_mWminus
MonitorElement * subleading_l_eta
MonitorElement * h_mWplus_3b
MonitorElement * h_ptWplus_3b
MonitorElement * mlllnununu
MonitorElement * genJetPto100
MonitorElement * h_mWplus
MonitorElement * h_l_jet_pt
MonitorElement * h_ptWminus_3b
MonitorElement * genJetPto1
MonitorElement * h_phiWZZ
MonitorElement * leading_l_eta
MonitorElement * genJetPto30
MonitorElement * h_phiWplus
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * h_ptZ_3b
MonitorElement * h_phiWminus_3b
double deltaR(double eta1, double eta2, double phi1, double phi2)
MonitorElement * h_sl_jet_eta
MonitorElement * h_yWplus_3b
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * h_ssl_jet_eta
edm::InputTag hepmcCollection_
MonitorElement * genJetCentral
MonitorElement * h_mWminus_3b
MonitorElement * h_ssl_jet_pt
MonitorElement * h_phiZ_3b
DQMStore * dbe
ME's "container".
MonitorElement * h_l_jet_eta
MonitorElement * genJetMult
MonitorElement * subsubleading_l_eta
edm::InputTag genjetCollection_
virtual void endRun(const edm::Run &, const edm::EventSetup &)
double weight(const edm::Event &)
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * h_phiWWW
MonitorElement * h_phiWWZ
MonitorElement * subsubleading_l_pt
void setCurrentFolder(const std::string &fullpath)
MonitorElement * h_ptWplus
MonitorElement * h_ptWminus
MonitorElement * genJetPto50
VVVValidation(const edm::ParameterSet &)
MonitorElement * genJetEnergy