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
L1CondDBPayloadWriterExt Class Reference

#include <L1CondDBPayloadWriterExt.h>

Inheritance diagram for L1CondDBPayloadWriterExt:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1CondDBPayloadWriterExt (const edm::ParameterSet &)
 
 ~L1CondDBPayloadWriterExt ()
 
- 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_logTransactions
 
bool m_newL1TriggerKeyListExt
 
bool m_overwriteKeys
 
bool m_writeConfigData
 
bool m_writeL1TriggerKeyExt
 
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 15 of file L1CondDBPayloadWriterExt.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file L1CondDBPayloadWriterExt.cc.

11  : m_writeL1TriggerKeyExt( iConfig.getParameter< bool >( "writeL1TriggerKeyExt" )),
12  m_writeConfigData( iConfig.getParameter< bool >( "writeConfigData" ) ),
13  m_overwriteKeys( iConfig.getParameter< bool >( "overwriteKeys" ) ),
14  m_logTransactions( iConfig.getParameter<bool>( "logTransactions" ) ),
15  m_newL1TriggerKeyListExt( iConfig.getParameter< bool >( "newL1TriggerKeyListExt" ) )
16 {
17  //now do what ever initialization is needed
18 
19 }
T getParameter(std::string const &) const
L1CondDBPayloadWriterExt::~L1CondDBPayloadWriterExt ( )

Definition at line 22 of file L1CondDBPayloadWriterExt.cc.

23 {
24 
25  // do anything here that needs to be done at desctruction time
26  // (e.g. close files, deallocate resources etc.)
27 
28 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 33 of file L1CondDBPayloadWriterExt.cc.

References end, edm::false, l1t::DataWriterExt::fillLastTriggerKeyList(), edm::EventSetup::get(), relval_steps::key, L1TriggerKeyExt::kNullKey, m_logTransactions, m_newL1TriggerKeyListExt, m_overwriteKeys, m_writeConfigData, m_writeL1TriggerKeyExt, m_writer, AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), unpackBuffers-CaloStage2::token, funct::true, cms::Exception::what(), l1t::DataWriterExt::writeKeyList(), and l1t::DataWriterExt::writePayload().

