CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Attributes
GctFormatTranslateV35 Class Reference

Unpacks/packs the V35 raw format. More...

#include <GctFormatTranslateV35.h>

Inheritance diagram for GctFormatTranslateV35:
GctFormatTranslateBase

Public Member Functions

bool convertBlock (const unsigned char *d, const GctBlockHeader &hdr) override
 Get digis from the block - will return true if it succeeds, false otherwise. More...
 
 GctFormatTranslateV35 (bool hltMode=false, bool unpackSharedRegions=false)
 Constructor. More...
 
GctBlockHeader generateBlockHeader (const unsigned char *data) const override
 Generate a block header from four 8-bit values. More...
 
 ~GctFormatTranslateV35 () override
 Destructor. More...
 
- Public Member Functions inherited from GctFormatTranslateBase
 GctFormatTranslateBase (bool hltMode=false, bool unpackSharedRegions=false)
 Constructor. More...
 
const std::string & getBlockDescription (const GctBlockHeader &header) const
 Get block description. More...
 
void setPackingBxId (uint32_t bxId)
 
void setPackingEventId (uint32_t eventId)
 
void setUnpackCollections (GctUnpackCollections *const collections)
 Set the pointer to the unpack collections. More...
 
virtual ~GctFormatTranslateBase ()
 Destructor. More...
 

Protected Member Functions

const BlockLengthMapblockLengthMap () const final
 get the static block ID to block-length map. More...
 
const BlockNameMapblockNameMap () const final
 get the static block ID to blockname map. More...
 
uint32_t generateRawHeader (const uint32_t blockId, const uint32_t nSamples, const uint32_t bxId, const uint32_t eventId) const override
 Returns a raw 32-bit header word generated from the blockId, number of time samples, bunch-crossing and event IDs. More...
 
const BlockIdToEmCandIsoBoundMapinternEmIsoBounds () const final
 get the static intern EM cand isolated boundary map. More...
 
const BlkToRctCrateMaprctEmCrateMap () const final
 get static the block ID to RCT crate map for electrons. More...
 
const BlkToRctCrateMaprctJetCrateMap () const final
 get the static block ID to RCT crate map for jets More...
 
- Protected Member Functions inherited from GctFormatTranslateBase
void blockDoNothing (const unsigned char *d, const GctBlockHeader &hdr)
 The null unpack function - obviously common to all formats. More...
 
bool checkBlock (const GctBlockHeader &hdr) const
 Performs checks on the block header to see if the block is possible to unpack or not. More...
 
GctUnpackCollections *const colls () const
 Protected access to the GCT Unpack Collections. More...
 
L1GctJetCandCollection *const gctJets (const unsigned cat) const
 Get a specific jet candandiate collection using the JetCandCategory enumeration. More...
 
bool hltMode () const
 Protected interface to get HLT optimisation mode flag. More...
 
const uint32_t packingBxId () const
 Get the BxId to be used when packing data. More...
 
const uint32_t packingEventId () const
 Get the EventId to be used when packing data. More...
 
const SourceCardRoutingsrcCardRouting () const
 Protected interface to the unpackSharedRegions commissioning option. More...
 
bool unpackSharedRegions () const
 
void writeRawHeader (unsigned char *data, uint32_t blockId, uint32_t nSamples) const
 Writes a raw block header into the raw data array for a given block ID and number of time-samples. More...
 

Private Types

typedef std::map< unsigned int, PtrToUnpackFnBlockIdToUnpackFnMap
 Typedef for a block ID to unpack function map. More...
 
typedef void(GctFormatTranslateV35::* PtrToUnpackFn) (const unsigned char *, const GctBlockHeader &)
 Function pointer typdef to a block unpack function. More...
 

Private Member Functions

void blockToFibres (const unsigned char *d, const GctBlockHeader &hdr)
 unpack Fibres More...
 
void blockToFibresAndToRctEmCand (const unsigned char *d, const GctBlockHeader &hdr)
 unpack Fibres and RCT EM Candidates More...
 
