DataManager

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#ifndef CondTools_L1Trigger_DataManager_h
#define CondTools_L1Trigger_DataManager_h

#include "FWCore/Framework/interface/DataKeyTags.h"
#include "CondCore/CondDB/interface/Session.h"

#include <string>

namespace l1t {

  /* 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;
  };

}  // namespace l1t

#endif