CMS 3D CMS Logo

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

#include <RPCRecordFormatter.h>

Public Member Functions

std::vector< rpcrawtodigi::EventRecordsrecordPack (uint32_t rawDetId, const RPCDigi &digi, int trigger_BX) const
 
int recordUnpack (const rpcrawtodigi::EventRecords &event, RPCDigiCollection *prod, RPCRawDataCounts *counter, RPCRawSynchro::ProdItem *synchro)
 
 RPCRecordFormatter (int fedId, const RPCReadOutMapping *readoutMapping)
 Creator. More...
 
 ~RPCRecordFormatter ()
 Destructor. More...
 

Private Attributes

int currentFED
 
int currentTbLinkInputNumber
 
const RPCReadOutMappingreadoutMapping
 

Detailed Description

Definition at line 15 of file RPCRecordFormatter.h.

Constructor & Destructor Documentation

◆ RPCRecordFormatter()

RPCRecordFormatter::RPCRecordFormatter ( int  fedId,
const RPCReadOutMapping readoutMapping 
)

Creator.

Definition at line 28 of file RPCRecordFormatter.cc.

◆ ~RPCRecordFormatter()

RPCRecordFormatter::~RPCRecordFormatter ( )

Destructor.

Definition at line 30 of file RPCRecordFormatter.cc.

30 {}

Member Function Documentation

◆ recordPack()

std::vector< EventRecords > RPCRecordFormatter::recordPack ( uint32_t  rawDetId,
const RPCDigi digi,
int  trigger_BX 
) const

Definition at line 32 of file RPCRecordFormatter.cc.

32  {
33  std::vector<EventRecords> result;
34 
35  LogTrace("") << " DIGI; det: " << rawDetId << ", strip: " << digi.strip() << ", bx: " << digi.bx();
36  int stripInDU = digi.strip();
37 
38  // decode digi<->map
39  typedef std::vector<std::pair<LinkBoardElectronicIndex, LinkBoardPackedStrip> > RawDataFrames;
40  RPCReadOutMapping::StripInDetUnit duFrame(rawDetId, stripInDU);
41  RawDataFrames rawDataFrames = readoutMapping->rawDataFrame(duFrame);
42 
43  for (RawDataFrames::const_iterator ir = rawDataFrames.begin(); ir != rawDataFrames.end(); ir++) {
44  const LinkBoardElectronicIndex& eleIndex = (*ir).first;
45  const LinkBoardPackedStrip& lbPackedStrip = (*ir).second;
46 
47  if (eleIndex.dccId == currentFED) {
48  LogTrace("pack:") << " dccId= " << eleIndex.dccId << " dccInputChannelNum= " << eleIndex.dccInputChannelNum
49  << " tbLinkInputNum= " << eleIndex.tbLinkInputNum << " lbNumInLink=" << eleIndex.lbNumInLink;
50 
51  // BX
52  int current_BX = trigger_BX + digi.bx();
53  RecordBX bxr(current_BX);
54 
55  // LB
56  int tbLinkInputNumber = eleIndex.tbLinkInputNum;
57  int rmb = eleIndex.dccInputChannelNum;
58  RecordSLD lbr(tbLinkInputNumber, rmb);
59 
60  // CD record
61  int lbInLink = eleIndex.lbNumInLink;
62  int eod = 0;
63  int halfP = 0;
64  int packedStrip = lbPackedStrip.packedStrip();
65  int partitionNumber = packedStrip / 8;
66  RecordCD cdr(lbInLink, partitionNumber, eod, halfP, vector<int>(1, packedStrip));
67 
68  result.push_back(EventRecords(trigger_BX, bxr, lbr, cdr));
69  }
70  }
71  return result;
72 }

References RPCDigi::bx(), currentFED, LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, LinkBoardElectronicIndex::lbNumInLink, LogTrace, LinkBoardPackedStrip::packedStrip(), RPCReadOutMapping::rawDataFrame(), readoutMapping, mps_fire::result, RPCDigi::strip(), and LinkBoardElectronicIndex::tbLinkInputNum.

Referenced by RPCPackingModule::eventRecords().

◆ recordUnpack()

