#include <AlcaBeamSpotProducer.h>
Public Member Functions | |
AlcaBeamSpotProducer (const edm::ParameterSet &) | |
~AlcaBeamSpotProducer () | |
Private Member Functions | |
virtual void | beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) override final |
virtual void | endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) override final |
virtual void | endLuminosityBlockProduce (edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) override final |
virtual void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override final |
Private Attributes | |
int | beginLumiOfBSFit_ |
int | countEvt_ |
int | countLumi_ |
int | endLumiOfBSFit_ |
int | fitNLumi_ |
int | ftmprun |
int | ftmprun0 |
int | ftotalevents |
double | inputBeamWidth_ |
std::time_t | refBStime [2] |
int | resetFitNLumi_ |
bool | runallfitters_ |
bool | runbeamwidthfit_ |
BeamFitter * | theBeamFitter |
bool | write2DB_ |
_________________________________________________________________ class: AlcaBeamSpotProducer.h package: Calibration/TkAlCaRecoProducers
author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)
version
________________________________________________________________
Definition at line 27 of file AlcaBeamSpotProducer.h.
AlcaBeamSpotProducer::AlcaBeamSpotProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
_________________________________________________________________ class: AlcaBeamSpotProducer.cc package: RecoVertex/BeamSpotProducer
author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov) Geng-Yuan Jeng, UC Riverside (Geng-Yuan.Jeng@cern.ch)
version
________________________________________________________________
Definition at line 35 of file AlcaBeamSpotProducer.cc.
References beginLumiOfBSFit_, countLumi_, endLumiOfBSFit_, fitNLumi_, ftmprun, ftmprun0, ftotalevents, edm::ParameterSet::getParameter(), BeamFitter::resetCutFlow(), resetFitNLumi_, BeamFitter::resetLSRange(), BeamFitter::resetPVFitter(), BeamFitter::resetRefTime(), BeamFitter::resetTrkVector(), runallfitters_, runbeamwidthfit_, theBeamFitter, and write2DB_.
{ // get parameter write2DB_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("WriteToDB"); runallfitters_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("RunAllFitters"); fitNLumi_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getUntrackedParameter<int>("fitEveryNLumi",-1); resetFitNLumi_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getUntrackedParameter<int>("resetEveryNLumi",-1); runbeamwidthfit_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("RunBeamWidthFit"); theBeamFitter = new BeamFitter(iConfig); theBeamFitter->resetTrkVector(); theBeamFitter->resetLSRange(); theBeamFitter->resetCutFlow(); theBeamFitter->resetRefTime(); theBeamFitter->resetPVFitter(); ftotalevents = 0; ftmprun0 = ftmprun = -1; countLumi_ = 0; beginLumiOfBSFit_ = endLumiOfBSFit_ = -1; produces<reco::BeamSpot, edm::InLumi>("alcaBeamSpot"); }
AlcaBeamSpotProducer::~AlcaBeamSpotProducer | ( | ) |
Definition at line 59 of file AlcaBeamSpotProducer.cc.
References theBeamFitter.
{ delete theBeamFitter; }
void AlcaBeamSpotProducer::beginLuminosityBlock | ( | edm::LuminosityBlock const & | lumiSeg, |
const edm::EventSetup & | iSetup | ||
) | [override, private, virtual] |
Definition at line 71 of file AlcaBeamSpotProducer.cc.
References beginLumiOfBSFit_, edm::LuminosityBlockBase::beginTime(), countLumi_, ftmprun, ftmprun0, edm::LuminosityBlockBase::luminosityBlock(), refBStime, resetFitNLumi_, and edm::LuminosityBlockBase::run().
{ const edm::TimeValue_t fbegintimestamp = lumiSeg.beginTime().value(); const std::time_t ftmptime = fbegintimestamp >> 32; if ( countLumi_ == 0 || (resetFitNLumi_ > 0 && countLumi_%resetFitNLumi_ == 0) ) { ftmprun0 = lumiSeg.run(); ftmprun = ftmprun0; beginLumiOfBSFit_ = lumiSeg.luminosityBlock(); refBStime[0] = ftmptime; } countLumi_++; }
void AlcaBeamSpotProducer::endLuminosityBlock | ( | edm::LuminosityBlock const & | lumiSeg, |
const edm::EventSetup & | iSetup | ||
) | [override, private, virtual] |
Definition at line 87 of file AlcaBeamSpotProducer.cc.
{ }
void AlcaBeamSpotProducer::endLuminosityBlockProduce | ( | edm::LuminosityBlock & | lumiSeg, |
const edm::EventSetup & | iSetup | ||
) | [override, private, virtual] |
Definition at line 91 of file AlcaBeamSpotProducer.cc.
References beginLumiOfBSFit_, countLumi_, endLumiOfBSFit_, edm::LuminosityBlockBase::endTime(), reco::BeamSpot::Fake, fitNLumi_, ftmprun, ftmprun0, BeamFitter::getBeamSpot(), BeamFitter::getBSvector(), BeamFitter::getFitLSRange(), edm::LuminosityBlockBase::luminosityBlock(), edm::LuminosityBlock::put(), refBStime, BeamFitter::resetCutFlow(), resetFitNLumi_, BeamFitter::resetLSRange(), BeamFitter::resetPVFitter(), BeamFitter::resetRefTime(), BeamFitter::resetTrkVector(), query::result, BeamFitter::runPVandTrkFitter(), BeamFitter::setFitLSRange(), BeamFitter::setRefTime(), BeamFitter::setRun(), reco::BeamSpot::setType(), AlCaHLTBitMon_QueryRunRegistry::string, and theBeamFitter.
{ const edm::TimeValue_t fendtimestamp = lumiSeg.endTime().value(); const std::time_t fendtime = fendtimestamp >> 32; refBStime[1] = fendtime; endLumiOfBSFit_ = lumiSeg.luminosityBlock(); if ( fitNLumi_ == -1 && resetFitNLumi_ == -1 ) return; if (fitNLumi_ > 0 && countLumi_%fitNLumi_!=0) return; theBeamFitter->setFitLSRange(beginLumiOfBSFit_,endLumiOfBSFit_); theBeamFitter->setRefTime(refBStime[0],refBStime[1]); theBeamFitter->setRun(ftmprun0); std::pair<int,int> LSRange = theBeamFitter->getFitLSRange(); reco::BeamSpot bs; if (theBeamFitter->runPVandTrkFitter()){ bs = theBeamFitter->getBeamSpot(); edm::LogInfo("AlcaBeamSpotProducer") << "\n RESULTS OF DEFAULT FIT " << std::endl << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl << " for lumi blocks : " << LSRange.first << " - " << LSRange.second << std::endl << " lumi counter # " << countLumi_ << std::endl << bs << std::endl << "fit done. \n" << std::endl; } else { // Fill in empty beam spot if beamfit fails bs.setType(reco::BeamSpot::Fake); edm::LogInfo("AlcaBeamSpotProducer") << "\n Empty Beam spot fit" << std::endl << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl << " for lumi blocks : " << LSRange.first << " - " << LSRange.second << std::endl << " lumi counter # " << countLumi_ << std::endl << bs << std::endl << "fit failed \n" << std::endl; } std::auto_ptr<reco::BeamSpot> result(new reco::BeamSpot); *result = bs; lumiSeg.put(result, std::string("alcaBeamSpot")); if (resetFitNLumi_ > 0 && countLumi_%resetFitNLumi_ == 0) { std::vector<BSTrkParameters> theBSvector = theBeamFitter->getBSvector(); edm::LogInfo("AlcaBeamSpotProducer") << "Total number of tracks accumulated = " << theBSvector.size() << std::endl << "Reset track collection for beam fit" <<std::endl; theBeamFitter->resetTrkVector(); theBeamFitter->resetLSRange(); theBeamFitter->resetCutFlow(); theBeamFitter->resetRefTime(); theBeamFitter->resetPVFitter(); countLumi_=0; } }
void AlcaBeamSpotProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [override, private, virtual] |
Implements edm::one::EDProducerBase.
Definition at line 64 of file AlcaBeamSpotProducer.cc.
References ftmprun, ftotalevents, edm::EventBase::id(), BeamFitter::readEvent(), edm::EventID::run(), and theBeamFitter.
{ ftotalevents++; theBeamFitter->readEvent(iEvent); ftmprun = iEvent.id().run(); }
int AlcaBeamSpotProducer::beginLumiOfBSFit_ [private] |
Definition at line 45 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer(), beginLuminosityBlock(), and endLuminosityBlockProduce().
int AlcaBeamSpotProducer::countEvt_ [private] |
Definition at line 42 of file AlcaBeamSpotProducer.h.
int AlcaBeamSpotProducer::countLumi_ [private] |
Definition at line 43 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer(), beginLuminosityBlock(), and endLuminosityBlockProduce().
int AlcaBeamSpotProducer::endLumiOfBSFit_ [private] |
Definition at line 46 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer(), and endLuminosityBlockProduce().
int AlcaBeamSpotProducer::fitNLumi_ [private] |
Definition at line 40 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer(), and endLuminosityBlockProduce().
int AlcaBeamSpotProducer::ftmprun [private] |
Definition at line 44 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer(), beginLuminosityBlock(), endLuminosityBlockProduce(), and produce().
int AlcaBeamSpotProducer::ftmprun0 [private] |
Definition at line 44 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer(), beginLuminosityBlock(), and endLuminosityBlockProduce().
int AlcaBeamSpotProducer::ftotalevents [private] |
Definition at line 39 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer(), and produce().
double AlcaBeamSpotProducer::inputBeamWidth_ [private] |
Definition at line 52 of file AlcaBeamSpotProducer.h.
std::time_t AlcaBeamSpotProducer::refBStime[2] [private] |
Definition at line 47 of file AlcaBeamSpotProducer.h.
Referenced by beginLuminosityBlock(), and endLuminosityBlockProduce().
int AlcaBeamSpotProducer::resetFitNLumi_ [private] |
Definition at line 41 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer(), beginLuminosityBlock(), and endLuminosityBlockProduce().
bool AlcaBeamSpotProducer::runallfitters_ [private] |
Definition at line 51 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer().
bool AlcaBeamSpotProducer::runbeamwidthfit_ [private] |
Definition at line 50 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer().
BeamFitter* AlcaBeamSpotProducer::theBeamFitter [private] |
Definition at line 54 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer(), endLuminosityBlockProduce(), produce(), and ~AlcaBeamSpotProducer().
bool AlcaBeamSpotProducer::write2DB_ [private] |
Definition at line 49 of file AlcaBeamSpotProducer.h.
Referenced by AlcaBeamSpotProducer().