CMS 3D CMS Logo

List of all members | Public Member Functions
omtf::DtPacker Class Reference

#include <OmtfDtPacker.h>

Public Member Functions

void pack (const L1MuDTChambPhContainer *phCont, const L1MuDTChambThContainer *thCont, FedAmcRawsMap &raws)
 

Detailed Description

Definition at line 13 of file OmtfDtPacker.h.

Member Function Documentation

◆ pack()

void omtf::DtPacker::pack ( const L1MuDTChambPhContainer phCont,
const L1MuDTChambThContainer thCont,
FedAmcRawsMap raws 
)

Definition at line 8 of file OmtfDtPacker.cc.

8  {
9  const L1MuDTChambPhContainer& dtphDigisBMTF = *phCont;
10  const L1MuDTChambThContainer& dtthDigisBMTF = *thCont;
11  for (const auto& chDigi : *dtphDigisBMTF.getContainer()) {
12  if (std::abs(chDigi.whNum()) != 2)
13  continue;
14  if (chDigi.stNum() == 4)
15  continue;
16  DtDataWord64 data;
17  data.st_phi_ = chDigi.phi();
18  data.st_phib_ = chDigi.phiB();
19  data.st_q_ = chDigi.code();
20  int bxNumber = chDigi.bxNum();
21  data.bxNum_ = (3 + bxNumber);
22  data.st_ = chDigi.stNum() - 1;
23  data.valid_ = 1;
24  int bxCnt = (chDigi.BxCnt() >= 0 && chDigi.BxCnt() <= 3) ? chDigi.BxCnt() : 0;
25  data.bcnt_st_ = bxCnt;
26  data.bcnt_e0_ = bxCnt;
27  data.bcnt_e1_ = bxCnt;
28  data.fiber_ = chDigi.Ts2Tag();
29  unsigned int amc;
30  unsigned int amc2 = 0;
31  unsigned int fed = (chDigi.whNum() == -2) ? 1380 : 1381;
32  if (chDigi.scNum() % 2 != 0) {
33  amc = chDigi.scNum();
34  data.sector_ = 1;
35  } else {
36  amc = chDigi.scNum() + 1;
37  data.sector_ = 0;
38  amc2 = (chDigi.scNum() + 11) % 12; // in this case data.sector_ should be 2, fixed later
39  }
40  LogTrace("") << " fed: " << fed << " amc: " << amc << " DT PH DATA: " << data << std::endl;
41  raws[std::make_pair(fed, amc)].push_back(data.rawData);
42  if (amc2 != 0) {
43  data.sector_ = 2;
44  LogTrace("") << " fed: " << fed << " amc: " << amc2 << " DT PH DATA: " << data << std::endl;
45  raws[std::make_pair(fed, amc2)].push_back(data.rawData);
46  }
47  }
48 
49  //
50  //
51  //
52  for (const auto& chDigi : *dtthDigisBMTF.getContainer()) {
53  if (std::abs(chDigi.whNum()) != 2)
54  continue;
55  if (chDigi.stNum() == 4)
56  continue;
57  DtDataWord64 data;
58  int bxNumber = chDigi.bxNum();
59  data.bxNum_ = (3 + bxNumber);
60  data.st_ = chDigi.stNum() - 1;
61  data.valid_ = 1;
62  unsigned int amc;
63  unsigned int amc2 = 0;
64  unsigned int fed = (chDigi.whNum() == -2) ? 1380 : 1381;
65  if (chDigi.scNum() % 2 != 0) {
66  amc = chDigi.scNum();
67  data.sector_ = 1;
68  } else {
69  amc = chDigi.scNum() + 1;
70  data.sector_ = 0;
71  amc2 = (chDigi.scNum() + 11) % 12; // in this case data.sector_ should be 2, fixed later
72  }
73  unsigned int eta = 0;
74  unsigned int etaQ = 0;
75  for (unsigned int ipos = 0; ipos < 7; ipos++) {
76  if (chDigi.position(ipos) > 1)
77  edm::LogError("OmtfDtPacker") << "DT TH position to ETA, PROBLEM !!!!";
78  if (chDigi.position(ipos) == 1)
79  eta |= (1 << ipos);
80  if (chDigi.quality(ipos) == 1)
81  etaQ |= (1 << ipos);
82  }
83  data.eta_qbit_ = etaQ;
84  data.eta_hit_ = eta;
85  bool foundDigi = false;
86  for (auto& raw : raws) {
87  if (raw.first.first != fed)
88  continue;
89  unsigned int amcPh = raw.first.second;
90  if (amc != amcPh && amc2 != amcPh)
91  continue;
92  auto& words = raw.second;
93  for (auto& word : words) {
95  continue;
96  DtDataWord64 dataRaw(word);
97  if (dataRaw.bxNum_ != data.bxNum_)
98  continue;
99  if (dataRaw.st_ != data.st_)
100  continue;
101  if ((amcPh == amc && dataRaw.sector_ == data.sector_) || (amcPh == amc2 && 2 == dataRaw.sector_)) {
102  foundDigi = true;
103  dataRaw.eta_qbit_ = data.eta_qbit_;
104  dataRaw.eta_hit_ = data.eta_hit_;
105  word = dataRaw.rawData;
106  LogTrace("") << "AP fed: " << fed << " amc: " << amc << " DT TH DATA: " << dataRaw << std::endl;
107  }
108  }
109  }
110  if (!foundDigi) {
111  LogTrace("") << "NFD fed: " << fed << " amc: " << amc << " DT TH DATA: " << data << std::endl;
112  raws[std::make_pair(fed, amc)].push_back(data.rawData);
113  if (amc2 != 0) {
114  data.sector_ = 2;
115  LogTrace("") << "NFD fed: " << fed << " amc2: " << amc2 << " DT TH DATA: " << data << std::endl;
116  raws[std::make_pair(fed, amc2)].push_back(data.rawData);
117  }
118  }
119  }
120  }

References funct::abs(), amc, omtf::DtDataWord64::bxNum_, data, omtf::DataWord64::dt, PVValHelper::eta, omtf::DtDataWord64::eta_hit_, omtf::DtDataWord64::eta_qbit_, L1MuDTChambPhContainer::getContainer(), L1MuDTChambThContainer::getContainer(), LogTrace, omtf::DtDataWord64::rawData, omtf::DtDataWord64::sector_, omtf::DtDataWord64::st_, and omtf::DataWord64::type().

Referenced by omtf::OmtfPacker::produce().

L1MuDTChambPhContainer
Definition: L1MuDTChambPhContainer.h:33
L1MuDTChambPhContainer::getContainer
Phi_Container const * getContainer() const
Definition: L1MuDTChambPhContainer.cc:41
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
PVValHelper::eta
Definition: PVValidationHelpers.h:70
omtf::DataWord64::dt
Definition: OmtfDataWord64.h:16
L1MuDTChambThContainer::getContainer
The_Container const * getContainer() const
Definition: L1MuDTChambThContainer.cc:41
omtf::DataWord64::type
Type type(const T &)
amc
Definition: AMCSpec.h:8
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
amc
double amc
Definition: hdecay.h:20
L1MuDTChambThContainer
Definition: L1MuDTChambThContainer.h:33
edm::Log
Definition: MessageLogger.h:70