CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DTDataIntegrityROSOffline Class Reference

#include <DTDataIntegrityROSOffline.h>

Inheritance diagram for DTDataIntegrityROSOffline:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
 DTDataIntegrityROSOffline (const edm::ParameterSet &ps)
 
void fedEntry (int dduID)
 
void fedFatal (int dduID)
 
void fedNonFatal (int dduID)
 
void processFED (DTDDUData &dduData, const std::vector< DTROS25Data > &rosData, int dduID)
 
void processROS25 (DTROS25Data &data, int dduID, int ros)
 
 ~DTDataIntegrityROSOffline () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Private Member Functions

void bookHistos (DQMStore::IBooker &, const int fedMin, const int fedMax)
 
void bookHistos (DQMStore::IBooker &, std::string folder, DTROChainCoding code)
 
void bookHistosROS25 (DQMStore::IBooker &, DTROChainCoding code)
 
void channelsInCEROS (int cerosId, int chMask, std::vector< int > &channels)
 
void channelsInROS (int cerosMask, std::vector< int > &channels)
 
std::string topFolder (bool isFEDIntegrity) const
 

Private Attributes

edm::EDGetTokenT< DTDDUCollectiondduToken
 
bool eventErrorFlag
 
std::set< int > fedBXIds
 
std::map< std::string, std::map< int, MonitorElement * > > fedHistos
 
int FEDIDmax
 
int FEDIDmin
 
std::string fedIntegrityFolder
 
bool getSCInfo
 
MonitorElementhCorruptionSummary
 
MonitorElementhFEDEntry
 
MonitorElementhFEDFatal
 
MonitorElementhFEDNonFatal
 
MonitorElementhTTSSummary
 
MonitorElementnEventMonitor
 
int nevents
 
int neventsFED
 
int neventsROS
 
const int nROS = 12
 
edm::EDGetTokenT< DTROS25Collectionros25Token
 
std::map< int, std::set< int > > rosBxIdsPerFED
 
std::map< std::string, std::map< int, MonitorElement * > > rosHistos
 
std::map< int, std::set< int > > rosL1AIdsPerFED
 
std::map< std::string, std::map< int, MonitorElement * > > summaryHistos
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Class for DT Data Integrity.

Author
Marco Zanetti (INFN Padova), Gianluca Cerminara (INFN Torino)

Definition at line 33 of file DTDataIntegrityROSOffline.h.

Constructor & Destructor Documentation

◆ DTDataIntegrityROSOffline()

DTDataIntegrityROSOffline::DTDataIntegrityROSOffline ( const edm::ParameterSet ps)

Definition at line 29 of file DTDataIntegrityROSOffline.cc.

References dduToken, FEDIDmax, FEDIDmin, fedIntegrityFolder, getSCInfo, edm::ParameterSet::getUntrackedParameter(), LogTrace, FEDNumbering::MAXDTFEDID, FEDNumbering::MINDTFEDID, neventsFED, and ros25Token.

29  : nevents(0) {
30  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
31  << "[DTDataIntegrityROSOffline]: Constructor" << endl;
32 
33  dduToken = consumes<DTDDUCollection>(ps.getUntrackedParameter<InputTag>("dtDDULabel"));
34  ros25Token = consumes<DTROS25Collection>(ps.getUntrackedParameter<InputTag>("dtROS25Label"));
37 
38  neventsFED = 0;
39 
40  // Plot quantities about SC
41  getSCInfo = ps.getUntrackedParameter<bool>("getSCInfo", false);
42 
43  fedIntegrityFolder = ps.getUntrackedParameter<string>("fedIntegrityFolder", "DT/FEDIntegrity");
44 }
#define LogTrace(id)
edm::EDGetTokenT< DTROS25Collection > ros25Token
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< DTDDUCollection > dduToken

◆ ~DTDataIntegrityROSOffline()

DTDataIntegrityROSOffline::~DTDataIntegrityROSOffline ( )
override

Definition at line 46 of file DTDataIntegrityROSOffline.cc.

References LogTrace, and neventsFED.

46  {
47  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
48  << "[DTDataIntegrityROSOffline]: Destructor. Analyzed " << neventsFED << " events" << endl;
49  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
50  << "[DTDataIntegrityROSOffline]: postEndJob called!" << endl;
51 }
#define LogTrace(id)

Member Function Documentation

◆ analyze()

void DTDataIntegrityROSOffline::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 713 of file DTDataIntegrityROSOffline.cc.

References dduToken, MillePedeFileConverter_cfg::e, eventErrorFlag, fedBXIds, FEDIDmax, FEDIDmin, dqm::impl::MonitorElement::Fill(), DTDDUData::getDDUHeader(), RecoTauValidation_cfi::header, mps_fire::i, edm::HandleBase::isValid(), dqmiolumiharvest::j, LogTrace, genParticles_cff::map, nEventMonitor, nevents, processFED(), processROS25(), ros25Token, rosBxIdsPerFED, and rosL1AIdsPerFED.

