CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
BeamSpotOnlineLegacyRcdReader Class Reference

#include <CondTools/BeamSpot/plugins/BeamSpotOnlineLegacyRcdReader.cc>

Inheritance diagram for BeamSpotOnlineLegacyRcdReader:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  theBSOfromDB
 

Public Member Functions

 BeamSpotOnlineLegacyRcdReader (const edm::ParameterSet &)
 
 ~BeamSpotOnlineLegacyRcdReader () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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 &&)=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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- 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 beginJob () override
 
void endJob () override
 

Private Attributes

TTree * bstree_
 
std::unique_ptr< std::ofstream > output_
 
edm::Service< TFileServicetFileService
 
struct BeamSpotOnlineLegacyRcdReader::theBSOfromDB theBSOfromDB_
 
edm::ESWatcher< BeamSpotOnlineLegacyObjectsRcdwatcher_
 

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
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

Description: EDAnalyzer to create a BeamSpotOnlineLegacyObjectsRcd payload from a txt file and dump it in a db file

Implementation: [Notes on implementation]

Definition at line 49 of file BeamSpotOnlineLegacyRcdReader.cc.

Constructor & Destructor Documentation

◆ BeamSpotOnlineLegacyRcdReader()

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

Definition at line 88 of file BeamSpotOnlineLegacyRcdReader.cc.

88  : bstree_(nullptr) {
89  //now do what ever initialization is needed
90  usesResource("TFileService");
91  std::string fileName(iConfig.getUntrackedParameter<std::string>("rawFileName"));
92  if (!fileName.empty()) {
93  output_.reset(new std::ofstream(fileName.c_str()));
94  if (!output_->good()) {
95  edm::LogError("IOproblem") << "Could not open output file " << fileName << ".";
96  output_.reset();
97  }
98  }
99 }

References MillePedeFileConverter_cfg::fileName, edm::ParameterSet::getUntrackedParameter(), output_, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~BeamSpotOnlineLegacyRcdReader()

BeamSpotOnlineLegacyRcdReader::~BeamSpotOnlineLegacyRcdReader ( )
override

Definition at line 101 of file BeamSpotOnlineLegacyRcdReader.cc.

101  {
102  // do anything here that needs to be done at desctruction time
103  // (e.g. close files, deallocate resources etc.)
104 }

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 129 of file BeamSpotOnlineLegacyRcdReader.cc.

129  {
130  using namespace edm;
131  std::ostringstream output;
132 
133  // initialize the ntuple
135 
136  if (watcher_.check(iSetup)) { // check for new IOV for this run / LS
137 
138  output << " for runs: " << iEvent.id().run() << " - " << iEvent.id().luminosityBlock() << std::endl;
139 
140  // Get BeamSpot from EventSetup:
142  iSetup.get<BeamSpotOnlineLegacyObjectsRcd>().get(beamhandle);
143  const BeamSpotOnlineObjects* mybeamspot = beamhandle.product();
144 
145  theBSOfromDB_.run = iEvent.id().run();
146  theBSOfromDB_.ls = iEvent.id().luminosityBlock();
147  theBSOfromDB_.BSx0_ = mybeamspot->GetX();
148  theBSOfromDB_.BSy0_ = mybeamspot->GetY();
149  theBSOfromDB_.BSz0_ = mybeamspot->GetZ();
150  theBSOfromDB_.Beamsigmaz_ = mybeamspot->GetSigmaZ();
151  theBSOfromDB_.Beamdxdz_ = mybeamspot->Getdxdz();
152  theBSOfromDB_.BeamWidthX_ = mybeamspot->GetBeamWidthX();
153  theBSOfromDB_.BeamWidthY_ = mybeamspot->GetBeamWidthY();
157 
158  bstree_->Fill();
159 
160  output << *mybeamspot << std::endl;
161  }
162 
163  // Final output - either message logger or output file:
164  if (output_.get())
165  *output_ << output.str();
166  else
167  edm::LogInfo("") << output.str();
168 }

References BeamSpotOnlineLegacyRcdReader::theBSOfromDB::Beamdxdz_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::Beamsigmaz_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BeamWidthX_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BeamWidthY_, bstree_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BSx0_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BSy0_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BSz0_, edm::ESWatcher< T >::check(), edm::EventSetup::get(), get, BeamSpotObjects::GetBeamWidthX(), BeamSpotObjects::GetBeamWidthY(), BeamSpotObjects::Getdxdz(), BeamSpotOnlineObjects::GetLastAnalyzedFill(), BeamSpotOnlineObjects::GetLastAnalyzedLumi(), BeamSpotOnlineObjects::GetLastAnalyzedRun(), BeamSpotObjects::GetSigmaZ(), BeamSpotObjects::GetX(), BeamSpotObjects::GetY(), BeamSpotObjects::GetZ(), iEvent, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::init(), BeamSpotOnlineLegacyRcdReader::theBSOfromDB::lastAnalyzedFill_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::lastAnalyzedLumi_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::lastAnalyzedRun_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::ls, convertSQLitetoXML_cfg::output, output_, edm::ESHandle< T >::product(), BeamSpotOnlineLegacyRcdReader::theBSOfromDB::run, theBSOfromDB_, and watcher_.

