CMS 3D CMS Logo

TriggerBxVsOrbitMonitor.cc
Go to the documentation of this file.
1 // C++ headers
2 #include <cstring>
3 #include <string>
4 
5 // CMSSW headers
27 
28 namespace {
31 
32  struct RunBasedHistograms {
33  dqm::reco::MonitorElement* orbit_bx_all;
34  std::vector<dqm::reco::MonitorElement*> orbit_bx;
35  std::vector<dqm::reco::MonitorElement*> orbit_bx_all_byLS;
36  };
37 } // namespace
38 
39 class TriggerBxVsOrbitMonitor : public DQMGlobalEDAnalyzer<RunBasedHistograms> {
40 public:
42  ~TriggerBxVsOrbitMonitor() override = default;
43 
44  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
45 
46 private:
47  void dqmBeginRun(edm::Run const&, edm::EventSetup const&, RunBasedHistograms&) const override;
48  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&, RunBasedHistograms&) const override;
49  void dqmAnalyze(edm::Event const&, edm::EventSetup const&, RunBasedHistograms const&) const override;
50 
51  // number of bunch crossings
52  static const unsigned int s_bx_range = 3564;
53  static const unsigned int s_orbit_range = 262144; // 2**18 orbits in 1 LS
54 
55  // TCDS trigger types
56  // see https://twiki.cern.ch/twiki/bin/viewauth/CMS/TcdsEventRecord
57  static constexpr const char* const s_tcds_trigger_types[] = {
58  "Empty", // 0 - No trigger
59  "Physics", // 1 - GT trigger
60  "Calibration", // 2 - Sequence trigger (calibration)
61  "Random", // 3 - Random trigger
62  "Auxiliary", // 4 - Auxiliary (CPM front panel NIM input) trigger
63  nullptr, // 5 - reserved
64  nullptr, // 6 - reserved
65  nullptr, // 7 - reserved
66  "Cyclic", // 8 - Cyclic trigger
67  "Bunch-pattern", // 9 - Bunch-pattern trigger
68  "Software", // 10 - Software trigger
69  "TTS", // 11 - TTS-sourced trigger
70  nullptr, // 12 - reserved
71  nullptr, // 13 - reserved
72  nullptr, // 14 - reserved
73  nullptr // 15 - reserved
74  };
75 
76  // module configuration
80  const int m_minLS;
81  const int m_maxLS;
82  const int m_minBX;
83  const int m_maxBX;
84 };
85 
86 // definition
87 constexpr const char* const TriggerBxVsOrbitMonitor::s_tcds_trigger_types[];
88 
91  desc.addUntracked<edm::InputTag>("l1tResults", edm::InputTag("gtStage2Digis"));
92  desc.addUntracked<edm::InputTag>("hltResults", edm::InputTag("TriggerResults"));
93  desc.addUntracked<std::string>("dqmPath", "HLT/TriggerBx");
94  desc.addUntracked<int>("minLS", 134);
95  desc.addUntracked<int>("maxLS", 136);
96  desc.addUntracked<int>("minBX", 894);
97  desc.addUntracked<int>("maxBX", 912);
98  descriptions.add("triggerBxVsOrbitMonitor", desc);
99 }
100 
102  : // module configuration
103  m_l1t_results(consumes<GlobalAlgBlkBxCollection>(config.getUntrackedParameter<edm::InputTag>("l1tResults"))),
104  m_hlt_results(consumes<edm::TriggerResults>(config.getUntrackedParameter<edm::InputTag>("hltResults"))),
105  m_dqm_path(config.getUntrackedParameter<std::string>("dqmPath")),
106  m_minLS(config.getUntrackedParameter<int>("minLS")),
107  m_maxLS(config.getUntrackedParameter<int>("maxLS")),
108  m_minBX(config.getUntrackedParameter<int>("minBX")),
109  m_maxBX(config.getUntrackedParameter<int>("maxBX")) {}
110 
112  edm::EventSetup const& setup,
113  RunBasedHistograms& histograms) const {
114  size_t nLS = m_maxLS - m_minLS + 1;
115 
116  histograms.orbit_bx_all_byLS.clear();
117  histograms.orbit_bx_all_byLS.resize(nLS);
118 
119  histograms.orbit_bx.clear();
120  histograms.orbit_bx.resize(std::size(s_tcds_trigger_types));
121 }
122 
124  edm::Run const& run,
125  edm::EventSetup const& setup,
126  RunBasedHistograms& histograms) const {
127  // TCDS trigger type plots
129  size_t nLS = m_maxLS - m_minLS + 1;
130  size_t nBX = m_maxBX - m_minBX + 1;
131 
132  // book 2D histogram to monitor all TCDS trigger types in a single plot
133  booker.setCurrentFolder(m_dqm_path + "/orbitVsBX");
134  histograms.orbit_bx_all = booker.book2D("OrbitVsBX",
135  "Event orbits vs. bunch crossing",
136  nBX,
137  m_minBX - 0.5,
138  m_maxBX + 0.5,
139  s_orbit_range + 1,
140  -0.5,
141  s_orbit_range + 0.5);
142  histograms.orbit_bx_all->setXTitle("BX");
143  histograms.orbit_bx_all->setYTitle("orbit");
144 
145  for (unsigned int i = 0; i < nLS; ++i) {
146  std::string iname = std::to_string(i);
147  histograms.orbit_bx_all_byLS[i] = booker.book2D("OrbitVsBX_LS" + iname,
148  "Event orbits vs. bunch crossing, for lumisection " + iname,
149  nBX,
150  m_minBX - 0.5,
151  m_maxBX + 0.5,
152  s_orbit_range + 1,
153  -0.5,
154  s_orbit_range + 0.5);
155  histograms.orbit_bx_all_byLS[i]->setXTitle("BX");
156  histograms.orbit_bx_all_byLS[i]->setYTitle("orbit");
157  }
158 
159  booker.setCurrentFolder(m_dqm_path + "/orbitVsBX/TCDS");
160  for (unsigned int i = 0; i < size; ++i) {
161  if (s_tcds_trigger_types[i]) {
162  histograms.orbit_bx[i] = booker.book2D("OrbitVsBX_" + std::string(s_tcds_trigger_types[i]),
163  "Event orbits vs. bunch crossing " + std::string(s_tcds_trigger_types[i]),
164  nBX,
165  m_minBX - 0.5,
166  m_maxBX + 0.5,
167  s_orbit_range + 1,
168  -0.5,
169  s_orbit_range + 0.5);
170  histograms.orbit_bx[i]->setXTitle("BX");
171  histograms.orbit_bx[i]->setYTitle("orbit");
172  }
173  }
174 }
175 
177  edm::EventSetup const& setup,
178  RunBasedHistograms const& histograms) const {
179  unsigned int type = event.experimentType();
180  unsigned int ls = event.id().luminosityBlock();
181  unsigned int orbit = event.orbitNumber() % s_orbit_range;
182  unsigned int bx = event.bunchCrossing();
183  histograms.orbit_bx_all->Fill(bx, orbit);
184 
185  int iLS = ls - m_minLS;
186  if (iLS >= 0 and iLS < int(histograms.orbit_bx_all_byLS.size()))
187  histograms.orbit_bx_all_byLS[iLS]->Fill(bx, orbit);
188 
189  // monitor the bx distribution for the TCDS trigger types
191  if (type < size and histograms.orbit_bx[type]) {
192  histograms.orbit_bx[type]->Fill(bx, orbit);
193  }
194 }
195 
196 //define this as a plug-in
TriggerBxVsOrbitMonitor::m_dqm_path
const std::string m_dqm_path
Definition: TriggerBxVsOrbitMonitor.cc:79
TriggerBxVsOrbitMonitor::s_bx_range
static const unsigned int s_bx_range
Definition: TriggerBxVsOrbitMonitor.cc:52
ConfigurationDescriptions.h
eostools.ls
def ls(path, rec=False)
Definition: eostools.py:349
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
TriggerBxVsOrbitMonitor::dqmBeginRun
void dqmBeginRun(edm::Run const &, edm::EventSetup const &, RunBasedHistograms &) const override
Definition: TriggerBxVsOrbitMonitor.cc:111
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
TriggerBxVsOrbitMonitor::m_minBX
const int m_minBX
Definition: TriggerBxVsOrbitMonitor.cc:82
L1TUtmTriggerMenuRcd.h
MessageLogger.h
TriggerBxVsOrbitMonitor::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &, RunBasedHistograms &) const override
Definition: TriggerBxVsOrbitMonitor.cc:123
ESHandle.h
TriggerResults.h
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
LuminosityBlock.h
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
TriggerBxVsOrbitMonitor
Definition: TriggerBxVsOrbitMonitor.cc:39
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
BXVector
Definition: BXVector.h:15
config
Definition: config.py:1
MakerMacros.h
TriggerBxVsOrbitMonitor::~TriggerBxVsOrbitMonitor
~TriggerBxVsOrbitMonitor() override=default
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::legacy::DQMStore
Definition: DQMStore.h:727
ProcessHistory.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
Service.h
Run.h
TriggerBxVsOrbitMonitor::TriggerBxVsOrbitMonitor
TriggerBxVsOrbitMonitor(edm::ParameterSet const &)
Definition: TriggerBxVsOrbitMonitor.cc:101
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1TUtmTriggerMenu.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:39
TriggerBxVsOrbitMonitor::s_tcds_trigger_types
static constexpr const char *const s_tcds_trigger_types[]
Definition: TriggerBxVsOrbitMonitor.cc:57
createfilelist.int
int
Definition: createfilelist.py:10
GlobalAlgBlk.h
edm::EventSetup
Definition: EventSetup.h:57
histograms
Definition: histograms.py:1
HLTConfigProvider.h
Registry.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Frameworkfwd.h
TriggerBxVsOrbitMonitor::m_maxLS
const int m_maxLS
Definition: TriggerBxVsOrbitMonitor.cc:81
TriggerBxVsOrbitMonitor::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TriggerBxVsOrbitMonitor.cc:89
dqm::implementation::IBooker::book2D
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:177
phase2tkutil::DQMStore
dqm::reco::DQMStore DQMStore
Definition: TrackerPhase2DQMUtil.h:16
EventSetup.h
TriggerBxVsOrbitMonitor::m_l1t_results
const edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1t_results
Definition: TriggerBxVsOrbitMonitor.cc:77
TriggerBxVsOrbitMonitor::m_minLS
const int m_minLS
Definition: TriggerBxVsOrbitMonitor.cc:80
MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiPixelSCurveCalibrationAnalysis.h:55
dqm::implementation::IBooker
Definition: DQMStore.h:43
TriggerBxVsOrbitMonitor::m_maxBX
const int m_maxBX
Definition: TriggerBxVsOrbitMonitor.cc:83
DQMGlobalEDAnalyzer
Definition: DQMGlobalEDAnalyzer.h:76
ParameterSet.h
event
Definition: event.py:1
HLTObjectsMonitor_cfi.TriggerResults
TriggerResults
Definition: HLTObjectsMonitor_cfi.py:9
TriggerBxVsOrbitMonitor::dqmAnalyze
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, RunBasedHistograms const &) const override
Definition: TriggerBxVsOrbitMonitor.cc:176
edm::Event
Definition: Event.h:73
TriggerBxVsOrbitMonitor::s_orbit_range
static const unsigned int s_orbit_range
Definition: TriggerBxVsOrbitMonitor.cc:53
TriggerBxVsOrbitMonitor::m_hlt_results
const edm::EDGetTokenT< edm::TriggerResults > m_hlt_results
Definition: TriggerBxVsOrbitMonitor.cc:78
edm::InputTag
Definition: InputTag.h:15
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
DQMGlobalEDAnalyzer.h