CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
BeamSpotWrite2DB Class Reference
Inheritance diagram for BeamSpotWrite2DB:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 BeamSpotWrite2DB (const edm::ParameterSet &)
 
 ~BeamSpotWrite2DB () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void endJob () override
 

Private Attributes

std::ifstream fasciiFile
 
std::string fasciiFileName
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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 31 of file BeamSpotWrite2DB.cc.

Constructor & Destructor Documentation

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

Definition at line 45 of file BeamSpotWrite2DB.cc.

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

45  {
46  usesResource("PoolDBOutputService");
47  fasciiFileName = iConfig.getUntrackedParameter<std::string>("OutputFileName");
48  if (!fasciiFileName.empty()) {
49  fasciiFile.open(fasciiFileName.c_str());
50  } else {
51  throw cms::Exception("Inconsistent Data") << " expected input file name is null\n";
52  }
53 }
T getUntrackedParameter(std::string const &, T const &) const
std::ifstream fasciiFile
std::string fasciiFileName
BeamSpotWrite2DB::~BeamSpotWrite2DB ( )
overridedefault

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 57 of file BeamSpotWrite2DB.cc.

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 59 of file BeamSpotWrite2DB.cc.

References cond::service::PoolDBOutputService::appendOneIOV(), cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createOneIOV(), cond::service::PoolDBOutputService::currentTime(), BeamSpotPI::dxdz, BeamSpotPI::dydz, 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(), BeamSpotPI::sigmaZ, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, x, y, and z.

59  {
60  edm::LogPrint("BeamSpotWrite2DB") << " Read beam spot data from text file: " << fasciiFileName;
61  edm::LogPrint("BeamSpotWrite2DB") << " please see plugins/BeamSpotWrite2DB.cc for format of text file.";
62 
63  edm::LogInfo("BeamSpotWrite2DB")
64  << " Content of the file is expected to have this format with the first column as a keyword:";
65  edm::LogInfo("BeamSpotWrite2DB") << " x\n y\n z\n sigmaZ\n dxdz\n dydz\n beamWidthX\n beamWidthY";
66  for (int i = 0; i < 7; i++) {
67  for (int j = 0; j < 7; j++) {
68  edm::LogInfo("BeamSpotWrite2DB") << " cov[" << i << "][" << j << "] cov[" << i << "][" << j << "] cov[" << i
69  << "][" << j << "] cov[" << i << "][" << j << "] cov[" << i << "][" << j
70  << "] cov[" << j << "][" << j << "] cov[" << i << "][" << j << "]";
71  }
72  }
73 
74  // extract from file
75  double x, y, z, sigmaZ, dxdz, dydz, beamWidthX, beamWidthY, emittanceX, emittanceY, betastar;
77  double cov[7][7];
78  int type;
79 
80  fasciiFile >> tag >> type;
81  fasciiFile >> tag >> x;
82  fasciiFile >> tag >> y;
83  fasciiFile >> tag >> z;
84  fasciiFile >> tag >> sigmaZ;
85  fasciiFile >> tag >> dxdz;
86  fasciiFile >> tag >> dydz;
87  fasciiFile >> tag >> beamWidthX;
88  fasciiFile >> tag >> beamWidthY;
89  fasciiFile >> tag >> cov[0][0] >> cov[0][1] >> cov[0][2] >> cov[0][3] >> cov[0][4] >> cov[0][5] >> cov[0][6];
90  fasciiFile >> tag >> cov[1][0] >> cov[1][1] >> cov[1][2] >> cov[1][3] >> cov[1][4] >> cov[1][5] >> cov[1][6];
91  fasciiFile >> tag >> cov[2][0] >> cov[2][1] >> cov[2][2] >> cov[2][3] >> cov[2][4] >> cov[2][5] >> cov[2][6];
92  fasciiFile >> tag >> cov[3][0] >> cov[3][1] >> cov[3][2] >> cov[3][3] >> cov[3][4] >> cov[3][5] >> cov[3][6];
93  fasciiFile >> tag >> cov[4][0] >> cov[4][1] >> cov[4][2] >> cov[4][3] >> cov[4][4] >> cov[4][5] >> cov[4][6];
94  fasciiFile >> tag >> cov[5][0] >> cov[5][1] >> cov[5][2] >> cov[5][3] >> cov[5][4] >> cov[5][5] >> cov[5][6];
95  fasciiFile >> tag >> cov[6][0] >> cov[6][1] >> cov[6][2] >> cov[6][3] >> cov[6][4] >> cov[6][5] >> cov[6][6];
96  fasciiFile >> tag >> emittanceX;
97  fasciiFile >> tag >> emittanceY;
98  fasciiFile >> tag >> betastar;
99 
100  BeamSpotObjects abeam;
101 
102  abeam.SetType(type);
103  abeam.SetPosition(x, y, z);
104  abeam.SetSigmaZ(sigmaZ);
105  abeam.Setdxdz(dxdz);
106  abeam.Setdydz(dydz);
107  abeam.SetBeamWidthX(beamWidthX);
108  abeam.SetBeamWidthY(beamWidthY);
109  abeam.SetEmittanceX(emittanceX);
110  abeam.SetEmittanceY(emittanceY);
111  abeam.SetBetaStar(betastar);
112 
113  for (int i = 0; i < 7; ++i) {
114  for (int j = 0; j < 7; ++j) {
115  abeam.SetCovariance(i, j, cov[i][j]);
116  }
117  }
118 
119  edm::LogPrint("BeamSpotWrite2DB") << " write results to DB...";
120 
122  if (poolDbService.isAvailable()) {
123  edm::LogPrint("BeamSpotWrite2DB") << "poolDBService available";
124  if (poolDbService->isNewTagRequest("BeamSpotObjectsRcd")) {
125  edm::LogPrint("BeamSpotWrite2DB") << "new tag requested";
126  poolDbService->createOneIOV<BeamSpotObjects>(abeam, poolDbService->beginOfTime(), "BeamSpotObjectsRcd");
127  } else {
128  edm::LogPrint("BeamSpotWrite2DB") << "no new tag requested";
129  poolDbService->appendOneIOV<BeamSpotObjects>(abeam, poolDbService->currentTime(), "BeamSpotObjectsRcd");
130  }
131  }
132  edm::LogPrint("BeamSpotWrite2DB") << "[BeamSpotWrite2DB] endJob done \n";
133 }
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 createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
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
Log< level::Warning, true > LogPrint
void SetBetaStar(double val)
set beta star
Log< level::Info, false > LogInfo
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
void BeamSpotWrite2DB::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 135 of file BeamSpotWrite2DB.cc.

References edm::ParameterSetDescription::addUntracked(), edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

135  {
137  desc.setComment(
138  "Writes out a DB file containing a BeamSpotObjects payload, according to parameters defined in ASCII file");
139  desc.addUntracked<std::string>("OutputFileName", {});
140  descriptions.addWithDefaultLabel(desc);
141 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setComment(std::string const &value)

Member Data Documentation

std::ifstream BeamSpotWrite2DB::fasciiFile
private

Definition at line 41 of file BeamSpotWrite2DB.cc.

Referenced by BeamSpotWrite2DB(), and endJob().

std::string BeamSpotWrite2DB::fasciiFileName
private

Definition at line 42 of file BeamSpotWrite2DB.cc.

Referenced by BeamSpotWrite2DB(), and endJob().