CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
BeamSpotFakeConditions Class Reference
Inheritance diagram for BeamSpotFakeConditions:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Public Types

typedef std::unique_ptr< BeamSpotObjectsReturnType
 

Public Member Functions

 BeamSpotFakeConditions (const edm::ParameterSet &params)
 
ReturnType produce (const BeamSpotObjectsRcd &record)
 
 ~BeamSpotFakeConditions () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const EventSetupRecordIntervalFinderoperator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Private Member Functions

void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &key, const edm::IOVSyncValue &syncValue, edm::ValidityInterval &oValidity) override
 

Private Attributes

double beamWidthX
 
double beamWidthY
 
double betastar
 
double cov [7][7]
 
double dxdz
 
double dydz
 
double emittanceX
 
double emittanceY
 
bool getDataFromFile_
 
edm::FileInPath inputFilename_
 
double sigmaZ
 
std::string tag
 
int type
 
double x
 
double y
 
double z
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- Protected Member Functions inherited from edm::ESProducer
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProductResolverFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Detailed Description

Definition at line 25 of file BeamSpotFakeConditions.cc.

Member Typedef Documentation

◆ ReturnType

Definition at line 27 of file BeamSpotFakeConditions.cc.

Constructor & Destructor Documentation

◆ BeamSpotFakeConditions()

BeamSpotFakeConditions::BeamSpotFakeConditions ( const edm::ParameterSet params)

Definition at line 44 of file BeamSpotFakeConditions.cc.

References beamWidthX, beamWidthY, betastar, cov, dxdz, dydz, emittanceX, emittanceY, edm::FileInPath::fullPath(), getDataFromFile_, mps_fire::i, inputFilename_, dqmiolumiharvest::j, submitPVValidationJobs::params, funct::pow(), edm::ESProducer::setWhatProduced(), sigmaZ, tag, type, x, y, and z.

44  {
45  setWhatProduced(this);
46  findingRecord<BeamSpotObjectsRcd>();
47  getDataFromFile_ = params.getParameter<bool>("getDataFromFile");
48  if (getDataFromFile_) {
49  inputFilename_ = params.getParameter<edm::FileInPath>("InputFilename");
50  std::ifstream fasciiFile(inputFilename_.fullPath().c_str());
51  fasciiFile >> tag >> type;
52  fasciiFile >> tag >> x;
53  fasciiFile >> tag >> y;
54  fasciiFile >> tag >> z;
55  fasciiFile >> tag >> sigmaZ;
56  fasciiFile >> tag >> dxdz;
57  fasciiFile >> tag >> dydz;
58  fasciiFile >> tag >> beamWidthX;
59  fasciiFile >> tag >> beamWidthY;
60  fasciiFile >> tag >> cov[0][0] >> cov[0][1] >> cov[0][2] >> cov[0][3] >> cov[0][4] >> cov[0][5] >> cov[0][6];
61  fasciiFile >> tag >> cov[1][0] >> cov[1][1] >> cov[1][2] >> cov[1][3] >> cov[1][4] >> cov[1][5] >> cov[1][6];
62  fasciiFile >> tag >> cov[2][0] >> cov[2][1] >> cov[2][2] >> cov[2][3] >> cov[2][4] >> cov[2][5] >> cov[2][6];
63  fasciiFile >> tag >> cov[3][0] >> cov[3][1] >> cov[3][2] >> cov[3][3] >> cov[3][4] >> cov[3][5] >> cov[3][6];
64  fasciiFile >> tag >> cov[4][0] >> cov[4][1] >> cov[4][2] >> cov[4][3] >> cov[4][4] >> cov[4][5] >> cov[4][6];
65  fasciiFile >> tag >> cov[5][0] >> cov[5][1] >> cov[5][2] >> cov[5][3] >> cov[5][4] >> cov[5][5] >> cov[5][6];
66  fasciiFile >> tag >> cov[6][0] >> cov[6][1] >> cov[6][2] >> cov[6][3] >> cov[6][4] >> cov[6][5] >> cov[6][6];
67  fasciiFile >> tag >> emittanceX;
68  fasciiFile >> tag >> emittanceY;
69  fasciiFile >> tag >> betastar;
70 
71  }
72  // input values by hand
73  else {
74  x = params.getParameter<double>("X0");
75  y = params.getParameter<double>("Y0");
76  z = params.getParameter<double>("Z0");
77  dxdz = params.getParameter<double>("dxdz");
78  dydz = params.getParameter<double>("dydz");
79  sigmaZ = params.getParameter<double>("sigmaZ");
80  beamWidthX = params.getParameter<double>("widthX");
81  beamWidthY = params.getParameter<double>("widthY");
82  emittanceX = params.getParameter<double>("emittanceX");
83  emittanceY = params.getParameter<double>("emittanceY");
84  betastar = params.getParameter<double>("betaStar");
85 
86  // first set all elements (esp. off-diagonal elements to zero)
87  for (int i = 0; i < 7; i++) {
88  for (int j = 0; j < 7; j++)
89  cov[i][j] = 0.0;
90  }
91 
92  // we ignore correlations when values are given by hand
93  cov[0][0] = pow(params.getParameter<double>("errorX0"), 2);
94  cov[1][1] = pow(params.getParameter<double>("errorY0"), 2);
95  cov[2][2] = pow(params.getParameter<double>("errorZ0"), 2);
96  cov[3][3] = pow(params.getParameter<double>("errorSigmaZ"), 2);
97  cov[4][4] = pow(params.getParameter<double>("errordxdz"), 2);
98  cov[5][5] = pow(params.getParameter<double>("errordydz"), 2);
99  cov[6][6] = pow(params.getParameter<double>("errorWidth"), 2);
100  }
101 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
const std::string & fullPath() const
Definition: FileInPath.cc:144
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ ~BeamSpotFakeConditions()

BeamSpotFakeConditions::~BeamSpotFakeConditions ( )
override

Definition at line 103 of file BeamSpotFakeConditions.cc.

103 {}

Member Function Documentation

◆ produce()

BeamSpotFakeConditions::ReturnType BeamSpotFakeConditions::produce ( const BeamSpotObjectsRcd record)

Definition at line 105 of file BeamSpotFakeConditions.cc.

References beamWidthX, beamWidthY, betastar, cov, dxdz, dydz, emittanceX, emittanceY, mps_fire::i, dqmiolumiharvest::j, sigmaZ, x, y, and z.

105  {
106  ReturnType adummy = std::make_unique<BeamSpotObjects>();
107 
108  adummy->setPosition(x, y, z);
109  adummy->setSigmaZ(sigmaZ);
110  adummy->setdxdz(dxdz);
111  adummy->setdydz(dydz);
112  adummy->setBeamWidthX(beamWidthX);
113  adummy->setBeamWidthY(beamWidthY);
114  for (int i = 0; i < 7; i++) {
115  for (int j = 0; j < 7; j++) {
116  adummy->setCovariance(i, j, cov[i][j]);
117  }
118  }
119  adummy->setEmittanceX(emittanceX);
120  adummy->setEmittanceY(emittanceY);
121  adummy->setBetaStar(betastar);
122 
123  return adummy;
124 }
std::unique_ptr< BeamSpotObjects > ReturnType

◆ setIntervalFor()

void BeamSpotFakeConditions::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue syncValue,
edm::ValidityInterval oValidity 
)
overrideprivatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 126 of file BeamSpotFakeConditions.cc.

