CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
RPCRecordFormatter Class Reference

#include <RPCRecordFormatter.h>

Public Member Functions

std::vector
< rpcrawtodigi::EventRecords
recordPack (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 17 of file RPCRecordFormatter.h.

Constructor & Destructor Documentation

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

Destructor.

Definition at line 35 of file RPCRecordFormatter.cc.

36 { }

Member Function Documentation

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

Definition at line 39 of file RPCRecordFormatter.cc.

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().

41 {
42  std::vector<EventRecords> result;
43 
44  LogTrace("") << " DIGI; det: " << rawDetId<<", strip: "<<digi.strip()<<", bx: "<<digi.bx();
45  int stripInDU = digi.strip();
46 
47  // decode digi<->map
48  typedef std::vector< std::pair< LinkBoardElectronicIndex, LinkBoardPackedStrip> > RawDataFrames;
49  RPCReadOutMapping::StripInDetUnit duFrame(rawDetId, stripInDU);
50  RawDataFrames rawDataFrames = readoutMapping->rawDataFrame(duFrame);
51 
52  for (RawDataFrames::const_iterator ir = rawDataFrames.begin(); ir != rawDataFrames.end(); ir++) {
53 
54  const LinkBoardElectronicIndex & eleIndex = (*ir).first;
55  const LinkBoardPackedStrip & lbPackedStrip = (*ir).second;
56 
57  if (eleIndex.dccId == currentFED) {
58 
59  LogTrace("pack:")
60  <<" dccId= "<<eleIndex.dccId
61  <<" dccInputChannelNum= "<<eleIndex.dccInputChannelNum
62  <<" tbLinkInputNum= "<<eleIndex.tbLinkInputNum
63  <<" lbNumInLink="<<eleIndex.lbNumInLink;
64 
65  // BX
66  int current_BX = trigger_BX+digi.bx();
67  RecordBX bxr(current_BX);
68 
69  // LB
70  int tbLinkInputNumber = eleIndex.tbLinkInputNum;
71  int rmb = eleIndex.dccInputChannelNum;
72  RecordSLD lbr( tbLinkInputNumber, rmb);
73 
74  // CD record
75  int lbInLink = eleIndex.lbNumInLink;
76  int eod = 0;
77  int halfP = 0;
78  int packedStrip = lbPackedStrip.packedStrip();
79  int partitionNumber = packedStrip/8;
80  RecordCD cdr(lbInLink, partitionNumber, eod, halfP, vector<int>(1,packedStrip) );
81 
82  result.push_back( EventRecords(trigger_BX, bxr, lbr, cdr) );
83  }
84  }
85  return result;
86 }
int bx() const
Definition: RPCDigi.cc:47
std::pair< uint32_t, int > StripInDetUnit
first member is DetUnit ID, second strip in DetUnit frame
tuple result
Definition: mps_fire.py:84
int strip() const
Definition: RPCDigi.cc:45
#define LogTrace(id)
std::vector< std::pair< LinkBoardElectronicIndex, LinkBoardPackedStrip > > rawDataFrame(const StripInDetUnit &duFrame) const
connection &quot;paths&quot; that lead from one digi to one strip
const RPCReadOutMapping * readoutMapping
int RPCRecordFormatter::recordUnpack ( const rpcrawtodigi::EventRecords event,
RPCDigiCollection prod,
RPCRawDataCounts counter,
RPCRawSynchro::ProdItem synchro 
)

Committing digi to the product

Definition at line 88 of file RPCRecordFormatter.cc.

References RPCRawDataCounts::addReadoutError(), currentFED, currentTbLinkInputNumber, rpcrawtodigi::EventRecords::dataToTriggerDelay(), LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, debug, edm::MessageDrop::debugEnabled, RPCReadOutMapping::detUnitFrame(), rpcrawtodigi::RecordCD::eod(), relativeConstraints::error, edm::MessageDrop::instance(), LinkBoardElectronicIndex::lbNumInLink, RPCReadOutMapping::location(), LogDebug, LogTrace, readoutMapping, rpcrawtodigi::EventRecords::recordCD(), RPCDetId, LinkBoardElectronicIndex::tbLinkInputNum, and rpcrawtodigi::ReadoutError::type().

Referenced by RPCUnpackingModule::produce().

91 {
92 
95  int currentRMB = event.recordSLD().rmb();
96  int currentTbLinkInputNumber = event.recordSLD().tbLinkInputNumber();
97 
98  LinkBoardElectronicIndex eleIndex;
99  eleIndex.dccId = currentFED;
100  eleIndex.dccInputChannelNum = currentRMB;
102  eleIndex.lbNumInLink = event.recordCD().lbInLink();
103 
104 
105  if( event.recordCD().eod() ) {
106  if(counter) counter->addReadoutError(currentFED, ReadoutError(eleIndex,ReadoutError::EOD));
107  }
108 
109  if(readoutMapping == 0) return error.type();
110  const LinkBoardSpec* linkBoard = readoutMapping->location(eleIndex);
111  if (!linkBoard) {
112  if (debug) LogDebug("")<<" ** PROBLEM ** Invalid Linkboard location, skip CD event, "
113  << "dccId: "<<eleIndex.dccId
114  << "dccInputChannelNum: " <<eleIndex.dccInputChannelNum
115  << " tbLinkInputNum: "<<eleIndex.tbLinkInputNum
116  << " lbNumInLink: "<<eleIndex.lbNumInLink;
117  error = ReadoutError(eleIndex,ReadoutError::InvalidLB);
118  if(counter) counter->addReadoutError(currentFED,error );
119  return error.type();
120  }
121 
122 
123  std::vector<int> packStrips = event.recordCD().packedStrips();
124  if (packStrips.size() ==0) {
125  error = ReadoutError(eleIndex,ReadoutError::EmptyPackedStrips);
126  if(counter) counter->addReadoutError(currentFED, error);
127  return error.type();
128  }
129 
130  for(std::vector<int>::iterator is = packStrips.begin(); is != packStrips.end(); ++is) {
131 
134 
135  uint32_t rawDetId = duFrame.first;
136  int geomStrip = duFrame.second;
137  if (!rawDetId) {
138  if (debug) LogTrace("") << " ** PROBLEM ** no rawDetId, skip at least part of CD data";
139  error = ReadoutError(eleIndex,ReadoutError::InvalidDetId);
140  if (counter) counter->addReadoutError(currentFED, error);
141  continue;
142  }
143  if (geomStrip==0) {
144  if(debug) LogTrace("") <<" ** PROBLEM ** no strip found";
145  error = ReadoutError(eleIndex,ReadoutError::InvalidStrip);
146  if (counter) counter->addReadoutError(currentFED, error);
147  continue;
148  }
149 
150  // Creating RPC digi
151  RPCDigi digi(geomStrip,event.dataToTriggerDelay()-3);
152 
154  if (debug) {
155  //LogTrace("") << " LinkBoardElectronicIndex: " << eleIndex.print();
156  LogTrace("")<<" DIGI; det: "<<rawDetId<<", strip: "<<digi.strip()<<", bx: "<<digi.bx();
157  }
158  if (prod) prod->insertDigi(RPCDetId(rawDetId),digi);
159 
160 // if (RPCDetId(rawDetId).region() == -1 ) {
161 // RPCDetId det(rawDetId);
162 // if (det.ring()== 2 ) takeIt = true;
163 // if (det.station() == 1)
164 // takeIt = true;
165 // LogInfo("RPCRecordFormatter") <<"ENDCAP Region: "<<det.region()<<" disk: "<<det.station()<<" ring: "<<det.ring() <<" sector: "<<det.sector()<<" digiBX: "<<digi.bx()<< std::endl;
166 // }
167 
168  }
169 
170  if(synchro) synchro->push_back( make_pair(eleIndex,event.dataToTriggerDelay() ));
171 
172  return error.type();
173 }
#define LogDebug(id)
int eod() const
Definition: RecordCD.cc:39
static MessageDrop * instance()
Definition: MessageDrop.cc:60
std::pair< uint32_t, int > StripInDetUnit
first member is DetUnit ID, second strip in DetUnit frame
int dataToTriggerDelay() const
Definition: EventRecords.cc:11
ReadoutErrorType type() const
Definition: ReadoutError.cc:14
const RecordCD & recordCD() const
Definition: EventRecords.h:39
virtual StripInDetUnit detUnitFrame(const LinkBoardSpec &location, const LinkBoardPackedStrip &packedStrip) const
convert strip location as in raw data (LB and LBchannel) to detUnit frame
#define LogTrace(id)
virtual const LinkBoardSpec * location(const LinkBoardElectronicIndex &ele) const
conversion between electronic and detector indexing
#define debug
Definition: HDRShower.cc:19
void addReadoutError(int fedId, const rpcrawtodigi::ReadoutError &error, int weight=1)
const RPCReadOutMapping * readoutMapping

Member Data Documentation

int RPCRecordFormatter::currentFED
private

Definition at line 34 of file RPCRecordFormatter.h.

Referenced by recordPack(), and recordUnpack().

int RPCRecordFormatter::currentTbLinkInputNumber
private

Definition at line 35 of file RPCRecordFormatter.h.

Referenced by recordUnpack().

const RPCReadOutMapping* RPCRecordFormatter::readoutMapping
private

Definition at line 37 of file RPCRecordFormatter.h.

Referenced by recordPack(), and recordUnpack().