72 bool isBadRun(
const unsigned int)
const;
103 std::vector<std::pair<unsigned int, unsigned int> >
m_badruns;
130 m_ignoreDB(iConfig.getUntrackedParameter<bool>(
"ignoreDB",
false)),
131 m_rcdLabel(iConfig.getUntrackedParameter<std::
string>(
"recordLabel",
"apvphaseoffsets")),
132 _defpartnames(iConfig.getParameter<std::vector<std::
string> >(
"defaultPartitionNames")),
133 _defphases(iConfig.getParameter<std::vector<int> >(
"defaultPhases")),
134 _wantHistos(iConfig.getUntrackedParameter<bool>(
"wantHistos",
false)),
135 _useEC0(iConfig.getUntrackedParameter<bool>(
"useEC0",
false)),
136 _magicOffset(iConfig.getUntrackedParameter<int>(
"magicOffset",8)),
138 m_maxLS(iConfig.getUntrackedParameter<unsigned int>(
"maxLSBeforeRebin",250)),
139 m_LSfrac(iConfig.getUntrackedParameter<unsigned int>(
"startingLSFraction",16)),
140 m_rhm(consumesCollector()),
141 _hsize(0),_hlresync(0),_hlOC0(0),_hlTE(0),_hlstart(0),_hlEC0(0),_hlHR(0),_hdlec0lresync(0),_hdlresynclHR(0),
143 _lastResync(-1),_lastHardReset(-1),_lastStart(-1),
144 _lastEventCounter0(-1),_lastOrbitCounter0(-1),_lastTestEnable(-1)
147 std::stringstream
ss;
149 edm::LogInfo(
"ConfigurationAtConstruction") << ss.str();
152 produces<APVCyclePhaseCollection,edm::InEvent>();
154 m_badruns.push_back(std::pair<unsigned int, unsigned int>(0,131767));
155 m_badruns.push_back(std::pair<unsigned int, unsigned int>(193150,193733));
203 confObj->printDebug(summary);
204 LogDebug(
"SiStripConfObjectSummary") << summary.str();
206 _defpartnames = confObj->get<std::vector<std::string> >(
"defaultPartitionNames");
207 _defphases = confObj->get<std::vector<int> >(
"defaultPhases");
208 _useEC0 = confObj->get<
bool>(
"useEC0");
209 m_badRun = confObj->get<
bool>(
"badRun");
212 std::stringstream
ss;
224 (*_hlresync)->GetXaxis()->SetTitle(
"Orbit"); (*_hlresync)->GetYaxis()->SetTitle(
"Events");
225 (*_hlresync)->SetBit(TH1::kCanRebin);
229 (*_hlOC0)->GetXaxis()->SetTitle(
"Orbit"); (*_hlOC0)->GetYaxis()->SetTitle(
"Events");
230 (*_hlOC0)->SetBit(TH1::kCanRebin);
234 (*_hlTE)->GetXaxis()->SetTitle(
"Orbit"); (*_hlTE)->GetYaxis()->SetTitle(
"Events");
235 (*_hlTE)->SetBit(TH1::kCanRebin);
239 (*_hlstart)->GetXaxis()->SetTitle(
"Orbit"); (*_hlstart)->GetYaxis()->SetTitle(
"Events");
240 (*_hlstart)->SetBit(TH1::kCanRebin);
244 (*_hlEC0)->GetXaxis()->SetTitle(
"Orbit"); (*_hlEC0)->GetYaxis()->SetTitle(
"Events");
245 (*_hlEC0)->SetBit(TH1::kCanRebin);
249 (*_hlHR)->GetXaxis()->SetTitle(
"Orbit"); (*_hlHR)->GetYaxis()->SetTitle(
"Events");
250 (*_hlHR)->SetBit(TH1::kCanRebin);
254 (*_hdlec0lresync)->GetXaxis()->SetTitle(
"lastEC0-lastResync");
258 (*_hdlresynclHR)->GetXaxis()->SetTitle(
"lastEC0-lastResync");
264 LogDebug(
"UnreliableMissingL1TriggerScalers") <<
265 "In this run L1TriggerScalers is missing or unreliable for phase determination: invlid phase will be returned";
293 long long orbitoffset = 0;
297 if((*l1ts)[0].lastResync()!=0) {
303 if(
_hlOC0 && *
_hlOC0) (*_hlOC0)->Fill((*l1ts)[0].lastOrbitCounter0());
304 if(
_hlTE && *
_hlTE) (*_hlTE)->Fill((*l1ts)[0].lastTestEnable());
306 if(
_hlEC0 && *
_hlEC0) (*_hlEC0)->Fill((*l1ts)[0].lastEventCounter0());
307 if(
_hlHR && *
_hlHR) (*_hlHR)->Fill((*l1ts)[0].lastHardReset());
338 phasechange = ((
long long)(orbitoffset*3564))%70;
340 for(
unsigned int ipart=0;ipart<phases.size();++ipart) {
341 phases[ipart] = (
_defphases[ipart]+phasechange)%70;
348 if(phases.size() < partnames.size() ) {
350 throw cms::Exception(
"InvalidAPVCyclePhases") <<
" Inconsistent phases/partitions vector sizes: "
351 << phases.size() <<
" "
355 for(
unsigned int ipart=0;ipart<partnames.size();++ipart) {
358 apvphases->get()[partnames[ipart]] = phases[ipart];
364 iEvent.
put(apvphases);
371 for(std::vector<std::pair<unsigned int, unsigned int> >::const_iterator runpair =
m_badruns.begin();runpair!=
m_badruns.end();++runpair) {
372 if( run >= runpair->first && run <= runpair->
second)
return true;
387 ss <<
_defphases.size() <<
" default phases: ";
388 for(std::vector<int>::const_iterator phase=
_defphases.begin();phase!=
_defphases.end();++phase) {
393 ss <<
" use ECO: " <<
_useEC0 << std::endl;
394 ss <<
" bad run: " <<
m_badRun << std::endl;
std::vector< std::string > _defpartnames
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
long long _lastOrbitCounter0
edm::ESWatcher< SiStripConfObjectRcd > m_eswatcher
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.
m_rhm(consumesCollector())
void printConfiguration(std::stringstream &ss) 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< Level1TriggerScalers > Level1TriggerScalersCollection
bool check(const edm::EventSetup &iSetup)
std::vector< std::pair< unsigned int, unsigned int > > m_badruns
const std::string m_rcdLabel
long long _lastEventCounter0
APVCyclePhaseProducerFromL1TS(const edm::ParameterSet &)
std::vector< int > _defphases
volatile std::atomic< bool > shutdown_flag false
~APVCyclePhaseProducerFromL1TS()
edm::EDGetTokenT< Level1TriggerScalersCollection > _l1tscollectionToken
const unsigned int m_maxLS