64 virtual void endJob()
override ;
66 bool isBadRun(
const unsigned int)
const;
92 std::vector<std::pair<unsigned int, unsigned int> >
m_badruns;
117 _l1tscollection(iConfig.getParameter<edm::InputTag>(
"l1TSCollection")),
118 _defpartnames(iConfig.getParameter<std::vector<std::
string> >(
"defaultPartitionNames")),
119 _defphases(iConfig.getParameter<std::vector<int> >(
"defaultPhases")),
120 _wantHistos(iConfig.getUntrackedParameter<bool>(
"wantHistos",
false)),
121 _useEC0(iConfig.getUntrackedParameter<bool>(
"useEC0",
false)),
122 _magicOffset(iConfig.getUntrackedParameter<int>(
"magicOffset",8)),
123 m_maxLS(iConfig.getUntrackedParameter<unsigned int>(
"maxLSBeforeRebin",250)),
124 m_LSfrac(iConfig.getUntrackedParameter<unsigned int>(
"startingLSFraction",16)),
126 _hsize(0),_hlresync(0),_hlOC0(0),_hlTE(0),_hlstart(0),_hlEC0(0),_hlHR(0),_hdlec0lresync(0),_hdlresynclHR(0),
128 _lastResync(-1),_lastHardReset(-1),_lastStart(-1),
129 _lastEventCounter0(-1),_lastOrbitCounter0(-1),_lastTestEnable(-1)
132 produces<APVCyclePhaseCollection,edm::InEvent>();
134 m_badruns.push_back(std::pair<unsigned int, unsigned int>(0,131767));
135 m_badruns.push_back(std::pair<unsigned int, unsigned int>(193150,193733));
183 (*_hlresync)->GetXaxis()->SetTitle(
"Orbit"); (*_hlresync)->GetYaxis()->SetTitle(
"Events");
184 (*_hlresync)->SetBit(TH1::kCanRebin);
188 (*_hlOC0)->GetXaxis()->SetTitle(
"Orbit"); (*_hlOC0)->GetYaxis()->SetTitle(
"Events");
189 (*_hlOC0)->SetBit(TH1::kCanRebin);
193 (*_hlTE)->GetXaxis()->SetTitle(
"Orbit"); (*_hlTE)->GetYaxis()->SetTitle(
"Events");
194 (*_hlTE)->SetBit(TH1::kCanRebin);
198 (*_hlstart)->GetXaxis()->SetTitle(
"Orbit"); (*_hlstart)->GetYaxis()->SetTitle(
"Events");
199 (*_hlstart)->SetBit(TH1::kCanRebin);
203 (*_hlEC0)->GetXaxis()->SetTitle(
"Orbit"); (*_hlEC0)->GetYaxis()->SetTitle(
"Events");
204 (*_hlEC0)->SetBit(TH1::kCanRebin);
208 (*_hlHR)->GetXaxis()->SetTitle(
"Orbit"); (*_hlHR)->GetYaxis()->SetTitle(
"Events");
209 (*_hlHR)->SetBit(TH1::kCanRebin);
213 (*_hdlec0lresync)->GetXaxis()->SetTitle(
"lastEC0-lastResync");
217 (*_hdlresynclHR)->GetXaxis()->SetTitle(
"lastEC0-lastResync");
223 LogDebug(
"UnreliableMissingL1TriggerScalers") <<
224 "In this run L1TriggerScalers is missing or unreliable for phase determination: invlid phase will be returned";
252 long long orbitoffset = 0;
256 if((*l1ts)[0].lastResync()!=0) {
262 if(
_hlOC0 && *
_hlOC0) (*_hlOC0)->Fill((*l1ts)[0].lastOrbitCounter0());
263 if(
_hlTE && *
_hlTE) (*_hlTE)->Fill((*l1ts)[0].lastTestEnable());
265 if(
_hlEC0 && *
_hlEC0) (*_hlEC0)->Fill((*l1ts)[0].lastEventCounter0());
266 if(
_hlHR && *
_hlHR) (*_hlHR)->Fill((*l1ts)[0].lastHardReset());
297 phasechange = ((
long long)(orbitoffset*3564))%70;
299 for(
unsigned int ipart=0;ipart<phases.size();++ipart) {
300 phases[ipart] = (
_defphases[ipart]+phasechange)%70;
307 if(phases.size() < partnames.size() ) {
309 throw cms::Exception(
"InvalidAPVCyclePhases") <<
" Inconsistent phases/partitions vector sizes: "
310 << phases.size() <<
" "
314 for(
unsigned int ipart=0;ipart<partnames.size();++ipart) {
317 apvphases->get()[partnames[ipart]] = phases[ipart];
323 iEvent.
put(apvphases);
341 for(std::vector<std::pair<unsigned int, unsigned int> >::const_iterator runpair =
m_badruns.begin();runpair!=
m_badruns.end();++runpair) {
342 if( run >= runpair->first && run <= runpair->
second)
return true;
virtual void endJob() override
const std::vector< std::string > _defpartnames
#define DEFINE_FWK_MODULE(type)
long long _lastOrbitCounter0
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
U second(std::pair< T, U > const &p)
const unsigned int m_LSfrac
TH1F ** makeTH1F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
RunHistogramManager m_rhm
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual void beginJob() override
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
bool isBadRun(const unsigned int) const
virtual void produce(edm::Event &, const edm::EventSetup &) override
long long _lastTestEnable
void beginRun(const edm::Run &iRun)
std::vector< std::pair< unsigned int, unsigned int > > m_badruns
const edm::InputTag _l1tscollection
long long _lastEventCounter0
APVCyclePhaseProducerFromL1TS(const edm::ParameterSet &)
const std::vector< int > _defphases
volatile std::atomic< bool > shutdown_flag false
~APVCyclePhaseProducerFromL1TS()
const unsigned int m_maxLS