58 useDBEMap_(pset.getParameter<bool>(
"useDBEMap")),
59 keepDAQStatus_(pset.getParameter<bool>(
"keepDAQStatus")),
60 readMultiBX_(pset.getParameter<bool>(
"readMultiBX")),
61 ge21Off_(pset.getParameter<bool>(
"ge21Off")),
62 fedIdStart_(pset.getParameter<unsigned int>(
"fedIdStart")),
63 fedIdEnd_(pset.getParameter<unsigned int>(
"fedIdEnd")),
65 produces<GEMDigiCollection>();
67 produces<GEMAMC13StatusCollection>(
"AMC13Status");
68 produces<GEMAMCStatusCollection>(
"AMCStatus");
69 produces<GEMOHStatusCollection>(
"OHStatus");
70 produces<GEMVFATStatusCollection>(
"VFATStatus");
73 gemEMapToken_ = esConsumes<GEMeMap, GEMeMapRcd, edm::Transition::BeginRun>();
78 edm::LogError(
"InvalidSettings") <<
"Turning GE2/1 off requires changing the FEDIDs the GEM unpacker looks at. If "
79 "you wish to set the FEDIDs yourself, don't use the ge21Off switch.";
86 desc.
add<
bool>(
"useDBEMap",
false);
87 desc.
add<
bool>(
"keepDAQStatus",
false);
88 desc.
add<
bool>(
"readMultiBX",
false);
89 desc.
add<
bool>(
"ge21Off",
false);
92 descriptions.
add(
"muonGEMDigisDefault", desc);
96 auto gemROmap = std::make_shared<GEMROMapping>();
99 auto gemEMap = std::make_unique<GEMeMap>(eMap);
100 gemEMap->convert(*gemROmap);
104 auto gemEMap = std::make_unique<GEMeMap>();
105 gemEMap->convertDummy(*gemROmap);
112 auto outGEMDigis = std::make_unique<GEMDigiCollection>();
113 auto outAMC13Status = std::make_unique<GEMAMC13StatusCollection>();
114 auto outAMCStatus = std::make_unique<GEMAMCStatusCollection>();
115 auto outOHStatus = std::make_unique<GEMOHStatusCollection>();
116 auto outVFATStatus = std::make_unique<GEMVFATStatusCollection>();
128 LogDebug(
"GEMRawToDigiModule") <<
"fedId:" <<
fedId <<
" words: " << nWords;
130 if (st_amc13.
isBad()) {
131 LogDebug(
"GEMRawToDigiModule") << st_amc13;
133 outAMC13Status.get()->insertDigi(
fedId, st_amc13);
142 LogDebug(
"GEMRawToDigiModule") <<
"AMC13 bx:" << amc13->bunchCrossing() <<
" lv1Id:" << int(amc13->lv1Id())
143 <<
" orbitNumber:" << amc13->orbitNumber();
146 for (
const auto&
amc : *(amc13->getAMCpayloads())) {
147 uint8_t amcNum =
amc.amcNum();
149 if (!gemROMap->isValidAMC(amcEC)) {
155 if (st_amc.isBad()) {
156 LogDebug(
"GEMRawToDigiModule") << st_amc;
158 outAMCStatus.get()->insertDigi(
fedId, st_amc);
163 uint16_t amcBx =
amc.bunchCrossing();
164 LogDebug(
"GEMRawToDigiModule") <<
"AMC no.:" << int(
amc.amcNum()) <<
" bx:" <<
int(
amc.bunchCrossing())
165 <<
" lv1Id:" <<
int(
amc.lv1Id()) <<
" orbitNumber:" <<
int(
amc.orbitNumber());
168 for (
const auto& optoHybrid : *
amc.gebs()) {
169 uint8_t gebId = optoHybrid.inputID();
172 bool isValidChamber = gemROMap->isValidChamber(geb_ec);
173 if (!isValidChamber) {
182 LogDebug(
"GEMRawToDigiModule") << st_oh;
184 outOHStatus.get()->insertDigi(gemChId, st_oh);
189 for (
auto vfat : *optoHybrid.vFATs()) {
191 vfat.setVersion(geb_dc.
vfatVer);
192 uint16_t vfatId = vfat.vfatId();
195 if (!gemROMap->isValidChipID(vfat_ec)) {
205 if (st_vfat.isBad()) {
206 LogDebug(
"GEMRawToDigiModule") << st_vfat;
208 outVFATStatus.get()->insertDigi(gemId, st_vfat);
213 int bx(vfat.bc() - amcBx);
218 chan0xf = ((vfat.lsData() >>
chan) & 0x1);
220 chan0xf = ((vfat.msData() >> (
chan - 64)) & 0x1);
234 <<
"fed: " <<
fedId <<
" amc:" << int(amcNum) <<
" geb:" << int(gebId) <<
" vfat id:" << int(vfatId)
235 <<
",type:" << vfat_dc.
vfatType <<
" id:" << gemId <<
" ch:" << chMap.chNum <<
" st:" << digi.
strip()
236 <<
" bx:" << digi.
bx();
238 outGEMDigis.get()->insertDigi(gemId, digi);
243 outVFATStatus.get()->insertDigi(gemId, st_vfat);
249 outOHStatus.get()->insertDigi(gemChId, st_oh);
255 outAMCStatus.get()->insertDigi(
fedId, st_amc);
261 outAMC13Status.get()->insertDigi(
fedId, st_amc13);
EventNumber_t event() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::ESGetToken< GEMeMap, GEMeMapRcd > gemEMapToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
tuple chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
int bunchCrossing() const
Run const & getRun() const
static const int maxChan_
Log< level::Error, false > LogError
size_t size() const
Lenght of the data buffer in bytes.
static const int nChannels
edm::EDGetTokenT< FEDRawDataCollection > fed_token
void globalEndRun(edm::Run const &, edm::EventSetup const &) const override
bool getData(T &iHolder) const
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
GEMRawToDigiModule(const edm::ParameterSet &pset)
Constructor.
unsigned long long uint64_t
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< GEMRawToDigi > gemRawToDigi_
std::shared_ptr< GEMROMapping > globalBeginRun(edm::Run const &, edm::EventSetup const &) const override
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.