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<>

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 TotemTriggerRawToDigi (const edm::ParameterSet &)
 
 ~TotemTriggerRawToDigi () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 24 of file TotemTriggerRawToDigi.cc.

Constructor & Destructor Documentation

◆ TotemTriggerRawToDigi()

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

Definition at line 43 of file TotemTriggerRawToDigi.cc.

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

44  : fedId(conf.getParameter<unsigned int>("fedId")) {
45  fedDataToken = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("rawDataTag"));
46 
47  if (fedId == 0)
48  throw cms::Exception("TotemTriggerRawToDigi")
49  << "Invalid FED id for TOTEM trigger. Please specify it through the 'fedId' parameter.";
50 
51  produces<TotemTriggerCounters>();
52 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< FEDRawDataCollection > fedDataToken

◆ ~TotemTriggerRawToDigi()

TotemTriggerRawToDigi::~TotemTriggerRawToDigi ( )
override

Definition at line 54 of file TotemTriggerRawToDigi.cc.

54 {}

Member Function Documentation

◆ ProcessLoneGFrame()

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

Process one LoneG frame.

Definition at line 75 of file TotemTriggerRawToDigi.cc.

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

Referenced by produce().

75  {
76  if (size != 20) {
77  LogError("Totem") << "Error in TotemTriggerRawToDigi::ProcessLoneGFrame > "
78  << "Wrong LoneG frame size: " << size << " (shall be 20)." << endl;
79  return 1;
80  }
81 
82  // buffer mapping: OptoRx buffer --> LoneG buffer
83  uint64_t buf[5];
84  for (unsigned int i = 0; i < 5; i++)
85  buf[i] = 0;
86 
87  for (unsigned int i = 0; i < 20; i++) {
88  int row = i / 4;
89  int col = i % 4;
90  buf[row] |= (oBuf[i] & 0xFFFF) << (col * 16);
91  }
92 
93  td.type = (buf[0] >> 56) & 0xF;
94  td.event_num = (buf[0] >> 32) & 0xFFFFFF;
95  td.bunch_num = (buf[0] >> 20) & 0xFFF;
96  td.src_id = (buf[0] >> 8) & 0xFFF;
97 
98  td.orbit_num = (buf[1] >> 32) & 0xFFFFFFFF;
99  td.revision_num = (buf[1] >> 24) & 0xFF;
100 
101  td.run_num = (buf[2] >> 32) & 0xFFFFFFFF;
102  td.trigger_num = (buf[2] >> 0) & 0xFFFFFFFF;
103 
104  td.inhibited_triggers_num = (buf[3] >> 32) & 0xFFFFFFFF;
105  td.input_status_bits = (buf[3] >> 0) & 0xFFFFFFFF;
106 
107 #ifdef DEBUG
108  printf(">> RawDataUnpacker::ProcessLoneGFrame > size = %li\n", size);
109  printf(
110  "\ttype = %x, event number = %x, bunch number = %x, id = %x\n", td.type, td.event_num, td.bunch_num, td.src_id);
111  printf("\torbit number = %x, revision = %x\n", td.orbit_num, td.revision_num);
112  printf("\trun number = %x, trigger number = %x\n", td.run_num, td.trigger_num);
113  printf("\tinhibited triggers = %x, input status bits = %x\n", td.inhibited_triggers_num, td.input_status_bits);
114 #endif
115 
116  return 0;
117 }
size
Write out results.
Log< level::Error, false > LogError
unsigned long long uint64_t
Definition: Time.h:13
col
Definition: cuy.py:1009

◆ produce()

void TotemTriggerRawToDigi::produce ( edm::Event event,
const edm::EventSetup es 
)
override

Definition at line 56 of file TotemTriggerRawToDigi.cc.

References visDQMUpload::buf, data, fedDataToken, fedId, ProcessLoneGFrame(), and l1tstage2_dqm_sourceclient-live_cfg::rawData.

56  {
57  // raw data handle
59  event.getByToken(fedDataToken, rawData);
60 
61  // book output products
62  TotemTriggerCounters totemTriggerCounters;
63 
64  // unpack trigger data
65  const FEDRawData &data = rawData->FEDData(fedId);
66  uint64_t *buf = (uint64_t *)data.data();
67  unsigned int sizeInWords = data.size() / 8; // bytes -> words
68  if (data.size() > 0)
69  ProcessLoneGFrame(buf + 2, sizeInWords - 4, totemTriggerCounters);
70 
71  // commit products to event
72  event.put(make_unique<TotemTriggerCounters>(totemTriggerCounters));
73 }
int ProcessLoneGFrame(uint64_t *oBuf, unsigned long size, TotemTriggerCounters &data)
Process one LoneG frame.
unsigned long long uint64_t
Definition: Time.h:13
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
edm::EDGetTokenT< FEDRawDataCollection > fedDataToken

Member Data Documentation

◆ fedDataToken

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

Definition at line 34 of file TotemTriggerRawToDigi.cc.

Referenced by produce(), and TotemTriggerRawToDigi().

◆ fedId

unsigned int TotemTriggerRawToDigi::fedId
private

Definition at line 32 of file TotemTriggerRawToDigi.cc.

Referenced by produce(), and TotemTriggerRawToDigi().