Skip to content

Commit

Permalink
Merge pull request #26976 from cms-sw/code-format-db-l1-b03e1e
Browse files Browse the repository at this point in the history
Running code-format for db-l1
  • Loading branch information
cmsbuild committed May 31, 2019
2 parents 42c89de + 1514b97 commit 2a58223
Show file tree
Hide file tree
Showing 39 changed files with 1,634 additions and 2,224 deletions.
1 change: 0 additions & 1 deletion CondCore/L1TPlugins/src/CSCTFRecords.cc
Expand Up @@ -9,4 +9,3 @@
REGISTER_PLUGIN(L1MuCSCTFConfigurationRcd, L1MuCSCTFConfiguration);
REGISTER_PLUGIN(L1MuCSCTFAlignmentRcd, L1MuCSCTFAlignment);
REGISTER_PLUGIN(L1MuCSCPtLutRcd, L1MuCSCPtLut);

1 change: 0 additions & 1 deletion CondCore/L1TPlugins/src/GCTRecords.cc
Expand Up @@ -8,4 +8,3 @@ REGISTER_PLUGIN(L1GctChannelMaskRcd, L1GctChannelMask);
#include "CondFormats/DataRecord/interface/L1GctJetFinderParamsRcd.h"

REGISTER_PLUGIN(L1GctJetFinderParamsRcd, L1GctJetFinderParams);

1 change: 0 additions & 1 deletion CondCore/L1TPlugins/src/GMTRecords.cc
Expand Up @@ -8,4 +8,3 @@ REGISTER_PLUGIN(L1MuGMTParametersRcd, L1MuGMTParameters);
#include "CondFormats/DataRecord/interface/L1MuGMTChannelMaskRcd.h"

REGISTER_PLUGIN(L1MuGMTChannelMaskRcd, L1MuGMTChannelMask);

1 change: 0 additions & 1 deletion CondCore/L1TPlugins/src/GTRecords1.cc
Expand Up @@ -21,4 +21,3 @@ REGISTER_PLUGIN(L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors);
#include "CondFormats/DataRecord/interface/L1GtStableParametersRcd.h"

REGISTER_PLUGIN(L1GtStableParametersRcd, L1GtStableParameters);

1 change: 0 additions & 1 deletion CondCore/L1TPlugins/src/GTRecords2.cc
Expand Up @@ -9,4 +9,3 @@ REGISTER_PLUGIN(L1GtTriggerMaskAlgoTrigRcd, L1GtTriggerMask);
REGISTER_PLUGIN(L1GtTriggerMaskTechTrigRcd, L1GtTriggerMask);
REGISTER_PLUGIN(L1GtTriggerMaskVetoAlgoTrigRcd, L1GtTriggerMask);
REGISTER_PLUGIN(L1GtTriggerMaskVetoTechTrigRcd, L1GtTriggerMask);

7 changes: 4 additions & 3 deletions CondCore/L1TPlugins/src/GTRecords3.cc
Expand Up @@ -3,8 +3,10 @@
#include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"

namespace {
struct L1GtTriggerMenuInitializer { void operator()(L1GtTriggerMenu & _) { _.buildGtConditionMap(); } };
}
struct L1GtTriggerMenuInitializer {
void operator()(L1GtTriggerMenu& _) { _.buildGtConditionMap(); }
};
} // namespace
REGISTER_PLUGIN_INIT(L1GtTriggerMenuRcd, L1GtTriggerMenu, L1GtTriggerMenuInitializer);

#include "CondFormats/L1TObjects/interface/L1GtPsbSetup.h"
Expand All @@ -16,4 +18,3 @@ REGISTER_PLUGIN(L1GtPsbSetupRcd, L1GtPsbSetup);
#include "CondFormats/DataRecord/interface/L1CaloGeometryRecord.h"

REGISTER_PLUGIN(L1CaloGeometryRecord, L1CaloGeometry);

1 change: 0 additions & 1 deletion CondCore/L1TPlugins/src/RCTRecords.cc
Expand Up @@ -23,4 +23,3 @@ REGISTER_PLUGIN(L1CaloEcalScaleRcd, L1CaloEcalScale);
#include "CondFormats/DataRecord/interface/L1CaloHcalScaleRcd.h"

