CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
DTHVStatusHandler Class Reference

#include <DTHVStatusHandler.h>

Inheritance diagram for DTHVStatusHandler:
popcon::PopConSourceHandler< DTHVStatus >

Public Member Functions

 DTHVStatusHandler (const edm::ParameterSet &ps)
 
void getNewObjects () override
 
std::string id () const override
 
 ~DTHVStatusHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< DTHVStatus >
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const *, std::string const > operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Private Types

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

Private Member Functions

int checkForPeriod (cond::Time_t condSince, cond::Time_t condUntil, int &missingChannels, bool copyOffline)
 
void checkNewData ()
 
int checkStatusChange (int type, float oldValue, float newValue)
 
void copyHVData ()
 
void createSnapshot ()
 
void dumpHVAliases ()
 
void dumpSnapshot (const coral::TimeStamp &time)
 
void filterData ()
 
void getChannelMap ()
 
void getChannelSplit ()
 
void getLayerSplit ()
 
void getLayerValues (int rawId, int type, float &valueL, float &valueR, float &valueS, float &valueC)
 
DTHVStatusofflineList ()
 
cond::Time_t recoverLastTime ()
 
int recoverSnapshot ()
 
void setChannelFlag (DTHVStatus *hv, int whe, int sta, int sec, int qua, int lay, int l_p, const DTHVAbstractCheck::flag &flag)
 
void updateHVStatus ()
 

Static Private Member Functions

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

Private Attributes

std::map< int, int > aliasMap
 
cond::persistency::Session buff_session
 
std::string bufferConnect
 
long long int bwdTime
 
std::map< int, std::vector< int > * > channelSplit
 
std::string dataTag
 
int dSince
 
bool dumpAtEnd
 
bool dumpAtStart
 
int dUntil
 
long long int fwdTime
 
int hSince
 
int hUntil
 
DTHVAbstractCheckhvChecker
 
cond::Time_t lastFound
 
long long int lastStamp
 
DTHVStatuslastStatus
 
std::map< int, int > layerMap
 
std::map< int, int > laySplit
 
std::string mapVersion
 
int maxPayload
 
long long int minTime
 
int mSince
 
int mUntil
 
cond::Time_t nextFound
 
cond::persistency::Session omds_session
 
std::string onlineAuthentication
 
std::string onlineConnect
 
cond::Time_t procSince
 
cond::Time_t procUntil
 
int pSince
 
int pUntil
 
std::map< int, timedMeasurementsnapshotValues
 
std::string splitVersion
 
int sSince
 
int sUntil
 
bool switchOff
 
cond::Time_t timeLimit
 
std::vector< std::pair< DTHVStatus *, cond::Time_t > > tmpContainer
 
cond::persistency::Session util_session
 
std::string utilConnect
 
int ySince
 
int yUntil
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< DTHVStatus >
typedef std::map< Time_t, std::shared_ptr< DTHVStatus > > Container
 
typedef std::unique_ptr< DTHVStatusRef
 
typedef PopConSourceHandler< DTHVStatusself
 
typedef cond::Time_t Time_t
 
typedef DTHVStatus value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< DTHVStatus >
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< DTHVStatus >
Container m_iovs
 
std::vector< std::pair< DTHVStatus *, Time_t > > m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Description: Class to copy HV status via PopCon

Date
2010/07/21 16:06:52
Revision
1.6
Author
Paolo Ronchese INFN Padova

Definition at line 40 of file DTHVStatusHandler.h.

Member Typedef Documentation

◆ channelValue

typedef std::pair<int, float> DTHVStatusHandler::channelValue
private

Definition at line 58 of file DTHVStatusHandler.h.

◆ timedMeasurement

Definition at line 57 of file DTHVStatusHandler.h.

Constructor & Destructor Documentation

◆ DTHVStatusHandler()

DTHVStatusHandler::DTHVStatusHandler ( const edm::ParameterSet ps)

Constructor

Definition at line 49 of file DTHVStatusHandler.cc.

References gather_cfg::cout, DTHVAbstractCheck::getInstance(), hvChecker, maxPayload, and onlineAuthentication.

