21 useDBEMap_(pset.getParameter<
bool>(
"useDBEMap")),
22 unPackStatusDigis_(pset.getParameter<
bool>(
"unPackStatusDigis"))
24 produces<GEMDigiCollection>();
26 produces<GEMVfatStatusDigiCollection>(
"vfatStatus");
27 produces<GEMGEBStatusDigiCollection>(
"GEBStatus");
28 produces<GEMAMCStatusDigiCollection>(
"AMCStatus");
36 desc.
add<
bool>(
"useDBEMap",
false);
37 desc.
add<
bool>(
"unPackStatusDigis",
false);
38 descriptions.
add(
"muonGEMDigisDefault", desc);
43 auto gemORmap = std::make_shared<GEMROmap>();
47 auto gemEMap = std::make_unique<GEMELMap>(*(gemEMapRcd.
product()));
48 gemEMap->convert(*gemORmap);
53 auto gemEMap = std::make_unique<GEMELMap>();
54 gemEMap->convertDummy(*gemORmap);
62 auto outGEMDigis = std::make_unique<GEMDigiCollection>();
63 auto outVfatStatus = std::make_unique<GEMVfatStatusDigiCollection>();
64 auto outGEBStatus = std::make_unique<GEMGEBStatusDigiCollection>();
65 auto outAMCStatus = std::make_unique<GEMAMCStatusDigiCollection>();
74 const FEDRawData& fedData = fed_buffers->FEDData(
id);
77 LogDebug(
"GEMRawToDigiModule") <<
" words " << nWords;
78 if (nWords<5)
continue;
79 const unsigned char *
data = fedData.
data();
81 auto amc13Event = std::make_unique<AMC13Event>();
85 amc13Event->setCDFHeader(*word);
86 amc13Event->setAMC13header(*(++word));
89 for (
unsigned short i = 0;
i < amc13Event->nAMC(); ++
i)
90 amc13Event->addAMCheader(*(++word));
93 for (
unsigned short i = 0;
i < amc13Event->nAMC(); ++
i){
94 auto amcData = std::make_unique<AMCdata>();
95 amcData->setAMCheader1(*(++word));
96 amcData->setAMCheader2(*(++word));
97 amcData->setGEMeventHeader(*(++word));
98 uint16_t amcId = amcData->boardId();
99 uint16_t amcBx = amcData->bx();
102 for (
unsigned short j = 0; j < amcData->gdCount(); ++j){
103 auto gebData = std::make_unique<GEBdata>();
104 gebData->setChamberHeader(*(++word));
106 unsigned int m_nvb = gebData->vwh() / 3;
107 uint16_t gebId = gebData->inputID();
109 for (
unsigned short k = 0;
k < m_nvb;
k++){
110 auto vfatData = std::make_unique<VFATdata>();
111 vfatData->read_fw(*(++word));
112 vfatData->read_sw(*(++word));
113 vfatData->read_tw(*(++word));
114 gebData->addVFAT(*vfatData);
116 uint16_t bc=vfatData->bc();
117 uint8_t b1010=vfatData->b1010();
118 uint8_t b1100=vfatData->b1100();
119 uint8_t b1110=vfatData->b1110();
120 uint16_t vfatId=vfatData->chipID();
121 uint16_t crc = vfatData->crc();
122 uint16_t crc_check = vfatData->checkCRC();
123 bool Quality = (b1010==10) && (b1100==12) && (b1110==14) && (crc==crc_check);
125 if (crc!=crc_check)
edm::LogWarning(
"GEMRawToDigiModule") <<
"DIFFERENT CRC :"<<crc<<
" "<<crc_check;
126 if (!Quality)
edm::LogWarning(
"GEMRawToDigiModule") <<
"Quality "<< Quality
127 <<
" b1010 "<<
int(b1010)
128 <<
" b1100 "<<
int(b1100)
129 <<
" b1110 "<<
int(b1110);
134 if (!gemROMap->isValidChipID(ec)){
141 if (
chan < 64) chan0xf = ((vfatData->lsData() >>
chan) & 0
x1);
142 else chan0xf = ((vfatData->msData() >> (
chan-64)) & 0x1);
145 if(chan0xf==0)
continue;
160 <<
" gemDetId "<< gemId
161 <<
" chan "<< chMap.
chNum 162 <<
" strip "<< stripId
163 <<
" bx "<< digi.
bx();
165 outGEMDigis.get()->insertDigi(gemId,digi);
170 crc, vfatData->crc_calc(),
171 b1010, b1100, b1110, vfatData->flag(),
172 vfatData->isBlockGood());
173 outVfatStatus.get()->insertDigi(gebData->inputID(),vfatStatus);
178 gebData->setChamberTrailer(*(++word));
188 gebData->getGEBflag());
189 outGEBStatus.get()->insertDigi(gebData->inputID(),gebStatus);
192 amcData->addGEB(*gebData);
195 amcData->setGEMeventTrailer(*(++word));
196 amcData->setAMCTrailer(*(++word));
214 amcData->chamberTimeOut(),
216 outAMCStatus.get()->insertDigi(amcData->boardId(), amcStatus);
219 amc13Event->addAMCpayload(*amcData);
222 amc13Event->setAMC13trailer(*(++word));
223 amc13Event->setCDFTrailer(*(++word));
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Run const & getRun() const
std::shared_ptr< GEMROmap > globalBeginRun(edm::Run const &, edm::EventSetup const &) const override
size_t size() const
Lenght of the data buffer in bytes.
static const int maxVFatGE21_
edm::EDGetTokenT< FEDRawDataCollection > fed_token
static const int maxChan_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int station() const
Station id : the station is the pair of chambers at same disk.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
GEMRawToDigiModule(const edm::ParameterSet &pset)
Constructor.
unsigned long long uint64_t
static const int maxVFatGE11_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
char data[epos_bytes_allocation]
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
T const * product() const