REGISTER_PLUGIN(L1CaloHcalScaleRcd, L1CaloHcalScale);

1 change: 0 additions & 1 deletion CondCore/L1TPlugins/src/RPCRecords.cc
Expand Up @@ -18,4 +18,3 @@ REGISTER_PLUGIN(L1RPCHsbConfigRcd, L1RPCHsbConfig);
#include "CondFormats/DataRecord/interface/L1RPCBxOrConfigRcd.h"

REGISTER_PLUGIN(L1RPCBxOrConfigRcd, L1RPCBxOrConfig);

1 change: 0 additions & 1 deletion CondCore/L1TPlugins/src/UpgradeRecords1.cc
Expand Up @@ -10,4 +10,3 @@ REGISTER_PLUGIN(L1TCaloParamsO2ORcd, CaloParams);
REGISTER_PLUGIN(L1TCaloParamsRcd, CaloParams);
REGISTER_PLUGIN(L1TCaloStage2ParamsRcd, CaloParams);
REGISTER_PLUGIN(L1TCaloConfigRcd, CaloConfig);

23 changes: 11 additions & 12 deletions CondCore/L1TPlugins/src/UpgradeRecords2.cc
@@ -1,7 +1,7 @@
#include "CondCore/ESSources/interface/registration_macros.h"

#include "CondFormats/DataRecord/interface/L1TMuonEndcapParamsRcd.h" // Temporary copy to avoid crashes - AWB 28.08.17
// Required to satisfy current convention for "Record" in "Global Tag Entries"
#include "CondFormats/DataRecord/interface/L1TMuonEndcapParamsRcd.h" // Temporary copy to avoid crashes - AWB 28.08.17
// Required to satisfy current convention for "Record" in "Global Tag Entries"
// https://cms-conddb-prod.cern.ch/cmsDbBrowser/search/Prod/L1TMuonEndCapParams

#include "CondFormats/L1TObjects/interface/L1TMuonEndCapParams.h"
Expand All @@ -26,17 +26,16 @@
#include "CondFormats/DataRecord/interface/L1TMuonGlobalParamsRcd.h"
#include "CondFormats/DataRecord/interface/L1TMuonGlobalParamsO2ORcd.h"

REGISTER_PLUGIN(L1TMuonEndcapParamsRcd, L1TMuonEndCapParams); // Temporary copy to avoid crashes - AWB 28.08.17
REGISTER_PLUGIN(L1TMuonEndcapParamsRcd, L1TMuonEndCapParams); // Temporary copy to avoid crashes - AWB 28.08.17

REGISTER_PLUGIN(L1TMuonEndCapParamsRcd, L1TMuonEndCapParams);
REGISTER_PLUGIN(L1TMuonEndCapForestRcd, L1TMuonEndCapForest);
REGISTER_PLUGIN(L1TMuonEndCapParamsRcd, L1TMuonEndCapParams);
REGISTER_PLUGIN(L1TMuonEndCapForestRcd, L1TMuonEndCapForest);
REGISTER_PLUGIN(L1TMuonOverlapParamsRcd, L1TMuonOverlapParams);
REGISTER_PLUGIN(L1TMuonBarrelParamsRcd, L1TMuonBarrelParams);
REGISTER_PLUGIN(L1TMuonGlobalParamsRcd, L1TMuonGlobalParams);
REGISTER_PLUGIN(L1TMuonBarrelParamsRcd, L1TMuonBarrelParams);
REGISTER_PLUGIN(L1TMuonGlobalParamsRcd, L1TMuonGlobalParams);

REGISTER_PLUGIN(L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams);
REGISTER_PLUGIN(L1TMuonEndCapForestO2ORcd, L1TMuonEndCapForest);
REGISTER_PLUGIN(L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams);
REGISTER_PLUGIN(L1TMuonEndCapForestO2ORcd, L1TMuonEndCapForest);
REGISTER_PLUGIN(L1TMuonOverlapParamsO2ORcd, L1TMuonOverlapParams);
REGISTER_PLUGIN(L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams);
REGISTER_PLUGIN(L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams);

