#include <ConditionDBWriter.h>
Static Public Member Functions | |
static void | fillPSetDescription (edm::ParameterSetDescription &desc) |
Static Public Member Functions inherited from edm::one::EDAnalyzerBase | |
static const std::string & | baseType () |
static void | fillDescriptions (ConfigurationDescriptions &descriptions) |
static void | prevalidate (ConfigurationDescriptions &descriptions) |
Protected Member Functions | |
void | setDoStore (const bool doStore) |
When set to false the payload will not be written to the db. More... | |
void | storeOnDbNow () |
cond::Time_t | timeOfLastIOV () |
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 () |
template<Transition Tr = Transition::Event> | |
auto | esConsumes (ESInputTag tag) |
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) |
Private Member Functions | |
virtual void | algoAnalyze (const edm::Event &, const edm::EventSetup &) |
virtual void | algoBeginJob (const edm::EventSetup &) |
virtual void | algoBeginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) |
virtual void | algoBeginRun (const edm::Run &, const edm::EventSetup &) |
virtual void | algoEndJob () |
virtual void | algoEndLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) |
virtual void | algoEndRun (const edm::Run &, const edm::EventSetup &) |
void | analyze (const edm::Event &event, const edm::EventSetup &iSetup) override |
void | beginJob () override |
void | beginLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override |
void | beginRun (const edm::Run &run, const edm::EventSetup &es) override |
void | endJob () override |
void | endLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &es) override |
void | endRun (const edm::Run &run, const edm::EventSetup &es) override |
virtual std::unique_ptr< T > | getNewObject ()=0 |
void | setTime () |
void | storeOnDb (std::unique_ptr< T > &objPointer) |
Private Attributes | |
bool | AlgoDrivenMode_ |
bool | doStore_ |
bool | firstRun_ |
bool | JobMode_ |
bool | LumiBlockMode_ |
unsigned int | maxRunRange_ |
unsigned int | minRunRange_ |
std::string | Record_ |
bool | RunMode_ |
bool | setSinceTime_ |
bool | SinceAppendMode_ |
cond::Time_t | Time_ |
bool | timeFromEndRun_ |
bool | timeFromStartOfRunRange_ |
Additional Inherited Members | |
Public Types inherited from edm::one::EDAnalyzerBase | |
typedef EDAnalyzerBase | ModuleType |
Public Types inherited from edm::EDConsumerBase | |
typedef ProductLabels | Labels |
Implementation:
This class can be very useful whenever a CMSSW application needs to store data to the offline DB. Typically such applications require access to event data and/or need to be notified about the start of Run, Lumi section in order to set a correct Interval Of Validity (IOV) for the data they have to store. Therefore the FWK EDAnalyzer is an excellent candidate for the implementation of such applications; this is the reason why this class inherits from the EDAnalyzer class.
The user class should inherit from this class. The templated type must be the type of the object that has to be written on the DB (e.g. MyCalibration). Examples of use of this class can be found in package CalibTracker/SiStripChannelGain. Have a look also at the test/ directory for examples of full cfg files.
The user must implement in his derived class the abstract method below
virtual std::unique_ptr<MyCalibration> getNewObject()=0;
The user can optionally implement the following methods
//Will be called at the beginning of the job virtual void algoBeginJob(const edm::EventSetup&){}; //Will be called at the beginning of each run in the job virtual void algoBeginRun(const edm::Run &, const edm::EventSetup &){}; //Will be called at the beginning of each luminosity block in the run virtual void algoBeginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &){}; //Will be called at every event virtual void algoAnalyze(const edm::Event&, const edm::EventSetup&){}; //Will be called at the end of each run in the job virtual void algoEndRun(const edm::Run &, const edm::EventSetup &){}; //Will be called at the end of the job virtual void algoEndJob(){};
where he can access information needed to build his object. For instance, if he is computing a calibration that is computed as the mean of a certain quantity that varies from event to event, he will implement the algoAnalyze method.
The important part is the IOV setting. The advantage of using this class is that this setting is performed almost automatically: the only thing that the user has to do is to pass prescriptions about the IOV setting in the configuration of his module. A typical configuration is as follows:
module prod = SiStripGainRandomCalculator { #parameters of the derived class double MinPositiveGain = 0.1 double MeanGain = 1 double SigmaGain = 0 untracked bool printDebug = true #parameters of the base class string IOVMode = "Run" bool SinceAppendMode = true string Record = "SiStripApvGainRcd" }
Two subsets of parameters can be found. The first subset contains the specific parameters of the user class, which is called in this case SiStripGainRandomCalculator. The second subset contains the parameters of the base class. These are the following:
1) string IOVMode
4 possible values can be given: "Job", "Run", "LumiBlock" and "AlgoDriven" This card determines the length of the IOV. In other words, together with
the number of Lumysections/runs the user has decided to run his application, this card determines the number of objects that will be stored on the DB (the getNewObject method will be called as many times). For example if the user is running on the events of one Run, which has 10 luminosity sections and chooses the "LumiBlock" mode, then 10 objects with corresponding IOV will be written. If the "Job" mode is chosen, only one object will be stored irrespective of the dataset on which the user is running. The "AlgoDriven" option is special. If this choice is made, then it is up to the user to tell in the code when the getNewObject method must be called. This can be done by calling the method below void storeOnDbNow() must be invoked whenever a certain condition that justifies the start/end of an IOV is met.
2) bool SinceAppendMode
obsolete option now ONLY Since append mode is supported
WARNING: due to the policy of the framework, objects SHALL be stored in IOV chronological order. If you have 10 runs, then execute your application starting from run 1 and not for example in two steps: first from Run 6 to Run 10 and then from Run 1 to Run 6.
3)string Record
this is the eventsetup record of your object.
Note that the setDoStore method changes the doStore parameter read from configuration file. This is sometimes needed e.g. to avoid filling bad payloads to the database.
Definition at line 150 of file ConditionDBWriter.h.
|
inlineexplicit |
Definition at line 153 of file ConditionDBWriter.h.
|
inlineoverride |
Definition at line 188 of file ConditionDBWriter.h.
|
inlineprivatevirtual |
Reimplemented in SiStripHitEffFromCalibTree, SiStripGainFromCalibTree, SiStripGainFromData, SiPhase2BadStripChannelBuilder, SiStripQualityHotStripIdentifierRoot, SiStripQualityHotStripIdentifier, SiStripGainCosmicCalculator, SiStripGainRandomCalculator, and DeDxDiscriminatorLearner.
Definition at line 214 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::analyze().
|
inlineprivatevirtual |
Reimplemented in SiStripHitEffFromCalibTree, SiStripGainFromCalibTree, SiStripGainFromData, SiStripCalibLorentzAngle, SiStripGainCosmicCalculator, SiStripQualityHotStripIdentifier, and DeDxDiscriminatorLearner.
Definition at line 208 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::beginRun().
|
inlineprivatevirtual |
Reimplemented in SiStripQualityHotStripIdentifierRoot, and SiStripQualityHotStripIdentifier.
Definition at line 212 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::beginLuminosityBlock().
|
inlineprivatevirtual |
Reimplemented in SiStripGainFromCalibTree, SiStripGainFromData, SiPhase2BadStripChannelBuilder, SiStripQualityHotStripIdentifierRoot, SiStripQualityHotStripIdentifier, and SiPixelBadModuleByHandBuilder.
Definition at line 210 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::beginRun().
|
inlineprivatevirtual |
Reimplemented in SiStripHitEffFromCalibTree, SiStripGainFromCalibTree, SiStripGainFromData, SiStripQualityHotStripIdentifierRoot, SiStripQualityHotStripIdentifier, SiStripGainCosmicCalculator, and DeDxDiscriminatorLearner.
Definition at line 218 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::endJob().
|
inlineprivatevirtual |
Definition at line 275 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::endLuminosityBlock().
|
inlineprivatevirtual |
Reimplemented in SiStripGainFromCalibTree.
Definition at line 216 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::endRun().
|
inlineoverrideprivatevirtual |
Implements edm::one::EDAnalyzerBase.
Definition at line 249 of file ConditionDBWriter.h.
|
inlineoverrideprivatevirtual |
Reimplemented from edm::one::EDAnalyzerBase.
Definition at line 220 of file ConditionDBWriter.h.
|
inlineoverrideprivate |
Definition at line 242 of file ConditionDBWriter.h.
|
inlineoverrideprivate |
Definition at line 222 of file ConditionDBWriter.h.
|
inlineoverrideprivatevirtual |
Reimplemented from edm::one::EDAnalyzerBase.
Definition at line 298 of file ConditionDBWriter.h.
Referenced by o2olib.O2ORunMgr::executeJob().
|
inlineoverrideprivate |
Definition at line 257 of file ConditionDBWriter.h.
|
inlineoverrideprivate |
Definition at line 277 of file ConditionDBWriter.h.
|
inlinestatic |
Definition at line 191 of file ConditionDBWriter.h.
Referenced by SiStripBadStripFromASCIIFile::fillDescriptions(), and SiPhase2BadStripChannelBuilder::fillDescriptions().
|
privatepure virtual |
Implemented in SiStripGainFromCalibTree, SiStripHitEffFromCalibTree, SiStripGainFromData, SiStripQualityHotStripIdentifierRoot, SiStripCalibLorentzAngle, SiStripQualityHotStripIdentifier, SiPhase2BadStripChannelBuilder, SiStripGainCosmicCalculator, DeDxDiscriminatorLearner, SiStripGainRandomCalculator, SiStripBadStripFromASCIIFile, SiPixelBadModuleByHandBuilder, SiStripBadChannelBuilder, SiStripBadFiberBuilder, SiStripBadModuleByHandBuilder, and SiStripGainFromAsciiFile.
Referenced by ConditionDBWriter< SiStripApvGain >::endJob(), ConditionDBWriter< SiStripApvGain >::endLuminosityBlock(), ConditionDBWriter< SiStripApvGain >::endRun(), and ConditionDBWriter< SiStripApvGain >::storeOnDbNow().
|
inlineprotected |
When set to false the payload will not be written to the db.
Definition at line 396 of file ConditionDBWriter.h.
|
inlineprivate |
Definition at line 350 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::analyze().
|
inlineprivate |
Definition at line 319 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::endJob(), ConditionDBWriter< SiStripApvGain >::endLuminosityBlock(), ConditionDBWriter< SiStripApvGain >::endRun(), and ConditionDBWriter< SiStripApvGain >::storeOnDbNow().
|
inlineprotected |
Definition at line 365 of file ConditionDBWriter.h.
|
inlineprotected |
Definition at line 393 of file ConditionDBWriter.h.
|
private |
Definition at line 407 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::beginRun(), ConditionDBWriter< SiStripApvGain >::ConditionDBWriter(), and ConditionDBWriter< SiStripApvGain >::storeOnDbNow().
|
private |
Definition at line 408 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::ConditionDBWriter(), ConditionDBWriter< SiStripApvGain >::setDoStore(), and ConditionDBWriter< SiStripApvGain >::storeOnDb().
|
private |
Definition at line 416 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::beginRun().
|
private |
Definition at line 406 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::beginRun(), ConditionDBWriter< SiStripApvGain >::ConditionDBWriter(), and ConditionDBWriter< SiStripApvGain >::endJob().
|
private |
Definition at line 404 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::beginLuminosityBlock(), ConditionDBWriter< SiStripApvGain >::ConditionDBWriter(), and ConditionDBWriter< SiStripApvGain >::endLuminosityBlock().
|
private |
Definition at line 400 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::beginRun().
|
private |
Definition at line 399 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::beginRun(), and ConditionDBWriter< SiStripApvGain >::storeOnDb().
|
private |
Definition at line 410 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::ConditionDBWriter(), and ConditionDBWriter< SiStripApvGain >::storeOnDb().
|
private |
Definition at line 405 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::beginRun(), ConditionDBWriter< SiStripApvGain >::ConditionDBWriter(), and ConditionDBWriter< SiStripApvGain >::endRun().
|
private |
Definition at line 414 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::analyze(), ConditionDBWriter< SiStripApvGain >::beginLuminosityBlock(), ConditionDBWriter< SiStripApvGain >::beginRun(), ConditionDBWriter< SiStripApvGain >::storeOnDb(), and ConditionDBWriter< SiStripApvGain >::storeOnDbNow().
|
private |
Definition at line 402 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::beginLuminosityBlock(), ConditionDBWriter< SiStripApvGain >::beginRun(), and ConditionDBWriter< SiStripApvGain >::ConditionDBWriter().
|
private |
Definition at line 412 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::endRun(), ConditionDBWriter< SiStripApvGain >::setTime(), ConditionDBWriter< SiStripApvGain >::storeOnDb(), and ConditionDBWriter< SiStripApvGain >::timeOfLastIOV().
|
private |
Definition at line 418 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::ConditionDBWriter(), ConditionDBWriter< SiStripApvGain >::endRun(), and ConditionDBWriter< SiStripApvGain >::storeOnDb().
|
private |
Definition at line 419 of file ConditionDBWriter.h.
Referenced by ConditionDBWriter< SiStripApvGain >::ConditionDBWriter(), and ConditionDBWriter< SiStripApvGain >::storeOnDb().