Variables are not found in Delphes

So I used MakeClass to create some histogram, using a root file generated from Delphes, but it keeps telling me that the variables doesn’t exist. (attached picture 1) I tried using another root file using the exact same code in a tutorial and it works perfectly fine. (attached picture 2)

Here is the code: for the delphes variable:

[code]#define Ana_cxx
#include “Ana.h”
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>

void Ana::Loop()
{
// In a ROOT session, you can do:
// Root > .L Ana.C
// Root > Ana 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;
//Set up code goes here
TH1* Hist = new TH1D("MUON","Histogram of muon-4vector",100,0,20);

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;
    //The loop code
    Hist->Fill(Photon_Size);

}
//the Wrap-up code
        Hist->Draw();

}[/code]

and here is the code for the tutorial:

[code]#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;
TH1
chi2Hist = new TH1D(“chi2”,“Histogram of Chi2”,100,0,20);
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;
chi2Hist->Fill(chi2);
}
chi2Hist->Draw();
}
[/code]

The error message:
root [0] .L Ana.C
root [1] Ana a
Warning in TClass::TClass: no dictionary for class LHEFEvent is available
Warning in TClass::TClass: no dictionary for class Event is available
Warning in TClass::TClass: no dictionary for class GenParticle is available
Warning in TClass::TClass: no dictionary for class SortableObject is available
Warning in TClass::TClass: no dictionary for class Track is available
Warning in TClass::TClass: no dictionary for class Tower is available
Warning in TClass::TClass: no dictionary for class Jet is available
Warning in TClass::TClass: no dictionary for class Electron is available
Warning in TClass::TClass: no dictionary for class Photon is available
Warning in TClass::TClass: no dictionary for class Muon is available
Warning in TClass::TClass: no dictionary for class MissingET is available
Warning in TClass::TClass: no dictionary for class ScalarHT is available
root [2] a.Loop()
Error: Symbol Photon_Size is not defined in current scope Ana.C:45:
*** Interpreter error recovered ***

The only thing that I know that is different is that some dictionaries seems to be missing with the delphes file.:

root [0] .L Ana.C
root [1] Ana a
Warning in TClass::TClass: no dictionary for class LHEFEvent is available
Warning in TClass::TClass: no dictionary for class Event is available
Warning in TClass::TClass: no dictionary for class GenParticle is available
Warning in TClass::TClass: no dictionary for class SortableObject is available
Warning in TClass::TClass: no dictionary for class Track is available
Warning in TClass::TClass: no dictionary for class Tower is available
Warning in TClass::TClass: no dictionary for class Jet is available
Warning in TClass::TClass: no dictionary for class Electron is available
Warning in TClass::TClass: no dictionary for class Photon is available
Warning in TClass::TClass: no dictionary for class Muon is available
Warning in TClass::TClass: no dictionary for class MissingET is available
Warning in TClass::TClass: no dictionary for class ScalarHT is available
root [2] a.Loop()
Error: Symbol Photon_Size is not defined in current scope Ana.C:45:
*** Interpreter error recovered ***

I wonder if anyone has experienced this before or know what is wrong?
Thanks in advance.



Hi,

Delphes variables are defined in Delphes, so you need to install Delphes and load the Delphes library to be able to use them. In Root 5, just do a gSystem->Load(“path_to_your_Delphes.so”) before loading your macro.

Note that this might not be sufficient to make it work in your case, depending on how this Ana class is implemented… Can you post Ana.h?

Cheers,
Sébastien

Hi here it is. Thanks for your help!
Ana.h (43.3 KB)

I can’t quite understand why this error happened after loading the library…(See Picture)
line 19 of the Ana1.C file:
#include “./classes/DelphesClasses.h”
I tried opening the file: DelphesClasses.h It works just fine.

Any help or suggestion is appreciated.
Thanks