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 | Private Attributes | Static Private Attributes
GctFormatTranslateV38 Class Reference

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

#include <GctFormatTranslateV38.h>

Inheritance diagram for GctFormatTranslateV38:
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...
 
 GctFormatTranslateV38 (bool hltMode=false, bool unpackSharedRegions=false, unsigned numberOfGctSamplesToUnpack=1, unsigned numberOfRctSamplesToUnpack=1)
 Constructor. More...
 
virtual GctBlockHeader generateBlockHeader (const unsigned char *data) const override
 Generate a block header from four 8-bit values. More...
 
virtual ~GctFormatTranslateV38 ()
 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(GctFormatTranslateV38::* 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 blockToGctInternHtMissPostWheel (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT internal Missing Ht data that is either wheel output or concJet input (i.e. after wheel processing). More...
 
void blockToGctInternHtMissPreWheel (const unsigned char *d, const GctBlockHeader &hdr)
 unpack GCT internal Missing Ht data that is being input to the wheels. 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...
 

Private Attributes

const unsigned m_numberOfGctSamplesToUnpack
 Number of BXs of GCT data to unpack (assuming they are in the raw data) More...
 
const unsigned m_numberOfRctSamplesToUnpack
 

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 V38 raw format.

Author
Robert Frazier

Definition at line 17 of file GctFormatTranslateV38.h.

Member Typedef Documentation

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

Typedef for a block ID to unpack function map.

Definition at line 78 of file GctFormatTranslateV38.h.

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

Function pointer typdef to a block unpack function.

Definition at line 76 of file GctFormatTranslateV38.h.

Constructor & Destructor Documentation

GctFormatTranslateV38::GctFormatTranslateV38 ( bool  hltMode = false,
bool  unpackSharedRegions = false,
unsigned  numberOfGctSamplesToUnpack = 1,
unsigned  numberOfRctSamplesToUnpack = 1 
)
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 557 of file GctFormatTranslateV38.cc.

559  :
561  m_numberOfGctSamplesToUnpack(numberOfGctSamplesToUnpack),
562  m_numberOfRctSamplesToUnpack(numberOfRctSamplesToUnpack)
563 {
564 }
GctFormatTranslateBase(bool hltMode=false, bool unpackSharedRegions=false)
Constructor.
const unsigned m_numberOfGctSamplesToUnpack
Number of BXs of GCT data to unpack (assuming they are in the raw data)
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
const unsigned m_numberOfRctSamplesToUnpack
GctFormatTranslateV38::~GctFormatTranslateV38 ( )
virtual

Destructor.

Definition at line 566 of file GctFormatTranslateV38.cc.

567 {
568 }

Member Function Documentation

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

get the static block ID to block-length map.

Implements GctFormatTranslateBase.

Definition at line 52 of file GctFormatTranslateV38.h.

References m_blockLength.

Referenced by generateBlockHeader().

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

get the static block ID to blockname map.

Implements GctFormatTranslateBase.

Definition at line 54 of file GctFormatTranslateV38.h.

References m_blockName.

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

unpack Fibres

Definition at line 944 of file GctFormatTranslateV38.cc.

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

Referenced by blockToFibresAndToRctEmCand().

945 {
946  // Don't want to do this in HLT optimisation mode!
947  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of GCT Fibres"; return; }
948 
949  unsigned int id = hdr.blockId();
950  unsigned int nSamples = hdr.nSamples();
951  unsigned int length = hdr.blockLength();
952 
953  // re-interpret pointer
954  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
955 
956  for (unsigned int i=0; i<length; ++i) {
957  for (unsigned int bx=0; bx<nSamples; ++bx) {
958  colls()->gctFibres()->push_back( L1GctFibreWord(*p, id, i, bx) );
959  ++p;
960  }
961  }
962 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
Global Calorimeter Trigger SC -&gt; 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.
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 GctFormatTranslateV38::blockToFibresAndToRctEmCand ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack Fibres and RCT EM Candidates

Definition at line 964 of file GctFormatTranslateV38.cc.

References blockToFibres(), and blockToRctEmCand().

965 {
966  this->blockToRctEmCand(d, hdr);
967  this->blockToFibres(d, hdr);
968 }
void blockToFibres(const unsigned char *d, const GctBlockHeader &hdr)
unpack Fibres
void blockToRctEmCand(const unsigned char *d, const GctBlockHeader &hdr)
unpack RCT EM Candidates
void GctFormatTranslateV38::blockToGctEmCandsAndEnergySums ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT EM Candidates and energy sums.

Definition at line 642 of file GctFormatTranslateV38.cc.

References GctBlockHeader::blockId(), GctFormatTranslateBase::colls(), castor_dqm_sourceclient_file_cfg::firstSample, GctUnpackCollections::gctEtHad(), GctUnpackCollections::gctEtMiss(), GctUnpackCollections::gctEtTot(), GctUnpackCollections::gctIsoEm(), GctUnpackCollections::gctNonIsoEm(), castor_dqm_sourceclient_file_cfg::lastSample, LogDebug, m_numberOfGctSamplesToUnpack, bookConverter::min, GctBlockHeader::nSamples(), and evf::evtn::offset().

643 {
644  const unsigned int id = hdr.blockId();
645  const unsigned int nSamples = hdr.nSamples();
646 
647  // Re-interpret pointer. p16 will be pointing at the 16 bit word that
648  // contains the rank0 non-isolated electron of the zeroth time-sample.
649  const uint16_t * p16 = reinterpret_cast<const uint16_t *>(d);
650 
651  // UNPACK EM CANDS
652 
653  const unsigned int emCandCategoryOffset = nSamples * 4; // Offset to jump from the non-iso electrons to the isolated ones.
654  const unsigned int timeSampleOffset = nSamples * 2; // Offset to jump to next candidate pair in the same time-sample.
655 
656  unsigned int samplesToUnpack = std::min(nSamples,m_numberOfGctSamplesToUnpack); // Unpack as many as asked for if they are in the raw data
657  unsigned int centralSample = (unsigned)std::ceil((double)nSamples/2.)-1; // think this works when nSamples is even, need to check!!!
658  unsigned int firstSample = centralSample-(unsigned)std::ceil((double)samplesToUnpack/2.)+1;
659  unsigned int lastSample = centralSample+(unsigned)(samplesToUnpack/2);
660 
661  LogDebug("GCT") << "Unpacking output EM. Central sample=" << centralSample << " first=" << firstSample << " last=" << lastSample;
662 
663  for (unsigned int iso=0; iso<2; ++iso) // loop over non-iso/iso candidate pairs
664  {
665  bool isoFlag = (iso==1);
666 
667  // Get the correct collection to put them in.
669  if (isoFlag) { em = colls()->gctIsoEm(); }
670  else { em = colls()->gctNonIsoEm(); }
671 
672  for (unsigned int bx=firstSample; bx<=lastSample; ++bx) // loop over samples to be unpacked
673  {
674  // cand0Offset will give the offset on p16 to get the rank 0 candidate
675  // of the correct category and timesample.
676  const unsigned int cand0Offset = iso*emCandCategoryOffset + bx*2;
677 
678  em->push_back(L1GctEmCand(p16[cand0Offset], isoFlag, id, 0, (int)bx-(int)centralSample)); // rank0 electron
679  em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset], isoFlag, id, 1, (int)bx-(int)centralSample)); // rank1 electron
680  em->push_back(L1GctEmCand(p16[cand0Offset + 1], isoFlag, id, 2, (int)bx-(int)centralSample)); // rank2 electron
681  em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset + 1], isoFlag, id, 3, (int)bx-(int)centralSample)); // rank3 electron
682 
683  LogDebug("GCT") << "Unpacked a bunch of EG. iso=" << iso << " bx=" << bx << std::endl;
684  }
685  }
686 
687  p16 += emCandCategoryOffset * 2; // Move the pointer over the data we've already unpacked.
688 
689  // UNPACK ENERGY SUMS
690 
691  for (unsigned int bx=firstSample; bx<=lastSample; ++bx) // loop over all time samples
692  {
693  const unsigned int offset = bx*2;
694  colls()->gctEtTot()->push_back(L1GctEtTotal(p16[offset],(int)bx-(int)centralSample)); // Et total
695  colls()->gctEtHad()->push_back(L1GctEtHad(p16[offset+1],(int)bx-(int)centralSample)); // Et hadronic
696  }
697 
698  p16 += nSamples * 2;
699 
700  // 32-bit pointer for getting Missing Et.
701  const uint32_t * p32 = reinterpret_cast<const uint32_t *>(p16);
702 
703  for (unsigned int bx=firstSample; bx<=lastSample; ++bx) {
704  colls()->gctEtMiss()->push_back(L1GctEtMiss(p32[bx],(int)bx-(int)centralSample)); // Et Miss
705  LogDebug("GCT") << "Unpacked energy sums bx=" << bx << std::endl;
706  }
707 
708 
709 }
#define LogDebug(id)
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
const unsigned m_numberOfGctSamplesToUnpack
Number of BXs of GCT data to unpack (assuming they are in the raw data)
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.
unsigned int offset(bool)
bool first
Definition: L1TdeRCT.cc:75
Persistable copy of total Ht measured at Level-1.
Definition: L1GctEtHad.h:18
for(const auto &pset:thresholds)
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 GctFormatTranslateV38::blockToGctInternEmCand ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal EM Candidates

