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

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

Definition at line 8 of file OmtfDtPacker.cc.

References funct::abs(), amc, omtf::DtDataWord64::bcnt_e0_, omtf::DtDataWord64::bcnt_e1_, omtf::DtDataWord64::bcnt_st_, omtf::DtDataWord64::bxNum_, data, omtf::DataWord64::dt, PVValHelper::eta, omtf::DtDataWord64::eta_hit_, omtf::DtDataWord64::eta_qbit_, omtf::DtDataWord64::fiber_, L1MuDTChambThContainer::getContainer(), L1MuDTChambPhContainer::getContainer(), LogTrace, omtf::DtDataWord64::rawData, omtf::DtDataWord64::sector_, omtf::DtDataWord64::st_, omtf::DtDataWord64::st_phi_, omtf::DtDataWord64::st_phib_, omtf::DtDataWord64::st_q_, omtf::DataWord64::type(), and omtf::DtDataWord64::valid_.

Referenced by pyrootRender.interactiveRender::draw(), and omtf::OmtfPacker::produce().

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