CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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)
 
 ~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
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
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< B > consumes (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 () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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 ( 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 }
void resetTrkVector()
Definition: BeamFitter.h:58
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void resetLSRange()
Definition: BeamFitter.h:60
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void resetPVFitter()
Definition: BeamFitter.h:72
void resetCutFlow()
Definition: BeamFitter.h:104
void resetRefTime()
Definition: BeamFitter.h:61
AlcaBeamSpotProducer::~AlcaBeamSpotProducer ( )
override

Definition at line 61 of file AlcaBeamSpotProducer.cc.

References theBeamFitter.

61 { delete theBeamFitter; }

Member Function Documentation

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:28
void AlcaBeamSpotProducer::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
const edm::EventSetup iSetup 
)
finalprivate

Definition at line 86 of file AlcaBeamSpotProducer.cc.

86 {}
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(), reco::BeamSpot::setType(), 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 
110  bs = theBeamFitter->getBeamSpot();
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
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
tuple result
Definition: mps_fire.py:311
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:124
LuminosityBlockNumber_t luminosityBlock() const
void put(std::unique_ptr< PROD > product)
Put a new product.
Timestamp const & endTime() const
def move
Definition: eostools.py:511
void setFitLSRange(int ls0, int ls1)
Definition: BeamFitter.h:115
void resetLSRange()
Definition: BeamFitter.h:60
unsigned long long TimeValue_t
Definition: Timestamp.h:28
Log< level::Info, false > LogInfo
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
TimeValue_t value() const
Definition: Timestamp.h:45
reco::BeamSpot getBeamSpot()
Definition: BeamFitter.h:93
void resetRefTime()
Definition: BeamFitter.h:61
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, edm::EventBase::id(), BeamFitter::readEvent(), edm::EventID::run(), and theBeamFitter.

64  {
65  ftotalevents++;
66  theBeamFitter->readEvent(iEvent);
67  ftmprun = iEvent.id().run();
68 }
RunNumber_t run() const
Definition: EventID.h:38
void readEvent(const edm::Event &iEvent)
Definition: BeamFitter.cc:261
edm::EventID id() const
Definition: EventBase.h:59

Member Data Documentation

int AlcaBeamSpotProducer::beginLumiOfBSFit_
private
int AlcaBeamSpotProducer::countEvt_
private

Definition at line 39 of file AlcaBeamSpotProducer.h.

int AlcaBeamSpotProducer::countLumi_
private
int AlcaBeamSpotProducer::endLumiOfBSFit_
private

Definition at line 43 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and endLuminosityBlockProduce().

int AlcaBeamSpotProducer::fitNLumi_
private

Definition at line 37 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and endLuminosityBlockProduce().

int AlcaBeamSpotProducer::ftmprun
private
int AlcaBeamSpotProducer::ftmprun0
private
int AlcaBeamSpotProducer::ftotalevents
private

Definition at line 36 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and produce().

double AlcaBeamSpotProducer::inputBeamWidth_
private

Definition at line 49 of file AlcaBeamSpotProducer.h.

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

Definition at line 44 of file AlcaBeamSpotProducer.h.

Referenced by beginLuminosityBlock(), and endLuminosityBlockProduce().

int AlcaBeamSpotProducer::resetFitNLumi_
private
bool AlcaBeamSpotProducer::runallfitters_
private

Definition at line 48 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().

bool AlcaBeamSpotProducer::runbeamwidthfit_
private

Definition at line 47 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().

BeamFitter* AlcaBeamSpotProducer::theBeamFitter
private
bool AlcaBeamSpotProducer::write2DB_
private

Definition at line 46 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().