Definition at line 777 of file GctFormatTranslateV38.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), GctFormatTranslateBase::colls(), end, newFWLiteAna::found, GctUnpackCollections::gctInternEm(), GctFormatTranslateBase::hltMode(), i, internEmIsoBounds(), LogDebug, GctBlockHeader::nSamples(), evf::evtn::offset(), and AlCaHLTBitMon_ParallelJobs::p.

778 {
779  // Don't want to do this in HLT optimisation mode!
780  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal EM Cands"; return; }
781 
782  unsigned int id = hdr.blockId();
783  unsigned int nSamples = hdr.nSamples();
784  unsigned int numCandPairs = hdr.blockLength();
785 
786  // Debug assertion to prevent problems if definitions not up to date.
787  auto found = internEmIsoBounds().find(id);
788  assert(found != internEmIsoBounds().end());
789 
790  unsigned int lowerIsoPairBound = found->second.first;
791  unsigned int upperIsoPairBound = found->second.second;
792 
793  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
794  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
795 
796  // Loop over timesamples (i.e. bunch crossings)
797  for(unsigned int bx=0; bx < nSamples; ++bx)
798  {
799  // Loop over candidate pairs (i.e. each iteration unpacks a pair of candidates)
800  for(unsigned int candPair = 0 ; candPair < numCandPairs ; ++candPair)
801  {
802  // Is the candidate electron pair an isolated pair or not?
803  bool iso = ((candPair>=lowerIsoPairBound) && (candPair<=upperIsoPairBound));
804 
805  // Loop over the two electron candidates in each pair
806  for(unsigned int i = 0 ; i < 2 ; ++i)
807  {
808  unsigned offset = 2*(bx + candPair*nSamples) + i;
809  uint16_t candRaw = p[offset];
810  colls()->gctInternEm()->push_back( L1GctInternEmCand(candRaw, iso, id, candPair*2 + i, bx) );
811  }
812  }
813  }
814 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
virtual const BlockIdToEmCandIsoBoundMap & internEmIsoBounds() const overridefinal
get the static intern EM cand isolated boundary map.
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
#define end
Definition: vmac.h:37
unsigned int offset(bool)
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
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 GctFormatTranslateV38::blockToGctInternEtSums ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal Et sums

Definition at line 970 of file GctFormatTranslateV38.cc.

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

971 {
972  // Don't want to do this in HLT optimisation mode!
973 
974  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Et Sums"; return; }
975 
976  unsigned int id = hdr.blockId();
977  unsigned int nSamples = hdr.nSamples();
978  unsigned int length = hdr.blockLength();
979 
980  // Re-interpret pointer to 32 bits
981  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
982 
983  for (unsigned int i=0; i<length; ++i) {
984  // Loop over timesamples (i.e. bunch crossings)
985  for (unsigned int bx=0; bx<nSamples; ++bx) {
986  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id,i,bx,*p));
987  ++p;
988  }
989  }
990 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
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.
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 GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal output of leaf jet finder

