CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1GTDigiToRaw Class Reference

#include <L1GTDigiToRaw.h>

Inheritance diagram for L1GTDigiToRaw:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1GTDigiToRaw (const edm::ParameterSet &)
 constructor(s) More...
 
 ~L1GTDigiToRaw () override
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 beginning of job stuff More...
 
void endJob () override
 end of job stuff More...
 
unsigned int flipPtQ (unsigned int)
 
void packFDL (const edm::EventSetup &, unsigned char *, L1GtFdlWord &)
 pack FDL blocks for various bunch crosses More...
 
unsigned int packGMT (L1MuGMTReadoutRecord const &, unsigned char *)
 pack a GMT record More...
 
unsigned int packGmtCollection (unsigned char *ptrGt, L1MuGMTReadoutCollection const *digis)
 pack the GMT collection using packGMT (GMT record packing) More...
 
void packGTFE (const edm::EventSetup &, unsigned char *, L1GtfeWord &, cms_uint16_t activeBoardsGtValue)
 
void packHeader (unsigned char *, edm::Event &)
 block packers -------—— More...
 
void packPSB (const edm::EventSetup &, unsigned char *, L1GtPsbWord &)
 
void packTrailer (unsigned char *, unsigned char *, int)
 pack trailer word More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 loop over events More...
 

Private Attributes

cms_uint16_t m_activeBoardsMaskGt
 mask for active boards More...
 
int m_daqGtFedId
 
edm::InputTag m_daqGtInputTag
 
edm::EDGetTokenT< L1GlobalTriggerReadoutRecordm_daqGtInputToken
 input tag for GT DAQ record More...
 
bool m_isDebugEnabled
 
int m_maxBxInEvent
 
int m_minBxInEvent
 
edm::InputTag m_muGmtInputTag
 
edm::EDGetTokenT< L1MuGMTReadoutCollectionm_muGmtInputToken
 input tag for GMT record More...
 
int m_totalBxInEvent
 total Bx's in the event, obtained from GTFE block More...
 
int m_verbosity
 verbosity level More...
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: generate raw data from digis.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna - GT
: Ivan Mikulec - HEPHY Vienna - GMT

Definition at line 45 of file L1GTDigiToRaw.h.

Constructor & Destructor Documentation

L1GTDigiToRaw::L1GTDigiToRaw ( const edm::ParameterSet pSet)
explicit

constructor(s)

Definition at line 60 of file L1GTDigiToRaw.cc.

References TauDecayModes::dec, LogDebug, m_activeBoardsMaskGt, m_daqGtFedId, m_daqGtInputTag, m_isDebugEnabled, m_muGmtInputTag, and m_verbosity.

60  :
61 
63  "DaqGtFedId", FEDNumbering::MAXTriggerGTPFEDID)),
64  m_daqGtInputToken(consumes<L1GlobalTriggerReadoutRecord>(pSet.getParameter<edm::InputTag> ("DaqGtInputTag"))),
65  m_muGmtInputToken(consumes<L1MuGMTReadoutCollection>(pSet.getParameter<edm::InputTag> ("MuGmtInputTag"))),
66  m_daqGtInputTag(pSet.getParameter<edm::InputTag> ("DaqGtInputTag")),
67  m_muGmtInputTag(pSet.getParameter<edm::InputTag> ("MuGmtInputTag")),
68  m_activeBoardsMaskGt(pSet.getParameter<unsigned int> ("ActiveBoardsMask")),
71  m_verbosity(pSet.getUntrackedParameter<int> ("Verbosity", 0)),
73 
74 {
75 
77  LogDebug("L1GTDigiToRaw")
78  << "\nFED Id for DAQ GT record: " << m_daqGtFedId << " \n"
79  << "\nInput tag for DAQ GT record: " << m_daqGtInputTag << " \n"
80  << "\nInput tag for GMT record: " << m_muGmtInputTag << " \n"
81  << "\nMask for active boards (hex format): " << std::hex
82  << std::setw(sizeof(m_activeBoardsMaskGt) * 2) << std::setfill('0')
84  << std::dec << std::setfill(' ') << " \n"
85  << std::endl;
86  }
87 
88  //
89  produces<FEDRawDataCollection> ();
90 
91 }
#define LogDebug(id)
T getParameter(std::string const &) const
bool isDebugEnabled()
T getUntrackedParameter(std::string const &, T const &) const
cms_uint16_t m_activeBoardsMaskGt
mask for active boards
edm::InputTag m_daqGtInputTag
edm::InputTag m_muGmtInputTag
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_daqGtInputToken
input tag for GT DAQ record
edm::EDGetTokenT< L1MuGMTReadoutCollection > m_muGmtInputToken
input tag for GMT record
int m_verbosity
verbosity level
int m_totalBxInEvent
total Bx&#39;s in the event, obtained from GTFE block
L1GTDigiToRaw::~L1GTDigiToRaw ( )
override

destructor

Definition at line 94 of file L1GTDigiToRaw.cc.

95 {
96 
97  // empty now
98 
99 }

Member Function Documentation

void L1GTDigiToRaw::beginJob ( void  )
overrideprivatevirtual

beginning of job stuff

Reimplemented from edm::EDProducer.

Definition at line 104 of file L1GTDigiToRaw.cc.

105 {
106 
107  // empty now
108 
109 }
void L1GTDigiToRaw::endJob ( void  )
overrideprivatevirtual

end of job stuff

Reimplemented from edm::EDProducer.

Definition at line 887 of file L1GTDigiToRaw.cc.

888 {
889 
890  // empty now
891 }
unsigned int L1GTDigiToRaw::flipPtQ ( unsigned int  w)
private

Definition at line 853 of file L1GTDigiToRaw.cc.

854 {
855  return ( (w&0xffff00ff) | ((~w)&0x0000ff00) );
856 }
const double w
Definition: UKUtility.cc:23
void L1GTDigiToRaw::packFDL ( const edm::EventSetup evSetup,
unsigned char *  ptrGt,
L1GtFdlWord fdlBlock 
)
private

pack FDL blocks for various bunch crosses

Definition at line 612 of file L1GTDigiToRaw.cc.

