test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1CondDBIOVWriterExt Class Reference

#include <L1CondDBIOVWriterExt.h>

Inheritance diagram for L1CondDBIOVWriterExt:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1CondDBIOVWriterExt (const edm::ParameterSet &)
 
 ~L1CondDBIOVWriterExt ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 

Private Attributes

bool m_forceUpdate
 
bool m_ignoreTriggerKey
 
bool m_logKeys
 
bool m_logTransactions
 
std::vector< std::string > m_recordTypes
 
std::string m_tscKey
 l1t::DataWriter m_writer ; More...
 
l1t::DataWriterExt m_writer
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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

Definition at line 16 of file L1CondDBIOVWriterExt.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file L1CondDBIOVWriterExt.cc.

References edm::ParameterSet::getParameter(), m_recordTypes, record, and AlCaHLTBitMon_QueryRunRegistry::string.

14  : m_tscKey( iConfig.getParameter<std::string> ("tscKey") ),
15  m_ignoreTriggerKey( iConfig.getParameter<bool> ("ignoreTriggerKey") ),
16  m_logKeys( iConfig.getParameter<bool>( "logKeys" ) ),
17  m_logTransactions( iConfig.getParameter<bool>( "logTransactions" ) ),
18  m_forceUpdate( iConfig.getParameter<bool>( "forceUpdate" ) )
19 {
20  //now do what ever initialization is needed
21  typedef std::vector<edm::ParameterSet> ToSave;
22  ToSave toSave = iConfig.getParameter<ToSave> ("toPut");
23  for (ToSave::const_iterator it = toSave.begin (); it != toSave.end (); it++)
24  {
25  std::string record = it->getParameter<std::string> ("record");
26  std::string type = it->getParameter<std::string> ("type");
27  m_recordTypes.push_back( record + "@" + type ) ;
28  }
29 }
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
JetCorrectorParameters::Record record
Definition: classes.h:7
std::vector< std::string > m_recordTypes
std::string m_tscKey
l1t::DataWriter m_writer ;
L1CondDBIOVWriterExt::~L1CondDBIOVWriterExt ( )

Definition at line 32 of file L1CondDBIOVWriterExt.cc.

33 {
34 
35  // do anything here that needs to be done at desctruction time
36  // (e.g. close files, deallocate resources etc.)
37 
38 }

Member Function Documentation

void L1CondDBIOVWriterExt::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 42 of file L1CondDBIOVWriterExt.cc.

References end, edm::false, edm::EventSetup::get(), edm::EventBase::id(), relval_steps::key, L1TriggerKeyExt::kNullKey, dqm-mbProfile::log, m_forceUpdate, m_ignoreTriggerKey, m_logKeys, m_logTransactions, m_recordTypes, m_tscKey, m_writer, l1t::DataWriterExt::readObject(), align_cfg::recordName, L1TriggerKeyExt::recordToKeyMap(), python.rootplot.root2matplotlib::replace(), edm::EventID::run(), DTTTrigCorrFirst::run, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), funct::true, and l1t::DataWriterExt::updateIOV().

