CMS 3D CMS Logo

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

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

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

Classes

struct  theBSOfromDB
 

Public Member Functions

 BeamSpotOnlineHLTRcdReader (const edm::ParameterSet &)
 
 ~BeamSpotOnlineHLTRcdReader () 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 BeamSpotOnlineHLTRcdReader::theBSOfromDB theBSOfromDB_
 
edm::ESWatcher< BeamSpotOnlineHLTObjectsRcdwatcher_
 

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 BeamSpotOnlineHLTObjectsRcd payload from a txt file and dump it in a db file

Implementation: [Notes on implementation]

Definition at line 49 of file BeamSpotOnlineHLTRcdReader.cc.

Constructor & Destructor Documentation

◆ BeamSpotOnlineHLTRcdReader()

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

Definition at line 88 of file BeamSpotOnlineHLTRcdReader.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.

◆ ~BeamSpotOnlineHLTRcdReader()

BeamSpotOnlineHLTRcdReader::~BeamSpotOnlineHLTRcdReader ( )
override

Definition at line 101 of file BeamSpotOnlineHLTRcdReader.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 BeamSpotOnlineHLTRcdReader::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 129 of file BeamSpotOnlineHLTRcdReader.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<BeamSpotOnlineHLTObjectsRcd>().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 BeamSpotOnlineHLTRcdReader::theBSOfromDB::Beamdxdz_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::Beamsigmaz_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::BeamWidthX_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::BeamWidthY_, bstree_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::BSx0_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::BSy0_, BeamSpotOnlineHLTRcdReader::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, BeamSpotOnlineHLTRcdReader::theBSOfromDB::init(), BeamSpotOnlineHLTRcdReader::theBSOfromDB::lastAnalyzedFill_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::lastAnalyzedLumi_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::lastAnalyzedRun_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::ls, convertSQLitetoXML_cfg::output, output_, edm::ESHandle< T >::product(), BeamSpotOnlineHLTRcdReader::theBSOfromDB::run, theBSOfromDB_, and watcher_.

◆ beginJob()

void BeamSpotOnlineHLTRcdReader::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 171 of file BeamSpotOnlineHLTRcdReader.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 BeamSpotOnlineHLTRcdReader::theBSOfromDB::Beamdxdz_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::Beamsigmaz_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::BeamWidthX_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::BeamWidthY_, bstree_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::BSx0_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::BSy0_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::BSz0_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::lastAnalyzedFill_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::lastAnalyzedLumi_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::lastAnalyzedRun_, BeamSpotOnlineHLTRcdReader::theBSOfromDB::ls, TFileService::make(), BeamSpotOnlineHLTRcdReader::theBSOfromDB::run, tFileService, and theBSOfromDB_.

◆ endJob()

void BeamSpotOnlineHLTRcdReader::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 190 of file BeamSpotOnlineHLTRcdReader.cc.

190 {}

◆ fillDescriptions()

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

Definition at line 193 of file BeamSpotOnlineHLTRcdReader.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* BeamSpotOnlineHLTRcdReader::bstree_
private

Definition at line 78 of file BeamSpotOnlineHLTRcdReader.cc.

Referenced by analyze(), and beginJob().

◆ output_

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

Definition at line 82 of file BeamSpotOnlineHLTRcdReader.cc.

Referenced by analyze(), and BeamSpotOnlineHLTRcdReader().

◆ tFileService

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

Definition at line 77 of file BeamSpotOnlineHLTRcdReader.cc.

Referenced by beginJob().

◆ theBSOfromDB_

struct BeamSpotOnlineHLTRcdReader::theBSOfromDB BeamSpotOnlineHLTRcdReader::theBSOfromDB_
private

Referenced by analyze(), and beginJob().

◆ watcher_

edm::ESWatcher<BeamSpotOnlineHLTObjectsRcd> BeamSpotOnlineHLTRcdReader::watcher_
private

Definition at line 81 of file BeamSpotOnlineHLTRcdReader.cc.

Referenced by analyze().

edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
BeamSpotOnlineHLTObjectsRcd
Definition: BeamSpotOnlineHLTObjectsRcd.h:24
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
BeamSpotOnlineHLTRcdReader::theBSOfromDB::ls
int ls
Definition: BeamSpotOnlineHLTRcdReader.cc:62
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
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
BeamSpotOnlineHLTRcdReader::bstree_
TTree * bstree_
Definition: BeamSpotOnlineHLTRcdReader.cc:78
BeamSpotOnlineHLTRcdReader::tFileService
edm::Service< TFileService > tFileService
Definition: BeamSpotOnlineHLTRcdReader.cc:77
BeamSpotOnlineHLTRcdReader::theBSOfromDB_
struct BeamSpotOnlineHLTRcdReader::theBSOfromDB theBSOfromDB_
BeamSpotOnlineHLTRcdReader::theBSOfromDB::Beamsigmaz_
float Beamsigmaz_
Definition: BeamSpotOnlineHLTRcdReader.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
BeamSpotOnlineHLTRcdReader::theBSOfromDB::BSy0_
float BSy0_
Definition: BeamSpotOnlineHLTRcdReader.cc:65
edm::ESHandle
Definition: DTSurvey.h:22
BeamSpotOnlineHLTRcdReader::theBSOfromDB::BeamWidthX_
float BeamWidthX_
Definition: BeamSpotOnlineHLTRcdReader.cc:69
BeamSpotOnlineHLTRcdReader::watcher_
edm::ESWatcher< BeamSpotOnlineHLTObjectsRcd > watcher_
Definition: BeamSpotOnlineHLTRcdReader.cc:81
BeamSpotOnlineObjects::GetLastAnalyzedLumi
int GetLastAnalyzedLumi() const
Getters Methods.
Definition: BeamSpotOnlineObjects.h:63
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BeamSpotOnlineHLTRcdReader::theBSOfromDB::BSz0_
float BSz0_
Definition: BeamSpotOnlineHLTRcdReader.cc:66
BeamSpotOnlineHLTRcdReader::output_
std::unique_ptr< std::ofstream > output_
Definition: BeamSpotOnlineHLTRcdReader.cc:82
edm::LogError
Definition: MessageLogger.h:183
BeamSpotObjects::GetY
double GetY() const
get Y beam position
Definition: BeamSpotObjects.h:69
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
BeamSpotOnlineObjects::GetLastAnalyzedRun
int GetLastAnalyzedRun() const
Definition: BeamSpotOnlineObjects.h:66
get
#define get
BeamSpotOnlineHLTRcdReader::theBSOfromDB::init
void init()
Definition: BeamSpotOnlineHLTRcdReader.cc:110
BeamSpotObjects::GetBeamWidthX
double GetBeamWidthX() const
get average transverse beam width
Definition: BeamSpotObjects.h:75
BeamSpotOnlineHLTRcdReader::theBSOfromDB::lastAnalyzedRun_
int lastAnalyzedRun_
Definition: BeamSpotOnlineHLTRcdReader.cc:72
BeamSpotOnlineObjects
Definition: BeamSpotOnlineObjects.h:25
BeamSpotOnlineHLTRcdReader::theBSOfromDB::BSx0_
float BSx0_
Definition: BeamSpotOnlineHLTRcdReader.cc:64
BeamSpotOnlineHLTRcdReader::theBSOfromDB::Beamdxdz_
float Beamdxdz_
Definition: BeamSpotOnlineHLTRcdReader.cc:68
BeamSpotOnlineHLTRcdReader::theBSOfromDB::lastAnalyzedFill_
int lastAnalyzedFill_
Definition: BeamSpotOnlineHLTRcdReader.cc:73
BeamSpotOnlineHLTRcdReader::theBSOfromDB::run
int run
Definition: BeamSpotOnlineHLTRcdReader.cc:63
BeamSpotOnlineObjects::GetLastAnalyzedFill
int GetLastAnalyzedFill() const
Definition: BeamSpotOnlineObjects.h:69
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
BeamSpotObjects::GetX
double GetX() const
get X beam position
Definition: BeamSpotObjects.h:67
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
BeamSpotOnlineHLTRcdReader::theBSOfromDB::lastAnalyzedLumi_
int lastAnalyzedLumi_
Definition: BeamSpotOnlineHLTRcdReader.cc:71
BeamSpotOnlineHLTRcdReader::theBSOfromDB::BeamWidthY_
float BeamWidthY_
Definition: BeamSpotOnlineHLTRcdReader.cc:70