void blockToGctEmCandsAndEnergySums (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT EM Candidates and energy sums. More...
 
void blockToGctInternEmCand (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT internal EM Candidates More...
 
void blockToGctInternEtSums (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT internal Et sums More...
 
void blockToGctInternEtSumsAndJetCluster (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT internal output of leaf jet finder More...
 
void blockToGctInternRingSums (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT internal HF ring sums More...
 
void blockToGctJetCandsAndCounts (const unsigned char *d, const GctBlockHeader &hdr)
 Unpack GCT Jet Candidates and jet counts. More...
 
void blockToGctJetClusterMinimal (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT internal input to wheel jet sort More...
 
void blockToGctJetPreCluster (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT internal shared jet finder info More...
 
void blockToGctTrigObjects (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT internal wheel and conc jets More...
 
void blockToGctWheelInputInternEtAndRingSums (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT internal input to wheel More...
 
void blockToGctWheelOutputInternEtAndRingSums (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT internal output of wheel More...
 
void blockToRctCaloRegions (const unsigned char *d, const GctBlockHeader &hdr)
 Unpack RCT Calo Regions. More...
 
void blockToRctEmCand (const unsigned char *d, const GctBlockHeader &hdr)
 unpack RCT EM Candidates More...
 

Static Private Attributes

static const BlockLengthMap m_blockLength
 Map to translate block number to fundamental size of a block (i.e. for 1 time-sample). More...
 
static const BlockNameMap m_blockName
 Map to hold a description for each block number. More...
 
static const BlockIdToUnpackFnMap m_blockUnpackFn
 Block ID to unpack function map. More...
 
static const BlockIdToEmCandIsoBoundMap m_internEmIsoBounds
 
static const BlkToRctCrateMap m_rctEmCrate
 Map to relate capture block ID to the RCT crate the data originated from (for electrons). More...
 
static const BlkToRctCrateMap m_rctJetCrate
 Map to relate capture block ID to the RCT crate the data originated from (for jets). More...
 

Additional Inherited Members

- Protected Types inherited from GctFormatTranslateBase
typedef std::map< unsigned int, unsigned int > BlkToRctCrateMap
 Typedef for mapping block ID to RCT crate. More...
 
typedef std::map< unsigned int, IsoBoundaryPairBlockIdToEmCandIsoBoundMap
 A typdef for mapping Block IDs to IsoBoundaryPairs. More...
 
typedef std::map< unsigned int, unsigned int > BlockLengthMap
 Block ID to Block Length map. More...
 
typedef std::pair< unsigned int, unsigned int > BlockLengthPair
 Block ID/length pair. More...
 
typedef std::map< unsigned int, std::string > BlockNameMap
 Block ID to Block Description map. More...
 
typedef std::pair< unsigned int, std::string > BlockNamePair
 Block ID/Description pair. More...
 
enum  EmCandCatagory { NON_ISO_EM_CANDS, ISO_EM_CANDS, NUM_EM_CAND_CATEGORIES }
 An enum of the EM candidate types. More...
 
typedef std::pair< unsigned int, unsigned int > IsoBoundaryPair
 
enum  JetCandCategory { TAU_JETS, FORWARD_JETS, CENTRAL_JETS, NUM_JET_CATEGORIES }
 Useful enumeration for jet candidate pack/unpack. More...
 

Detailed Description

Unpacks/packs the V35 raw format.

Author
Robert Frazier

Definition at line 17 of file GctFormatTranslateV35.h.

Member Typedef Documentation

typedef std::map<unsigned int, PtrToUnpackFn> GctFormatTranslateV35::BlockIdToUnpackFnMap
private

Typedef for a block ID to unpack function map.

Definition at line 75 of file GctFormatTranslateV35.h.

typedef void(GctFormatTranslateV35::* GctFormatTranslateV35::PtrToUnpackFn) (const unsigned char *, const GctBlockHeader &)
private

Function pointer typdef to a block unpack function.

Definition at line 73 of file GctFormatTranslateV35.h.

Constructor & Destructor Documentation

GctFormatTranslateV35::GctFormatTranslateV35 ( bool  hltMode = false,
bool  unpackSharedRegions = false 
)
explicit

Constructor.

Parameters
hltMode- set true to unpack only BX zero and GCT output data (i.e. to run as quick as possible).
unpackSharedRegions- this is a commissioning option to unpack the shared RCT calo regions.

Definition at line 559 of file GctFormatTranslateV35.cc.

GctFormatTranslateBase(bool hltMode=false, bool unpackSharedRegions=false)
Constructor.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
GctFormatTranslateV35::~GctFormatTranslateV35 ( )
override

Destructor.

Definition at line 562 of file GctFormatTranslateV35.cc.

562 {}

Member Function Documentation

const BlockLengthMap& GctFormatTranslateV35::blockLengthMap ( ) const
inlinefinalprotectedvirtual

get the static block ID to block-length map.

Implements GctFormatTranslateBase.

Definition at line 44 of file GctFormatTranslateV35.h.

References m_blockLength.

Referenced by generateBlockHeader().

const BlockNameMap& GctFormatTranslateV35::blockNameMap ( ) const
inlinefinalprotectedvirtual

get the static block ID to blockname map.

Implements GctFormatTranslateBase.

Definition at line 48 of file GctFormatTranslateV35.h.

References m_blockName.

void GctFormatTranslateV35::blockToFibres ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack Fibres

Definition at line 903 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, GctUnpackCollections::gctFibres(), GctFormatTranslateBase::hltMode(), mps_fire::i, LogDebug, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by blockToFibresAndToRctEmCand().

903  {
904  // Don't want to do this in HLT optimisation mode!
905  if (hltMode()) {
906  LogDebug("GCT") << "HLT mode - skipping unpack of GCT Fibres";
907  return;
908  }
909 
910  unsigned int id = hdr.blockId();
911  unsigned int nSamples = hdr.nSamples();
912  unsigned int length = hdr.blockLength();
913 
914  // re-interpret pointer
915  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
916 
917  for (unsigned int i = 0; i < length; ++i) {
918  for (unsigned int bx = 0; bx < nSamples; ++bx) {
919  colls()->gctFibres()->push_back(L1GctFibreWord(*p, id, i, bx));
920  ++p;
921  }
922  }
923 }
#define LogDebug(id)
Global Calorimeter Trigger SC -> CC fibre data word.
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
L1GctFibreCollection *const gctFibres() const
Raw fibre input to the GCT.
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
void GctFormatTranslateV35::blockToFibresAndToRctEmCand ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack Fibres and RCT EM Candidates

Definition at line 925 of file GctFormatTranslateV35.cc.

References blockToFibres(), and blockToRctEmCand().

925  {
926  this->blockToRctEmCand(d, hdr);
927  this->blockToFibres(d, hdr);
928 }
void blockToFibres(const unsigned char *d, const GctBlockHeader &hdr)
unpack Fibres
d
Definition: ztail.py:151
void blockToRctEmCand(const unsigned char *d, const GctBlockHeader &hdr)
unpack RCT EM Candidates
void GctFormatTranslateV35::blockToGctEmCandsAndEnergySums ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT EM Candidates and energy sums.

Definition at line 634 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, GctUnpackCollections::gctEtHad(), GctUnpackCollections::gctEtMiss(), GctUnpackCollections::gctEtTot(), GctUnpackCollections::gctIsoEm(), GctUnpackCollections::gctNonIsoEm(), GctFormatTranslateBase::hltMode(), PresampleTask_cfi::nSamples, and GctBlockHeader::nSamples().

634  {
635  const unsigned int id = hdr.blockId();
636  const unsigned int nSamples = hdr.nSamples();
637 
638  // Re-interpret pointer. p16 will be pointing at the 16 bit word that
639  // contains the rank0 non-isolated electron of the zeroth time-sample.
640  const uint16_t* p16 = reinterpret_cast<const uint16_t*>(d);
641 
642  // UNPACK EM CANDS
643 
644  const unsigned int emCandCategoryOffset =
645  nSamples * 4; // Offset to jump from the non-iso electrons to the isolated ones.
646  const unsigned int timeSampleOffset = nSamples * 2; // Offset to jump to next candidate pair in the same time-sample.
647 
648  unsigned int samplesToUnpack = 1;
649  if (!hltMode()) {
650  samplesToUnpack = nSamples;
651  } // Only if not running in HLT mode do we want more than 1 timesample.
652 
653  for (unsigned int iso = 0; iso < 2; ++iso) // loop over non-iso/iso candidate pairs
654  {
655  bool isoFlag = (iso == 1);
656 
657  // Get the correct collection to put them in.
659  if (isoFlag) {
660  em = colls()->gctIsoEm();
661  } else {
662  em = colls()->gctNonIsoEm();
663  }
664 
665  for (unsigned int bx = 0; bx < samplesToUnpack; ++bx) // loop over time samples
666  {
667  // cand0Offset will give the offset on p16 to get the rank 0 candidate
668  // of the correct category and timesample.
669  const unsigned int cand0Offset = iso * emCandCategoryOffset + bx * 2;
670 
671  em->push_back(L1GctEmCand(p16[cand0Offset], isoFlag, id, 0, bx)); // rank0 electron
672  em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset], isoFlag, id, 1, bx)); // rank1 electron
673  em->push_back(L1GctEmCand(p16[cand0Offset + 1], isoFlag, id, 2, bx)); // rank2 electron
674  em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset + 1], isoFlag, id, 3, bx)); // rank3 electron
675  }
676  }
677 
678  p16 += emCandCategoryOffset * 2; // Move the pointer over the data we've already unpacked.
679 
680  // UNPACK ENERGY SUMS
681  // NOTE: we are only unpacking one timesample of these currently!
682 
683  colls()->gctEtTot()->push_back(L1GctEtTotal(p16[0])); // Et total (timesample 0).
684  colls()->gctEtHad()->push_back(L1GctEtHad(p16[1])); // Et hadronic (timesample 0).
685 
686  // 32-bit pointer for getting Missing Et.
687  const uint32_t* p32 = reinterpret_cast<const uint32_t*>(p16);
688 
689  colls()->gctEtMiss()->push_back(L1GctEtMiss(p32[nSamples])); // Et Miss (timesample 0).
690 }
L1GctEmCandCollection *const gctNonIsoEm() const
GCT output: Non-isolated EM candidate collection.
Persistable copy of missing Et measured at Level-1.
Definition: L1GctEtMiss.h:17
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:21
L1GctEtTotalCollection *const gctEtTot() const
GCT output: Total Et collection.
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
Persistable copy of total Et measured at Level-1.
Definition: L1GctEtTotal.h:17
L1GctEtMissCollection *const gctEtMiss() const
GCT output: Missing Et collection.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
Persistable copy of total Ht measured at Level-1.
Definition: L1GctEtHad.h:17
d
Definition: ztail.py:151
L1GctEmCandCollection *const gctIsoEm() const
GCT output: Isolated EM candidate collection.
L1GctEtHadCollection *const gctEtHad() const
GCT output: Hadronic transverse-energy (Ht) collection.
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
std::vector< L1GctEmCand > L1GctEmCandCollection
void GctFormatTranslateV35::blockToGctInternEmCand ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal EM Candidates

Definition at line 749 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, end, spr::find(), newFWLiteAna::found, GctUnpackCollections::gctInternEm(), GctFormatTranslateBase::hltMode(), mps_fire::i, internEmIsoBounds(), LogDebug, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), hltrates_dqm_sourceclient-live_cfg::offset, and AlCaHLTBitMon_ParallelJobs::p.

749  {
750  // Don't want to do this in HLT optimisation mode!
751  if (hltMode()) {
752  LogDebug("GCT") << "HLT mode - skipping unpack of internal EM Cands";
753  return;
754  }
755 
756  unsigned int id = hdr.blockId();
757  unsigned int nSamples = hdr.nSamples();
758  unsigned int numCandPairs = hdr.blockLength();
759 
760  // Debug assertion to prevent problems if definitions not up to date.
761  auto found = internEmIsoBounds().find(id);
762  assert(internEmIsoBounds().find(id) != internEmIsoBounds().end());
763 
764  unsigned int lowerIsoPairBound = found->second.first;
765  unsigned int upperIsoPairBound = found->second.second;
766 
767  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
768  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
769 
770  // Loop over timesamples (i.e. bunch crossings)
771  for (unsigned int bx = 0; bx < nSamples; ++bx) {
772  // Loop over candidate pairs (i.e. each iteration unpacks a pair of candidates)
773  for (unsigned int candPair = 0; candPair < numCandPairs; ++candPair) {
774  // Is the candidate electron pair an isolated pair or not?
775  bool iso = ((candPair >= lowerIsoPairBound) && (candPair <= upperIsoPairBound));
776 
777  // Loop over the two electron candidates in each pair
778  for (unsigned int i = 0; i < 2; ++i) {
779  unsigned offset = 2 * (bx + candPair * nSamples) + i;
780  uint16_t candRaw = p[offset];
781  colls()->gctInternEm()->push_back(L1GctInternEmCand(candRaw, iso, id, candPair * 2 + i, bx));
782  }
783  }
784  }
785 }
#define LogDebug(id)
const BlockIdToEmCandIsoBoundMap & internEmIsoBounds() const final
get the static intern EM cand isolated boundary map.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
#define end
Definition: vmac.h:39
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
uint32_t blockId() const
Get the block ID.
L1GctInternEmCandCollection *const gctInternEm() const
Internal EM candidate collection.
uint32_t nSamples() const
Get the number of time samples.
void GctFormatTranslateV35::blockToGctInternEtSums ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal Et sums

Definition at line 930 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, L1GctInternEtSum::fromTotalEtOrHt(), GctUnpackCollections::gctInternEtSums(), GctFormatTranslateBase::hltMode(), mps_fire::i, LogDebug, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), and AlCaHLTBitMon_ParallelJobs::p.

930  {
931  // Don't want to do this in HLT optimisation mode!
932 
933  if (hltMode()) {
934  LogDebug("GCT") << "HLT mode - skipping unpack of internal Et Sums";
935  return;
936  }
937 
938  unsigned int id = hdr.blockId();
939  unsigned int nSamples = hdr.nSamples();
940  unsigned int length = hdr.blockLength();
941 
942  // Re-interpret pointer to 32 bits
943  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
944 
945  for (unsigned int i = 0; i < length; ++i) {
946  // Loop over timesamples (i.e. bunch crossings)
947  for (unsigned int bx = 0; bx < nSamples; ++bx) {
948  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id, i, bx, *p));
949  ++p;
950  }
951  }
952 }
#define LogDebug(id)
static L1GctInternEtSum fromTotalEtOrHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
L1GctInternEtSumCollection *const gctInternEtSums() const
Internal Et Sum collection.
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
void GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal output of leaf jet finder

