Oleksandr Zenaiev | 1 May 05:33 2011

[ROOT] problem with TTree after removing one of branches

Hello ROOTers,

I have a problem with TTree class after removing one of branches.

Here is my code (simplified enough to represent a problem):

//file: test_tree.cxx
#include "TTree.h"
#include "TBranch.h"

int main() {
	TTree* tree=new TTree("orange", "orange");
	int a;
	TBranch* br_a=tree->Branch("a", &a, "a/I");
	int b;
	TBranch* br_b=tree->Branch("b", &b, "b/I");
	for (int i=0; i<10; i++) {
		a=i;
		b=i*i;
		tree->Fill();
	}
	tree->GetListOfBranches()->Remove(br_a);
	int b1;
	tree->SetBranchAddress("b", &b1);
	return 0;
}

Then I tried to run it and got segmentation violation:

 *** Break *** segmentation violation
(Continue reading)

Philippe Canal | 1 May 06:16 2011

Re: [ROOT] problem with TTree after removing one of branches

Hi,

Removing a branch from a TTree is not officially supported
(as, in particular, it does not really reclaim the disk space anyway).

To resolve the segmentation, you need to use the following
code:
     tree->GetListOfBranches()->Remove(br_a);
     tree->GetListOfBranches()->Compress();

which makes sure that the collection of branches in the
state expected by the rest of the TTree code.

Cheers,
Philippe.

On 4/30/11 10:33 PM, Oleksandr Zenaiev wrote:
> Hello ROOTers,
>
> I have a problem with TTree class after removing one of branches.
>
> Here is my code (simplified enough to represent a problem):
>
> //file: test_tree.cxx
> #include "TTree.h"
> #include "TBranch.h"
>
> int main() {
> 	TTree* tree=new TTree("orange", "orange");
> 	int a;
(Continue reading)

Hermann Fuchs | 2 May 09:06 2011
Picon

Re: [ROOT] Newbie Question- strtok type mismatch

Hello

I am using the current stable version, version 5.28

It causes a type missmatch, wheter I start it with .x myfile.cxx or .x
myfile.cxx+

I have attached my script below, perhaps it is something trivial, which
I'm just not seeing.
The reason why I'm using this complicated read process instead of using
the built-in ReadFile is, because I've to preprocess the values first.
The current source file consists of a single column of data which can be
surrounded by leading and trailing spaces and blank lines.
In the next step I want to read in a 8000*8000 matrix therefore the
complicated design.

any help would be greatly appreciated,
Cheers,
Hermann
{
gROOT->Reset();
Int_t i,numValRead;
//the variables for the data
Double_t depth=0;
Double_t EDep=0;

Double_t x,y,z;
Double_t incrementX,incrementY,incrementZ;
Double_t startX,startY,startZ;
Double_t value;
(Continue reading)

Hermann Fuchs | 2 May 10:33 2011
Picon

Re: [ROOT] Newbie Question- strtok type mismatch

Hi

It seems I've found the error.
	splitedString = strtok (NULL, " ");
Does not work with Root, I have to use
	splitedString = strtok (0, " ");
then it works.

Can anybody explain why this is the case? I thought NULL can be used
throughout c and c++ ?

Cheers,
Hermann

On Mon, 2011-05-02 at 09:06 +0200, Hermann Fuchs wrote:
> Hello
> 
> I am using the current stable version, version 5.28
> 
> It causes a type missmatch, wheter I start it with .x myfile.cxx or .x
> myfile.cxx+
> 
> I have attached my script below, perhaps it is something trivial, which
> I'm just not seeing.
> The reason why I'm using this complicated read process instead of using
> the built-in ReadFile is, because I've to preprocess the values first.
> The current source file consists of a single column of data which can be
> surrounded by leading and trailing spaces and blank lines.
> In the next step I want to read in a 8000*8000 matrix therefore the
> complicated design.
(Continue reading)

Marcelo Zimbres | 2 May 12:31 2011
Picon

[ROOT] Help on TVirtualFFT::SineCosine()

Hi,

could you help me getting TVirtualFFT::SineCosine() works properly on the attached macro? I am trying to calculate a cosine function using DCT-I but I am not succeeding. If I change to TVirtualFFT::FFT() everything works fine. I think the problem is on the transform size I am using but I do not get it to work correctly.

I have also pasted the code bellow
Thanks in advance,
Marcelo

void even_odd(Int_t n = 3,Int_t physical = 100)                           

   // testing even-odd fourier transforms.                                

   Int_t even = 1; // DCT-I                                               

   //TVirtualFFT* fEven = TVirtualFFT::FFT(1,&physical,"C2R M K"); // this works
   TVirtualFFT* fEven = TVirtualFFT::SineCosine(1,&physical,&even,"M K");
  
   TArrayD fRe(physical);                                                 
   TArrayD fIm(physical);                                                 
  
   fRe[n] = 1.;
                                                                          
   TArrayD xaxis(physical);                                               
   Double_t conv = 180./physical;                                         
   for (Int_t i = 0; i < physical; ++i)                                   
      xaxis[i] = i*conv;
                                                                          
   fEven->SetPointsComplex(fRe.GetArray(),fIm.GetArray());                
   fEven->Transform();
                                                                          
   TGraph* g = new TGraph(physical,xaxis.GetArray(),fEven->GetPointsReal());  
   g->Draw("AC*");
     
   delete fEven;                                                          
}                      

Attachment (even_odd.C): text/x-csrc, 907 bytes
Antonio Salvucci | 2 May 14:13 2011
Picon

Re: [ROOT] Debian packages i386/amd64

Ho Chris,

	sorry for the late reply, but I was on holiday :)

