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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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
 
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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

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

References d0_phi_analyzer_cff::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_.

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 }
T getParameter(std::string const &) const
void resetTrkVector()
Definition: BeamFitter.h:53
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void resetLSRange()
Definition: BeamFitter.h:55
void resetPVFitter()
Definition: BeamFitter.h:69
void resetCutFlow()
Definition: BeamFitter.h:105
void resetRefTime()
Definition: BeamFitter.h:56
AlcaBeamSpotProducer::~AlcaBeamSpotProducer ( )
override

Definition at line 62 of file AlcaBeamSpotProducer.cc.

References theBeamFitter.

62 { delete theBeamFitter; }

Member Function Documentation

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

Definition at line 72 of file AlcaBeamSpotProducer.cc.

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

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 }
unsigned long long TimeValue_t
Definition: Timestamp.h:28
void AlcaBeamSpotProducer::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
const edm::EventSetup iSetup 
)
finalprivate

Definition at line 87 of file AlcaBeamSpotProducer.cc.

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

Definition at line 90 of file AlcaBeamSpotProducer.cc.

References beginLumiOfBSFit_, countLumi_, DEFINE_FWK_MODULE, 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().

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 
109  reco::BeamSpot bs;
111  bs = theBeamFitter->getBeamSpot();
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
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 }
bool runPVandTrkFitter()
Definition: BeamFitter.cc:398
void setRun(int run)
Definition: BeamFitter.h:124
std::vector< BSTrkParameters > getBSvector()
Definition: BeamFitter.h:96
void resetTrkVector()
Definition: BeamFitter.h:53
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:131
LuminosityBlockNumber_t luminosityBlock() const
void put(std::unique_ptr< PROD > product)
Put a new product.
Timestamp const & endTime() const
void setFitLSRange(int ls0, int ls1)
Definition: BeamFitter.h:120
void resetLSRange()
Definition: BeamFitter.h:55
unsigned long long TimeValue_t
Definition: Timestamp.h:28
void resetPVFitter()
Definition: BeamFitter.h:69
void resetCutFlow()
Definition: BeamFitter.h:105
void setRefTime(time_t t0, time_t t1)
Definition: BeamFitter.h:57
std::pair< int, int > getFitLSRange()
Definition: BeamFitter.h:117
TimeValue_t value() const
Definition: Timestamp.h:56
reco::BeamSpot getBeamSpot()
Definition: BeamFitter.h:94
def move(src, dest)
Definition: eostools.py:511
void resetRefTime()
Definition: BeamFitter.h:56
void AlcaBeamSpotProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
finalprivate

Definition at line 65 of file AlcaBeamSpotProducer.cc.

References ftmprun, ftotalevents, edm::EventBase::id(), BeamFitter::readEvent(), edm::EventID::run(), and theBeamFitter.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

65  {
66  ftotalevents++;
67  theBeamFitter->readEvent(iEvent);
68  ftmprun = iEvent.id().run();
69 }
RunNumber_t run() const
Definition: EventID.h:39
void readEvent(const edm::Event &iEvent)
Definition: BeamFitter.cc:216
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().