Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:50

0001 #ifndef LMFRUNIOV_H
0002 #define LMFRUNIOV_H
0003 
0004 #include "OnlineDB/EcalCondDB/interface/LMFUnique.h"
0005 #include "OnlineDB/EcalCondDB/interface/LMFRunTag.h"
0006 #include "OnlineDB/EcalCondDB/interface/LMFSeqDat.h"
0007 #include "OnlineDB/EcalCondDB/interface/LMFTrigType.h"
0008 #include "OnlineDB/EcalCondDB/interface/LMFColor.h"
0009 #include "OnlineDB/EcalCondDB/interface/LMFDefFabric.h"
0010 #include "OnlineDB/EcalCondDB/interface/Tm.h"
0011 
0012 #include <string>
0013 
0014 /*
0015  Last updated by  Giovanni.Organtini@roma1.infn.it 2010
0016 */
0017 
0018 class LMFRunIOV : public LMFUnique {
0019 public:
0020   friend class EcalCondDBInterface;
0021 
0022   LMFRunIOV();
0023   LMFRunIOV(oracle::occi::Environment *env, oracle::occi::Connection *conn);
0024   LMFRunIOV(EcalDBConnection *c);
0025   LMFRunIOV(const LMFRunIOV &r);
0026   ~LMFRunIOV() override;
0027 
0028   // Methods for user data
0029   LMFRunIOV &setLMFRunTag(const LMFRunTag &tag);
0030   LMFRunIOV &setLMFRunTag(int tag_id);
0031   LMFRunIOV &setSequence(LMFSeqDat &seq);
0032   LMFRunIOV &setSequence(LMFSeqDat *seq);
0033   LMFRunIOV &setTriggerType(LMFTrigType &tt);
0034   LMFRunIOV &setTriggerType(int trigType_id);
0035   LMFRunIOV &setTriggerType(std::string trigShortName);
0036   LMFRunIOV &setLmr(int n);
0037   LMFRunIOV &setColor(const LMFColor &c);
0038   LMFRunIOV &setColor(std::string name);
0039   LMFRunIOV &setColor(int color_id);
0040   LMFRunIOV &setColorIndex(int color_index);
0041   LMFRunIOV &setSubRunStart(const Tm &start);
0042   LMFRunIOV &setSubRunEnd(const Tm &end);
0043   LMFRunIOV &setSubRunType(const std::string &x);
0044 
0045   LMFRunTag getLMFRunTag() const;
0046   LMFSeqDat getSequence() const;
0047   LMFTrigType getTriggerType() const;
0048 
0049   int getLmr() const;
0050   std::string getSubRunType() const;
0051   std::string getColorShortName() const;
0052   std::string getColorLongName() const;
0053   LMFColor getLMFColor() const;
0054   LMFColor getColor() const { return getLMFColor(); }
0055   Tm getSubRunStart() const;
0056   Tm getSubRunEnd() const;
0057   Tm getDBInsertionTime() const;
0058   bool isValid() override;
0059 
0060   void dump() const override;
0061   virtual LMFRunIOV &operator=(const LMFRunIOV &r);
0062   std::list<LMFRunIOV> fetchBySequence(const LMFSeqDat &s);
0063   std::list<LMFRunIOV> fetchBySequence(const LMFSeqDat &s, int lmr);
0064   std::list<LMFRunIOV> fetchBySequence(const LMFSeqDat &s, int lmr, int type, int color);
0065   std::list<LMFRunIOV> fetchLastBeforeSequence(const LMFSeqDat &s, int lmr, int type, int color);
0066 
0067   // Operators
0068   bool operator==(const LMFRunIOV &m) const {
0069     return (getLMFRunTag() == m.getLMFRunTag() && getSequence() == m.getSequence() && getLmr() == m.getLmr() &&
0070             getLMFColor() == m.getLMFColor() && getTriggerType() == m.getTriggerType() &&
0071             getSubRunType() == m.getSubRunType() && getSubRunStart() == m.getSubRunStart() &&
0072             getSubRunEnd() == m.getSubRunEnd());
0073   }
0074 
0075   bool operator!=(const LMFRunIOV &m) const { return !(*this == m); }
0076 
0077   std::string fetchIdSql(Statement *stmt) override;
0078   std::string setByIDSql(Statement *stmt, int id) override;
0079   std::string writeDBSql(Statement *stmt) override;
0080   void getParameters(ResultSet *rset) override;
0081 
0082 private:
0083   void checkFabric();
0084   void initialize();
0085   std::list<LMFRunIOV> fetchBySequence(const std::vector<int> &par,
0086                                        const std::string &sql,
0087                                        const std::string &method) noexcept(false);
0088 
0089   LMFDefFabric *_fabric;
0090 };
0091 
0092 #endif