Definition at line 992 of file GctFormatTranslateV38.cc.

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

993 {
994  // Don't want to do this in HLT optimisation mode!
995  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands"; return; }
996 
997  unsigned int id = hdr.blockId();
998  unsigned int nSamples = hdr.nSamples();
999  unsigned int length = hdr.blockLength();
1000 
1001  // Re-interpret pointer to 32 bits
1002  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
1003 
1004  for (unsigned int i=0; i<length; ++i) {
1005  // Loop over timesamples (i.e. bunch crossings)
1006  for (unsigned int bx=0; bx<nSamples; ++bx) {
1007  if (i<2) colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetMissEt(id,i,bx,*p));
1008  if (i==3){
1009  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetTotEt(id,i,bx,*p));
1010  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetTotHt(id,i,bx,*p));
1011  }
1012  if (i>4) colls()->gctInternJets()->push_back(L1GctInternJetData::fromJetCluster(L1CaloRegionDetId(0,0),id,i,bx,*p));
1013  ++p;
1014  }
1015  }
1016 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
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.
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 GctFormatTranslateV38::blockToGctInternHtMissPostWheel ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal Missing Ht data that is either wheel output or concJet input (i.e. after wheel processing).

Definition at line 1193 of file GctFormatTranslateV38.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), GctFormatTranslateBase::colls(), GctUnpackCollections::gctInternHtMiss(), GctFormatTranslateBase::hltMode(), LogDebug, GctBlockHeader::nSamples(), AlCaHLTBitMon_ParallelJobs::p, L1GctInternHtMiss::unpackerMissHtx(), and L1GctInternHtMiss::unpackerMissHty().

