CMS 3D CMS Logo

List of all members | 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 > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AlcaBeamSpotProducer (const edm::ParameterSet &)
 
 ~AlcaBeamSpotProducer () override
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) final
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) final
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) 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_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description


class: AlcaBeamSpotProducer.h package: Calibration/TkAlCaRecoProducers

author: Francisco Yumiceva, Fermilab (yumic.nosp@m.eva@.nosp@m.fnal..nosp@m.gov)


Definition at line 24 of file AlcaBeamSpotProducer.h.

Constructor & Destructor Documentation

◆ AlcaBeamSpotProducer()

AlcaBeamSpotProducer::AlcaBeamSpotProducer ( const edm::ParameterSet iConfig)
explicit

class: AlcaBeamSpotProducer.cc package: RecoVertex/BeamSpotProducer

author: Francisco Yumiceva, Fermilab (yumic.nosp@m.eva@.nosp@m.fnal..nosp@m.gov) Geng-Yuan Jeng, UC Riverside (Geng-.nosp@m.Yuan.nosp@m..Jeng.nosp@m.@cer.nosp@m.n.ch)


Definition at line 34 of file AlcaBeamSpotProducer.cc.

34  {
35  // get parameter
36  write2DB_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("WriteToDB");
38  iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("RunAllFitters");
39  fitNLumi_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters")
40  .getUntrackedParameter<int>("fitEveryNLumi", -1);
41  resetFitNLumi_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters")
42  .getUntrackedParameter<int>("resetEveryNLumi", -1);
44  iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("RunBeamWidthFit");
45 
46  theBeamFitter = new BeamFitter(iConfig, consumesCollector());
52 
53  ftotalevents = 0;
54  ftmprun0 = ftmprun = -1;
55  countLumi_ = 0;
57 
58  produces<reco::BeamSpot, edm::Transition::EndLuminosityBlock>("alcaBeamSpot");
59 }

References AlcaBeamMonitor_cfi::BeamFitter, beginLumiOfBSFit_, edm::EDConsumerBase::consumesCollector(), 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_.

◆ ~AlcaBeamSpotProducer()

AlcaBeamSpotProducer::~AlcaBeamSpotProducer ( )
override

Definition at line 62 of file AlcaBeamSpotProducer.cc.

62 { delete theBeamFitter; }

References theBeamFitter.

Member Function Documentation

◆ beginLuminosityBlock()

void AlcaBeamSpotProducer::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
const edm::EventSetup iSetup 
)
finalprivate

Definition at line 72 of file AlcaBeamSpotProducer.cc.

72  {
73  const edm::TimeValue_t fbegintimestamp = lumiSeg.beginTime().value();
74  const std::time_t ftmptime = fbegintimestamp >> 32;
75 
76  if (countLumi_ == 0 || (resetFitNLumi_ > 0 && countLumi_ % resetFitNLumi_ == 0)) {
77  ftmprun0 = lumiSeg.run();
78  ftmprun = ftmprun0;
79  beginLumiOfBSFit_ = lumiSeg.luminosityBlock();
80  refBStime[0] = ftmptime;
81  }
82 
83  countLumi_++;
84 }

References beginLumiOfBSFit_, edm::LuminosityBlockBase::beginTime(), countLumi_, ftmprun, ftmprun0, edm::LuminosityBlockBase::luminosityBlock(), refBStime, resetFitNLumi_, edm::LuminosityBlockBase::run(), and edm::Timestamp::value().

◆ endLuminosityBlock()

void AlcaBeamSpotProducer::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
const edm::EventSetup iSetup 
)
finalprivate

Definition at line 87 of file AlcaBeamSpotProducer.cc.

87 {}

◆ endLuminosityBlockProduce()

void AlcaBeamSpotProducer::endLuminosityBlockProduce ( edm::LuminosityBlock lumiSeg,
const edm::EventSetup iSetup 
)
finalprivate

Definition at line 90 of file AlcaBeamSpotProducer.cc.