References TauDecayModes::dec, L1GtFdlWord::getSize(), LogDebug, LogTrace, m_isDebugEnabled, m_verbosity, L1GtFdlWord::setBoardIdWord64(), L1GtFdlWord::setBxInEventWord64(), L1GtFdlWord::setBxNrWord64(), L1GtFdlWord::setEventNrWord64(), L1GtFdlWord::setFinalORWord64(), L1GtFdlWord::setGtDecisionWordAWord64(), L1GtFdlWord::setGtDecisionWordBWord64(), L1GtFdlWord::setGtDecisionWordExtendedWord64(), L1GtFdlWord::setGtPrescaleFactorIndexAlgoWord64(), L1GtFdlWord::setGtPrescaleFactorIndexTechWord64(), L1GtFdlWord::setGtTechnicalTriggerWordWord64(), L1GtFdlWord::setLocalBxNrWord64(), L1GtFdlWord::setLumiSegmentNrWord64(), L1GtFdlWord::setNoAlgoWord64(), L1GtFdlWord::setOrbitNrWord64(), L1GtFdlWord::setPhysicsDeclaredWord64(), and L1GlobalTriggerReadoutSetup::UnitLength.

Referenced by produce().

613  {
614 
615  if (m_verbosity && m_isDebugEnabled) {
616 
617  LogDebug("L1GTDigiToRaw") << "\nPacking FDL \n" << std::endl;
618  }
619 
621 
622  // initialize the required number of word64
623  int nrWord64 = fdlBlock.getSize() / uLength;
624  std::vector<cms_uint64_t> tmpWord64;
625  tmpWord64.resize(nrWord64);
626 
627  for (int iWord = 0; iWord < nrWord64; ++iWord) {
628  tmpWord64[iWord] = 0x0000000000000000ULL;
629  }
630 
631  // fill the values in the words
632  for (int iWord = 0; iWord < nrWord64; ++iWord) {
633 
634  fdlBlock.setBoardIdWord64(tmpWord64[iWord], iWord);
635  fdlBlock.setBxInEventWord64(tmpWord64[iWord], iWord);
636  fdlBlock.setBxNrWord64(tmpWord64[iWord], iWord);
637  fdlBlock.setEventNrWord64(tmpWord64[iWord], iWord);
638 
639  fdlBlock.setGtTechnicalTriggerWordWord64(tmpWord64[iWord], iWord);
640 
641  fdlBlock.setGtDecisionWordAWord64(tmpWord64[iWord], iWord);
642  fdlBlock.setGtDecisionWordBWord64(tmpWord64[iWord], iWord);
643 
644  fdlBlock.setGtDecisionWordExtendedWord64(tmpWord64[iWord], iWord);
645 
646  fdlBlock.setPhysicsDeclaredWord64(tmpWord64[iWord], iWord);
647  fdlBlock.setGtPrescaleFactorIndexTechWord64(tmpWord64[iWord], iWord);
648  fdlBlock.setGtPrescaleFactorIndexAlgoWord64(tmpWord64[iWord], iWord);
649  fdlBlock.setNoAlgoWord64(tmpWord64[iWord], iWord);
650  fdlBlock.setFinalORWord64(tmpWord64[iWord], iWord);
651 
652  fdlBlock.setOrbitNrWord64(tmpWord64[iWord], iWord);
653  fdlBlock.setLumiSegmentNrWord64(tmpWord64[iWord], iWord);
654  fdlBlock.setLocalBxNrWord64(tmpWord64[iWord], iWord);
655 
656  }
657 
658  // put the words in the FED record
659 
660  cms_uint64_t* pw = reinterpret_cast<cms_uint64_t*> (const_cast<unsigned char*> (ptrGt));
661 
662  for (int iWord = 0; iWord < nrWord64; ++iWord) {
663 
664  *pw++ = tmpWord64[iWord];
665 
666  if (m_verbosity && m_isDebugEnabled) {
667 
668  LogTrace("L1GTDigiToRaw")
669  << std::setw(4) << iWord << " "
670  << std::hex << std::setfill('0') << std::setw(16) << tmpWord64[iWord] << std::dec
671  << std::setfill(' ')
672  << std::endl;
673  }
674  }
675 
676 }
#define LogDebug(id)
void setNoAlgoWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:642
void setGtDecisionWordBWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:471
static const int UnitLength
one unit in the word is UnitLength bits
void setBoardIdWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:196
void setLumiSegmentNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:700
const unsigned int getSize() const
get the size of the FDL block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtFdlWord.h:392
void setOrbitNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:682
void setGtTechnicalTriggerWordWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:311
void setGtPrescaleFactorIndexTechWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:603
void setBxInEventWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:217
void setPhysicsDeclaredWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:584
void setEventNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:258
void setBxNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:239
#define LogTrace(id)
void setGtDecisionWordExtendedWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:545
void setLocalBxNrWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:719
void setGtDecisionWordAWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:435
int m_verbosity
verbosity level
void setFinalORWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:664
unsigned long long cms_uint64_t
Definition: typedefs.h:17
void setGtPrescaleFactorIndexAlgoWord64(cms_uint64_t &word64, const int iWord)
Definition: L1GtFdlWord.cc:623
unsigned L1GTDigiToRaw::packGMT ( L1MuGMTReadoutRecord const &  gmtrr,
unsigned char *  chp 
)
private

pack a GMT record

Definition at line 757 of file L1GTDigiToRaw.cc.

References L1MuGMTReadoutRecord::getBCERR(), L1MuGMTReadoutRecord::getBrlRPCCands(), L1MuGMTReadoutRecord::getBxInEvent(), L1MuGMTReadoutRecord::getBxNr(), L1MuGMTReadoutRecord::getCSCCands(), L1MuGMTReadoutRecord::getDTBXCands(), L1MuGMTReadoutRecord::getEvNr(), L1MuGMTReadoutRecord::getFwdRPCCands(), L1MuGMTReadoutRecord::getGMTBrlCands(), L1MuGMTReadoutRecord::getGMTCands(), L1MuGMTReadoutRecord::getGMTFwdCands(), mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, createTree::pp, SIZE, and w.

Referenced by packGmtCollection().