REGISTER_PLUGIN(L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams);
REGISTER_PLUGIN(L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams);
1 change: 0 additions & 1 deletion CondCore/L1TPlugins/src/UpgradeRecords3.cc
Expand Up @@ -22,4 +22,3 @@ REGISTER_PLUGIN(L1TUtmCutValueRcd, L1TUtmCutValue);
#include "CondFormats/L1TObjects/interface/L1TUtmObject.h"
#include "CondFormats/DataRecord/interface/L1TUtmObjectRcd.h"
REGISTER_PLUGIN(L1TUtmObjectRcd, L1TUtmObject);

57 changes: 25 additions & 32 deletions CondTools/L1Trigger/interface/DataManager.h
Expand Up @@ -6,43 +6,36 @@

#include <string>

namespace l1t
{
namespace l1t {

/* Helper class that provides common objects required to access Pool and Coral DB's.
/* Helper class that provides common objects required to access Pool and Coral DB's.
* This class will initialize connections and makes sure that they are closed
* when it is destroyed.
* Connections are initialized, but user is still responsible for opening and commiting
* them
*/
class DataManager
{
public:
DataManager() ;
explicit DataManager (const std::string & connectString,
const std::string & authenticationPath,
bool isOMDS = false );
virtual ~DataManager ();

void connect(const std::string & connectString,
const std::string & authenticationPath,
bool isOMDS = false );
void setDebug( bool debug ) ;

cond::persistency::Session dbSession()
{ return session ; }

protected:
//Returns type object for provided type name
edm::eventsetup::TypeTag findType (const std::string & type) ;

// Database connection management
cond::persistency::Session session;

private:
bool debugFlag = false;
};

}
class DataManager {
public:
DataManager();
explicit DataManager(const std::string& connectString, const std::string& authenticationPath, bool isOMDS = false);
virtual ~DataManager();

void connect(const std::string& connectString, const std::string& authenticationPath, bool isOMDS = false);
void setDebug(bool debug);

cond::persistency::Session dbSession() { return session; }

protected:
//Returns type object for provided type name
edm::eventsetup::TypeTag findType(const std::string& type);

// Database connection management
cond::persistency::Session session;

private:
bool debugFlag = false;
};

} // namespace l1t

#endif
119 changes: 54 additions & 65 deletions CondTools/L1Trigger/interface/DataWriter.h
Expand Up @@ -21,10 +21,9 @@
#include <string>
#include <map>