Definition at line 954 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, L1GctInternJetData::fromJetCluster(), L1GctInternEtSum::fromJetMissEt(), L1GctInternEtSum::fromJetTotEt(), L1GctInternEtSum::fromJetTotHt(), GctUnpackCollections::gctInternEtSums(), GctUnpackCollections::gctInternJets(), GctFormatTranslateBase::hltMode(), mps_fire::i, LogDebug, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), and AlCaHLTBitMon_ParallelJobs::p.

954  {
955  // Don't want to do this in HLT optimisation mode!
956  if (hltMode()) {
957  LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
958  return;
959  }
960 
961  unsigned int id = hdr.blockId();
962  unsigned int nSamples = hdr.nSamples();
963  unsigned int length = hdr.blockLength();
964 
965  // Re-interpret pointer to 32 bits
966  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
967 
968  for (unsigned int i = 0; i < length; ++i) {
969  // Loop over timesamples (i.e. bunch crossings)
970  for (unsigned int bx = 0; bx < nSamples; ++bx) {
971  if (i < 2)
972  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetMissEt(id, i, bx, *p));
973  if (i == 3) {
974  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetTotEt(id, i, bx, *p));
975  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetTotHt(id, i, bx, *p));
976  }
977  if (i > 4)
979  ++p;
980  }
981  }
982 }
#define LogDebug(id)
L1GctInternEtSumCollection *const gctInternEtSums() const
Internal Et Sum collection.
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
static L1GctInternEtSum fromJetMissEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
static L1GctInternJetData fromJetCluster(L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
construct from "jet_cluster"
L1GctInternJetDataCollection *const gctInternJets() const
Internal Jet candidate collection.
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
static L1GctInternEtSum fromJetTotEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
static L1GctInternEtSum fromJetTotHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
void GctFormatTranslateV35::blockToGctInternRingSums ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal HF ring sums

Definition at line 1065 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, L1GctInternHFData::fromConcBitCounts(), L1GctInternHFData::fromConcRingSums(), GctUnpackCollections::gctInternHFData(), GctFormatTranslateBase::hltMode(), mps_fire::i, LogDebug, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), and AlCaHLTBitMon_ParallelJobs::p.

