CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TotemTriggerRawToDigi Class Reference
Inheritance diagram for TotemTriggerRawToDigi:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 TotemTriggerRawToDigi (const edm::ParameterSet &)
 
 ~TotemTriggerRawToDigi ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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

int ProcessLoneGFrame (uint64_t *oBuf, unsigned long size, TotemTriggerCounters &data)
 Process one LoneG frame. More...
 

Private Attributes

edm::EDGetTokenT< FEDRawDataCollectionfedDataToken
 
unsigned int fedId
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
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

Definition at line 27 of file TotemTriggerRawToDigi.cc.

Constructor & Destructor Documentation

TotemTriggerRawToDigi::TotemTriggerRawToDigi ( const edm::ParameterSet conf)
explicit

Definition at line 51 of file TotemTriggerRawToDigi.cc.

References fedDataToken, fedId, edm::ParameterSet::getParameter(), and FEDNumbering::MINTotemTriggerFEDID.

51  :
52  fedId(conf.getParameter<unsigned int>("fedId"))
53 {
54  fedDataToken = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("rawDataTag"));
55 
56  if (fedId == 0)
58 
59  produces<TotemTriggerCounters>();
60 }
T getParameter(std::string const &) const
edm::EDGetTokenT< FEDRawDataCollection > fedDataToken
TotemTriggerRawToDigi::~TotemTriggerRawToDigi ( )

Definition at line 64 of file TotemTriggerRawToDigi.cc.

65 {
66 }

Member Function Documentation

int TotemTriggerRawToDigi::ProcessLoneGFrame ( uint64_t *  oBuf,
unsigned long  size,
TotemTriggerCounters data 
)
private

Process one LoneG frame.

Definition at line 92 of file TotemTriggerRawToDigi.cc.

References TotemTriggerCounters::bunch_num, cuy::col, DEFINE_FWK_MODULE, TotemTriggerCounters::event_num, mps_fire::i, TotemTriggerCounters::inhibited_triggers_num, TotemTriggerCounters::input_status_bits, TotemTriggerCounters::orbit_num, TotemTriggerCounters::revision_num, TotemTriggerCounters::run_num, TotemTriggerCounters::src_id, TotemTriggerCounters::trigger_num, and TotemTriggerCounters::type.

Referenced by produce().

93 {
94  if (size != 20)
95  {
96  LogError("Totem") << "Error in TotemTriggerRawToDigi::ProcessLoneGFrame > " <<
97  "Wrong LoneG frame size: " << size << " (shall be 20)." << endl;
98  return 1;
99  }
100 
101  // buffer mapping: OptoRx buffer --> LoneG buffer
102  uint64_t buf[5];
103  for (unsigned int i = 0; i < 5; i++)
104  buf[i] = 0;
105 
106  for (unsigned int i = 0; i < 20; i++)
107  {
108  int row = i / 4;
109  int col = i % 4;
110  buf[row] |= (oBuf[i] & 0xFFFF) << (col * 16);
111  }
112 
113  td.type = (buf[0] >> 56) & 0xF;
114  td.event_num = (buf[0] >> 32) & 0xFFFFFF;
115  td.bunch_num = (buf[0] >> 20) & 0xFFF;
116  td.src_id = (buf[0] >> 8) & 0xFFF;
117 
118  td.orbit_num = (buf[1] >> 32) & 0xFFFFFFFF;
119  td.revision_num = (buf[1] >> 24) & 0xFF;
120 
121  td.run_num = (buf[2] >> 32) & 0xFFFFFFFF;
122  td.trigger_num = (buf[2] >> 0) & 0xFFFFFFFF;
123 
124  td.inhibited_triggers_num = (buf[3] >> 32) & 0xFFFFFFFF;
125  td.input_status_bits = (buf[3] >> 0) & 0xFFFFFFFF;
126 
127 #ifdef DEBUG
128  printf(">> RawDataUnpacker::ProcessLoneGFrame > size = %li\n", size);
129  printf("\ttype = %x, event number = %x, bunch number = %x, id = %x\n",
130  td.type, td.event_num, td.bunch_num, td.src_id);
131  printf("\torbit number = %x, revision = %x\n",
132  td.orbit_num, td.revision_num);
133  printf("\trun number = %x, trigger number = %x\n",
134  td.run_num, td.trigger_num);
135  printf("\tinhibited triggers = %x, input status bits = %x\n",
136  td.inhibited_triggers_num, td.input_status_bits);
137 #endif
138 
139  return 0;
140 }
size
Write out results.
unsigned long long uint64_t
Definition: Time.h:15
col
Definition: cuy.py:1008
void TotemTriggerRawToDigi::produce ( edm::Event event,
const edm::EventSetup es 
)
overridevirtual

Definition at line 70 of file TotemTriggerRawToDigi.cc.

References FEDRawData::data(), data, FEDRawDataCollection::FEDData(), fedDataToken, fedId, ProcessLoneGFrame(), and FEDRawData::size().

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

71 {
72  // raw data handle
74  event.getByToken(fedDataToken, rawData);
75 
76  // book output products
77  TotemTriggerCounters totemTriggerCounters;
78 
79  // unpack trigger data
80  const FEDRawData &data = rawData->FEDData(fedId);
81  uint64_t *buf = (uint64_t *) data.data();
82  unsigned int sizeInWords = data.size() / 8; // bytes -> words
83  if (data.size() > 0)
84  ProcessLoneGFrame(buf + 2, sizeInWords - 4, totemTriggerCounters);
85 
86  // commit products to event
87  event.put(make_unique<TotemTriggerCounters>(totemTriggerCounters));
88 }
int ProcessLoneGFrame(uint64_t *oBuf, unsigned long size, TotemTriggerCounters &data)
Process one LoneG frame.
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
unsigned long long uint64_t
Definition: Time.h:15
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
edm::EDGetTokenT< FEDRawDataCollection > fedDataToken

Member Data Documentation

edm::EDGetTokenT<FEDRawDataCollection> TotemTriggerRawToDigi::fedDataToken
private

Definition at line 38 of file TotemTriggerRawToDigi.cc.

Referenced by produce(), and TotemTriggerRawToDigi().

unsigned int TotemTriggerRawToDigi::fedId
private

Definition at line 36 of file TotemTriggerRawToDigi.cc.

Referenced by produce(), and TotemTriggerRawToDigi().