CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cond::BTransitionAnalyzer< T, R > Class Template Referenceabstract

#include <BTransitionAnalyzer.h>

Inheritance diagram for cond::BTransitionAnalyzer< T, R >:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) final
 
void beginJob () final
 
void beginRun (edm::Run const &, edm::EventSetup const &) final
 
 BTransitionAnalyzer (const edm::ParameterSet &pset)
 
void endJob () final
 
void endRun (edm::Run const &run, edm::EventSetup const &eventSetup) final
 
virtual bool equalPayloads (edm::ESHandle< T > const &payloadHandle, edm::ESHandle< T > const &payloadRefHandle)=0
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

double m_currentThreshold
 
const edm::ESGetToken< T, R > m_ESToken
 
const edm::ESGetToken< T, R > m_ESTokenB0T
 
const edm::ESGetToken< T, R > m_ESTokenB38T
 
const edm::ESGetToken< RunInfo, RunInfoRcdm_RunInfoToken
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (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 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)
 

Detailed Description

template<class T, class R>
class cond::BTransitionAnalyzer< T, R >

Definition at line 17 of file BTransitionAnalyzer.h.

Constructor & Destructor Documentation

◆ BTransitionAnalyzer()

template<class T, class R>
cond::BTransitionAnalyzer< T, R >::BTransitionAnalyzer ( const edm::ParameterSet pset)
inline

Definition at line 19 of file BTransitionAnalyzer.h.

20  : m_currentThreshold(pset.getUntrackedParameter<double>("currentThreshold", 18000.)),
21  m_RunInfoToken(esConsumes<edm::Transition::EndRun>()),
22  m_ESToken(esConsumes<edm::Transition::EndRun>()),
23  m_ESTokenB0T(esConsumes<edm::Transition::EndRun>(edm::ESInputTag("", "0T"))),
24  m_ESTokenB38T(esConsumes<edm::Transition::EndRun>(edm::ESInputTag("", "38T"))) {}
const edm::ESGetToken< T, R > m_ESTokenB38T
const edm::ESGetToken< RunInfo, RunInfoRcd > m_RunInfoToken
const edm::ESGetToken< T, R > m_ESToken
const edm::ESGetToken< T, R > m_ESTokenB0T

Member Function Documentation

◆ analyze()

template<class T, class R>
void cond::BTransitionAnalyzer< T, R >::analyze ( edm::Event const &  ,
edm::EventSetup const &   
)
inlinefinalvirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 33 of file BTransitionAnalyzer.h.

33 {};

◆ beginJob()

template<class T, class R>
void cond::BTransitionAnalyzer< T, R >::beginJob ( )
inlinefinalvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 31 of file BTransitionAnalyzer.h.

31 {};

◆ beginRun()

template<class T, class R>
void cond::BTransitionAnalyzer< T, R >::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlinefinal

Definition at line 32 of file BTransitionAnalyzer.h.

32 {};

◆ endJob()

template<class T, class R>
void cond::BTransitionAnalyzer< T, R >::endJob ( void  )
inlinefinalvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 72 of file BTransitionAnalyzer.h.

72 {};

◆ endRun()

template<class T, class R>
void cond::BTransitionAnalyzer< T, R >::endRun ( edm::Run const &  run,
edm::EventSetup const &  eventSetup 
)
inlinefinal

Definition at line 34 of file BTransitionAnalyzer.h.

34  {
35  edm::ESHandle<RunInfo> runInfoHandle = eventSetup.getHandle(m_RunInfoToken);
36  edm::ESHandle<T> payloadHandle, payloadRefHandle;
37  double avg_current = (double)runInfoHandle->m_avg_current;
38  double current_default = -1;
39  std::string bOnLabel = std::string("38T");
40  std::string bOffLabel = std::string("0T");
41  std::string bFieldLabel = bOnLabel;
42  LogDebug("BTransitionAnalyzer") << "Comparing value of magnet current: " << avg_current
43  << " A for run: " << run.run()
44  << " with the corresponding threshold: " << m_currentThreshold << " A."
45  << std::endl;
46  if (avg_current != current_default && avg_current <= m_currentThreshold) {
47  bFieldLabel = bOffLabel;
48  payloadHandle = eventSetup.getHandle(m_ESTokenB0T);
49  } else {
50  payloadHandle = eventSetup.getHandle(m_ESTokenB38T);
51  }
52  edm::LogInfo("BTransitionAnalyzer")
53  << "The magnet was " << (bFieldLabel == bOnLabel ? "ON" : "OFF") << " during run " << run.run()
54  << ".\nLoading the product for the corrisponding label " << bFieldLabel << std::endl;
55  payloadRefHandle = eventSetup.getHandle(m_ESToken);
57  if (mydbservice.isAvailable()) {
58  if (!equalPayloads(payloadHandle, payloadRefHandle)) {
59  edm::LogInfo("BTransitionAnalyzer")
60  << "Exporting payload corresponding to the calibrations for magnetic field "
61  << (bFieldLabel == bOnLabel ? "ON" : "OFF") << " starting from run number: " << run.run() << std::endl;
62  mydbservice->writeOneIOV(*payloadHandle.product(), run.run(), demangledName(typeid(R)));
63  } else {
64  edm::LogInfo("BTransitionAnalyzer") << "The payload corresponding to the calibrations for magnetic field "
65  << (bFieldLabel == bOnLabel ? "ON" : "OFF") << " is still valid for run "
66  << run.run() << ".\nNo transfer needed." << std::endl;
67  }
68  } else {
69  edm::LogError("BTransitionAnalyzer") << "PoolDBOutputService unavailable";
70  }
71  }
virtual bool equalPayloads(edm::ESHandle< T > const &payloadHandle, edm::ESHandle< T > const &payloadRefHandle)=0
Log< level::Error, false > LogError
T const * product() const
Definition: ESHandle.h:86
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
const edm::ESGetToken< T, R > m_ESTokenB38T
Log< level::Info, false > LogInfo
const edm::ESGetToken< RunInfo, RunInfoRcd > m_RunInfoToken
const edm::ESGetToken< T, R > m_ESToken
float m_avg_current
Definition: RunInfo.h:28
const edm::ESGetToken< T, R > m_ESTokenB0T
bool isAvailable() const
Definition: Service.h:40
#define LogDebug(id)

◆ equalPayloads()

template<class T, class R>
virtual bool cond::BTransitionAnalyzer< T, R >::equalPayloads ( edm::ESHandle< T > const &  payloadHandle,
edm::ESHandle< T > const &  payloadRefHandle 
)
pure virtual

Member Data Documentation

◆ m_currentThreshold

template<class T, class R>
double cond::BTransitionAnalyzer< T, R >::m_currentThreshold
private

◆ m_ESToken

template<class T, class R>
const edm::ESGetToken<T, R> cond::BTransitionAnalyzer< T, R >::m_ESToken
private

◆ m_ESTokenB0T

template<class T, class R>
const edm::ESGetToken<T, R> cond::BTransitionAnalyzer< T, R >::m_ESTokenB0T
private

◆ m_ESTokenB38T

template<class T, class R>
const edm::ESGetToken<T, R> cond::BTransitionAnalyzer< T, R >::m_ESTokenB38T
private

◆ m_RunInfoToken

template<class T, class R>
const edm::ESGetToken<RunInfo, RunInfoRcd> cond::BTransitionAnalyzer< T, R >::m_RunInfoToken
private