CMS 3D CMS Logo

OmtfRpcUnpacker.cc
Go to the documentation of this file.
2 
6 
14 
19 
20 namespace omtf {
21 
23  edm::ESTransientHandle<RPCEMap> readoutMapping;
24  es.get<RPCEMapRcd>().get(readoutMapping);
25  thePactCabling = readoutMapping->convert();
26  LogDebug("OmtfUnpacker") <<" Has PACT readout map, VERSION: " << thePactCabling->version() << std::endl;
27 }
28 
30 {
31  initCabling(es);
32  RpcLinkMap omtfLink2Ele;
33  omtfLink2Ele.init(es);
35 }
36 
37 void RpcUnpacker::init(const edm::EventSetup & es, const std::string & connectionFile)
38 {
39  initCabling(es);
40  RpcLinkMap omtfLink2Ele;
41  omtfLink2Ele.init(connectionFile);
43 }
44 
45 void RpcUnpacker::unpack(int triggerBX, unsigned int fed, unsigned int amc, const RpcDataWord64 &data, RPCDigiCollection * prod)
46 {
47  LogTrace("RpcUnpacker:") << data;
48 
49 // EleIndex omtfEle(fedHeader.sourceID(), bh.getAMCNumber()/2+1, data.linkNum());
50  EleIndex omtfEle(fed, amc, data.linkNum());
51  LinkBoardElectronicIndex rpcEle = theOmtf2Pact.at(omtfEle);
52  RPCRecordFormatter formater(rpcEle.dccId, thePactCabling);
53 
54 
55  rpcrawtodigi::EventRecords records(triggerBX);
56  rpcrawtodigi::RecordBX recordBX(triggerBX+data.bxNum()-3);
57  records.add(recordBX); // warning: event records must be added in right order
58  rpcrawtodigi::RecordSLD recordSLD(rpcEle.tbLinkInputNum, rpcEle.dccInputChannelNum);
59  records.add(recordSLD); // warning: event records must be added in right order
60 
61  for (unsigned int iframe=1; iframe <=3; iframe++) {
62 
63  uint16_t frame = (iframe==1) ? data.frame1() : ( (iframe==2) ? data.frame2() : data.frame3() );
64  if (frame==0) continue;
65  rpcrawtodigi::RecordCD recordCD(frame);
66  records.add(recordCD);
67 
68  LogTrace("") <<"OMTF->RPC Event isComplete: "<<records.complete() <<records.print(rpcrawtodigi::DataRecord::StartOfBXData); // << std::endl;
69  LogTrace("") <<"OMTF->RPC Event: "<<records.print(rpcrawtodigi::DataRecord::StartOfTbLinkInputNumberData) << std::endl;
70  LogTrace("") <<"OMTF->RPC Event: "<<records.print(rpcrawtodigi::DataRecord::ChamberData)
71  <<" lb:"<< recordCD.lbInLink()
72  <<" part: "<< recordCD.partitionNumber()
73  <<" partData: "<<recordCD.partitionData()
74  << std::endl << std::endl;
75 
76  if (records.complete()) formater.recordUnpack( records, prod, nullptr,nullptr);
77  }
78 }
79 }
#define LogDebug(id)
const RPCReadOutMapping * thePactCabling
void init(const edm::EventSetup &es)
int lbInLink() const
Definition: RecordCD.cc:29
unsigned int frame3() const
unsigned int linkNum() const
std::string print(const DataRecord::DataRecordType &type) const
Definition: EventRecords.cc:83
unsigned int frame2() const
void initCabling(const edm::EventSetup &es)
int partitionData() const
Definition: RecordCD.cc:49
void add(const DataRecord &record)
Definition: EventRecords.cc:22
void unpack(int triggerBX, unsigned int fed, unsigned int amc, const RpcDataWord64 &raw, RPCDigiCollection *prod)
const std::string & version() const
version as string
#define LogTrace(id)
int partitionNumber() const
Definition: RecordCD.cc:34
const T & get() const
Definition: EventSetup.h:58
int recordUnpack(const rpcrawtodigi::EventRecords &event, RPCDigiCollection *prod, RPCRawDataCounts *counter, RPCRawSynchro::ProdItem *synchro)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
MapEleIndex2LBIndex translateOmtf2Pact(const RpcLinkMap &omtfLnks, const RPCReadOutMapping *pactCabling)
RPCReadOutMapping const * convert() const
Definition: RPCEMap.h:67
void init(const edm::EventSetup &es)
unsigned int frame1() const
Definition: AMCSpec.h:8
MapEleIndex2LBIndex theOmtf2Pact
unsigned int bxNum() const