1065  {
1066  // Don't want to do this in HLT optimisation mode!
1067  if (hltMode()) {
1068  LogDebug("GCT") << "HLT mode - skipping unpack of internal HF ring data";
1069  return;
1070  }
1071 
1072  unsigned int id = hdr.blockId();
1073  unsigned int nSamples = hdr.nSamples();
1074  unsigned int length = hdr.blockLength();
1075 
1076  // Re-interpret pointer to 32 bits
1077  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1078 
1079  for (unsigned int i = 0; i < length / 2; ++i) {
1080  // Loop over timesamples (i.e. bunch crossings)
1081  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1082  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromConcRingSums(id, i, bx, *p));
1083  ++p;
1084  }
1085  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1086  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromConcBitCounts(id, i, bx, *p));
1087  ++p;
1088  }
1089  }
1090 }
#define LogDebug(id)
static L1GctInternHFData fromConcBitCounts(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
L1GctInternHFDataCollection *const gctInternHFData() const
Internal Hadronic-Forward bit-counts/ring-sums data collection.
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
static L1GctInternHFData fromConcRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
void GctFormatTranslateV35::blockToGctJetCandsAndCounts ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

Unpack GCT Jet Candidates and jet counts.

Definition at line 692 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, GctFormatTranslateBase::FORWARD_JETS, L1GctHFBitCounts::fromConcHFBitCounts(), L1GctHFRingEtSums::fromConcRingSums(), GctUnpackCollections::gctHfBitCounts(), GctUnpackCollections::gctHfRingEtSums(), GctFormatTranslateBase::gctJets(), GctFormatTranslateBase::hltMode(), singleTopDQM_cfi::jets, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), GctFormatTranslateBase::NUM_JET_CATEGORIES, and GctFormatTranslateBase::TAU_JETS.

