Hi All,
I’m really new to Root and I have been stuck the last days on (I think) a very simple issue.
I have generated a root file with MadGraph, and in the picture in the link (http://img837.imageshack.us/img837/3301/5lf.png) you can see the structure of the file that is called tag_1_pythia_lhe_events.root.
My goal is to try to construct (and plot of course) my own variable, so I was trying to build the transvers momenta from Px and Py and to compared with the distribution PT.
Following a guide that I found online I have opened root and I have typed the following lines
TFile myFile(“tag_1_pythia_lhe_events.root”)
LHEF->MakeClass(“Analyze”)
And now I got a file Analyze.H and Analyze.C that I shoul edit
In the file Analyze.C (below the message) I have put at line 33 the following line
Double_t pt = TMath::Sqrt(Px*Px + Py*Py);
I have saved an inside root I have typed
.L Analyze.C
Analyze a
a.Loop
but I get
root [4] aaa.Loop()
Error: Symbol px is not defined in current scope Analyze.C:33:
Error: Symbol px is not defined in current scope Analyze.C:33:
Error: Symbol py is not defined in current scope Analyze.C:33:
Error: Symbol py is not defined in current scope Analyze.C:33:
*** Interpreter error recovered ***
So looks like I’m not taking correctly the variables Px and Px to construct my Pt.
I tryed to understand on my own, but I’m a bit stuck, does any body can help me?
Thanks in advance!
Analyze.c
#define Analyze_cxx
#include “Analyze.h”
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
void Analyze::Loop()
{
// In a ROOT session, you can do:
// Root > .L Analyze.C
// Root > Analyze t
// Root > t.GetEntry(12); // Fill t data members with entry number 12
// Root > t.Show(); // Show values of entry 12
// Root > t.Show(16); // Read and show values of entry 16
// Root > t.Loop(); // Loop on all entries
//
// This is the loop skeleton where:
// jentry is the global entry number in the chain
// ientry is the entry number in the current Tree
// Note that the argument to GetEntry must be:
// jentry for TChain::GetEntry
// ientry for TTree::GetEntry and TBranch::GetEntry
//
// To read only selected branches, Insert statements like:
// METHOD1:
// fChain->SetBranchStatus("*",0); // disable all branches
// fChain->SetBranchStatus(“branchname”,1); // activate branchname
// METHOD2: replace line
// fChain->GetEntry(jentry); //read all branches
//by b_branchname->GetEntry(ientry); //read only this branch
if (fChain == 0) return;
Long64_t nentries = fChain->GetEntriesFast();
Long64_t nbytes = 0, nb = 0;
for (Long64_t jentry=0; jentry<nentries;jentry++) {
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;
// if (Cut(ientry) < 0) continue;
}
}