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 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 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
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: 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 ( 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.

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

26  {
27  fasciiFileName = iConfig.getUntrackedParameter<std::string>("OutputFileName");
28 
29  fasciiFile.open(fasciiFileName.c_str());
30 }
T getUntrackedParameter(std::string const &, T const &) const
std::ifstream fasciiFile
std::string fasciiFileName
BeamSpotWrite2DB::~BeamSpotWrite2DB ( )
override

Definition at line 32 of file BeamSpotWrite2DB.cc.

32 {}

Member Function Documentation

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

Definition at line 34 of file BeamSpotWrite2DB.cc.

34 {}
void BeamSpotWrite2DB::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 36 of file BeamSpotWrite2DB.cc.

36 {}
void BeamSpotWrite2DB::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 38 of file BeamSpotWrite2DB.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), DEFINE_FWK_MODULE, 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.

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];
74  fasciiFile >> tag >> emittanceX;
75  fasciiFile >> tag >> emittanceY;
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 }
type
Definition: HCALResponse.h:21
std::ifstream fasciiFile
std::string fasciiFileName
void SetSigmaZ(double val)
set sigma Z, RMS bunch length
void SetCovariance(int i, int j, double val)
set i,j element of the full covariance matrix 7x7
void Setdydz(double val)
set dydz slope, crossing angle in XZ
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
void SetEmittanceX(double val)
set emittance
bool isAvailable() const
Definition: Service.h:40
void Setdxdz(double val)
set dxdz slope, crossing angle
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void SetBetaStar(double val)
set beta star
void SetType(int type)
set beam type
void SetEmittanceY(double val)
set emittance
void SetBeamWidthX(double val)
set average transverse beam width X
void SetBeamWidthY(double val)
set average transverse beam width Y
void SetPosition(double x, double y, double z)
set XYZ position

Member Data Documentation

std::ifstream BeamSpotWrite2DB::fasciiFile
private

Definition at line 40 of file BeamSpotWrite2DB.h.

Referenced by BeamSpotWrite2DB(), and endJob().

std::string BeamSpotWrite2DB::fasciiFileName
private

Definition at line 41 of file BeamSpotWrite2DB.h.

Referenced by BeamSpotWrite2DB(), and endJob().