CMS 3D CMS Logo

APVCyclePhaseDebuggerFromL1TS.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripTools
4 // Class: APVCyclePhaseDebuggerFromL1TS
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Mon Jan 12 09:05:45 CET 2009
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
29 
31 
33 
35 
39 
41 
42 #include <map>
43 #include <vector>
44 #include <utility>
45 #include <string>
46 #include <iostream>
47 
48 #include "TH1F.h"
49 #include "TProfile.h"
50 
52 
54 
55 //
56 // class decleration
57 //
58 
60 public:
63 
64  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
65 
66 private:
67  void beginRun(const edm::Run&, const edm::EventSetup&) override;
68  void analyze(const edm::Event&, const edm::EventSetup&) override;
69 
70  // ----------member data ---------------------------
71 
73  const unsigned int m_maxLS;
74  const unsigned int m_LSfrac;
75 
77 
78  TH1F** _hsize;
79  TH1F** _hlresync;
80  TH1F** _hlOC0;
81  TH1F** _hlTE;
82  TH1F** _hlstart;
83  TH1F** _hlEC0;
84  TH1F** _hlHR;
85 
87  TH1F** _hdlresynclHR;
88 
89  long long _lastResync;
90  long long _lastHardReset;
91  long long _lastStart;
92  long long _lastEventCounter0;
93  long long _lastOrbitCounter0;
94  long long _lastTestEnable;
95 };
96 
97 //
98 // constants, enums and typedefs
99 //
100 
101 //
102 // static data member definitions
103 //
104 
105 //
106 // constructors and destructor
107 //
109  : _l1tscollectionToken(
110  consumes<Level1TriggerScalersCollection>(iConfig.getParameter<edm::InputTag>("l1TSCollection"))),
111  m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin", 250)),
112  m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction", 16)),
113  m_rhm(consumesCollector()),
114  _hsize(nullptr),
115  _hlresync(nullptr),
116  _hlOC0(nullptr),
117  _hlTE(nullptr),
118  _hlstart(nullptr),
119  _hlEC0(nullptr),
120  _hlHR(nullptr),
121  _hdlec0lresync(nullptr),
122  _hdlresynclHR(nullptr),
123  _lastResync(-1),
124  _lastHardReset(-1),
125  _lastStart(-1),
126  _lastEventCounter0(-1),
127  _lastOrbitCounter0(-1),
128  _lastTestEnable(-1) {
129  //now do what ever other initialization is needed
130 
131  _hsize = m_rhm.makeTH1F("size", "Level1TriggerScalers Collection size", 20, -0.5, 19.5);
132 
133  _hlresync = m_rhm.makeTH1F("lresync", "Orbit of last resync", m_LSfrac * m_maxLS, 0, m_maxLS * 262144);
134  _hlOC0 = m_rhm.makeTH1F("lOC0", "Orbit of last OC0", m_LSfrac * m_maxLS, 0, m_maxLS * 262144);
135  _hlTE = m_rhm.makeTH1F("lTE", "Orbit of last TestEnable", m_LSfrac * m_maxLS, 0, m_maxLS * 262144);
136  _hlstart = m_rhm.makeTH1F("lstart", "Orbit of last Start", m_LSfrac * m_maxLS, 0, m_maxLS * 262144);
137  _hlEC0 = m_rhm.makeTH1F("lEC0", "Orbit of last EC0", m_LSfrac * m_maxLS, 0, m_maxLS * 262144);
138  _hlHR = m_rhm.makeTH1F("lHR", "Orbit of last HardReset", m_LSfrac * m_maxLS, 0, m_maxLS * 262144);
139  _hdlec0lresync = m_rhm.makeTH1F("dlec0lresync", "Orbit difference EC0-Resync", 4000, -1999.5, 2000.5);
140  _hdlresynclHR = m_rhm.makeTH1F("dlresynclHR", "Orbit difference Resync-HR", 4000, -1999.5, 2000.5);
141 }
142 
144  // do anything here that needs to be done at desctruction time
145  // (e.g. close files, deallocate resources etc.)
146 }
147 
148 //
149 // member functions
150 //
151 
152 // ------------ method called to produce the data ------------
154 
155 {
156  // update the parameters from DB
157 
158  m_rhm.beginRun(iRun);
159 
160  if (_hlresync && *_hlresync) {
161  (*_hlresync)->GetXaxis()->SetTitle("Orbit");
162  (*_hlresync)->GetYaxis()->SetTitle("Events");
163  (*_hlresync)->SetCanExtend(TH1::kXaxis);
164  }
165 
166  if (_hlOC0 && *_hlOC0) {
167  (*_hlOC0)->GetXaxis()->SetTitle("Orbit");
168  (*_hlOC0)->GetYaxis()->SetTitle("Events");
169  (*_hlOC0)->SetCanExtend(TH1::kXaxis);
170  }
171 
172  if (_hlTE && *_hlTE) {
173  (*_hlTE)->GetXaxis()->SetTitle("Orbit");
174  (*_hlTE)->GetYaxis()->SetTitle("Events");
175  (*_hlTE)->SetCanExtend(TH1::kXaxis);
176  }
177 
178  if (_hlstart && *_hlstart) {
179  (*_hlstart)->GetXaxis()->SetTitle("Orbit");
180  (*_hlstart)->GetYaxis()->SetTitle("Events");
181  (*_hlstart)->SetCanExtend(TH1::kXaxis);
182  }
183 
184  if (_hlEC0 && *_hlEC0) {
185  (*_hlEC0)->GetXaxis()->SetTitle("Orbit");
186  (*_hlEC0)->GetYaxis()->SetTitle("Events");
187  (*_hlEC0)->SetCanExtend(TH1::kXaxis);
188  }
189 
190  if (_hlHR && *_hlHR) {
191  (*_hlHR)->GetXaxis()->SetTitle("Orbit");
192  (*_hlHR)->GetYaxis()->SetTitle("Events");
193  (*_hlHR)->SetCanExtend(TH1::kXaxis);
194  }
195 
196  if (_hdlec0lresync && *_hdlec0lresync) {
197  (*_hdlec0lresync)->GetXaxis()->SetTitle("lastEC0-lastResync");
198  }
199 
200  if (_hdlresynclHR && *_hdlresynclHR) {
201  (*_hdlresynclHR)->GetXaxis()->SetTitle("lastEC0-lastResync");
202  }
203 }
204 
206  using namespace edm;
207 
209  iEvent.getByToken(_l1tscollectionToken, l1ts);
210 
211  if (_hsize && *_hsize)
212  (*_hsize)->Fill(l1ts->size());
213 
214  // offset computation
215 
216  if (!l1ts->empty()) {
217  if (_hlresync && *_hlresync)
218  (*_hlresync)->Fill((*l1ts)[0].lastResync());
219  if (_hlOC0 && *_hlOC0)
220  (*_hlOC0)->Fill((*l1ts)[0].lastOrbitCounter0());
221  if (_hlTE && *_hlTE)
222  (*_hlTE)->Fill((*l1ts)[0].lastTestEnable());
223  if (_hlstart && *_hlstart)
224  (*_hlstart)->Fill((*l1ts)[0].lastStart());
225  if (_hlEC0 && *_hlEC0)
226  (*_hlEC0)->Fill((*l1ts)[0].lastEventCounter0());
227  if (_hlHR && *_hlHR)
228  (*_hlHR)->Fill((*l1ts)[0].lastHardReset());
229 
230  if (_lastResync != (*l1ts)[0].lastResync()) {
231  _lastResync = (*l1ts)[0].lastResync();
233  (*_hdlec0lresync)->Fill((*l1ts)[0].lastEventCounter0() - (*l1ts)[0].lastResync());
234  LogDebug("TTCSignalReceived") << "New Resync at orbit " << _lastResync;
235  }
236  if (_lastHardReset != (*l1ts)[0].lastHardReset()) {
237  _lastHardReset = (*l1ts)[0].lastHardReset();
239  (*_hdlresynclHR)->Fill((*l1ts)[0].lastResync() - (*l1ts)[0].lastHardReset());
240  LogDebug("TTCSignalReceived") << "New HardReset at orbit " << _lastHardReset;
241  }
242  if (_lastTestEnable != (*l1ts)[0].lastTestEnable()) {
243  _lastTestEnable = (*l1ts)[0].lastTestEnable();
244  // LogDebug("TTCSignalReceived") << "New TestEnable at orbit " << _lastTestEnable ;
245  }
246  if (_lastOrbitCounter0 != (*l1ts)[0].lastOrbitCounter0()) {
247  _lastOrbitCounter0 = (*l1ts)[0].lastOrbitCounter0();
248  LogDebug("TTCSignalReceived") << "New OrbitCounter0 at orbit " << _lastOrbitCounter0;
249  }
250  if (_lastEventCounter0 != (*l1ts)[0].lastEventCounter0()) {
251  _lastEventCounter0 = (*l1ts)[0].lastEventCounter0();
252  LogDebug("TTCSignalReceived") << "New EventCounter0 at orbit " << _lastEventCounter0;
253  }
254  if (_lastStart != (*l1ts)[0].lastStart()) {
255  _lastStart = (*l1ts)[0].lastStart();
256  LogDebug("TTCSignalReceived") << "New Start at orbit " << _lastStart;
257  }
258  }
259 }
260 
263  desc.add<edm::InputTag>("l1TSCollection", edm::InputTag("scalersRawToDigi"));
264  descriptions.add("l1TSDebugger", desc);
265 }
266 
267 //define this as a plug-in
ConfigurationDescriptions.h
APVCyclePhaseDebuggerFromL1TS::_hdlec0lresync
TH1F ** _hdlec0lresync
Definition: APVCyclePhaseDebuggerFromL1TS.cc:86
APVCyclePhaseDebuggerFromL1TS::_hlOC0
TH1F ** _hlOC0
Definition: APVCyclePhaseDebuggerFromL1TS.cc:80
MessageLogger.h
APVCyclePhaseDebuggerFromL1TS::_hsize
TH1F ** _hsize
Definition: APVCyclePhaseDebuggerFromL1TS.cc:78
edm::Run
Definition: Run.h:45
APVCyclePhaseDebuggerFromL1TS::m_rhm
RunHistogramManager m_rhm
Definition: APVCyclePhaseDebuggerFromL1TS.cc:76
edm::EDGetTokenT< Level1TriggerScalersCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
APVCyclePhaseDebuggerFromL1TS::~APVCyclePhaseDebuggerFromL1TS
~APVCyclePhaseDebuggerFromL1TS() override
Definition: APVCyclePhaseDebuggerFromL1TS.cc:143
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
APVCyclePhaseDebuggerFromL1TS::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: APVCyclePhaseDebuggerFromL1TS.cc:205
EDAnalyzer.h
APVCyclePhaseDebuggerFromL1TS::_lastStart
long long _lastStart
Definition: APVCyclePhaseDebuggerFromL1TS.cc:91
APVCyclePhaseDebuggerFromL1TS::m_maxLS
const unsigned int m_maxLS
Definition: APVCyclePhaseDebuggerFromL1TS.cc:73
APVCyclePhaseDebuggerFromL1TS::_hlTE
TH1F ** _hlTE
Definition: APVCyclePhaseDebuggerFromL1TS.cc:81
edm::Handle
Definition: AssociativeIterator.h:50
APVCyclePhaseDebuggerFromL1TS
Definition: APVCyclePhaseDebuggerFromL1TS.cc:59
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
MakerMacros.h
Level1TriggerScalers.h
RunHistogramManager
Definition: RunHistogramManager.h:210
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
RunHistogramManager.h
APVCyclePhaseDebuggerFromL1TS::_lastEventCounter0
long long _lastEventCounter0
Definition: APVCyclePhaseDebuggerFromL1TS.cc:92
APVCyclePhaseDebuggerFromL1TS::_l1tscollectionToken
edm::EDGetTokenT< Level1TriggerScalersCollection > _l1tscollectionToken
Definition: APVCyclePhaseDebuggerFromL1TS.cc:72
Run.h
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
RunHistogramManager::makeTH1F
TH1F ** makeTH1F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
Definition: RunHistogramManager.cc:33
APVCyclePhaseDebuggerFromL1TS::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: APVCyclePhaseDebuggerFromL1TS.cc:261
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
APVCyclePhaseDebuggerFromL1TS::_lastOrbitCounter0
long long _lastOrbitCounter0
Definition: APVCyclePhaseDebuggerFromL1TS.cc:93
RunHistogramManager::beginRun
void beginRun(const edm::Run &iRun)
Definition: RunHistogramManager.cc:101
APVCyclePhaseDebuggerFromL1TS::_lastTestEnable
long long _lastTestEnable
Definition: APVCyclePhaseDebuggerFromL1TS.cc:94
APVCyclePhaseDebuggerFromL1TS::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: APVCyclePhaseDebuggerFromL1TS.cc:153
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
APVCyclePhaseDebuggerFromL1TS::_hlEC0
TH1F ** _hlEC0
Definition: APVCyclePhaseDebuggerFromL1TS.cc:83
edm::EventSetup
Definition: EventSetup.h:57
InputTag.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
APVCyclePhaseDebuggerFromL1TS::m_LSfrac
const unsigned int m_LSfrac
Definition: APVCyclePhaseDebuggerFromL1TS.cc:74
APVCyclePhaseDebuggerFromL1TS::_hlstart
TH1F ** _hlstart
Definition: APVCyclePhaseDebuggerFromL1TS.cc:82
Frameworkfwd.h
APVCyclePhaseDebuggerFromL1TS::_hlHR
TH1F ** _hlHR
Definition: APVCyclePhaseDebuggerFromL1TS.cc:84
APVCyclePhaseDebuggerFromL1TS::_lastResync
long long _lastResync
Definition: APVCyclePhaseDebuggerFromL1TS.cc:89
EventSetup.h
Exception.h
APVCyclePhaseDebuggerFromL1TS::_hdlresynclHR
TH1F ** _hdlresynclHR
Definition: APVCyclePhaseDebuggerFromL1TS.cc:87
ParameterSet.h
Level1TriggerScalersCollection
std::vector< Level1TriggerScalers > Level1TriggerScalersCollection
Definition: Level1TriggerScalers.h:183
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
APVCyclePhaseDebuggerFromL1TS::APVCyclePhaseDebuggerFromL1TS
APVCyclePhaseDebuggerFromL1TS(const edm::ParameterSet &)
Definition: APVCyclePhaseDebuggerFromL1TS.cc:108
APVCyclePhaseDebuggerFromL1TS::_lastHardReset
long long _lastHardReset
Definition: APVCyclePhaseDebuggerFromL1TS.cc:90
APVCyclePhaseDebuggerFromL1TS::_hlresync
TH1F ** _hlresync
Definition: APVCyclePhaseDebuggerFromL1TS.cc:79