692  {
693  const unsigned int id = hdr.blockId(); // Capture block ID.
694  const unsigned int nSamples = hdr.nSamples(); // Number of time-samples.
695 
696  // Re-interpret block payload pointer to 16 bits so it sees one candidate at a time.
697  // p16 points to the start of the block payload, at the rank0 tau jet candidate.
698  const uint16_t* p16 = reinterpret_cast<const uint16_t*>(d);
699 
700  // UNPACK JET CANDS
701 
702  const unsigned int jetCandCategoryOffset = nSamples * 4; // Offset to jump from one jet category to the next.
703  const unsigned int timeSampleOffset = nSamples * 2; // Offset to jump to next candidate pair in the same time-sample.
704 
705  unsigned int samplesToUnpack = 1;
706  if (!hltMode()) {
707  samplesToUnpack = nSamples;
708  } // Only if not running in HLT mode do we want more than 1 timesample.
709 
710  // Loop over the different catagories of jets
711  for (unsigned int iCat = 0; iCat < NUM_JET_CATEGORIES; ++iCat) {
712  L1GctJetCandCollection* const jets = gctJets(iCat);
713  assert(jets->empty()); // The supplied vector should be empty.
714 
715  bool tauflag = (iCat == TAU_JETS);
716  bool forwardFlag = (iCat == FORWARD_JETS);
717 
718  // Loop over the different timesamples (bunch crossings).
719  for (unsigned int bx = 0; bx < samplesToUnpack; ++bx) {
720  // cand0Offset will give the offset on p16 to get the rank 0 Jet Cand of the correct category and timesample.
721  const unsigned int cand0Offset = iCat * jetCandCategoryOffset + bx * 2;
722 
723  // Rank 0 Jet.
724  jets->push_back(L1GctJetCand(p16[cand0Offset], tauflag, forwardFlag, id, 0, bx));
725  // Rank 1 Jet.
726  jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset], tauflag, forwardFlag, id, 1, bx));
727  // Rank 2 Jet.
728  jets->push_back(L1GctJetCand(p16[cand0Offset + 1], tauflag, forwardFlag, id, 2, bx));
729  // Rank 3 Jet.
730  jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset + 1], tauflag, forwardFlag, id, 3, bx));
731  }
732  }
733 
734  p16 += NUM_JET_CATEGORIES * jetCandCategoryOffset; // Move the pointer over the data we've already unpacked.
735 
736  // NOW UNPACK: HFBitCounts, HFRingEtSums (no Missing Ht yet)
737  // NOTE: we are only unpacking one timesample of these currently!
738 
739  // Re-interpret block payload pointer to 32 bits so it sees six jet counts at a time.
740  const uint32_t* p32 = reinterpret_cast<const uint32_t*>(p16);
741 
742  // Channel 0 carries both HF counts and sums
743  colls()->gctHfBitCounts()->push_back(L1GctHFBitCounts::fromConcHFBitCounts(id, 6, 0, p32[0]));
744  colls()->gctHfRingEtSums()->push_back(L1GctHFRingEtSums::fromConcRingSums(id, 6, 0, p32[0]));
745  // Skip channel 1 for now. Later this may carry MHT would be accessed as p32[nSamples]
746 }
L1GctHFBitCountsCollection *const gctHfBitCounts() const
GCT output: Hadronic-Forward bit-counts collection.
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:17
std::vector< L1GctJetCand > L1GctJetCandCollection
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
d
Definition: ztail.py:151
static L1GctHFRingEtSums fromConcRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
L1GctJetCandCollection *const gctJets(const unsigned cat) const
Get a specific jet candandiate collection using the JetCandCategory enumeration.
L1GctHFRingEtSumsCollection *const gctHfRingEtSums() const
GCT output: Hadronic-Forward ring-sums collection.
static L1GctHFBitCounts fromConcHFBitCounts(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
void GctFormatTranslateV35::blockToGctJetClusterMinimal ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal input to wheel jet sort

Definition at line 1011 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, L1GctInternJetData::fromJetClusterMinimal(), GctUnpackCollections::gctInternJets(), GctFormatTranslateBase::hltMode(), mps_fire::i, LogDebug, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), and AlCaHLTBitMon_ParallelJobs::p.

