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::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 AlcaBeamSpotProducer (const edm::ParameterSet &)
 
 ~AlcaBeamSpotProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

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

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::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description


class: AlcaBeamSpotProducer.h package: Calibration/TkAlCaRecoProducers

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

version

Id:
AlcaBeamSpotProducer.h,v 1.1 2010/05/28 19:51:47 uplegger Exp

Definition at line 27 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)

version

Id:
AlcaBeamSpotProducer.cc,v 1.2 2010/07/20 02:58:20 wmtan Exp

Definition at line 35 of file AlcaBeamSpotProducer.cc.

References beginLumiOfBSFit_, 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);
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
void resetTrkVector()
Definition: BeamFitter.h:48
void resetLSRange()
Definition: BeamFitter.h:50
void resetPVFitter()
Definition: BeamFitter.h:64
void resetCutFlow()
Definition: BeamFitter.h:100
void resetRefTime()
Definition: BeamFitter.h:51
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 lumiSeg,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDProducer.

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;
79  refBStime[0] = ftmptime;
80  }
81 
82  countLumi_++;
83 
84 }
Timestamp const & beginTime() const
LuminosityBlockNumber_t luminosityBlock() const
RunNumber_t run() const
unsigned long long TimeValue_t
Definition: Timestamp.h:27
TimeValue_t value() const
Definition: Timestamp.cc:72
void AlcaBeamSpotProducer::endLuminosityBlock ( edm::LuminosityBlock lumiSeg,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDProducer.

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

87  {
88  const edm::TimeValue_t fendtimestamp = lumiSeg.endTime().value();
89  const std::time_t fendtime = fendtimestamp >> 32;
90  refBStime[1] = fendtime;
91 
92  endLumiOfBSFit_ = lumiSeg.luminosityBlock();
93 
94  if ( fitNLumi_ == -1 && resetFitNLumi_ == -1 ) return;
95 
96  if (fitNLumi_ > 0 && countLumi_%fitNLumi_!=0) return;
97 
101 
102  std::pair<int,int> LSRange = theBeamFitter->getFitLSRange();
103 
104  reco::BeamSpot bs;
106  bs = theBeamFitter->getBeamSpot();
107  edm::LogInfo("AlcaBeamSpotProducer")
108  << "\n RESULTS OF DEFAULT FIT " << std::endl
109  << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl
110  << " for lumi blocks : " << LSRange.first << " - " << LSRange.second << std::endl
111  << " lumi counter # " << countLumi_ << std::endl
112  << bs << std::endl
113  << "fit done. \n" << std::endl;
114  }
115  else { // Fill in empty beam spot if beamfit fails
117  edm::LogInfo("AlcaBeamSpotProducer")
118  << "\n Empty Beam spot fit" << std::endl
119  << " for runs: " << ftmprun0 << " - " << ftmprun << std::endl
120  << " for lumi blocks : " << LSRange.first << " - " << LSRange.second << std::endl
121  << " lumi counter # " << countLumi_ << std::endl
122  << bs << std::endl
123  << "fit failed \n" << std::endl;
124  }
125 
126  std::auto_ptr<reco::BeamSpot> result(new reco::BeamSpot);
127  *result = bs;
128  lumiSeg.put(result, std::string("alcaBeamSpot"));
129 
130  if (resetFitNLumi_ > 0 && countLumi_%resetFitNLumi_ == 0) {
131  std::vector<BSTrkParameters> theBSvector = theBeamFitter->getBSvector();
132  edm::LogInfo("AlcaBeamSpotProducer")
133  << "Total number of tracks accumulated = " << theBSvector.size() << std::endl
134  << "Reset track collection for beam fit" <<std::endl;
140  countLumi_=0;
141  }
142 }
bool runPVandTrkFitter()
Definition: BeamFitter.cc:409
void setRun(int run)
Definition: BeamFitter.h:119
std::vector< BSTrkParameters > getBSvector()
Definition: BeamFitter.h:91
void resetTrkVector()
Definition: BeamFitter.h:48
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:132
LuminosityBlockNumber_t luminosityBlock() const
Timestamp const & endTime() const
tuple result
Definition: query.py:137
void setFitLSRange(int ls0, int ls1)
Definition: BeamFitter.h:115
void resetLSRange()
Definition: BeamFitter.h:50
unsigned long long TimeValue_t
Definition: Timestamp.h:27
TimeValue_t value() const
Definition: Timestamp.cc:72
void resetPVFitter()
Definition: BeamFitter.h:64
void resetCutFlow()
Definition: BeamFitter.h:100
void setRefTime(time_t t0, time_t t1)
Definition: BeamFitter.h:52
std::pair< int, int > getFitLSRange()
Definition: BeamFitter.h:112
reco::BeamSpot getBeamSpot()
Definition: BeamFitter.h:89
void put(std::auto_ptr< PROD > product)
Put a new product.
void resetRefTime()
Definition: BeamFitter.h:51
void AlcaBeamSpotProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 64 of file AlcaBeamSpotProducer.cc.

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

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

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

Member Data Documentation

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

Definition at line 40 of file AlcaBeamSpotProducer.h.

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

Definition at line 44 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and endLuminosityBlock().

int AlcaBeamSpotProducer::fitNLumi_
private

Definition at line 38 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and endLuminosityBlock().

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

Definition at line 37 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer(), and produce().

double AlcaBeamSpotProducer::inputBeamWidth_
private

Definition at line 50 of file AlcaBeamSpotProducer.h.

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

Definition at line 45 of file AlcaBeamSpotProducer.h.

Referenced by beginLuminosityBlock(), and endLuminosityBlock().

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

Definition at line 49 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().

bool AlcaBeamSpotProducer::runbeamwidthfit_
private

Definition at line 48 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().

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

Definition at line 47 of file AlcaBeamSpotProducer.h.

Referenced by AlcaBeamSpotProducer().