int RPCRecordFormatter::recordUnpack ( const rpcrawtodigi::EventRecords event,
RPCDigiCollection prod,
RPCRawDataCounts counter,
RPCRawSynchro::ProdItem synchro 
)

Committing digi to the product

Definition at line 74 of file RPCRecordFormatter.cc.

77  {
80  int currentRMB = event.recordSLD().rmb();
81  int currentTbLinkInputNumber = event.recordSLD().tbLinkInputNumber();
82 
83  LinkBoardElectronicIndex eleIndex;
84  eleIndex.dccId = currentFED;
85  eleIndex.dccInputChannelNum = currentRMB;
87  eleIndex.lbNumInLink = event.recordCD().lbInLink();
88 
89  if (event.recordCD().eod()) {
90  if (counter)
91  counter->addReadoutError(currentFED, ReadoutError(eleIndex, ReadoutError::EOD));
92  }
93 
94  if (readoutMapping == nullptr)
95  return error.type();
96  const LinkBoardSpec* linkBoard = readoutMapping->location(eleIndex);
97  if (!linkBoard) {
98  if (debug)
99  LogDebug("") << " ** PROBLEM ** Invalid Linkboard location, skip CD event, "
100  << "dccId: " << eleIndex.dccId << "dccInputChannelNum: " << eleIndex.dccInputChannelNum
101  << " tbLinkInputNum: " << eleIndex.tbLinkInputNum << " lbNumInLink: " << eleIndex.lbNumInLink;
102  error = ReadoutError(eleIndex, ReadoutError::InvalidLB);
103  if (counter)
104  counter->addReadoutError(currentFED, error);
105  return error.type();
106  }
107 
108  std::vector<int> packStrips = event.recordCD().packedStrips();
109  if (packStrips.empty()) {
110  error = ReadoutError(eleIndex, ReadoutError::EmptyPackedStrips);
111  if (counter)
112  counter->addReadoutError(currentFED, error);
113  return error.type();
114  }
115 
116  for (std::vector<int>::iterator is = packStrips.begin(); is != packStrips.end(); ++is) {
118 
119  uint32_t rawDetId = duFrame.first;
120  int geomStrip = duFrame.second;
121  if (!rawDetId) {
122  if (debug)
123  LogTrace("") << " ** PROBLEM ** no rawDetId, skip at least part of CD data";
124  error = ReadoutError(eleIndex, ReadoutError::InvalidDetId);
125  if (counter)
126  counter->addReadoutError(currentFED, error);
127  continue;
128  }
129  if (geomStrip == 0) {
130  if (debug)
131  LogTrace("") << " ** PROBLEM ** no strip found";
132  error = ReadoutError(eleIndex, ReadoutError::InvalidStrip);
133  if (counter)
134  counter->addReadoutError(currentFED, error);
135  continue;
136  }
137 
138  // Creating RPC digi
139  RPCDigi digi(geomStrip, event.dataToTriggerDelay() - 3);
140 
142  if (debug) {
143  //LogTrace("") << " LinkBoardElectronicIndex: " << eleIndex.print();
144  LogTrace("") << " DIGI; det: " << rawDetId << ", strip: " << digi.strip() << ", bx: " << digi.bx();
145  }
146  if (prod)
147  prod->insertDigi(RPCDetId(rawDetId), digi);
148 
149  // if (RPCDetId(rawDetId).region() == -1 ) {
150  // RPCDetId det(rawDetId);
151  // if (det.ring()== 2 ) takeIt = true;
152  // if (det.station() == 1)
153  // takeIt = true;
154  // LogInfo("RPCRecordFormatter") <<"ENDCAP Region: "<<det.region()<<" disk: "<<det.station()<<" ring: "<<det.ring() <<" sector: "<<det.sector()<<" digiBX: "<<digi.bx()<< std::endl;
155  // }
156  }
157 
158  if (synchro)
159  synchro->push_back(make_pair(eleIndex, event.dataToTriggerDelay()));
160 
161  return error.type();
162 }

References currentFED, currentTbLinkInputNumber, LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, debug, edm::MessageDrop::debugEnabled, RPCReadOutMapping::detUnitFrame(), relativeConstraints::error, edm::MessageDrop::instance(), LinkBoardElectronicIndex::lbNumInLink, RPCReadOutMapping::location(), LogDebug, LogTrace, dumpMFGeometry_cfg::prod, readoutMapping, and LinkBoardElectronicIndex::tbLinkInputNum.

