From 72c03542aca97664586020fc047b39f6bc5fb44e Mon Sep 17 00:00:00 2001 From: Byeonghak Ko Date: Tue, 30 Aug 2022 12:08:23 +0200 Subject: [PATCH 1/2] Using vfat.position instead of vfat.phi --- DQM/GEM/plugins/GEMDAQStatusSource.cc | 5 +++-- EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DQM/GEM/plugins/GEMDAQStatusSource.cc b/DQM/GEM/plugins/GEMDAQStatusSource.cc index bb11767fdf639..0214af0b63e3f 100644 --- a/DQM/GEM/plugins/GEMDAQStatusSource.cc +++ b/DQM/GEM/plugins/GEMDAQStatusSource.cc @@ -506,7 +506,7 @@ void GEMDAQStatusSource::analyze(edm::Event const &event, edm::EventSetup const const GEMVFATStatusCollection::Range &range = (*vfatIt).second; for (auto vfatStat = range.first; vfatStat != range.second; ++vfatStat) { - Int_t nIdxVFAT = getVFATNumber(gid.station(), gid.ieta(), vfatStat->vfatPosition()); + Int_t nIdxVFAT = vfatStat->vfatPosition(); GEMVFATStatus::Warnings warnings{vfatStat->warnings()}; if (warnings.basicOFW) @@ -515,7 +515,8 @@ void GEMDAQStatusSource::analyze(edm::Event const &event, edm::EventSetup const mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFAT, 3); GEMVFATStatus::Errors errors{(uint8_t)vfatStat->errors()}; - mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFAT, 4); + if (errors.vc) + mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFAT, 4); if (errors.InValidHeader) mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFAT, 5); if (errors.EC) diff --git a/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc b/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc index 7e2e3a455a1bf..64a89ae70d837 100644 --- a/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc +++ b/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc @@ -194,7 +194,7 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve continue; } - GEMVFATStatus st_vfat(amc, vfat, vfat.phi(), readMultiBX_); + GEMVFATStatus st_vfat(amc, vfat, vfat.position(), readMultiBX_); if (st_vfat.isBad()) { LogDebug("GEMRawToDigiModule") << st_vfat; if (keepDAQStatus_) { From cb8d8d7f5c7c0579fe0eed2f75bc64fff53dcee1 Mon Sep 17 00:00:00 2001 From: yechanKang Date: Thu, 22 Sep 2022 17:51:24 +0900 Subject: [PATCH 2/2] Adding new flags on the GEM status digi for masking information --- DataFormats/GEMDigi/interface/GEMOHStatus.h | 14 +++++++++++++ DataFormats/GEMDigi/interface/GEMOptoHybrid.h | 10 ++++++++-- DataFormats/GEMDigi/interface/GEMVFATStatus.h | 20 +++++++++++++------ DataFormats/GEMDigi/src/classes_def.xml | 6 ++++-- .../plugins/GEMRawToDigiModule.cc | 3 ++- 5 files changed, 42 insertions(+), 11 deletions(-) diff --git a/DataFormats/GEMDigi/interface/GEMOHStatus.h b/DataFormats/GEMDigi/interface/GEMOHStatus.h index 33a35eadc01ef..3d01a2ad34047 100644 --- a/DataFormats/GEMDigi/interface/GEMOHStatus.h +++ b/DataFormats/GEMDigi/interface/GEMOHStatus.h @@ -31,6 +31,7 @@ class GEMOHStatus { uint8_t L1aNF : 1; // L1A FIFO near full uint8_t EvtSzW : 1; // Event size warning uint8_t InValidVFAT : 1; + uint8_t missingVFAT : 1; }; }; @@ -51,10 +52,15 @@ class GEMOHStatus { errors_ = error.codes; Warnings warn{0}; + existVFATs_ = oh.existVFATs(); + vfatMask_ = oh.vfatMask(); + zsMask_ = oh.zsMask(); + missingVFATs_ = (existVFATs_ ^ 0xffffff) & (vfatMask_ & (zsMask_ ^ 0xffffff)); warn.EvtNF = oh.evtNF(); warn.InNF = oh.inNF(); warn.L1aNF = (oh.l1aNF() and (oh.version() == 0)); warn.EvtSzW = oh.evtSzW(); + warn.missingVFAT = (oh.version() != 0) and (missingVFATs_ != 0); warnings_ = warn.wcodes; } @@ -67,10 +73,18 @@ class GEMOHStatus { bool isBad() const { return errors_ != 0; } uint16_t errors() const { return errors_; } uint8_t warnings() const { return warnings_; } + uint32_t missingVFATs() const { return missingVFATs_; } + uint32_t vfatMask() const { return vfatMask_; } + uint32_t zsMask() const { return zsMask_; } + uint32_t existVFATs() const { return existVFATs_; } private: uint16_t errors_; uint8_t warnings_; + uint32_t missingVFATs_; + uint32_t vfatMask_; + uint32_t zsMask_; + uint32_t existVFATs_; }; inline std::ostream& operator<<(std::ostream& out, const GEMOHStatus& status) { diff --git a/DataFormats/GEMDigi/interface/GEMOptoHybrid.h b/DataFormats/GEMDigi/interface/GEMOptoHybrid.h index 53c77cc4903a8..b869fb04ade0c 100644 --- a/DataFormats/GEMDigi/interface/GEMOptoHybrid.h +++ b/DataFormats/GEMDigi/interface/GEMOptoHybrid.h @@ -73,7 +73,7 @@ class GEMOptoHybrid { }; }; - GEMOptoHybrid() : ch_(0), ct_(0){}; + GEMOptoHybrid() : ch_(0), ct_(0), existVFATs_(0){}; ~GEMOptoHybrid() { vfatd_.clear(); } void setVersion(uint8_t i) { ver_ = i; } @@ -147,9 +147,13 @@ class GEMOptoHybrid { uint32_t zsMask() const { return GEBchamberTrailer{ct_}.ZSMask; } //!Adds VFAT data to the vector - void addVFAT(GEMVFAT v) { vfatd_.push_back(v); } + void addVFAT(GEMVFAT v) { + existVFATs_ = existVFATs_ | (0x1 << v.vfatId()); + vfatd_.push_back(v); + } //!Returns the vector of VFAT data const std::vector* vFATs() const { return &vfatd_; } + uint32_t existVFATs() const { return existVFATs_; } //!Clear the vector rof VFAT data void clearVFATs() { vfatd_.clear(); } @@ -161,6 +165,8 @@ class GEMOptoHybrid { uint64_t ch_; // GEBchamberHeader uint64_t ct_; // GEBchamberTrailer + uint32_t existVFATs_; + std::vector vfatd_; }; #endif diff --git a/DataFormats/GEMDigi/interface/GEMVFATStatus.h b/DataFormats/GEMDigi/interface/GEMVFATStatus.h index d2d0935a27f17..7cc28e7c10cfd 100644 --- a/DataFormats/GEMDigi/interface/GEMVFATStatus.h +++ b/DataFormats/GEMDigi/interface/GEMVFATStatus.h @@ -1,6 +1,7 @@ #ifndef DataFormats_GEMDigi_GEMVFATStatus_h #define DataFormats_GEMDigi_GEMVFATStatus_h #include "GEMAMC.h" +#include "GEMOptoHybrid.h" #include "GEMVFAT.h" #include #include @@ -12,8 +13,10 @@ class GEMVFATStatus { struct { uint8_t vc : 1; // VFAT CRC error uint8_t InValidHeader : 1; - uint8_t EC : 1; // does not match AMC EC - uint8_t BC : 1; // does not match AMC BC + uint8_t EC : 1; // does not match AMC EC + uint8_t BC : 1; // does not match AMC BC + uint8_t vfatMask : 1; // VFAT mask error + uint8_t zsMask : 1; // Zero Suppression mask error }; }; union Warnings { @@ -25,7 +28,7 @@ class GEMVFATStatus { }; GEMVFATStatus() {} - GEMVFATStatus(const GEMAMC& amc, const GEMVFAT& vfat, uint16_t position, bool readMultiBX) { + GEMVFATStatus(const GEMAMC& amc, const GEMOptoHybrid& oh, const GEMVFAT& vfat, bool readMultiBX) { Errors error{0}; Warnings warn{0}; @@ -33,6 +36,11 @@ class GEMVFATStatus { if (!readMultiBX) error.BC = vfat.bc() != amc.bunchCrossing(); + if (oh.version() != 0) { + error.vfatMask = (oh.vfatMask() >> vfat.vfatId()) ^ 0x1; + error.zsMask = (oh.zsMask() >> vfat.vfatId()) & 0x1; + } + if (vfat.version() > 2) { error.vc = vfat.vc(); if (vfat.header() == 0x1E) @@ -46,7 +54,7 @@ class GEMVFATStatus { else error.InValidHeader = 1; } - vfatPosition_ = position; + vfatPosition_ = vfat.vfatId(); errors_ = error.codes; warnings_ = warn.wcodes; @@ -54,12 +62,12 @@ class GEMVFATStatus { uint16_t vfatPosition() const { return vfatPosition_; } bool isBad() const { return errors_ != 0; } - uint16_t errors() const { return errors_; } + uint8_t errors() const { return errors_; } uint8_t warnings() const { return warnings_; } private: uint16_t vfatPosition_; - uint16_t errors_; + uint8_t errors_; uint8_t warnings_; }; diff --git a/DataFormats/GEMDigi/src/classes_def.xml b/DataFormats/GEMDigi/src/classes_def.xml index 64db452776cb1..97e2d0c97de60 100644 --- a/DataFormats/GEMDigi/src/classes_def.xml +++ b/DataFormats/GEMDigi/src/classes_def.xml @@ -61,8 +61,9 @@ - + + @@ -70,8 +71,9 @@ - + + diff --git a/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc b/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc index 64a89ae70d837..b3e403d105886 100644 --- a/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc +++ b/EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc @@ -178,6 +178,7 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve if (keepDAQStatus_) { outOHStatus.get()->insertDigi(cId, st_oh); } + continue; } //Read vfat data @@ -194,7 +195,7 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve continue; } - GEMVFATStatus st_vfat(amc, vfat, vfat.position(), readMultiBX_); + GEMVFATStatus st_vfat(amc, optoHybrid, vfat, readMultiBX_); if (st_vfat.isBad()) { LogDebug("GEMRawToDigiModule") << st_vfat; if (keepDAQStatus_) {