Nick West | 1 May 2007 06:57
Picon
Picon
Favicon

RE: [ROOT] rootcint segmentation fault with SL3/gcc 3.2.3

Hi Philippe and Paul,

>Thanks for reporting this problem (due in part to a bug in gcc 3.2.3).
>This is now corrected in the head of the CVS repository and in 
>the v5.14/00 patch branch.

Yes, it's fine now.  Thanks.

Nick.

Stephen Liu | 1 May 2007 07:04
Picon

[ROOT] A problem with TTree::Fill()

Hi, all

I have came up with a strange problem with TTree::Fill(). I have a tree with some data and now I want to pick out some of them to form a new tree. Here is my code:

void split()
{
    TFile *input = new TFile(" input.root", "READ");
    TTree *original = (TTree *)input->Get("Train");

    Double_t data1;
    Double_t data2;
    Double_t data3;
    Int_t data4;

    original->SetBranchAddress(

"data1", &data1);
    original->SetBranchAddress("data2", &data2);
    original->SetBranchAddress("data3", &data3);
    original->SetBranchAddress("data4", &data4);

    TTree *newtree = new TTree("Train", "My New Tree");
    newtree->Branch("data1", &data1, "data1/D");
    newtree->Branch("data2", &data2, "data2/D");
    newtree->Branch("data3", &data3, "data3/D");
    newtree->Branch("data4", &data4, "data4/I");

    for(Int_t i = 0; i < original->GetEntries(); i++)
      {
          original->GetEntry(i);

          if(data1 > 0.5)  newtree->Fill();

      }

}

When I run this macro in ROOT v5.14, ROOT gives out following error messages while i equals certain values:

Error in <TTree::Fill>: Failed filling branch: Train.data1, nbytes=-1
 This error is symptomatic of a Tree created as a memory-resident Tree
 Instead of doing:
    TTree *T = new TTree(...)
    TFile *f = new TFile(...)
 you should do:
    TFile *f = new TFile(...)
    TTree *T = new TTree(...)
Error in <TTree::Fill>: Failed filling branch:Train.data2, nbytes=-1
 This error is symptomatic of a Tree created as a memory-resident Tree
 Instead of doing:
    TTree *T = new TTree(...)
    TFile *f = new TFile(...)
 you should do:
    TFile *f = new TFile(...)
    TTree *T = new TTree(...)
Error in <TTree::Fill>: Failed filling branch:Train.data3, nbytes=-1
 This error is symptomatic of a Tree created as a memory-resident Tree
 Instead of doing:
    TTree *T = new TTree(...)
    TFile *f = new TFile(...)
 you should do:
    TFile *f = new TFile(...)
    TTree *T = new TTree(...)
Error in <TTree::Fill>: Failed filling branch:Train.data4, nbytes=-1
 This error is symptomatic of a Tree created as a memory-resident Tree
 Instead of doing:
    TTree *T = new TTree(...)
    TFile *f = new TFile(...)
 you should do:
    TFile *f = new TFile(...)
    TTree *T = new TTree(...)


I checked the value of the branches of the entries which induce the error, however they appears quite normal.
Thanks in advance for any help!

liuk
2007.4.30
augalves | 1 May 2007 17:17
Picon

[ROOT] Is possible to define and to use arrays of data structures in ROOT?

Hi all,

I didint have any success in define and use array of data structures, like as in
the code showed below in ROOT:

struct parameter{
             Char_t a[];
             Char_t b[];
             };
parameter array[5];
array[1].a[]="example";
...
...

Does someone knows whats is happening?

Thank you very much!
Augusto

------------------------------------------
CBPF WebMail -  http://www.cbpf.br 

Mark Messier | 1 May 2007 19:01
Picon
Favicon

[ROOT] Arithmetic using constants in GDML

Hi,

I'm working with defining a geometry using GDML and ROOT. The  
attached gdml file produced this error:

Error in <TFormula::Compile>:  Bad numerical expression : "sz"

when loaded. The problem comes from when I try to use a defined  
constant in an arithmetic expression:

<define>
   ...
   <constant name="sz" value="100"/>
</define>

<solids>
   ...
   <box aunit="radian" lunit="mm" name="det" x="sz" y="sz" z="2*sz"/>
