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

virtual void analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginJob () final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
 BTransitionAnalyzer (const edm::ParameterSet &pset)
 
virtual void endJob () final
 
virtual 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
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 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.

19  :
20  m_currentThreshold( pset.getUntrackedParameter<double>( "currentThreshold", 18000. ) ) {
21  }
T getUntrackedParameter(std::string const &, T const &) const

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 30 of file BTransitionAnalyzer.h.

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 28 of file BTransitionAnalyzer.h.

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

Definition at line 29 of file BTransitionAnalyzer.h.

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 65 of file BTransitionAnalyzer.h.

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

Definition at line 31 of file BTransitionAnalyzer.h.

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