713  {
714  nevents++;
716 
717  LogTrace("DTRawToDigi|TDQM|DTMonitorModule|DTDataIntegrityROSOffline")
718  << "[DTDataIntegrityROSOffline]: preProcessEvent" << endl;
719 
720  //Legacy ROS
721  // clear the set of BXids from the ROSs
722  for (map<int, set<int> >::iterator rosBxIds = rosBxIdsPerFED.begin(); rosBxIds != rosBxIdsPerFED.end(); ++rosBxIds) {
723  (*rosBxIds).second.clear();
724  }
725 
726  fedBXIds.clear();
727 
728  for (map<int, set<int> >::iterator rosL1AIds = rosL1AIdsPerFED.begin(); rosL1AIds != rosL1AIdsPerFED.end();
729  ++rosL1AIds) {
730  (*rosL1AIds).second.clear();
731  }
732 
733  // reset the error flag
734  eventErrorFlag = false;
735 
736  // Digi collection
737  edm::Handle<DTDDUCollection> dduProduct;
738  e.getByToken(dduToken, dduProduct);
739  edm::Handle<DTROS25Collection> ros25Product;
740  e.getByToken(ros25Token, ros25Product);
741 
742  DTDDUData dduData;
743  std::vector<DTROS25Data> ros25Data;
744  if (dduProduct.isValid() && ros25Product.isValid()) {
745  for (unsigned int i = 0; i < dduProduct->size(); ++i) {
746  dduData = dduProduct->at(i);
747  ros25Data = ros25Product->at(i);
748  FEDHeader header = dduData.getDDUHeader();
749  int id = header.sourceID();
750  if (id > FEDIDmax || id < FEDIDmin)
751  continue; //SIM uses extra FEDs not monitored
752 
753  processFED(dduData, ros25Data, id);
754  for (unsigned int j = 0; j < ros25Data.size(); ++j) {
755  int rosid = j + 1;
756  processROS25(ros25Data[j], id, rosid);
757  }
758  }
759  }
760 }
void processFED(DTDDUData &dduData, const std::vector< DTROS25Data > &rosData, int dduID)
#define LogTrace(id)
edm::EDGetTokenT< DTROS25Collection > ros25Token
void Fill(long long x)
edm::EDGetTokenT< DTDDUCollection > dduToken
std::map< int, std::set< int > > rosL1AIdsPerFED
const FEDHeader & getDDUHeader() const
Getters.
bool isValid() const
Definition: HandleBase.h:70
std::map< int, std::set< int > > rosBxIdsPerFED
void processROS25(DTROS25Data &data, int dduID, int ros)

◆ bookHistograms()

void DTDataIntegrityROSOffline::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 62 of file DTDataIntegrityROSOffline.cc.

References bookHistos(), bookHistosROS25(), FEDIDmax, FEDIDmin, LogTrace, nROS, DTROChainCoding::setDDU(), and DTROChainCoding::setROS().

64  {
65  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
66  << "[DTDataIntegrityROSOffline]: postBeginJob" << endl;
67 
68  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
69  << "[DTDataIntegrityROSOffline] Get DQMStore service" << endl;
70 
71  // Loop over the DT FEDs
72 
73  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
74  << " FEDS: " << FEDIDmin << " to " << FEDIDmax << " in the RO" << endl;
75 
76  // book FED integrity histos
77  bookHistos(ibooker, FEDIDmin, FEDIDmax);
78 
79  //Legacy ROS
80 
81  // static booking of the histograms
82 
83  for (int fed = FEDIDmin; fed <= FEDIDmax; ++fed) { // loop over the FEDs in the readout
84  DTROChainCoding code;
85  code.setDDU(fed);
86  bookHistos(ibooker, string("ROS_S"), code);
87 
88  bookHistos(ibooker, string("DDU"), code);
89 
90  for (int ros = 1; ros <= nROS; ++ros) { // loop over all ROS
91  code.setROS(ros);
92  bookHistosROS25(ibooker, code);
93  }
94  }
95 }
void bookHistosROS25(DQMStore::IBooker &, DTROChainCoding code)
#define LogTrace(id)
void bookHistos(DQMStore::IBooker &, const int fedMin, const int fedMax)
void setROS(const int &ID)
void setDDU(const int &ID)
need to reset the bits before setting

◆ bookHistos() [1/2]

void DTDataIntegrityROSOffline::bookHistos ( DQMStore::IBooker ibooker,
const int  fedMin,
const int  fedMax 
)
private

Definition at line 97 of file DTDataIntegrityROSOffline.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::IBooker::bookFloat(), hCorruptionSummary, hFEDEntry, hFEDFatal, hFEDNonFatal, hTTSSummary, nEventMonitor, dqm::impl::MonitorElement::setAxisTitle(), dqm::impl::MonitorElement::setBinLabel(), dqm::implementation::NavigatorBase::setCurrentFolder(), and topFolder().

Referenced by bookHistograms(), and bookHistosROS25().