So, I know root packages are out from Debian/Ubuntu because there is not a 
really maintainer, and then we decided to leave them out from Debian/Ubuntu.

Maybe is useful to use the upcoming release, because I compiled root under 
unstable debian and maybe you need new dependences.

In the other case, you can compile by yourself root downloading deb source

apt-get source root-system
cd root-system-5.28...
debuild -tc

Cheers,

	Antonio

On Monday 25 April 2011 00:17:11 Christopher Backhouse wrote:
> Hi Antonio,
> 
> Do you know if/when these packages will make it into the upcoming ubuntu
> release 11.04? They were in the previous 10.10 release. I don't see them
> right now in beta 2 (which is probably my own fault for using prerelease
> software).
> 
> If the answer is that they aren't going to make it, do you know if it's
> possible to install the debian packages directly? I followed the
> instructions on the webpage, but they don't show up. I expect there's
> some small change I need to make to convince ubuntu to accept them.
> 
> Thanks - Chris
> 
> On 04/17/2011 05:47 PM, Sigifredo Escobar Gómez wrote:
> > Hi Antonio.
> > 
> > Good job, congratulations.
> > 
> > 
> > 
> > 
> > El 17 de abril de 2011 17:16, Omar Andrés Zapata Mesa
> > 
> > <andresete.chaos <at> gmail.com <mailto:andresete.chaos <at> gmail.com>> escribió:
> >     oh! thats a great job, congratulations
> >     O.
> >     
> >     
> >     On Sun, Apr 17, 2011 at 5:06 PM, Antonio Salvucci <s4lb04 <at> gmail.com
> >     
> >     <mailto:s4lb04 <at> gmail.com>> wrote:
> >         Hi rooters,
> >         
> >                 I updated root debian packages.
> >         
> >         Now they are available for both i386 and amd64 systems.
> >         
> >         Cheers,
> >         
> >                 Antonio
> >         
> >         PS: information about repository are at
> >         http://lcg-heppkg.web.cern.ch/lcg-heppkg/debian/
Arthur E. Snyder | 3 May 01:31 2011
Picon

[ROOT] Apply in an cut string in a selector


I'm trying to apply cuts I'm given as a string (e.g., TString cuts) in a 
selector w/o having to re-code them by hand.

That is I have string |cuts| with cuts specified in it. With |Draw| I 
would do something like:

tup->Draw("var",cuts) (1)

I could also make a list of "events" with

tup->Draw(">>cutList",cuts); (2)

Is there some way I can apply this string of cuts inside a selector.

