THnSparse : axis range and projection

Hello folks,

I have got an error message when trying to project a THnSparse after having defined the axis range :

Int_t nvarbins[1]={3}
THnSparseF * h =new THnSparseF(“sparse”,“blablabla”,1,nvarbins)
Double_t array0[4]={0,1,2,3}
h->SetBinEdges(0,array0)
h->GetAxis(0)->SetRangeUser(2,3)
h->Projection(0)
Error in TAxis::TAxis::Set: bins must be in increasing order

If I don’t call SetRangeUser I get everything is OK.

I am using root v5-22-00 recompiled with THnSparse from yesterday’s trunk. I didn’t try with a whole fresh trunk… could this explain my problem ?

Thanks for any help !
renaud

Hi Renaud,

this is now fixed in the trunk. Thanks for reporting!

Cheers, Axel.

Hi again,

I actually still get problems using this piece of code :

Int_t bins[1] = {2};
THnSparseF* hn = new THnSparseF(“hn”,"",1,bins);
Double_t limits0[3]={0,1,2};
hn->SetBinEdges(0,limits0);
hn->GetAxis(0)->SetBit(TAxis::kAxisRange);
hn->Projection(0);
—> Error in TAxis::TAxis::Set: bins must be in increasing order

just setting the bit TAxis::kAxisRange causes the mess. that shouldn’t be right ? :slight_smile:
unfortunately I really need to be able to do that for my projections.

thanks a lot for fixing that.
cheers,
renaud

forgot something important : I am using v5-23-02

Hi Renaud,

this was fixed only after 5.23/02; you’ll need to use the trunk to get the fix. For me it works.

Cheers, Axel.

hi Axel
thanks, you’re right
I still have problems understanding svn, sorry …
it works for me too

cheers,
renaud