43 {
44  using namespace edm;
45 
46  // Get L1TriggerKeyListExt
47  L1TriggerKeyListExt keyList ;
48  l1t::DataWriterExt dataWriter ;
49  if( !dataWriter.fillLastTriggerKeyList( keyList ) )
50  {
51  edm::LogError( "L1-O2O" )
52  << "Problem getting last L1TriggerKeyListExt" ;
53  }
54 
55  unsigned long long run = iEvent.id().run() ;
56 
57  L1TriggerKeyExt::RecordToKey recordTypeToKeyMap ;
58 
59  bool triggerKeyIOVUpdated = true ;
60 
61  // Start log string, convert run number into string
62  std::stringstream ss ;
63  ss << run ;
64  std::string log = "KEYLOG runNumber=" + ss.str() ;
65  bool logRecords = true ;
66 
67  if( !m_ignoreTriggerKey )
68  {
69  if( !m_tscKey.empty() )
70  {
71  edm::LogVerbatim( "L1-O2O" )
72  << "Object key for L1TriggerKeyExt@L1TriggerKeyExtRcd: "
73  << m_tscKey ;
74 
75  // Use TSC key and L1TriggerKeyListExt to find next run's
76  // L1TriggerKey token
77  std::string keyToken = keyList.token( m_tscKey ) ;
78 
79  // Update IOV sequence for this token with since-time = new run
80  triggerKeyIOVUpdated =
81  m_writer.updateIOV( "L1TriggerKeyExtRcd", keyToken, run, m_logTransactions ) ;
82 
83  // Read current L1TriggerKeyExt directly from ORCON using token
85  m_writer.readObject( keyToken, key ) ;
86 
87  recordTypeToKeyMap = key.recordToKeyMap() ;
88 
89  // Replace spaces in key with ?s. Do reverse substitution when
90  // making L1TriggerKeyExt.
91  std::string tmpKey = m_tscKey ;
92  replace( tmpKey.begin(), tmpKey.end(), ' ', '?' ) ;
93  log += " tscKey=" + tmpKey ;
94  logRecords = false ;
95  }
96  else
97  {
98  // For use with Run Settings, no corresponding L1TrigerKey in
99  // ORCON.
100 
101  // Get L1TriggerKeyExt from EventSetup
103  iSetup.get< L1TriggerKeyExtRcd >().get( esKey ) ;
104 
105  recordTypeToKeyMap = esKey->recordToKeyMap() ;
106  }
107  }
108  else
109  {
110  std::vector<std::string >::const_iterator
111  recordTypeItr = m_recordTypes.begin() ;
112  std::vector<std::string >::const_iterator
113  recordTypeEnd = m_recordTypes.end() ;
114 
115  for( ; recordTypeItr != recordTypeEnd ; ++recordTypeItr )
116  {
117  recordTypeToKeyMap.insert(
118  std::make_pair( *recordTypeItr, m_tscKey ) ) ;
119  }
120  }
121 
122  // If L1TriggerKeyExt IOV was already up to date, then so are all its
123  // sub-records.
124  bool throwException = false ;
125 
126  if( triggerKeyIOVUpdated || m_forceUpdate )
127  {
128  // Loop over record@type in L1TriggerKeyExt
129  L1TriggerKeyExt::RecordToKey::const_iterator itr =
130  recordTypeToKeyMap.begin() ;
131  L1TriggerKeyExt::RecordToKey::const_iterator end =
132  recordTypeToKeyMap.end() ;
133 
134  for( ; itr != end ; ++itr )
135  {
136  std::string recordType = itr->first ;
137  std::string objectKey = itr->second ;
138 
139  std::string recordName( recordType,
140  0, recordType.find_first_of("@") ) ;
141 
142  if( logRecords )
143  {
144  // Replace spaces in key with ?s. Do reverse substitution when
145  // making L1TriggerKeyExt.
146  std::string tmpKey = objectKey ;
147  replace( tmpKey.begin(), tmpKey.end(), ' ', '?' ) ;
148  log += " " + recordName + "Key=" + tmpKey ;
149  }
150 
151  // Do nothing if object key is null.
152  if( objectKey == L1TriggerKeyExt::kNullKey )
153  {
154  edm::LogVerbatim( "L1-O2O" )
155  << "L1CondDBIOVWriterExt: null object key for "
156  << recordType << "; skipping this record." ;
157  }
158  else
159  {
160  // Find payload token
161  edm::LogVerbatim( "L1-O2O" )
162  << "Object key for "
163  << recordType << ": " << objectKey ;
164 
165  std::string payloadToken = keyList.token( recordType,
166  objectKey ) ;
167  if( payloadToken.empty() )
168  {
169  edm::LogVerbatim( "L1-O2O" )
170  << "L1CondDBIOVWriterExt: empty payload token for " +
171  recordType + ", key " + objectKey ;
172 
173  throwException = true ;
174  }
175  else
176  {
178  payloadToken,
179  run,
181  }
182  }
183  }
184  }
185 
186  if( m_logKeys )
187  {
188  edm::LogVerbatim( "L1-O2O" ) << log ;
189  }
190 
191  if( throwException )
192  {
193  throw cond::Exception( "L1CondDBIOVWriterExt: empty payload tokens" ) ;
194  }
195 }
RunNumber_t run() const
Definition: EventID.h:39
persistency::Exception Exception
Definition: Exception.h:25
void readObject(const std::string &payloadToken, T &outputObject)
Definition: DataWriterExt.h:79
static const std::string kNullKey
tuple recordName
Definition: align_cfg.py:66
const RecordToKey & recordToKeyMap() const
bool updateIOV(const std::string &esRecordName, const std::string &payloadToken, edm::RunNumber_t sinceRun, bool logTransactions=false)
std::vector< std::string > m_recordTypes
#define end
Definition: vmac.h:37
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
std::map< std::string, std::string > RecordToKey
std::string m_tscKey
l1t::DataWriter m_writer ;
const T & get() const
Definition: EventSetup.h:56
l1t::DataWriterExt m_writer
edm::EventID id() const
Definition: EventBase.h:59
volatile std::atomic< bool > shutdown_flag false
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
void L1CondDBIOVWriterExt::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 200 of file L1CondDBIOVWriterExt.cc.

201 {
202 }
void L1CondDBIOVWriterExt::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 206 of file L1CondDBIOVWriterExt.cc.

206  {
207 }

Member Data Documentation

bool L1CondDBIOVWriterExt::m_forceUpdate
private

Definition at line 48 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().

bool L1CondDBIOVWriterExt::m_ignoreTriggerKey
private

Definition at line 42 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().

bool L1CondDBIOVWriterExt::m_logKeys
private

Definition at line 44 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().

bool L1CondDBIOVWriterExt::m_logTransactions
private

Definition at line 46 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().

std::vector< std::string > L1CondDBIOVWriterExt::m_recordTypes
private

Definition at line 35 of file L1CondDBIOVWriterExt.h.

Referenced by analyze(), and L1CondDBIOVWriterExt().

std::string L1CondDBIOVWriterExt::m_tscKey
private

l1t::DataWriter m_writer ;

Definition at line 31 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().

l1t::DataWriterExt L1CondDBIOVWriterExt::m_writer
private

Definition at line 28 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().