1194 {
1195  // Don't want to do this in HLT optimisation mode!
1196  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of post-wheel internal Missing Ht data"; return; }
1197 
1198  unsigned int id = hdr.blockId();
1199  unsigned int nSamples = hdr.nSamples();
1200  unsigned int length = hdr.blockLength();
1201 
1202  // Re-interpret pointer to 32 bits
1203  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
1204 
1205  for (unsigned int iLength=0; iLength < length; ++iLength)
1206  {
1207  // Loop over timesamples (i.e. bunch crossings)
1208  for (unsigned int bx=0; bx<nSamples; ++bx)
1209  {
1210  if(iLength % 2) { colls()->gctInternHtMiss()->push_back(L1GctInternHtMiss::unpackerMissHty(id, iLength, bx, *p)); } // Hty on odd numbers
1211  else { colls()->gctInternHtMiss()->push_back(L1GctInternHtMiss::unpackerMissHtx(id, iLength, bx, *p)); } // Htx on even numbers
1212  ++p;
1213  }
1214  }
1215 }
#define LogDebug(id)
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
static L1GctInternHtMiss unpackerMissHty(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
Named ctor for making missing Ht y-component object from unpacker raw data.
L1GctInternHtMissCollection *const gctInternHtMiss() const
Internal missing Ht collection.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
static L1GctInternHtMiss unpackerMissHtx(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
Named ctor for making missing Ht x-component object from unpacker raw data.
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
void GctFormatTranslateV38::blockToGctInternHtMissPreWheel ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal Missing Ht data that is being input to the wheels.

Definition at line 1170 of file GctFormatTranslateV38.cc.

References GctBlockHeader::blockId(), GctBlockHeader::blockLength(), GctFormatTranslateBase::colls(), GctUnpackCollections::gctInternHtMiss(), GctFormatTranslateBase::hltMode(), LogDebug, GctBlockHeader::nSamples(), AlCaHLTBitMon_ParallelJobs::p, and L1GctInternHtMiss::unpackerMissHtxHty().

1171 {
1172  // Don't want to do this in HLT optimisation mode!
1173  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of pre-wheel internal Missing Ht data"; return; }
1174 
1175  unsigned int id = hdr.blockId();
1176  unsigned int nSamples = hdr.nSamples();
1177  unsigned int length = hdr.blockLength();
1178 
1179  // Re-interpret pointer to 32 bits
1180  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
1181 
1182  for (unsigned int iLength=0; iLength < length; ++iLength)
1183  {
1184  // Loop over timesamples (i.e. bunch crossings)
1185  for (unsigned int bx=0; bx<nSamples; ++bx)
1186  {
1187  colls()->gctInternHtMiss()->push_back(L1GctInternHtMiss::unpackerMissHtxHty(id, iLength, bx, *p));
1188  ++p;
1189  }
1190  }
1191 }
#define LogDebug(id)
static L1GctInternHtMiss unpackerMissHtxHty(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
Named ctor for making missing Ht x &amp; y components object from unpacker raw data (wheel input)...
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
L1GctInternHtMissCollection *const gctInternHtMiss() const
Internal missing Ht collection.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
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 GctFormatTranslateV38::blockToGctInternRingSums ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal HF ring sums

Definition at line 1087 of file GctFormatTranslateV38.cc.

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

1088 {
1089  // Don't want to do this in HLT optimisation mode!
1090  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal HF ring data"; return; }
1091 
1092  unsigned int id = hdr.blockId();
1093  unsigned int nSamples = hdr.nSamples();
1094  unsigned int length = hdr.blockLength();
1095 
1096  // Re-interpret pointer to 32 bits
1097  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
1098 
1099  for (unsigned int i=0; i<length/2; ++i) {
1100  // Loop over timesamples (i.e. bunch crossings)
1101  for (unsigned int bx=0; bx<nSamples; ++bx) {
1102  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromConcRingSums(id,i,bx,*p));
1103  ++p;
1104  }
1105  for (unsigned int bx=0; bx<nSamples; ++bx) {
1106  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromConcBitCounts(id,i,bx,*p));
1107  ++p;
1108  }
1109  }
1110 }
#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.
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.
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 GctFormatTranslateV38::blockToGctJetCandsAndCounts ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

Unpack GCT Jet Candidates and jet counts.

Definition at line 711 of file GctFormatTranslateV38.cc.

References GctBlockHeader::blockId(), GctFormatTranslateBase::colls(), castor_dqm_sourceclient_file_cfg::firstSample, GctFormatTranslateBase::FORWARD_JETS, L1GctHFBitCounts::fromConcHFBitCounts(), L1GctHFRingEtSums::fromConcRingSums(), GctUnpackCollections::gctHfBitCounts(), GctUnpackCollections::gctHfRingEtSums(), GctUnpackCollections::gctHtMiss(), GctFormatTranslateBase::gctJets(), fwrapper::jets, castor_dqm_sourceclient_file_cfg::lastSample, LogDebug, m_numberOfGctSamplesToUnpack, bookConverter::min, GctBlockHeader::nSamples(), GctFormatTranslateBase::NUM_JET_CATEGORIES, and GctFormatTranslateBase::TAU_JETS.

712 {
713  const unsigned int id = hdr.blockId(); // Capture block ID.
714  const unsigned int nSamples = hdr.nSamples(); // Number of time-samples.
715 
716  // Re-interpret block payload pointer to 16 bits so it sees one candidate at a time.
717  // p16 points to the start of the block payload, at the rank0 tau jet candidate.
718  const uint16_t * p16 = reinterpret_cast<const uint16_t *>(d);
719 
720  // UNPACK JET CANDS
721 
722  const unsigned int jetCandCategoryOffset = nSamples * 4; // Offset to jump from one jet category to the next.
723  const unsigned int timeSampleOffset = nSamples * 2; // Offset to jump to next candidate pair in the same time-sample.
724 
725  unsigned int samplesToUnpack = std::min(nSamples,m_numberOfGctSamplesToUnpack); // Unpack as many as asked for if they are in the raw data
726  unsigned int centralSample = (unsigned)std::ceil((double)nSamples/2.)-1; // think this works when nSamples is even, need to check!!!
727  unsigned int firstSample = centralSample-(unsigned)std::ceil((double)samplesToUnpack/2.)+1;
728  unsigned int lastSample = centralSample+(unsigned)(samplesToUnpack/2);
729 
730  LogDebug("GCT") << "Unpacking output Jets. Samples to unpack=" << samplesToUnpack << " central=" << centralSample << " first=" << firstSample << " last=" << lastSample;
731 
732  // Loop over the different catagories of jets
733  for(unsigned int iCat = 0 ; iCat < NUM_JET_CATEGORIES ; ++iCat)
734  {
735  L1GctJetCandCollection * const jets = gctJets(iCat);
736  assert(jets->empty()); // The supplied vector should be empty.
737 
738  bool tauflag = (iCat == TAU_JETS);
739  bool forwardFlag = (iCat == FORWARD_JETS);
740 
741  // Loop over the different timesamples (bunch crossings).
742  for(unsigned int bx = firstSample ; bx <=lastSample; ++bx)
743  {
744  // cand0Offset will give the offset on p16 to get the rank 0 Jet Cand of the correct category and timesample.
745  const unsigned int cand0Offset = iCat*jetCandCategoryOffset + bx*2;
746 
747  // Rank 0 Jet.
748  jets->push_back(L1GctJetCand(p16[cand0Offset], tauflag, forwardFlag, id, 0, (int)bx-(int)centralSample));
749  // Rank 1 Jet.
750  jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset], tauflag, forwardFlag, id, 1, (int)bx-(int)centralSample));
751  // Rank 2 Jet.
752  jets->push_back(L1GctJetCand(p16[cand0Offset + 1], tauflag, forwardFlag, id, 2, (int)bx-(int)centralSample));
753  // Rank 3 Jet.
754  jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset + 1], tauflag, forwardFlag, id, 3, (int)bx-(int)centralSample));
755  }
756  }
757 
758  p16 += NUM_JET_CATEGORIES * jetCandCategoryOffset; // Move the pointer over the data we've already unpacked.
759 
760  // NOW UNPACK: HFBitCounts, HFRingEtSums and Missing Ht
761 
762  // Re-interpret block payload pointer to 32 bits so it sees six jet counts at a time.
763  const uint32_t * p32 = reinterpret_cast<const uint32_t *>(p16);
764 
765  for (unsigned int bx=firstSample; bx<=lastSample; ++bx) // loop over all time samples
766  {
767  // Channel 0 carries both HF counts and sums
768  colls()->gctHfBitCounts()->push_back(L1GctHFBitCounts::fromConcHFBitCounts(id,6,(int)bx-(int)centralSample,p32[bx]));
769  colls()->gctHfRingEtSums()->push_back(L1GctHFRingEtSums::fromConcRingSums(id,6,(int)bx-(int)centralSample,p32[bx]));
770 
771  // Channel 1 carries Missing HT.
772  colls()->gctHtMiss()->push_back(L1GctHtMiss(p32[bx+nSamples], (int)bx-(int)centralSample));
773  }
774 }
#define LogDebug(id)
L1GctHFBitCountsCollection *const gctHfBitCounts() const
GCT output: Hadronic-Forward bit-counts collection.
L1GctHtMissCollection *const gctHtMiss() const
GCT output: Missing Ht collection.
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:18
std::vector< L1GctJetCand > L1GctJetCandCollection
const unsigned m_numberOfGctSamplesToUnpack
Number of BXs of GCT data to unpack (assuming they are in the raw data)
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
vector< PseudoJet > jets
tuple Jets
Definition: METSkim_cff.py:17
bool first
Definition: L1TdeRCT.cc:75
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.
for(const auto &pset:thresholds)
L1GctHFRingEtSumsCollection *const gctHfRingEtSums() const
GCT output: Hadronic-Forward ring-sums collection.
Persistable copy of missing Et measured at Level-1.
Definition: L1GctHtMiss.h:16
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 GctFormatTranslateV38::blockToGctJetClusterMinimal ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal input to wheel jet sort