758 {
759 
760  const unsigned SIZE=136;
761  const unsigned boardId=0xdd12;
762  memset(chp,0,SIZE);
763 
764  unsigned* p = (unsigned*) chp;
765 
766  // event number + bcerr
767  *p++ = (gmtrr.getEvNr()&0xffffff) | ((gmtrr.getBCERR()&0xff)<<24);
768  // bx number, bx in event, length(?), board-id(?)
769  *p++ = (gmtrr.getBxNr()&0xfff) | ((gmtrr.getBxInEvent()&0xf)<<12) | (boardId<<16);
770 
771  std::vector<L1MuRegionalCand> vrc;
772  std::vector<L1MuRegionalCand>::const_iterator irc;
773  unsigned* pp = p;
774 
775  vrc = gmtrr.getDTBXCands();
776  pp = p;
777  for(irc=vrc.begin(); irc!=vrc.end(); irc++) {
778  *pp++ = (*irc).getDataWord();
779  }
780  p+=4;
781 
782  vrc = gmtrr.getBrlRPCCands();
783  pp = p;
784  for(irc=vrc.begin(); irc!=vrc.end(); irc++) {
785  *pp++ = (*irc).getDataWord();
786  }
787  p+=4;
788 
789  vrc = gmtrr.getCSCCands();
790  pp = p;
791  for(irc=vrc.begin(); irc!=vrc.end(); irc++) {
792  *pp++ = (*irc).getDataWord();
793  }
794  p+=4;
795 
796  vrc = gmtrr.getFwdRPCCands();
797  pp = p;
798  for(irc=vrc.begin(); irc!=vrc.end(); irc++) {
799  *pp++ = (*irc).getDataWord();
800  }
801  p+=4;
802 
803  // the regional candidates are written to the record with inverted Pt and qual bits
804  pp = p-16;
805  for(int i=0; i<16; i++) {
806  unsigned w = *pp;
807  *pp++ = (w&0xffff00ff) | ((~w)&0x0000ff00);
808  }
809 
810  std::vector<L1MuGMTExtendedCand> vgc;
811  std::vector<L1MuGMTExtendedCand>::const_iterator igc;
812 
813  vgc = gmtrr.getGMTBrlCands();
814  pp = p;
815  for(igc=vgc.begin(); igc!=vgc.end(); igc++) {
816  *pp++ = (*igc).getDataWord();
817  }
818  p+=4;
819 
820  vgc = gmtrr.getGMTFwdCands();
821  pp = p;
822  for(igc=vgc.begin(); igc!=vgc.end(); igc++) {
823  *pp++ = (*igc).getDataWord();
824  }
825  p+=4;
826 
827  vgc = gmtrr.getGMTCands();
828  pp = p;
829  for(igc=vgc.begin(); igc!=vgc.end(); igc++) {
830  *pp++ = (*igc).getDataWord();
831  }
832  p+=4;
833 
834  unsigned char* chpp;
835 
836  vgc = gmtrr.getGMTBrlCands();
837  chpp = (unsigned char*) p;
838  for(igc=vgc.begin(); igc!=vgc.end(); igc++) {
839  *chpp++ = (*igc).rank();
840  }
841  p++;
842 
843  vgc = gmtrr.getGMTFwdCands();
844  chpp = (unsigned char*) p;
845  for(igc=vgc.begin(); igc!=vgc.end(); igc++) {
846  *chpp++ = (*igc).rank();
847  }
848  p++;
849 
850  return SIZE;
851 }
const double w
Definition: UKUtility.cc:23
unsigned int L1GTDigiToRaw::packGmtCollection ( unsigned char *  ptrGt,
L1MuGMTReadoutCollection const *  digis 
)
private

pack the GMT collection using packGMT (GMT record packing)

Definition at line 733 of file L1GTDigiToRaw.cc.

References L1MuGMTReadoutCollection::getRecord(), LogDebug, m_isDebugEnabled, m_maxBxInEvent, m_minBxInEvent, m_totalBxInEvent, m_verbosity, and packGMT().

Referenced by produce().

736 {
737 
738  if (m_verbosity && m_isDebugEnabled) {
739  LogDebug("L1GTDigiToRaw") << "\nPacking GMT collection \n" << std::endl;
740  }
741 
742  unsigned gmtsize = 0;
743 
744  // loop range: int m_totalBxInEvent is normally even (L1A-1, L1A, L1A+1, with L1A = 0)
745  for (int iBxInEvent = m_minBxInEvent; iBxInEvent <= m_maxBxInEvent;
746  ++iBxInEvent) {
747  L1MuGMTReadoutRecord const& gmtrr = digis->getRecord(iBxInEvent);
748  gmtsize = packGMT(gmtrr, ptrGt);
749  ptrGt += gmtsize;
750  }
751 
752  return m_totalBxInEvent*gmtsize;
753 
754 }
#define LogDebug(id)
unsigned int packGMT(L1MuGMTReadoutRecord const &, unsigned char *)
pack a GMT record
int m_verbosity
verbosity level
int m_totalBxInEvent
total Bx&#39;s in the event, obtained from GTFE block
void L1GTDigiToRaw::packGTFE ( const edm::EventSetup evSetup,
unsigned char *  ptrGt,
L1GtfeWord gtfeBlock,
cms_uint16_t  activeBoardsGtValue 
)
private

pack the GTFE block gives the number of bunch crosses in the event, as well as the active boards records for inactive boards are not written in the GT DAQ record

Definition at line 558 of file L1GTDigiToRaw.cc.

References TauDecayModes::dec, L1GtfeWord::getSize(), LogDebug, LogTrace, m_isDebugEnabled, m_verbosity, L1GtfeWord::setActiveBoardsWord64(), L1GtfeWord::setAltNrBxBoardWord64(), L1GtfeWord::setBoardIdWord64(), L1GtfeWord::setBxNrWord64(), L1GtfeWord::setRecordLength1Word64(), L1GtfeWord::setRecordLengthWord64(), L1GtfeWord::setSetupVersionWord64(), L1GtfeWord::setTotalTriggerNrWord64(), and L1GlobalTriggerReadoutSetup::UnitLength.

Referenced by produce().

