112 _l1tscollection(iConfig.getParameter<edm::InputTag>(
"l1TSCollection")),
113 _defpartnames(iConfig.getParameter<std::vector<std::string> >(
"defaultPartitionNames")),
114 _defphases(iConfig.getParameter<std::vector<int> >(
"defaultPhases")),
115 _wantHistos(iConfig.getUntrackedParameter<bool>(
"wantHistos",
false)),
116 _useEC0(iConfig.getUntrackedParameter<bool>(
"useEC0",
false)),
117 _magicOffset(iConfig.getUntrackedParameter<int>(
"magicOffset",8)),
118 _firstgoodrun(131768),
119 _lastResync(-1),_lastHardReset(-1),_lastStart(-1),
120 _lastEventCounter0(-1),_lastOrbitCounter0(-1),_lastTestEnable(-1)
123 produces<APVCyclePhaseCollection,edm::InEvent>();
156 sprintf(dirname,
"run_%d",iRun.
run());
159 _hsize = subrun.make<TH1F>(
"size",
"Level1TriggerScalers Collection size",20,-0.5,19.5);
161 _hlresync = subrun.make<TH1F>(
"lresync",
"Orbit of last resync",3600,0.,3600*11223);
165 _hlOC0 = subrun.make<TH1F>(
"lOC0",
"Orbit of last OC0",3600,0.,3600*11223);
166 _hlOC0->GetXaxis()->SetTitle(
"Orbit");
_hlOC0->GetYaxis()->SetTitle(
"Events");
167 _hlOC0->SetBit(TH1::kCanRebin);
169 _hlTE = subrun.make<TH1F>(
"lTE",
"Orbit of last TestEnable",3600,0.,3600*11223);
170 _hlTE->GetXaxis()->SetTitle(
"Orbit");
_hlTE->GetYaxis()->SetTitle(
"Events");
171 _hlTE->SetBit(TH1::kCanRebin);
173 _hlstart = subrun.make<TH1F>(
"lstart",
"Orbit of last Start",3600,0.,3600*11223);
174 _hlstart->GetXaxis()->SetTitle(
"Orbit");
_hlstart->GetYaxis()->SetTitle(
"Events");
177 _hlEC0 = subrun.make<TH1F>(
"lEC0",
"Orbit of last EC0",3600,0.,3600*11223);
178 _hlEC0->GetXaxis()->SetTitle(
"Orbit");
_hlEC0->GetYaxis()->SetTitle(
"Events");
179 _hlEC0->SetBit(TH1::kCanRebin);
181 _hlHR = subrun.make<TH1F>(
"lHR",
"Orbit of last HardReset",3600,0.,3600*11223);
182 _hlHR->GetXaxis()->SetTitle(
"Orbit");
_hlHR->GetYaxis()->SetTitle(
"Events");
183 _hlHR->SetBit(TH1::kCanRebin);
185 _hdlec0lresync = subrun.make<TH1F>(
"dlec0lresync",
"Orbit difference EC0-Resync",4000,-1999.5,2000.5);
188 _hdlresynclHR = subrun.make<TH1F>(
"dlresynclHR",
"Orbit difference Resync-HR",4000,-1999.5,2000.5);
194 LogDebug(
"UnreliableMissingL1TriggerScalers") <<
195 "In this run L1TriggerScalers is missing or unreliable for phase determination: default phases will be used";
230 long long orbitoffset = 0;
234 if((*l1ts)[0].lastResync()!=0) {
239 _hlresync->Fill((*l1ts)[0].lastResync());
240 _hlOC0->Fill((*l1ts)[0].lastOrbitCounter0());
241 _hlTE->Fill((*l1ts)[0].lastTestEnable());
242 _hlstart->Fill((*l1ts)[0].lastStart());
243 _hlEC0->Fill((*l1ts)[0].lastEventCounter0());
244 _hlHR->Fill((*l1ts)[0].lastHardReset());
274 phasechange = ((
long long)(orbitoffset*3564))%70;
280 if(phases.size() < partnames.size() ) {
282 throw cms::Exception(
"InvalidAPVCyclePhases") <<
" Inconsistent phases/partitions vector sizes: "
283 << phases.size() <<
" "
287 for(
unsigned int ipart=0;ipart<partnames.size();++ipart) {
288 if(phases[ipart]>=0) {
289 apvphases->get()[partnames[ipart]] = (phases[ipart]+phasechange)%70;
295 iEvent.
put(apvphases);
const std::vector< std::string > _defpartnames
#define DEFINE_FWK_MODULE(type)
long long _lastOrbitCounter0
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual void endRun(edm::Run &, const edm::EventSetup &)
virtual void beginRun(edm::Run &, const edm::EventSetup &)
long long _lastTestEnable
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
const edm::InputTag _l1tscollection
long long _lastEventCounter0
APVCyclePhaseProducerFromL1TS(const edm::ParameterSet &)
const std::vector< int > _defphases
virtual void produce(edm::Event &, const edm::EventSetup &)
~APVCyclePhaseProducerFromL1TS()
const unsigned int _firstgoodrun