DTHVStatusHandler

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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
#ifndef DTHVStatusHandler_H
#define DTHVStatusHandler_H
/** \class DTHVStatusHandler
 *
 *  Description: Class to copy HV status via PopCon
 *
 *
 *  $Date: 2010/07/21 16:06:52 $
 *  $Revision: 1.6 $
 *  \author Paolo Ronchese INFN Padova
 *
 */

//----------------------
// Base Class Headers --
//----------------------
#include "CondCore/PopCon/interface/PopConSourceHandler.h"

//------------------------------------
// Collaborating Class Declarations --
//------------------------------------
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "CondCore/CondDB/interface/Session.h"
#include "CondFormats/DTObjects/interface/DTHVStatus.h"
#include <string>

namespace coral {
  class TimeStamp;
}
#include "CondTools/DT/interface/DTHVAbstractCheck.h"

//---------------
// C++ Headers --
//---------------

//              ---------------------
//              -- Class Interface --
//              ---------------------

class DTHVStatusHandler : public popcon::PopConSourceHandler<DTHVStatus> {
public:
  /** Constructor
   */
  DTHVStatusHandler(const edm::ParameterSet& ps);

  /** Destructor
   */
  ~DTHVStatusHandler() override;

  /** Operations
   */
  ///
  void getNewObjects() override;
  std::string id() const override;

private:
  typedef DTHVAbstractCheck::timedMeasurement timedMeasurement;
  typedef std::pair<int, float> channelValue;

  void checkNewData();

  void getChannelMap();
  void getLayerSplit();
  void getChannelSplit();
  void dumpHVAliases();

  void createSnapshot();
  int recoverSnapshot();
  cond::Time_t recoverLastTime();
  void dumpSnapshot(const coral::TimeStamp& time);
  void updateHVStatus();
  int checkForPeriod(cond::Time_t condSince, cond::Time_t condUntil, int& missingChannels, bool copyOffline);

  void copyHVData();
  DTHVStatus* offlineList();
  void getLayerValues(int rawId, int type, float& valueL, float& valueR, float& valueS, float& valueC);
  void setChannelFlag(
      DTHVStatus* hv, int whe, int sta, int sec, int qua, int lay, int l_p, const DTHVAbstractCheck::flag& flag);

  int checkStatusChange(int type, float oldValue, float newValue);
  void filterData();

  static DTWireId layerId(int rawId, int l_p);
  static coral::TimeStamp coralTime(const cond::Time_t& time);
  static cond::Time_t condTime(const coral::TimeStamp& time);
  static cond::Time_t condTime(long long int time);

  std::string dataTag;
  std::string onlineConnect;
  std::string utilConnect;
  std::string onlineAuthentication;
  std::string bufferConnect;
  DTHVStatus* lastStatus;

  int ySince;
  int mSince;
  int dSince;
  int hSince;
  int pSince;
  int sSince;
  int yUntil;
  int mUntil;
  int dUntil;
  int hUntil;
  int pUntil;
  int sUntil;
  bool dumpAtStart;
  bool dumpAtEnd;
  long long int bwdTime;
  long long int fwdTime;
  long long int minTime;

  std::map<int, timedMeasurement> snapshotValues;
  DTHVAbstractCheck* hvChecker;

  cond::Time_t procSince;
  cond::Time_t procUntil;
  cond::Time_t lastFound;
  cond::Time_t nextFound;
  cond::Time_t timeLimit;
  long long int lastStamp;
  int maxPayload;

  cond::persistency::Session omds_session;
  cond::persistency::Session util_session;
  cond::persistency::Session buff_session;

  std::string mapVersion;
  std::string splitVersion;
  std::map<int, int> aliasMap;
  std::map<int, int> layerMap;
  std::map<int, int> laySplit;
  std::map<int, std::vector<int>*> channelSplit;
  std::vector<std::pair<DTHVStatus*, cond::Time_t> > tmpContainer;
  bool switchOff;
};

#endif  // DTHVStatusHandler_H