W-mass reconstruction by using TLorentzVector

i m finding w-boson mass ,i write a script for it , i divide the canvas in two , while i get a hist name met_pt
but the other hist name W_Tran_mass is not getting , kindly check the script

 #include <TFile.h>
#include <TTree.h>
#include <TROOT.h>
#include <TH1.h>
#include <TH2.h>
#include <TSystem.h>
#include <vector>
#include <TLorentzVector.h>
#include <math.h>
#include "TMath.h"
#include <iostream>
#include <fstream>
#include <algorithm>
#include <map>
#include <TFileMerger.h>

 void W_BOSON () {

  TFile *f = new TFile("dMergedMiniEvents_36.root");
  TFile *f1 = new TFile("MergedMiniEvents_6.root");

  TTree *t = (TTree*)f->Get("AnaTree");
  TTree *t1 = (TTree*)f1->Get("analysis/data");

  TH1F *W_Tran_mass = new TH1F("W_Tran_mass","W_Tran_mass",100,0,300);
  TH1F * met_Pt= new TH1F("met_Pt","met_Pt",100,0,300);
  using namespace std;
  Float_t VetoMu_px[50], VetoMu_py[50], VetoMu_pz[50], VetoMu_en[50], met_pt[50], met_phi[50];
 Int_t  nMu;

int m_i=999, m_ii=999;

  t->SetBranchAddress("VetoMu_px", &VetoMu_px);
  t->SetBranchAddress("VetoMu_py", &VetoMu_py);
  t->SetBranchAddress("VetoMu_pz", &VetoMu_pz);
  t->SetBranchAddress("VetoMu_en", &VetoMu_en);
  t->SetBranchAddress("nMu", &nMu);
  t1->SetBranchAddress("met_pt", &met_pt);
  t1->SetBranchAddress("met_phi", &met_phi);
 TLorentzVector met(0,0,0,0),p4_W(0,0,0,0);

   Long64_t nentries = t->GetEntries();
   for (Int_t i = 0; i < nentries; i++) {

 TLorentzVector p4_W, met;

     bool isWmuon =false;
     double p4_W_phi = 0., mt_mu = 0., dphi_mumet = 0.;

     for (int mu=0; mu<nMu; mu++){
     if ( mu==m_i || mu==m_ii ) continue;
     p4_W.SetPxPyPzE(VetoMu_px[mu], VetoMu_py[mu], VetoMu_pz[mu], VetoMu_en[mu]);
         p4_W_phi = p4_W.Phi();
 double Met_Pt= met_pt[0];
 double Met_Phi= met_phi[0];

 double metpt = met.Pt();
cout<<"Met_Pt : "<< Met_Pt<<endl;
cout<<"isWmuon : "<< isWmuon<<endl;

dphi_mumet = p4_W_phi - Met_Phi;
      if( fabs(dphi_mumet)< 0.5) continue;

     mt_mu = TMath::Sqrt(2* p4_W.Pt()*Met_Pt*(1-TMath::Cos( dphi_mumet )));

cout<<"mt_mu : "<< mt_mu<<endl;

TCanvas *c1 = new TCanvas("c1","WBOSON",800,600);


See what you get when you try (e.g. inspect “Entries=” and “fSumw[…]=”):


kindly you plz explain what is the use of this command, I do it and get
some results on terminal i send u screen shots plz u explain it.


It just prints all the information contained in the histogramm. For example you can see in the 3. line, the name of your histogramm, the number of entries and the total sum of all entries. Then it prints all the bins of your histogram (x=…) and the number of entries per bin. (fSumw[…]=number of entries in each bin)
Now if you look at the bin at x=1.5 all the entries are there, that is not good since it means that your histogram has only entries in this only bin.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.