If I do (2) at begining can create |cutList|, but how to access it, so I 
can skip directly to the disired events in |Proccess|? Or is there some 
way I can apply cuts directly to the entry and do the selection in 
|Proccess|, i.e, just check if a given entry passes the cuts?

-Arthur S.

I think I could make a |TEventList| externally and pass it into my 
selector via a static |TEventList*|, but it seems awkward ... I'd like to 
just specify the string and let the program to the rest ..

A.E. Snyder, Group ?                         \!c*p?/
SLAC Mail Stop #95                          ((.   .))
Box 4349                                        |
Stanford, Ca, USA, 94309                      '\|/`
e-mail:snyder <at> slac.stanford.edu                 o
phone:650-926-2701                              _
http://www.slac.stanford.edu/~snyder          BaBar
FAX:707-313-0250                          Collaboration
                                                 &
                                            Fermi/GLAST

OKUMURA, Akira | 4 May 03:04 2011
Picon

[ROOT] How to call TPyException in Python?

Hello ROOTers,

I would like to know how to make an instance of PyROOT::TPyException inside python interpreter. I get the
following error on OS X 10.6 + Python 2.6.1 + ROOT 5.29/01.

========================================
$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> e = ROOT.PyROOT.TPyException()
TClass::TClass:0: RuntimeWarning: no dictionary for class exception is available
TClass::TClass:0: RuntimeWarning: no dictionary for class exception is available
TypeError: type 'instance' is not an acceptable base type
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'PyROOT' has no attribute 'TPyException'
========================================

Regards,

--
OKUMURA, Akira oxon <at> {astro.isas.jaxa.jp,stanford.edu}
Institute of Space and Astronautical Science (ISAS/JAXA)
Now at KIPAC/SLAC/Stanford
Varian Physics #306, 382 Via Pueblo Mall, MC 4060
Stanford, CA 94305-4060
TEL 650-736-0971/FAX 650-724-5065
Skype : okumura.akira

wlavrijsen | 4 May 04:43 2011

Re: [ROOT] How to call TPyException in Python?

Akira,

> TypeError: type 'instance' is not an acceptable base type

a quick look seems to indicate that ROOT.py is mistakenly creating class
std.exception as a template instance, rather than a class. Will fix tomorrow.

I'm not sure why there's a complaint about not having a dictionary for
exception, when the same does not happen with root.exe.

All that said, why care about TPyException from python? Its purpose is to
be thrown from and caught by C++.

Best regards,
            Wim
--

-- 
WLavrijsen <at> lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net

OKUMURA, Akira | 4 May 04:58 2011
Picon

Re: [ROOT] How to call TPyException in Python?

Hello Wim,

Thanks a lot.

What I want to do is to throw C++ exceptions from my C++ ROOT code, and catch them in PyROOT. I thought that it
could be done by using PyROOT::TPyException. Because the explanation in its header says as follow.

==============
http://root.cern.ch/root/html/PyROOT__TPyException.html
Purpose: A C++ exception class for throwing python exceptions
         through C++ code.
==============

But according to your comment, my understanding seems to be wrong. Is there any tutorial of TPyException?

Regards,

--
OKUMURA, Akira oxon <at> {astro.isas.jaxa.jp,stanford.edu}
Institute of Space and Astronautical Science (ISAS/JAXA)
Now at KIPAC/SLAC/Stanford
Varian Physics #306, 382 Via Pueblo Mall, MC 4060
Stanford, CA 94305-4060
TEL 650-736-0971/FAX 650-724-5065
Skype : okumura.akira

On 2011/05/03, at 19:43, wlavrijsen <at> lbl.gov wrote:

> Akira,
> 
>> TypeError: type 'instance' is not an acceptable base type
> 
> a quick look seems to indicate that ROOT.py is mistakenly creating class
> std.exception as a template instance, rather than a class. Will fix tomorrow.
> 
> I'm not sure why there's a complaint about not having a dictionary for
> exception, when the same does not happen with root.exe.
> 
> All that said, why care about TPyException from python? Its purpose is to
> be thrown from and caught by C++.
> 
> Best regards,
>          Wim
> -- 
> WLavrijsen <at> lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net


Gmane