Transverse mass of W boson

Hello:
I m not getting how to draw the transverse mass of W boson. here i m uploading my code file. Please guide me to to do this.
Regards

Trans_mass.cc (1.2 KB)

Your code does not run. This line is incorrect:

      met_pt = met_pt[0];

met_pt is not an array. It is a Float.

See how it is declared in your code:


void Trans_mass()
{
   TCanvas *c1 = new TCanvas("c1","transverse mass",800,600);
   c1->Divide(1,1);
   TFile *F = new TFile("May26_2.root");
   TTree *AnaTree1 = (TTree*)F->Get("demo/AnaTree");
   TH1F *h1 = new TH1F("h1","transverse mass",500,0,1000);
   Float_t mt, met_pt, met_phi;
   TLorentzVector met(0,0,0,0), mu_neutrino(0,0,0,0);
   TLorentzVector mu_neutrinoPz;

   AnaTree1->SetBranchAddress("mt",&mt);
   AnaTree1->SetBranchAddress("met_phi",&met_phi);
   AnaTree1->SetBranchAddress("met_pt",&met_pt);
   Long64_t nentries = AnaTree1->GetEntries();
   for (int i=0;i<233428;i++)  {
      AnaTree1->GetEntry(i);
      met.SetPtEtaPhiM(met_pt,0,met_phi,0);
      met.SetPz(0);
      met.SetE(met.Pt());
      met_pt = met_pt[0];
      float mu_nupz; //=mu_neutrinoPz.Calculate();
      float mu_nuE = sqrt( met.Px()*met.Px() + met.Py()*met.Py() + mu_nupz*mu_nupz);
      mu_neutrino =  TLorentzVector(met.Px(), met.Py(), mu_nupz, mu_nuE );

      double transverse = (mu_neutrino+met).Mt();
      h1->Fill(transverse);
   }
   h1->Draw();
}

I get:

Processing Trans_mass.cc...
In file included from input_line_10:1:
/Users/couet/Downloads/Trans_mass.cc:23:16: error: subscripted value is not an array, pointer, or vector
met_pt = met_pt[0];
         ~~~~~~^~

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