Retrieving bunch crossing from jet skim tree

 - Had some confusion in retrieving bunch by bunch beam polarization
 - Trying to clean things up in my head
 - Update: Feb 18, 2020 / Added bx distributions + polarization by bx type

//-------------------------------------------------------------------------------------------------

 - Codes in StJetSkimEventMaker related to retrieving spin info:
   in short, it gets bx48 from l0 trigger and feed it to retrieve spin info from spnDB.

    //spin specific info from Mudst:
    int bx7 = muEvent->l0Trigger().bunchCrossingId7bit(muEvent->runId());
    int bx48 =  muEvent->l0Trigger().bunchCrossingId();
    mEvent->setBx7( bx7 );
    mEvent->setBx48( bx48 );
    mEvent->setSpinBits( muEvent->l0Trigger().spinBits( muEvent->runId() ) );

    //get spin info (Yellow,Blue): Up,Up = 5; Down,Up = 6; Up,Down = 9; Down,Down = 10;
    if(isRealData) {
        StSpinDbMaker* spDbMaker = dynamic_cast<StSpinDbMaker*>(GetMakerInheritsFrom("StSpinDbMaker"));
        assert(spDbMaker);
        mEvent->setIsValid( spDbMaker->isValid() );
        mEvent->setIsPolLong( spDbMaker->isPolDirLong() );
        mEvent->setIsPolTrans( spDbMaker->isPolDirTrans() );
        int isMasked = (spDbMaker->isMaskedUsingBX48(bx48)) ? 1 : 0;
        mEvent->setIsMaskedUsingBx48( isMasked );
        mEvent->setOffsetBx48minusBX7( spDbMaker->offsetBX48minusBX7(bx48, bx7) );
        mEvent->setSpin4UsingBx48( spDbMaker->spin4usingBX48(bx48) );
    }

//-------------------------------------------------------------------------------------------------

 - Used a muDST file (st_fms_16080002_raw_1500002.MuDst.root, fill 18793)
     a. Checked saved bx48 and spin info by using a skim file produced from it
     b. Checked same items by accessing spinDB directly via an independent test Maker

 - Codes used to check the bunch by bunch polarization:

        a. skim file, in event loop

        //Get spin info
        const int bunch7 = evtSkim->bx7();
        const int bunch = evtSkim->bx48();
        const int spin4 = evtSkim->spin4usingBx48();
        int polY = 0;
        int polB = 0;
        if (spin4 & 0x1) polY = +1; //Ypol up, in "Source" -> at STAR, this is flipped!
        if (spin4 & 0x2) polY = -1; //Ypol
        if (spin4 & 0x4) polB = +1; //Bpol
        if (spin4 & 0x8) polB = -1; //Bpol
        cout <<Form("%3i %3i %2i %2i", bunch7, bunch, polB, polY) <<endl;

        b. independent Maker, in InitRun

        for (int i=0; i<120; i++)
        {
            const int bunch = mSpinDbMk->BXstarUsingBX48(i);
            const int spin4 = mSpinDbMk->spin4usingBX48(bunch);

            int yPol = 0;
            int bPol = 0;
            if (spin4 & 0x1) yPol = +1; //Ypol up, in "Source" -> at STAR, this is flipped!
            if (spin4 & 0x2) yPol = -1; //Ypol
            if (spin4 & 0x4) bPol = +1; //Bpol
            if (spin4 & 0x8) bPol = -1; //Bpol

            mSpinPt[bunch][0] = bPol;
            mSpinPt[bunch][1] = yPol;
        }
        for (int i=0; i<120; i++) cout <<Form("%3i %2i %2i", i, mSpinPt[i][0], mSpinPt[i][1]) <<endl;

 - Output: skim file (left) vs. maker
 




 - Both results match for bx48 and its spin info. But the bx48's abort gaps are NOT positioned properly.
    Typical Blue (Yellow) beam's abort gap is 31 - 39 (111 - 119) in STAR,
    but the results show Blue (Yellow) abort gap is located at 90 - 98 (10 - 18). //Feb. 18: Yellow AG is 31 - 39

 - Meantime it seems bx7 (leftmost column in screenshot) seems makes sense for abort gap.
   (cannot find any event located in 31 - 39 or 111 - 119)