50  : dataTag(ps.getParameter<std::string>("tag")),
51  onlineConnect(ps.getParameter<std::string>("onlineDB")),
52  utilConnect(ps.getParameter<std::string>("utilDB")),
53  onlineAuthentication(ps.getParameter<std::string>("onlineAuthentication")),
54  bufferConnect(ps.getParameter<std::string>("bufferDB")),
55  ySince(ps.getParameter<int>("sinceYear")),
56  mSince(ps.getParameter<int>("sinceMonth")),
57  dSince(ps.getParameter<int>("sinceDay")),
58  hSince(ps.getParameter<int>("sinceHour")),
59  pSince(ps.getParameter<int>("sinceMinute")),
60  sSince(ps.getParameter<int>("sinceSecond")),
61  yUntil(ps.getParameter<int>("untilYear")),
62  mUntil(ps.getParameter<int>("untilMonth")),
63  dUntil(ps.getParameter<int>("untilDay")),
64  hUntil(ps.getParameter<int>("untilHour")),
65  pUntil(ps.getParameter<int>("untilMinute")),
66  sUntil(ps.getParameter<int>("untilSecond")),
67  dumpAtStart(ps.getParameter<bool>("dumpAtStart")),
68  dumpAtEnd(ps.getParameter<bool>("dumpAtEnd")),
69  bwdTime(ps.getParameter<long long int>("bwdTime")),
70  fwdTime(ps.getParameter<long long int>("fwdTime")),
71  minTime(ps.getParameter<long long int>("minTime")),
72  omds_session(),
73  util_session(),
74  buff_session(),
75  mapVersion(ps.getParameter<std::string>("mapVersion")),
76  splitVersion(ps.getParameter<std::string>("splitVersion")) {
77  std::cout << " PopCon application for DT HV data export " << onlineAuthentication << std::endl;
79  maxPayload = 1000;
80 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
long long int minTime
cond::persistency::Session omds_session
cond::persistency::Session buff_session
std::string onlineConnect
cond::persistency::Session util_session
long long int fwdTime
std::string utilConnect
static DTHVAbstractCheck * getInstance()
check HV status
long long int bwdTime
std::string onlineAuthentication
DTHVAbstractCheck * hvChecker
std::string bufferConnect
std::string splitVersion

◆ ~DTHVStatusHandler()

DTHVStatusHandler::~DTHVStatusHandler ( )
override

Destructor

Definition at line 85 of file DTHVStatusHandler.cc.

85 {}

Member Function Documentation

◆ checkForPeriod()

int DTHVStatusHandler::checkForPeriod ( cond::Time_t  condSince,
cond::Time_t  condUntil,
int &  missingChannels,
bool  copyOffline 
)
private

Definition at line 735 of file DTHVStatusHandler.cc.

References DTHVStatus::begin(), officialStyle::chan, checkStatusChange(), condTime(), generateEDF::cont, coralTime(), gather_cfg::cout, Calorimetry_cff::dp, DTHVStatus::end(), mps_splice::entry, lastFound, lastStamp, maxPayload, minTime, nextFound, cond::persistency::Session::nominalSchema(), offlineList(), omds_session, procUntil, snapshotValues, timeLimit, and tmpContainer.

Referenced by copyHVData(), and updateHVStatus().

738  {
739  std::map<int, timedMeasurement>::iterator mapIter = snapshotValues.begin();
740  std::map<int, timedMeasurement>::iterator mapIend = snapshotValues.end();
741 
742  std::map<long long int, channelValue> periodBuffer;
743 
744  coral::ITable& fwccTable = omds_session.nominalSchema().tableHandle("FWCAENCHANNEL");
745  std::unique_ptr<coral::IQuery> fwccQuery(fwccTable.newQuery());
746  fwccQuery->addToOutputList("DPID");
747  fwccQuery->addToOutputList("CHANGE_DATE");
748  fwccQuery->addToOutputList("ACTUAL_VMON");
749  fwccQuery->addToOutputList("ACTUAL_IMON");
750  fwccQuery->addToOutputList("ACTUAL_ISON");
751  fwccQuery->addToOutputList("ACTUAL_STATUS");
752  fwccQuery->addToOutputList("ACTUAL_OVC");
753  coral::AttributeList timeBindVariableList;
754  timeBindVariableList.extend("since", typeid(coral::TimeStamp));
755  timeBindVariableList.extend("until", typeid(coral::TimeStamp));
756  coral::TimeStamp coralSince = coralTime(condSince);
757  coral::TimeStamp coralUntil = coralTime(condUntil);
758  std::cout << "look for data since " << coralSince.year() << " " << coralSince.month() << " " << coralSince.day()
759  << " " << coralSince.hour() << ":" << coralSince.minute() << ":" << coralSince.second() << " until "
760  << coralUntil.year() << " " << coralUntil.month() << " " << coralUntil.day() << " " << coralUntil.hour()
761  << ":" << coralUntil.minute() << ":" << coralUntil.second() << std::endl;
762  timeBindVariableList["since"].data<coral::TimeStamp>() = coralTime(condSince);
763  timeBindVariableList["until"].data<coral::TimeStamp>() = coralTime(condUntil);
764  fwccQuery->setCondition("CHANGE_DATE>:since and CHANGE_DATE<:until", timeBindVariableList);
765  fwccQuery->addToOrderList("CHANGE_DATE");
766  coral::ICursor& fwccCursor = fwccQuery->execute();
767  int nrows = 0;
768  while (fwccCursor.next()) {
769  nrows++;
770  const coral::Attribute& dp = fwccCursor.currentRow()["DPID"];
771  const coral::Attribute& vmon = fwccCursor.currentRow()["ACTUAL_VMON"];
772  const coral::Attribute& imon = fwccCursor.currentRow()["ACTUAL_IMON"];
773  coral::TimeStamp changeTime = fwccCursor.currentRow()["CHANGE_DATE"].data<coral::TimeStamp>();
774  long long int cTimeValue = changeTime.total_nanoseconds();
775  if (!copyOffline)
776  cTimeValue = -cTimeValue;
777  if (dp.isNull()) {
778  std::cout << "------- " << nrows << std::endl;
779  continue;
780  }
781  int dpId = 10 * static_cast<int>(0.01 + fwccCursor.currentRow()["DPID"].data<float>());
782  if (!(vmon.isNull())) {
783  while (periodBuffer.find(cTimeValue) != periodBuffer.end())
784  cTimeValue++;
785  int chan = dpId + 1;
786  periodBuffer.insert(std::pair<long long int, channelValue>(cTimeValue, channelValue(chan, vmon.data<float>())));
787  }
788  if (!(imon.isNull())) {
789  while (periodBuffer.find(cTimeValue) != periodBuffer.end())
790  cTimeValue++;
791  int chan = dpId + 2;
792  periodBuffer.insert(std::pair<long long int, channelValue>(cTimeValue, channelValue(chan, imon.data<float>())));
793  }
794  }
795 
796  long long int dTime = minTime;
797  dTime <<= 32;
798  std::cout << "data found in period: " << periodBuffer.size() << std::endl;
799  std::map<long long int, channelValue>::const_iterator bufIter = periodBuffer.begin();
800  std::map<long long int, channelValue>::const_iterator bufIend = periodBuffer.end();
801 
802  bool changedStatus = false;
803  while (bufIter != bufIend) {
804  const std::pair<long long int, channelValue>& entry = *bufIter++;
805  long long int mTime = entry.first;
806  if (!copyOffline)
807  mTime = -mTime;
808  channelValue cValue = entry.second;
809  int chan = cValue.first;
810  float cont = cValue.second;
811  mapIter = snapshotValues.find(chan);
812  if ((mapIter != mapIend) && (mapIter->second.first < mTime)) {
813  nextFound = condTime(mTime);
814  if (changedStatus) {
815  if (nextFound > timeLimit) {
816  DTHVStatus* hvStatus = offlineList();
817  std::cout << "new payload " << hvStatus->end() - hvStatus->begin() << std::endl;
818  tmpContainer.push_back(std::make_pair(hvStatus, lastFound));
819  changedStatus = false;
820  if (!(--maxPayload)) {
822  std::cout << "max payload number reached" << std::endl;
823  break;
824  }
825  }
826  }
827  if (copyOffline && !changedStatus && checkStatusChange(chan, mapIter->second.second, cont)) {
828  timeLimit = nextFound + dTime;
829  changedStatus = true;
830  }
831  mapIter->second = timedMeasurement(lastStamp = mTime, cont);
833  missingChannels--;
834  }
835  }
836 
837  std::cout << nrows << std::endl;
838  return nrows;
839 }
long long int lastStamp
DTHVAbstractCheck::timedMeasurement timedMeasurement
cond::Time_t lastFound
long long int minTime
cond::persistency::Session omds_session
cond::Time_t procUntil
DTHVStatus * offlineList()
static coral::TimeStamp coralTime(const cond::Time_t &time)
std::vector< std::pair< DTHVStatus *, cond::Time_t > > tmpContainer
int checkStatusChange(int type, float oldValue, float newValue)
cond::Time_t nextFound
static cond::Time_t condTime(const coral::TimeStamp &time)
coral::ISchema & nominalSchema()
Definition: Session.cc:224
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
std::pair< int, float > channelValue
std::map< int, timedMeasurement > snapshotValues
const_iterator begin() const
Definition: DTHVStatus.cc:298
cond::Time_t timeLimit
cont
load Luminosity info ##
Definition: generateEDF.py:628
const_iterator end() const
Definition: DTHVStatus.cc:300

◆ checkNewData()

void DTHVStatusHandler::checkNewData ( )
private

Definition at line 188 of file DTHVStatusHandler.cc.

References buff_session, coralTime(), gather_cfg::cout, createSnapshot(), getChannelMap(), getChannelSplit(), getLayerSplit(), cond::persistency::Session::nominalSchema(), omds_session, procSince, procUntil, AlCaHLTBitMon_QueryRunRegistry::string, updateHVStatus(), and util_session.

Referenced by getNewObjects().

188  {
189  //to access the information on last successful log entry for this tag:
190  // cond::LogDBEntry const & lde = logDBEntry();
191 
192  //to access the lastest payload (Ref is a smart pointer)
193  // Ref payload = lastPayload();
194 
195  std::cout << "check for new data since " << procSince << " " << coralTime(procSince).total_nanoseconds() << " "
196  << coralTime(procSince).year() << " " << coralTime(procSince).month() << " " << coralTime(procSince).day()
197  << " " << coralTime(procSince).hour() << " " << coralTime(procSince).minute() << " "
198  << coralTime(procSince).second() << std::endl;
199  std::cout << " until " << procUntil << " " << coralTime(procUntil).total_nanoseconds() << " "
200  << coralTime(procUntil).year() << " " << coralTime(procUntil).month() << " " << coralTime(procUntil).day()
201  << " " << coralTime(procUntil).hour() << " " << coralTime(procUntil).minute() << " "
202  << coralTime(procUntil).second() << std::endl;
203 
204  std::set<std::string> omds_lt(omds_session.nominalSchema().listTables());
205  std::set<std::string>::const_iterator omds_iter = omds_lt.begin();
206  std::set<std::string>::const_iterator omds_iend = omds_lt.end();
207  while (omds_iter != omds_iend) {
208  const std::string& istr = *omds_iter++;
209  std::cout << "TABLE: " << istr << std::endl;
210  }
211 
212  std::set<std::string> util_lt(util_session.nominalSchema().listTables());
213  std::set<std::string>::const_iterator util_iter = util_lt.begin();
214  std::set<std::string>::const_iterator util_iend = util_lt.end();
215  while (util_iter != util_iend) {
216  const std::string& istr = *util_iter++;
217  std::cout << "TABLE: " << istr << std::endl;
218  }
219 
220  getLayerSplit();
221  getChannelMap();
222  getChannelSplit();
223 
224  std::cout << "open buffer db..." << std::endl;
225 
226  if (!(buff_session.nominalSchema().existsTable("HVSNAPSHOT")))
227  createSnapshot();
228  updateHVStatus();
229 
230  return;
231 }
cond::persistency::Session omds_session
cond::Time_t procUntil
cond::persistency::Session buff_session
cond::persistency::Session util_session
static coral::TimeStamp coralTime(const cond::Time_t &time)
cond::Time_t procSince
coral::ISchema & nominalSchema()
Definition: Session.cc:224

◆ checkStatusChange()

int DTHVStatusHandler::checkStatusChange ( int  type,
float  oldValue,
float  newValue 
)
private

Definition at line 1030 of file DTHVStatusHandler.cc.

References aliasMap, officialStyle::chan, DTHVAbstractCheck::checkCurrentStatus(), DTHVAbstractCheck::compare(), gather_cfg::cout, getLayerValues(), hvChecker, layerId(), layerMap, nano_mu_digi_cff::rawId, snapshotValues, and DTWireId::wire().

Referenced by checkForPeriod().

1030  {
1031  int dpId = chan / 10;
1032  int type = chan % 10;
1033  std::map<int, int>::const_iterator aliasIter = aliasMap.find(dpId);
1034  std::map<int, int>::const_iterator aliasIend = aliasMap.end();
1035  if (aliasIter == aliasIend)
1036  return false;
1037  int rawId = aliasIter->second;
1038  DTWireId chlId(rawId);
1039  int l_p = chlId.wire();
1040  float valueL = 0.0;
1041  float valueR = 0.0;
1042  float valueS = 0.0;
1043  float valueC = 0.0;
1044  getLayerValues(rawId, type, valueL, valueR, valueS, valueC);
1045  // std::cout << "layer values: " << type << " " << valueL << " "
1046  // << valueR << " "
1047  // << valueS << " "
1048  // << valueC << std::endl;
1050  layerId(rawId, 0).rawId(), type, valueL, valueC, valueS, snapshotValues, aliasMap, layerMap);
1052  layerId(rawId, 1).rawId(), type, valueR, valueC, valueS, snapshotValues, aliasMap, layerMap);
1053  switch (l_p) {
1054  case 10:
1055  if (valueL != oldValue)
1056  std::cout << "*** INCONSISTENT DATA!!!!! " << type << " " << l_p << " " << oldValue << " " << valueL << " "
1057  << std::endl;
1058  valueL = newValue;
1059  break;
1060  case 11:
1061  if (valueR != oldValue)
1062  std::cout << "*** INCONSISTENT DATA!!!!! " << type << " " << l_p << " " << oldValue << " " << valueR << " "
1063  << std::endl;
1064  valueR = newValue;
1065  break;
1066  case 12:
1067  if (valueS != oldValue)
1068  std::cout << "*** INCONSISTENT DATA!!!!! " << type << " " << l_p << " " << oldValue << " " << valueS << " "
1069  << std::endl;
1070  valueS = newValue;
1071  break;
1072  case 13:
1073  if (valueC != oldValue)
1074  std::cout << "*** INCONSISTENT DATA!!!!! " << type << " " << l_p << " " << oldValue << " " << valueC << " "
1075  << std::endl;
1076  valueC = newValue;
1077  break;
1078  default:
1079  break;
1080  }
1082  layerId(rawId, 0).rawId(), type, valueL, valueC, valueS, snapshotValues, aliasMap, layerMap);
1084  layerId(rawId, 1).rawId(), type, valueR, valueC, valueS, snapshotValues, aliasMap, layerMap);
1085 
1086  if (DTHVAbstractCheck::compare(newStatusL, oldStatusL) && DTHVAbstractCheck::compare(newStatusR, oldStatusR))
1087  return 0;
1088  std::cout << "changed status: " << chan << " from " << oldValue << " to " << newValue << std::endl;
1089  return 1;
1090 }
void getLayerValues(int rawId, int type, float &valueL, float &valueR, float &valueS, float &valueC)
static DTWireId layerId(int rawId, int l_p)
virtual DTHVAbstractCheck::flag checkCurrentStatus(int rawId, int type, float valueA, float valueC, float valueS, const std::map< int, timedMeasurement > &snapshotValues, const std::map< int, int > &aliasMap, const std::map< int, int > &layerMap)=0
std::map< int, int > layerMap
static bool compare(const DTHVAbstractCheck::flag &fl, const DTHVAbstractCheck::flag &fr)
std::map< int, int > aliasMap
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
DTHVAbstractCheck * hvChecker
std::map< int, timedMeasurement > snapshotValues

◆ condTime() [1/2]

cond::Time_t DTHVStatusHandler::condTime ( const coral::TimeStamp &  time)
staticprivate

Definition at line 1187 of file DTHVStatusHandler.cc.

References hcalRecHitTable_cff::time.

Referenced by checkForPeriod(), getNewObjects(), and recoverLastTime().

1187  {
1188  cond::Time_t cTime =
1189  ((time.total_nanoseconds() / 1000000000) << 32) + ((time.total_nanoseconds() % 1000000000) / 1000);
1190  return cTime;
1191 }
unsigned long long Time_t
Definition: Time.h:14

◆ condTime() [2/2]

