<br><br><div class="gmail_quote">On Wed, May 26, 2010 at 1:40 PM, Brad Sawatzky &lt;<a href="mailto:brads@jlab.org">brads@jlab.org</a>&gt; wrote:<br><blockquote class="gmail_quote">
<div class="im">On Wed, 26 May 2010, MATTHEW R POSIK wrote:<br>
<br>
&gt; On Wed, May 26, 2010 at 11:05 AM, Brad Sawatzky &lt;<a href="mailto:brads@jlab.org">brads@jlab.org</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; On Wed, 26 May 2010, MATTHEW R POSIK wrote:<br>
&gt; &gt;<br>
&gt; &gt; &gt; On Wed, May 26, 2010 at 10:15 AM, Brad Sawatzky &lt;<a href="mailto:brads@jlab.org">brads@jlab.org</a>&gt; wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; On Sat, 22 May 2010, <a href="mailto:posik@jlab.org">posik@jlab.org</a> wrote:<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; So I think I finally got the BB cer multihit TDCs working right. I<br>
&gt; &gt; &gt; &gt; &gt; just use TString cuts for all hits in the TDC. For example the<br>
&gt; &gt; &gt; &gt; &gt; beam line side has 6 hits, so I do something like<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; TString tdc1_1 =<br>
&gt; &gt; &gt; &gt; &gt; &quot;DL.BBcerT01[Ndata.DL.BBcerT01-1]&gt;xx&amp;&amp;DL.BBcerT01[Ndata.DL.BBcerT01-1]&lt;xx&quot;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; What happens when Ndata.DL.BBcerTxx==0?  Will it attempt to index with<br>
&gt; &gt; &gt; &gt; &#39;-1&#39; or do you watch for that condition prior to invoking this cut?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Yes, I took this condition in to account by appending the condition<br>
&gt; &gt; &gt; Ndata.DLBBcerTxx!=0 to all 20 TDCs.<br>
&gt; &gt;<br>
&gt; &gt; You should not just add Ndata.DLBBcerTxx!=0 to the end of the Cut<br>
&gt; &gt; string.  The software must still evaluate all of the bogus [-1] indexes.<br>
&gt; &gt; If those memory locations are out of scope, then you can segfault or<br>
&gt; &gt; throw some other error.  Same problem if you try to invoke a cut for<br>
&gt; &gt; &quot;hit 6&quot; when there are less than 6 hits -- in either case you&#39;re<br>
&gt; &gt; indexing beyond the scope of the array.  That kind of code is just<br>
&gt; &gt; begging for trouble :-)<br>
[ . . . ]<br>
</div><div class="im">&gt; &gt; It looks like the default limit is 1000.  Are you really intending to<br>
&gt; &gt; generating a cut with more than 1000 comparisons?  How big do you have<br>
&gt; &gt; to set it?<br>
<br>
&gt; Right now I have it set to 10000. I have five comparisons for 1 hit on TDC1:<br>
&gt;<br>
&gt;   1) for Ndata !=0<br>
&gt;   2) &amp;&amp; with the TDC hit cut windows<br>
&gt;   3) Hit one less than a TDC channel<br>
&gt;   4) Hit one greater than a TDC channel<br>
&gt;   5) another &amp;&amp; between the two high and low TDC channels<br>
<br>
</div>FWIW, I would recommend using a cut like this:<br>
  &quot;((abs( DL.BBcerT01[Ndata.DL.BBcerT01-1]) - YYY ) &lt; XXX)&quot;<br>
Where YYY is the nominal peak position for that channel, and XXX is the<br>
width of your cut.<br>
<div class="im"><br>
&gt; This is then done for 20 TDCs. This gives 5*20 = 600 comparisons.  I<br>
&gt; then make another cut called &quot;TString tdc_1 = OR of all the one hits<br>
&gt; in the 20 TDCs&quot;  this is another 19 comparisons, which now total<br>
&gt; 600+19=619 comparisons This is then done for 6 hits, so the<br>
&gt; comparisons are now 619*6 = 3714 comparisons.<br>
&gt;<br>
&gt; Is there a more efficient way to do this? I only did it this way because it<br>
&gt; was the most straight forward.<br>
<br>
</div>It would only be valid to apply all 3714 comparisons for an event if you<br>
actually had 6 hits in all 20 PMTs.  That never happens.  Your existing<br>
code (may?) attempt to index outside of array bounds thousands of times on<br>
every event.  Unless you can find something in the ROOT documentation<br>
that says &#39;dereferencing outside array bounds will not screw you in some<br>
weird and mysterious way&#39; then I&#39;ll have to insist that the code be made<br>
more robust.  CINT already does too many stupid things with arrays when<br>
it tries to guess what the user really meant with otherwise invalid<br>
syntax.  I really wish it would just crash on invalid syntax...<br>
<br>
If we must use the DL class, then please rewrite your script using the<br>
TLoop framework (ie. T-&gt;MakeClass(), etc)<br></blockquote><div><br>I just checked the TDC hits and it seems like most of the (15 of the TDCs) are arrays of 16 and of the other  TDCs with array length less than 16, only one was less than the 6 hits that I was looping over (For the H2 elastic runs). So I just fixed that. On the TDCs with array length 16, there seems to be events in hits 1-6 and then a large gap until hit 16 where there is what looks to be one event.      <br>
</div><blockquote class="gmail_quote">
<br>
It would be best to update the Cerenkov class so that it knew about<br>
multi-hit TDCs and treated them rationally.  The modified class should<br>
expose all of the hits, and should also have a boolean flag (ie. named<br>
BB.Cer.hitQ[PMT]) that would indicate whether any one of the hits land<br>
within a min,max pair added to the DB file.  Better yet, set<br>
BB.Cer.hitQ[PMT] to the number of the hit in question.  If<br>
BB.Cer.hitQ[PMT] == 0 (or -1), then no hit passed the cut for that<br>
event.<br>
<br>
What is the status of multi-hit Cerenkov class project anyway?  Dead in<br>
the water, never started, ???<br>
<div><div></div><div class="h5"><br></div></div></blockquote><div>I have not started that yet, but I would not mind if I could, it would save a lot of hassle makeing TDC cuts.<br><br>  -matt<br> <br></div><blockquote class="gmail_quote">
<div><div class="h5">
-- Brad<br>
<br>
--<br>
Brad Sawatzky, PhD &lt;<a href="mailto:brads@jlab.org">brads@jlab.org</a>&gt;  -&lt;&gt;-  Jefferson Lab / Hall C / C111<br>
Ph: 757-269-5947  -&lt;&gt;-  Fax: 757-269-5235  -&lt;&gt;- Pager: <a href="mailto:brads-page@jlab.org">brads-page@jlab.org</a><br>
The most exciting phrase to hear in science, the one that heralds new<br>
  discoveries, is not &quot;Eureka!&quot; but &quot;That&#39;s funny...&quot;   -- Isaac Asimov<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Matthew Posik<br>Email: <a href="mailto:posik@temple.edu">posik@temple.edu</a><br>Temple University Physics Dept.<br>Office: BA-319<br>Office #:  215-204-1331 <br>
WebSites:<br>Temple:<br><a href="http://quarks.temple.edu/">http://quarks.temple.edu/</a><br>d2n:<br><a href="http://hallaweb.jlab.org/experiment/E06-014/">http://hallaweb.jlab.org/experiment/E06-014/</a><br><br>