JeffersonLab / analyzer

HallA C++ Analyzer
BSD 3-Clause "New" or "Revised" License
7 stars 54 forks source link

Evtype coda3 #186

Closed rwmichaels closed 2 years ago

rwmichaels commented 2 years ago

These are changes for CODA3 to CodaDecoder, THaEvData, Decoder.h, THaCrateMap, and THaUsrstrutils to get the trigger_bits from the TS and the evt_time (250 MHz clock in TS). Also to read from db_cratemap.dat the crate number of the trigger supervisor (TS). New special event types added. And to parse the CODA3 prescale factors, which are quite different from CODA2. event_type is 1 for all physics events in CODA3. Meanwhile, the CODA2 behavior is unchanged.

rwmichaels commented 2 years ago

Web page describing the changes: https://userweb.jlab.org/~rom/Coda3_PoddMod.html

rwmichaels commented 2 years ago

You may want to check the prescale_decode_coda3. I wasn't sure what to do with ps=-1 which means the trigger is really disabled. However, what I wrote is functional. Also, the DAQ folks should remember to make the TS_PRESCALE_EVTYPE events, which are a reading of the TS registers. Not urgent, but we always considered that information more reliable.

hansenjo commented 2 years ago

Thanks Bob. It looks good. I'll give It a spin. Expect it to be merged shortly.

rwmichaels commented 2 years ago

Maybe ... but I did my best to check this. First, there is the pic attached from Hall C (Brad) where they have a "TI master" (not quite the same as a "Trigger Supervisor" board -- what we have on SBS. Next, I asked William Gu, who invented these boards, if these boards are the same and he said "Yes", see the email below.

Two things worry me: 1) some other info I had said it should be 2^N, but I think that was wrong. 2) It would be great to do a simple test : take a few short runs with a high-rate trigger and adjust prescales and observe the expected behavior. Have not done it yet. That would confirm experimentally.

However, going by the info I have, this code for CODA3 prescales is correct, but it would not be the first time I'm wrong. Need to test it experimentally.

And here's William's reply (I worry it was a "I'm too busy to think about it" answer).

Dear Bob,

Yes, the scale factor should be the same as TImaster.

Thanks.

William


From: Ole Hansen @.> Sent: Thursday, October 28, 2021 1:39 PM To: JeffersonLab/analyzer @.> Cc: Robert Michaels @.>; Author @.> Subject: [EXTERNAL] Re: [JeffersonLab/analyzer] Evtype coda3 (PR #186)

@hansenjo commented on this pull request.


In hana_decode/CodaDecoder.cxxhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_JeffersonLab_analyzer_pull_186-23discussion-5Fr738614424&d=DwMCaQ&c=CJqEzB1piLOyyvZjb8YUQw&r=niPpw-PoOQn3jt3nn_-lSw&m=JZ1gSXCNcOCgdsNCQiiYyI964P8KMiGozOqbfAN2fImJkCWgJT57vFF-adcZImNB&s=Lcx_B2oeLIs4laI2A-BohLPc4VExwSlDc0NjTiaZ8dg&e=:

+// CODA 3 actually allows for 32 triggers. But we have <= 8 for SBS. +// If you don't set psfact[N] (N=8 - 11) to a value, THaRunBase will +// throw an error. May need a better fix here. +

  • for(Int_t trig=8; trig<12; trig++) psfact[trig]=super_big;
  • for(Int_t trig=0; trig<8; trig++) { // loop to 8
  • long ps;
  • ps = sut.getSignedInt(pstr[trig]);
  • long pstemp=kMaxUInt;
  • if (ps==0) pstemp=1;
  • if (ps==-1) pstemp=super_big; // The trigger is actually off,
  • // not just "super big" but infinite.
  • if (ps>=1) {
  • long powerof2=1;
  • for (long ii=0; ii<ps-1; ii++) powerof2 = 2*powerof2;
  • pstemp = 1 + powerof2;

About the CODA3 prescale calculation, I wonder if the "powerof2" logic is correct. It gives: ps=0 -> pstemp = 1 // ok ps=1 -> pstemp = 2 // ok ps=2 -> pstemp = 3 // huh? shouldn't it be 4? ps=3 -> pstemp = 5 // expect 8 ps=4 -> pstemp = 9 // expect 16 etc.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_JeffersonLab_analyzer_pull_186-23pullrequestreview-2D792179590&d=DwMCaQ&c=CJqEzB1piLOyyvZjb8YUQw&r=niPpw-PoOQn3jt3nn_-lSw&m=JZ1gSXCNcOCgdsNCQiiYyI964P8KMiGozOqbfAN2fImJkCWgJT57vFF-adcZImNB&s=FG_JSET3pRygSyizVhXJz4AcjvmewRCYtslZxQ9CHHs&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AAUBLRDCJDJTFCM7XIJ2HS3UJGDGTANCNFSM5G3AIRUQ&d=DwMCaQ&c=CJqEzB1piLOyyvZjb8YUQw&r=niPpw-PoOQn3jt3nn_-lSw&m=JZ1gSXCNcOCgdsNCQiiYyI964P8KMiGozOqbfAN2fImJkCWgJT57vFF-adcZImNB&s=cSpgz5kpe3sGHTc5HBbxjYxiUH20y2ciDM72lFMlmy8&e=. Triage notifications on the go with GitHub Mobile for iOShttps://urldefense.proofpoint.com/v2/url?u=https-3A__apps.apple.com_app_apple-2Dstore_id1477376905-3Fct-3Dnotification-2Demail-26mt-3D8-26pt-3D524675&d=DwMCaQ&c=CJqEzB1piLOyyvZjb8YUQw&r=niPpw-PoOQn3jt3nn_-lSw&m=JZ1gSXCNcOCgdsNCQiiYyI964P8KMiGozOqbfAN2fImJkCWgJT57vFF-adcZImNB&s=E6g4vyNsTOEl9kIGO_kOHKDkKItMSY9oKGcRaCWWo1o&e= or Androidhttps://urldefense.proofpoint.com/v2/url?u=https-3A__play.google.com_store_apps_details-3Fid-3Dcom.github.android-26referrer-3Dutm-5Fcampaign-253Dnotification-2Demail-2526utm-5Fmedium-253Demail-2526utm-5Fsource-253Dgithub&d=DwMCaQ&c=CJqEzB1piLOyyvZjb8YUQw&r=niPpw-PoOQn3jt3nn_-lSw&m=JZ1gSXCNcOCgdsNCQiiYyI964P8KMiGozOqbfAN2fImJkCWgJT57vFF-adcZImNB&s=BUY3aYbw1ftlUcpUnMo_i1-1LKrpK7Z4pRlKWpK1g0A&e=.

rwmichaels commented 2 years ago

I think my email attachment for the hall C prescales from TImaster did not get put here, so here I try again: http://userweb.jlab.org/~rom/hallC_prescale.png

Again, in theory a "Trigger Supervisor" for CODA3 is the same as a TImaster in Hall C, says William Gu. But we should do a simple set of experimental runs to verify it.

rwmichaels commented 2 years ago

Well, you have to cut an paste the link because I can't get it to work on this platform. Here: https://userweb.jlab.org/~rom/hallC_prescale.png

rwmichaels commented 2 years ago

On Slack I proposed this DAQ test. It's about a half hour and doesn't require beam, just a high-rate pulser trigger. Then we know experimentally what the prescale factors are.

hansenjo commented 2 years ago

Rebased, slightly modified, and merged with commit 74211133