cond::Time_t DTHVStatusHandler::condTime ( long long int  time)
staticprivate

Definition at line 1193 of file DTHVStatusHandler.cc.

References hcalRecHitTable_cff::time.

1193  {
1194  cond::Time_t cTime = ((time / 1000000000) << 32) + ((time % 1000000000) / 1000);
1195  return cTime;
1196 }
unsigned long long Time_t
Definition: Time.h:14

◆ copyHVData()

void DTHVStatusHandler::copyHVData ( )
private

Definition at line 841 of file DTHVStatusHandler.cc.

References checkForPeriod(), gather_cfg::cout, filterData(), fwdTime, lastFound, lastStatus, popcon::PopConSourceHandler< DTHVStatus >::m_to_transfer, maxPayload, offlineList(), procSince, procUntil, and switchOff.

Referenced by updateHVStatus().

841  {
842  long long int dTime = fwdTime;
843  dTime <<= 32;
844 
845  cond::Time_t condSince = procSince;
846  cond::Time_t condUntil = condSince + dTime;
847  if (condUntil > procUntil)
848  condUntil = procUntil;
849 
850  int dum = 0;
851  lastStatus = nullptr;
852  while (condSince < condUntil) {
853  checkForPeriod(condSince, condUntil, dum, true);
854  condSince = condUntil;
855  condUntil = condSince + dTime;
856  if (condUntil > procUntil)
857  condUntil = procUntil;
858  }
859  std::cout << "call filterData " << std::endl;
860  filterData();
861  std::cout << "filterData return " << switchOff << " " << lastFound << " " << maxPayload << " " << m_to_transfer.size()
862  << std::endl;
863  if (switchOff || ((lastFound != 0) && (maxPayload > 0))) {
864  DTHVStatus* hvStatus = offlineList();
865  m_to_transfer.push_back(std::make_pair(hvStatus, lastFound));
866  }
867 
868  return;
869 }
DTHVStatus * lastStatus
cond::Time_t lastFound
cond::Time_t procUntil
DTHVStatus * offlineList()
unsigned long long Time_t
Definition: Time.h:14
cond::Time_t procSince
long long int fwdTime
std::vector< std::pair< DTHVStatus *, Time_t > > m_to_transfer
int checkForPeriod(cond::Time_t condSince, cond::Time_t condUntil, int &missingChannels, bool copyOffline)

◆ coralTime()

coral::TimeStamp DTHVStatusHandler::coralTime ( const cond::Time_t time)
staticprivate

Definition at line 1181 of file DTHVStatusHandler.cc.

References hcalRecHitTable_cff::time.

Referenced by checkForPeriod(), checkNewData(), getNewObjects(), and updateHVStatus().

1181  {
1182  long long int iTime = ((((time >> 32) & 0xFFFFFFFF) * 1000000000) + ((time & 0xFFFFFFFF) * 1000));
1183  coral::TimeStamp cTime(iTime);
1184  return cTime;
1185 }

◆ createSnapshot()

void DTHVStatusHandler::createSnapshot ( )
private

Definition at line 487 of file DTHVStatusHandler.cc.

References aliasMap, buff_session, gather_cfg::cout, hcalRecHitTable_cff::detId, mps_splice::entry, DTLayerId::layer(), L1DTConfigBti_cff::LL, cond::persistency::Session::nominalSchema(), DTChamberId::sector(), DTChamberId::station(), DTSuperLayerId::superLayer(), DTChamberId::wheel(), and DTWireId::wire().

Referenced by checkNewData().

487  {
488  std::cout << "create snapshot description..." << std::endl;
489  coral::TableDescription hvssDesc;
490  hvssDesc.setName("HVSNAPSHOT");
491  hvssDesc.insertColumn("TIME", coral::AttributeSpecification::typeNameForId(typeid(coral::TimeStamp)));
492  hvssDesc.insertColumn("WHEEL", coral::AttributeSpecification::typeNameForId(typeid(int)));
493  hvssDesc.insertColumn("STATION", coral::AttributeSpecification::typeNameForId(typeid(int)));
494  hvssDesc.insertColumn("SECTOR", coral::AttributeSpecification::typeNameForId(typeid(int)));
495  hvssDesc.insertColumn("SUPERLAYER", coral::AttributeSpecification::typeNameForId(typeid(int)));
496  hvssDesc.insertColumn("LAYER", coral::AttributeSpecification::typeNameForId(typeid(int)));
497  hvssDesc.insertColumn("CHAN", coral::AttributeSpecification::typeNameForId(typeid(int)));
498  hvssDesc.insertColumn("TYPE", coral::AttributeSpecification::typeNameForId(typeid(int)));
499  hvssDesc.insertColumn("VALUE", coral::AttributeSpecification::typeNameForId(typeid(float)));
500  std::cout << "create snapshot table..." << std::endl;
501  buff_session.nominalSchema().createTable(hvssDesc);
502  coral::ITable& bufferTable = buff_session.nominalSchema().tableHandle("HVSNAPSHOT");
503  coral::AttributeList newMeas;
504  newMeas.extend("TIME", typeid(coral::TimeStamp));
505  newMeas.extend("WHEEL", typeid(int));
506  newMeas.extend("STATION", typeid(int));
507  newMeas.extend("SECTOR", typeid(int));
508  newMeas.extend("SUPERLAYER", typeid(int));
509  newMeas.extend("LAYER", typeid(int));
510  newMeas.extend("CHAN", typeid(int));
511  newMeas.extend("TYPE", typeid(int));
512  newMeas.extend("VALUE", typeid(float));
513 
514  long long int zeroTime = 0LL;
515  newMeas["TIME"].data<coral::TimeStamp>() = coral::TimeStamp(zeroTime);
516  newMeas["VALUE"].data<float>() = -999999.0;
517 
518  std::map<int, int>::const_iterator iter = aliasMap.begin();
519  std::map<int, int>::const_iterator iend = aliasMap.end();
520  while (iter != iend) {
521  const std::pair<int, int>& entry = *iter++;
522  int detId = entry.second;
523  DTWireId chlId(detId);
524  newMeas["WHEEL"].data<int>() = chlId.wheel();
525  newMeas["STATION"].data<int>() = chlId.station();
526  newMeas["SECTOR"].data<int>() = chlId.sector();
527  newMeas["SUPERLAYER"].data<int>() = chlId.superLayer();
528  newMeas["LAYER"].data<int>() = chlId.layer();
529  newMeas["CHAN"].data<int>() = chlId.wire() - 10;
530  int itype;
531  for (itype = 1; itype <= 2; itype++) {
532  newMeas["TYPE"].data<int>() = itype;
533  bufferTable.dataEditor().insertRow(newMeas);
534  }
535  }
536 
537  std::cout << "create logging info..." << std::endl;
538  if (buff_session.nominalSchema().existsTable("LOG"))
539  buff_session.nominalSchema().dropTable("LOG");
540  coral::TableDescription infoDesc;
541  infoDesc.setName("LOG");
542  infoDesc.insertColumn("EXECTIME", coral::AttributeSpecification::typeNameForId(typeid(coral::TimeStamp)));
543  infoDesc.insertColumn("SNAPSHOT", coral::AttributeSpecification::typeNameForId(typeid(coral::TimeStamp)));
544  buff_session.nominalSchema().createTable(infoDesc);
545  coral::AttributeList newInfo;
546  newInfo.extend("EXECTIME", typeid(coral::TimeStamp));
547  newInfo.extend("SNAPSHOT", typeid(coral::TimeStamp));
548  newInfo["EXECTIME"].data<coral::TimeStamp>() = coral::TimeStamp(zeroTime);
549  newInfo["SNAPSHOT"].data<coral::TimeStamp>() = coral::TimeStamp(zeroTime);
550  coral::ITable& infoTable = buff_session.nominalSchema().tableHandle("LOG");
551  infoTable.dataEditor().insertRow(newInfo);
552 
553  return;
554 }
cond::persistency::Session buff_session
coral::ISchema & nominalSchema()
Definition: Session.cc:224
std::map< int, int > aliasMap

◆ dumpHVAliases()

void DTHVStatusHandler::dumpHVAliases ( )
private

Definition at line 365 of file DTHVStatusHandler.cc.

References aliasMap, buff_session, gather_cfg::cout, Calorimetry_cff::dp, layerMap, cond::persistency::Session::nominalSchema(), omds_session, DetId::rawId(), fileinputsource_cfi::sec, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getChannelMap().

