Hi
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();
t1->GetEntry(i);
double Met_Pt= met_pt[0];
double Met_Phi= met_phi[0];
met.SetPtEtaPhiM(Met_Pt,0,Met_Phi,0.);
double metpt = met.Pt();
met_Pt->Fill(metpt);
cout<<"Met_Pt : "<< Met_Pt<<endl;
//if(isWmuon)
{
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 )));
W_Tran_mass->Fill(mt_mu);
cout<<"mt_mu : "<< mt_mu<<endl;
}
}
TCanvas *c1 = new TCanvas("c1","WBOSON",800,600);
c1->Divide(2,1);
c1->cd(1);
W_Tran_mass->Draw();
c1->cd(2);
met_Pt->Draw();
}