CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

AlcaBeamSpotProducer Class Reference

#include <AlcaBeamSpotProducer.h>

Inheritance diagram for AlcaBeamSpotProducer:
edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks > Type edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

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_
BeamFittertheBeamFitter
bool write2DB_

Detailed Description

_________________________________________________________________ class: AlcaBeamSpotProducer.h package: Calibration/TkAlCaRecoProducers

author: Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)

version

Id:
AlcaBeamSpotProducer.h,v 1.2 2013/05/17 20:25:10 chrjones Exp

________________________________________________________________

Definition at line 27 of file AlcaBeamSpotProducer.h.


Constructor & Destructor Documentation

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

Id:
AlcaBeamSpotProducer.cc,v 1.4 2013/05/17 20:25:11 chrjones Exp

________________________________________________________________

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;
}

Member Function Documentation

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]

Member Data Documentation

Definition at line 42 of file AlcaBeamSpotProducer.h.

Definition at line 46 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and endLuminosityBlockProduce().

Definition at line 40 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and endLuminosityBlockProduce().

Definition at line 39 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and produce().

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().

Definition at line 51 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().

Definition at line 50 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().

Definition at line 49 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().