Definition at line 1041 of file GctFormatTranslateV38.cc.

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

1042 {
1043  // Don't want to do this in HLT optimisation mode!
1044  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands"; return; }
1045 
1046  unsigned int id = hdr.blockId();
1047  unsigned int nSamples = hdr.nSamples();
1048  unsigned int length = hdr.blockLength();
1049 
1050  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
1051  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
1052 
1053  for (unsigned int i=0; i<length; ++i) {
1054  // Loop over timesamples (i.e. bunch crossings)
1055  for (unsigned int bx=0; bx<nSamples; ++bx) {
1057  ++p;
1059  ++p;
1060  }
1061  }
1062 }
#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;
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
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 GctFormatTranslateV38::blockToGctJetPreCluster ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal shared jet finder info

Definition at line 1064 of file GctFormatTranslateV38.cc.

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

1065 {
1066  // Don't want to do this in HLT optimisation mode!
1067  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands"; return; }
1068 
1069  unsigned int id = hdr.blockId();
1070  unsigned int nSamples = hdr.nSamples();
1071  unsigned int length = hdr.blockLength();
1072 
1073  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
1074  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
1075 
1076  for (unsigned int i=0; i<length; ++i) {
1077  // Loop over timesamples (i.e. bunch crossings)
1078  for (unsigned int bx=0; bx<nSamples; ++bx) {
1080  ++p;
1082  ++p;
1083  }
1084  }
1085 }
#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;
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
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 GctFormatTranslateV38::blockToGctTrigObjects ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal wheel and conc jets

