CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
BeamSpotWrite2DB Class Reference

#include <BeamSpotWrite2DB.h>

Inheritance diagram for BeamSpotWrite2DB:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 BeamSpotWrite2DB (const edm::ParameterSet &)
 
 ~BeamSpotWrite2DB () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

std::ifstream fasciiFile
 
std::string fasciiFileName
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description


class: BeamSpotWrite2DB.h package: RecoVertex/BeamSpotProducer

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


Definition at line 30 of file BeamSpotWrite2DB.h.

Constructor & Destructor Documentation

◆ BeamSpotWrite2DB()

BeamSpotWrite2DB::BeamSpotWrite2DB ( const edm::ParameterSet iConfig)
explicit

class: BeamSpotWrite2DB.cc package: RecoVertex/BeamSpotProducer

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


Definition at line 26 of file BeamSpotWrite2DB.cc.

26  {
27  fasciiFileName = iConfig.getUntrackedParameter<std::string>("OutputFileName");
28 
29  fasciiFile.open(fasciiFileName.c_str());
30 }

References fasciiFile, fasciiFileName, edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~BeamSpotWrite2DB()

BeamSpotWrite2DB::~BeamSpotWrite2DB ( )
override

Definition at line 32 of file BeamSpotWrite2DB.cc.

32 {}

Member Function Documentation

◆ analyze()

void BeamSpotWrite2DB::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 34 of file BeamSpotWrite2DB.cc.

34 {}

◆ beginJob()

void BeamSpotWrite2DB::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 36 of file BeamSpotWrite2DB.cc.

36 {}

◆ endJob()

void BeamSpotWrite2DB::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 38 of file BeamSpotWrite2DB.cc.

38  {
39  std::cout << " Read beam spot data from text file: " << fasciiFileName << std::endl;
40  std::cout << " please see plugins/BeamSpotWrite2DB.cc for format of text file." << std::endl;
41  /*
42  std::cout << " Content of the file is expected to have this format with the first column as a keyword:" << std::endl;
43  std::cout << " x\n y\n z\n sigmaZ\n dxdz\n dydz\n beamWidthX\n beamWidthY" << std::endl;
44  for (int i =0; i<7; i++) {
45  for (int j=0; j<7; j++ ) {
46 
47  std::cout << " cov["<<i<<"]["<<j<<"] cov["<<i<<"]["<<j<<"] cov["<<i<<"]["<<j<<"] cov["<<i<<"]["<<j<<"] cov["<<i<<"]["<<j<<"] cov["<<j<<"]["<<j<<"] cov["<<i<<"]["<<j<<"]" << std::endl;
48  }
49  }
50  */
51 
52  // extract from file
53  double x, y, z, sigmaZ, dxdz, dydz, beamWidthX, beamWidthY, emittanceX, emittanceY, betastar;
55  double cov[7][7];
56  int type;
57 
58  fasciiFile >> tag >> type;
59  fasciiFile >> tag >> x;
60  fasciiFile >> tag >> y;
61  fasciiFile >> tag >> z;
62  fasciiFile >> tag >> sigmaZ;
63  fasciiFile >> tag >> dxdz;
64  fasciiFile >> tag >> dydz;
65  fasciiFile >> tag >> beamWidthX;
66  fasciiFile >> tag >> beamWidthY;
67  fasciiFile >> tag >> cov[0][0] >> cov[0][1] >> cov[0][2] >> cov[0][3] >> cov[0][4] >> cov[0][5] >> cov[0][6];
68  fasciiFile >> tag >> cov[1][0] >> cov[1][1] >> cov[1][2] >> cov[1][3] >> cov[1][4] >> cov[1][5] >> cov[1][6];
69  fasciiFile >> tag >> cov[2][0] >> cov[2][1] >> cov[2][2] >> cov[2][3] >> cov[2][4] >> cov[2][5] >> cov[2][6];
70  fasciiFile >> tag >> cov[3][0] >> cov[3][1] >> cov[3][2] >> cov[3][3] >> cov[3][4] >> cov[3][5] >> cov[3][6];
71  fasciiFile >> tag >> cov[4][0] >> cov[4][1] >> cov[4][2] >> cov[4][3] >> cov[4][4] >> cov[4][5] >> cov[4][6];
72  fasciiFile >> tag >> cov[5][0] >> cov[5][1] >> cov[5][2] >> cov[5][3] >> cov[5][4] >> cov[5][5] >> cov[5][6];
73  fasciiFile >> tag >> cov[6][0] >> cov[6][1] >> cov[6][2] >> cov[6][3] >> cov[6][4] >> cov[6][5] >> cov[6][6];
76  fasciiFile >> tag >> betastar;
77 
78  BeamSpotObjects* abeam = new BeamSpotObjects();
79 
80  abeam->SetType(type);
81  abeam->SetPosition(x, y, z);
82  abeam->SetSigmaZ(sigmaZ);
83  abeam->Setdxdz(dxdz);
84  abeam->Setdydz(dydz);
85  abeam->SetBeamWidthX(beamWidthX);
86  abeam->SetBeamWidthY(beamWidthY);
87  abeam->SetEmittanceX(emittanceX);
88  abeam->SetEmittanceY(emittanceY);
89  abeam->SetBetaStar(betastar);
90 
91  for (int i = 0; i < 7; ++i) {
92  for (int j = 0; j < 7; ++j) {
93  abeam->SetCovariance(i, j, cov[i][j]);
94  }
95  }
96 
97  std::cout << " write results to DB..." << std::endl;
98 
100  if (poolDbService.isAvailable()) {
101  std::cout << "poolDBService available" << std::endl;
102  if (poolDbService->isNewTagRequest("BeamSpotObjectsRcd")) {
103  std::cout << "new tag requested" << std::endl;
104  poolDbService->createNewIOV<BeamSpotObjects>(
105  abeam, poolDbService->beginOfTime(), poolDbService->endOfTime(), "BeamSpotObjectsRcd");
106  } else {
107  std::cout << "no new tag requested" << std::endl;
108  poolDbService->appendSinceTime<BeamSpotObjects>(abeam, poolDbService->currentTime(), "BeamSpotObjectsRcd");
109  }
110  }
111 
112  std::cout << "[BeamSpotWrite2DB] endJob done \n" << std::endl;
113 }

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), BeamSpotFakeParameters_cfi::dxdz, BeamSpotFakeParameters_cfi::dydz, BeamSpotFakeParameters_cfi::emittanceX, BeamSpotFakeParameters_cfi::emittanceY, cond::service::PoolDBOutputService::endOfTime(), fasciiFile, fasciiFileName, mps_fire::i, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), dqmiolumiharvest::j, BeamSpotObjects::SetBeamWidthX(), BeamSpotObjects::SetBeamWidthY(), BeamSpotObjects::SetBetaStar(), BeamSpotObjects::SetCovariance(), BeamSpotObjects::Setdxdz(), BeamSpotObjects::Setdydz(), BeamSpotObjects::SetEmittanceX(), BeamSpotObjects::SetEmittanceY(), BeamSpotObjects::SetPosition(), BeamSpotObjects::SetSigmaZ(), BeamSpotObjects::SetType(), fftjetvertexadder_cfi::sigmaZ, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, x, y, and z.