97  {
98  ibooker.setCurrentFolder("DT/EventInfo/Counters");
99  nEventMonitor = ibooker.bookFloat("nProcessedEventsDataIntegrity");
100 
101  // Standard FED integrity histos
102  ibooker.setCurrentFolder(topFolder(true));
103 
104  int nFED = (fedMax - fedMin) + 1;
105 
106  hFEDEntry = ibooker.book1D("FEDEntries", "# entries per DT FED", nFED, fedMin, fedMax + 1);
107 
108  hFEDFatal = ibooker.book1D("FEDFatal", "# fatal errors DT FED", nFED, fedMin, fedMax + 1);
109  hFEDNonFatal = ibooker.book1D("FEDNonFatal", "# NON fatal errors DT FED", nFED, fedMin, fedMax + 1);
110 
111  ibooker.setCurrentFolder(topFolder(false));
112  hTTSSummary = ibooker.book2D("TTSSummary", "Summary Status TTS", nFED, fedMin, fedMax + 1, 9, 1, 10);
113  hTTSSummary->setAxisTitle("FED", 1);
114  hTTSSummary->setBinLabel(1, "ROS PAF", 2);
115  hTTSSummary->setBinLabel(2, "DDU PAF", 2);
116  hTTSSummary->setBinLabel(3, "ROS PAF", 2);
117  hTTSSummary->setBinLabel(4, "DDU PAF", 2);
118  hTTSSummary->setBinLabel(5, "DDU Full", 2);
119  hTTSSummary->setBinLabel(6, "L1A Mism.", 2);
120  hTTSSummary->setBinLabel(7, "ROS Error", 2);
121  hTTSSummary->setBinLabel(8, "BX Mism.", 2);
122  hTTSSummary->setBinLabel(9, "DDU Logic Err.", 2);
123 
124  // bookkeeping of the histos
126  ibooker.book2D("DataCorruptionSummary", "Data Corruption Sources", nFED, fedMin, fedMax + 1, 8, 1, 9);
127  hCorruptionSummary->setAxisTitle("FED", 1);
128  hCorruptionSummary->setBinLabel(1, "Miss Ch.", 2);
129  hCorruptionSummary->setBinLabel(2, "ROS BX mism", 2);
130  hCorruptionSummary->setBinLabel(3, "DDU BX mism", 2);
131  hCorruptionSummary->setBinLabel(4, "ROS L1A mism", 2);
132  hCorruptionSummary->setBinLabel(5, "Miss Payload", 2);
133  hCorruptionSummary->setBinLabel(6, "FCRC bit", 2);
134  hCorruptionSummary->setBinLabel(7, "Header check", 2);
135  hCorruptionSummary->setBinLabel(8, "Trailer Check", 2);
136 }
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
std::string topFolder(bool isFEDIntegrity) const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)

◆ bookHistos() [2/2]

void DTDataIntegrityROSOffline::bookHistos ( DQMStore::IBooker ,
std::string  folder,
DTROChainCoding  code 
)
private

◆ bookHistosROS25()

void DTDataIntegrityROSOffline::bookHistosROS25 ( DQMStore::IBooker ibooker,
DTROChainCoding  code 
)
private

Definition at line 305 of file DTDataIntegrityROSOffline.cc.

References bookHistos().

Referenced by bookHistograms().

305  {
306  bookHistos(ibooker, string("ROS"), code);
307 }
void bookHistos(DQMStore::IBooker &, const int fedMin, const int fedMax)

◆ channelsInCEROS()

void DTDataIntegrityROSOffline::channelsInCEROS ( int  cerosId,
int  chMask,
std::vector< int > &  channels 
)
private

Definition at line 693 of file DTDataIntegrityROSOffline.cc.

References ewkTauDQM_cfi::channels, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by processROS25().

693  {
694  for (int iCh = 0; iCh < 6; ++iCh) {
695  if ((chMask >> iCh) & 0x1) {
696  channels.push_back(cerosId * 6 + iCh);
697  }
698  }
699  return;
700 }

◆ channelsInROS()

void DTDataIntegrityROSOffline::channelsInROS ( int  cerosMask,
std::vector< int > &  channels 
)
private

Definition at line 702 of file DTDataIntegrityROSOffline.cc.

References ewkTauDQM_cfi::channels, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by processROS25().

702  {
703  for (int iCeros = 0; iCeros < 5; ++iCeros) {
704  if ((cerosMask >> iCeros) & 0x1) {
705  for (int iCh = 0; iCh < 6; ++iCh) {
706  channels.push_back(iCeros * 6 + iCh);
707  }
708  }
709  }
710  return;
711 }

◆ fedEntry()

void DTDataIntegrityROSOffline::fedEntry ( int  dduID)

Definition at line 679 of file DTDataIntegrityROSOffline.cc.

References dqm::impl::MonitorElement::Fill(), and hFEDEntry.

679 { hFEDEntry->Fill(dduID); }
void Fill(long long x)

◆ fedFatal()

void DTDataIntegrityROSOffline::fedFatal ( int  dduID)

Definition at line 682 of file DTDataIntegrityROSOffline.cc.

References dqm::impl::MonitorElement::Fill(), and hFEDFatal.