365  {
366  std::cout << "DTHVStatusHandler::dumpHVAliases - begin" << std::endl;
367 
368  std::cout << "create aliases description..." << std::endl;
369  coral::TableDescription hvalDesc;
370  hvalDesc.setName("HVALIASES");
371  hvalDesc.insertColumn("DETID", coral::AttributeSpecification::typeNameForId(typeid(int)));
372  hvalDesc.insertColumn("DPID", coral::AttributeSpecification::typeNameForId(typeid(int)));
373  std::cout << "create aliases table..." << std::endl;
374  coral::ITable& hvalTable = buff_session.nominalSchema().createTable(hvalDesc);
375 
376  std::cout << "open DPNAME table..." << std::endl;
377  std::map<int, std::string> idMap;
378  coral::ITable& dpidTable = omds_session.nominalSchema().tableHandle("DP_NAME2ID");
379  std::unique_ptr<coral::IQuery> dpidQuery(dpidTable.newQuery());
380  dpidQuery->addToOutputList("ID");
381  dpidQuery->addToOutputList("DPNAME");
382  coral::ICursor& dpidCursor = dpidQuery->execute();
383  while (dpidCursor.next()) {
384  const coral::AttributeList& row = dpidCursor.currentRow();
385  int id = static_cast<int>(0.01 + row["ID"].data<float>());
386  std::string dp = row["DPNAME"].data<std::string>();
387  idMap.insert(std::pair<int, std::string>(id, dp));
388  }
389  std::cout << "DPNAME table read... " << idMap.size() << std::endl;
390 
391  std::cout << "open ALIASES table..." << std::endl;
392  std::map<std::string, std::string> cnMap;
393  coral::ITable& nameTable = omds_session.nominalSchema().tableHandle("ALIASES");
394  std::unique_ptr<coral::IQuery> nameQuery(nameTable.newQuery());
395  nameQuery->addToOutputList("DPE_NAME");
396  nameQuery->addToOutputList("ALIAS");
397  coral::ICursor& nameCursor = nameQuery->execute();
398  while (nameCursor.next()) {
399  const coral::AttributeList& row = nameCursor.currentRow();
400  std::string dp = row["DPE_NAME"].data<std::string>();
401  std::string an = row["ALIAS"].data<std::string>();
402  if (an.length() < 20)
403  continue;
404  cnMap.insert(std::pair<std::string, std::string>(dp, an));
405  }
406  std::cout << "ALIASES table read... " << cnMap.size() << std::endl;
407 
408  std::map<int, std::string>::const_iterator idIter = idMap.begin();
409  std::map<int, std::string>::const_iterator idIend = idMap.end();
410  std::string outChk("/outputChannel");
411  while (idIter != idIend) {
412  const std::pair<int, std::string>& ientry = *idIter++;
413  int dpId = ientry.first;
414  std::string dp = ientry.second;
415  int ldp = dp.length();
416  if (ldp < 20)
417  continue;
418  std::string subOut(dp.substr(ldp - 17, 17));
419  std::string subChk(subOut.substr(0, 14));
420  if (subChk != outChk)
421  continue;
422  std::string chName(dp.substr(0, ldp - 17));
423  chName += ".actual.OvC";
424  int chCode = subOut.c_str()[16] - '0';
425  std::map<std::string, std::string>::const_iterator jter = cnMap.find(chName);
426  if (jter == cnMap.end())
427  continue;
428  const std::pair<std::string, std::string>& jentry = *jter;
429  std::cout << dp << std::endl << chName << " " << chCode << std::endl;
430  std::string an(jentry.second);
431  int al = an.length();
432  int iofw = 7 + an.find("DT_HV_W", 0);
433  int iofc = 3 + an.find("_MB", 0);
434  int iofs = 2 + an.find("_S", 0);
435  int iofq = 3 + an.find("_SL", 0);
436  int iofl = 2 + an.find("_L", 0);
437  if ((iofw == al) || (iofc == al) || (iofs == al) || (iofq == al) || (iofl == al)) {
438  break;
439  }
440  int ioew = an.find('_', iofw);
441  int ioec = an.find('_', iofc);
442  int ioes = an.find('_', iofs);
443  int ioeq = an.find('_', iofq);
444  int ioel = an.find('_', iofl);
445  std::string swhe(an.substr(iofw, ioew - iofw));
446  const char* cwhe = swhe.c_str();
447  int whe = cwhe[1] - '0';
448  if (*cwhe != 'P')
449  whe = -whe;
450 
451  std::string scha(an.substr(iofc, ioec - iofc));
452  const char* ccha = scha.c_str();
453  int cha = *ccha - '0';
454 
455  std::string ssec(an.substr(iofs, ioes - iofs));
456  const char* csec = ssec.c_str();
457  int sec = ((*csec - '0') * 10) + (csec[1] - '0');
458  if ((csec[2] == 'R') && (sec == 10))
459  sec = 14;
460  if ((csec[2] == 'L') && (sec == 4))
461  sec = 13;
462 
463  std::string squa(an.substr(iofq, ioeq - iofq));
464  const char* cqua = squa.c_str();
465  int qua = *cqua - '0';
466 
467  std::string slay(an.substr(iofl, ioel - iofl));
468  const char* clay = slay.c_str();
469  int lay = *clay - '0';
470 
471  DTWireId wireId(whe, cha, sec, qua, lay, 10 + chCode);
472  int chId = wireId.rawId();
473  coral::AttributeList newChan;
474  newChan.extend("DETID", typeid(int));
475  newChan.extend("DPID", typeid(int));
476  newChan["DETID"].data<int>() = chId;
477  newChan["DPID"].data<int>() = dpId;
478  hvalTable.dataEditor().insertRow(newChan);
479  aliasMap.insert(std::pair<int, int>(dpId, chId));
480  layerMap.insert(std::pair<int, int>(chId, dpId));
481  }
482 
483  std::cout << "DTHVStatusHandler::dumpHVAliases - end" << std::endl;
484  return;
485 }
cond::persistency::Session omds_session
cond::persistency::Session buff_session
std::map< int, int > layerMap
coral::ISchema & nominalSchema()
Definition: Session.cc:224
std::map< int, int > aliasMap

◆ dumpSnapshot()

void DTHVStatusHandler::dumpSnapshot ( const coral::TimeStamp &  time)
private

Definition at line 666 of file DTHVStatusHandler.cc.

References aliasMap, buff_session, gather_cfg::cout, mps_splice::entry, DTLayerId::layer(), cond::persistency::Session::nominalSchema(), submitPVValidationJobs::now, DTChamberId::sector(), snapshotValues, DTChamberId::station(), AlCaHLTBitMon_QueryRunRegistry::string, DTSuperLayerId::superLayer(), hcalRecHitTable_cff::time, DTChamberId::wheel(), and DTWireId::wire().

Referenced by updateHVStatus().

666  {
667  std::cout << "dump snapshot to buffer db..." << std::endl;
668  std::string emptyCondition("");
669  coral::AttributeList emptyBindVariableList;
670  std::map<int, int>::const_iterator mapIter = aliasMap.begin();
671  std::map<int, int>::const_iterator mapIend = aliasMap.end();
672  coral::ITable& hvssTable = buff_session.nominalSchema().tableHandle("HVSNAPSHOT");
673  coral::ITableDataEditor& hvssEditor(hvssTable.dataEditor());
674  long nRows = hvssEditor.deleteRows(emptyCondition, emptyBindVariableList);
675  std::cout << nRows << " rows deleted" << std::endl;
676 
677  coral::AttributeList newMeas;
678  newMeas.extend("TIME", typeid(coral::TimeStamp));
679  newMeas.extend("WHEEL", typeid(int));
680  newMeas.extend("STATION", typeid(int));
681  newMeas.extend("SECTOR", typeid(int));
682  newMeas.extend("SUPERLAYER", typeid(int));
683  newMeas.extend("LAYER", typeid(int));
684  newMeas.extend("CHAN", typeid(int));
685  newMeas.extend("TYPE", typeid(int));
686  newMeas.extend("VALUE", typeid(float));
687 
688  nRows = 0;
689  std::map<int, timedMeasurement>::const_iterator ssvIter = snapshotValues.begin();
690  std::map<int, timedMeasurement>::const_iterator ssvIend = snapshotValues.end();
691  while (ssvIter != ssvIend) {
692  const std::pair<int, timedMeasurement>& entry = *ssvIter++;
693  int dpty = entry.first;
694  int dpId = dpty / 10;
695  int type = dpty % 10;
696  mapIter = aliasMap.find(dpId);
697  if (mapIter == mapIend)
698  continue;
699  DTWireId chlId(mapIter->second);
700  const timedMeasurement& tMeas = entry.second;
701  long long int newTime = tMeas.first;
702  newMeas["TIME"].data<coral::TimeStamp>() = coral::TimeStamp(newTime);
703  newMeas["WHEEL"].data<int>() = chlId.wheel();
704  newMeas["STATION"].data<int>() = chlId.station();
705  newMeas["SECTOR"].data<int>() = chlId.sector();
706  newMeas["SUPERLAYER"].data<int>() = chlId.superLayer();
707  newMeas["LAYER"].data<int>() = chlId.layer();
708  newMeas["CHAN"].data<int>() = chlId.wire() - 10;
709  newMeas["TYPE"].data<int>() = type;
710  newMeas["VALUE"].data<float>() = tMeas.second;
711  hvssEditor.insertRow(newMeas);
712  nRows++;
713  }
714  std::cout << nRows << " rows updated" << std::endl;
715 
716  std::cout << "create logging info..." << std::endl;
717  if (buff_session.nominalSchema().existsTable("LOG"))
718  buff_session.nominalSchema().dropTable("LOG");
719  coral::TableDescription infoDesc;
720  infoDesc.setName("LOG");
721  infoDesc.insertColumn("EXECTIME", coral::AttributeSpecification::typeNameForId(typeid(coral::TimeStamp)));
722  infoDesc.insertColumn("SNAPSHOT", coral::AttributeSpecification::typeNameForId(typeid(coral::TimeStamp)));
723  buff_session.nominalSchema().createTable(infoDesc);
724  coral::AttributeList newInfo;
725  newInfo.extend("EXECTIME", typeid(coral::TimeStamp));
726  newInfo.extend("SNAPSHOT", typeid(coral::TimeStamp));
727  newInfo["EXECTIME"].data<coral::TimeStamp>() = coral::TimeStamp::now();
728  newInfo["SNAPSHOT"].data<coral::TimeStamp>() = time;
729  coral::ITable& infoTable = buff_session.nominalSchema().tableHandle("LOG");
730  infoTable.dataEditor().insertRow(newInfo);
731 
732  return;
733 }
DTHVAbstractCheck::timedMeasurement timedMeasurement
cond::persistency::Session buff_session
coral::ISchema & nominalSchema()
Definition: Session.cc:224
std::map< int, int > aliasMap
std::map< int, timedMeasurement > snapshotValues

◆ filterData()

void DTHVStatusHandler::filterData ( )
private

Definition at line 1092 of file DTHVStatusHandler.cc.

References DTHVStatus::begin(), gather_cfg::cout, change_name::diff, HLT_2023v12_cff::distance, DTHVStatus::end(), mps_splice::entry, popcon::PopConSourceHandler< DTHVStatus >::m_to_transfer, HLT_2023v12_cff::maxTime, GetRecoTauVFromDQM_MC_cff::next, switchOff, and tmpContainer.

Referenced by copyHVData().