</solids>

The z="2*sz" causes the error. If I replace this with "2*100", for  
example, the error goes away.

Is this feature of GDML implemented? Is it implemented within ROOT?

I've attached a gdml file that shows the problem, along with a macro  
I've been using for testing.
Attachment (geo.C): application/octet-stream, 144 bytes
Attachment (test.gdml): application/octet-stream, 1367 bytes

Thank you,
Mark
========================================================================
Mark Messier                                         messier <at> indiana.edu
Department of Physics            http://www.physics.indiana.edu/~messier
Indiana University                                 Phone: (812) 855-0236
Bloomington, IN 47405                                Fax: (812) 855-0440

suneel | 2 May 2007 03:38
Picon

[ROOT] smart code-help needed

Dear rooters,
    I want to be a smart coder but now have a very limited knowledge of
c++ and coding techniques that is why running for help.
I an interested in plotting few similar two dimensional histograms for a
very large number of variables .All the histograms are going to have  same
thing along one of the axis(let us take x-axis(pt))Idea is to  define the
other axis as a variable(y) as then I can make a common fill loop.(like
Fill(pt,y).Then  I am left with only specifying value for y and get all
the histograms.This thing will also need to define one other variable
which could represent the histograms for different y-variables.
To provide more clarity of what I am doing I am enclosing following three
steps.
1.Defining histograms
2.define the loop which tells for a particular value of y fill which set
of histograms.
   3.Common fill.
I am finding myself clueless in answering "how to code it".
If some-one could provide me some help or hints regarding this then it
could be a great help.
Thanks a lot in advance
chris

Rene Brun | 2 May 2007 09:08
Picon
Picon

Re: [ROOT] smart code-help needed

Do something like:

  TH2F *h2 = new TH2F("h2","y vs pt",npt,ptmin,ptmax,ny,ymin,ymax);
  //now make your loop computing pt and y and fill h2
  h2->Fill(pt,y);

 //draw h2 as a lego plot
 h2->Draw("lego");

Rene Brun

suneel <at> puhep.res.in wrote:
> Dear rooters,
>     I want to be a smart coder but now have a very limited knowledge of
> c++ and coding techniques that is why running for help.
> I an interested in plotting few similar two dimensional histograms for a
> very large number of variables .All the histograms are going to have  same
> thing along one of the axis(let us take x-axis(pt))Idea is to  define the
> other axis as a variable(y) as then I can make a common fill loop.(like
> Fill(pt,y).Then  I am left with only specifying value for y and get all
> the histograms.This thing will also need to define one other variable
> which could represent the histograms for different y-variables.
> To provide more clarity of what I am doing I am enclosing following three
> steps.
> 1.Defining histograms
> 2.define the loop which tells for a particular value of y fill which set
> of histograms.
>    3.Common fill.
> I am finding myself clueless in answering "how to code it".
> If some-one could provide me some help or hints regarding this then it
> could be a great help.
> Thanks a lot in advance
> chris
>   

Picon
Favicon

[ROOT] TDatime::Set() SQL DateTime Format

Dear ROOT team,

Could you include a Set function for the TDatime class that allows one to set an existing object using the SQL DateTime format? See modified code below.

Thanks
Kerry

//insert following Set method into TDatime.h

void         Set(const char *sqlDateTime);

//replace current constructor in TDatime.cxx
TDatime::TDatime(const char *sqlDateTime)
{
   // Expects as input a string in SQL date/time compatible format, like:
   // yyyy-mm-dd hh:mm:ss.

  Set(sqlDateTime);
}

//add implementation of new Set method in TDatime.cxx
void TDatime::Set(const char* sqlDateTime)
{
   // Expects as input a string in SQL date/time compatible format, like:
   // yyyy-mm-dd hh:mm:ss.

   Int_t yy, mm, dd, hh, mi, ss;

   if (sscanf(sqlDateTime, "%d-%d-%d %d:%d:%d", &yy, &mm, &dd, &hh, &mi, &ss) == 6)
      Set(yy, mm, dd, hh, mi, ss);
   else {
      Error("TDatime(sqlDatTime)", "input string not in right format, set"
            " to current date/time");
      Set();
   }
}

Rene Brun | 3 May 2007 11:20
Picon
Picon

Re: [ROOT] TDatime::Set() SQL DateTime Format

Hi Kerry,

Thanks for this suggestion and the code ::)
Now implemented in CVS head.

Rene Brun

Lee, Kerry T. (JSC-SF)[LMIT] wrote:
>
> Dear ROOT team,
>
> Could you include a Set function for the TDatime class that allows one 
> to set an existing object using the SQL DateTime format? See modified 
> code below.
>
> Thanks
> Kerry
>
> //insert following Set method into TDatime.h
>
> void         Set(const char *sqlDateTime);
>
> //replace current constructor in TDatime.cxx
> TDatime::TDatime(const char *sqlDateTime)
> {
>    // Expects as input a string in SQL date/time compatible format, like:
>    // yyyy-mm-dd hh:mm:ss.
>
>   Set(sqlDateTime);
> }
>
> //add implementation of new Set method in TDatime.cxx
> void TDatime::Set(const char* sqlDateTime)
> {
>    // Expects as input a string in SQL date/time compatible format, like:
>    // yyyy-mm-dd hh:mm:ss.
>
>    Int_t yy, mm, dd, hh, mi, ss;
>
>    if (sscanf(sqlDateTime, "%d-%d-%d %d:%d:%d", &yy, &mm, &dd, &hh, 
> &mi, &ss) == 6)
>       Set(yy, mm, dd, hh, mi, ss);
>    else {
>       Error("TDatime(sqlDatTime)", "input string not in right format, set"
>             " to current date/time");
>       Set();
>    }
> }
>

Alberto Pulvirenti | 3 May 2007 12:43
Picon
Picon
Favicon

[ROOT] PC got stuck when launching TGeo examples

Dear all,

I don't know why it happens that, if I launch for the second time (or 
more) some example macroes which are found in $ROOTSYS/tutorials/geom, 
sometimes happens that my computer gets stuck completely, and I have to 
reset it.