Referenced by RPCUnpackingModule::produce().

Member Data Documentation

◆ currentFED

int RPCRecordFormatter::currentFED
private

Definition at line 31 of file RPCRecordFormatter.h.

Referenced by recordPack(), and recordUnpack().

◆ currentTbLinkInputNumber

int RPCRecordFormatter::currentTbLinkInputNumber
private

Definition at line 32 of file RPCRecordFormatter.h.

Referenced by recordUnpack().

◆ readoutMapping

const RPCReadOutMapping* RPCRecordFormatter::readoutMapping
private

Definition at line 34 of file RPCRecordFormatter.h.

Referenced by recordPack(), and recordUnpack().

rpcrawtodigi::RecordBX
Definition: RecordBX.h:7
counter
Definition: counter.py:1
LinkBoardPackedStrip::packedStrip
int packedStrip() const
Definition: LinkBoardPackedStrip.h:12
edm::MessageDrop::debugEnabled
bool debugEnabled
Definition: MessageDrop.h:63
RPCRecordFormatter::currentFED
int currentFED
Definition: RPCRecordFormatter.h:31
rpcrawtodigi::RecordCD
Definition: RecordCD.h:8
RPCDetId
Definition: RPCDetId.h:16
LinkBoardElectronicIndex::dccId
int dccId
Definition: LinkBoardElectronicIndex.h:11
rpcrawtodigi::ReadoutError
Definition: ReadoutError.h:8
relativeConstraints.error
error
Definition: relativeConstraints.py:53
RPCReadOutMapping::location
virtual const LinkBoardSpec * location(const LinkBoardElectronicIndex &ele) const
conversion between electronic and detector indexing
Definition: RPCReadOutMapping.cc:97
RPCDigi::bx
int bx() const
Definition: RPCDigi.h:28
LinkBoardElectronicIndex::dccInputChannelNum
int dccInputChannelNum
Definition: LinkBoardElectronicIndex.h:12
debug
#define debug
Definition: HDRShower.cc:19
RPCRecordFormatter::currentTbLinkInputNumber
int currentTbLinkInputNumber
Definition: RPCRecordFormatter.h:32
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
RPCRecordFormatter::readoutMapping
const RPCReadOutMapping * readoutMapping
Definition: RPCRecordFormatter.h:34
rpcrawtodigi::RecordSLD
Definition: RecordSLD.h:7
LinkBoardElectronicIndex::tbLinkInputNum
int tbLinkInputNum
Definition: LinkBoardElectronicIndex.h:13
RPCReadOutMapping::detUnitFrame
virtual StripInDetUnit detUnitFrame(const LinkBoardSpec &location, const LinkBoardPackedStrip &packedStrip) const
convert strip location as in raw data (LB and LBchannel) to detUnit frame
Definition: RPCReadOutMapping.cc:113
LinkBoardSpec
Definition: LinkBoardSpec.h:13
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
rpcrawtodigi::EventRecords
Definition: EventRecords.h:11
RPCReadOutMapping::rawDataFrame
std::vector< std::pair< LinkBoardElectronicIndex, LinkBoardPackedStrip > > rawDataFrame(const StripInDetUnit &duFrame) const
connection "paths" that lead from one digi to one strip
Definition: RPCReadOutMapping.cc:46
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
RPCDigi::strip
int strip() const
Definition: RPCDigi.h:27
alignCSCRings.r
r
Definition: alignCSCRings.py:93
LinkBoardElectronicIndex
Definition: LinkBoardElectronicIndex.h:10
RPCDigi
Definition: RPCDigi.h:19
edm::MessageDrop::instance
static MessageDrop * instance()
Definition: MessageDrop.cc:33
LinkBoardPackedStrip
Definition: LinkBoardPackedStrip.h:4
RPCReadOutMapping::StripInDetUnit
std::pair< uint32_t, int > StripInDetUnit
first member is DetUnit ID, second strip in DetUnit frame
Definition: RPCReadOutMapping.h:25
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
event
Definition: event.py:1
LinkBoardElectronicIndex::lbNumInLink
int lbNumInLink
Definition: LinkBoardElectronicIndex.h:14