Definition at line 1018 of file GctFormatTranslateV38.cc.

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

1019 {
1020  // Don't want to do this in HLT optimisation mode!
1021  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands"; return; }
1022 
1023  unsigned int id = hdr.blockId();
1024  unsigned int nSamples = hdr.nSamples();
1025  unsigned int length = hdr.blockLength();
1026 
1027  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
1028  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
1029 
1030  for (unsigned int i=0; i<length; ++i) {
1031  // Loop over timesamples (i.e. bunch crossings)
1032  for (unsigned int bx=0; bx<nSamples; ++bx) {
1034  ++p;
1036  ++p;
1037  }
1038  }
1039 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
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 GctFormatTranslateV38::blockToGctWheelInputInternEtAndRingSums ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal input to wheel

Definition at line 1112 of file GctFormatTranslateV38.cc.

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

1113 {
1114  // Don't want to do this in HLT optimisation mode!
1115  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of wheel input internal Et sums and HF ring data"; return; }
1116 
1117  unsigned int id = hdr.blockId();
1118  unsigned int nSamples = hdr.nSamples();
1119  unsigned int length = hdr.blockLength();
1120 
1121  // Re-interpret pointer to 32 bits
1122  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
1123 
1124  for (unsigned int i=0; i<length; ++i) {
1125  // Loop over timesamples (i.e. bunch crossings)
1126  for (unsigned int bx=0; bx<nSamples; ++bx) {
1127  if (i<3){
1128  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id,i,bx,*p));
1129  } else if (i>2 && i<9) {
1130  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromMissEtxOrEty(id,i,bx,*p));
1131  } else if (i>8 && i<15) {
1132  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelRingSums(id,i,bx,*p));
1133  } else if (i>14){
1134  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelBitCounts(id,i,bx,*p));
1135  }
1136  ++p;
1137  }
1138  }
1139 }
#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.
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)
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 GctFormatTranslateV38::blockToGctWheelOutputInternEtAndRingSums ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack GCT internal output of wheel

Definition at line 1141 of file GctFormatTranslateV38.cc.

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

1142 {
1143  // Don't want to do this in HLT optimisation mode!
1144  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of wheel output internal Et sums and HF ring data"; return; }
1145 
1146  unsigned int id = hdr.blockId();
1147  unsigned int nSamples = hdr.nSamples();
1148  unsigned int length = hdr.blockLength();
1149 
1150  // Re-interpret pointer to 32 bits
1151  const uint32_t * p = reinterpret_cast<const uint32_t *>(d);
1152 
1153  for (unsigned int i=0; i<length; ++i) {
1154  // Loop over timesamples (i.e. bunch crossings)
1155  for (unsigned int bx=0; bx<nSamples; ++bx) {
1156  if (i<1){
1157  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id,i,bx,*p));
1158  } else if (i>0 && i<3) {
1159  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromMissEtxOrEty(id,i,bx,*p));
1160  } else if (i>2 && i<5) {
1161  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelRingSums(id,i,bx,*p));
1162  } else if (i>4){
1163  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelBitCounts(id,i,bx,*p));
1164  }
1165  ++p;
1166  }
1167  }
1168 }
#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.
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)
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 GctFormatTranslateV38::blockToRctCaloRegions ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