560  {
561 
562  if (m_verbosity && m_isDebugEnabled) {
563  LogDebug("L1GTDigiToRaw") << "\nPacking GTFE \n" << std::endl;
564  }
565 
567 
568  // initialize the required number of word64
569  int nrWord64 = gtfeBlock.getSize() / uLength;
570  std::vector<cms_uint64_t> tmpWord64;
571  tmpWord64.resize(nrWord64);
572 
573  for (int iWord = 0; iWord < nrWord64; ++iWord) {
574  tmpWord64[iWord] = 0x0000000000000000ULL;
575  }
576 
577  // fill the values in the words
578  for (int iWord = 0; iWord < nrWord64; ++iWord) {
579 
580  gtfeBlock.setBoardIdWord64(tmpWord64[iWord], iWord);
581  gtfeBlock.setRecordLength1Word64(tmpWord64[iWord], iWord);
582  gtfeBlock.setRecordLengthWord64(tmpWord64[iWord], iWord);
583  gtfeBlock.setBxNrWord64(tmpWord64[iWord], iWord);
584  gtfeBlock.setSetupVersionWord64(tmpWord64[iWord], iWord);
585  gtfeBlock.setActiveBoardsWord64(tmpWord64[iWord], iWord, activeBoardsGtValue);
586  gtfeBlock.setAltNrBxBoardWord64(tmpWord64[iWord], iWord);
587  gtfeBlock.setTotalTriggerNrWord64(tmpWord64[iWord], iWord);
588 
589  }
590 
591  // put the words in the FED record
592 
593  cms_uint64_t* pw = reinterpret_cast<cms_uint64_t*> (const_cast<unsigned char*> (ptrGt));
594 
595  for (int iWord = 0; iWord < nrWord64; ++iWord) {
596 
597  *pw++ = tmpWord64[iWord];
598 
599  if (m_verbosity && m_isDebugEnabled) {
600  LogTrace("L1GTDigiToRaw")
601  << std::setw(4) << iWord << " "
602  << std::hex << std::setfill('0') << std::setw(16) << tmpWord64[iWord] << std::dec
603  << std::setfill(' ')
604  << std::endl;
605  }
606  }
607 
608 }
#define LogDebug(id)
const unsigned int getSize() const
get the size of the GTFE block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtfeWord.h:229
void setRecordLength1Word64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:138
static const int UnitLength
one unit in the word is UnitLength bits
void setActiveBoardsWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:231
void setSetupVersionWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:194
void setBoardIdWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:120
#define LogTrace(id)
void setAltNrBxBoardWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:263
void setBxNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:176
int m_verbosity
verbosity level
unsigned long long cms_uint64_t
Definition: typedefs.h:17
void setTotalTriggerNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:293
void setRecordLengthWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtfeWord.cc:157
void L1GTDigiToRaw::packHeader ( unsigned char *  ptrGt,
edm::Event iEvent 
)
private

block packers -------——

pack header

Definition at line 516 of file L1GTDigiToRaw.cc.

References edm::EventBase::bunchCrossing(), TauDecayModes::dec, edm::EventID::event(), edm::EventBase::id(), LogDebug, m_daqGtFedId, m_isDebugEnabled, m_verbosity, and FEDHeader::set().

Referenced by produce().

516  {
517  // TODO FIXME where from to get all numbers?
518 
519  // Event Trigger type identifier
520  int triggerTypeVal = 0;
521 
522  // Level-1 event number generated by the TTC system
523  int lvl1IdVal = iEvent.id().event();
524 
525  // The bunch crossing number
526  int bxCross = iEvent.bunchCrossing();
527  cms_uint16_t bxCrossHw = 0;
528  if ( ( bxCross & 0xFFF ) == bxCross) {
529  bxCrossHw = static_cast<cms_uint16_t> (bxCross);
530  } else {
531  bxCrossHw = 0; // Bx number too large, set to 0!
532  if (m_verbosity && m_isDebugEnabled) {
533  LogDebug("L1GTDigiToRaw") << "\nBunch cross number [hex] = " << std::hex << bxCross
534  << "\n larger than 12 bits. Set to 0! \n" << std::dec << std::endl;
535  }
536  }
537  int bxIdVal = bxCrossHw;
538 
539  // Identifier of the FED
540  int sourceIdVal = m_daqGtFedId;
541 
542  // Version identifier of the FED data format
543  int versionVal = 0;
544 
545  // 0 -> the current header word is the last one.
546  // 1-> other header words can follow
547  // (always 1 for ECAL)
548  bool moreHeadersVal = false;
549 
550  FEDHeader gtFEDHeader(ptrGt);
551 
552  gtFEDHeader.set(
553  ptrGt, triggerTypeVal, lvl1IdVal, bxIdVal, sourceIdVal, versionVal, moreHeadersVal);
554 
555 }
#define LogDebug(id)
EventNumber_t event() const
Definition: EventID.h:41
int bunchCrossing() const
Definition: EventBase.h:66
unsigned short cms_uint16_t
Definition: typedefs.h:13
edm::EventID id() const
Definition: EventBase.h:60
int m_verbosity
verbosity level
void L1GTDigiToRaw::packPSB ( const edm::EventSetup evSetup,
unsigned char *  ptrGt,
L1GtPsbWord psbBlock 
)
private

pack PSB blocks packing is done in PSB class format

Definition at line 679 of file L1GTDigiToRaw.cc.

References TauDecayModes::dec, L1GtPsbWord::getSize(), LogDebug, LogTrace, m_isDebugEnabled, m_verbosity, L1GtPsbWord::setADataWord64(), L1GtPsbWord::setBDataWord64(), L1GtPsbWord::setBoardIdWord64(), L1GtPsbWord::setBxInEventWord64(), L1GtPsbWord::setBxNrWord64(), L1GtPsbWord::setEventNrWord64(), L1GtPsbWord::setLocalBxNrWord64(), and L1GlobalTriggerReadoutSetup::UnitLength.

Referenced by produce().

