GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Bugs, Fixes, Releases » Strange behaviour of CINT
Strange behaviour of CINT [message #11881] Wed, 25 May 2011 15:23 Go to next message
Simone Bianco is currently offline  Simone Bianco
Messages: 29
Registered: January 2009
continuous participant
From: *to.infn.it
Dear all,

if I write a macro like the following:

test.C
void test(Int_t nEv)
{

  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
  
  for (Int_t j = 0 ; j < nEv ; j++)
    {
      cout << "j: " << j << " - nEv: " << nEv << endl;
    }

}


and I run it with a

root -l 'test.C(10)'


I correctly get:

j: 0 - nEv: 10
j: 1 - nEv: 10
j: 2 - nEv: 10
j: 3 - nEv: 10
j: 4 - nEv: 10
j: 5 - nEv: 10
j: 6 - nEv: 10
j: 7 - nEv: 10
j: 8 - nEv: 10
j: 9 - nEv: 10


But If I do:

root [0] .L test.C
root [1] test(10)


I only get the first cycle run:

j: 0 - nEv: 10


The problem disappears if I comment out the rootlogon call.

Any idea about why this is happening?

Cheers,

Simone
Re: Strange behaviour of CINT [message #11882 is a reply to message #11881] Wed, 25 May 2011 15:57 Go to previous messageGo to next message
Garzia Isabella is currently offline  Garzia Isabella
Messages: 11
Registered: January 2009
occasional visitor
From: *fe.infn.it
Hi Simone,

if you compile with

.L test.C+

you will be able to see possible errors in your code.
To solve your problem you need to include the following libraries:

#include "TROOT.h"
#include <iostream>

void testtest(Int_t nEv){

gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");

for (Int_t j = 0 ; j < nEv ; j++)
{
cout << "j: " << j << " - nEv: " << nEv << endl;
}

}

I hope this help you,

Isabella.
Re: Strange behaviour of CINT [message #11883 is a reply to message #11882] Wed, 25 May 2011 16:10 Go to previous messageGo to next message
Simone Bianco is currently offline  Simone Bianco
Messages: 29
Registered: January 2009
continuous participant
From: *to.infn.it
Sure, but still this shouldn't be a problem in such a simple macro, expecially since I am trying to interpret it. Am I wrong?
Re: Strange behaviour of CINT [message #11885 is a reply to message #11883] Wed, 25 May 2011 16:48 Go to previous message
Garzia Isabella is currently offline  Garzia Isabella
Messages: 11
Registered: January 2009
occasional visitor
From: *fe.infn.it
no, it shouldn't be a problem, but you need to iclude
#include "TROOT.h" if you use the gRoot global object

In this link you can found some explanation:
http://root.cern.ch/drupal/content/mixing-interpreted-and-compiled-code

isa.
Previous Topic: TPC geometry fixed
Next Topic: Vertex smearing in FairPrimaryGenerator
Goto Forum:
  


Current Time: Tue Nov 19 11:30:23 CET 2024

Total time taken to generate the page: 0.00916 seconds