[Rivet] Displacing histograms

Andy Buckley andy.buckley at ed.ac.uk
Thu Nov 29 15:41:13 GMT 2012


On 29/11/12 16:40, Andy Buckley wrote:
> On 29/11/12 16:26, James Monk wrote:
>> Hi everyone,
>>
>> I'm implementing a Rivet analysis in which the final plots involve taking the ratio of two temporary histograms, before shifting the whole lot down by the average multiplicity for the run.  I can obviously go through point-by-point on the scatter plot and shift each one down (and in principle deal with the additional statistical error on the multiplicity, which will be very small), but I was wondering if anyone knows of a more elegant way of doing that.  It's a bit of an unusual case, so I'm not surprised there's no method to do that.
> 
> There's a nice way to do it in YODA :-) Well, niceish... it's still C++!
> Maybe we should *really* get that released as soon as possible!
> 
> In Rivet-with-YODA it would be something like this. First, because
> 
> ---
> struct XShifter {
>     XShifter(double shift) : xshift(shift) {  }
>     double operator()(double x) { return x - xshift; }
> };
> 
> divide(tmp1, tmp2, destScatter2DPtr);
> transformX(destScatter2DPtr, XShifter(Nmean));
> ---
> 
> The XShifter struct (or class) is inelegant, but blame C++ for that.
> Maybe the Boost lambda stuff would work, too. It's only necessary
> because your Nmean is only known at the end of the run: a fixed offset
> could be done with just a double -> double function.
> 
> In AIDA.... yep, completely by-hand DataPointSet mangling, I guess!

On re-reading, maybe you wanted a shift in y instead. I think you can
probably guess the syntax for that ;)

Andy

-- 
Dr Andy Buckley, SUPA Advanced 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