1092  {
1093  int maxTime = 100;
1094  int maxTtot = 600;
1095  int minDiff = 88;
1096 
1097  int iTime = 0;
1098  int pTime = 0;
1099  int nTime = 0;
1100  int iSize;
1101  int pSize;
1102  int nSize;
1103 
1104  std::vector<std::pair<DTHVStatus*, cond::Time_t> >::const_iterator iter = tmpContainer.begin();
1105  std::vector<std::pair<DTHVStatus*, cond::Time_t> >::const_iterator iend = tmpContainer.end();
1106  std::vector<std::pair<DTHVStatus*, cond::Time_t> >::const_iterator prev;
1107  std::vector<std::pair<DTHVStatus*, cond::Time_t> >::const_iterator next;
1108 
1109  while (iter != iend) {
1110  switchOff = false;
1111  next = iter;
1112  prev = next++;
1113  if (next == iend)
1114  next = prev;
1115  const DTHVStatus* iPtr = iter->first;
1116  const DTHVStatus* pPtr = prev->first;
1117  const DTHVStatus* nPtr = next->first;
1118  iSize = std::distance(iPtr->begin(), iPtr->end());
1119  pSize = std::distance(pPtr->begin(), pPtr->end());
1120  nSize = std::distance(nPtr->begin(), nPtr->end());
1121  int dtot = nSize - pSize;
1122  prev = next;
1123  while (++next != iend) {
1124  pPtr = prev->first;
1125  nPtr = next->first;
1126  pSize = std::distance(pPtr->begin(), pPtr->end());
1127  nSize = std::distance(nPtr->begin(), nPtr->end());
1128  int diff = nSize - pSize;
1129  iTime = static_cast<int>((iter->second >> 32) & 0xffffffff);
1130  pTime = static_cast<int>((prev->second >> 32) & 0xffffffff);
1131  nTime = static_cast<int>((next->second >> 32) & 0xffffffff);
1132  if ((nTime - pTime) > maxTime)
1133  break;
1134  if ((nTime - iTime) > maxTtot)
1135  break;
1136  if ((dtot * diff) < 0)
1137  break;
1138  prev = next;
1139  }
1140  pPtr = prev->first;
1141  iSize = std::distance(iPtr->begin(), iPtr->end());
1142  pSize = std::distance(pPtr->begin(), pPtr->end());
1143  dtot = pSize - iSize;
1144  int dist = pTime - iTime;
1145  if ((dtot < -minDiff) && (dist < maxTtot)) {
1146  std::cout << " ******** SWITCH ON " << std::distance(iter, prev) << " " << iTime << " " << pTime << " " << iSize
1147  << " " << pSize << std::endl;
1148  m_to_transfer.push_back(std::make_pair(prev->first, prev->second));
1149  while (iter != prev)
1150  delete (iter++->first);
1151  }
1152  if ((dtot > minDiff) && (dist < maxTtot)) {
1153  std::cout << " ******** SWITCH OFF " << std::distance(iter, prev) << " " << iTime << " " << pTime << " " << iSize
1154  << " " << pSize << std::endl;
1155  m_to_transfer.push_back(std::make_pair(prev->first, iter->second));
1156  switchOff = true;
1157  while (iter != prev)
1158  delete (iter++->first);
1159  }
1160  if (((dtot >= -minDiff) && (dtot <= minDiff)) || (dist >= maxTtot)) {
1161  while (iter != next) {
1162  const std::pair<DTHVStatus*, cond::Time_t>& entry = *iter++;
1163  m_to_transfer.push_back(std::make_pair(entry.first, entry.second));
1164  }
1165  }
1166  iter = next;
1167  }
1168 }
std::vector< std::pair< DTHVStatus *, cond::Time_t > > tmpContainer
std::vector< std::pair< DTHVStatus *, Time_t > > m_to_transfer
const_iterator begin() const
Definition: DTHVStatus.cc:298
const_iterator end() const
Definition: DTHVStatus.cc:300

◆ getChannelMap()

void DTHVStatusHandler::getChannelMap ( )
private

Definition at line 235 of file DTHVStatusHandler.cc.

References aliasMap, buff_session, gather_cfg::cout, dumpHVAliases(), layerMap, and cond::persistency::Session::nominalSchema().

Referenced by checkNewData().

235  {
236  if (!(buff_session.nominalSchema().existsTable("HVALIASES"))) {
237  dumpHVAliases();
238  } else {
239  std::cout << "retrieve aliases table..." << std::endl;
240  coral::ITable& hvalTable = buff_session.nominalSchema().tableHandle("HVALIASES");
241  std::unique_ptr<coral::IQuery> hvalQuery(hvalTable.newQuery());
242  hvalQuery->addToOutputList("DETID");
243  hvalQuery->addToOutputList("DPID");
244  coral::ICursor& hvalCursor = hvalQuery->execute();
245  int chId;
246  int dpId;
247  while (hvalCursor.next()) {
248  chId = hvalCursor.currentRow()["DETID"].data<int>();
249  dpId = hvalCursor.currentRow()["DPID"].data<int>();
250  aliasMap.insert(std::pair<int, int>(dpId, chId));
251  layerMap.insert(std::pair<int, int>(chId, dpId));
252  }
253  }
254 
255  return;
256 }
cond::persistency::Session buff_session
std::map< int, int > layerMap
coral::ISchema & nominalSchema()
Definition: Session.cc:224
std::map< int, int > aliasMap

◆ getChannelSplit()

void DTHVStatusHandler::getChannelSplit ( )
private

Definition at line 300 of file DTHVStatusHandler.cc.

References channelSplit, gather_cfg::cout, cond::persistency::Session::nominalSchema(), DetId::rawId(), submitPVValidationJobs::splitList, splitVersion, AlCaHLTBitMon_QueryRunRegistry::string, and util_session.

Referenced by checkNewData().

300  {
301  std::cout << "retrieve channel split table..." << std::endl;
302  int pwhe;
303  int psec;
304  int psta;
305  int pqua;
306  int play;
307  int pl_p;
308  int swhe;
309  int ssec;
310  int ssta;
311  int squa;
312  int slay;
313  int sl_p;
314  coral::ITable& csplTable = util_session.nominalSchema().tableHandle("DT_HV_CHANNEL_SPLIT");
315  std::unique_ptr<coral::IQuery> csplQuery(csplTable.newQuery());
316  coral::AttributeList versionBindVariableList;
317  versionBindVariableList.extend("version", typeid(std::string));
318  versionBindVariableList["version"].data<std::string>() = splitVersion;
319  csplQuery->setCondition("VERSION=:version", versionBindVariableList);
320  csplQuery->addToOutputList("P_WHEEL");
321  csplQuery->addToOutputList("P_SECTOR");
322  csplQuery->addToOutputList("P_STATION");
323  csplQuery->addToOutputList("P_SUPERLAYER");
324  csplQuery->addToOutputList("P_LAYER");
325  csplQuery->addToOutputList("P_PART");
326  csplQuery->addToOutputList("S_NUMBER");
327  csplQuery->addToOutputList("S_WHEEL");
328  csplQuery->addToOutputList("S_SECTOR");
329  csplQuery->addToOutputList("S_STATION");
330  csplQuery->addToOutputList("S_SUPERLAYER");
331  csplQuery->addToOutputList("S_LAYER");
332  csplQuery->addToOutputList("S_PART");
333  coral::ICursor& csplCursor = csplQuery->execute();
334  while (csplCursor.next()) {
335  pwhe = csplCursor.currentRow()["P_WHEEL"].data<int>();
336  psec = csplCursor.currentRow()["P_SECTOR"].data<int>();
337  psta = csplCursor.currentRow()["P_STATION"].data<int>();
338  pqua = csplCursor.currentRow()["P_SUPERLAYER"].data<int>();
339  play = csplCursor.currentRow()["P_LAYER"].data<int>();
340  pl_p = csplCursor.currentRow()["P_PART"].data<int>();
341  csplCursor.currentRow()["S_NUMBER"].data<int>();
342  swhe = csplCursor.currentRow()["S_WHEEL"].data<int>();
343  ssec = csplCursor.currentRow()["S_SECTOR"].data<int>();
344  ssta = csplCursor.currentRow()["S_STATION"].data<int>();
345  squa = csplCursor.currentRow()["S_SUPERLAYER"].data<int>();
346  slay = csplCursor.currentRow()["S_LAYER"].data<int>();
347  sl_p = csplCursor.currentRow()["S_PART"].data<int>();
348  DTWireId pId(pwhe, psta, psec, pqua, play, 10 + pl_p);
349  DTWireId sId(swhe, ssta, ssec, squa, slay, 10 + sl_p);
350  int pRaw = pId.rawId();
351  int sRaw = sId.rawId();
352  std::vector<int>* splitList = nullptr;
353  std::map<int, std::vector<int>*>::iterator iter = channelSplit.find(pRaw);
354  std::map<int, std::vector<int>*>::iterator iend = channelSplit.end();
355  if (iter == iend) {
356  channelSplit.insert(std::pair<int, std::vector<int>*>(pRaw, splitList = new std::vector<int>));
357  } else {
358  splitList = iter->second;
359  }
360  splitList->push_back(sRaw);
361  }
362  return;
363 }
cond::persistency::Session util_session
coral::ISchema & nominalSchema()
Definition: Session.cc:224
std::map< int, std::vector< int > * > channelSplit
std::string splitVersion

◆ getLayerSplit()

void DTHVStatusHandler::getLayerSplit ( )
private

Definition at line 258 of file DTHVStatusHandler.cc.

References gather_cfg::cout, laySplit, mapVersion, cond::persistency::Session::nominalSchema(), fileinputsource_cfi::sec, AlCaHLTBitMon_QueryRunRegistry::string, and util_session.

Referenced by checkNewData().

258  {
259  std::cout << "retrieve layer split table..." << std::endl;
260  int whe;
261  int sec;
262  int sta;
263  int qua;
264  int lay;
265  int l_p;
266  int f_c;
267  int l_c;
268  coral::ITable& lsplTable = util_session.nominalSchema().tableHandle("DT_HV_LAYER_SPLIT");
269  std::cout << " layer split table got..." << std::endl;
270  std::unique_ptr<coral::IQuery> lsplQuery(lsplTable.newQuery());
271  coral::AttributeList versionBindVariableList;
272  versionBindVariableList.extend("version", typeid(std::string));
273  versionBindVariableList["version"].data<std::string>() = mapVersion;
274  lsplQuery->setCondition("VERSION=:version", versionBindVariableList);
275  lsplQuery->addToOutputList("WHEEL");
276  lsplQuery->addToOutputList("SECTOR");
277  lsplQuery->addToOutputList("STATION");
278  lsplQuery->addToOutputList("SUPERLAYER");
279  lsplQuery->addToOutputList("LAYER");
280  lsplQuery->addToOutputList("PART");
281  lsplQuery->addToOutputList("FIRST_CELL");
282  lsplQuery->addToOutputList("LAST_CELL");
283  coral::ICursor& lsplCursor = lsplQuery->execute();
284  while (lsplCursor.next()) {
285  whe = lsplCursor.currentRow()["WHEEL"].data<int>();
286  sec = lsplCursor.currentRow()["SECTOR"].data<int>();
287  sta = lsplCursor.currentRow()["STATION"].data<int>();
288  qua = lsplCursor.currentRow()["SUPERLAYER"].data<int>();
289  lay = lsplCursor.currentRow()["LAYER"].data<int>();
290  l_p = lsplCursor.currentRow()["PART"].data<int>();
291  f_c = lsplCursor.currentRow()["FIRST_CELL"].data<int>();
292  l_c = lsplCursor.currentRow()["LAST_CELL"].data<int>();
293  DTWireId wireId(whe, sta, sec, qua, lay, 10 + l_p);
294  laySplit.insert(std::pair<int, int>(wireId.rawId(), (f_c * 10000) + l_c));
295  }
296  std::cout << "channel split table retrieved" << std::endl;
297  return;
298 }
std::map< int, int > laySplit
cond::persistency::Session util_session
coral::ISchema & nominalSchema()
Definition: Session.cc:224