90  {
91  const edm::TimeValue_t fendtimestamp = lumiSeg.endTime().value();
92  const std::time_t fendtime = fendtimestamp >> 32;
93  refBStime[1] = fendtime;
94 
95  endLumiOfBSFit_ = lumiSeg.luminosityBlock();
96 
97  if (fitNLumi_ == -1 && resetFitNLumi_ == -1)
98  return;
99 
100  if (fitNLumi_ > 0 && countLumi_ % fitNLumi_ != 0)
101  return;
102 
106 
107  std::pair<int, int> LSRange = theBeamFitter->getFitLSRange();
108 
112  edm::LogInfo("AlcaBeamSpotProducer") << "\n RESULTS OF DEFAULT FIT " << std::endl
113  << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl
114  << " for lumi blocks : " << LSRange.first << " - " << LSRange.second
115  << std::endl
116  << " lumi counter # " << countLumi_ << std::endl
117  << bs << std::endl
118  << "fit done. \n"
119  << std::endl;
120  } else { // Fill in empty beam spot if beamfit fails
121  bs.setType(reco::BeamSpot::Fake);
122  edm::LogInfo("AlcaBeamSpotProducer") << "\n Empty Beam spot fit" << std::endl
123  << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl
124  << " for lumi blocks : " << LSRange.first << " - " << LSRange.second
125  << std::endl
126  << " lumi counter # " << countLumi_ << std::endl
127  << bs << std::endl
128  << "fit failed \n"
129  << std::endl;
130  }
131 
132  auto result = std::make_unique<reco::BeamSpot>();
133  *result = bs;
134  lumiSeg.put(std::move(result), std::string("alcaBeamSpot"));
135 
136  if (resetFitNLumi_ > 0 && countLumi_ % resetFitNLumi_ == 0) {
137  std::vector<BSTrkParameters> theBSvector = theBeamFitter->getBSvector();
138  edm::LogInfo("AlcaBeamSpotProducer") << "Total number of tracks accumulated = " << theBSvector.size() << std::endl
139  << "Reset track collection for beam fit" << std::endl;
145  countLumi_ = 0;
146  }
147 }

References beginLumiOfBSFit_, cms::cuda::bs, countLumi_, endLumiOfBSFit_, edm::LuminosityBlockBase::endTime(), reco::BeamSpot::Fake, fitNLumi_, ftmprun, ftmprun0, BeamFitter::getBeamSpot(), BeamFitter::getBSvector(), BeamFitter::getFitLSRange(), edm::LuminosityBlockBase::luminosityBlock(), eostools::move(), edm::LuminosityBlock::put(), refBStime, BeamFitter::resetCutFlow(), resetFitNLumi_, BeamFitter::resetLSRange(), BeamFitter::resetPVFitter(), BeamFitter::resetRefTime(), BeamFitter::resetTrkVector(), mps_fire::result, BeamFitter::runPVandTrkFitter(), BeamFitter::setFitLSRange(), BeamFitter::setRefTime(), BeamFitter::setRun(), AlCaHLTBitMon_QueryRunRegistry::string, theBeamFitter, and edm::Timestamp::value().

◆ produce()

void AlcaBeamSpotProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
finalprivatevirtual

Implements edm::one::EDProducerBase.

Definition at line 65 of file AlcaBeamSpotProducer.cc.

65  {
66  ftotalevents++;
68  ftmprun = iEvent.id().run();
69 }

References ftmprun, ftotalevents, iEvent, BeamFitter::readEvent(), and theBeamFitter.

Member Data Documentation

◆ beginLumiOfBSFit_

int AlcaBeamSpotProducer::beginLumiOfBSFit_
private

◆ countEvt_

int AlcaBeamSpotProducer::countEvt_
private

Definition at line 39 of file AlcaBeamSpotProducer.h.

◆ countLumi_

int AlcaBeamSpotProducer::countLumi_
private

◆ endLumiOfBSFit_

int AlcaBeamSpotProducer::endLumiOfBSFit_
private

Definition at line 43 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and endLuminosityBlockProduce().

◆ fitNLumi_

int AlcaBeamSpotProducer::fitNLumi_
private

Definition at line 37 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and endLuminosityBlockProduce().

◆ ftmprun

int AlcaBeamSpotProducer::ftmprun
private

◆ ftmprun0

int AlcaBeamSpotProducer::ftmprun0
private

◆ ftotalevents

int AlcaBeamSpotProducer::ftotalevents
private

Definition at line 36 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and produce().

◆ inputBeamWidth_

double AlcaBeamSpotProducer::inputBeamWidth_
private

Definition at line 49 of file AlcaBeamSpotProducer.h.

◆ refBStime

std::time_t AlcaBeamSpotProducer::refBStime[2]
private

Definition at line 44 of file AlcaBeamSpotProducer.h.

Referenced by beginLuminosityBlock(), and endLuminosityBlockProduce().

◆ resetFitNLumi_

int AlcaBeamSpotProducer::resetFitNLumi_
private

◆ runallfitters_

bool AlcaBeamSpotProducer::runallfitters_
private

Definition at line 48 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().

◆ runbeamwidthfit_

bool AlcaBeamSpotProducer::runbeamwidthfit_
private

