[d2n-analysis-talk] S1 and S2m Time Averages: Problems With the SetAlias Method?

Brad Sawatzky brads at jlab.org
Tue Sep 21 12:04:03 EDT 2010


On Mon, 20 Sep 2010, David Flay wrote:

> I have been trying to construct S1 and S2m time average root variables
> using the SetAlias method.  However, I have run into some odd issues:
> 
> To obtain the S1 time average, for instance, my code is:
> 
>     //construct the time averages:
> ch->SetAlias("S1TAvg_0","0.5e+09*(L.s1.lt_c[0]+L.s1.rt_c[0])");
> ch->SetAlias("S1TAvg_1","0.5e+09*(L.s1.lt_c[1]+L.s1.rt_c[1])");
> ch->SetAlias("S1TAvg_2","0.5e+09*(L.s1.lt_c[2]+L.s1.rt_c[2])");
> ch->SetAlias("S1TAvg_3","0.5e+09*(L.s1.lt_c[3]+L.s1.rt_c[3])");
> ch->SetAlias("S1TAvg_4","0.5e+09*(L.s1.lt_c[4]+L.s1.rt_c[4])");
> ch->SetAlias("S1TAvg_5","0.5e+09*(L.s1.lt_c[5]+L.s1.rt_c[5])");
> ch->SetAlias("S1TimeAvg","(1.0/6.0)*(S1TAvg_0+S1TAvg_1+S1TAvg_2+S1TAvg_3+S1TAvg_4+S1TAvg_5)");

The bad plots look like they are accessing the uncorrected variable
data, but I do not see how that is possible from the code you quote...
Any chance the you're not drawing the histo you think you are?  ie.
Copy-and-paste type error that you're unintentionally repeating when you
were testing (ie. commenting and uncommenting different blocks of lines
that should be identical, but really aren't).  Or some low-level
weirdness due to multiple object instantiations sharing the same name,
or a 'generic' histo pointer falls out of scope and isn't pointing to
the object you think it is...  That's what seems to be the most likely
culprit.

Hmm, as an additional observation, the event counts in the histograms
don't seem to add up.  The 'Entries' line claims 1.2M events, but if I
add the bins up by eye I only get ~400k tops.  Where are the other 800k
events?

That said, the statement that this line fails:
> ch->SetAlias("S1TimeAvg","(1.0/6.0)*(S1TAvg_0+S1TAvg_1+S1TAvg_2+S1TAvg_3+S1TAvg_4+S1TAvg_5)");
but works if you leave off the 1/6 factor is really puzzling.  Do you
mean that if you plot:
> ch->SetAlias("S1TimeAvg","(S1TAvg_0+S1TAvg_1+S1TAvg_2+S1TAvg_3+S1TAvg_4+S1TAvg_5)");
then you get figure 2:  a single clean peak at 55ns?  Again, the Entries
number and the integrated counts in the visible bins don't seem to add
up, so perhaps you're just looking at a peak that was outside your histo
bounds when you divided by 1/6?


There could also be some weird operator or function precedence stuff
going on when ROOT is internally unrolling all the aliases to get to the
final expression.  You could try adding 'extra' parentheses around
the expression. Ex:
  ch->SetAlias("S1TimeAvg","((1.0/6.0)*(S1TAvg_0+S1TAvg_1+S1TAvg_2+S1TAvg_3+S1TAvg_4+S1TAvg_5))");
I doubt this is the problem though.

-- Brad

-- 
Brad Sawatzky, PhD <brads at jlab.org>  -<>-  Jefferson Lab / Hall C / C111
Ph: 757-269-5947  -<>-  Fax: 757-269-5235  -<>- Pager: brads-page at jlab.org
The most exciting phrase to hear in science, the one that heralds new
  discoveries, is not "Eureka!" but "That's funny..."   -- Isaac Asimov


More information about the d2n-analysis-talk mailing list