◆ getLayerValues()

void DTHVStatusHandler::getLayerValues ( int  rawId,
int  type,
float &  valueL,
float &  valueR,
float &  valueS,
float &  valueC 
)
private

Definition at line 943 of file DTHVStatusHandler.cc.

References gather_cfg::cout, layerId(), layerMap, nano_mu_digi_cff::rawId, DetId::rawId(), and snapshotValues.

Referenced by checkStatusChange(), and offlineList().

943  {
944  valueL = valueR = valueS = valueC = 0.0;
945  DTWireId chlId(rawId);
946  std::map<int, timedMeasurement>::const_iterator snapIter = snapshotValues.begin();
947  std::map<int, timedMeasurement>::const_iterator snapIend = snapshotValues.end();
948  int rawL = layerId(rawId, 0).rawId();
949  int rawR = layerId(rawId, 1).rawId();
950  int rawS = layerId(rawId, 2).rawId();
951  int rawC = layerId(rawId, 3).rawId();
952  std::map<int, int>::const_iterator layerIter;
953  std::map<int, int>::const_iterator layerIend = layerMap.end();
954  if ((layerIter = layerMap.find(rawL)) != layerIend) {
955  const std::pair<int, int>& layerEntry = *layerIter;
956  int dpId = layerEntry.second;
957  snapIter = snapshotValues.find((dpId * 10) + type);
958  if (snapIter != snapIend) {
959  const std::pair<int, timedMeasurement>& snapEntry = *snapIter;
960  valueL = snapEntry.second.second;
961  } else
962  std::cout << "snapR not found" << std::endl;
963  } else
964  std::cout << "rawR not found" << std::endl;
965  if ((layerIter = layerMap.find(rawR)) != layerIend) {
966  const std::pair<int, int>& layerEntry = *layerIter;
967  int dpId = layerEntry.second;
968  snapIter = snapshotValues.find((dpId * 10) + type);
969  if (snapIter != snapIend) {
970  const std::pair<int, timedMeasurement>& snapEntry = *snapIter;
971  valueR = snapEntry.second.second;
972  } else
973  std::cout << "snapL not found" << std::endl;
974  } else
975  std::cout << "rawL not found" << std::endl;
976  if ((layerIter = layerMap.find(rawS)) != layerIend) {
977  const std::pair<int, int>& layerEntry = *layerIter;
978  int dpId = layerEntry.second;
979  snapIter = snapshotValues.find((dpId * 10) + type);
980  if (snapIter != snapIend) {
981  const std::pair<int, timedMeasurement>& snapEntry = *snapIter;
982  valueS = snapEntry.second.second;
983  } else
984  std::cout << "snapS not found" << std::endl;
985  } else
986  std::cout << "rawS not found" << std::endl;
987  if ((layerIter = layerMap.find(rawC)) != layerIend) {
988  const std::pair<int, int>& layerEntry = *layerIter;
989  int dpId = layerEntry.second;
990  snapIter = snapshotValues.find((dpId * 10) + type);
991  if (snapIter != snapIend) {
992  const std::pair<int, timedMeasurement>& snapEntry = *snapIter;
993  valueC = snapEntry.second.second;
994  } else
995  std::cout << "snapC not found" << std::endl;
996  } else
997  std::cout << "rawC not found" << std::endl;
998  // std::cout << "layer values... " << type << " " << valueL << " "
999  // << valueR << " "
1000  // << valueS << " "
1001  // << valueC << std::endl;
1002  return;
1003 }
static DTWireId layerId(int rawId, int l_p)
std::map< int, int > layerMap
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::map< int, timedMeasurement > snapshotValues

◆ getNewObjects()

void DTHVStatusHandler::getNewObjects ( )
overridevirtual

Operations

Implements popcon::PopConSourceHandler< DTHVStatus >.

Definition at line 90 of file DTHVStatusHandler.cc.

References aliasMap, buff_session, bufferConnect, officialStyle::chan, checkNewData(), cond::persistency::Session::close(), cond::persistency::Transaction::commit(), condTime(), cond::persistency::ConnectionPool::configure(), coralTime(), gather_cfg::cout, cond::persistency::ConnectionPool::createSession(), data, dataTag, dSince, dUntil, mps_splice::entry, hSince, hUntil, hvChecker, id(), dqmdumpme::last, lastFound, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< DTHVStatus >::lastPayload(), lastStamp, layerMap, popcon::PopConSourceHandler< DTHVStatus >::m_to_transfer, mSince, mUntil, nextFound, submitPVValidationJobs::now, omds_session, onlineAuthentication, onlineConnect, jetsAK4_Puppi_cff::payload, procSince, procUntil, pSince, pUntil, nano_mu_digi_cff::rawId, cond::persistency::ConnectionPool::setAuthenticationPath(), DTHVAbstractCheck::setStatus(), cond::Iov_t::since, snapshotValues, sSince, cond::persistency::Transaction::start(), sUntil, popcon::PopConSourceHandler< DTHVStatus >::tagInfo(), timeLimit, cond::persistency::Session::transaction(), util_session, ySince, and yUntil.

90  {
91  std::cout << "get new objects..." << std::endl;
92 
93  // online DB connection - data
94  std::cout << "configure omds DbConnection" << std::endl;
96  // conn->configure( cond::CmsDefaults );
98  connection.configure();
99  std::cout << "create omds DbSession" << std::endl;
101  std::cout << "start omds transaction" << std::endl;
103  std::cout << "" << std::endl;
104 
105  // online DB connection - util
106  std::cout << "create util DbSession" << std::endl;
108  std::cout << "startutil transaction" << std::endl;
110  std::cout << "" << std::endl;
111 
112  // buffer DB connection
113  std::cout << "create buffer DbSession" << std::endl;
115  std::cout << "start buffer transaction" << std::endl;
117 
118  // offline info
119 
120  //to access the information on the tag inside the offline database:
121  cond::TagInfo_t const& ti = tagInfo();
123  std::cout << "latest DCS data (HV) already copied until: " << last << std::endl;
124 
125  coral::TimeStamp coralSince(ySince, mSince, dSince, hSince, pSince, sSince, 0);
126  procSince = condTime(coralSince);
127  coral::TimeStamp coralUntil(yUntil, mUntil, dUntil, hUntil, pUntil, sUntil, 0);
128  procUntil = condTime(coralUntil);
129  lastFound = 0;
130  nextFound = 0;
131  timeLimit = 0;
132  lastStamp = 0;
133 
134  if (last == 0) {
135  DTHVStatus* dummyStatus = new DTHVStatus(dataTag);
136  cond::Time_t snc = 1;
137  m_to_transfer.push_back(std::make_pair(dummyStatus, snc));
138  last = procSince + 1;
139  std::cout << "no old data... " << last << std::endl;
140  } else {
141  Ref payload = lastPayload();
142  DTHVStatus::const_iterator paylIter = payload->begin();
143  DTHVStatus::const_iterator paylIend = payload->end();
144  while (paylIter != paylIend) {
145  const std::pair<DTHVStatusId, DTHVStatusData>& entry = *paylIter++;
146  const DTHVStatusId& chan = entry.first;
147  const DTHVStatusData& data = entry.second;
148  DTWireId id(chan.wheelId, chan.stationId, chan.sectorId, chan.slId, chan.layerId, chan.partId + 10);
149  hvChecker->setStatus(id.rawId(), data.flagA, data.flagC, data.flagS, snapshotValues, aliasMap, layerMap);
150  }
151  }
152  coral::TimeStamp coralLast = coralTime(last);
153  coral::TimeStamp coralProc = coral::TimeStamp::now();
154  cond::Time_t condProc = condTime(coralProc);
155 
156  if (procSince > condProc) {
157  std::cout << "Required time interval in the future: " << std::endl
158  << " copy since " << ySince << " " << mSince << " " << dSince << " ( " << procSince << " )" << std::endl
159  << " current time " << coralProc.year() << " " << coralProc.month() << " " << coralProc.day()
160  << std::endl;
161  }
162  if (procUntil > condProc)
163  procUntil = condProc;
164  if (last > procSince) {
165  if (last < procUntil) {
166  procSince = last;
167  checkNewData();
168  } else {
169  std::cout << "Required time interval already copied: " << std::endl
170  << " copy until " << yUntil << " " << mUntil << " " << dUntil << " ( " << procUntil << " )" << std::endl
171  << " data until " << coralLast.year() << " " << coralLast.month() << " " << coralLast.day()
172  << std::endl;
173  }
174  } else {
175  std::cout << "Required time interval not contiguous with copied data: " << std::endl
176  << " data until " << coralLast.year() << " " << coralLast.month() << " " << coralLast.day() << std::endl
177  << " copy since " << ySince << " " << mSince << " " << dSince << " ( " << procSince << " )" << std::endl;
178  }
179 
184 
185  return;
186 }
long long int lastStamp
Iov_t lastInterval
Definition: Types.h:73
cond::Time_t lastFound
cond::persistency::Session omds_session
void start(bool readOnly=true)
Definition: Session.cc:18
cond::Time_t procUntil
Time_t since
Definition: Types.h:53
cond::persistency::Session buff_session
std::string onlineConnect
virtual void setStatus(int rawId, int flagA, int flagC, int flagS, const std::map< int, timedMeasurement > &snapshotValues, const std::map< int, int > &aliasMap, const std::map< int, int > &layerMap)
Transaction & transaction()
Definition: Session.cc:52
cond::persistency::Session util_session
cond::TagInfo_t const & tagInfo() const
static coral::TimeStamp coralTime(const cond::Time_t &time)
std::map< int, int > layerMap
cond::Time_t nextFound
unsigned long long Time_t
Definition: Time.h:14
cond::Time_t procSince
static cond::Time_t condTime(const coral::TimeStamp &time)
std::vector< std::pair< DTHVStatus *, Time_t > > m_to_transfer
Session createSession(const std::string &connectionString, bool writeCapable=false)
std::vector< std::pair< DTHVStatusId, DTHVStatusData > >::const_iterator const_iterator
Access methods to data.
Definition: DTHVStatus.h:130
std::string onlineAuthentication
std::map< int, int > aliasMap
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
DTHVAbstractCheck * hvChecker
std::string id() const override
std::string bufferConnect
std::map< int, timedMeasurement > snapshotValues
void setAuthenticationPath(const std::string &p)
cond::Time_t timeLimit

