BeamMode

Errors

L1TSync_Offline

LSValid

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
#ifndef DQMOffline_L1Trigger_L1TSync_Offline_h
#define DQMOffline_L1Trigger_L1TSync_Offline_h

/*
 * \class L1TSync_Offline
 *
 *
 * Description: offline DQM module for L1Trigger/bunchStructure synchronization
 * 
 * Implementation:
 *   <TODO: enter implementation details>
 *
 * \author: Pietro Vischia - LIP Lisbon pietro.vischia@gmail.com
 *
 * Changelog:
 *    2012/08/10 11:01:01: First creation. Dummy module with actual code commented.
 *
 * Todo:
 *  - implement the module in offline
 *  - check if there are user includes specific for offline/online that should be changed
 *
 *
 */

// System include files
#include <memory>
#include <unistd.h>

// User include files
#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
#include "FWCore/Framework/interface/MakerMacros.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "DQMServices/Core/interface/DQMStore.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

//L1 includes and dataformats
#include "DQM/L1TMonitor/interface/L1TMenuHelper.h"
#include "DQMOffline/L1Trigger/interface/L1TBeamConfiguration.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"

#include "DQMServices/Core/interface/DQMEDAnalyzer.h"

#include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h"

#include <TString.h>

#include <iostream>
#include <fstream>
#include <string>
#include <vector>

// Forward declarations

// Class declaration
namespace ltso {
  struct LSValid {
    bool lsIsValid = true;
  };
}  // namespace ltso
class L1TSync_Offline : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<ltso::LSValid>> {
public:
  enum BeamMode {
    NOMODE = 1,
    SETUP = 2,
    INJPILOT = 3,
    INJINTR = 4,
    INJNOMN = 5,
    PRERAMP = 6,
    RAMP = 7,
    FLATTOP = 8,
    QUEEZE = 9,
    ADJUST = 10,
    STABLE = 11,
    UNSTABLE = 12,
    BEAMDUMP = 13,
    RAMPDOWN = 14,
    RECOVERY = 15,
    INJDUMP = 16,
    CIRCDUMP = 17,
    ABORT = 18,
    CYCLING = 19,
    WBDUMP = 20,
    NOBEAM = 21
  };

  enum Errors {
    UNKNOWN = 1,
    WARNING_DB_CONN_FAILED = 2,
    WARNING_DB_QUERY_FAILED = 3,
    WARNING_DB_INCORRECT_NBUNCHES = 4,
    ERROR_UNABLE_RETRIVE_PRODUCT = 5,
    ERROR_TRIGGERALIAS_NOTVALID = 6,
    ERROR_LSBLOCK_NOTVALID = 7
  };

public:
  // Constructor
  L1TSync_Offline(const edm::ParameterSet& ps);
  // Destructor
  ~L1TSync_Offline() override;

protected:
  void analyze(const edm::Event& e, const edm::EventSetup& c) override;  // Analyze
  std::shared_ptr<ltso::LSValid> globalBeginLuminosityBlock(edm::LuminosityBlock const& lumiBlock,
                                                            edm::EventSetup const& c) const final;
  void globalEndLuminosityBlock(edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c) final {}
  void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
  void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) override;

  // Private Methods
private:
  void getBeamConfOffline(const edm::Event&);
  // no lumi block //    void doFractionInSync(bool iForce=false, bool iBad=false);
  // no lumi block //    void certifyLSBlock  (std::string iTrigger, int iInitLs, int iEndLs ,float iValue);

  // Variables
private:
  // Input parameters
  edm::ParameterSet m_parameters;

  // bool
  bool m_verbose;

  // Int
  int m_refPrescaleSet;
  //unsigned int                         m_eventLS;
  unsigned int m_lhcFill;  //

  // Vectors
  L1TBeamConfiguration m_beamConfig;  // Current Bunch Structure

  // Const Vectors
  const std::vector<std::vector<int>>* ListsPrescaleFactors;  // Collection os all sets of prescales

  // Maps
  std::map<TString, int> m_algoBit;
  std::map<TString, unsigned int> m_certFirstLS;  // First uncertified LS
  std::map<TString, unsigned int> m_certLastLS;   // Last  uncertified LS
  std::map<TString, MonitorElement*> m_algoCertification;
  std::map<TString, MonitorElement*> m_algoVsBunchStructure;
  std::map<std::string, bool> m_algoAutoSelect;           // Map of categories to monitor
  std::map<std::string, std::string> m_selectedTriggers;  // Map of what trigger to monitor for each category

  // MonitorElement
  MonitorElement* m_ErrorMonitor;

  // Input tags
  edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> m_l1GtEvmSource;
  edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> m_l1GtDataDaqInputTag;
  const edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> m_menuToken;
  L1TMenuHelper::Tokens m_helperTokens;

  L1GtUtils m_l1GtUtils;
};

#endif