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
 
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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)
 

Private Attributes

double m_currentThreshold
 

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

Detailed Description

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

Definition at line 17 of file BTransitionAnalyzer.h.

Constructor & Destructor Documentation

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.)) {}
T getUntrackedParameter(std::string const &, T const &) const

Member Function Documentation

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 29 of file BTransitionAnalyzer.h.

29 {};
template<class T, class R>
void cond::BTransitionAnalyzer< T, R >::beginJob ( void  )
inlinefinalvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 27 of file BTransitionAnalyzer.h.

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

Definition at line 28 of file BTransitionAnalyzer.h.

28 {};
template<class T, class R>
void cond::BTransitionAnalyzer< T, R >::endJob ( void  )
inlinefinalvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 66 of file BTransitionAnalyzer.h.

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

Definition at line 30 of file BTransitionAnalyzer.h.

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

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