<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Century;
        panose-1:2 4 6 4 5 5 5 2 3 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:black">Hello fellow SBS software developers:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">After much experimentation, I’ve concluded that the only foolproof and reliable way to apply a cut on a variable-sized array within the output definition file is to write some code within the analyzer to calculate
 the result of that cut, define a variable holding the result of that cut for each index in the variable array, and then use ONLY the name of that variable as the cut definition in either the odef or cdef file. Combining them in cut definitions with logical
 operators does not seem to work correctly.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">For example, I have a “decoded strip” array for each GEM module, and I wanted to histogram the decoded strips by choosing strips along a particular axis and also strips along a particular axis that end up on a
 good track. I already had two variables to indicate each of these conditions: <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">sbs.uvagem.m0.strip.ontrack # flag indicating strip is on a good track<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">sbs.uvagem.m0.strip.IsU # flag indicating this is a U/X strip (“axis” = 0)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">sbs.uvagem.m0.strip.IsV # flag indicating this is a V/Y strip (“axis” = 1)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black;background:yellow;mso-highlight:yellow">When I try to define a histogram like this, it doesn’t work correctly:</span><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="color:black">th1d hstripv_good_sbs_uvagem_m1 'V Strip heat map, module 1' sbs.uvagem.m1.strip.istrip[I] 1280 -0.5 1279.5 sbs.uvagem.m1.strip.ontrack[I]&&sbs.uvagem.m1.strip.IsV[I]</span></b><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">It compiles but I get incorrect results. The cut expression is attempting to combine the “ontrack” and “IsV” results. However, in the output histogram only the first expression is applied and everything after the
 && seems to be ignored. <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">So although it is extremely annoying to do so, I defined a new variable “ontrackV” which is the logical AND of “ontrack” and “IsV” and calculated its result in the code.
<span style="background:yellow;mso-highlight:yellow">The following syntax then works correctly:</span> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="color:black">th1d hstripv_good_sbs_uvagem_m0 ‘V Strip heat map, module 0’ sbs.uvagem.m0.strip.istrip[I] 1280 -0.5 1279.5 sbs.uvagem.m0.strip.ontrackV[I]</span></b><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">I am not sure if the “[I]” is necessary, but it can’t hurt to make your intentions more clear to Podd. While the automatic histogramming and cut definition in the analyzer is clunky and cumbersome and should probably
 eventually be rewritten wholesale, nobody has time to do that, so this is something that works that we can use for now. I thought you might find this useful. <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Andrew<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Century",serif;color:black">Andrew Puckett<br>
Associate Professor, Physics Department<br>
University of Connecticut<br>
196 Auditorium Road, Unit 3046<br>
Storrs, CT 06269-3046<br>
Office phone: (860) 486-7137<br>
</span><a href="https://puckett.physics.uconn.edu" title="https://puckett.physics.uconn.edu"><span style="font-size:12.0pt;font-family:"Century",serif">https://puckett.physics.uconn.edu</span></a><span style="font-size:12.0pt;font-family:"Century",serif;color:black"><br>
</span><a href="mailto:andrew.puckett@uconn.edu"><span style="font-size:12.0pt;font-family:"Century",serif">puckett@jlab.org</span></a></p>
</div>
</body>
</html>