Re: [ROOT] Question about modular ntuples.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Oct 26 2000 - 08:20:58 MEST


Hi Susana,

I do not know what are these functions creating your ntuple!
Do you use an interface on top on Root ?
Now, concerning your function MetAnal, I do not have enough information
to tell you what is wrong?
Could you send me :
 - MyAna.h
 - MyAna.C
 - your function MetAna
 - the few statements invoking MetAna , the initialisation of MyAna?

Rene Brun

Susana Cabrera wrote:
> 
>         Hello,
>         I am trying to write a CINT program to read some
>         blocks of my ntuple, here I send to you an example of the booking
>         of two blocks of this ntuple.
> 
>   if(_L2_process.value()==true) {
> 
>     _ntuple=&_manager->ntuple("MyNtuple",1);
>     _ntuple->setColumnWise();
>     _ntuple->setDiskResident();
> 
>     _ntuple->columnAt("L2CalJet::NclusT",&_nclusL2Jet,(Int4)1);
>     _ntuple->span("L2CalJet::NclusT",0,_n2clst);
>     _ntuple->columnAt("L2CalJet::sumEtT",&_sumEtL1,(Float4)0.);
> 
>   }
> 
>   if(_Met_process.value()==true) {
>     _ntuple->columnAt("MET::met",&_uncorrMet,(Float4)0.);
>     _ntuple->columnAt("MET::xsum",&_xSum,(Float4)0.);
>     _ntuple->columnAt("MET::ysum",&_ySum,(Float4)0.);
>     _ntuple->columnAt("MET::sumet",&_sumEt,(Float4)0.);
>   }
> 
>         I can have a look to the leaves. I start clicking on different
> buttons. Finally the canvas appear in the screen without problems.
>         TFile f("stnmaker.root")
>         TBrowser b
> 
>         However, when I try to use the autogenerated code (equivalent of
> PAW's UWFUNC) in my CINT program:
> 
> TFile *file = new TFile("ntuple.root","READ","RUN-II")
> TTree *t;
> file->cd("MyDirectory");
> t = (TTree*)gDirectory->Get("Myntuple");
> t->MakeClass("MyAna")
> 
> I introduce the next declarations following a similar syntax
> than in MyAna:
> 
> //Declaration of leaves types
>    Int_t           L2CalJet_NclusT;
>    Float_t         L2CalJet_sumEtT;
>    Float_t         MET_met;
>    Float_t         MET_sumet;
>    Float_t         MET_xsum;
>    Float_t         MET_ysum;
> 
> // List of branches
>    TBranch        *b_L2CalJet;
>    TBranch        *b_MET;
> // Set branch addresses
>    t->SetBranchAddress("L2CalJet",&L2CalJet_NclusT);
>    t->SetBranchAddress("MET",&MET_met);
> 
> When I try to access to the information in the branches
> with my loop I can not get the information of the leaves,
> for example, the variable MET_met is always zero.
> 
> void MetAnal() {
>    Int_t nbytes = 0;
>    Int_t i;
> 
> // ...........loop over entries..................
> 
>    Int_t nentries = chain->GetEntries();
>    printf("Total number of entries in chain = %d\n",nentries);
>    for (i=0; i<nentries;i++) {
>      if(i % 1000 ==0) printf("analysed:%d\n",i);
>      nbytes += chain.GetEvent(i);
>      cout << MET_met <<endl;
>    }
> }
> 
>                 Thanks for your help,
>                         Susana Cabrera.
> 
> **************************************************************
> *    Susana Cabrera Urban          cabrera@cdfsga.fnal.gov   *
> *                                                            *
> *    Fermilab                      Tf:  (630)840-5003        *
> *    P.O. Box 500, MS 318          Fax: (630)840-2968        *
> *    Batavia, IL 60510                                       *
> *    U.S.A.                                                  *
> **************************************************************



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET