test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual 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...
 
virtual GctBlockHeader generateBlockHeader (const unsigned char *data) const override
 Generate a block header from four 8-bit values. More...
 
virtual ~GctFormatTranslateV35 ()
 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

virtual const BlockLengthMapblockLengthMap () const overridefinal
 get the static block ID to block-length map. More...
 
virtual const BlockNameMapblockNameMap () const overridefinal
 get the static block ID to blockname map. More...
 
virtual 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...
 
virtual const
BlockIdToEmCandIsoBoundMap
internEmIsoBounds () const overridefinal
 get the static intern EM cand isolated boundary map. More...
 
virtual const BlkToRctCrateMaprctEmCrateMap () const overridefinal
 get static the block ID to RCT crate map for electrons. More...
 
virtual const BlkToRctCrateMaprctJetCrateMap () const overridefinal
 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,
PtrToUnpackFn
BlockIdToUnpackFnMap
 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,
IsoBoundaryPair
BlockIdToEmCandIsoBoundMap
 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 540 of file GctFormatTranslateV35.cc.

540  :
542 {
543 }
GctFormatTranslateBase(bool hltMode=false, bool unpackSharedRegions=false)
Constructor.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
GctFormatTranslateV35::~GctFormatTranslateV35 ( )
virtual

Destructor.

Definition at line 545 of file GctFormatTranslateV35.cc.

546 {
547 }

Member Function Documentation

virtual const BlockLengthMap& GctFormatTranslateV35::blockLengthMap ( ) const
inlinefinaloverrideprotectedvirtual

get the static block ID to block-length map.

Implements GctFormatTranslateBase.

Definition at line 49 of file GctFormatTranslateV35.h.

References m_blockLength.

Referenced by generateBlockHeader().

virtual const BlockNameMap& GctFormatTranslateV35::blockNameMap ( ) const
inlinefinaloverrideprotectedvirtual

get the static block ID to blockname map.

Implements GctFormatTranslateBase.

Definition at line 51 of file GctFormatTranslateV35.h.

References m_blockName.

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

unpack Fibres

Definition at line 879 of file GctFormatTranslateV35.cc.

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

Referenced by blockToFibresAndToRctEmCand().

880 {
881  // Don't want to do this in HLT optimisation mode!
882  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of GCT Fibres"; return; }
883 
884  unsigned int id = hdr.blockId();
885  unsigned int nSamples = hdr.nSamples();
886  unsigned int length = hdr.blockLength();
887 
888  // re-interpret pointer
889  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
890 
891  for (unsigned int i=0; i<length; ++i) {
892  for (unsigned int bx=0; bx<nSamples; ++bx) {
893  colls()->gctFibres()->push_back( L1GctFibreWord(*p, id, i, bx) );
894  ++p;
895  }
896  }
897 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
Global Calorimeter Trigger SC -&gt; CC fibre data word.
tuple d
Definition: ztail.py:151
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
constexpr size_t nSamples
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 899 of file GctFormatTranslateV35.cc.

References blockToFibres(), and blockToRctEmCand().

900 {
901  this->blockToRctEmCand(d, hdr);
902  this->blockToFibres(d, hdr);
903 }
void blockToFibres(const unsigned char *d, const GctBlockHeader &hdr)
unpack Fibres
tuple 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 617 of file GctFormatTranslateV35.cc.

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

618 {
619  const unsigned int id = hdr.blockId();
620  const unsigned int nSamples = hdr.nSamples();
621 
622  // Re-interpret pointer. p16 will be pointing at the 16 bit word that
623  // contains the rank0 non-isolated electron of the zeroth time-sample.
624  const uint16_t * p16 = reinterpret_cast<const uint16_t *>(d);
625 
626  // UNPACK EM CANDS
627 
628  const unsigned int emCandCategoryOffset = nSamples * 4; // Offset to jump from the non-iso electrons to the isolated ones.
629  const unsigned int timeSampleOffset = nSamples * 2; // Offset to jump to next candidate pair in the same time-sample.
630 
631  unsigned int samplesToUnpack = 1;
632  if(!hltMode()) { samplesToUnpack = nSamples; } // Only if not running in HLT mode do we want more than 1 timesample.
633 
634  for (unsigned int iso=0; iso<2; ++iso) // loop over non-iso/iso candidate pairs
635  {
636  bool isoFlag = (iso==1);
637 
638  // Get the correct collection to put them in.
640  if (isoFlag) { em = colls()->gctIsoEm(); }
641  else { em = colls()->gctNonIsoEm(); }
642 
643  for (unsigned int bx=0; bx<samplesToUnpack; ++bx) // loop over time samples
644  {
645  // cand0Offset will give the offset on p16 to get the rank 0 candidate
646  // of the correct category and timesample.
647  const unsigned int cand0Offset = iso*emCandCategoryOffset + bx*2;
648 
649  em->push_back(L1GctEmCand(p16[cand0Offset], isoFlag, id, 0, bx)); // rank0 electron
650  em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset], isoFlag, id, 1, bx)); // rank1 electron
651  em->push_back(L1GctEmCand(p16[cand0Offset + 1], isoFlag, id, 2, bx)); // rank2 electron
652  em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset + 1], isoFlag, id, 3, bx)); // rank3 electron
653  }
654  }
655 
656  p16 += emCandCategoryOffset * 2; // Move the pointer over the data we've already unpacked.
657 
658  // UNPACK ENERGY SUMS
659  // NOTE: we are only unpacking one timesample of these currently!
660 
661  colls()->gctEtTot()->push_back(L1GctEtTotal(p16[0])); // Et total (timesample 0).
662  colls()->gctEtHad()->push_back(L1GctEtHad(p16[1])); // Et hadronic (timesample 0).
663 
664  // 32-bit pointer for getting Missing Et.
665  const uint32_t * p32 = reinterpret_cast<const uint32_t *>(p16);
666 
667  colls()->gctEtMiss()->push_back(L1GctEtMiss(p32[nSamples])); // Et Miss (timesample 0).
668 }
L1GctEmCandCollection *const gctNonIsoEm() const
GCT output: Non-isolated EM candidate collection.
Persistable copy of missing Et measured at Level-1.
Definition: L1GctEtMiss.h:18
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:22
tuple d
Definition: ztail.py:151
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:18
L1GctEtMissCollection *const gctEtMiss() const
GCT output: Missing Et collection.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
constexpr size_t nSamples
Persistable copy of total Ht measured at Level-1.
Definition: L1GctEtHad.h:18
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 728 of file GctFormatTranslateV35.cc.

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

729 {
730  // Don't want to do this in HLT optimisation mode!
731  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal EM Cands"; return; }
732 
733  unsigned int id = hdr.blockId();
734  unsigned int nSamples = hdr.nSamples();
735  unsigned int numCandPairs = hdr.blockLength();
736 
737  // Debug assertion to prevent problems if definitions not up to date.
738  auto found = internEmIsoBounds().find(id);
740 
741  unsigned int lowerIsoPairBound = found->second.first;
742  unsigned int upperIsoPairBound = found->second.second;
743 
744  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
745  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
746 
747  // Loop over timesamples (i.e. bunch crossings)
748  for(unsigned int bx=0; bx < nSamples; ++bx)
749  {
750  // Loop over candidate pairs (i.e. each iteration unpacks a pair of candidates)
751  for(unsigned int candPair = 0 ; candPair < numCandPairs ; ++candPair)
752  {
753  // Is the candidate electron pair an isolated pair or not?
754  bool iso = ((candPair>=lowerIsoPairBound) && (candPair<=upperIsoPairBound));
755 
756  // Loop over the two electron candidates in each pair
757  for(unsigned int i = 0 ; i < 2 ; ++i)
758  {
759  unsigned offset = 2*(bx + candPair*nSamples) + i;
760  uint16_t candRaw = p[offset];
761  colls()->gctInternEm()->push_back( L1GctInternEmCand(candRaw, iso, id, candPair*2 + i, bx) );
762  }
763  }
764  }
765 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
virtual const BlockIdToEmCandIsoBoundMap & internEmIsoBounds() const overridefinal
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:7
tuple d
Definition: ztail.py:151
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
#define end
Definition: vmac.h:37
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
constexpr size_t nSamples
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 905 of file GctFormatTranslateV35.cc.

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

906 {
907  // Don't want to do this in HLT optimisation mode!
908 
909  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Et Sums"; return; }
910 
911  unsigned int id = hdr.blockId();
912  unsigned int nSamples = hdr.nSamples();
913  unsigned int length = hdr.blockLength();
914 
915  // Re-interpret pointer to 32 bits
916  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
917 
918  for (unsigned int i=0; i<length; ++i) {
919  // Loop over timesamples (i.e. bunch crossings)
920  for (unsigned int bx=0; bx<nSamples; ++bx) {
921  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id,i,bx,*p));
922  ++p;
923  }
924  }
925 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
static L1GctInternEtSum fromTotalEtOrHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
tuple d
Definition: ztail.py:151
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.
constexpr size_t nSamples
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 927 of file GctFormatTranslateV35.cc.

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

928 {
929  // Don't want to do this in HLT optimisation mode!
930  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands"; return; }
931 
932  unsigned int id = hdr.blockId();
933  unsigned int nSamples = hdr.nSamples();
934  unsigned int length = hdr.blockLength();
935 
936  // Re-interpret pointer to 32 bits
937  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
938 
939  for (unsigned int i=0; i<length; ++i) {
940  // Loop over timesamples (i.e. bunch crossings)
941  for (unsigned int bx=0; bx<nSamples; ++bx) {
942  if (i<2) colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetMissEt(id,i,bx,*p));
943  if (i==3){
944  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetTotEt(id,i,bx,*p));
945  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetTotHt(id,i,bx,*p));
946  }
947  if (i>4) colls()->gctInternJets()->push_back(L1GctInternJetData::fromJetCluster(L1CaloRegionDetId(0,0),id,i,bx,*p));
948  ++p;
949  }
950  }
951 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
tuple d
Definition: ztail.py:151
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.
constexpr size_t nSamples
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 &quot;jet_cluster&quot;
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 1022 of file GctFormatTranslateV35.cc.

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

1023 {
1024  // Don't want to do this in HLT optimisation mode!
1025  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal HF ring data"; return; }
1026 
1027  unsigned int id = hdr.blockId();
1028  unsigned int nSamples = hdr.nSamples();
1029  unsigned int length = hdr.blockLength();
1030 
1031  // Re-interpret pointer to 32 bits
1032  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
1033 
1034  for (unsigned int i=0; i<length/2; ++i) {
1035  // Loop over timesamples (i.e. bunch crossings)
1036  for (unsigned int bx=0; bx<nSamples; ++bx) {
1037  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromConcRingSums(id,i,bx,*p));
1038  ++p;
1039  }
1040  for (unsigned int bx=0; bx<nSamples; ++bx) {
1041  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromConcBitCounts(id,i,bx,*p));
1042  ++p;
1043  }
1044  }
1045 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
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.
tuple d
Definition: ztail.py:151
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.
constexpr size_t nSamples
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 670 of file GctFormatTranslateV35.cc.

References assert(), GctBlockHeader::blockId(), GctFormatTranslateBase::colls(), ztail::d, GctFormatTranslateBase::FORWARD_JETS, L1GctHFBitCounts::fromConcHFBitCounts(), L1GctHFRingEtSums::fromConcRingSums(), GctUnpackCollections::gctHfBitCounts(), GctUnpackCollections::gctHfRingEtSums(), GctFormatTranslateBase::gctJets(), GctFormatTranslateBase::hltMode(), fwrapper::jets, hgc_digi::nSamples, GctBlockHeader::nSamples(), GctFormatTranslateBase::NUM_JET_CATEGORIES, and GctFormatTranslateBase::TAU_JETS.

671 {
672  const unsigned int id = hdr.blockId(); // Capture block ID.
673  const unsigned int nSamples = hdr.nSamples(); // Number of time-samples.
674 
675  // Re-interpret block payload pointer to 16 bits so it sees one candidate at a time.
676  // p16 points to the start of the block payload, at the rank0 tau jet candidate.
677  const uint16_t * p16 = reinterpret_cast<const uint16_t *>(d);
678 
679  // UNPACK JET CANDS
680 
681  const unsigned int jetCandCategoryOffset = nSamples * 4; // Offset to jump from one jet category to the next.
682  const unsigned int timeSampleOffset = nSamples * 2; // Offset to jump to next candidate pair in the same time-sample.
683 
684  unsigned int samplesToUnpack = 1;
685  if(!hltMode()) { samplesToUnpack = nSamples; } // Only if not running in HLT mode do we want more than 1 timesample.
686 
687  // Loop over the different catagories of jets
688  for(unsigned int iCat = 0 ; iCat < NUM_JET_CATEGORIES ; ++iCat)
689  {
690  L1GctJetCandCollection * const jets = gctJets(iCat);
691  assert(jets->empty()); // The supplied vector should be empty.
692 
693  bool tauflag = (iCat == TAU_JETS);
694  bool forwardFlag = (iCat == FORWARD_JETS);
695 
696  // Loop over the different timesamples (bunch crossings).
697  for(unsigned int bx = 0 ; bx < samplesToUnpack ; ++bx)
698  {
699  // cand0Offset will give the offset on p16 to get the rank 0 Jet Cand of the correct category and timesample.
700  const unsigned int cand0Offset = iCat*jetCandCategoryOffset + bx*2;
701 
702  // Rank 0 Jet.
703  jets->push_back(L1GctJetCand(p16[cand0Offset], tauflag, forwardFlag, id, 0, bx));
704  // Rank 1 Jet.
705  jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset], tauflag, forwardFlag, id, 1, bx));
706  // Rank 2 Jet.
707  jets->push_back(L1GctJetCand(p16[cand0Offset + 1], tauflag, forwardFlag, id, 2, bx));
708  // Rank 3 Jet.
709  jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset + 1], tauflag, forwardFlag, id, 3, bx));
710  }
711  }
712 
713  p16 += NUM_JET_CATEGORIES * jetCandCategoryOffset; // Move the pointer over the data we've already unpacked.
714 
715  // NOW UNPACK: HFBitCounts, HFRingEtSums (no Missing Ht yet)
716  // NOTE: we are only unpacking one timesample of these currently!
717 
718  // Re-interpret block payload pointer to 32 bits so it sees six jet counts at a time.
719  const uint32_t * p32 = reinterpret_cast<const uint32_t *>(p16);
720 
721  // Channel 0 carries both HF counts and sums
722  colls()->gctHfBitCounts()->push_back(L1GctHFBitCounts::fromConcHFBitCounts(id,6,0,p32[0]));
723  colls()->gctHfRingEtSums()->push_back(L1GctHFRingEtSums::fromConcRingSums(id,6,0,p32[0]));
724  // Skip channel 1 for now. Later this may carry MHT would be accessed as p32[nSamples]
725 }
L1GctHFBitCountsCollection *const gctHfBitCounts() const
GCT output: Hadronic-Forward bit-counts collection.
assert(m_qm.get())
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:18
std::vector< L1GctJetCand > L1GctJetCandCollection
tuple d
Definition: ztail.py:151
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
vector< PseudoJet > jets
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
constexpr size_t nSamples
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 976 of file GctFormatTranslateV35.cc.

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

977 {
978  // Don't want to do this in HLT optimisation mode!
979  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands"; return; }
980 
981  unsigned int id = hdr.blockId();
982  unsigned int nSamples = hdr.nSamples();
983  unsigned int length = hdr.blockLength();
984 
985  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
986  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
987 
988  for (unsigned int i=0; i<length; ++i) {
989  // Loop over timesamples (i.e. bunch crossings)
990  for (unsigned int bx=0; bx<nSamples; ++bx) {
992  ++p;
994  ++p;
995  }
996  }
997 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
static L1GctInternJetData fromJetClusterMinimal(L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
construct from &quot;jet_cluster_minimal&quot;
tuple d
Definition: ztail.py:151
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
constexpr size_t nSamples
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 999 of file GctFormatTranslateV35.cc.

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

1000 {
1001  // Don't want to do this in HLT optimisation mode!
1002  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands"; return; }
1003 
1004  unsigned int id = hdr.blockId();
1005  unsigned int nSamples = hdr.nSamples();
1006  unsigned int length = hdr.blockLength();
1007 
1008  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
1009  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
1010 
1011  for (unsigned int i=0; i<length; ++i) {
1012  // Loop over timesamples (i.e. bunch crossings)
1013  for (unsigned int bx=0; bx<nSamples; ++bx) {
1015  ++p;
1017  ++p;
1018  }
1019  }
1020 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
static L1GctInternJetData fromJetPreCluster(L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
construct from &quot;jet_precluster&quot;
tuple d
Definition: ztail.py:151
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
constexpr size_t nSamples
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 953 of file GctFormatTranslateV35.cc.

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

954 {
955  // Don't want to do this in HLT optimisation mode!
956  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands"; return; }
957 
958  unsigned int id = hdr.blockId();
959  unsigned int nSamples = hdr.nSamples();
960  unsigned int length = hdr.blockLength();
961 
962  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
963  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
964 
965  for (unsigned int i=0; i<length; ++i) {
966  // Loop over timesamples (i.e. bunch crossings)
967  for (unsigned int bx=0; bx<nSamples; ++bx) {
969  ++p;
971  ++p;
972  }
973  }
974 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
tuple d
Definition: ztail.py:151
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
constexpr size_t nSamples
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 &quot;gct_trig_object&quot;
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 1047 of file GctFormatTranslateV35.cc.

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

1048 {
1049  // Don't want to do this in HLT optimisation mode!
1050  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of wheel input internal Et sums and HF ring data"; return; }
1051 
1052  unsigned int id = hdr.blockId();
1053  unsigned int nSamples = hdr.nSamples();
1054  unsigned int length = hdr.blockLength();
1055 
1056  // Re-interpret pointer to 32 bits
1057  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
1058 
1059  for (unsigned int i=0; i<length; ++i) {
1060  // Loop over timesamples (i.e. bunch crossings)
1061  for (unsigned int bx=0; bx<nSamples; ++bx) {
1062  if (i<3){
1063  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id,i,bx,*p));
1064  } else if (i>2 && i<9) {
1065  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromMissEtxOrEty(id,i,bx,*p));
1066  } else if (i>8 && i<15) {
1067  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelRingSums(id,i,bx,*p));
1068  } else if (i>14){
1069  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelBitCounts(id,i,bx,*p));
1070  }
1071  ++p;
1072  }
1073  }
1074 }
#define LogDebug(id)
static L1GctInternEtSum fromMissEtxOrEty(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
int i
Definition: DBlmapReader.cc:9
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.
tuple d
Definition: ztail.py:151
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.
constexpr size_t nSamples
static L1GctInternHFData fromWheelRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
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 1076 of file GctFormatTranslateV35.cc.

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

1077 {
1078  // Don't want to do this in HLT optimisation mode!
1079  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of wheel output internal Et sums and HF ring data"; return; }
1080 
1081  unsigned int id = hdr.blockId();
1082  unsigned int nSamples = hdr.nSamples();
1083  unsigned int length = hdr.blockLength();
1084 
1085  // Re-interpret pointer to 32 bits
1086  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
1087 
1088  for (unsigned int i=0; i<length; ++i) {
1089  // Loop over timesamples (i.e. bunch crossings)
1090  for (unsigned int bx=0; bx<nSamples; ++bx) {
1091  if (i<1){
1092  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id,i,bx,*p));
1093  } else if (i>0 && i<3) {
1094  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromMissEtxOrEty(id,i,bx,*p));
1095  } else if (i>2 && i<5) {
1096  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelRingSums(id,i,bx,*p));
1097  } else if (i>4){
1098  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelBitCounts(id,i,bx,*p));
1099  }
1100  ++p;
1101  }
1102  }
1103 }
#define LogDebug(id)
static L1GctInternEtSum fromMissEtxOrEty(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
int i
Definition: DBlmapReader.cc:9
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.
tuple d
Definition: ztail.py:151
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.
constexpr size_t nSamples
static L1GctInternHFData fromWheelRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
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 826 of file GctFormatTranslateV35.cc.

References assert(), GctBlockHeader::blockId(), GctBlockHeader::blockLength(), GctFormatTranslateBase::colls(), ztail::d, end, newFWLiteAna::found, GctFormatTranslateBase::hltMode(), i, LogDebug, L1CaloRegion::makeRegionFromUnpacker(), hgc_digi::nSamples, GctBlockHeader::nSamples(), AlCaHLTBitMon_ParallelJobs::p, GctUnpackCollections::rctCalo(), and rctJetCrateMap().

827 {
828  // Don't want to do this in HLT optimisation mode!
829  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of RCT Regions"; return; }
830 
831  unsigned int id = hdr.blockId();
832  unsigned int nSamples = hdr.nSamples();
833  unsigned int length = hdr.blockLength();
834 
835  // Debug assertion to prevent problems if definitions not up to date.
836  auto found = rctJetCrateMap().find(id);
837  assert(found != rctJetCrateMap().end());
838 
839  // get crate (need this to get ieta and iphi)
840  unsigned int crate=found->second;
841 
842  // re-interpret pointer
843  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
844 
845  // eta and phi
846  unsigned int ieta;
847  unsigned int iphi;
848 
849  for (unsigned int i=0; i<length; ++i) {
850  for (uint16_t bx=0; bx<nSamples; ++bx) {
851  if (i>0) {
852  if (crate<9){ // negative eta
853  ieta = 11-i;
854  iphi = 2*((11-crate)%9);
855  } else { // positive eta
856  ieta = 10+i;
857  iphi = 2*((20-crate)%9);
858  }
859  // First region is phi=0
860  colls()->rctCalo()->push_back( L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx) );
861  ++p;
862  // Second region is phi=1
863  if (iphi>0){
864  iphi-=1;
865  } else {
866  iphi = 17;
867  }
868  colls()->rctCalo()->push_back( L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx) );
869  ++p;
870  } else { // Skip the first two regions which are duplicates.
871  ++p;
872  ++p;
873  }
874  }
875  }
876 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
virtual const BlkToRctCrateMap & rctJetCrateMap() const overridefinal
get the static block ID to RCT crate map for jets
assert(m_qm.get())
tuple d
Definition: ztail.py:151
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
#define end
Definition: vmac.h:37
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
constexpr size_t nSamples
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
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 770 of file GctFormatTranslateV35.cc.

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

Referenced by blockToFibresAndToRctEmCand().

771 {
772  // Don't want to do this in HLT optimisation mode!
773  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of RCT EM Cands"; return; }
774 
775  unsigned int id = hdr.blockId();
776  unsigned int nSamples = hdr.nSamples();
777  unsigned int length = hdr.blockLength();
778 
779  // re-interpret pointer
780  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
781 
782  // arrays of source card data
783  uint16_t sfp[2][4]; // [ cycle ] [ SFP ]
784  uint16_t eIsoRank[4];
785  uint16_t eIsoCard[4];
786  uint16_t eIsoRgn[4];
787  uint16_t eNonIsoRank[4];
788  uint16_t eNonIsoCard[4];
789  uint16_t eNonIsoRgn[4];
790  uint16_t MIPbits[7][2];
791  uint16_t QBits[7][2];
792 
793  unsigned int bx = 0;
794 
795  // loop over crates
796  auto found = rctEmCrateMap().find(id);
797  assert(found != rctEmCrateMap().end());
798  for (unsigned int crate=found->second; crate<found->second+length/3; ++crate) {
799 
800  // read SC SFP words
801  for (unsigned short iSfp=0 ; iSfp<4 ; ++iSfp) {
802  for (unsigned short cyc=0 ; cyc<2 ; ++cyc) {
803  if (iSfp==0) { sfp[cyc][iSfp] = 0; } // muon bits
804  else { // EM candidate
805  sfp[cyc][iSfp] = *p;
806  ++p;
807  }
808  }
809  p = p + 2*(nSamples-1);
810  }
811 
812  // fill SC arrays
813  srcCardRouting().SFPtoEMU(eIsoRank, eIsoCard, eIsoRgn, eNonIsoRank, eNonIsoCard, eNonIsoRgn, MIPbits, QBits, sfp);
814 
815  // create EM cands
816  for (unsigned short int i=0; i<4; ++i) {
817  colls()->rctEm()->push_back( L1CaloEmCand( eIsoRank[i], eIsoRgn[i], eIsoCard[i], crate, true, i, bx) );
818  }
819  for (unsigned short int i=0; i<4; ++i) {
820  colls()->rctEm()->push_back( L1CaloEmCand( eNonIsoRank[i], eNonIsoRgn[i], eNonIsoCard[i], crate, false, i, bx) );
821  }
822  }
823 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
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
assert(m_qm.get())
virtual const BlkToRctCrateMap & rctEmCrateMap() const overridefinal
get static the block ID to RCT crate map for electrons.
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:18
const SourceCardRouting & srcCardRouting() const
Protected interface to the unpackSharedRegions commissioning option.
U second(std::pair< T, U > const &p)
tuple d
Definition: ztail.py:151
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
#define end
Definition: vmac.h:37
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
constexpr size_t nSamples
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 577 of file GctFormatTranslateV35.cc.

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

578 {
579  // if the block has no time samples, don't bother with it.
580  if ( hdr.nSamples() < 1 ) { return true; }
581 
582  if(!checkBlock(hdr)) { return false; } // Check the block to see if it's possible to unpack.
583 
584  // The header validity check above will protect against
585  // the map::find() method returning the end of the map,
586  // assuming the block header definitions are up-to-date.
587  (this->*m_blockUnpackFn.find(hdr.blockId())->second)(data, hdr); // Calls the correct unpack function, based on block ID.
588 
589  return true;
590 }
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)
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 549 of file GctFormatTranslateV35.cc.

References blockLengthMap(), and hgc_digi::nSamples.

550 {
551  // Turn the four 8-bit header words into the full 32-bit header.
552  uint32_t hdr = data[0] + (data[1]<<8) + (data[2]<<16) + (data[3]<<24);
553 
554 // Bit mapping of V35 header:
555 // --------------------------
556 // 11:0 => block_id Unique pipeline identifier.
557 // - 3:0 =>> pipe_id There can be up to 16 different pipelines per FPGA.
558 // - 6:4 =>> reserved Do not use yet. Set to zero.
559 // - 11:7 =>> fpga geograpical add The VME geographical address of the FPGA.
560 // 15:12 => event_id Determined locally. Not reset by Resync.
561 // 19:16 => number_of_time_samples If time samples 15 or more then value = 15.
562 // 31:20 => event_bcid The bunch crossing the data was recorded.
563 
564  unsigned blockId = hdr & 0xfff;
565  unsigned blockLength = 0; // Set to zero until we know it's a valid block
566  unsigned nSamples = (hdr>>16) & 0xf;
567  unsigned bxId = (hdr>>20) & 0xfff;
568  unsigned eventId = (hdr>>12) & 0xf;
569  bool valid = (blockLengthMap().find(blockId) != blockLengthMap().end());
570 
571  if(valid) { blockLength = blockLengthMap().find(blockId)->second; }
572 
573  return GctBlockHeader(blockId, blockLength, nSamples, bxId, eventId, valid);
574 }
virtual const BlockLengthMap & blockLengthMap() const overridefinal
get the static block ID to block-length map.
Simple class for holding the basic attributes of an 32-bit block header.
constexpr size_t nSamples
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 595 of file GctFormatTranslateV35.cc.

599 {
600  // Bit mapping of V35 header:
601  // --------------------------
602  // 11:0 => block_id Unique pipeline identifier.
603  // - 3:0 =>> pipe_id There can be up to 16 different pipelines per FPGA.
604  // - 6:4 =>> reserved Do not use yet. Set to zero.
605  // - 11:7 =>> fpga geograpical add The VME geographical address of the FPGA.
606  // 15:12 => event_id Determined locally. Not reset by Resync.
607  // 19:16 => number_of_time_samples If time samples 15 or more then value = 15.
608  // 31:20 => event_bxId The bunch crossing the data was recorded.
609 
610  return ((bxId & 0xfff) << 20) | ((nSamples & 0xf) << 16) | ((eventId & 0xf) << 12) | (blockId & 0xfff);
611 }
constexpr size_t nSamples
virtual const BlockIdToEmCandIsoBoundMap& GctFormatTranslateV35::internEmIsoBounds ( ) const
inlinefinaloverrideprotectedvirtual

get the static intern EM cand isolated boundary map.

Implements GctFormatTranslateBase.

Definition at line 57 of file GctFormatTranslateV35.h.

References m_internEmIsoBounds.

Referenced by blockToGctInternEmCand().

virtual const BlkToRctCrateMap& GctFormatTranslateV35::rctEmCrateMap ( ) const
inlinefinaloverrideprotectedvirtual

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

Implements GctFormatTranslateBase.

Definition at line 53 of file GctFormatTranslateV35.h.

References m_rctEmCrate.

Referenced by blockToRctEmCand().

virtual const BlkToRctCrateMap& GctFormatTranslateV35::rctJetCrateMap ( ) const
inlinefinaloverrideprotectedvirtual

get the static block ID to RCT crate map for jets

Implements GctFormatTranslateBase.

Definition at line 55 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 81 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 84 of file GctFormatTranslateV35.h.

Referenced by blockNameMap().

const GctFormatTranslateV35::BlockIdToUnpackFnMap GctFormatTranslateV35::m_blockUnpackFn
staticprivate

Block ID to unpack function map.

Definition at line 97 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 94 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 87 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 90 of file GctFormatTranslateV35.h.

Referenced by rctJetCrateMap().