|
[Rivet] ATLAS inclusive isolated diphoton analysis in RivetAndy Buckley andy.buckley at ed.ac.ukWed Sep 28 15:39:05 BST 2011
On 28/09/11 15:47, Hendrik Hoeth wrote: > Hi Giovanni, > > I'm looking at the ATLAS_2011_S9120807 Rivet analysis for which you are > listed as author, and I see these lines of code: > > if( nDens%2 == 0 ) > median = (ptDensities[b][nDens/2]+ptDensities[b][(nDens-2)/2])/2; > else > median = ptDensities[b][(nDens-1)/2]; > > I'm not familiar with that analysis, but I guess you are trying to > calculate a median here. Shouldn't it then be (nDens+2)/2 instead of > (nDens-2)/2 in the first line? Really? Let's say the array has 10 entries -- in that case Giovanni's median is the mean of the 5th and 6th entries. Since C(++) arrays are zero-based, that means myarray[4] = myarray[10/2 - 1] and myarray[5] = myarray[10/2 + 1 - 1] = myarray[10/2]. That's effectively what Giovanni has, it's just that the [num/2 - 1] is written as [(num-2)/2]... which I think makes the motivation a bit unclear but isn't wrong. Or did I screw up? ;) -- Dr Andy Buckley SUPA Advanced Research Fellow Particle Physics Experiment 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 |