Hi,
I am trying to read a root tree that I made using a struct like class (for ease of setting the branch address). And somehow it is not reading things correctly. If I ACLiC, it fails and if I don’t ACLiC, it works fine. But I don’t want to risk not compiling the macro. So can someone please tell me what it is that I am doing wrong?
The macro itself is as follows -
#include
#include
#include
#include
#include
#include
#include <stdlib.h>
#include “TGraph.h”
#include “TCanvas.h”
#include “TStyle.h”
#include “TPaveText.h”
#include “TLegend.h”
#include “TH2.h”
#include “TH2F.h”
#include “TH1F.h”
#include “TH1.h”
#include “TH3.h”
#include “TMath.h”
#include “TPostScript.h”
#include <TTree.h>
#include “TAxis.h”
#include “TFile.h”
#include “TChain.h”
#include “TROOT.h”
#include “TEllipse.h”
#include “TLine.h”
#include “TChain.h”
#include “TTree.h”
#include “/home/picasso/sujeewa/IWorkHere/VarProb.C”
using namespace std;
void LocalisationVisualisationAmateur();
void LocalisationVisualisationAmateur()
{
//run in root as root [0] .L macros/VarProb.C+
// root [2] .x macros/LocalisationVisualisationAmateur.C++()
//Montreal Chain
TChain *chain = new TChain(“StreeVar”);
chain->AddFile(“Montreal11000.root”);
chain->AddFile(“Montreal11050.root”);
//PhysVariables *skvarmc = new PhysVariables();
MontrealLoc *skvarmc = new MontrealLoc();
chain->SetBranchAddress(“PhysVariables”,&skvarmc);
Int_t nentmc=chain->GetEntries();
TH2F *xycom = new TH2F(“xycom”,“X vs Y”,80,-20.,20.,80,-20.,20.);
for (Int_t iUL=0; iUL<nentmc; iUL++)
{
Int_t nbytes = chain->GetEntry(iUL);
xycom->Fill(skvarmc->udemposition[0],skvarmc->udemposition[1]);
}
TCanvas *cc = new TCanvas(“cc”,“cc”,100,100,400,400);
cc->cd();
xycom->Draw(“lego2z”);
}
============== And the struct like class, which I load at the beginning, VarProb.C is as follows===================
#include “TObject.h”
class MontrealLoc : public TObject
{
public:
//Physics Variables; these will be our leaves
Int_t runindex;
Int_t evindex;
Int_t totevents;
Double_t udemposition[3];
Double_t udemsigmaplus[3];
Double_t udemsigmaminus[3];
Double_t udemtzero[9];
Double_t udemsigmatzero[9];
Double_t velocity;
Double_t sigmavelocity;
Double_t chisquared;
Double_t nuctime;
Int_t numpzos;
Int_t goodpzos[9];
char* detname;
Int_t prodnum;
Char_t* runtype;
ClassDef (MontrealLoc,2);
};
#if !defined(CINT)
ClassImp(MontrealLoc);
#endif
=============Is it something wrong that I do when I make my root files in the first place? If I try to load one of these root files with a root MontrealLoc11000.root it complains that it can’t find the class that was used to make the tree? I remember seeing this in the past for other root files other people have made and given me. But we used to ignore them back then. Is this a normal warning message? I can actually browse and run uncompiled macros even though I get this warning… The warning message looks like the following-
root [0]
Attaching file Montreal11000.root as _file0…
Warning in TClass::TClass: no dictionary for class MontrealLoc is available ===================