1011  {
1012  // Don't want to do this in HLT optimisation mode!
1013  if (hltMode()) {
1014  LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
1015  return;
1016  }
1017 
1018  unsigned int id = hdr.blockId();
1019  unsigned int nSamples = hdr.nSamples();
1020  unsigned int length = hdr.blockLength();
1021 
1022  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
1023  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
1024 
1025  for (unsigned int i = 0; i < length; ++i) {
1026  // Loop over timesamples (i.e. bunch crossings)
1027  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1028  colls()->gctInternJets()->push_back(
1030  ++p;
1031  colls()->gctInternJets()->push_back(
1033  ++p;
1034  }
1035  }
1036 }
#define LogDebug(id)
static L1GctInternJetData fromJetClusterMinimal(L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
construct from "jet_cluster_minimal"
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
L1GctInternJetDataCollection *const gctInternJets() const
Internal Jet candidate collection.
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
void GctFormatTranslateV35::blockToGctJetPreCluster ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal shared jet finder info

Definition at line 1038 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, L1GctInternJetData::fromJetPreCluster(), GctUnpackCollections::gctInternJets(), GctFormatTranslateBase::hltMode(), mps_fire::i, LogDebug, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), and AlCaHLTBitMon_ParallelJobs::p.

1038  {
1039  // Don't want to do this in HLT optimisation mode!
1040  if (hltMode()) {
1041  LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
1042  return;
1043  }
1044 
1045  unsigned int id = hdr.blockId();
1046  unsigned int nSamples = hdr.nSamples();
1047  unsigned int length = hdr.blockLength();
1048 
1049  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
1050  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
1051 
1052  for (unsigned int i = 0; i < length; ++i) {
1053  // Loop over timesamples (i.e. bunch crossings)
1054  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1055  colls()->gctInternJets()->push_back(
1057  ++p;
1058  colls()->gctInternJets()->push_back(
1060  ++p;
1061  }
1062  }
1063 }
#define LogDebug(id)
static L1GctInternJetData fromJetPreCluster(L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
construct from "jet_precluster"
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
L1GctInternJetDataCollection *const gctInternJets() const
Internal Jet candidate collection.
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
void GctFormatTranslateV35::blockToGctTrigObjects ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal wheel and conc jets

Definition at line 984 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, L1GctInternJetData::fromGctTrigObject(), GctUnpackCollections::gctInternJets(), GctFormatTranslateBase::hltMode(), mps_fire::i, LogDebug, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), and AlCaHLTBitMon_ParallelJobs::p.

984  {
985  // Don't want to do this in HLT optimisation mode!
986  if (hltMode()) {
987  LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
988  return;
989  }
990 
991  unsigned int id = hdr.blockId();
992  unsigned int nSamples = hdr.nSamples();
993  unsigned int length = hdr.blockLength();
994 
995  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
996  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
997 
998  for (unsigned int i = 0; i < length; ++i) {
999  // Loop over timesamples (i.e. bunch crossings)
1000  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1001  colls()->gctInternJets()->push_back(
1003  ++p;
1004  colls()->gctInternJets()->push_back(
1006  ++p;
1007  }
1008  }
1009 }
#define LogDebug(id)
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
static L1GctInternJetData fromGctTrigObject(L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
construct from "gct_trig_object"
L1GctInternJetDataCollection *const gctInternJets() const
Internal Jet candidate collection.
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
void GctFormatTranslateV35::blockToGctWheelInputInternEtAndRingSums ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal input to wheel

Definition at line 1092 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, L1GctInternEtSum::fromMissEtxOrEty(), L1GctInternEtSum::fromTotalEtOrHt(), L1GctInternHFData::fromWheelBitCounts(), L1GctInternHFData::fromWheelRingSums(), GctUnpackCollections::gctInternEtSums(), GctUnpackCollections::gctInternHFData(), GctFormatTranslateBase::hltMode(), mps_fire::i, LogDebug, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), and AlCaHLTBitMon_ParallelJobs::p.

1092  {
1093  // Don't want to do this in HLT optimisation mode!
1094  if (hltMode()) {
1095  LogDebug("GCT") << "HLT mode - skipping unpack of wheel input internal Et sums and HF ring data";
1096  return;
1097  }
1098 
1099  unsigned int id = hdr.blockId();
1100  unsigned int nSamples = hdr.nSamples();
1101  unsigned int length = hdr.blockLength();
1102 
1103  // Re-interpret pointer to 32 bits
1104  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1105 
1106  for (unsigned int i = 0; i < length; ++i) {
1107  // Loop over timesamples (i.e. bunch crossings)
1108  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1109  if (i < 3) {
1110  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id, i, bx, *p));
1111  } else if (i > 2 && i < 9) {
1112  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromMissEtxOrEty(id, i, bx, *p));
1113  } else if (i > 8 && i < 15) {
1114  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelRingSums(id, i, bx, *p));
1115  } else if (i > 14) {
1116  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelBitCounts(id, i, bx, *p));
1117  }
1118  ++p;
1119  }
1120  }
1121 }
#define LogDebug(id)
static L1GctInternEtSum fromMissEtxOrEty(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
static L1GctInternEtSum fromTotalEtOrHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
L1GctInternHFDataCollection *const gctInternHFData() const
Internal Hadronic-Forward bit-counts/ring-sums data collection.
L1GctInternEtSumCollection *const gctInternEtSums() const
Internal Et Sum collection.
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
static L1GctInternHFData fromWheelRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
static L1GctInternHFData fromWheelBitCounts(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
void GctFormatTranslateV35::blockToGctWheelOutputInternEtAndRingSums ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal output of wheel

Definition at line 1123 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, L1GctInternEtSum::fromMissEtxOrEty(), L1GctInternEtSum::fromTotalEtOrHt(), L1GctInternHFData::fromWheelBitCounts(), L1GctInternHFData::fromWheelRingSums(), GctUnpackCollections::gctInternEtSums(), GctUnpackCollections::gctInternHFData(), GctFormatTranslateBase::hltMode(), mps_fire::i, LogDebug, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), and AlCaHLTBitMon_ParallelJobs::p.

1124  {
1125  // Don't want to do this in HLT optimisation mode!
1126  if (hltMode()) {
1127  LogDebug("GCT") << "HLT mode - skipping unpack of wheel output internal Et sums and HF ring data";
1128  return;
1129  }
1130 
1131  unsigned int id = hdr.blockId();
1132  unsigned int nSamples = hdr.nSamples();
1133  unsigned int length = hdr.blockLength();
1134 
1135  // Re-interpret pointer to 32 bits
1136  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1137 
1138  for (unsigned int i = 0; i < length; ++i) {
1139  // Loop over timesamples (i.e. bunch crossings)
1140  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1141  if (i < 1) {
1142  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id, i, bx, *p));
1143  } else if (i > 0 && i < 3) {
1144  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromMissEtxOrEty(id, i, bx, *p));
1145  } else if (i > 2 && i < 5) {
1146  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelRingSums(id, i, bx, *p));
1147  } else if (i > 4) {
1148  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelBitCounts(id, i, bx, *p));
1149  }
1150  ++p;
1151  }
1152  }
1153 }
#define LogDebug(id)
static L1GctInternEtSum fromMissEtxOrEty(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
static L1GctInternEtSum fromTotalEtOrHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
L1GctInternHFDataCollection *const gctInternHFData() const
Internal Hadronic-Forward bit-counts/ring-sums data collection.
L1GctInternEtSumCollection *const gctInternEtSums() const
Internal Et Sum collection.
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
static L1GctInternHFData fromWheelRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
static L1GctInternHFData fromWheelBitCounts(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
void GctFormatTranslateV35::blockToRctCaloRegions ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

Unpack RCT Calo Regions.

Definition at line 848 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, end, newFWLiteAna::found, GctFormatTranslateBase::hltMode(), mps_fire::i, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, LogDebug, L1CaloRegion::makeRegionFromUnpacker(), PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), AlCaHLTBitMon_ParallelJobs::p, GctUnpackCollections::rctCalo(), and rctJetCrateMap().

848  {
849  // Don't want to do this in HLT optimisation mode!
850  if (hltMode()) {
851  LogDebug("GCT") << "HLT mode - skipping unpack of RCT Regions";
852  return;
853  }
854 
855  unsigned int id = hdr.blockId();
856  unsigned int nSamples = hdr.nSamples();
857  unsigned int length = hdr.blockLength();
858 
859  // Debug assertion to prevent problems if definitions not up to date.
860  auto found = rctJetCrateMap().find(id);
861  assert(found != rctJetCrateMap().end());
862 
863  // get crate (need this to get ieta and iphi)
864  unsigned int crate = found->second;
865 
866  // re-interpret pointer
867  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
868 
869  // eta and phi
870  unsigned int ieta;
871  unsigned int iphi;
872 
873  for (unsigned int i = 0; i < length; ++i) {
874  for (uint16_t bx = 0; bx < nSamples; ++bx) {
875  if (i > 0) {
876  if (crate < 9) { // negative eta
877  ieta = 11 - i;
878  iphi = 2 * ((11 - crate) % 9);
879  } else { // positive eta
880  ieta = 10 + i;
881  iphi = 2 * ((20 - crate) % 9);
882  }
883  // First region is phi=0
884  colls()->rctCalo()->push_back(L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx));
885  ++p;
886  // Second region is phi=1
887  if (iphi > 0) {
888  iphi -= 1;
889  } else {
890  iphi = 17;
891  }
892  colls()->rctCalo()->push_back(L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx));
893  ++p;
894  } else { // Skip the first two regions which are duplicates.
895  ++p;
896  ++p;
897  }
898  }
899  }
900 }
#define LogDebug(id)
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
const BlkToRctCrateMap & rctJetCrateMap() const final
get the static block ID to RCT crate map for jets
#define end
Definition: vmac.h:39
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
static L1CaloRegion makeRegionFromUnpacker(const uint16_t data, const unsigned ieta, const unsigned iphi, const uint16_t block, const uint16_t index, const int16_t bx)
constructor from raw data and GCT indices for unpacking
Definition: L1CaloRegion.cc:78
L1CaloRegionCollection *const rctCalo() const
Input calo regions from the RCT to the GCT.
void GctFormatTranslateV35::blockToRctEmCand ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack RCT EM Candidates