Unpack RCT Calo Regions.

Definition at line 875 of file GctFormatTranslateV38.cc.

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

876 {
877  // Don't want to do this in HLT optimisation mode!
878  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of RCT Regions"; return; }
879 
880  unsigned int id = hdr.blockId();
881  unsigned int nSamples = hdr.nSamples();
882  unsigned int length = hdr.blockLength();
883 
884  // Debug assertion to prevent problems if definitions not up to date.
885  auto found = rctJetCrateMap().find(id);
886  assert(found != rctJetCrateMap().end());
887 
888  // get crate (need this to get ieta and iphi)
889  unsigned int crate=found->second;
890 
891  // re-interpret pointer
892  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
893 
894  // eta and phi
895  unsigned int ieta;
896  unsigned int iphi;
897 
898  for (unsigned int i=0; i<length; ++i)
899  {
900  for (uint16_t bx=0; bx<nSamples; ++bx)
901  {
902  // First figure out eta and phi
903  if (crate<9) { // negative eta
904  ieta = 12-i;
905  iphi = 2*((11-crate)%9);
906  }
907  else { // positive eta
908  ieta = 9+i;
909  iphi = 2*((20-crate)%9);
910  }
911 
912  // Skip the first four regions (i.e. where i<2) which are duplicates (shared data).
913  if (i>1) {
914  // First region is phi=0
915  colls()->rctCalo()->push_back( L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx) );
916  ++p;
917  // Second region is phi=1
918  if (iphi>0) { iphi-=1; }
919  else { iphi = 17; }
920  colls()->rctCalo()->push_back( L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx) );
921  ++p;
922  }
923  // Unpack the shared data if asked for debugging
924  else if (unpackSharedRegions()){
925  // First region is phi=0
926  colls()->rctCalo()->push_back( L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx) );
927  ++p;
928  // Second region is phi=1
929  if (iphi>0) { iphi-=1; }
930  else { iphi = 17; }
931  colls()->rctCalo()->push_back( L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx) );
932  ++p;
933 
934  } else { // Skip the shared data
935  ++p;
936  ++p;
937  }
938  }
939  }
940 }
#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
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.
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 GctFormatTranslateV38::blockToRctEmCand ( const unsigned char *  d,
const GctBlockHeader hdr 
)
private

unpack RCT EM Candidates

Definition at line 819 of file GctFormatTranslateV38.cc.

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

Referenced by blockToFibresAndToRctEmCand().

820 {
821  // Don't want to do this in HLT optimisation mode!
822  if(hltMode()) { LogDebug("GCT") << "HLT mode - skipping unpack of RCT EM Cands"; return; }
823 
824  unsigned int id = hdr.blockId();
825  unsigned int nSamples = hdr.nSamples();
826  unsigned int length = hdr.blockLength();
827 
828  // re-interpret pointer
829  const uint16_t * p = reinterpret_cast<const uint16_t *>(d);
830 
831  // arrays of source card data
832  uint16_t sfp[2][4]; // [ cycle ] [ SFP ]
833  uint16_t eIsoRank[4];
834  uint16_t eIsoCard[4];
835  uint16_t eIsoRgn[4];
836  uint16_t eNonIsoRank[4];
837  uint16_t eNonIsoCard[4];
838  uint16_t eNonIsoRgn[4];
839  uint16_t MIPbits[7][2];
840  uint16_t QBits[7][2];
841 
842  unsigned int bx = 0;
843 
844  auto found = rctEmCrateMap().find(id);
845  assert(found != rctEmCrateMap().end());
846  // loop over crates
847  for (unsigned int crate=found->second; crate<found->second+length/3; ++crate) {
848 
849  // read SC SFP words
850  for (unsigned short iSfp=0 ; iSfp<4 ; ++iSfp) {
851  for (unsigned short cyc=0 ; cyc<2 ; ++cyc) {
852  if (iSfp==0) { sfp[cyc][iSfp] = 0; } // muon bits
853  else { // EM candidate
854  sfp[cyc][iSfp] = *p;
855  ++p;
856  }
857  }
858  p = p + 2*(nSamples-1);
859  }
860 
861  // fill SC arrays
862  srcCardRouting().SFPtoEMU(eIsoRank, eIsoCard, eIsoRgn, eNonIsoRank, eNonIsoCard, eNonIsoRgn, MIPbits, QBits, sfp);
863 
864  // create EM cands
865  for (unsigned short int i=0; i<4; ++i) {
866  colls()->rctEm()->push_back( L1CaloEmCand( eIsoRank[i], eIsoRgn[i], eIsoCard[i], crate, true, i, bx) );
867  }
868  for (unsigned short int i=0; i<4; ++i) {
869  colls()->rctEm()->push_back( L1CaloEmCand( eNonIsoRank[i], eNonIsoRgn[i], eNonIsoCard[i], crate, false, i, bx) );
870  }
871  }
872 }
#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
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)
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.
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
virtual const BlkToRctCrateMap & rctEmCrateMap() const overridefinal
get static the block ID to RCT crate map for electrons.
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
bool GctFormatTranslateV38::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 598 of file GctFormatTranslateV38.cc.

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

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