namespace l1t
{
namespace l1t {

/* This class is used to write L1 Trigger configuration data to Pool DB.
/* This class is used to write L1 Trigger configuration data to Pool DB.
* It also has a function for reading L1TriggerKey directly from Pool.
*
* In order to use this class to write payloads, user has to make sure to register datatypes that she or he is
Expand All @@ -33,68 +32,58 @@ namespace l1t
* REGISTER_PLUGIN(record, type) from registration_macros.h found in PluginSystem.
*/

class DataWriter
{
public:
DataWriter();
~DataWriter();

// Payload and IOV writing functions.

// Get payload from EventSetup and write to DB with no IOV
// recordType = "record@type", return value is payload token
std::string writePayload( const edm::EventSetup& setup,
const std::string& recordType ) ;

// Use PoolDBOutputService to append IOV with sinceRun to IOV sequence
// for given ESRecord. PoolDBOutputService knows the corresponding IOV tag.
// Return value is true if IOV was updated; false if IOV was already
// up to date.
bool updateIOV( const std::string& esRecordName,
const std::string& payloadToken,
edm::RunNumber_t sinceRun,
bool logTransactions = false ) ;

// Write L1TriggerKeyList payload and set IOV. Takes ownership of pointer.
void writeKeyList( L1TriggerKeyList* keyList,
edm::RunNumber_t sinceRun = 0,
bool logTransactions = false ) ;

// Read object directly from Pool, not from EventSetup.
template< class T >
void readObject( const std::string& payloadToken,
T& outputObject ) ;

std::string payloadToken( const std::string& recordName,
edm::RunNumber_t runNumber ) ;

std::string lastPayloadToken( const std::string& recordName ) ;

bool fillLastTriggerKeyList( L1TriggerKeyList& output ) ;

protected:
};

template< class T >
void DataWriter::readObject( const std::string& payloadToken,
T& outputObject )
{
edm::Service<cond::service::PoolDBOutputService> poolDb;
if( !poolDb.isAvailable() )
{
throw cond::Exception( "DataWriter: PoolDBOutputService not available."
) ;
class DataWriter {
public:
DataWriter();
~DataWriter();

// Payload and IOV writing functions.

// Get payload from EventSetup and write to DB with no IOV
// recordType = "record@type", return value is payload token
std::string writePayload(const edm::EventSetup& setup, const std::string& recordType);

// Use PoolDBOutputService to append IOV with sinceRun to IOV sequence
// for given ESRecord. PoolDBOutputService knows the corresponding IOV tag.
// Return value is true if IOV was updated; false if IOV was already
// up to date.
bool updateIOV(const std::string& esRecordName,
const std::string& payloadToken,
edm::RunNumber_t sinceRun,
bool logTransactions = false);

// Write L1TriggerKeyList payload and set IOV. Takes ownership of pointer.
void writeKeyList(L1TriggerKeyList* keyList, edm::RunNumber_t sinceRun = 0, bool logTransactions = false);

// Read object directly from Pool, not from EventSetup.
template <class T>
void readObject(const std::string& payloadToken, T& outputObject);

std::string payloadToken(const std::string& recordName, edm::RunNumber_t runNumber);

std::string lastPayloadToken(const std::string& recordName);

bool fillLastTriggerKeyList(L1TriggerKeyList& output);

protected:
};

template <class T>
void DataWriter::readObject(const std::string& payloadToken, T& outputObject) {
edm::Service<cond::service::PoolDBOutputService> poolDb;
if (!poolDb.isAvailable()) {
throw cond::Exception("DataWriter: PoolDBOutputService not available.");
}
cond::persistency::Session session = poolDb->session();
session.transaction().start(true);
// Get object from CondDB
std::shared_ptr<T> ref = session.fetchPayload<T>(payloadToken) ;
outputObject = *ref ;
session.transaction().commit ();
}

} // ns

cond::persistency::Session session = poolDb->session();
session.transaction().start(true);

// Get object from CondDB
std::shared_ptr<T> ref = session.fetchPayload<T>(payloadToken);
outputObject = *ref;
session.transaction().commit();
}

} // namespace l1t

#endif
38 changes: 16 additions & 22 deletions CondTools/L1Trigger/interface/Exception.h
Expand Up @@ -4,7 +4,7 @@
//
// Package: L1Trigger
// Class : Exception
//
//
/**\class Exception Exception.h CondTools/L1Trigger/interface/Exception.h
Description: <one line class summary>
Expand All @@ -29,50 +29,44 @@

namespace l1t {

class DataAlreadyPresentException : public cond::Exception
{

class DataAlreadyPresentException : public cond::Exception {
public:
explicit DataAlreadyPresentException( const std::string& message );
explicit DataAlreadyPresentException(const std::string& message);
~DataAlreadyPresentException() throw() override;

// ---------- const member functions ---------------------
// ---------- const member functions ---------------------

// ---------- static member functions --------------------
// ---------- static member functions --------------------

// ---------- member functions ---------------------------
// ---------- member functions ---------------------------

private:
private:
//DataAlreadyPresentException(const DataAlreadyPresentException&); // stop default

//const DataAlreadyPresentException& operator=(const DataAlreadyPresentException&); // stop default

// ---------- member data --------------------------------

// ---------- member data --------------------------------
};

class DataInvalidException : public cond::Exception
{

class DataInvalidException : public cond::Exception {
public:
explicit DataInvalidException( const std::string& message );
explicit DataInvalidException(const std::string& message);
~DataInvalidException() throw() override;

// ---------- const member functions ---------------------
// ---------- const member functions ---------------------

// ---------- static member functions --------------------
// ---------- static member functions --------------------

// ---------- member functions ---------------------------
// ---------- member functions ---------------------------

private:
private:
//DataInvalidException(const DataInvalidException&); // stop default

//const DataInvalidException& operator=(const DataInvalidException&); // stop default

// ---------- member data --------------------------------

// ---------- member data --------------------------------
};

}
} // namespace l1t

#endif

0 comments on commit 2a58223

Please sign in to comment.