Definition at line 47 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().

◆ theBeamFitter

BeamFitter* AlcaBeamSpotProducer::theBeamFitter
private

◆ write2DB_

bool AlcaBeamSpotProducer::write2DB_
private

Definition at line 46 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().

AlcaBeamSpotProducer::refBStime
std::time_t refBStime[2]
Definition: AlcaBeamSpotProducer.h:44
BeamFitter::runPVandTrkFitter
bool runPVandTrkFitter()
Definition: BeamFitter.cc:412
BeamFitter::resetRefTime
void resetRefTime()
Definition: BeamFitter.h:58
BeamFitter::resetPVFitter
void resetPVFitter()
Definition: BeamFitter.h:69
BeamFitter::resetTrkVector
void resetTrkVector()
Definition: BeamFitter.h:55
AlcaBeamMonitor_cfi.BeamFitter
BeamFitter
Definition: AlcaBeamMonitor_cfi.py:11
AlcaBeamSpotProducer::beginLumiOfBSFit_
int beginLumiOfBSFit_
Definition: AlcaBeamSpotProducer.h:42
AlcaBeamSpotProducer::theBeamFitter
BeamFitter * theBeamFitter
Definition: AlcaBeamSpotProducer.h:51
AlcaBeamSpotProducer::endLumiOfBSFit_
int endLumiOfBSFit_
Definition: AlcaBeamSpotProducer.h:43
AlcaBeamSpotProducer::fitNLumi_
int fitNLumi_
Definition: AlcaBeamSpotProducer.h:37
edm::LogInfo
Definition: MessageLogger.h:254
BeamFitter::readEvent
void readEvent(const edm::Event &iEvent)
Definition: BeamFitter.cc:224
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
AlcaBeamSpotProducer::resetFitNLumi_
int resetFitNLumi_
Definition: AlcaBeamSpotProducer.h:38
edm::Timestamp::value
TimeValue_t value() const
Definition: Timestamp.h:45
cms::cuda::bs
bs
Definition: HistoContainer.h:127
AlcaBeamSpotProducer::ftotalevents
int ftotalevents
Definition: AlcaBeamSpotProducer.h:36
edm::LuminosityBlockBase::endTime
Timestamp const & endTime() const
Definition: LuminosityBlockBase.h:47
edm::LuminosityBlockBase::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockBase.h:40
reco::BeamSpot
Definition: BeamSpot.h:21
reco::BeamSpot::Fake
Definition: BeamSpot.h:24
BeamFitter::getBeamSpot
reco::BeamSpot getBeamSpot()
Definition: BeamFitter.h:90
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BeamFitter::setRun
void setRun(int run)
Definition: BeamFitter.h:116
BeamFitter::setRefTime
void setRefTime(time_t t0, time_t t1)
Definition: BeamFitter.h:59
AlcaBeamSpotProducer::write2DB_
bool write2DB_
Definition: AlcaBeamSpotProducer.h:46
edm::ParameterSet
Definition: ParameterSet.h:36
AlcaBeamSpotProducer::countLumi_
int countLumi_
Definition: AlcaBeamSpotProducer.h:40
AlcaBeamSpotProducer::ftmprun0
int ftmprun0
Definition: AlcaBeamSpotProducer.h:41
iEvent
int iEvent
Definition: GenABIO.cc:224
BeamFitter::resetLSRange
void resetLSRange()
Definition: BeamFitter.h:57
edm::LuminosityBlock::put
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: LuminosityBlock.h:115
BeamFitter::resetCutFlow
void resetCutFlow()
Definition: BeamFitter.h:101
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
BeamFitter::setFitLSRange
void setFitLSRange(int ls0, int ls1)
Definition: BeamFitter.h:112
eostools.move
def move(src, dest)
Definition: eostools.py:511
BeamFitter::getFitLSRange
std::pair< int, int > getFitLSRange()
Definition: BeamFitter.h:111
AlcaBeamSpotProducer::runbeamwidthfit_
bool runbeamwidthfit_
Definition: AlcaBeamSpotProducer.h:47
mps_fire.result
result
Definition: mps_fire.py:303
AlcaBeamSpotProducer::runallfitters_
bool runallfitters_
Definition: AlcaBeamSpotProducer.h:48
AlcaBeamSpotProducer::ftmprun
int ftmprun
Definition: AlcaBeamSpotProducer.h:41
BeamFitter::getBSvector
std::vector< BSTrkParameters > getBSvector()
Definition: BeamFitter.h:92
edm::TimeValue_t
unsigned long long TimeValue_t
Definition: Timestamp.h:28