[Rivet] problem with Analysis::divide?

Andy Buckley andy.buckley at ed.ac.uk
Mon Mar 4 12:48:20 GMT 2013


Hi James,

Hendrik and I are having a bit of a Rivet-YODA hacking session now, and
obviously this is a major thing to resolve.

I'm puzzled by your problem... the point of the *s = h1 / h2 as far as I
recall is that it's the dereferenced scatter pointer *s that is being
assigned to, so there should be a Scatter2D copy assignment operation
here. So the temporary is copied before it's returned... or should be.

As Hendrik asked, do you have a minimal example that segfaults for you?

Andy


On 14/12/12 13:05, James Monk wrote:
> Anyone..?  In case I wasn't clear, this is causing a seg-fault at runtime
> 
> James
> 
> On 10 Dec 2012, at 19:30, James Monk wrote:
> 
>> Hi,
>>
>> I think there's a problem with the histogram divide method on the YODA-fied version of Rivet.  It takes a pointer to a scatter plot for the result, thus:
>>
>> 	  void Analysis::divide(const Histo1D & h1, const Histo1D & h2, Scatter2DPtr s) const
>>
>> and then assigns 
>>
>> 	*s = h1 / h2;
>>
>> but that / operator returns a temporary that is not valid outside of the divide method.  I'm not sure what the intent is here - should it be 
>>
>> 	s = new Scatter2DPtr(h1 / h2);
>>
>> but in that case, why not do away with passing the pointer in and just return it? 
>>
>> cheers,
>>
>> James
>> _______________________________________________
>> Rivet mailing list
>> Rivet at projects.hepforge.org
>> http://www.hepforge.org/lists/listinfo/rivet
> 
> _______________________________________________
> Rivet mailing list
> Rivet at projects.hepforge.org
> http://www.hepforge.org/lists/listinfo/rivet
> 


-- 
Dr Andy Buckley, Royal Society University Research Fellow
Particle Physics Expt Group, University of Edinburgh

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the Rivet mailing list