35 {
36  using namespace edm;
37 
38  // Get L1TriggerKeyListExt and make a copy
39  L1TriggerKeyListExt oldKeyList ;
40 
42  {
43  if( !m_writer.fillLastTriggerKeyList( oldKeyList ) )
44  {
45  edm::LogError( "L1-O2O" )
46  << "Problem getting last L1TriggerKeyListExt" ;
47  }
48  }
49 
50  L1TriggerKeyListExt* keyList = 0 ;
51 
52  // Write L1TriggerKeyExt to ORCON with no IOV
55 
56  // Before calling writePayload(), check if TSC key is already in
57  // L1TriggerKeyListExt. writePayload() will not catch this situation in
58  // the case of dummy configurations.
59  bool triggerKeyOK = true ;
60  try
61  {
62  // Get L1TriggerKeyExt
63  iSetup.get< L1TriggerKeyExtRcd >().get( key ) ;
64 
65  if( !m_overwriteKeys )
66  {
67  triggerKeyOK = oldKeyList.token( key->tscKey() ) == "" ;
68  }
69  }
71  {
72  triggerKeyOK = false ;
73  edm::LogVerbatim( "L1-O2O" ) << ex.what() ;
74  }
75 
76  if( triggerKeyOK && m_writeL1TriggerKeyExt )
77  {
78  edm::LogVerbatim( "L1-O2O" )
79  << "Object key for L1TriggerKeyExtRcd@L1TriggerKeyExt: "
80  << key->tscKey() ;
81  token = m_writer.writePayload( iSetup,
82  "L1TriggerKeyExtRcd@L1TriggerKeyExt" ) ;
83  }
84 
85  // If L1TriggerKeyExt is invalid, then all configuration data is already in DB
86  bool throwException = false ;
87 
88  if( !token.empty() || !m_writeL1TriggerKeyExt )
89  {
90  // Record token in L1TriggerKeyListExt
92  {
93  keyList = new L1TriggerKeyListExt( oldKeyList ) ;
94  if( !( keyList->addKey( key->tscKey(),
95  token,
96  m_overwriteKeys ) ) )
97  {
98  throw cond::Exception( "L1CondDBPayloadWriter: TSC key "
99  + key->tscKey()
100  + " already in L1TriggerKeyListExt" ) ;
101  }
102  }
103 
104  if( m_writeConfigData )
105  {
106  // Loop over record@type in L1TriggerKeyExt
107  L1TriggerKeyExt::RecordToKey::const_iterator it =
108  key->recordToKeyMap().begin() ;
109  L1TriggerKeyExt::RecordToKey::const_iterator end =
110  key->recordToKeyMap().end() ;
111 
112  for( ; it != end ; ++it )
113  {
114  // Do nothing if object key is null.
115  if( it->second == L1TriggerKeyExt::kNullKey )
116  {
117  edm::LogVerbatim( "L1-O2O" )
118  << "L1CondDBPayloadWriter: null object key for "
119  << it->first << "; skipping this record." ;
120  }
121  else
122  {
123  // Check key is new before writing
124  if( oldKeyList.token( it->first, it->second ) == "" ||
126  {
127  // Write data to ORCON with no IOV
128  if( oldKeyList.token( it->first, it->second ) != "" )
129  {
130  edm::LogVerbatim( "L1-O2O" )
131  << "*** Overwriting payload: object key for "
132  << it->first << ": " << it->second ;
133  }
134  else
135  {
136  edm::LogVerbatim( "L1-O2O" )
137  << "object key for "
138  << it->first << ": " << it->second ;
139  }
140 
141  try
142  {
143  token = m_writer.writePayload( iSetup, it->first ) ;
144  }
145  catch( l1t::DataInvalidException& ex )
146  {
147  edm::LogVerbatim( "L1-O2O" )
148  << ex.what()
149  << " Skipping to next record." ;
150 
151  throwException = true ;
152 
153  continue ;
154  }
155 
156  if( !token.empty() )
157  {
158  // Record token in L1TriggerKeyListExt
159  if( !keyList )
160  {
161  keyList = new L1TriggerKeyListExt( oldKeyList ) ;
162  }
163 
164  if( !( keyList->addKey( it->first,
165  it->second,
166  token,
167  m_overwriteKeys ) ) )
168  {
169  // This should never happen because of the check
170  // above, but just in case....
171  throw cond::Exception(
172  "L1CondDBPayloadWriter: subsystem key "
173  + it->second + " for " + it->first
174  + " already in L1TriggerKeyListExt" ) ;
175  }
176  }
177  }
178  else
179  {
180  edm::LogVerbatim( "L1-O2O" )
181  << "L1CondDBPayloadWriter: object key "
182  << it->second << " for " << it->first
183  << " already in L1TriggerKeyListExt" ;
184  }
185  }
186  }
187  }
188  }
189 
190  if( keyList )
191  {
192  // Write L1TriggerKeyListExt to ORCON
193  m_writer.writeKeyList( keyList, 0, m_logTransactions ) ;
194  }
195 
196  if( throwException )
197  {
198  throw l1t::DataInvalidException( "Payload problem found." ) ;
199  }
200 }
persistency::Exception Exception
Definition: Exception.h:25
virtual char const * what() const
Definition: Exception.cc:141
bool fillLastTriggerKeyList(L1TriggerKeyListExt &output)
static const std::string kNullKey
void writeKeyList(L1TriggerKeyListExt *keyList, edm::RunNumber_t sinceRun=0, bool logTransactions=false)
#define end
Definition: vmac.h:37
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
const T & get() const
Definition: EventSetup.h:56
std::string writePayload(const edm::EventSetup &setup, const std::string &recordType)
volatile std::atomic< bool > shutdown_flag false
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
void L1CondDBPayloadWriterExt::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 205 of file L1CondDBPayloadWriterExt.cc.

206 {
207 }
void L1CondDBPayloadWriterExt::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 211 of file L1CondDBPayloadWriterExt.cc.

211  {
212 }

Member Data Documentation

bool L1CondDBPayloadWriterExt::m_logTransactions
private

Definition at line 39 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_newL1TriggerKeyListExt
private

Definition at line 42 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_overwriteKeys
private

Definition at line 37 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_writeConfigData
private

Definition at line 34 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_writeL1TriggerKeyExt
private

Definition at line 31 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

l1t::DataWriterExt L1CondDBPayloadWriterExt::m_writer
private

Definition at line 27 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().