Definition at line 789 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), l1GtPatternGenerator_cfi::bx, GctFormatTranslateBase::colls(), ztail::d, end, newFWLiteAna::found, GctFormatTranslateBase::hltMode(), mps_fire::i, LogDebug, PresampleTask_cfi::nSamples, GctBlockHeader::nSamples(), AlCaHLTBitMon_ParallelJobs::p, GctUnpackCollections::rctEm(), rctEmCrateMap(), edm::second(), SourceCardRouting::SFPtoEMU(), and GctFormatTranslateBase::srcCardRouting().

Referenced by blockToFibresAndToRctEmCand().

789  {
790  // Don't want to do this in HLT optimisation mode!
791  if (hltMode()) {
792  LogDebug("GCT") << "HLT mode - skipping unpack of RCT EM Cands";
793  return;
794  }
795 
796  unsigned int id = hdr.blockId();
797  unsigned int nSamples = hdr.nSamples();
798  unsigned int length = hdr.blockLength();
799 
800  // re-interpret pointer
801  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
802 
803  // arrays of source card data
804  uint16_t sfp[2][4]; // [ cycle ] [ SFP ]
805  uint16_t eIsoRank[4];
806  uint16_t eIsoCard[4];
807  uint16_t eIsoRgn[4];
808  uint16_t eNonIsoRank[4];
809  uint16_t eNonIsoCard[4];
810  uint16_t eNonIsoRgn[4];
811  uint16_t MIPbits[7][2];
812  uint16_t QBits[7][2];
813 
814  unsigned int bx = 0;
815 
816  // loop over crates
817  auto found = rctEmCrateMap().find(id);
818  assert(found != rctEmCrateMap().end());
819  for (unsigned int crate = found->second; crate < found->second + length / 3; ++crate) {
820  // read SC SFP words
821  for (unsigned short iSfp = 0; iSfp < 4; ++iSfp) {
822  for (unsigned short cyc = 0; cyc < 2; ++cyc) {
823  if (iSfp == 0) {
824  sfp[cyc][iSfp] = 0;
825  } // muon bits
826  else { // EM candidate
827  sfp[cyc][iSfp] = *p;
828  ++p;
829  }
830  }
831  p = p + 2 * (nSamples - 1);
832  }
833 
834  // fill SC arrays
835  srcCardRouting().SFPtoEMU(eIsoRank, eIsoCard, eIsoRgn, eNonIsoRank, eNonIsoCard, eNonIsoRgn, MIPbits, QBits, sfp);
836 
837  // create EM cands
838  for (unsigned short int i = 0; i < 4; ++i) {
839  colls()->rctEm()->push_back(L1CaloEmCand(eIsoRank[i], eIsoRgn[i], eIsoCard[i], crate, true, i, bx));
840  }
841  for (unsigned short int i = 0; i < 4; ++i) {
842  colls()->rctEm()->push_back(L1CaloEmCand(eNonIsoRank[i], eNonIsoRgn[i], eNonIsoCard[i], crate, false, i, bx));
843  }
844  }
845 }
#define LogDebug(id)
L1CaloEmCollection *const rctEm() const
Input electrons from the RCT to the GCT.
void SFPtoEMU(unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], unsigned short(&SFP)[2][4]) const
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:17
const SourceCardRouting & srcCardRouting() const
Protected interface to the unpackSharedRegions commissioning option.
U second(std::pair< T, U > const &p)
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
#define end
Definition: vmac.h:39
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
const BlkToRctCrateMap & rctEmCrateMap() const final
get static the block ID to RCT crate map for electrons.
d
Definition: ztail.py:151
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
bool GctFormatTranslateV35::convertBlock ( const unsigned char *  d,
const GctBlockHeader hdr 
)
overridevirtual

Get digis from the block - will return true if it succeeds, false otherwise.

Implements GctFormatTranslateBase.

Definition at line 593 of file GctFormatTranslateV35.cc.

References GctBlockHeader::blockId(), GctFormatTranslateBase::checkBlock(), data, m_blockUnpackFn, GctBlockHeader::nSamples(), and edm::second().

593  {
594  // if the block has no time samples, don't bother with it.
595  if (hdr.nSamples() < 1) {
596  return true;
597  }
598 
599  if (!checkBlock(hdr)) {
600  return false;
601  } // Check the block to see if it's possible to unpack.
602 
603  // The header validity check above will protect against
604  // the map::find() method returning the end of the map,
605  // assuming the block header definitions are up-to-date.
606  (this->*m_blockUnpackFn.find(hdr.blockId())->second)(data,
607  hdr); // Calls the correct unpack function, based on block ID.
608 
609  return true;
610 }
bool checkBlock(const GctBlockHeader &hdr) const
Performs checks on the block header to see if the block is possible to unpack or not.
U second(std::pair< T, U > const &p)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
static const BlockIdToUnpackFnMap m_blockUnpackFn
Block ID to unpack function map.
GctBlockHeader GctFormatTranslateV35::generateBlockHeader ( const unsigned char *  data) const
overridevirtual

Generate a block header from four 8-bit values.

Implements GctFormatTranslateBase.

Definition at line 564 of file GctFormatTranslateV35.cc.

References blockLengthMap(), PresampleTask_cfi::nSamples, and validateGeometry_cfg::valid.

