97 _l1abccollection(iConfig.getParameter<edm::InputTag>(
"l1ABCCollection")),
98 _defpartnames(iConfig.getParameter<std::vector<std::string> >(
"defaultPartitionNames")),
99 _defphases(iConfig.getParameter<std::vector<int> >(
"defaultPhases")),
100 _orbitoffsetSOR(iConfig.getParameter<int>(
"StartOfRunOrbitOffset")),
101 _wantHistos(iConfig.getUntrackedParameter<bool>(
"wantHistos",
false)),
102 _hbx(0),_hdbx(0),_hdorbit(0),_firstgoodrun(110878),
103 _offsets(), _curroffset(0), _curroffevent(0)
106 produces<APVCyclePhaseCollection,edm::InEvent>();
135 edm::LogInfo(
"AbsoluteBXOffsetReset") <<
"Absolute BX offset map reset";
143 sprintf(dirname,
"run_%d",iRun.
run());
146 _hbx = subrun.make<TH1F>(
"l1abcbx",
"BX number from L1ABC",4096,-0.5,4095.5);
147 _hbx->GetXaxis()->SetTitle(
"BX");
_hbx->GetYaxis()->SetTitle(
"Events");
149 _hdbx = subrun.make<TH1F>(
"dbx",
"BX number difference",4096*2-1,-4095.5,4095.5);
150 _hdbx->GetXaxis()->SetTitle(
"#DeltaBX");
_hdbx->GetYaxis()->SetTitle(
"Events");
152 _hdorbit = subrun.make<TH1F>(
"dorbit",
"Orbit Number difference",9999,-4999.5,4999.5);
153 _hdorbit->GetXaxis()->SetTitle(
"#Deltaorbit");
_hdorbit->GetYaxis()->SetTitle(
"Events");
158 edm::LogInfo(
"UnreliableMissingL1AcceptBunchCrossingCollection") <<
159 "In this run L1AcceptBunchCrossingCollection is missing or unreliable: default phases will be used";
169 edm::LogInfo(
"L1AcceptBunchCrossingAbsoluteBXOffsetSummary") <<
"Absolute BX offset summary:";
202 for(L1AcceptBunchCrossingCollection::const_iterator l1abc=pIn->begin();l1abc!=pIn->end();++l1abc) {
203 if(l1abc->l1AcceptOffset()==0) {
204 if(l1abc->eventType()!=0) {
205 orbitoffset = (
long long)iEvent.
orbitNumber() - (
long long)l1abc->orbitNumber() ;
209 _hbx->Fill(l1abc->bunchCrossing());
210 _hdbx->Fill(bxoffset);
215 edm::LogWarning(
"L1AcceptBunchCrossingNoType") <<
"L1AcceptBunchCrossing with no type found: ";
216 for(L1AcceptBunchCrossingCollection::const_iterator debu=pIn->begin();debu!=pIn->end();++debu) {
223 long long absbxoffset = orbitoffset*3564 + bxoffset;
225 if(orbitoffset !=
_orbitoffsetSOR) phasechange = (orbitoffset*3564)%70;
236 edm::LogInfo(
"L1AcceptBunchCrossingAbsoluteBXOffsetChanged") <<
"Absolute BX offset changed from "
238 << absbxoffset <<
" at orbit "
241 for(L1AcceptBunchCrossingCollection::const_iterator l1abc=pIn->begin();l1abc!=pIn->end();++l1abc) {
257 if(phases.size() < partnames.size() ) {
259 throw cms::Exception(
"InvalidAPVCyclePhases") <<
" Inconsistent phases/partitions vector sizes: "
260 << phases.size() <<
" "
264 for(
unsigned int ipart=0;ipart<partnames.size();++ipart) {
265 if(phases[ipart]>=0) {
266 apvphases->get()[partnames[ipart]] = (phases[ipart]+phasechange)%70;
272 iEvent.
put(apvphases);
std::map< unsigned int, long long > _offsets
EventNumber_t event() const
const std::vector< std::string > _defpartnames
APVCyclePhaseProducerFromL1ABC(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
const edm::InputTag _l1abccollection
int bunchCrossing() const
virtual void endRun(edm::Run &, const edm::EventSetup &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
const unsigned int _firstgoodrun
virtual void produce(edm::Event &, const edm::EventSetup &)
unsigned int offset(bool)
virtual void beginRun(edm::Run &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
unsigned int _curroffevent
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
const int _orbitoffsetSOR
const std::vector< int > _defphases
~APVCyclePhaseProducerFromL1ABC()