◆ beginJob()

void BeamSpotOnlineLegacyRcdReader::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 171 of file BeamSpotOnlineLegacyRcdReader.cc.

171  {
172  bstree_ = tFileService->make<TTree>("BSONtuple", "BeamSpotOnline analyzer ntuple");
173 
174  //Tree Branches
175  bstree_->Branch("run", &theBSOfromDB_.run, "run/I");
176  bstree_->Branch("ls", &theBSOfromDB_.ls, "ls/I");
177  bstree_->Branch("BSx0", &theBSOfromDB_.BSx0_, "BSx0/F");
178  bstree_->Branch("BSy0", &theBSOfromDB_.BSy0_, "BSy0/F");
179  bstree_->Branch("BSz0", &theBSOfromDB_.BSz0_, "BSz0/F");
180  bstree_->Branch("Beamsigmaz", &theBSOfromDB_.Beamsigmaz_, "Beamsigmaz/F");
181  bstree_->Branch("Beamdxdz", &theBSOfromDB_.Beamdxdz_, "Beamdxdz/F");
182  bstree_->Branch("BeamWidthX", &theBSOfromDB_.BeamWidthX_, "BeamWidthX/F");
183  bstree_->Branch("BeamWidthY", &theBSOfromDB_.BeamWidthY_, "BeamWidthY/F");
184  bstree_->Branch("LastAnalyzedLumi", &theBSOfromDB_.lastAnalyzedLumi_, "LastAnalyzedLumi/I");
185  bstree_->Branch("LastAnalyzedRun", &theBSOfromDB_.lastAnalyzedRun_, "LastAnalyzedRun/I");
186  bstree_->Branch("LastAnalyzedFill", &theBSOfromDB_.lastAnalyzedFill_, "LastAnalyzedFill/I");
187 }

References BeamSpotOnlineLegacyRcdReader::theBSOfromDB::Beamdxdz_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::Beamsigmaz_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BeamWidthX_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BeamWidthY_, bstree_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BSx0_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BSy0_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BSz0_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::lastAnalyzedFill_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::lastAnalyzedLumi_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::lastAnalyzedRun_, BeamSpotOnlineLegacyRcdReader::theBSOfromDB::ls, TFileService::make(), BeamSpotOnlineLegacyRcdReader::theBSOfromDB::run, tFileService, and theBSOfromDB_.

◆ endJob()

void BeamSpotOnlineLegacyRcdReader::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 190 of file BeamSpotOnlineLegacyRcdReader.cc.

190 {}

◆ fillDescriptions()

void BeamSpotOnlineLegacyRcdReader::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 193 of file BeamSpotOnlineLegacyRcdReader.cc.

193  {
194  //The following says we do not know what parameters are allowed so do no validation
195  // Please change this to state exactly what you do use, even if it is no parameters
197  desc.setUnknown();
198  descriptions.addDefault(desc);
199 }

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

Member Data Documentation

◆ bstree_

TTree* BeamSpotOnlineLegacyRcdReader::bstree_
private

Definition at line 78 of file BeamSpotOnlineLegacyRcdReader.cc.

Referenced by analyze(), and beginJob().

◆ output_

std::unique_ptr<std::ofstream> BeamSpotOnlineLegacyRcdReader::output_
private

Definition at line 82 of file BeamSpotOnlineLegacyRcdReader.cc.

Referenced by analyze(), and BeamSpotOnlineLegacyRcdReader().

◆ tFileService

edm::Service<TFileService> BeamSpotOnlineLegacyRcdReader::tFileService
private

Definition at line 77 of file BeamSpotOnlineLegacyRcdReader.cc.

Referenced by beginJob().

◆ theBSOfromDB_

struct BeamSpotOnlineLegacyRcdReader::theBSOfromDB BeamSpotOnlineLegacyRcdReader::theBSOfromDB_
private

Referenced by analyze(), and beginJob().

◆ watcher_

edm::ESWatcher<BeamSpotOnlineLegacyObjectsRcd> BeamSpotOnlineLegacyRcdReader::watcher_
private

Definition at line 81 of file BeamSpotOnlineLegacyRcdReader.cc.

