Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-15 05:17:10

0001 #ifndef DTDataIntegrityTask_H
0002 #define DTDataIntegrityTask_H
0003 
0004 /** \class DTDataIntegrityTask
0005  *
0006  * Class for DT Data Integrity
0007  * at Online DQM (Single Thread)
0008  * expected to monitor uROS
0009  * Class with MEs vs Time/LS
0010  *
0011  * \author Javier Fernandez (Uni. Oviedo) 
0012  *
0013  */
0014 
0015 #include "FWCore/Framework/interface/Frameworkfwd.h"
0016 #include "FWCore/Framework/interface/Event.h"
0017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0018 #include "FWCore/Utilities/interface/EDGetToken.h"
0019 #include "FWCore/Framework/interface/LuminosityBlock.h"
0020 
0021 #include "DQMServices/Core/interface/DQMStore.h"
0022 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0023 
0024 #include "DataFormats/DTDigi/interface/DTuROSControlData.h"
0025 
0026 #include <fstream>
0027 #include <map>
0028 #include <string>
0029 #include <vector>
0030 #include <list>
0031 
0032 namespace dtdi {
0033   struct Void {};
0034 }  // namespace dtdi
0035 
0036 class DTuROSROSData;
0037 class DTuROSFEDData;
0038 class DTTimeEvolutionHisto;
0039 
0040 class DTDataIntegrityTask : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<dtdi::Void>> {
0041 public:
0042   DTDataIntegrityTask(const edm::ParameterSet& ps);
0043 
0044   ~DTDataIntegrityTask() override;
0045 
0046   void TimeHistos(DQMStore::IBooker&, std::string histoType);
0047 
0048   void processuROS(DTuROSROSData& data, int fed, int uRos);
0049   void processFED(DTuROSFEDData& data, int fed);
0050 
0051   std::shared_ptr<dtdi::Void> globalBeginLuminosityBlock(const edm::LuminosityBlock& ls,
0052                                                          const edm::EventSetup& es) const override;
0053   void globalEndLuminosityBlock(const edm::LuminosityBlock& ls, const edm::EventSetup& es) override;
0054 
0055   void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0056 
0057 protected:
0058   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0059 
0060 private:
0061   void bookHistos(DQMStore::IBooker&, const int fedMin, const int fedMax);
0062   void bookHistos(DQMStore::IBooker&, std::string folder, const int fed);
0063   void bookHistosuROS(DQMStore::IBooker&, const int fed, const int uRos);
0064   void bookHistosROS(DQMStore::IBooker&, const int wheel, const int ros);
0065 
0066   std::string topFolder(bool isFEDIntegrity) const;
0067 
0068   //conversions
0069   int theDDU(int crate, int slot, int link, bool tenDDU);
0070   int theROS(int slot, int link);
0071 
0072   //If you want info VS time histos
0073   bool doTimeHisto;
0074 
0075   int nevents;
0076 
0077   // Monitor Elements
0078   MonitorElement* nEventMonitor;
0079   // <histoType, <index , histo> >
0080   std::map<std::string, std::map<int, MonitorElement*>> fedHistos;
0081   // <histoType, histo> >
0082   std::map<std::string, std::map<int, MonitorElement*>> summaryHistos;
0083   // <key , histo> >
0084   std::map<unsigned int, MonitorElement*> urosHistos;
0085 
0086   //enum histoTypes for reduced map of MEs urosHistos
0087   // key = stringEnum*1000 + (fed-minFED)#*100 + (uROS-minuROS)#
0088   enum histoTypes { uROSEventLength = 0, uROSError = 1, TDCError = 4, TTSValues = 7 };
0089 
0090   // standard ME for monitoring of FED integrity
0091   MonitorElement* hFEDEntry;
0092   MonitorElement* hFEDFatal;
0093 
0094   //time histos for FEDs/uROS
0095   std::map<std::string, std::map<int, DTTimeEvolutionHisto*>> fedTimeHistos;
0096   // <key, histo> >
0097   std::map<unsigned int, DTTimeEvolutionHisto*> urosTimeHistos;
0098   //key =  (fed-minFED)#*100 + (uROS-minuROS)#
0099 
0100   mutable int nEventsLS;
0101 
0102   int neventsFED;
0103   int neventsuROS;
0104 
0105   int FEDIDmin;
0106   int FEDIDmax;
0107 
0108   int errorX[6][12][5] = {{{0}}};  //5th is notOK flag and 6th is TDC Fatal; Second index is ROS. Last index is wheel
0109   int nLinksForFatal;  //Minumum number of Links/wheel with notOKFlag or TDC fatal errors to consider a FEDfatal event
0110 
0111   // Number of uROS per FED
0112   const int NuROS = 12;
0113 
0114   // flag to toggle the creation of only the summaries (for HLT running)
0115   int mode;
0116   std::string fedIntegrityFolder;
0117 
0118   // The label to retrieve the digis
0119   edm::EDGetTokenT<DTuROSFEDDataCollection> fedToken;
0120 };
0121 
0122 #endif
0123 
0124 /* Local Variables: */
0125 /* show-trailing-whitespace: t */
0126 /* truncate-lines: t */
0127 /* End: */