680  {
681  if (m_verbosity && m_isDebugEnabled) {
682 
683  LogDebug("L1GTDigiToRaw") << "\nPacking PSB \n" << std::endl;
684  }
685 
687 
688  // initialize the required number of word64
689  int nrWord64 = psbBlock.getSize() / uLength;
690  std::vector<cms_uint64_t> tmpWord64;
691  tmpWord64.resize(nrWord64);
692 
693  for (int iWord = 0; iWord < nrWord64; ++iWord) {
694  tmpWord64[iWord] = 0x0000000000000000ULL;
695  }
696 
697  // fill the values in the words
698  for (int iWord = 0; iWord < nrWord64; ++iWord) {
699 
700  psbBlock.setBoardIdWord64(tmpWord64[iWord], iWord);
701  psbBlock.setBxInEventWord64(tmpWord64[iWord], iWord);
702  psbBlock.setBxNrWord64(tmpWord64[iWord], iWord);
703  psbBlock.setEventNrWord64(tmpWord64[iWord], iWord);
704 
705  psbBlock.setADataWord64(tmpWord64[iWord], iWord);
706  psbBlock.setBDataWord64(tmpWord64[iWord], iWord);
707 
708  psbBlock.setLocalBxNrWord64(tmpWord64[iWord], iWord);
709 
710  }
711 
712  // put the words in the FED record
713 
714  cms_uint64_t* pw = reinterpret_cast<cms_uint64_t*> (const_cast<unsigned char*> (ptrGt));
715 
716  for (int iWord = 0; iWord < nrWord64; ++iWord) {
717 
718  *pw++ = tmpWord64[iWord];
719 
720  if (m_verbosity && m_isDebugEnabled) {
721 
722  LogTrace("L1GTDigiToRaw")
723  << std::setw(4) << iWord << " "
724  << std::hex << std::setfill('0') << std::setw(16) << tmpWord64[iWord] << std::dec
725  << std::setfill(' ')
726  << std::endl;
727  }
728  }
729 
730 }
#define LogDebug(id)
void setEventNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:216
static const int UnitLength
one unit in the word is UnitLength bits
void setBxNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:195
void setBxInEventWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:170
void setADataWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:295
void setLocalBxNrWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:418
void setBDataWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:379
#define LogTrace(id)
int m_verbosity
verbosity level
unsigned long long cms_uint64_t
Definition: typedefs.h:17
void setBoardIdWord64(cms_uint64_t &word64, int iWord)
Definition: L1GtPsbWord.cc:146
const unsigned int getSize() const
get the size of the PSB block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtPsbWord.h:198
void L1GTDigiToRaw::packTrailer ( unsigned char *  ptrGt,
unsigned char *  ptrGtBegin,
int  dataSize 
)
private

pack trailer word

Definition at line 859 of file L1GTDigiToRaw.cc.

References evf::compute_crc(), and FEDTrailer::set().

Referenced by produce().

859  {
860 
861  // TODO FIXME where from to get all numbers?
862 
863  // The length of the event fragment counted in 64-bit words including header and trailer
864  int lengthVal = dataSize / 8;
865 
866  // Cyclic Redundancy Code of the event fragment including header and trailer
867  int crcVal = evf::compute_crc(ptrGtBegin, dataSize);
868 
869  // Event fragment status information
870  int evtStatusVal = 0;
871 
872  // Current value of the Trigger Throttling System bits.
873  int ttsBitsVal = 0;
874 
875  // 0 -> the current trailer word is the last one.
876  // 1-> other trailer words can follow
877  // (always 0 for ECAL)
878  bool moreTrailersVal = false;
879 
880  FEDTrailer gtFEDTrailer(ptrGt);
881  gtFEDTrailer.set(ptrGt, lengthVal, crcVal, evtStatusVal, ttsBitsVal, moreTrailersVal);
882 
883 }
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
Definition: CRC16.h:67
void L1GTDigiToRaw::produce ( edm::Event iEvent,
const edm::EventSetup evSetup 
)
overrideprivate

loop over events

Definition at line 113 of file L1GTDigiToRaw.cc.

References L1GtfeWord::activeBoards(), L1GtfeWord::altNrBxBoard(), FEDRawData::data(), TauDecayModes::dec, FDL, edm::EventSetup::get(), edm::Event::getByToken(), L1GtPsbWord::getSize(), L1GtfeWord::getSize(), L1TcsWord::getSize(), L1GtFdlWord::getSize(), GMT, L1GtBoardMaps::gtBoardMaps(), L1GlobalTriggerReadoutRecord::gtFdlWord(), GTFE, L1GlobalTriggerReadoutRecord::gtfeWord(), L1GlobalTriggerReadoutRecord::gtPsbWord(), edm::HandleBase::isValid(), LogDebug, LogTrace, m_activeBoardsMaskGt, m_daqGtFedId, m_daqGtInputTag, m_daqGtInputToken, m_isDebugEnabled, m_maxBxInEvent, m_minBxInEvent, m_muGmtInputTag, m_muGmtInputToken, m_totalBxInEvent, m_verbosity, eostools::move(), packFDL(), packGmtCollection(), packGTFE(), packHeader(), packPSB(), packTrailer(), L1GlobalTriggerReadoutRecord::print(), L1GtPsbWord::print(), L1GtfeWord::print(), L1GtFdlWord::print(), edm::Handle< T >::product(), PSB, edm::Event::put(), L1GtfeWord::recordLength(), L1GtfeWord::recordLength1(), FEDRawData::resize(), FEDRawData::size(), TCS, and TIM.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