Referenced by analyze().

BeamSpotOnlineLegacyRcdReader::theBSOfromDB::init
void init()
Definition: BeamSpotOnlineLegacyRcdReader.cc:110
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
BeamSpotObjects::GetBeamWidthY
double GetBeamWidthY() const
get average transverse beam width
Definition: BeamSpotObjects.h:77
BeamSpotObjects::Getdxdz
double Getdxdz() const
get dxdz slope, crossing angle in XZ
Definition: BeamSpotObjects.h:79
BeamSpotOnlineLegacyRcdReader::bstree_
TTree * bstree_
Definition: BeamSpotOnlineLegacyRcdReader.cc:78
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::lastAnalyzedLumi_
int lastAnalyzedLumi_
Definition: BeamSpotOnlineLegacyRcdReader.cc:71
BeamSpotOnlineLegacyRcdReader::output_
std::unique_ptr< std::ofstream > output_
Definition: BeamSpotOnlineLegacyRcdReader.cc:82
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
BeamSpotObjects::GetSigmaZ
double GetSigmaZ() const
get sigma Z, RMS bunch length
Definition: BeamSpotObjects.h:73
edm
HLT enums.
Definition: AlignableModifier.h:19
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::lastAnalyzedFill_
int lastAnalyzedFill_
Definition: BeamSpotOnlineLegacyRcdReader.cc:73
edm::LogInfo
Definition: MessageLogger.h:254
BeamSpotObjects::GetZ
double GetZ() const
get Z beam position
Definition: BeamSpotObjects.h:71
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::Beamsigmaz_
float Beamsigmaz_
Definition: BeamSpotOnlineLegacyRcdReader.cc:67
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BSz0_
float BSz0_
Definition: BeamSpotOnlineLegacyRcdReader.cc:66
edm::ESHandle
Definition: DTSurvey.h:22
BeamSpotOnlineLegacyObjectsRcd
Definition: BeamSpotOnlineLegacyObjectsRcd.h:24
BeamSpotOnlineObjects::GetLastAnalyzedLumi
int GetLastAnalyzedLumi() const
Getters Methods.
Definition: BeamSpotOnlineObjects.h:63
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BeamWidthX_
float BeamWidthX_
Definition: BeamSpotOnlineLegacyRcdReader.cc:69
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BSx0_
float BSx0_
Definition: BeamSpotOnlineLegacyRcdReader.cc:64
edm::LogError
Definition: MessageLogger.h:183
BeamSpotObjects::GetY
double GetY() const
get Y beam position
Definition: BeamSpotObjects.h:69
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BSy0_
float BSy0_
Definition: BeamSpotOnlineLegacyRcdReader.cc:65
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::Beamdxdz_
float Beamdxdz_
Definition: BeamSpotOnlineLegacyRcdReader.cc:68
iEvent
int iEvent
Definition: GenABIO.cc:224
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::ls
int ls
Definition: BeamSpotOnlineLegacyRcdReader.cc:62
BeamSpotOnlineLegacyRcdReader::theBSOfromDB_
struct BeamSpotOnlineLegacyRcdReader::theBSOfromDB theBSOfromDB_
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
BeamSpotOnlineObjects::GetLastAnalyzedRun
int GetLastAnalyzedRun() const
Definition: BeamSpotOnlineObjects.h:66
get
#define get
BeamSpotOnlineLegacyRcdReader::tFileService
edm::Service< TFileService > tFileService
Definition: BeamSpotOnlineLegacyRcdReader.cc:77
BeamSpotObjects::GetBeamWidthX
double GetBeamWidthX() const
get average transverse beam width
Definition: BeamSpotObjects.h:75
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::lastAnalyzedRun_
int lastAnalyzedRun_
Definition: BeamSpotOnlineLegacyRcdReader.cc:72
BeamSpotOnlineObjects
Definition: BeamSpotOnlineObjects.h:25
BeamSpotOnlineObjects::GetLastAnalyzedFill
int GetLastAnalyzedFill() const
Definition: BeamSpotOnlineObjects.h:69
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
BeamSpotOnlineLegacyRcdReader::watcher_
edm::ESWatcher< BeamSpotOnlineLegacyObjectsRcd > watcher_
Definition: BeamSpotOnlineLegacyRcdReader.cc:81
BeamSpotObjects::GetX
double GetX() const
get X beam position
Definition: BeamSpotObjects.h:67
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::BeamWidthY_
float BeamWidthY_
Definition: BeamSpotOnlineLegacyRcdReader.cc:70
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
BeamSpotOnlineLegacyRcdReader::theBSOfromDB::run
int run
Definition: BeamSpotOnlineLegacyRcdReader.cc:63