[d2n-analysis-talk] BB TDC cuts
Brad Sawatzky
brads at jlab.org
Wed May 26 13:40:28 EDT 2010
On Wed, 26 May 2010, MATTHEW R POSIK wrote:
> On Wed, May 26, 2010 at 11:05 AM, Brad Sawatzky <brads at jlab.org> wrote:
>
> > On Wed, 26 May 2010, MATTHEW R POSIK wrote:
> >
> > > On Wed, May 26, 2010 at 10:15 AM, Brad Sawatzky <brads at jlab.org> wrote:
> > >
> > > > On Sat, 22 May 2010, posik at jlab.org wrote:
> > > >
> > > > > So I think I finally got the BB cer multihit TDCs working right. I
> > > > > just use TString cuts for all hits in the TDC. For example the
> > > > > beam line side has 6 hits, so I do something like
> > > > >
> > > > > TString tdc1_1 =
> > > > > "DL.BBcerT01[Ndata.DL.BBcerT01-1]>xx&&DL.BBcerT01[Ndata.DL.BBcerT01-1]<xx"
> > > >
> > > > What happens when Ndata.DL.BBcerTxx==0? Will it attempt to index with
> > > > '-1' or do you watch for that condition prior to invoking this cut?
> > >
> > > Yes, I took this condition in to account by appending the condition
> > > Ndata.DLBBcerTxx!=0 to all 20 TDCs.
> >
> > You should not just add Ndata.DLBBcerTxx!=0 to the end of the Cut
> > string. The software must still evaluate all of the bogus [-1] indexes.
> > If those memory locations are out of scope, then you can segfault or
> > throw some other error. Same problem if you try to invoke a cut for
> > "hit 6" when there are less than 6 hits -- in either case you're
> > indexing beyond the scope of the array. That kind of code is just
> > begging for trouble :-)
[ . . . ]
> > It looks like the default limit is 1000. Are you really intending to
> > generating a cut with more than 1000 comparisons? How big do you have
> > to set it?
> Right now I have it set to 10000. I have five comparisons for 1 hit on TDC1:
>
> 1) for Ndata !=0
> 2) && with the TDC hit cut windows
> 3) Hit one less than a TDC channel
> 4) Hit one greater than a TDC channel
> 5) another && between the two high and low TDC channels
FWIW, I would recommend using a cut like this:
"((abs( DL.BBcerT01[Ndata.DL.BBcerT01-1]) - YYY ) < XXX)"
Where YYY is the nominal peak position for that channel, and XXX is the
width of your cut.
> This is then done for 20 TDCs. This gives 5*20 = 600 comparisons. I
> then make another cut called "TString tdc_1 = OR of all the one hits
> in the 20 TDCs" this is another 19 comparisons, which now total
> 600+19=619 comparisons This is then done for 6 hits, so the
> comparisons are now 619*6 = 3714 comparisons.
>
> Is there a more efficient way to do this? I only did it this way because it
> was the most straight forward.
It would only be valid to apply all 3714 comparisons for an event if you
actually had 6 hits in all 20 PMTs. That never happens. Your existing
code (may?) attempt to index outside of array bounds thousands of times on
every event. Unless you can find something in the ROOT documentation
that says 'dereferencing outside array bounds will not screw you in some
weird and mysterious way' then I'll have to insist that the code be made
more robust. CINT already does too many stupid things with arrays when
it tries to guess what the user really meant with otherwise invalid
syntax. I really wish it would just crash on invalid syntax...
If we must use the DL class, then please rewrite your script using the
TLoop framework (ie. T->MakeClass(), etc)
It would be best to update the Cerenkov class so that it knew about
multi-hit TDCs and treated them rationally. The modified class should
expose all of the hits, and should also have a boolean flag (ie. named
BB.Cer.hitQ[PMT]) that would indicate whether any one of the hits land
within a min,max pair added to the DB file. Better yet, set
BB.Cer.hitQ[PMT] to the number of the hit in question. If
BB.Cer.hitQ[PMT] == 0 (or -1), then no hit passed the cut for that
event.
What is the status of multi-hit Cerenkov class project anyway? Dead in
the water, never started, ???
-- 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