Member Data Documentation

◆ fasciiFile

std::ifstream BeamSpotWrite2DB::fasciiFile
private

Definition at line 40 of file BeamSpotWrite2DB.h.

Referenced by BeamSpotWrite2DB(), and endJob().

◆ fasciiFileName

std::string BeamSpotWrite2DB::fasciiFileName
private

Definition at line 41 of file BeamSpotWrite2DB.h.

Referenced by BeamSpotWrite2DB(), and endJob().

DDAxes::y
BeamSpotFakeParameters_cfi.dxdz
dxdz
Definition: BeamSpotFakeParameters_cfi.py:12
mps_fire.i
i
Definition: mps_fire.py:355
BeamSpotObjects::SetBetaStar
void SetBetaStar(double val)
set beta star
Definition: BeamSpotObjects.h:64
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:187
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cond::service::PoolDBOutputService::appendSinceTime
void appendSinceTime(const T *payloadObj, cond::Time_t sinceTime, const std::string &recordName)
Definition: PoolDBOutputService.h:135
BeamSpotObjects::SetBeamWidthY
void SetBeamWidthY(double val)
set average transverse beam width Y
Definition: BeamSpotObjects.h:50
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDAxes::x
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
BeamSpotObjects::SetSigmaZ
void SetSigmaZ(double val)
set sigma Z, RMS bunch length
Definition: BeamSpotObjects.h:42
BeamSpotFakeParameters_cfi.emittanceX
emittanceX
Definition: BeamSpotFakeParameters_cfi.py:17
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:110
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
BeamSpotWrite2DB::fasciiFile
std::ifstream fasciiFile
Definition: BeamSpotWrite2DB.h:40
DDAxes::z
BeamSpotObjects::SetEmittanceY
void SetEmittanceY(double val)
set emittance
Definition: BeamSpotObjects.h:62
BeamSpotFakeParameters_cfi.emittanceY
emittanceY
Definition: BeamSpotFakeParameters_cfi.py:18
BeamSpotObjects::SetPosition
void SetPosition(double x, double y, double z)
set XYZ position
Definition: BeamSpotObjects.h:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BeamSpotObjects::SetType
void SetType(int type)
set beam type
Definition: BeamSpotObjects.h:58
BeamSpotObjects::SetEmittanceX
void SetEmittanceX(double val)
set emittance
Definition: BeamSpotObjects.h:60
BeamSpotObjects::SetCovariance
void SetCovariance(int i, int j, double val)
set i,j element of the full covariance matrix 7x7
Definition: BeamSpotObjects.h:56
edm::Service< cond::service::PoolDBOutputService >
BeamSpotObjects
Definition: BeamSpotObjects.h:20
BeamSpotObjects::Setdxdz
void Setdxdz(double val)
set dxdz slope, crossing angle
Definition: BeamSpotObjects.h:44
BeamSpotFakeParameters_cfi.dydz
dydz
Definition: BeamSpotFakeParameters_cfi.py:13
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:185
BeamSpotWrite2DB::fasciiFileName
std::string fasciiFileName
Definition: BeamSpotWrite2DB.h:41
type
type
Definition: HCALResponse.h:21
BeamSpotObjects::SetBeamWidthX
void SetBeamWidthX(double val)
set average transverse beam width X
Definition: BeamSpotObjects.h:48
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:100
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
fftjetvertexadder_cfi.sigmaZ
sigmaZ
Definition: fftjetvertexadder_cfi.py:32
BeamSpotObjects::Setdydz
void Setdydz(double val)
set dydz slope, crossing angle in XZ
Definition: BeamSpotObjects.h:46
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:189