CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) overridefinal
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, const edm::EventSetup &iSetup) overridefinal
 
virtual void endLuminosityBlockProduce (edm::LuminosityBlock &lumiSeg, const edm::EventSetup &iSetup) overridefinal
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) overridefinal
 

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
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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 26 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 35 of file AlcaBeamSpotProducer.cc.

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

35  {
36  // get parameter
37  write2DB_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("WriteToDB");
38  runallfitters_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("RunAllFitters");
39  fitNLumi_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getUntrackedParameter<int>("fitEveryNLumi",-1);
40  resetFitNLumi_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getUntrackedParameter<int>("resetEveryNLumi",-1);
41  runbeamwidthfit_ = iConfig.getParameter<edm::ParameterSet>("AlcaBeamSpotProducerParameters").getParameter<bool>("RunBeamWidthFit");
42 
43  theBeamFitter = new BeamFitter(iConfig, consumesCollector());
49 
50  ftotalevents = 0;
51  ftmprun0 = ftmprun = -1;
52  countLumi_ = 0;
54 
55  produces<reco::BeamSpot, edm::InLumi>("alcaBeamSpot");
56 }
T getParameter(std::string const &) const
tuple BeamFitter
Input track for PrimaryVertex reconstruction, uncomment the following line to use pixelLess tracks pr...
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 ( )

Definition at line 59 of file AlcaBeamSpotProducer.cc.

References theBeamFitter.

59  {
60  delete theBeamFitter;
61 }

Member Function Documentation

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

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

Definition at line 87 of file AlcaBeamSpotProducer.cc.

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

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, theBeamFitter, and edm::Timestamp::value().

91  {
92  const edm::TimeValue_t fendtimestamp = lumiSeg.endTime().value();
93  const std::time_t fendtime = fendtimestamp >> 32;
94  refBStime[1] = fendtime;
95 
96  endLumiOfBSFit_ = lumiSeg.luminosityBlock();
97 
98  if ( fitNLumi_ == -1 && resetFitNLumi_ == -1 ) return;
99 
100  if (fitNLumi_ > 0 && countLumi_%fitNLumi_!=0) return;
101 
105 
106  std::pair<int,int> LSRange = theBeamFitter->getFitLSRange();
107 
108  reco::BeamSpot bs;
110  bs = theBeamFitter->getBeamSpot();
111  edm::LogInfo("AlcaBeamSpotProducer")
112  << "\n RESULTS OF DEFAULT FIT " << std::endl
113  << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl
114  << " for lumi blocks : " << LSRange.first << " - " << LSRange.second << std::endl
115  << " lumi counter # " << countLumi_ << std::endl
116  << bs << std::endl
117  << "fit done. \n" << std::endl;
118  }
119  else { // Fill in empty beam spot if beamfit fails
121  edm::LogInfo("AlcaBeamSpotProducer")
122  << "\n Empty Beam spot fit" << std::endl
123  << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl
124  << " for lumi blocks : " << LSRange.first << " - " << LSRange.second << std::endl
125  << " lumi counter # " << countLumi_ << std::endl
126  << bs << std::endl
127  << "fit failed \n" << std::endl;
128  }
129 
130  std::auto_ptr<reco::BeamSpot> result(new reco::BeamSpot);
131  *result = bs;
132  lumiSeg.put(result, std::string("alcaBeamSpot"));
133 
134  if (resetFitNLumi_ > 0 && countLumi_%resetFitNLumi_ == 0) {
135  std::vector<BSTrkParameters> theBSvector = theBeamFitter->getBSvector();
136  edm::LogInfo("AlcaBeamSpotProducer")
137  << "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:397
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
Timestamp const & endTime() const
tuple result
Definition: query.py:137
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
void put(std::auto_ptr< PROD > product)
Put a new product.
void resetRefTime()
Definition: BeamFitter.h:56
void AlcaBeamSpotProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
finaloverrideprivatevirtual

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.

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

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

Member Data Documentation

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

Definition at line 41 of file AlcaBeamSpotProducer.h.

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

Definition at line 45 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and endLuminosityBlockProduce().

int AlcaBeamSpotProducer::fitNLumi_
private

Definition at line 39 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and endLuminosityBlockProduce().

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

Definition at line 38 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and produce().

double AlcaBeamSpotProducer::inputBeamWidth_
private

Definition at line 51 of file AlcaBeamSpotProducer.h.

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

Definition at line 46 of file AlcaBeamSpotProducer.h.

Referenced by beginLuminosityBlock(), and endLuminosityBlockProduce().

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

Definition at line 50 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().

bool AlcaBeamSpotProducer::runbeamwidthfit_
private

Definition at line 49 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().

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

Definition at line 48 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().