564  {
565  // Turn the four 8-bit header words into the full 32-bit header.
566  uint32_t hdr = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24);
567 
568  // Bit mapping of V35 header:
569  // --------------------------
570  // 11:0 => block_id Unique pipeline identifier.
571  // - 3:0 =>> pipe_id There can be up to 16 different pipelines per FPGA.
572  // - 6:4 =>> reserved Do not use yet. Set to zero.
573  // - 11:7 =>> fpga geograpical add The VME geographical address of the FPGA.
574  // 15:12 => event_id Determined locally. Not reset by Resync.
575  // 19:16 => number_of_time_samples If time samples 15 or more then value = 15.
576  // 31:20 => event_bcid The bunch crossing the data was recorded.
577 
578  unsigned blockId = hdr & 0xfff;
579  unsigned blockLength = 0; // Set to zero until we know it's a valid block
580  unsigned nSamples = (hdr >> 16) & 0xf;
581  unsigned bxId = (hdr >> 20) & 0xfff;
582  unsigned eventId = (hdr >> 12) & 0xf;
583  bool valid = (blockLengthMap().find(blockId) != blockLengthMap().end());
584 
585  if (valid) {
586  blockLength = blockLengthMap().find(blockId)->second;
587  }
588 
589  return GctBlockHeader(blockId, blockLength, nSamples, bxId, eventId, valid);
590 }
Simple class for holding the basic attributes of an 32-bit block header.
const BlockLengthMap & blockLengthMap() const final
get the static block ID to block-length map.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
uint32_t GctFormatTranslateV35::generateRawHeader ( const uint32_t  blockId,
const uint32_t  nSamples,
const uint32_t  bxId,
const uint32_t  eventId 
) const
overrideprotectedvirtual

Returns a raw 32-bit header word generated from the blockId, number of time samples, bunch-crossing and event IDs.

Implements GctFormatTranslateBase.

Definition at line 614 of file GctFormatTranslateV35.cc.

Referenced by internEmIsoBounds().

617  {
618  // Bit mapping of V35 header:
619  // --------------------------
620  // 11:0 => block_id Unique pipeline identifier.
621  // - 3:0 =>> pipe_id There can be up to 16 different pipelines per FPGA.
622  // - 6:4 =>> reserved Do not use yet. Set to zero.
623  // - 11:7 =>> fpga geograpical add The VME geographical address of the FPGA.
624  // 15:12 => event_id Determined locally. Not reset by Resync.
625  // 19:16 => number_of_time_samples If time samples 15 or more then value = 15.
626  // 31:20 => event_bxId The bunch crossing the data was recorded.
627 
628  return ((bxId & 0xfff) << 20) | ((nSamples & 0xf) << 16) | ((eventId & 0xf) << 12) | (blockId & 0xfff);
629 }
const BlockIdToEmCandIsoBoundMap& GctFormatTranslateV35::internEmIsoBounds ( ) const
inlinefinalprotectedvirtual

get the static intern EM cand isolated boundary map.

Implements GctFormatTranslateBase.

Definition at line 58 of file GctFormatTranslateV35.h.

References generateRawHeader(), m_internEmIsoBounds, and PresampleTask_cfi::nSamples.

Referenced by blockToGctInternEmCand().

const BlkToRctCrateMap& GctFormatTranslateV35::rctEmCrateMap ( ) const
inlinefinalprotectedvirtual

get static the block ID to RCT crate map for electrons.

Implements GctFormatTranslateBase.

Definition at line 50 of file GctFormatTranslateV35.h.

References m_rctEmCrate.

Referenced by blockToRctEmCand().

const BlkToRctCrateMap& GctFormatTranslateV35::rctJetCrateMap ( ) const
inlinefinalprotectedvirtual

get the static block ID to RCT crate map for jets

Implements GctFormatTranslateBase.

Definition at line 54 of file GctFormatTranslateV35.h.

References m_rctJetCrate.

Referenced by blockToRctCaloRegions().

Member Data Documentation

const GctFormatTranslateV35::BlockLengthMap GctFormatTranslateV35::m_blockLength
staticprivate

Map to translate block number to fundamental size of a block (i.e. for 1 time-sample).

Definition at line 80 of file GctFormatTranslateV35.h.

Referenced by blockLengthMap().

const GctFormatTranslateV35::BlockNameMap GctFormatTranslateV35::m_blockName
staticprivate

Map to hold a description for each block number.

Definition at line 83 of file GctFormatTranslateV35.h.

Referenced by blockNameMap().

const GctFormatTranslateV35::BlockIdToUnpackFnMap GctFormatTranslateV35::m_blockUnpackFn
staticprivate

Block ID to unpack function map.

Definition at line 96 of file GctFormatTranslateV35.h.

Referenced by convertBlock().

const GctFormatTranslateV35::BlockIdToEmCandIsoBoundMap GctFormatTranslateV35::m_internEmIsoBounds
staticprivate
Initial value:
= {
{0x680, IsoBoundaryPair(8, 15)},
{0x800, IsoBoundaryPair(0, 9)},
{0x803, IsoBoundaryPair(0, 1)},
{0x880, IsoBoundaryPair(0, 7)},
{0x883, IsoBoundaryPair(0, 1)},
{0xc00, IsoBoundaryPair(0, 9)},
{0xc03, IsoBoundaryPair(0, 1)},
{0xc80, IsoBoundaryPair(0, 7)},
{0xc83, IsoBoundaryPair(0, 1)}}

A map of Block IDs to IsoBoundaryPairs for storing the location of the isolated Internal EM cands in the pipeline, as this differs with Block ID.

Definition at line 93 of file GctFormatTranslateV35.h.

Referenced by internEmIsoBounds().

const GctFormatTranslateV35::BlkToRctCrateMap GctFormatTranslateV35::m_rctEmCrate
staticprivate
Initial value:
= {
{0x804, 13}, {0x884, 9}, {0xc04, 4}, {0xc84, 0}}

Map to relate capture block ID to the RCT crate the data originated from (for electrons).

Definition at line 86 of file GctFormatTranslateV35.h.

Referenced by rctEmCrateMap().

const GctFormatTranslateV35::BlkToRctCrateMap GctFormatTranslateV35::m_rctJetCrate
staticprivate
Initial value:
= {
{0x900, 9},
{0x908, 10},
{0x988, 17},
{0xa00, 12},
{0xa08, 13},
{0xa88, 11},
{0xb00, 15},
{0xb08, 16},
{0xb88, 14},
{0xd00, 0},
{0xd08, 1},
{0xd88, 8},
{0xe00, 3},
{0xe08, 4},
{0xe88, 2},
{0xf00, 6},
{0xf08, 7},
{0xf88, 5}
}

Map to relate capture block ID to the RCT crate the data originated from (for jets).

Definition at line 89 of file GctFormatTranslateV35.h.

Referenced by rctJetCrateMap().