682 { hFEDFatal->Fill(dduID); }
void Fill(long long x)

◆ fedNonFatal()

void DTDataIntegrityROSOffline::fedNonFatal ( int  dduID)

Definition at line 685 of file DTDataIntegrityROSOffline.cc.

References dqm::impl::MonitorElement::Fill(), and hFEDNonFatal.

685 { hFEDNonFatal->Fill(dduID); }
void Fill(long long x)

◆ processFED()

void DTDataIntegrityROSOffline::processFED ( DTDDUData dduData,
const std::vector< DTROS25Data > &  rosData,
int  dduID 
)

Definition at line 543 of file DTDataIntegrityROSOffline.cc.

References FEDTrailer::check(), data, fedBXIds, fedHistos, FEDIDmax, FEDIDmin, dqm::impl::MonitorElement::Fill(), FEDTrailer::fragmentLength(), DTROChainCoding::getDDUID(), hCorruptionSummary, RecoTauValidation_cfi::header, hFEDEntry, hFEDFatal, mps_fire::i, LogTrace, neventsFED, rosBxIdsPerFED, rosL1AIdsPerFED, DTDDUSecondStatusWord::rosList(), DTROChainCoding::setDDU(), and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by analyze().

543  {
544  neventsFED++;
545  if (neventsFED % 1000 == 0)
546  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
547  << "[DTDataIntegrityROSOffline]: " << neventsFED << " events analyzed by processFED" << endl;
548 
549  DTROChainCoding code;
550  code.setDDU(ddu);
551  if (code.getDDUID() < FEDIDmin || code.getDDUID() > FEDIDmax)
552  return;
553 
554  hFEDEntry->Fill(code.getDDUID());
555 
556  const FEDTrailer& trailer = data.getDDUTrailer();
557  const FEDHeader& header = data.getDDUHeader();
558 
559  // check consistency of header and trailer
560  if (!header.check()) {
561  // error code 7
562  hFEDFatal->Fill(code.getDDUID());
563  hCorruptionSummary->Fill(code.getDDUID(), 7);
564  }
565 
566  if (!trailer.check()) {
567  // error code 8
568  hFEDFatal->Fill(code.getDDUID());
569  hCorruptionSummary->Fill(code.getDDUID(), 8);
570  }
571 
572  // check CRC error bit set by DAQ before sending data on SLink
573  if (data.crcErrorBit()) {
574  // error code 6
575  hFEDFatal->Fill(code.getDDUID());
576  hCorruptionSummary->Fill(code.getDDUID(), 6);
577  }
578 
579  const DTDDUSecondStatusWord& secondWord = data.getSecondStatusWord();
580 
581  //2D HISTO: ROS VS STATUS (8 BIT = 8 BIN) from 1st-2nd status words (9th BIN FROM LIST OF ROS in 2nd status word)
582  MonitorElement* hROSStatus = fedHistos["ROSStatus"][code.getDDUID()];
583  //1D HISTO: NUMBER OF ROS IN THE EVENTS from 2nd status word
584 
585  int rosList = secondWord.rosList();
586  set<int> rosPositions;
587  for (int i = 0; i < 12; i++) {
588  if (rosList & 0x1) {
589  rosPositions.insert(i);
590  //9th BIN FROM LIST OF ROS in 2nd status word
591  hROSStatus->Fill(8, i, 1);
592  }
593  rosList >>= 1;
594  }
595 
596  int channel = 0;
597  for (vector<DTDDUFirstStatusWord>::const_iterator fsw_it = data.getFirstStatusWord().begin();
598  fsw_it != data.getFirstStatusWord().end();
599  fsw_it++) {
600  // assuming association one-to-one between DDU channel and ROS
601  hROSStatus->Fill(0, channel, (*fsw_it).channelEnabled());
602  hROSStatus->Fill(1, channel, (*fsw_it).timeout());
603  hROSStatus->Fill(2, channel, (*fsw_it).eventTrailerLost());
604  hROSStatus->Fill(3, channel, (*fsw_it).opticalFiberSignalLost());
605  hROSStatus->Fill(4, channel, (*fsw_it).tlkPropagationError());
606  hROSStatus->Fill(5, channel, (*fsw_it).tlkPatternError());
607  hROSStatus->Fill(6, channel, (*fsw_it).tlkSignalLost());
608  hROSStatus->Fill(7, channel, (*fsw_it).errorFromROS());
609  // check that the enabled channel was also in the read-out
610  if ((*fsw_it).channelEnabled() == 1 && rosPositions.find(channel) == rosPositions.end()) {
611  hROSStatus->Fill(9, channel, 1);
612  // error code 1
613  hFEDFatal->Fill(code.getDDUID());
614  hCorruptionSummary->Fill(code.getDDUID(), 1);
615  }
616  channel++;
617  }
618 
619  // ---------------------------------------------------------------------
620  // cross checks between FED and ROS data
621  // check the BX ID against the ROSs
622  set<int> rosBXIds = rosBxIdsPerFED[ddu];
623  if ((rosBXIds.size() > 1 || rosBXIds.find(header.bxID()) == rosBXIds.end()) &&
624  !rosBXIds.empty()) { // in this case look for faulty ROSs
625  for (vector<DTROS25Data>::const_iterator rosControlData = rosData.begin(); rosControlData != rosData.end();
626  ++rosControlData) { // loop over the ROS data
627  for (vector<DTROSDebugWord>::const_iterator debug_it = (*rosControlData).getROSDebugs().begin();
628  debug_it != (*rosControlData).getROSDebugs().end();
629  debug_it++) { // Loop over ROS debug words
630  if ((*debug_it).debugType() == 0 && (*debug_it).debugMessage() != header.bxID()) { // check the BX
631  int ros = (*rosControlData).getROSID();
632  // fill the error bin
633  hROSStatus->Fill(11, ros - 1);
634  // error code 2
635  hFEDFatal->Fill(code.getDDUID());
636  hCorruptionSummary->Fill(code.getDDUID(), 2);
637  }
638  }
639  }
640  }
641 
642  // check the BX ID against other FEDs
643  fedBXIds.insert(header.bxID());
644  if (fedBXIds.size() != 1) {
645  LogWarning("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
646  << "ERROR: FED " << ddu << " BX ID different from other feds: " << header.bxID() << endl;
647  // error code 3
648  hFEDFatal->Fill(code.getDDUID());
649  hCorruptionSummary->Fill(code.getDDUID(), 3);
650  }
651 
652  // check the L1A ID against the ROSs
653  set<int> rosL1AIds = rosL1AIdsPerFED[ddu];
654  if ((rosL1AIds.size() > 1 || rosL1AIds.find(header.lvl1ID() - 1) == rosL1AIds.end()) &&
655  !rosL1AIds.empty()) { // in this case look for faulty ROSs
656  //If L1A_ID error identify which ROS has wrong L1A
657  for (vector<DTROS25Data>::const_iterator rosControlData = rosData.begin(); rosControlData != rosData.end();
658  rosControlData++) { // loop over the ROS data
659  unsigned int ROSHeader_TTCCount =
660  ((*rosControlData).getROSHeader().TTCEventCounter() + 1) %
661  0x1000000; // fix comparison in case of last counting bin in ROS /first one in DDU
662  if (ROSHeader_TTCCount != header.lvl1ID()) {
663  int ros = (*rosControlData).getROSID();
664  hROSStatus->Fill(10, ros - 1);
665  // error code 4
666  hFEDFatal->Fill(code.getDDUID());
667  hCorruptionSummary->Fill(code.getDDUID(), 4);
668  }
669  }
670  }
671 
672  //1D HISTOS: EVENT LENGHT from trailer
673  int fedEvtLength = trailer.fragmentLength() * 8;
674  // if(fedEvtLength > 16000) fedEvtLength = 16000; // overflow bin
675  fedHistos["EventLength"][code.getDDUID()]->Fill(fedEvtLength);
676 }
int rosList() const
Definition: DTDDUWords.h:658
#define LogTrace(id)
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
Definition: FEDTrailer.cc:13
void Fill(long long x)
int getDDUID() const
std::map< int, std::set< int > > rosL1AIdsPerFED
std::map< std::string, std::map< int, MonitorElement * > > fedHistos
void setDDU(const int &ID)
need to reset the bits before setting
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
Log< level::Warning, false > LogWarning
std::map< int, std::set< int > > rosBxIdsPerFED
bool check() const
Check that the trailer is OK.
Definition: FEDTrailer.cc:45

◆ processROS25()

void DTDataIntegrityROSOffline::processROS25 ( DTROS25Data data,
int  dduID,
int  ros 
)

Definition at line 309 of file DTDataIntegrityROSOffline.cc.

References DTROBHeaderWord::bunchID(), channelsInCEROS(), channelsInROS(), data, eventErrorFlag, dqm::impl::MonitorElement::Fill(), DTROChainCoding::getDDUID(), DTROChainCoding::getROB(), DTROChainCoding::getROS(), DTROChainCoding::getROSID(), LogTrace, neventsROS, DTTDCMeasurementWord::PC(), DTROBHeaderWord::robID(), rosBxIdsPerFED, rosHistos, rosL1AIdsPerFED, DTROChainCoding::setDDU(), DTROChainCoding::setROB(), DTROChainCoding::setROS(), and summaryHistos.

Referenced by analyze().

309  {
310  neventsROS++;
311 
312  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
313  << "[DTDataIntegrityROSOffline]: " << neventsROS << " events analyzed by processROS25" << endl;
314 
315  // The ID of the RO board (used to map the histos)
316  DTROChainCoding code;
317  code.setDDU(ddu);
318  code.setROS(ros);
319 
320  MonitorElement* ROSSummary = summaryHistos["ROSSummary"][code.getDDUID()];
321 
322  // Summary of all ROB errors
323  MonitorElement* ROSError = nullptr;
324  ROSError = rosHistos["ROSError"][code.getROSID()];
325 
326  if ((!ROSError)) {
327  LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
328  << "Trying to access non existing ME at ROSID " << code.getROSID() << std::endl;
329  return;
330  }
331 
332  // L1A ids to be checked against FED one
333  rosL1AIdsPerFED[ddu].insert(data.getROSHeader().TTCEventCounter());
334 
335  // ROS errors
336 
337  // check for TPX errors
338  if (data.getROSTrailer().TPX() != 0) {
339  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
340  << " TXP error en ROS " << code.getROS() << endl;
341  ROSSummary->Fill(9, code.getROS());
342  }
343 
344  // L1 Buffer almost full (non-critical error!)
345  if (data.getROSTrailer().l1AFifoOccupancy() > 31) {
346  ROSSummary->Fill(10, code.getROS());
347  }
348 
349  for (vector<DTROSErrorWord>::const_iterator error_it = data.getROSErrors().begin();
350  error_it != data.getROSErrors().end();
351  error_it++) { // Loop over ROS error words
352 
353  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
354  << " Error in ROS " << code.getROS() << " ROB Id " << (*error_it).robID() << " Error type "
355  << (*error_it).errorType() << endl;
356 
357  // Fill the ROSSummary (1 per FED) histo
358  ROSSummary->Fill((*error_it).errorType(), code.getROS());
359  if ((*error_it).errorType() <= 11) { // set error flag
360  eventErrorFlag = true;
361  }
362 
363  // Fill the ROB Summary (1 per ROS) histo
364  if ((*error_it).robID() != 31) {
365  ROSError->Fill((*error_it).errorType(), (*error_it).robID());
366  } else if ((*error_it).errorType() == 4) {
367  vector<int> channelBins;
368  channelsInROS((*error_it).cerosID(), channelBins);
369  vector<int>::const_iterator channelIt = channelBins.begin();
370  vector<int>::const_iterator channelEnd = channelBins.end();
371  for (; channelIt != channelEnd; ++channelIt) {
372  ROSError->Fill(4, (*channelIt));
373  }
374  }
375  }
376 
377  int ROSDebug_BunchNumber = -1;
378 
379  for (vector<DTROSDebugWord>::const_iterator debug_it = data.getROSDebugs().begin();
380  debug_it != data.getROSDebugs().end();
381  debug_it++) { // Loop over ROS debug words
382 
383  int debugROSSummary = 0;
384  int debugROSError = 0;
385  vector<int> debugBins;
386  bool hasEvIdMis = false;
387  vector<int> evIdMisBins;
388 
389  if ((*debug_it).debugType() == 0) {
390  ROSDebug_BunchNumber = (*debug_it).debugMessage();
391  } else if ((*debug_it).debugType() == 1) {
392  // not used
393  // ROSDebug_BcntResCntLow = (*debug_it).debugMessage();
394  } else if ((*debug_it).debugType() == 2) {
395  // not used
396  // ROSDebug_BcntResCntHigh = (*debug_it).debugMessage();
397  } else if ((*debug_it).debugType() == 3) {
398  if ((*debug_it).dontRead()) {
399  debugROSSummary = 11;
400  debugROSError = 8;
401  channelsInCEROS((*debug_it).cerosIdCerosStatus(), (*debug_it).dontRead(), debugBins);
402  }
403  if ((*debug_it).evIdMis()) {
404  hasEvIdMis = true;
405  channelsInCEROS((*debug_it).cerosIdCerosStatus(), (*debug_it).evIdMis(), evIdMisBins);
406  }
407  } else if ((*debug_it).debugType() == 4 && (*debug_it).cerosIdRosStatus()) {
408  debugROSSummary = 13;
409  debugROSError = 10;
410  channelsInROS((*debug_it).cerosIdRosStatus(), debugBins);
411  }
412 
413  if (debugROSSummary) {
414  ROSSummary->Fill(debugROSSummary, code.getROS());
415  vector<int>::const_iterator channelIt = debugBins.begin();
416  vector<int>::const_iterator channelEnd = debugBins.end();
417  for (; channelIt != channelEnd; ++channelIt) {
418  ROSError->Fill(debugROSError, (*channelIt));
419  }
420  }
421 
422  if (hasEvIdMis) {
423  ROSSummary->Fill(12, code.getROS());
424  vector<int>::const_iterator channelIt = evIdMisBins.begin();
425  vector<int>::const_iterator channelEnd = evIdMisBins.end();
426  for (; channelIt != channelEnd; ++channelIt) {
427  ROSError->Fill(9, (*channelIt));
428  }
429  }
430  }
431 
432  // ROB Group Header
433  // Check the BX of the ROB headers against the BX of the ROS
434  for (vector<DTROBHeader>::const_iterator rob_it = data.getROBHeaders().begin(); rob_it != data.getROBHeaders().end();
435  rob_it++) { // loop over ROB headers
436 
437  code.setROB((*rob_it).first);
438  DTROBHeaderWord robheader = (*rob_it).second;
439 
440  rosBxIdsPerFED[ddu].insert(ROSDebug_BunchNumber);
441 
442  if (robheader.bunchID() != ROSDebug_BunchNumber) {
443  // fill ROS Summary plot
444  ROSSummary->Fill(8, code.getROS());
445  eventErrorFlag = true;
446 
447  // fill ROB Summary plot for that particular ROS
448  ROSError->Fill(7, robheader.robID());
449  }
450  }
451 
452  // TDC Data
453  for (vector<DTTDCData>::const_iterator tdc_it = data.getTDCData().begin(); tdc_it != data.getTDCData().end();
454  tdc_it++) { // loop over TDC data
455 
456  DTTDCMeasurementWord tdcDatum = (*tdc_it).second;
457 
458  if (tdcDatum.PC() != 0) {
459  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
460  << " PC error in ROS " << code.getROS() << " TDC " << (*tdc_it).first << endl;
461  // fill ROS Summary plot
462  ROSSummary->Fill(7, code.getROS());
463 
464  eventErrorFlag = true;
465 
466  // fill ROB Summary plot for that particular ROS
467  ROSError->Fill(6, (*tdc_it).first);
468  }
469  }
470 
471  // TDC Error
472  for (vector<DTTDCError>::const_iterator tdc_it = data.getTDCError().begin(); tdc_it != data.getTDCError().end();
473  tdc_it++) { // loop over TDC errors
474 
475  code.setROB((*tdc_it).first);
476 
477  int tdcError_ROSSummary = 0;
478  int tdcError_ROSError = 0;
479 
480  if (((*tdc_it).second).tdcError() & 0x4000) {
481  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
482  << " ROS " << code.getROS() << " ROB " << code.getROB() << " Internal fatal Error 4000 in TDC "
483  << (*tdc_it).first << endl;
484 
485  tdcError_ROSSummary = 14;
486  tdcError_ROSError = 11;
487 
488  } else if (((*tdc_it).second).tdcError() & 0x0249) {
489  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
490  << " ROS " << code.getROS() << " ROB " << code.getROB() << " TDC FIFO overflow in TDC " << (*tdc_it).first
491  << endl;
492 
493  tdcError_ROSSummary = 15;
494  tdcError_ROSError = 12;
495 
496  } else if (((*tdc_it).second).tdcError() & 0x0492) {
497  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
498  << " ROS " << code.getROS() << " ROB " << code.getROB() << " TDC L1 buffer overflow in TDC "
499  << (*tdc_it).first << endl;
500 
501  tdcError_ROSSummary = 16;
502  tdcError_ROSError = 13;
503 
504  } else if (((*tdc_it).second).tdcError() & 0x2000) {
505  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
506  << " ROS " << code.getROS() << " ROB " << code.getROB() << " TDC L1A FIFO overflow in TDC " << (*tdc_it).first
507  << endl;
508 
509  tdcError_ROSSummary = 17;
510  tdcError_ROSError = 14;
511 
512  } else if (((*tdc_it).second).tdcError() & 0x0924) {
513  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
514  << " ROS " << code.getROS() << " ROB " << code.getROB() << " TDC hit error in TDC " << (*tdc_it).first
515  << endl;
516 
517  tdcError_ROSSummary = 18;
518  tdcError_ROSError = 15;
519 
520  } else if (((*tdc_it).second).tdcError() & 0x1000) {
521  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
522  << " ROS " << code.getROS() << " ROB " << code.getROB() << " TDC hit rejected in TDC " << (*tdc_it).first
523  << endl;
524 
525  tdcError_ROSSummary = 19;
526  tdcError_ROSError = 16;
527 
528  } else {
529  LogWarning("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
530  << " TDC error code not known " << ((*tdc_it).second).tdcError() << endl;
531  }
532 
533  ROSSummary->Fill(tdcError_ROSSummary, code.getROS());
534 
535  if (tdcError_ROSSummary <= 15) {
536  eventErrorFlag = true;
537  }
538 
539  ROSError->Fill(tdcError_ROSError, (*tdc_it).first);
540  }
541 }
int getROSID() const
std::map< std::string, std::map< int, MonitorElement * > > summaryHistos
int getROS() const
Log< level::Error, false > LogError
#define LogTrace(id)
void Fill(long long x)
int getROB() const
int getDDUID() const
int robID() const
Definition: DTDDUWords.h:341
int bunchID() const
Definition: DTDDUWords.h:343
std::map< int, std::set< int > > rosL1AIdsPerFED
void setROB(const int &ID)
void setROS(const int &ID)
void setDDU(const int &ID)
need to reset the bits before setting
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
std::map< std::string, std::map< int, MonitorElement * > > rosHistos
void channelsInCEROS(int cerosId, int chMask, std::vector< int > &channels)
Log< level::Warning, false > LogWarning
std::map< int, std::set< int > > rosBxIdsPerFED
void channelsInROS(int cerosMask, std::vector< int > &channels)

◆ topFolder()

std::string DTDataIntegrityROSOffline::topFolder ( bool  isFEDIntegrity) const
private

Definition at line 687 of file DTDataIntegrityROSOffline.cc.

References printsummarytable::folder.

Referenced by bookHistos().

687  {
688  string folder = "DT/00-DataIntegrity/";
689 
690  return folder;
691 }

Member Data Documentation

◆ dduToken

edm::EDGetTokenT<DTDDUCollection> DTDataIntegrityROSOffline::dduToken
private

Definition at line 107 of file DTDataIntegrityROSOffline.h.

Referenced by analyze(), and DTDataIntegrityROSOffline().

◆ eventErrorFlag

bool DTDataIntegrityROSOffline::eventErrorFlag
private

Definition at line 98 of file DTDataIntegrityROSOffline.h.

Referenced by analyze(), and processROS25().

◆ fedBXIds

std::set<int> DTDataIntegrityROSOffline::fedBXIds
private

Definition at line 101 of file DTDataIntegrityROSOffline.h.

Referenced by analyze(), and processFED().

◆ fedHistos

std::map<std::string, std::map<int, MonitorElement*> > DTDataIntegrityROSOffline::fedHistos
private

Definition at line 72 of file DTDataIntegrityROSOffline.h.

Referenced by processFED().

◆ FEDIDmax

int DTDataIntegrityROSOffline::FEDIDmax
private

◆ FEDIDmin

int DTDataIntegrityROSOffline::FEDIDmin
private

◆ fedIntegrityFolder

std::string DTDataIntegrityROSOffline::fedIntegrityFolder
private

Definition at line 104 of file DTDataIntegrityROSOffline.h.

Referenced by DTDataIntegrityROSOffline().

◆ getSCInfo

bool DTDataIntegrityROSOffline::getSCInfo
private

Definition at line 65 of file DTDataIntegrityROSOffline.h.

Referenced by DTDataIntegrityROSOffline().

◆ hCorruptionSummary

MonitorElement* DTDataIntegrityROSOffline::hCorruptionSummary
private

Definition at line 82 of file DTDataIntegrityROSOffline.h.

Referenced by bookHistos(), and processFED().

◆ hFEDEntry

MonitorElement* DTDataIntegrityROSOffline::hFEDEntry
private

Definition at line 79 of file DTDataIntegrityROSOffline.h.

Referenced by bookHistos(), fedEntry(), and processFED().

◆ hFEDFatal

MonitorElement* DTDataIntegrityROSOffline::hFEDFatal
private

Definition at line 80 of file DTDataIntegrityROSOffline.h.

Referenced by bookHistos(), fedFatal(), and processFED().

◆ hFEDNonFatal

MonitorElement* DTDataIntegrityROSOffline::hFEDNonFatal
private

Definition at line 81 of file DTDataIntegrityROSOffline.h.

Referenced by bookHistos(), and fedNonFatal().

◆ hTTSSummary

MonitorElement* DTDataIntegrityROSOffline::hTTSSummary
private

Definition at line 85 of file DTDataIntegrityROSOffline.h.

Referenced by bookHistos().

◆ nEventMonitor

MonitorElement* DTDataIntegrityROSOffline::nEventMonitor
private

Definition at line 70 of file DTDataIntegrityROSOffline.h.

Referenced by analyze(), and bookHistos().

◆ nevents

int DTDataIntegrityROSOffline::nevents
private

Definition at line 67 of file DTDataIntegrityROSOffline.h.

Referenced by analyze().

◆ neventsFED

int DTDataIntegrityROSOffline::neventsFED
private

◆ neventsROS

int DTDataIntegrityROSOffline::neventsROS
private

Definition at line 88 of file DTDataIntegrityROSOffline.h.

Referenced by processROS25().

◆ nROS

const int DTDataIntegrityROSOffline::nROS = 12
private

Definition at line 91 of file DTDataIntegrityROSOffline.h.

Referenced by bookHistograms().

◆ ros25Token

edm::EDGetTokenT<DTROS25Collection> DTDataIntegrityROSOffline::ros25Token
private

Definition at line 109 of file DTDataIntegrityROSOffline.h.

Referenced by analyze(), and DTDataIntegrityROSOffline().

◆ rosBxIdsPerFED

std::map<int, std::set<int> > DTDataIntegrityROSOffline::rosBxIdsPerFED
private

Definition at line 100 of file DTDataIntegrityROSOffline.h.

Referenced by analyze(), processFED(), and processROS25().

◆ rosHistos

std::map<std::string, std::map<int, MonitorElement*> > DTDataIntegrityROSOffline::rosHistos
private

Definition at line 76 of file DTDataIntegrityROSOffline.h.

Referenced by processROS25().

◆ rosL1AIdsPerFED

std::map<int, std::set<int> > DTDataIntegrityROSOffline::rosL1AIdsPerFED
private

Definition at line 102 of file DTDataIntegrityROSOffline.h.

Referenced by analyze(), processFED(), and processROS25().

◆ summaryHistos

std::map<std::string, std::map<int, MonitorElement*> > DTDataIntegrityROSOffline::summaryHistos
private

Definition at line 74 of file DTDataIntegrityROSOffline.h.

Referenced by processROS25().