◆ id()

std::string DTHVStatusHandler::id ( ) const
overridevirtual

Implements popcon::PopConSourceHandler< DTHVStatus >.

Definition at line 233 of file DTHVStatusHandler.cc.

Referenced by getNewObjects().

233 { return "DTHVStatusHandler"; }

◆ layerId()

DTWireId DTHVStatusHandler::layerId ( int  rawId,
int  l_p 
)
staticprivate

Definition at line 1170 of file DTHVStatusHandler.cc.

References DTLayerId::layer(), nano_mu_digi_cff::rawId, fileinputsource_cfi::sec, DTChamberId::sector(), DTChamberId::station(), DTSuperLayerId::superLayer(), and DTChamberId::wheel().

Referenced by checkStatusChange(), getLayerValues(), and offlineList().

1170  {
1171  DTWireId chlId(rawId);
1172  int whe = chlId.wheel();
1173  int sta = chlId.station();
1174  int sec = chlId.sector();
1175  int qua = chlId.superLayer();
1176  int lay = chlId.layer();
1177  DTWireId chl(whe, sta, sec, qua, lay, 10 + l_p);
1178  return chl;
1179 }

◆ offlineList()

DTHVStatus * DTHVStatusHandler::offlineList ( )
private

Definition at line 871 of file DTHVStatusHandler.cc.

References aliasMap, channelSplit, DTHVAbstractCheck::checkCurrentStatus(), dataTag, RemoveAddSevLevel::flag, getLayerValues(), hvChecker, DTLayerId::layer(), layerId(), layerMap, nano_mu_digi_cff::rawId, DetId::rawId(), fileinputsource_cfi::sec, DTChamberId::sector(), setChannelFlag(), snapshotValues, DTChamberId::station(), DTSuperLayerId::superLayer(), DTChamberId::wheel(), and DTWireId::wire().

Referenced by checkForPeriod(), and copyHVData().

871  {
872  DTHVStatus* hv = new DTHVStatus(dataTag);
873  int type;
874  float valueA = 0.0;
875  float valueL = 0.0;
876  float valueR = 0.0;
877  float valueS = 0.0;
878  float valueC = 0.0;
879  std::map<int, int>::const_iterator layerIter = layerMap.begin();
880  std::map<int, int>::const_iterator layerIend = layerMap.end();
881  while (layerIter != layerIend) {
882  const std::pair<int, int>& chanEntry = *layerIter++;
883  int rawId = chanEntry.first;
884  DTWireId chlId(rawId);
885  int whe = chlId.wheel();
886  int sta = chlId.station();
887  int sec = chlId.sector();
888  int qua = chlId.superLayer();
889  int lay = chlId.layer();
890  int l_p = chlId.wire();
891  if (l_p != 10)
892  continue;
893  for (type = 1; type <= 2; type++) {
894  getLayerValues(rawId, type, valueL, valueR, valueS, valueC);
895  for (l_p = 0; l_p <= 1; l_p++) {
896  int rPart = layerId(rawId, l_p).rawId();
897  switch (l_p) {
898  case 0:
899  valueA = valueL;
900  break;
901  case 1:
902  valueA = valueR;
903  break;
904  default:
905  break;
906  }
907  // std::cout << "layer values: " << type << " " << valueA << " "
908  // << valueS << " "
909  // << valueC << std::endl;
911  hvChecker->checkCurrentStatus(rPart, type, valueA, valueC, valueS, snapshotValues, aliasMap, layerMap);
912  if (!flag.a && !flag.c && !flag.s)
913  continue;
914  setChannelFlag(hv, whe, sta, sec, qua, lay, l_p, flag);
915  std::map<int, std::vector<int>*>::const_iterator m_iter = channelSplit.find(rPart);
916  std::map<int, std::vector<int>*>::const_iterator m_iend = channelSplit.end();
917  if (m_iter != m_iend) {
918  std::vector<int>* cList = m_iter->second;
919  std::vector<int>::const_iterator l_iter = cList->begin();
920  std::vector<int>::const_iterator l_iend = cList->end();
921  while (l_iter != l_iend) {
922  DTWireId chlId(*l_iter++);
923  int wh2 = chlId.wheel();
924  int st2 = chlId.station();
925  int se2 = chlId.sector();
926  int qu2 = chlId.superLayer();
927  int la2 = chlId.layer();
928  int lp2 = chlId.wire() - 10;
929  // std::cout << "duplicate "
930  // << whe << " " << sta << " " << sec << " "
931  // << qua << " " << lay << " " << l_p << " ---> "
932  // << wh2 << " " << st2 << " " << se2 << " "
933  // << qu2 << " " << la2 << " " << lp2 << std::endl;
934  setChannelFlag(hv, wh2, st2, se2, qu2, la2, lp2, flag);
935  }
936  }
937  }
938  }
939  }
940  return hv;
941 }
void getLayerValues(int rawId, int type, float &valueL, float &valueR, float &valueS, float &valueC)
static DTWireId layerId(int rawId, int l_p)
virtual DTHVAbstractCheck::flag checkCurrentStatus(int rawId, int type, float valueA, float valueC, float valueS, const std::map< int, timedMeasurement > &snapshotValues, const std::map< int, int > &aliasMap, const std::map< int, int > &layerMap)=0
std::map< int, int > layerMap
void setChannelFlag(DTHVStatus *hv, int whe, int sta, int sec, int qua, int lay, int l_p, const DTHVAbstractCheck::flag &flag)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::map< int, int > aliasMap
DTHVAbstractCheck * hvChecker
std::map< int, timedMeasurement > snapshotValues
std::map< int, std::vector< int > * > channelSplit

◆ recoverLastTime()

cond::Time_t DTHVStatusHandler::recoverLastTime ( )
private

Definition at line 640 of file DTHVStatusHandler.cc.

References condTime(), mps_splice::entry, L1DTConfigBti_cff::LL, and snapshotValues.

Referenced by updateHVStatus().

640  {
641  long long int lastTime = 0LL;
642  long long int chanTime = 0LL;
643  std::map<int, timedMeasurement>::iterator mapIter = snapshotValues.begin();
644  std::map<int, timedMeasurement>::iterator mapIend = snapshotValues.end();
645  while (mapIter != mapIend) {
646  const std::pair<int, timedMeasurement>& entry = *mapIter++;
647  chanTime = entry.second.first;
648  if (lastTime < chanTime)
649  lastTime = chanTime;
650  }
651  return condTime(lastTime);
652  /*
653  coral::ITable& infoTable =
654  buff_session.nominalSchema().tableHandle( "LOG" );
655  std::unique_ptr<coral::IQuery> infoQuery( infoTable.newQuery() );
656  infoQuery->addToOutputList( "SNAPSHOT" );
657  coral::ICursor& infoCursor = infoQuery->execute();
658  coral::TimeStamp time;
659  while ( infoCursor.next() ) {
660  time = infoCursor.currentRow()["SNAPSHOT"].data<coral::TimeStamp>();
661  }
662  return condTime( time );
663 */
664 }
static cond::Time_t condTime(const coral::TimeStamp &time)
std::map< int, timedMeasurement > snapshotValues

◆ recoverSnapshot()

int DTHVStatusHandler::recoverSnapshot ( )
private

Definition at line 599 of file DTHVStatusHandler.cc.

References buff_session, gather_cfg::cout, layerMap, cond::persistency::Session::nominalSchema(), DetId::rawId(), fileinputsource_cfi::sec, snapshotValues, hcalRecHitTable_cff::time, and relativeConstraints::value.

Referenced by updateHVStatus().

599  {
600  int missingChannels = 0;
601  std::map<int, int>::const_iterator layIter = layerMap.begin();
602  std::map<int, int>::const_iterator layIend = layerMap.end();
603  std::cout << "retrieve snapshot table..." << std::endl;
604  coral::ITable& hvssTable = buff_session.nominalSchema().tableHandle("HVSNAPSHOT");
605  std::unique_ptr<coral::IQuery> hvssQuery(hvssTable.newQuery());
606  hvssQuery->addToOutputList("TIME");
607  hvssQuery->addToOutputList("WHEEL");
608  hvssQuery->addToOutputList("STATION");
609  hvssQuery->addToOutputList("SECTOR");
610  hvssQuery->addToOutputList("SUPERLAYER");
611  hvssQuery->addToOutputList("LAYER");
612  hvssQuery->addToOutputList("CHAN");
613  hvssQuery->addToOutputList("TYPE");
614  hvssQuery->addToOutputList("VALUE");
615  coral::ICursor& hvssCursor = hvssQuery->execute();
616  while (hvssCursor.next()) {
617  coral::TimeStamp time = hvssCursor.currentRow()["TIME"].data<coral::TimeStamp>();
618  int whe = hvssCursor.currentRow()["WHEEL"].data<int>();
619  int sta = hvssCursor.currentRow()["STATION"].data<int>();
620  int sec = hvssCursor.currentRow()["SECTOR"].data<int>();
621  int qua = hvssCursor.currentRow()["SUPERLAYER"].data<int>();
622  int lay = hvssCursor.currentRow()["LAYER"].data<int>();
623  int l_p = hvssCursor.currentRow()["CHAN"].data<int>();
624  int mty = hvssCursor.currentRow()["TYPE"].data<int>();
625  float value = hvssCursor.currentRow()["VALUE"].data<float>();
626  if (mty > 2)
627  continue;
628  DTWireId wireId(whe, sta, sec, qua, lay, 10 + l_p);
629  layIter = layerMap.find(wireId.rawId());
630  if (layIter == layIend) {
631  continue;
632  }
633  int dpId = (layIter->second * 10) + mty;
634  snapshotValues.insert(std::pair<int, timedMeasurement>(dpId, timedMeasurement(time.total_nanoseconds(), value)));
635  missingChannels++;
636  }
637  return missingChannels;
638 }
DTHVAbstractCheck::timedMeasurement timedMeasurement
cond::persistency::Session buff_session
std::map< int, int > layerMap
coral::ISchema & nominalSchema()
Definition: Session.cc:224
Definition: value.py:1
std::map< int, timedMeasurement > snapshotValues

◆ setChannelFlag()

void DTHVStatusHandler::setChannelFlag ( DTHVStatus hv,
int  whe,
int  sta,
int  sec,
int  qua,
int  lay,
int  l_p,
const DTHVAbstractCheck::flag flag 
)
private

