81 std::map<edm::EventNumber_t, long long>
_offsets;
98 : _l1abccollectionToken(
101 _defpartnames(iConfig.getParameter<
std::
vector<
std::
string> >(
"defaultPartitionNames")),
102 _defphases(iConfig.getParameter<
std::
vector<
int> >(
"defaultPhases")),
103 _orbitoffsetSOR(iConfig.getParameter<
int>(
"StartOfRunOrbitOffset")),
104 _wantHistos(iConfig.getUntrackedParameter<
bool>(
"wantHistos",
false)),
105 _forceSCAL(iConfig.getParameter<
bool>(
"forceSCAL")),
106 m_rhm(consumesCollector()),
110 _firstgoodrun(110878),
114 produces<APVCyclePhaseCollection, edm::InEvent>();
119 _hbx =
m_rhm.
makeTH1F(
"l1abcbx",
"BX number from TCDS (or L1ABC as fallback)", 4096, -0.5, 4095.5);
141 edm::LogInfo(
"AbsoluteBXOffsetReset") <<
"Absolute BX offset map reset";
147 (*_hbx)->GetXaxis()->SetTitle(
"BX");
148 (*_hbx)->GetYaxis()->SetTitle(
"Events");
152 (*_hdbx)->GetXaxis()->SetTitle(
"#DeltaBX");
153 (*_hdbx)->GetYaxis()->SetTitle(
"Events");
157 (*_hdorbit)->GetXaxis()->SetTitle(
"#Deltaorbit");
158 (*_hdorbit)->GetYaxis()->SetTitle(
"Events");
163 edm::LogInfo(
"UnreliableMissingL1AcceptBunchCrossingCollection")
164 <<
"In this run L1AcceptBunchCrossingCollection is missing or unreliable: default phases will be used";
171 edm::LogInfo(
"L1AcceptBunchCrossingAbsoluteBXOffsetSummary") <<
"Absolute BX offset summary:";
203 if (
tcdsRecord->getL1aHistoryEntry(0).getIndex() == 0) {
205 orbitoffset = (
long long)
tcdsRecord->getOrbitNr() - (
long long)
iEvent.orbitNumber();
213 (*_hdbx)->Fill(bxoffset);
215 (*_hdorbit)->Fill(orbitoffset);
219 edm::LogWarning(
"L1AcceptBunchCrossingNoType") <<
"L1AcceptBunchCrossing with no type found: ";
223 for (L1AcceptBunchCrossingCollection::const_iterator l1abc = pIn->begin(); l1abc != pIn->end(); ++l1abc) {
224 if (l1abc->l1AcceptOffset() == 0) {
225 if (l1abc->eventType() != 0) {
226 orbitoffset = (
long long)
iEvent.orbitNumber() - (
long long)l1abc->orbitNumber();
229 l1abc->bunchCrossing();
233 (*_hbx)->Fill(l1abc->bunchCrossing());
235 (*_hdbx)->Fill(bxoffset);
237 (*_hdorbit)->Fill(orbitoffset);
240 edm::LogWarning(
"L1AcceptBunchCrossingNoType") <<
"L1AcceptBunchCrossing with no type found: ";
241 for (L1AcceptBunchCrossingCollection::const_iterator debu = pIn->begin(); debu != pIn->end(); ++debu) {
249 long long absbxoffset = orbitoffset * 3564 + bxoffset;
252 phasechange = (orbitoffset * 3564) % 70;
261 edm::LogInfo(
"L1AcceptBunchCrossingAbsoluteBXOffsetChanged")
262 <<
"Absolute BX offset changed from " <<
_curroffset <<
" to " << absbxoffset <<
" at orbit " 263 <<
iEvent.orbitNumber() <<
" and BX " <<
iEvent.bunchCrossing();
267 for (L1AcceptBunchCrossingCollection::const_iterator l1abc = pIn->begin(); l1abc != pIn->end(); ++l1abc) {
280 if (
phases.size() < partnames.size()) {
283 <<
" Inconsistent phases/partitions vector sizes: " <<
phases.size() <<
" " << partnames.size();
286 for (
unsigned int ipart = 0; ipart < partnames.size(); ++ipart) {
288 apvphases->get()[partnames[ipart]] = (
phases[ipart] + phasechange) % 70;
~APVCyclePhaseProducerFromL1ABC() override
Log< level::Info, true > LogVerbatim
std::map< edm::EventNumber_t, long long > _offsets
RunHistogramManager m_rhm
const std::vector< std::string > _defpartnames
APVCyclePhaseProducerFromL1ABC(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
T const * product() const
unsigned long long EventNumber_t
edm::EDGetTokenT< L1AcceptBunchCrossingCollection > _l1abccollectionToken
edm::EDGetTokenT< TCDSRecord > _tcdsRecordToken
Class to contain information from TCDS FED.
TH1F ** makeTH1F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
void endRun(const edm::Run &, const edm::EventSetup &) override
const unsigned int _firstgoodrun
#define DEFINE_FWK_MODULE(type)
std::vector< L1AcceptBunchCrossing > L1AcceptBunchCrossingCollection
void beginRun(const edm::Run &, const edm::EventSetup &) override
Log< level::Warning, true > LogPrint
Log< level::Info, false > LogInfo
std::vector< int > phases
void beginRun(const edm::Run &iRun)
const int _orbitoffsetSOR
edm::EventNumber_t _curroffevent
Log< level::Warning, false > LogWarning
const std::vector< int > _defphases