Usually this happens after some times I launched the macroes.

In my PC I have kubuntu 6.11 with a kernel 2.6.20-15-generic

Thanks and best regards.

    Alberto

Picon
Favicon

RE: [ROOT] TDatime::Set() SQL DateTime Format

Rene,

Thanks for the quick implementation!

Kerry


-----Original Message-----
From: owner-roottalk <at> pcroot.cern.ch on behalf of Rene Brun
Sent: Thu 5/3/2007 4:20 AM
To: Lee, Kerry T. (JSC-SF)[LMIT]
Cc: roottalk <at> pcroot.cern.ch
Subject: Re: [ROOT] TDatime::Set() SQL DateTime Format

Hi Kerry,

Thanks for this suggestion and the code ::)
Now implemented in CVS head.

Rene Brun


Lee, Kerry T. (JSC-SF)[LMIT] wrote:
>
> Dear ROOT team,
>
> Could you include a Set function for the TDatime class that allows one
> to set an existing object using the SQL DateTime format? See modified
> code below.
>
> Thanks
> Kerry
>
> //insert following Set method into TDatime.h
>
> void         Set(const char *sqlDateTime);
>
> //replace current constructor in TDatime.cxx
> TDatime::TDatime(const char *sqlDateTime)
> {
>    // Expects as input a string in SQL date/time compatible format, like:
>    // yyyy-mm-dd hh:mm:ss.
>
>   Set(sqlDateTime);
> }
>
> //add implementation of new Set method in TDatime.cxx
> void TDatime::Set(const char* sqlDateTime)
> {
>    // Expects as input a string in SQL date/time compatible format, like:
>    // yyyy-mm-dd hh:mm:ss.
>
>    Int_t yy, mm, dd, hh, mi, ss;
>
>    if (sscanf(sqlDateTime, "%d-%d-%d %d:%d:%d", &yy, &mm, &dd, &hh,
> &mi, &ss) == 6)
>       Set(yy, mm, dd, hh, mi, ss);
>    else {
>       Error("TDatime(sqlDatTime)", "input string not in right format, set"
>             " to current date/time");
>       Set();
>    }
> }
>



Gmane