Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:45

0001 #ifndef DTHVStatusHandler_H
0002 #define DTHVStatusHandler_H
0003 /** \class DTHVStatusHandler
0004  *
0005  *  Description: Class to copy HV status via PopCon
0006  *
0007  *
0008  *  $Date: 2010/07/21 16:06:52 $
0009  *  $Revision: 1.6 $
0010  *  \author Paolo Ronchese INFN Padova
0011  *
0012  */
0013 
0014 //----------------------
0015 // Base Class Headers --
0016 //----------------------
0017 #include "CondCore/PopCon/interface/PopConSourceHandler.h"
0018 
0019 //------------------------------------
0020 // Collaborating Class Declarations --
0021 //------------------------------------
0022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0023 #include "CondCore/CondDB/interface/Session.h"
0024 #include "CondFormats/DTObjects/interface/DTHVStatus.h"
0025 #include <string>
0026 
0027 namespace coral {
0028   class TimeStamp;
0029 }
0030 #include "CondTools/DT/interface/DTHVAbstractCheck.h"
0031 
0032 //---------------
0033 // C++ Headers --
0034 //---------------
0035 
0036 //              ---------------------
0037 //              -- Class Interface --
0038 //              ---------------------
0039 
0040 class DTHVStatusHandler : public popcon::PopConSourceHandler<DTHVStatus> {
0041 public:
0042   /** Constructor
0043    */
0044   DTHVStatusHandler(const edm::ParameterSet& ps);
0045 
0046   /** Destructor
0047    */
0048   ~DTHVStatusHandler() override;
0049 
0050   /** Operations
0051    */
0052   ///
0053   void getNewObjects() override;
0054   std::string id() const override;
0055 
0056 private:
0057   typedef DTHVAbstractCheck::timedMeasurement timedMeasurement;
0058   typedef std::pair<int, float> channelValue;
0059 
0060   void checkNewData();
0061 
0062   void getChannelMap();
0063   void getLayerSplit();
0064   void getChannelSplit();
0065   void dumpHVAliases();
0066 
0067   void createSnapshot();
0068   int recoverSnapshot();
0069   cond::Time_t recoverLastTime();
0070   void dumpSnapshot(const coral::TimeStamp& time);
0071   void updateHVStatus();
0072   int checkForPeriod(cond::Time_t condSince, cond::Time_t condUntil, int& missingChannels, bool copyOffline);
0073 
0074   void copyHVData();
0075   DTHVStatus* offlineList();
0076   void getLayerValues(int rawId, int type, float& valueL, float& valueR, float& valueS, float& valueC);
0077   void setChannelFlag(
0078       DTHVStatus* hv, int whe, int sta, int sec, int qua, int lay, int l_p, const DTHVAbstractCheck::flag& flag);
0079 
0080   int checkStatusChange(int type, float oldValue, float newValue);
0081   void filterData();
0082 
0083   static DTWireId layerId(int rawId, int l_p);
0084   static coral::TimeStamp coralTime(const cond::Time_t& time);
0085   static cond::Time_t condTime(const coral::TimeStamp& time);
0086   static cond::Time_t condTime(long long int time);
0087 
0088   std::string dataTag;
0089   std::string onlineConnect;
0090   std::string utilConnect;
0091   std::string onlineAuthentication;
0092   std::string bufferConnect;
0093   DTHVStatus* lastStatus;
0094 
0095   int ySince;
0096   int mSince;
0097   int dSince;
0098   int hSince;
0099   int pSince;
0100   int sSince;
0101   int yUntil;
0102   int mUntil;
0103   int dUntil;
0104   int hUntil;
0105   int pUntil;
0106   int sUntil;
0107   bool dumpAtStart;
0108   bool dumpAtEnd;
0109   long long int bwdTime;
0110   long long int fwdTime;
0111   long long int minTime;
0112 
0113   std::map<int, timedMeasurement> snapshotValues;
0114   DTHVAbstractCheck* hvChecker;
0115 
0116   cond::Time_t procSince;
0117   cond::Time_t procUntil;
0118   cond::Time_t lastFound;
0119   cond::Time_t nextFound;
0120   cond::Time_t timeLimit;
0121   long long int lastStamp;
0122   int maxPayload;
0123 
0124   cond::persistency::Session omds_session;
0125   cond::persistency::Session util_session;
0126   cond::persistency::Session buff_session;
0127 
0128   std::string mapVersion;
0129   std::string splitVersion;
0130   std::map<int, int> aliasMap;
0131   std::map<int, int> layerMap;
0132   std::map<int, int> laySplit;
0133   std::map<int, std::vector<int>*> channelSplit;
0134   std::vector<std::pair<DTHVStatus*, cond::Time_t> > tmpContainer;
0135   bool switchOff;
0136 };
0137 
0138 #endif  // DTHVStatusHandler_H