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
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, 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)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

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 33 of file AlcaBeamSpotProducer.cc.

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_.

33  {
34  // get parameter
35  write2DB_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("WriteToDB");
37  iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("RunAllFitters");
38  fitNLumi_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters")
39  .getUntrackedParameter<int>("fitEveryNLumi", -1);
40  resetFitNLumi_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters")
41  .getUntrackedParameter<int>("resetEveryNLumi", -1);
43  iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("RunBeamWidthFit");
44 
45  theBeamFitter = new BeamFitter(iConfig, consumesCollector());
51 
52  ftotalevents = 0;
53  ftmprun0 = ftmprun = -1;
54  countLumi_ = 0;
56 
57  produces<reco::BeamSpot, edm::Transition::EndLuminosityBlock>("alcaBeamSpot");
58 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void resetTrkVector()
Definition: BeamFitter.h:58
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void resetLSRange()
Definition: BeamFitter.h:60
void resetPVFitter()
Definition: BeamFitter.h:72
void resetCutFlow()
Definition: BeamFitter.h:104
void resetRefTime()
Definition: BeamFitter.h:61

◆ ~AlcaBeamSpotProducer()

AlcaBeamSpotProducer::~AlcaBeamSpotProducer ( )
override

Definition at line 61 of file AlcaBeamSpotProducer.cc.

References theBeamFitter.

61 { delete theBeamFitter; }

Member Function Documentation

◆ beginLuminosityBlock()

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

Definition at line 71 of file AlcaBeamSpotProducer.cc.

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

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

◆ endLuminosityBlock()

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

Definition at line 86 of file AlcaBeamSpotProducer.cc.

86 {}

◆ endLuminosityBlockProduce()

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

Definition at line 89 of file AlcaBeamSpotProducer.cc.

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

89  {
90  const edm::TimeValue_t fendtimestamp = lumiSeg.endTime().value();
91  const std::time_t fendtime = fendtimestamp >> 32;
92  refBStime[1] = fendtime;
93 
94  endLumiOfBSFit_ = lumiSeg.luminosityBlock();
95 
96  if (fitNLumi_ == -1 && resetFitNLumi_ == -1)
97  return;
98 
99  if (fitNLumi_ > 0 && countLumi_ % fitNLumi_ != 0)
100  return;
101 
105 
106  std::pair<int, int> LSRange = theBeamFitter->getFitLSRange();
107 
111  edm::LogInfo("AlcaBeamSpotProducer") << "\n RESULTS OF DEFAULT FIT " << std::endl
112  << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl
113  << " for lumi blocks : " << LSRange.first << " - " << LSRange.second
114  << std::endl
115  << " lumi counter # " << countLumi_ << std::endl
116  << bs << std::endl
117  << "fit done. \n"
118  << std::endl;
119  } else { // Fill in empty beam spot if beamfit fails
120  bs.setType(reco::BeamSpot::Fake);
121  edm::LogInfo("AlcaBeamSpotProducer") << "\n Empty Beam spot fit" << std::endl
122  << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl
123  << " for lumi blocks : " << LSRange.first << " - " << LSRange.second
124  << std::endl
125  << " lumi counter # " << countLumi_ << std::endl
126  << bs << std::endl
127  << "fit failed \n"
128  << std::endl;
129  }
130 
131  auto result = std::make_unique<reco::BeamSpot>();
132  *result = bs;
133  lumiSeg.put(std::move(result), std::string("alcaBeamSpot"));
134 
135  if (resetFitNLumi_ > 0 && countLumi_ % resetFitNLumi_ == 0) {
136  std::vector<BSTrkParameters> theBSvector = theBeamFitter->getBSvector();
137  edm::LogInfo("AlcaBeamSpotProducer") << "Total number of tracks accumulated = " << theBSvector.size() << std::endl
138  << "Reset track collection for beam fit" << std::endl;
144  countLumi_ = 0;
145  }
146 }
bool runPVandTrkFitter()
Definition: BeamFitter.cc:449
void setRun(int run)
Definition: BeamFitter.h:119
std::vector< BSTrkParameters > getBSvector()
Definition: BeamFitter.h:95
void resetTrkVector()
Definition: BeamFitter.h:58
void put(std::unique_ptr< PROD > product)
Put a new product.
void setFitLSRange(int ls0, int ls1)
Definition: BeamFitter.h:115
void resetLSRange()
Definition: BeamFitter.h:60
unsigned long long TimeValue_t
Definition: Timestamp.h:21
Log< level::Info, false > LogInfo
TimeValue_t value() const
Definition: Timestamp.h:38
Timestamp const & endTime() const
void resetPVFitter()
Definition: BeamFitter.h:72
void resetCutFlow()
Definition: BeamFitter.h:104
std::pair< int, int > getFitLSRange()
Definition: BeamFitter.h:114
void setRefTime(time_t t0, time_t t1)
Definition: BeamFitter.h:62
LuminosityBlockNumber_t luminosityBlock() const
reco::BeamSpot getBeamSpot()
Definition: BeamFitter.h:93
def move(src, dest)
Definition: eostools.py:511
void resetRefTime()
Definition: BeamFitter.h:61

◆ produce()

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

Implements edm::one::EDProducerBase.

Definition at line 64 of file AlcaBeamSpotProducer.cc.

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

64  {
65  ftotalevents++;
67  ftmprun = iEvent.id().run();
68 }
void readEvent(const edm::Event &iEvent)
Definition: BeamFitter.cc:261
int iEvent
Definition: GenABIO.cc:224

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