114 {
115 
116  // define new FEDRawDataCollection
117  // it contains ALL FEDs in an event
118  std::unique_ptr<FEDRawDataCollection> allFedRawData(new FEDRawDataCollection);
119 
120  FEDRawData& gtRawData = allFedRawData->FEDData(m_daqGtFedId);
121 
122  // get records from EventSetup
123 
124  // board maps
126  evSetup.get< L1GtBoardMapsRcd >().get( l1GtBM );
127 
128  const std::vector<L1GtBoard> boardMaps = l1GtBM->gtBoardMaps();
129  int boardMapsSize = boardMaps.size();
130 
131  typedef std::vector<L1GtBoard>::const_iterator CItBoardMaps;
132 
133  // create an ordered vector for the GT DAQ record
134  // header (pos 0 in record) and trailer (last position in record)
135  // not included, as they are not in board list
136  std::vector<L1GtBoard> gtRecordMap;
137  gtRecordMap.reserve(boardMapsSize);
138 
139  for (int iPos = 0; iPos < boardMapsSize; ++iPos) {
140  for (CItBoardMaps itBoard = boardMaps.begin(); itBoard
141  != boardMaps.end(); ++itBoard) {
142 
143  if (itBoard->gtPositionDaqRecord() == iPos) {
144  gtRecordMap.push_back(*itBoard);
145  break;
146  }
147 
148  }
149  }
150 
151 
152  // get L1GlobalTriggerReadoutRecord
154  iEvent.getByToken(m_daqGtInputToken, gtReadoutRecord);
155 
156  if (!gtReadoutRecord.isValid()) {
157  if (m_verbosity) {
158  edm::LogWarning("L1GTDigiToRaw")
159  << "\nWarning: L1GlobalTriggerReadoutRecord with input tag " << m_daqGtInputTag
160  << "\nrequested in configuration, but not found in the event."
161  << "\nQuit packing this event" << std::endl;
162  }
163 
164  // put the raw data in the event
165  iEvent.put(std::move(allFedRawData));
166 
167  return;
168  }
169 
170  if (m_verbosity && m_isDebugEnabled) {
171  std::ostringstream myCoutStream;
172  gtReadoutRecord->print(myCoutStream);
173  LogTrace("L1GTDigiToRaw")
174  << "\n The following L1 GT DAQ readout record will be packed.\n"
175  << " Some boards could be disabled before packing,"
176  << " see detailed board packing.\n" << myCoutStream.str() << "\n"
177  << std::endl;
178  }
179 
180  // get GTFE block
181  L1GtfeWord gtfeBlock = gtReadoutRecord->gtfeWord();
182 
183  // get the number of Bx in the event for alternative 0 and alternative 1
184  cms_uint16_t recordLength0 = gtfeBlock.recordLength();
185  cms_uint16_t recordLength1 = gtfeBlock.recordLength1();
186 
187 
188  // get list of active boards from the GTFE payload
189  // and mask some boards, if required
190  // boards not active are not written to the record
191 
192  cms_uint16_t activeBoardsGtInitial = gtfeBlock.activeBoards();
193  cms_uint16_t altNrBxBoardInitial = gtfeBlock.altNrBxBoard();
194 
195  // mask some boards, if needed
196 
197  cms_uint16_t activeBoardsGt = activeBoardsGtInitial & m_activeBoardsMaskGt;
198 
199  if (m_verbosity && m_isDebugEnabled) {
200  LogDebug("L1GTDigiToRaw")
201  << "\nActive boards before masking(hex format): " << std::hex
202  << std::setw(sizeof ( activeBoardsGtInitial ) * 2) << std::setfill('0')
203  << activeBoardsGtInitial << std::dec << std::setfill(' ')
204  << "Active boards after masking(hex format): " << std::hex
205  << std::setw(sizeof ( activeBoardsGt ) * 2) << std::setfill('0') << activeBoardsGt
206  << std::dec << std::setfill(' ') << " \n"
207  << std::endl;
208  }
209 
210  // get the size of the record
211 
212  unsigned int gtDataSize = 0;
213 
214  unsigned int headerSize = 8;
215  gtDataSize += headerSize;
216 
217  for (CItBoardMaps
218  itBoard = boardMaps.begin();
219  itBoard != boardMaps.end(); ++itBoard) {
220 
221  if (itBoard->gtBoardType() == GTFE) {
222  gtDataSize += gtfeBlock.getSize();
223  continue;
224  }
225 
226 
227  int iActiveBit = itBoard->gtBitDaqActiveBoards();
228  bool activeBoardToPack = false;
229 
230  int altNrBxBoardVal = -1;
231 
232  if (iActiveBit >= 0) {
233  activeBoardToPack = activeBoardsGt & (1 << iActiveBit);
234 
235  altNrBxBoardVal = (altNrBxBoardInitial & ( 1 << iActiveBit )) >> iActiveBit;
236 
237  if (altNrBxBoardVal == 1) {
238  m_totalBxInEvent = recordLength1;
239  } else if (altNrBxBoardVal == 0) {
240  m_totalBxInEvent = recordLength0;
241  } else {
242  if (m_verbosity) {
243  edm::LogWarning("L1GTDigiToRaw")
244  << "\n\nWARNING: Wrong value altNrBxBoardVal = " << altNrBxBoardVal
245  << " for board " << std::hex << ( itBoard->gtBoardId() ) << std::dec
246  << "\n iActiveBit = " << iActiveBit
247  << "\n altNrBxBoardInitial = 0x" << std::hex << altNrBxBoardInitial << std::dec
248  << "\n activeBoardsGt = 0x" << std::hex << activeBoardsGt << std::dec
249  << "\n activeBoardToPack = " << activeBoardToPack
250  << "\n Set altNrBxBoardVal tentatively to "
251  << recordLength0 << "\n Job may crash or produce wrong results!\n\n"
252  << std::endl;
253  }
254 
255  m_totalBxInEvent = recordLength0;
256  }
257 
258 
259  } else {
260  // board not in the ActiveBoards for the record
261  continue;
262  }
263 
264  if (activeBoardToPack) {
265 
266  switch (itBoard->gtBoardType()) {
267  case GTFE: {
268  // size already added;
269  }
270 
271  break;
272  case FDL: {
273  L1GtFdlWord fdlBlock;
274  gtDataSize += m_totalBxInEvent*fdlBlock.getSize();
275  }
276 
277  break;
278  case PSB: {
279  L1GtPsbWord psbBlock;
280  gtDataSize += m_totalBxInEvent*psbBlock.getSize();
281  }
282 
283  break;
284  case GMT: {
285  // 17*64/8 TODO FIXME ask Ivan for a getSize() function for GMT record
286  unsigned int gmtRecordSize = 136;
287  unsigned int gmtCollSize = m_totalBxInEvent*gmtRecordSize;
288  gtDataSize += gmtCollSize;
289  }
290 
291  break;
292  case TCS: {
293  L1TcsWord tcsBlock;
294  gtDataSize += tcsBlock.getSize();
295  }
296 
297  break;
298  case TIM: {
299  // not considered
300  }
301 
302  break;
303  default: {
304  // do nothing, all blocks are given in GtBoardType enum
305  }
306 
307  break;
308  }
309  }
310 
311  }
312 
313 
314  unsigned int trailerSize = 8;
315  gtDataSize += trailerSize;
316 
317 
318  // resize, GT raw data record has variable length,
319  // depending on active boards (read in GTFE)
320  gtRawData.resize(gtDataSize);
321 
322 
323  // ptrGt: pointer to the beginning of GT record in the raw data
324 
325  unsigned char* ptrGt = gtRawData.data();
326  unsigned char* ptrGtBegin = gtRawData.data();
327 
328  if (m_verbosity && m_isDebugEnabled) {
329  LogDebug("L1GTDigiToRaw") << "\n Size of raw data: " << gtRawData.size() << "\n"
330  << std::endl;
331  }
332 
333  // ------- pack boards -------
334 
335  // pack header
336  packHeader(ptrGt, iEvent);
337  ptrGt += headerSize; // advance with header size
338 
339  // loop over other blocks in the raw record, if they are active
340 
341  for (CItBoardMaps
342  itBoard = gtRecordMap.begin();
343  itBoard != gtRecordMap.end(); ++itBoard) {
344 
345  if (itBoard->gtBoardType() == GTFE) {
346 
347  packGTFE(evSetup, ptrGt, gtfeBlock, activeBoardsGt);
348 
349  if (m_verbosity && m_isDebugEnabled) {
350 
351  std::ostringstream myCoutStream;
352  gtfeBlock.print(myCoutStream);
353  LogTrace("L1GTDigiToRaw") << myCoutStream.str() << "\n" << std::endl;
354  }
355 
356  ptrGt += gtfeBlock.getSize(); // advance with GTFE block size
357 
358  continue;
359  }
360 
361 
362  // pack modules other than GTFE if they are active
363 
364  int iActiveBit = itBoard->gtBitDaqActiveBoards();
365  bool activeBoardToPack = false;
366 
367  int altNrBxBoardVal = -1;
368 
369  if (iActiveBit >= 0) {
370  activeBoardToPack = activeBoardsGt & (1 << iActiveBit);
371 
372  altNrBxBoardVal = (altNrBxBoardInitial & ( 1 << iActiveBit )) >> iActiveBit;
373 
374  if (altNrBxBoardVal == 1) {
375  m_totalBxInEvent = recordLength1;
376  } else if (altNrBxBoardVal == 0) {
377  m_totalBxInEvent = recordLength0;
378  } else {
379  if (m_verbosity) {
380  edm::LogWarning("L1GTDigiToRaw")
381  << "\n\nWARNING: Wrong value altNrBxBoardVal = " << altNrBxBoardVal
382  << " for board " << std::hex << ( itBoard->gtBoardId() ) << std::dec
383  << "\n iActiveBit = " << iActiveBit
384  << "\n altNrBxBoardInitial = 0x" << std::hex << altNrBxBoardInitial << std::dec
385  << "\n activeBoardsGt = 0x" << std::hex << activeBoardsGt << std::dec
386  << "\n activeBoardToPack = " << activeBoardToPack
387  << "\n Set altNrBxBoardVal tentatively to "
388  << recordLength0 << "\n Job may crash or produce wrong results!\n\n"
389  << std::endl;
390  }
391 
392  m_totalBxInEvent = recordLength0;
393  }
394 
396  m_maxBxInEvent = (m_totalBxInEvent + 1)/2 - 1;
397 
398 
399  } else {
400  // board not in the ActiveBoards for the record
401  continue;
402  }
403 
404  if (activeBoardToPack) {
405 
406  if (m_verbosity && m_isDebugEnabled) {
407  LogDebug("L1GTDigiToRaw")
408  << "\nBoard " << std::hex << "0x" << ( itBoard->gtBoardId() ) << std::dec
409  << "\n Number of bunch crosses in the record: " << m_totalBxInEvent
410  << " = " << "[" << m_minBxInEvent << ", " << m_maxBxInEvent
411  << "] BX\n"
412  << std::endl;
413  }
414 
415  // active board, pack it
416  switch (itBoard->gtBoardType()) {
417 
418  case FDL: {
419 
420  for (int iBxInEvent = m_minBxInEvent; iBxInEvent <= m_maxBxInEvent; ++iBxInEvent) {
421 
422  L1GtFdlWord fdlBlock = gtReadoutRecord->gtFdlWord(iBxInEvent);
423  packFDL(evSetup, ptrGt, fdlBlock);
424 
425  if (m_verbosity && m_isDebugEnabled) {
426 
427  std::ostringstream myCoutStream;
428  fdlBlock.print(myCoutStream);
429  LogTrace("L1GTDigiToRaw") << myCoutStream.str() << "\n" << std::endl;
430  }
431 
432  ptrGt += fdlBlock.getSize(); // advance with FDL block size
433  }
434 
435  }
436  break;
437  case PSB: {
438 
439  if (m_verbosity && m_isDebugEnabled) {
440  LogDebug("L1GTDigiToRaw") << "\nBoard of type " << itBoard->gtBoardName()
441  << " with index " << itBoard->gtBoardIndex() << " and boardId "
442  << std::hex << itBoard->gtBoardId() << std::dec << "\n"
443  << std::endl;
444  }
445 
446  for (int iBxInEvent = m_minBxInEvent; iBxInEvent <= m_maxBxInEvent; ++iBxInEvent) {
447 
448  L1GtPsbWord psbBlock = gtReadoutRecord->gtPsbWord(
449  itBoard->gtBoardId(), iBxInEvent);
450 
451  packPSB(evSetup, ptrGt, psbBlock);
452 
453  if (m_verbosity && m_isDebugEnabled) {
454 
455  std::ostringstream myCoutStream;
456  psbBlock.print(myCoutStream);
457  LogTrace("L1GTDigiToRaw") << myCoutStream.str() << "\n" << std::endl;
458  }
459 
460  ptrGt += psbBlock.getSize(); // advance with PSB block size
461  }
462 
463  }
464  break;
465  case GMT: {
466 
467  // get GMT record TODO separate GMT record or via RefProd from GT record
469  iEvent.getByToken(m_muGmtInputToken, gmtrc_handle);
470  if (!gmtrc_handle.isValid()) {
471  if (m_verbosity) {
472  edm::LogWarning("L1GTDigiToRaw")
473  << "\nWarning: L1MuGMTReadoutCollection with input tag "
474  << m_muGmtInputTag
475  << "\nrequested in configuration, but not found in the event."
476  << "\nQuit packing this event" << std::endl;
477  }
478 
479  std::unique_ptr<FEDRawDataCollection> allFedRawData(new FEDRawDataCollection);
480 
481  // put the raw data in the event
482  iEvent.put(std::move(allFedRawData));
483 
484  return;
485  }
486 
487  L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product();
488 
489  // pack the GMT record
490 
491  unsigned int gmtCollSize = 0;
492  gmtCollSize = packGmtCollection(ptrGt, gmtrc);
493  ptrGt += gmtCollSize; // advance with GMT collection size
494 
495  }
496  break;
497  default: {
498 
499  // do nothing, all blocks are given in GtBoardType enum
500  break;
501  }
502  }
503 
504  }
505  }
506 
507  // pack trailer
508  packTrailer(ptrGt, ptrGtBegin, gtDataSize);
509 
510  // put the raw data in the event
511  iEvent.put(std::move(allFedRawData));
512 }
#define LogDebug(id)
void packFDL(const edm::EventSetup &, unsigned char *, L1GtFdlWord &)
pack FDL blocks for various bunch crosses
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
const unsigned int getSize() const
get the size of the GTFE block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtfeWord.h:229
void print(std::ostream &myCout) const
pretty print the content of a L1GlobalTriggerReadoutRecord
virtual void print(std::ostream &myCout) const
pretty print the content of a L1GtfeWord
Definition: L1GtfeWord.cc:321
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
void packHeader(unsigned char *, edm::Event &)
block packers -------——
const L1GtfeWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
const unsigned int getSize() const
get the size of the FDL block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtFdlWord.h:392
const cms_uint16_t altNrBxBoard() const
get/set alternative for number of BX per board
Definition: L1GtfeWord.h:187
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
cms_uint16_t m_activeBoardsMaskGt
mask for active boards
const cms_uint16_t recordLength() const
get/set record length for alternative 0
Definition: L1GtfeWord.h:104
edm::InputTag m_daqGtInputTag
edm::InputTag m_muGmtInputTag
void packPSB(const edm::EventSetup &, unsigned char *, L1GtPsbWord &)
void resize(size_t newsize)
Definition: FEDRawData.cc:32
void packTrailer(unsigned char *, unsigned char *, int)
pack trailer word
unsigned short cms_uint16_t
Definition: typedefs.h:13
const L1GtPsbWord gtPsbWord(cms_uint16_t boardIdValue, int bxInEventValue) const
get / set PSB word (record) in the GT readout record
bool isValid() const
Definition: HandleBase.h:74
const cms_uint16_t activeBoards() const
get/set boards contributing to EVM respectively DAQ record
Definition: L1GtfeWord.h:163
#define LogTrace(id)
void print(std::ostream &myCout) const
pretty print the content of a L1GtFdlWord
Definition: L1GtFdlWord.cc:766
void print(std::ostream &myCout) const
pretty print
Definition: L1GtPsbWord.cc:453
T const * product() const
Definition: Handle.h:81
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
unsigned int packGmtCollection(unsigned char *ptrGt, L1MuGMTReadoutCollection const *digis)
pack the GMT collection using packGMT (GMT record packing)
const T & get() const
Definition: EventSetup.h:55
void packGTFE(const edm::EventSetup &, unsigned char *, L1GtfeWord &, cms_uint16_t activeBoardsGtValue)
const unsigned int getSize() const
get the size of the TCS block in GT EVM record (in multiple of 8 bits)
Definition: L1TcsWord.h:285
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_daqGtInputToken
input tag for GT DAQ record
const std::vector< L1GtBoard > & gtBoardMaps() const
get / set / print the L1 GT board map
Definition: L1GtBoardMaps.h:47
edm::EDGetTokenT< L1MuGMTReadoutCollection > m_muGmtInputToken
input tag for GMT record
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
int m_verbosity
verbosity level
const cms_uint16_t recordLength1() const
get/set record length for alternative 1
Definition: L1GtfeWord.h:85
int m_totalBxInEvent
total Bx&#39;s in the event, obtained from GTFE block
def move(src, dest)
Definition: eostools.py:510
const unsigned int getSize() const
get the size of the PSB block in GT DAQ record (in multiple of 8 bits)
Definition: L1GtPsbWord.h:198

