CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< FEDRawDataCollection
fedDataToken
 
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 ( const edm::ParameterSet conf)
explicit

Definition at line 43 of file TotemTriggerRawToDigi.cc.

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

44  : fedId(conf.getParameter<unsigned int>("fedId")) {
45  fedDataToken = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("rawDataTag"));
46 
47  if (fedId == 0)
49 
50  produces<TotemTriggerCounters>();
51 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< FEDRawDataCollection > fedDataToken
TotemTriggerRawToDigi::~TotemTriggerRawToDigi ( )
override

Definition at line 53 of file TotemTriggerRawToDigi.cc.

53 {}

Member Function Documentation

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

Process one LoneG frame.

Definition at line 74 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, gpuVertexFinder::printf(), TotemTriggerCounters::revision_num, TotemTriggerCounters::run_num, TotemTriggerCounters::src_id, TotemTriggerCounters::trigger_num, and TotemTriggerCounters::type.

Referenced by produce().

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

Definition at line 55 of file TotemTriggerRawToDigi.cc.

References visDQMUpload::buf, FEDRawData::data(), data, fedDataToken, fedId, ProcessLoneGFrame(), and FEDRawData::size().

55  {
56  // raw data handle
58  event.getByToken(fedDataToken, rawData);
59 
60  // book output products
61  TotemTriggerCounters totemTriggerCounters;
62 
63  // unpack trigger data
64  const FEDRawData &data = rawData->FEDData(fedId);
65  uint64_t *buf = (uint64_t *)data.data();
66  unsigned int sizeInWords = data.size() / 8; // bytes -> words
67  if (data.size() > 0)
68  ProcessLoneGFrame(buf + 2, sizeInWords - 4, totemTriggerCounters);
69 
70  // commit products to event
71  event.put(make_unique<TotemTriggerCounters>(totemTriggerCounters));
72 }
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:45
unsigned long long uint64_t
Definition: Time.h:13
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
edm::EDGetTokenT< FEDRawDataCollection > fedDataToken

Member Data Documentation

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

Definition at line 34 of file TotemTriggerRawToDigi.cc.

Referenced by produce(), and TotemTriggerRawToDigi().

unsigned int TotemTriggerRawToDigi::fedId
private

Definition at line 32 of file TotemTriggerRawToDigi.cc.

Referenced by produce(), and TotemTriggerRawToDigi().