Generate a block header from four 8-bit values.

Implements GctFormatTranslateBase.

Definition at line 570 of file GctFormatTranslateV38.cc.

References blockLengthMap(), and TrackValidation_HighPurity_cff::valid.

571 {
572  // Turn the four 8-bit header words into the full 32-bit header.
573  uint32_t hdr = data[0] + (data[1]<<8) + (data[2]<<16) + (data[3]<<24);
574 
575 // Bit mapping of V35 header:
576 // --------------------------
577 // 11:0 => block_id Unique pipeline identifier.
578 // - 3:0 =>> pipe_id There can be up to 16 different pipelines per FPGA.
579 // - 6:4 =>> reserved Do not use yet. Set to zero.
580 // - 11:7 =>> fpga geograpical add The VME geographical address of the FPGA.
581 // 15:12 => event_id Determined locally. Not reset by Resync.
582 // 19:16 => number_of_time_samples If time samples 15 or more then value = 15.
583 // 31:20 => event_bcid The bunch crossing the data was recorded.
584 
585  unsigned blockId = hdr & 0xfff;
586  unsigned blockLength = 0; // Set to zero until we know it's a valid block
587  unsigned nSamples = (hdr>>16) & 0xf;
588  unsigned bxId = (hdr>>20) & 0xfff;
589  unsigned eventId = (hdr>>12) & 0xf;
590  bool valid = (blockLengthMap().find(blockId) != blockLengthMap().end());
591 
592  if(valid) { blockLength = blockLengthMap().find(blockId)->second; }
593 
594  return GctBlockHeader(blockId, blockLength, nSamples, bxId, eventId, valid);
595 }
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.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
uint32_t GctFormatTranslateV38::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 616 of file GctFormatTranslateV38.cc.

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

get the static intern EM cand isolated boundary map.

Implements GctFormatTranslateBase.

Definition at line 60 of file GctFormatTranslateV38.h.

References m_internEmIsoBounds.

Referenced by blockToGctInternEmCand().

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

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

Implements GctFormatTranslateBase.

Definition at line 56 of file GctFormatTranslateV38.h.

References m_rctEmCrate.

Referenced by blockToRctEmCand().

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

get the static block ID to RCT crate map for jets

Implements GctFormatTranslateBase.

Definition at line 58 of file GctFormatTranslateV38.h.

References m_rctJetCrate.

Referenced by blockToRctCaloRegions().

Member Data Documentation

const GctFormatTranslateV38::BlockLengthMap GctFormatTranslateV38::m_blockLength
staticprivate

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

Definition at line 84 of file GctFormatTranslateV38.h.

Referenced by blockLengthMap().

const GctFormatTranslateV38::BlockNameMap GctFormatTranslateV38::m_blockName
staticprivate

Map to hold a description for each block number.

Definition at line 87 of file GctFormatTranslateV38.h.

Referenced by blockNameMap().

const GctFormatTranslateV38::BlockIdToUnpackFnMap GctFormatTranslateV38::m_blockUnpackFn
staticprivate

Block ID to unpack function map.

Definition at line 100 of file GctFormatTranslateV38.h.

Referenced by convertBlock().

const GctFormatTranslateV38::BlockIdToEmCandIsoBoundMap GctFormatTranslateV38::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 97 of file GctFormatTranslateV38.h.

Referenced by internEmIsoBounds().

const unsigned GctFormatTranslateV38::m_numberOfGctSamplesToUnpack
private

Number of BXs of GCT data to unpack (assuming they are in the raw data)

Number of BXs of RCT data to unpack (assuming they are in the raw data)

Definition at line 103 of file GctFormatTranslateV38.h.

Referenced by blockToGctEmCandsAndEnergySums(), and blockToGctJetCandsAndCounts().

const unsigned GctFormatTranslateV38::m_numberOfRctSamplesToUnpack
private

Definition at line 106 of file GctFormatTranslateV38.h.

const GctFormatTranslateV38::BlkToRctCrateMap GctFormatTranslateV38::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 90 of file GctFormatTranslateV38.h.

Referenced by rctEmCrateMap().

const GctFormatTranslateV38::BlkToRctCrateMap GctFormatTranslateV38::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 93 of file GctFormatTranslateV38.h.

Referenced by rctJetCrateMap().