Member Data Documentation

cms_uint16_t L1GTDigiToRaw::m_activeBoardsMaskGt
private

mask for active boards

Definition at line 112 of file L1GTDigiToRaw.h.

Referenced by L1GTDigiToRaw(), and produce().

int L1GTDigiToRaw::m_daqGtFedId
private

FED Id for GT DAQ record default value defined in DataFormats/FEDRawData/src/FEDNumbering.cc

Definition at line 101 of file L1GTDigiToRaw.h.

Referenced by L1GTDigiToRaw(), packHeader(), and produce().

edm::InputTag L1GTDigiToRaw::m_daqGtInputTag
private

Definition at line 108 of file L1GTDigiToRaw.h.

Referenced by L1GTDigiToRaw(), and produce().

edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> L1GTDigiToRaw::m_daqGtInputToken
private

input tag for GT DAQ record

Definition at line 104 of file L1GTDigiToRaw.h.

Referenced by produce().

bool L1GTDigiToRaw::m_isDebugEnabled
private
int L1GTDigiToRaw::m_maxBxInEvent
private

max Bx's in the event, computed after m_totalBxInEvent is obtained from GTFE block assume symmetrical number of BX around L1Accept

Definition at line 123 of file L1GTDigiToRaw.h.

Referenced by packGmtCollection(), and produce().

int L1GTDigiToRaw::m_minBxInEvent
private

min Bx's in the event, computed after m_totalBxInEvent is obtained from GTFE block assume symmetrical number of BX around L1Accept

Definition at line 119 of file L1GTDigiToRaw.h.

Referenced by packGmtCollection(), and produce().

edm::InputTag L1GTDigiToRaw::m_muGmtInputTag
private

Definition at line 109 of file L1GTDigiToRaw.h.

Referenced by L1GTDigiToRaw(), and produce().

edm::EDGetTokenT<L1MuGMTReadoutCollection> L1GTDigiToRaw::m_muGmtInputToken
private

input tag for GMT record

Definition at line 107 of file L1GTDigiToRaw.h.

Referenced by produce().

int L1GTDigiToRaw::m_totalBxInEvent
private

total Bx's in the event, obtained from GTFE block

Definition at line 115 of file L1GTDigiToRaw.h.

Referenced by packGmtCollection(), and produce().

int L1GTDigiToRaw::m_verbosity
private

verbosity level

Definition at line 128 of file L1GTDigiToRaw.h.

Referenced by L1GTDigiToRaw(), packFDL(), packGmtCollection(), packGTFE(), packHeader(), packPSB(), and produce().