References edm::IOVSyncValue::beginOfTime(), and edm::IOVSyncValue::endOfTime().

128  {
130 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88

Member Data Documentation

◆ beamWidthX

double BeamSpotFakeConditions::beamWidthX
private

◆ beamWidthY

double BeamSpotFakeConditions::beamWidthY
private

◆ betastar

double BeamSpotFakeConditions::betastar
private

◆ cov

double BeamSpotFakeConditions::cov[7][7]
private

Definition at line 40 of file BeamSpotFakeConditions.cc.

Referenced by BeamSpotFakeConditions(), and produce().

◆ dxdz

double BeamSpotFakeConditions::dxdz
private

◆ dydz

double BeamSpotFakeConditions::dydz
private

◆ emittanceX

double BeamSpotFakeConditions::emittanceX
private

Definition at line 38 of file BeamSpotFakeConditions.cc.

Referenced by BeamSpotFakeConditions(), and produce().

◆ emittanceY

double BeamSpotFakeConditions::emittanceY
private

Definition at line 38 of file BeamSpotFakeConditions.cc.

Referenced by BeamSpotFakeConditions(), and produce().

◆ getDataFromFile_

bool BeamSpotFakeConditions::getDataFromFile_
private

Definition at line 37 of file BeamSpotFakeConditions.cc.

Referenced by BeamSpotFakeConditions().

◆ inputFilename_

edm::FileInPath BeamSpotFakeConditions::inputFilename_
private

Definition at line 36 of file BeamSpotFakeConditions.cc.

Referenced by BeamSpotFakeConditions().

◆ sigmaZ

double BeamSpotFakeConditions::sigmaZ
private

◆ tag

std::string BeamSpotFakeConditions::tag
private

◆ type

int BeamSpotFakeConditions::type
private

Definition at line 41 of file BeamSpotFakeConditions.cc.

Referenced by BeamSpotFakeConditions().

◆ x

double BeamSpotFakeConditions::x
private

◆ y

double BeamSpotFakeConditions::y
private

◆ z

double BeamSpotFakeConditions::z
private