From 9c986702fd6e6abe988260432be4ef6d26d00d87 Mon Sep 17 00:00:00 2001 From: shahoian Date: Tue, 19 Oct 2021 19:05:11 +0200 Subject: [PATCH] Fix C/A beam assignment (0,1) and P2 offsets --- .../Constants/include/CommonConstants/LHCConstants.h | 10 ++++++---- .../common/include/CommonDataFormat/BunchFilling.h | 12 ++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Common/Constants/include/CommonConstants/LHCConstants.h b/Common/Constants/include/CommonConstants/LHCConstants.h index f831c111da634..358136b77e2d8 100644 --- a/Common/Constants/include/CommonConstants/LHCConstants.h +++ b/Common/Constants/include/CommonConstants/LHCConstants.h @@ -23,9 +23,11 @@ namespace constants namespace lhc { // LHC Beam1 and Beam2 definitions -enum BeamDirection : int { BeamClockWise, - BeamAntiClockWise, - NBeamDirections }; +enum BeamDirection : int { BeamClockWise, // beamC = beam 1, + BeamAntiClockWise, // beamA = beam 2 + NBeamDirections, + InteractingBC = -1 // as used in the BunchFilling class +}; constexpr int LHCMaxBunches = 3564; // max N bunches constexpr double LHCRFFreq = 400.789e6; // LHC RF frequency in Hz constexpr double LHCBunchSpacingNS = 10 * 1.e9 / LHCRFFreq; // bunch spacing in ns (10 RFbuckets) @@ -36,7 +38,7 @@ constexpr double LHCOrbitMUS = LHCOrbitNS * 1e-3; // orbit durati constexpr unsigned int MaxNOrbits = 0xffffffff; // Offsets of clockwise and anticlockwise beam bunches at P2 -constexpr int BunchOffsetsP2[2] = {346, 3019}; +constexpr int BunchOffsetsP2[2] = {3017, 344}; // convert LHC bunch ID to BC for 2 beam directions constexpr int LHCBunch2P2BC(int bunch, BeamDirection dir) diff --git a/DataFormats/common/include/CommonDataFormat/BunchFilling.h b/DataFormats/common/include/CommonDataFormat/BunchFilling.h index 077e3cc85b3f4..1fdc1d7ba8443 100644 --- a/DataFormats/common/include/CommonDataFormat/BunchFilling.h +++ b/DataFormats/common/include/CommonDataFormat/BunchFilling.h @@ -41,13 +41,13 @@ class BunchFilling // get interacting bunches pattern (B) const auto& getBCPattern() const { return mPattern; } - // get pattern or clockwise (0, A) and anticlockwise (1, C) beams at P2 + // get pattern or clockwise (1, A) and anticlockwise (0, C) beams at P2 const auto& getBeamPattern(int beam) const { return mBeamAC[beam]; } // get pattern of interacting BCs (-1) or beams filled BCs at P2 (0,1) const auto& getPattern(int dir = -1) const { return dir < 0 ? getBCPattern() : getBeamPattern(dir); } - // get number of interacting bunches (-1) and number of filled bunches for clockwise (0, A) and anticlockwise (1, C) beams + // get number of interacting bunches (-1) and number of filled bunches for clockwise (1, A) and anticlockwise (0, C) beams int getNBunches(int dir = -1) const { return dir < 0 ? mPattern.count() : mBeamAC[dir].count(); } // test interacting bunch @@ -56,10 +56,10 @@ class BunchFilling // test bean bunch bool testBeamBunch(int bcID, int dir) const { return mBeamAC[dir][bcID]; } - // test interacting (-1) or clockwise (0, A) and anticlockwise (1, C) beams bunch + // test interacting (-1) or clockwise (1, A) and anticlockwise (0, C) beams bunch bool testBC(int bcID, int dir = -1) const { return dir < 0 ? testInteractingBC(bcID) : testBeamBunch(bcID, dir); } - // BC setters, dir=-1 is for interacting bunches pattern, 0,1 for clockwise (A) and anticlockwise (C) beams + // BC setters, dir=-1 is for interacting bunches pattern, 0, 1 for clockwise (C) and anticlockwise (A) beams void setBC(int bcID, bool active = true, int dir = -1); void setBCTrain(int nBC, int bcSpacing, int firstBC, int dir = -1); void setBCTrains(int nTrains, int trainSpacingInBC, int nBC, int bcSpacing, int firstBC, int dir = -1); @@ -72,7 +72,7 @@ class BunchFilling int getFirstFilledBC(int dir = -1) const; int getLastFilledBC(int dir = -1) const; - // print pattern of bunches, dir=0,1: for A,C beams, dir=-1: for interacting BCs, otherwise: all + // print pattern of bunches, dir=0,1: for C,A beams, dir=-1: for interacting BCs, otherwise: all void print(int dir = -2, int bcPerLine = 100) const; // set BC filling a la TPC TDR, 12 50ns trains of 48 BCs @@ -94,7 +94,7 @@ class BunchFilling static bool parsePattern(const unsigned char*& input, Pattern& patt, int& ibit, int& level); Pattern mPattern{}; // Pattern of interacting BCs at P2 - std::array mBeamAC{}; // pattern of 2 beam bunches at P2 + std::array mBeamAC{}; // pattern of 2 beam bunches at P2, 0 for C, 1 for A beam ClassDefNV(BunchFilling, 2); };