Definition at line 1005 of file DTHVStatusHandler.cc.

References RemoveAddSevLevel::flag, DTHVStatus::get(), laySplit, DetId::rawId(), fileinputsource_cfi::sec, and DTHVStatus::set().

Referenced by offlineList().

1006  {
1007  int fCell = 0;
1008  int lCell = 99;
1009  int flagA = 0;
1010  int flagC = 0;
1011  int flagS = 0;
1012  int searchStatus = hv->get(whe, sta, sec, qua, lay, l_p, fCell, lCell, flagA, flagC, flagS);
1013  if (searchStatus) {
1014  DTWireId wireId(whe, sta, sec, qua, lay, 10 + l_p);
1015  std::map<int, int>::const_iterator splitIter = laySplit.find(wireId.rawId());
1016  std::map<int, int>::const_iterator splitIend = laySplit.end();
1017  if (splitIter != splitIend) {
1018  int code = splitIter->second;
1019  fCell = code / 10000;
1020  lCell = code % 10000;
1021  }
1022  }
1023  flagA |= flag.a;
1024  flagC |= flag.c;
1025  flagS |= flag.s;
1026  hv->set(whe, sta, sec, qua, lay, l_p, fCell, lCell, flagA, flagC, flagS);
1027  return;
1028 }
std::map< int, int > laySplit
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int partId, int &fCell, int &lCell, int &flagA, int &flagC, int &flagS) const
get content
Definition: DTHVStatus.cc:56
int set(int wheelId, int stationId, int sectorId, int slId, int layerId, int partId, int fCell, int lCell, int flagA, int flagC, int flagS)
Definition: DTHVStatus.cc:198

◆ updateHVStatus()

void DTHVStatusHandler::updateHVStatus ( )
private

Definition at line 556 of file DTHVStatusHandler.cc.

References bwdTime, checkForPeriod(), copyHVData(), coralTime(), gather_cfg::cout, dSince, dumpAtEnd, dumpAtStart, dumpSnapshot(), lastFound, mSince, procSince, recoverLastTime(), recoverSnapshot(), loadRecoTauTagMVAsFromPrepDB_cfi::snapshotTime, and ySince.

Referenced by checkNewData().

556  {
557  int missingChannels = recoverSnapshot();
559  std::cout << " snapshot at " << snapshotTime << " ( " << coralTime(snapshotTime).total_nanoseconds() << " ) "
560  << std::endl;
561  if (snapshotTime > procSince) {
562  coral::TimeStamp coralSnap = coralTime(snapshotTime);
563  std::cout << "too recent snapshot: " << std::endl
564  << " snapshot at " << coralSnap.year() << " " << coralSnap.month() << " " << coralSnap.day() << std::endl
565  << " copy since " << ySince << " " << mSince << " " << dSince << " ( " << procSince << " )" << std::endl;
566  return;
567  }
568  long long int dTime = bwdTime;
569  dTime <<= 32;
570  cond::Time_t condUntil = procSince;
571  cond::Time_t condSince = condUntil - dTime;
572 
573  while (missingChannels) {
574  std::cout << "back iteration: " << condSince << " ( " << coralTime(condSince).total_nanoseconds() << " ) -> "
575  << condUntil << " ( " << coralTime(condUntil).total_nanoseconds() << " ) " << std::endl;
576  if (condSince <= snapshotTime)
577  condSince = snapshotTime;
578  std::cout << "corrected since: " << condSince << " ( " << coralTime(condSince).total_nanoseconds() << " ) "
579  << std::endl;
580  if (condSince >= condUntil)
581  break;
582  std::cout << "missing... " << missingChannels << std::endl;
583  checkForPeriod(condSince, condUntil, missingChannels, false);
584  condUntil = condSince;
585  condSince = condUntil - dTime;
586  }
587 
588  if (dumpAtStart)
590 
591  copyHVData();
592 
593  if (dumpAtEnd)
595 
596  return;
597 }
cond::Time_t lastFound
cond::Time_t recoverLastTime()
static coral::TimeStamp coralTime(const cond::Time_t &time)
unsigned long long Time_t
Definition: Time.h:14
cond::Time_t procSince
void dumpSnapshot(const coral::TimeStamp &time)
int checkForPeriod(cond::Time_t condSince, cond::Time_t condUntil, int &missingChannels, bool copyOffline)
long long int bwdTime

Member Data Documentation

◆ aliasMap

std::map<int, int> DTHVStatusHandler::aliasMap
private

◆ buff_session

cond::persistency::Session DTHVStatusHandler::buff_session
private

◆ bufferConnect

std::string DTHVStatusHandler::bufferConnect
private

Definition at line 92 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

◆ bwdTime

long long int DTHVStatusHandler::bwdTime
private

Definition at line 109 of file DTHVStatusHandler.h.

Referenced by updateHVStatus().

◆ channelSplit

std::map<int, std::vector<int>*> DTHVStatusHandler::channelSplit
private

Definition at line 133 of file DTHVStatusHandler.h.

Referenced by getChannelSplit(), and offlineList().

◆ dataTag

std::string DTHVStatusHandler::dataTag
private

Definition at line 88 of file DTHVStatusHandler.h.

Referenced by getNewObjects(), and offlineList().

◆ dSince

int DTHVStatusHandler::dSince
private

Definition at line 97 of file DTHVStatusHandler.h.

Referenced by getNewObjects(), and updateHVStatus().

◆ dumpAtEnd

bool DTHVStatusHandler::dumpAtEnd
private

Definition at line 108 of file DTHVStatusHandler.h.

Referenced by updateHVStatus().

◆ dumpAtStart

bool DTHVStatusHandler::dumpAtStart
private

Definition at line 107 of file DTHVStatusHandler.h.

Referenced by updateHVStatus().

◆ dUntil

int DTHVStatusHandler::dUntil
private

Definition at line 103 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

◆ fwdTime

long long int DTHVStatusHandler::fwdTime
private

Definition at line 110 of file DTHVStatusHandler.h.

Referenced by copyHVData().

◆ hSince

int DTHVStatusHandler::hSince
private

Definition at line 98 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

◆ hUntil

int DTHVStatusHandler::hUntil
private

Definition at line 104 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

◆ hvChecker

DTHVAbstractCheck* DTHVStatusHandler::hvChecker
private

◆ lastFound

cond::Time_t DTHVStatusHandler::lastFound
private

Definition at line 118 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), copyHVData(), getNewObjects(), and updateHVStatus().

◆ lastStamp

long long int DTHVStatusHandler::lastStamp
private

Definition at line 121 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), and getNewObjects().

◆ lastStatus

DTHVStatus* DTHVStatusHandler::lastStatus
private

Definition at line 93 of file DTHVStatusHandler.h.

Referenced by copyHVData().

◆ layerMap

std::map<int, int> DTHVStatusHandler::layerMap
private

◆ laySplit

std::map<int, int> DTHVStatusHandler::laySplit
private

Definition at line 132 of file DTHVStatusHandler.h.

Referenced by getLayerSplit(), and setChannelFlag().

◆ mapVersion

std::string DTHVStatusHandler::mapVersion
private

Definition at line 128 of file DTHVStatusHandler.h.

Referenced by getLayerSplit().

◆ maxPayload

int DTHVStatusHandler::maxPayload
private

Definition at line 122 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), copyHVData(), and DTHVStatusHandler().

◆ minTime

long long int DTHVStatusHandler::minTime
private

Definition at line 111 of file DTHVStatusHandler.h.

Referenced by checkForPeriod().

◆ mSince

int DTHVStatusHandler::mSince
private

Definition at line 96 of file DTHVStatusHandler.h.

Referenced by getNewObjects(), and updateHVStatus().

◆ mUntil

int DTHVStatusHandler::mUntil
private

Definition at line 102 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

◆ nextFound

cond::Time_t DTHVStatusHandler::nextFound
private

Definition at line 119 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), and getNewObjects().

◆ omds_session

cond::persistency::Session DTHVStatusHandler::omds_session
private

Definition at line 124 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), checkNewData(), dumpHVAliases(), and getNewObjects().

◆ onlineAuthentication

std::string DTHVStatusHandler::onlineAuthentication
private

Definition at line 91 of file DTHVStatusHandler.h.

Referenced by DTHVStatusHandler(), and getNewObjects().

◆ onlineConnect

std::string DTHVStatusHandler::onlineConnect
private

Definition at line 89 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

◆ procSince

cond::Time_t DTHVStatusHandler::procSince
private

Definition at line 116 of file DTHVStatusHandler.h.

Referenced by checkNewData(), copyHVData(), getNewObjects(), and updateHVStatus().

◆ procUntil

cond::Time_t DTHVStatusHandler::procUntil
private

Definition at line 117 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), checkNewData(), copyHVData(), and getNewObjects().

◆ pSince

int DTHVStatusHandler::pSince
private

Definition at line 99 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

◆ pUntil

int DTHVStatusHandler::pUntil
private

Definition at line 105 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

◆ snapshotValues

std::map<int, timedMeasurement> DTHVStatusHandler::snapshotValues
private

◆ splitVersion

std::string DTHVStatusHandler::splitVersion
private

Definition at line 129 of file DTHVStatusHandler.h.

Referenced by getChannelSplit().

◆ sSince

int DTHVStatusHandler::sSince
private

Definition at line 100 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

◆ sUntil

int DTHVStatusHandler::sUntil
private

Definition at line 106 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

◆ switchOff

bool DTHVStatusHandler::switchOff
private

Definition at line 135 of file DTHVStatusHandler.h.

Referenced by copyHVData(), and filterData().

◆ timeLimit

cond::Time_t DTHVStatusHandler::timeLimit
private

Definition at line 120 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), and getNewObjects().

◆ tmpContainer

std::vector<std::pair<DTHVStatus*, cond::Time_t> > DTHVStatusHandler::tmpContainer
private

Definition at line 134 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), and filterData().

◆ util_session

cond::persistency::Session DTHVStatusHandler::util_session
private

Definition at line 125 of file DTHVStatusHandler.h.

Referenced by checkNewData(), getChannelSplit(), getLayerSplit(), and getNewObjects().

◆ utilConnect

std::string DTHVStatusHandler::utilConnect
private

Definition at line 90 of file DTHVStatusHandler.h.

◆ ySince

int DTHVStatusHandler::ySince
private

Definition at line 95 of file DTHVStatusHandler.h.

Referenced by getNewObjects(), and updateHVStatus().

◆ yUntil

int DTHVStatusHandler::yUntil
private

Definition at line 101 of file DTHVStatusHandler.h.

Referenced by getNewObjects().