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 convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
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 ()
 
void sort ()
 
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::vector< Triplet > Container
 
typedef std::vector< std::pair< DTHVStatus *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< DTHVStatusself
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef DTHVStatus value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< DTHVStatus >
int add (value_type *payload, Summary *summary, Time_t time)
 
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< DTHVStatus >
OldContainer 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 41 of file DTHVStatusHandler.h.

Member Typedef Documentation

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

Definition at line 62 of file DTHVStatusHandler.h.

Definition at line 61 of file DTHVStatusHandler.h.

Constructor & Destructor Documentation

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

Constructor

Definition at line 52 of file DTHVStatusHandler.cc.

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

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

Destructor

Definition at line 91 of file DTHVStatusHandler.cc.

91  {
92 }

Member Function Documentation

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

Definition at line 862 of file DTHVStatusHandler.cc.

References DTHVStatus::begin(), officialStyle::chan, checkStatusChange(), condTime(), coralTime(), gather_cfg::cout, reco::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().

865  {
866 
867  std::map<int,timedMeasurement>::iterator mapIter = snapshotValues.begin();
868  std::map<int,timedMeasurement>::iterator mapIend = snapshotValues.end();
869 
870  std::map<long long int,channelValue> periodBuffer;
871 
872  coral::ITable& fwccTable =
873  omds_session.nominalSchema().tableHandle( "FWCAENCHANNEL" );
874  std::auto_ptr<coral::IQuery> fwccQuery( fwccTable.newQuery() );
875  fwccQuery->addToOutputList( "DPID" );
876  fwccQuery->addToOutputList( "CHANGE_DATE" );
877  fwccQuery->addToOutputList( "ACTUAL_VMON" );
878  fwccQuery->addToOutputList( "ACTUAL_IMON" );
879  fwccQuery->addToOutputList( "ACTUAL_ISON" );
880  fwccQuery->addToOutputList( "ACTUAL_STATUS" );
881  fwccQuery->addToOutputList( "ACTUAL_OVC" );
882  coral::AttributeList timeBindVariableList;
883  timeBindVariableList.extend( "since", typeid(coral::TimeStamp) );
884  timeBindVariableList.extend( "until", typeid(coral::TimeStamp) );
885  coral::TimeStamp coralSince = coralTime( condSince );
886  coral::TimeStamp coralUntil = coralTime( condUntil );
887  std::cout << "look for data since "
888  << coralSince.year( ) << " "
889  << coralSince.month( ) << " "
890  << coralSince.day( ) << " "
891  << coralSince.hour( ) << ":"
892  << coralSince.minute() << ":"
893  << coralSince.second() << " until "
894  << coralUntil.year( ) << " "
895  << coralUntil.month( ) << " "
896  << coralUntil.day( ) << " "
897  << coralUntil.hour( ) << ":"
898  << coralUntil.minute() << ":"
899  << coralUntil.second() << std::endl;
900  timeBindVariableList["since"].data<coral::TimeStamp>() =
901  coralTime( condSince );
902  timeBindVariableList["until"].data<coral::TimeStamp>() =
903  coralTime( condUntil );
904  fwccQuery->setCondition( "CHANGE_DATE>:since and CHANGE_DATE<:until",
905  timeBindVariableList );
906  fwccQuery->addToOrderList( "CHANGE_DATE" );
907  coral::ICursor& fwccCursor = fwccQuery->execute();
908  int nrows = 0;
909  while ( fwccCursor.next() ) {
910  nrows++;
911  const coral::Attribute& dp = fwccCursor.currentRow()["DPID" ];
912  const coral::Attribute& vmon = fwccCursor.currentRow()["ACTUAL_VMON" ];
913  const coral::Attribute& imon = fwccCursor.currentRow()["ACTUAL_IMON" ];
914  coral::TimeStamp changeTime =
915  fwccCursor.currentRow()["CHANGE_DATE"].data<coral::TimeStamp>();
916  long long int cTimeValue = changeTime.total_nanoseconds();
917  if ( !copyOffline ) cTimeValue = -cTimeValue;
918  if ( dp.isNull() ) {
919  std::cout << "------- " << nrows << std::endl;
920  continue;
921  }
922  int dpId = 10 * static_cast<int>( 0.01 +
923  fwccCursor.currentRow()["DPID"].data<float>() );
924  if ( !( vmon.isNull() ) ) {
925  while ( periodBuffer.find( cTimeValue ) !=
926  periodBuffer.end() ) cTimeValue++;
927  int chan = dpId + 1;
928  periodBuffer.insert( std::pair<long long int,channelValue> (
929  cTimeValue, channelValue( chan,
930  vmon.data<float>() ) ) );
931  }
932  if ( !( imon.isNull() ) ) {
933  while ( periodBuffer.find( cTimeValue ) !=
934  periodBuffer.end() ) cTimeValue++;
935  int chan = dpId + 2;
936  periodBuffer.insert( std::pair<long long int,channelValue> (
937  cTimeValue, channelValue( chan,
938  imon.data<float>() ) ) );
939  }
940  }
941 
942  long long int dTime = minTime;
943  dTime <<= 32;
944  std::cout << "data found in period: " << periodBuffer.size() << std::endl;
945  std::map<long long int,channelValue>::const_iterator bufIter =
946  periodBuffer.begin();
947  std::map<long long int,channelValue>::const_iterator bufIend =
948  periodBuffer.end();
949 
950  bool changedStatus = false;
951  while ( bufIter != bufIend ) {
952  const std::pair<long long int,channelValue>& entry = *bufIter++;
953  long long int mTime = entry.first;
954  if ( !copyOffline ) mTime = -mTime;
955  channelValue cValue = entry.second;
956  int chan = cValue.first;
957  float cont = cValue.second;
958  mapIter = snapshotValues.find( chan );
959  if ( ( mapIter != mapIend ) &&
960  ( mapIter->second.first < mTime ) ) {
961  nextFound = condTime( mTime );
962  if ( changedStatus ) {
963  if ( nextFound > timeLimit ) {
964  DTHVStatus* hvStatus = offlineList();
965  std::cout << "new payload "
966  << hvStatus->end() - hvStatus->begin() << std::endl;
967  tmpContainer.push_back( std::make_pair( hvStatus, lastFound ) );
968  changedStatus = false;
969  if ( !( --maxPayload ) ) {
971  std::cout << "max payload number reached" << std::endl;
972  break;
973  }
974  }
975  }
976  if ( copyOffline && !changedStatus &&
977  checkStatusChange( chan, mapIter->second.second, cont ) ) {
978  timeLimit = nextFound + dTime;
979  changedStatus = true;
980  }
981  mapIter->second = timedMeasurement( lastStamp = mTime, cont );
983  missingChannels--;
984  }
985  }
986 
987  std::cout << nrows << std::endl;
988  return nrows;
989 
990 }
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()
std::vector< std::pair< DTHVStatus *, cond::Time_t > > tmpContainer
static coral::TimeStamp coralTime(const cond::Time_t &time)
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:233
std::map< int, timedMeasurement > snapshotValues
auto dp
Definition: deltaR.h:22
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
const_iterator end() const
Definition: DTHVStatus.cc:497
const_iterator begin() const
Definition: DTHVStatus.cc:492
cond::Time_t timeLimit
void DTHVStatusHandler::checkNewData ( )
private

Definition at line 223 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().

223  {
224 
225  //to access the information on last successful log entry for this tag:
226 // cond::LogDBEntry const & lde = logDBEntry();
227 
228  //to access the lastest payload (Ref is a smart pointer)
229 // Ref payload = lastPayload();
230 
231  std::cout << "check for new data since "
232  << procSince << " "
233  << coralTime( procSince ).total_nanoseconds() << " "
234  << coralTime( procSince ).year( ) << " "
235  << coralTime( procSince ).month( ) << " "
236  << coralTime( procSince ).day( ) << " "
237  << coralTime( procSince ).hour( ) << " "
238  << coralTime( procSince ).minute() << " "
239  << coralTime( procSince ).second() << std::endl;
240  std::cout << " until "
241  << procUntil << " "
242  << coralTime( procUntil ).total_nanoseconds() << " "
243  << coralTime( procUntil ).year( ) << " "
244  << coralTime( procUntil ).month( ) << " "
245  << coralTime( procUntil ).day( ) << " "
246  << coralTime( procUntil ).hour( ) << " "
247  << coralTime( procUntil ).minute() << " "
248  << coralTime( procUntil ).second() << std::endl;
249 
250  std::set<std::string> omds_lt( omds_session.nominalSchema().listTables() );
251  std::set<std::string>::const_iterator omds_iter = omds_lt.begin();
252  std::set<std::string>::const_iterator omds_iend = omds_lt.end();
253  while ( omds_iter != omds_iend ) {
254  const std::string& istr = *omds_iter++;
255  std::cout << "TABLE: " << istr << std::endl;
256  }
257 
258  std::set<std::string> util_lt( util_session.nominalSchema().listTables() );
259  std::set<std::string>::const_iterator util_iter = util_lt.begin();
260  std::set<std::string>::const_iterator util_iend = util_lt.end();
261  while ( util_iter != util_iend ) {
262  const std::string& istr = *util_iter++;
263  std::cout << "TABLE: " << istr << std::endl;
264  }
265 
266  getLayerSplit();
267  getChannelMap();
268  getChannelSplit();
269 
270  std::cout << "open buffer db..." << std::endl;
271 
272  if ( !( buff_session.nominalSchema().existsTable( "HVSNAPSHOT" ) ) )
273  createSnapshot();
274  updateHVStatus();
275 
276  return;
277 
278 }
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:233
int DTHVStatusHandler::checkStatusChange ( int  type,
float  oldValue,
float  newValue 
)
private

Definition at line 1203 of file DTHVStatusHandler.cc.

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

Referenced by checkForPeriod().

1204  {
1205  int dpId = chan / 10;
1206  int type = chan % 10;
1207  std::map<int,int>::const_iterator aliasIter = aliasMap.find( dpId );
1208  std::map<int,int>::const_iterator aliasIend = aliasMap.end();
1209  if ( aliasIter == aliasIend ) return false;
1210  int rawId = aliasIter->second;
1211  DTWireId chlId( rawId );
1212  int l_p = chlId.wire();
1213  float valueL = 0.0;
1214  float valueR = 0.0;
1215  float valueS = 0.0;
1216  float valueC = 0.0;
1217  getLayerValues( rawId, type, valueL, valueR, valueS, valueC );
1218 // std::cout << "layer values: " << type << " " << valueL << " "
1219 // << valueR << " "
1220 // << valueS << " "
1221 // << valueC << std::endl;
1223  oldStatusL = hvChecker->checkCurrentStatus( layerId( rawId, 0 ).rawId(),
1224  type,
1225  valueL, valueC, valueS,
1227  aliasMap, layerMap );
1229  oldStatusR = hvChecker->checkCurrentStatus( layerId( rawId, 1 ).rawId(),
1230  type,
1231  valueR, valueC, valueS,
1233  aliasMap, layerMap );
1234  switch ( l_p ) {
1235  case 10:
1236  if ( valueL != oldValue ) std::cout << "*** INCONSISTENT DATA!!!!! "
1237  << type << " " << l_p << " "
1238  << oldValue << " " << valueL << " "
1239  << std::endl;
1240  valueL = newValue;
1241  break;
1242  case 11:
1243  if ( valueR != oldValue ) std::cout << "*** INCONSISTENT DATA!!!!! "
1244  << type << " " << l_p << " "
1245  << oldValue << " " << valueR << " "
1246  << std::endl;
1247  valueR = newValue;
1248  break;
1249  case 12:
1250  if ( valueS != oldValue ) std::cout << "*** INCONSISTENT DATA!!!!! "
1251  << type << " " << l_p << " "
1252  << oldValue << " " << valueS << " "
1253  << std::endl;
1254  valueS = newValue;
1255  break;
1256  case 13:
1257  if ( valueC != oldValue ) std::cout << "*** INCONSISTENT DATA!!!!! "
1258  << type << " " << l_p << " "
1259  << oldValue << " " << valueC << " "
1260  << std::endl;
1261  valueC = newValue;
1262  break;
1263  default:
1264  break;
1265  }
1267  newStatusL = hvChecker->checkCurrentStatus( layerId( rawId, 0 ).rawId(),
1268  type,
1269  valueL, valueC, valueS,
1271  aliasMap, layerMap );
1273  newStatusR = hvChecker->checkCurrentStatus( layerId( rawId, 1 ).rawId(),
1274  type,
1275  valueR, valueC, valueS,
1277  aliasMap, layerMap );
1278 
1279  if ( DTHVAbstractCheck::compare( newStatusL, oldStatusL ) &&
1280  DTHVAbstractCheck::compare( newStatusR, oldStatusR ) ) return 0;
1281  std::cout << "changed status: " << chan << " from "
1282  << oldValue << " to " << newValue << std::endl;
1283  return 1;
1284 }
type
Definition: HCALResponse.h:21
std::map< int, int > aliasMap
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
static bool compare(const DTHVAbstractCheck::flag &fl, const DTHVAbstractCheck::flag &fr)
std::map< int, timedMeasurement > snapshotValues
std::map< int, int > layerMap
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
DTHVAbstractCheck * hvChecker
cond::Time_t DTHVStatusHandler::condTime ( const coral::TimeStamp &  time)
staticprivate

Definition at line 1391 of file DTHVStatusHandler.cc.

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

1391  {
1392  cond::Time_t cTime = ( ( time.total_nanoseconds() / 1000000000 ) << 32 ) +
1393  ( ( time.total_nanoseconds() % 1000000000 ) / 1000 );
1394  return cTime;
1395 }
unsigned long long Time_t
Definition: Time.h:16
cond::Time_t DTHVStatusHandler::condTime ( long long int  time)
staticprivate

Definition at line 1398 of file DTHVStatusHandler.cc.

1398  {
1399  cond::Time_t cTime = ( ( time / 1000000000 ) << 32 ) +
1400  ( ( time % 1000000000 ) / 1000 );
1401  return cTime;
1402 }
unsigned long long Time_t
Definition: Time.h:16
void DTHVStatusHandler::copyHVData ( )
private

Definition at line 993 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().

993  {
994  long long int dTime = fwdTime;
995  dTime <<= 32;
996 
997  cond::Time_t condSince = procSince;
998  cond::Time_t condUntil = condSince + dTime;
999  if ( condUntil > procUntil ) condUntil = procUntil;
1000 
1001  int dum = 0;
1002  lastStatus = nullptr;
1003  while ( condSince < condUntil ) {
1004  checkForPeriod( condSince, condUntil, dum, true );
1005  condSince = condUntil;
1006  condUntil = condSince + dTime;
1007  if ( condUntil > procUntil ) condUntil = procUntil;
1008  }
1009  std::cout << "call filterData " << std::endl;
1010  filterData();
1011  std::cout << "filterData return "
1012  << switchOff << " "
1013  << lastFound << " "
1014  << maxPayload << " "
1015  << m_to_transfer.size() << std::endl;
1016  if ( switchOff || ( ( lastFound != 0 ) && ( maxPayload > 0 ) ) ) {
1017  DTHVStatus* hvStatus = offlineList();
1018  m_to_transfer.push_back( std::make_pair( hvStatus, lastFound ) );
1019  }
1020 
1021  return;
1022 }
DTHVStatus * lastStatus
cond::Time_t lastFound
cond::Time_t procUntil
DTHVStatus * offlineList()
unsigned long long Time_t
Definition: Time.h:16
cond::Time_t procSince
long long int fwdTime
int checkForPeriod(cond::Time_t condSince, cond::Time_t condUntil, int &missingChannels, bool copyOffline)
coral::TimeStamp DTHVStatusHandler::coralTime ( const cond::Time_t time)
staticprivate

Definition at line 1383 of file DTHVStatusHandler.cc.

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

1383  {
1384  long long int iTime = ( ( ( ( time >> 32 ) & 0xFFFFFFFF ) * 1000000000 ) +
1385  ( ( time & 0xFFFFFFFF ) * 1000 ) );
1386  coral::TimeStamp cTime( iTime );
1387  return cTime;
1388 }
void DTHVStatusHandler::createSnapshot ( )
private

Definition at line 560 of file DTHVStatusHandler.cc.

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

Referenced by checkNewData().

560  {
561  std::cout << "create snapshot description..." << std::endl;
562  coral::TableDescription hvssDesc;
563  hvssDesc.setName( "HVSNAPSHOT" );
564  hvssDesc.insertColumn( "TIME",
565  coral::AttributeSpecification::typeNameForId(
566  typeid(coral::TimeStamp) ) );
567  hvssDesc.insertColumn( "WHEEL",
568  coral::AttributeSpecification::typeNameForId(
569  typeid(int) ) );
570  hvssDesc.insertColumn( "STATION",
571  coral::AttributeSpecification::typeNameForId(
572  typeid(int) ) );
573  hvssDesc.insertColumn( "SECTOR",
574  coral::AttributeSpecification::typeNameForId(
575  typeid(int) ) );
576  hvssDesc.insertColumn( "SUPERLAYER",
577  coral::AttributeSpecification::typeNameForId(
578  typeid(int) ) );
579  hvssDesc.insertColumn( "LAYER",
580  coral::AttributeSpecification::typeNameForId(
581  typeid(int) ) );
582  hvssDesc.insertColumn( "CHAN",
583  coral::AttributeSpecification::typeNameForId(
584  typeid(int) ) );
585  hvssDesc.insertColumn( "TYPE",
586  coral::AttributeSpecification::typeNameForId(
587  typeid(int) ) );
588  hvssDesc.insertColumn( "VALUE",
589  coral::AttributeSpecification::typeNameForId(
590  typeid(float) ) );
591  std::cout << "create snapshot table..." << std::endl;
592  buff_session.nominalSchema().createTable( hvssDesc );
593  coral::ITable& bufferTable =
594  buff_session.nominalSchema().tableHandle( "HVSNAPSHOT" );
595  coral::AttributeList newMeas;
596  newMeas.extend( "TIME", typeid(coral::TimeStamp) );
597  newMeas.extend( "WHEEL", typeid(int) );
598  newMeas.extend( "STATION", typeid(int) );
599  newMeas.extend( "SECTOR", typeid(int) );
600  newMeas.extend( "SUPERLAYER", typeid(int) );
601  newMeas.extend( "LAYER", typeid(int) );
602  newMeas.extend( "CHAN", typeid(int) );
603  newMeas.extend( "TYPE", typeid(int) );
604  newMeas.extend( "VALUE", typeid(float) );
605 
606  long long int zeroTime = 0LL;
607  newMeas["TIME" ].data<coral::TimeStamp>() =
608  coral::TimeStamp( zeroTime );
609  newMeas["VALUE" ].data<float>() = -999999.0;
610 
611  std::map<int,int>::const_iterator iter = aliasMap.begin();
612  std::map<int,int>::const_iterator iend = aliasMap.end();
613  while ( iter != iend ) {
614  const std::pair<int,int>& entry= *iter++;
615  int detId = entry.second;
616  DTWireId chlId( detId );
617  newMeas["WHEEL" ].data<int>() = chlId.wheel ();
618  newMeas["STATION" ].data<int>() = chlId.station ();
619  newMeas["SECTOR" ].data<int>() = chlId.sector ();
620  newMeas["SUPERLAYER"].data<int>() = chlId.superLayer();
621  newMeas["LAYER" ].data<int>() = chlId.layer ();
622  newMeas["CHAN" ].data<int>() = chlId.wire () - 10;
623  int itype;
624  for ( itype = 1; itype <= 2; itype++ ) {
625  newMeas["TYPE" ].data<int>() = itype;
626  bufferTable.dataEditor().insertRow( newMeas );
627  }
628  }
629 
630  std::cout << "create logging info..." << std::endl;
631  if ( buff_session.nominalSchema().existsTable( "LOG" ) )
632  buff_session.nominalSchema(). dropTable( "LOG" );
633  coral::TableDescription infoDesc;
634  infoDesc.setName( "LOG" );
635  infoDesc.insertColumn( "EXECTIME",
636  coral::AttributeSpecification::typeNameForId(
637  typeid(coral::TimeStamp) ) );
638  infoDesc.insertColumn( "SNAPSHOT",
639  coral::AttributeSpecification::typeNameForId(
640  typeid(coral::TimeStamp) ) );
641  buff_session.nominalSchema().createTable( infoDesc );
642  coral::AttributeList newInfo;
643  newInfo.extend( "EXECTIME", typeid(coral::TimeStamp) );
644  newInfo.extend( "SNAPSHOT", typeid(coral::TimeStamp) );
645  newInfo["EXECTIME"].data<coral::TimeStamp>() =
646  coral::TimeStamp( zeroTime );
647  newInfo["SNAPSHOT"].data<coral::TimeStamp>() =
648  coral::TimeStamp( zeroTime );
649  coral::ITable& infoTable =
650  buff_session.nominalSchema().tableHandle( "LOG" );
651  infoTable.dataEditor().insertRow( newInfo );
652 
653  return;
654 
655 }
std::map< int, int > aliasMap
cond::persistency::Session buff_session
coral::ISchema & nominalSchema()
Definition: Session.cc:233
void DTHVStatusHandler::dumpHVAliases ( )
private

Definition at line 430 of file DTHVStatusHandler.cc.

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

Referenced by getChannelMap().

430  {
431 
432  std::cout << "DTHVStatusHandler::dumpHVAliases - begin" << std::endl;
433 
434  std::cout << "create aliases description..." << std::endl;
435  coral::TableDescription hvalDesc;
436  hvalDesc.setName( "HVALIASES" );
437  hvalDesc.insertColumn( "DETID",
438  coral::AttributeSpecification::typeNameForId(
439  typeid(int) ) );
440  hvalDesc.insertColumn( "DPID",
441  coral::AttributeSpecification::typeNameForId(
442  typeid(int) ) );
443  std::cout << "create aliases table..." << std::endl;
444  coral::ITable& hvalTable =
445  buff_session.nominalSchema().createTable( hvalDesc );
446 
447  std::cout << "open DPNAME table..." << std::endl;
448  std::map<int,std::string> idMap;
449  coral::ITable& dpidTable =
450  omds_session.nominalSchema().tableHandle( "DP_NAME2ID" );
451  std::auto_ptr<coral::IQuery> dpidQuery( dpidTable.newQuery() );
452  dpidQuery->addToOutputList( "ID" );
453  dpidQuery->addToOutputList( "DPNAME" );
454  coral::ICursor& dpidCursor = dpidQuery->execute();
455  while( dpidCursor.next() ) {
456  const coral::AttributeList& row = dpidCursor.currentRow();
457  int id = static_cast<int>( 0.01 +
458  row["ID" ].data<float>() );
459  std::string dp = row["DPNAME"].data<std::string>();
460  idMap.insert( std::pair<int,std::string>( id, dp ) );
461  }
462  std::cout << "DPNAME table read... " << idMap.size() << std::endl;
463 
464  std::cout << "open ALIASES table..." << std::endl;
465  std::map<std::string,std::string> cnMap;
466  coral::ITable& nameTable =
467  omds_session.nominalSchema().tableHandle( "ALIASES" );
468  std::auto_ptr<coral::IQuery> nameQuery( nameTable.newQuery() );
469  nameQuery->addToOutputList( "DPE_NAME" );
470  nameQuery->addToOutputList( "ALIAS" );
471  coral::ICursor& nameCursor = nameQuery->execute();
472  while( nameCursor.next() ) {
473  const coral::AttributeList& row = nameCursor.currentRow();
474  std::string dp = row["DPE_NAME"].data<std::string>();
475  std::string an = row["ALIAS" ].data<std::string>();
476  if ( an.length() < 20 ) continue;
477  cnMap.insert( std::pair<std::string,std::string>( dp, an ) );
478  }
479  std::cout << "ALIASES table read... " << cnMap.size() << std::endl;
480 
481  std::map<int,std::string>::const_iterator idIter = idMap.begin();
482  std::map<int,std::string>::const_iterator idIend = idMap.end();
483  std::string outChk( "/outputChannel" );
484  while ( idIter != idIend ) {
485  const std::pair<int,std::string>& ientry = *idIter++;
486  int dpId = ientry.first;
487  std::string dp = ientry.second;
488  int ldp = dp.length();
489  if ( ldp < 20 ) continue;
490  std::string subOut( dp.substr( ldp - 17, 17 ) );
491  std::string subChk( subOut.substr( 0, 14 ) );
492  if ( subChk != outChk ) continue;
493  std::string chName( dp.substr( 0, ldp - 17 ) );
494  chName += ".actual.OvC";
495  int chCode = subOut.c_str()[16] - '0';
496  std::map<std::string,std::string>::const_iterator jter =
497  cnMap.find( chName );
498  if ( jter == cnMap.end() ) continue;
499  const std::pair<std::string,std::string>& jentry = *jter;
500  std::cout << dp << std::endl << chName << " " << chCode << std::endl;
501  std::string an( jentry.second );
502  int al = an.length();
503  int iofw = 7 + an.find( "DT_HV_W", 0 );
504  int iofc = 3 + an.find( "_MB", 0 );
505  int iofs = 2 + an.find( "_S" , 0 );
506  int iofq = 3 + an.find( "_SL", 0 );
507  int iofl = 2 + an.find( "_L" , 0 );
508  if ( ( iofw == al ) ||
509  ( iofc == al ) ||
510  ( iofs == al ) ||
511  ( iofq == al ) ||
512  ( iofl == al ) ) {
513  break;
514  }
515  int ioew = an.find( "_", iofw );
516  int ioec = an.find( "_", iofc );
517  int ioes = an.find( "_", iofs );
518  int ioeq = an.find( "_", iofq );
519  int ioel = an.find( "_", iofl );
520  std::string swhe( an.substr( iofw, ioew - iofw ) );
521  const char* cwhe = swhe.c_str();
522  int whe = cwhe[1] - '0';
523  if ( *cwhe != 'P' ) whe = -whe;
524 
525  std::string scha( an.substr( iofc, ioec - iofc ) );
526  const char* ccha = scha.c_str();
527  int cha = *ccha - '0';
528 
529  std::string ssec( an.substr( iofs, ioes - iofs ) );
530  const char* csec = ssec.c_str();
531  int sec = ( ( *csec - '0' ) * 10 ) + ( csec[1] - '0' );
532  if ( ( csec[2] == 'R' ) && ( sec == 10 ) ) sec = 14;
533  if ( ( csec[2] == 'L' ) && ( sec == 4 ) ) sec = 13;
534 
535  std::string squa( an.substr( iofq, ioeq - iofq ) );
536  const char* cqua = squa.c_str();
537  int qua = *cqua - '0';
538 
539  std::string slay( an.substr( iofl, ioel - iofl ) );
540  const char* clay = slay.c_str();
541  int lay = *clay - '0';
542 
543  DTWireId wireId( whe, cha, sec, qua, lay, 10 + chCode );
544  int chId = wireId.rawId();
545  coral::AttributeList newChan;
546  newChan.extend( "DETID", typeid(int) );
547  newChan.extend( "DPID", typeid(int) );
548  newChan["DETID"].data<int>() = chId;
549  newChan[ "DPID"].data<int>() = dpId;
550  hvalTable.dataEditor().insertRow( newChan );
551  aliasMap.insert( std::pair<int,int>( dpId, chId ) );
552  layerMap.insert( std::pair<int,int>( chId, dpId ) );
553  }
554 
555  std::cout << "DTHVStatusHandler::dumpHVAliases - end" << std::endl;
556  return;
557 }
std::map< int, int > aliasMap
cond::persistency::Session omds_session
cond::persistency::Session buff_session
coral::ISchema & nominalSchema()
Definition: Session.cc:233
std::map< int, int > layerMap
auto dp
Definition: deltaR.h:22
void DTHVStatusHandler::dumpSnapshot ( const coral::TimeStamp &  time)
private

Definition at line 782 of file DTHVStatusHandler.cc.

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

Referenced by updateHVStatus().

782  {
783 
784  std::cout << "dump snapshot to buffer db..." << std::endl;
785  std::string emptyCondition( "" );
786  coral::AttributeList emptyBindVariableList;
787  std::map<int,int>::const_iterator mapIter = aliasMap.begin();
788  std::map<int,int>::const_iterator mapIend = aliasMap.end();
789  coral::ITable& hvssTable =
790  buff_session.nominalSchema().tableHandle( "HVSNAPSHOT" );
791  coral::ITableDataEditor& hvssEditor( hvssTable.dataEditor() );
792  long nRows = hvssEditor.deleteRows( emptyCondition, emptyBindVariableList );
793  std::cout << nRows << " rows deleted" << std::endl;
794 
795  coral::AttributeList newMeas;
796  newMeas.extend( "TIME", typeid(coral::TimeStamp) );
797  newMeas.extend( "WHEEL", typeid(int) );
798  newMeas.extend( "STATION", typeid(int) );
799  newMeas.extend( "SECTOR", typeid(int) );
800  newMeas.extend( "SUPERLAYER", typeid(int) );
801  newMeas.extend( "LAYER", typeid(int) );
802  newMeas.extend( "CHAN", typeid(int) );
803  newMeas.extend( "TYPE", typeid(int) );
804  newMeas.extend( "VALUE", typeid(float) );
805 
806  nRows = 0;
807  std::map<int,timedMeasurement>::const_iterator ssvIter =
808  snapshotValues.begin();
809  std::map<int,timedMeasurement>::const_iterator ssvIend =
810  snapshotValues.end();
811  while ( ssvIter != ssvIend ) {
812  const std::pair<int,timedMeasurement>& entry = *ssvIter++;
813  int dpty = entry.first;
814  int dpId = dpty / 10;
815  int type = dpty % 10;
816  mapIter = aliasMap.find( dpId );
817  if ( mapIter == mapIend ) continue;
818  DTWireId chlId( mapIter->second );
819  const timedMeasurement& tMeas = entry.second;
820  long long int newTime = tMeas.first;
821  newMeas["TIME" ].data<coral::TimeStamp>() =
822  coral::TimeStamp( newTime );
823  newMeas["WHEEL" ].data<int>() = chlId.wheel ();
824  newMeas["STATION" ].data<int>() = chlId.station ();
825  newMeas["SECTOR" ].data<int>() = chlId.sector ();
826  newMeas["SUPERLAYER"].data<int>() = chlId.superLayer();
827  newMeas["LAYER" ].data<int>() = chlId.layer ();
828  newMeas["CHAN" ].data<int>() = chlId.wire () - 10;
829  newMeas["TYPE" ].data<int>() = type;
830  newMeas["VALUE" ].data<float>() = tMeas.second;
831  hvssEditor.insertRow( newMeas );
832  nRows++;
833  }
834  std::cout << nRows << " rows updated" << std::endl;
835 
836  std::cout << "create logging info..." << std::endl;
837  if ( buff_session.nominalSchema().existsTable( "LOG" ) )
838  buff_session.nominalSchema(). dropTable( "LOG" );
839  coral::TableDescription infoDesc;
840  infoDesc.setName( "LOG" );
841  infoDesc.insertColumn( "EXECTIME",
842  coral::AttributeSpecification::typeNameForId(
843  typeid(coral::TimeStamp) ) );
844  infoDesc.insertColumn( "SNAPSHOT",
845  coral::AttributeSpecification::typeNameForId(
846  typeid(coral::TimeStamp) ) );
847  buff_session.nominalSchema().createTable( infoDesc );
848  coral::AttributeList newInfo;
849  newInfo.extend( "EXECTIME", typeid(coral::TimeStamp) );
850  newInfo.extend( "SNAPSHOT", typeid(coral::TimeStamp) );
851  newInfo["EXECTIME"].data<coral::TimeStamp>() = coral::TimeStamp::now();
852  newInfo["SNAPSHOT"].data<coral::TimeStamp>() = time;
853  coral::ITable& infoTable =
854  buff_session.nominalSchema().tableHandle( "LOG" );
855  infoTable.dataEditor().insertRow( newInfo );
856 
857  return;
858 
859 }
type
Definition: HCALResponse.h:21
std::map< int, int > aliasMap
DTHVAbstractCheck::timedMeasurement timedMeasurement
cond::persistency::Session buff_session
coral::ISchema & nominalSchema()
Definition: Session.cc:233
std::map< int, timedMeasurement > snapshotValues
void DTHVStatusHandler::filterData ( )
private

Definition at line 1287 of file DTHVStatusHandler.cc.

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

Referenced by copyHVData().

1287  {
1288 
1289  int maxTime = 100;
1290  int maxTtot = 600;
1291  int minDiff = 88;
1292 
1293  int iTime = 0;
1294  int pTime = 0;
1295  int nTime = 0;
1296  int iSize;
1297  int pSize;
1298  int nSize;
1299 
1300  std::vector< std::pair<DTHVStatus*, cond::Time_t> >::const_iterator iter =
1301  tmpContainer.begin();
1302  std::vector< std::pair<DTHVStatus*, cond::Time_t> >::const_iterator iend =
1303  tmpContainer.end();
1304  std::vector< std::pair<DTHVStatus*, cond::Time_t> >::const_iterator prev;
1305  std::vector< std::pair<DTHVStatus*, cond::Time_t> >::const_iterator next;
1306 
1307  while ( iter != iend ) {
1308  switchOff = false;
1309  next = iter;
1310  prev = next++;
1311  if ( next == iend ) next = prev;
1312  const DTHVStatus* iPtr = iter->first;
1313  const DTHVStatus* pPtr = prev->first;
1314  const DTHVStatus* nPtr = next->first;
1315  iSize = std::distance( iPtr->begin(), iPtr->end() );
1316  pSize = std::distance( pPtr->begin(), pPtr->end() );
1317  nSize = std::distance( nPtr->begin(), nPtr->end() );
1318  int dtot = nSize - pSize;
1319  prev = next;
1320  while ( ++next != iend ) {
1321  pPtr = prev->first;
1322  nPtr = next->first;
1323  pSize = std::distance( pPtr->begin(), pPtr->end() );
1324  nSize = std::distance( nPtr->begin(), nPtr->end() );
1325  int diff = nSize - pSize;
1326  iTime = static_cast<int>( ( iter->second >> 32 ) & 0xffffffff );
1327  pTime = static_cast<int>( ( prev->second >> 32 ) & 0xffffffff );
1328  nTime = static_cast<int>( ( next->second >> 32 ) & 0xffffffff );
1329  if ( ( nTime - pTime ) > maxTime ) break;
1330  if ( ( nTime - iTime ) > maxTtot ) break;
1331  if ( ( dtot * diff ) < 0 ) break;
1332  prev = next;
1333  }
1334  pPtr = prev->first;
1335  iSize = std::distance( iPtr->begin(), iPtr->end() );
1336  pSize = std::distance( pPtr->begin(), pPtr->end() );
1337  dtot = pSize - iSize;
1338  int dist = pTime - iTime;
1339  if ( ( dtot < -minDiff ) &&
1340  ( dist < maxTtot ) ) {
1341  std::cout << " ******** SWITCH ON "
1342  << std::distance( iter, prev ) << " "
1343  << iTime << " " << pTime << " "
1344  << iSize << " " << pSize << std::endl;
1345  m_to_transfer.push_back( std::make_pair( prev->first, prev->second ) );
1346  while ( iter != prev ) delete ( iter++->first );
1347  }
1348  if ( ( dtot > minDiff ) &&
1349  ( dist < maxTtot ) ) {
1350  std::cout << " ******** SWITCH OFF "
1351  << std::distance( iter, prev ) << " "
1352  << iTime << " " << pTime << " "
1353  << iSize << " " << pSize << std::endl;
1354  m_to_transfer.push_back( std::make_pair( prev->first, iter->second ) );
1355  switchOff = true;
1356  while ( iter != prev ) delete ( iter++->first );
1357  }
1358  if ( ( ( dtot >= -minDiff ) && ( dtot <= minDiff ) ) ||
1359  ( dist >= maxTtot ) ) {
1360  while ( iter != next ) {
1361  const std::pair<DTHVStatus*, cond::Time_t>& entry = *iter++;
1362  m_to_transfer.push_back( std::make_pair( entry.first, entry.second ) );
1363  }
1364  }
1365  iter = next;
1366  }
1367 
1368 }
std::vector< std::pair< DTHVStatus *, cond::Time_t > > tmpContainer
const_iterator end() const
Definition: DTHVStatus.cc:497
const_iterator begin() const
Definition: DTHVStatus.cc:492
void DTHVStatusHandler::getChannelMap ( )
private

Definition at line 285 of file DTHVStatusHandler.cc.

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

Referenced by checkNewData().

285  {
286 
287  if ( !( buff_session.nominalSchema().existsTable( "HVALIASES" ) ) ) {
288  dumpHVAliases();
289  }
290  else {
291  std::cout << "retrieve aliases table..." << std::endl;
292  coral::ITable& hvalTable =
293  buff_session.nominalSchema().tableHandle( "HVALIASES" );
294  std::auto_ptr<coral::IQuery> hvalQuery( hvalTable.newQuery() );
295  hvalQuery->addToOutputList( "DETID" );
296  hvalQuery->addToOutputList( "DPID" );
297  coral::ICursor& hvalCursor = hvalQuery->execute();
298  int chId;
299  int dpId;
300  while ( hvalCursor.next() ) {
301  chId = hvalCursor.currentRow()["DETID"].data<int>();
302  dpId = hvalCursor.currentRow()[ "DPID"].data<int>();
303  aliasMap.insert( std::pair<int,int>( dpId, chId ) );
304  layerMap.insert( std::pair<int,int>( chId, dpId ) );
305  }
306  }
307 
308  return;
309 
310 }
std::map< int, int > aliasMap
cond::persistency::Session buff_session
coral::ISchema & nominalSchema()
Definition: Session.cc:233
std::map< int, int > layerMap
void DTHVStatusHandler::getChannelSplit ( )
private

Definition at line 358 of file DTHVStatusHandler.cc.

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

Referenced by checkNewData().

358  {
359  std::cout << "retrieve channel split table..." << std::endl;
360  int pwhe;
361  int psec;
362  int psta;
363  int pqua;
364  int play;
365  int pl_p;
366  int swhe;
367  int ssec;
368  int ssta;
369  int squa;
370  int slay;
371  int sl_p;
372  coral::ITable& csplTable =
373  util_session.nominalSchema().tableHandle( "DT_HV_CHANNEL_SPLIT" );
374  std::auto_ptr<coral::IQuery> csplQuery( csplTable.newQuery() );
375  coral::AttributeList versionBindVariableList;
376  versionBindVariableList.extend( "version", typeid(std::string) );
377  versionBindVariableList["version"].data<std::string>() = splitVersion;
378  csplQuery->setCondition( "VERSION=:version", versionBindVariableList );
379  csplQuery->addToOutputList( "P_WHEEL" );
380  csplQuery->addToOutputList( "P_SECTOR" );
381  csplQuery->addToOutputList( "P_STATION" );
382  csplQuery->addToOutputList( "P_SUPERLAYER" );
383  csplQuery->addToOutputList( "P_LAYER" );
384  csplQuery->addToOutputList( "P_PART" );
385  csplQuery->addToOutputList( "S_NUMBER" );
386  csplQuery->addToOutputList( "S_WHEEL" );
387  csplQuery->addToOutputList( "S_SECTOR" );
388  csplQuery->addToOutputList( "S_STATION" );
389  csplQuery->addToOutputList( "S_SUPERLAYER" );
390  csplQuery->addToOutputList( "S_LAYER" );
391  csplQuery->addToOutputList( "S_PART" );
392  coral::ICursor& csplCursor = csplQuery->execute();
393  while ( csplCursor.next() ) {
394  pwhe = csplCursor.currentRow()["P_WHEEL" ].data<int>();
395  psec = csplCursor.currentRow()["P_SECTOR" ].data<int>();
396  psta = csplCursor.currentRow()["P_STATION" ].data<int>();
397  pqua = csplCursor.currentRow()["P_SUPERLAYER"].data<int>();
398  play = csplCursor.currentRow()["P_LAYER" ].data<int>();
399  pl_p = csplCursor.currentRow()["P_PART" ].data<int>();
400  csplCursor.currentRow()["S_NUMBER" ].data<int>();
401  swhe = csplCursor.currentRow()["S_WHEEL" ].data<int>();
402  ssec = csplCursor.currentRow()["S_SECTOR" ].data<int>();
403  ssta = csplCursor.currentRow()["S_STATION" ].data<int>();
404  squa = csplCursor.currentRow()["S_SUPERLAYER"].data<int>();
405  slay = csplCursor.currentRow()["S_LAYER" ].data<int>();
406  sl_p = csplCursor.currentRow()["S_PART" ].data<int>();
407  DTWireId pId( pwhe, psta, psec, pqua, play, 10 + pl_p );
408  DTWireId sId( swhe, ssta, ssec, squa, slay, 10 + sl_p );
409  int pRaw = pId.rawId();
410  int sRaw = sId.rawId();
411  std::vector<int>* splitList = nullptr;
412  std::map< int,std::vector<int>* >::iterator iter =
413  channelSplit.find( pRaw );
414  std::map< int,std::vector<int>* >::iterator iend =
415  channelSplit.end();
416  if ( iter == iend ) {
417  channelSplit.insert( std::pair< int,
418  std::vector<int>* >( pRaw, splitList =
419  new std::vector<int> ) );
420  }
421  else {
422  splitList = iter->second;
423  }
424  splitList->push_back( sRaw );
425  }
426  return;
427 }
std::map< int, std::vector< int > * > channelSplit
cond::persistency::Session util_session
coral::ISchema & nominalSchema()
Definition: Session.cc:233
std::string splitVersion
void DTHVStatusHandler::getLayerSplit ( )
private

Definition at line 313 of file DTHVStatusHandler.cc.

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

Referenced by checkNewData().

313  {
314  std::cout << "retrieve layer split table..." << std::endl;
315  int whe;
316  int sec;
317  int sta;
318  int qua;
319  int lay;
320  int l_p;
321  int f_c;
322  int l_c;
323  coral::ITable& lsplTable =
324  util_session.nominalSchema().tableHandle( "DT_HV_LAYER_SPLIT" );
325  std::cout << " layer split table got..." << std::endl;
326  std::auto_ptr<coral::IQuery> lsplQuery( lsplTable.newQuery() );
327  coral::AttributeList versionBindVariableList;
328  versionBindVariableList.extend( "version", typeid(std::string) );
329  versionBindVariableList["version"].data<std::string>() = mapVersion;
330  lsplQuery->setCondition( "VERSION=:version", versionBindVariableList );
331  lsplQuery->addToOutputList( "WHEEL" );
332  lsplQuery->addToOutputList( "SECTOR" );
333  lsplQuery->addToOutputList( "STATION" );
334  lsplQuery->addToOutputList( "SUPERLAYER" );
335  lsplQuery->addToOutputList( "LAYER" );
336  lsplQuery->addToOutputList( "PART" );
337  lsplQuery->addToOutputList( "FIRST_CELL" );
338  lsplQuery->addToOutputList( "LAST_CELL" );
339  coral::ICursor& lsplCursor = lsplQuery->execute();
340  while ( lsplCursor.next() ) {
341  whe = lsplCursor.currentRow()["WHEEL" ].data<int>();
342  sec = lsplCursor.currentRow()["SECTOR" ].data<int>();
343  sta = lsplCursor.currentRow()["STATION" ].data<int>();
344  qua = lsplCursor.currentRow()["SUPERLAYER"].data<int>();
345  lay = lsplCursor.currentRow()["LAYER" ].data<int>();
346  l_p = lsplCursor.currentRow()["PART" ].data<int>();
347  f_c = lsplCursor.currentRow()["FIRST_CELL"].data<int>();
348  l_c = lsplCursor.currentRow()[ "LAST_CELL"].data<int>();
349  DTWireId wireId( whe, sta, sec, qua, lay, 10 + l_p );
350  laySplit.insert( std::pair<int,int>( wireId.rawId(),
351  ( f_c * 10000 ) + l_c ) );
352  }
353  std::cout << "channel split table retrieved" << std::endl;
354  return;
355 }
cond::persistency::Session util_session
std::map< int, int > laySplit
coral::ISchema & nominalSchema()
Definition: Session.cc:233
void DTHVStatusHandler::getLayerValues ( int  rawId,
int  type,
float &  valueL,
float &  valueR,
float &  valueS,
float &  valueC 
)
private

Definition at line 1101 of file DTHVStatusHandler.cc.

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

Referenced by checkStatusChange(), and offlineList().

1103  {
1104  valueL =
1105  valueR =
1106  valueS =
1107  valueC = 0.0;
1108  DTWireId chlId( rawId );
1109  std::map<int,timedMeasurement>::const_iterator snapIter =
1110  snapshotValues.begin();
1111  std::map<int,timedMeasurement>::const_iterator snapIend =
1112  snapshotValues.end();
1113  int rawL = layerId( rawId, 0 ).rawId();
1114  int rawR = layerId( rawId, 1 ).rawId();
1115  int rawS = layerId( rawId, 2 ).rawId();
1116  int rawC = layerId( rawId, 3 ).rawId();
1117  std::map<int,int>::const_iterator layerIter;
1118  std::map<int,int>::const_iterator layerIend = layerMap.end();
1119  if ( ( layerIter = layerMap.find( rawL ) ) != layerIend ) {
1120  const std::pair<int,int>& layerEntry = *layerIter;
1121  int dpId = layerEntry.second;
1122  snapIter = snapshotValues.find( ( dpId * 10 ) + type );
1123  if ( snapIter != snapIend ) {
1124  const std::pair<int,timedMeasurement>& snapEntry = *snapIter;
1125  valueL = snapEntry.second.second;
1126  }
1127  else std::cout << "snapR not found" << std::endl;
1128  }
1129  else std::cout << "rawR not found" << std::endl;
1130  if ( ( layerIter = layerMap.find( rawR ) ) != layerIend ) {
1131  const std::pair<int,int>& layerEntry = *layerIter;
1132  int dpId = layerEntry.second;
1133  snapIter = snapshotValues.find( ( dpId * 10 ) + type );
1134  if ( snapIter != snapIend ) {
1135  const std::pair<int,timedMeasurement>& snapEntry = *snapIter;
1136  valueR = snapEntry.second.second;
1137  }
1138  else std::cout << "snapL not found" << std::endl;
1139  }
1140  else std::cout << "rawL not found" << std::endl;
1141  if ( ( layerIter = layerMap.find( rawS ) ) != layerIend ) {
1142  const std::pair<int,int>& layerEntry = *layerIter;
1143  int dpId = layerEntry.second;
1144  snapIter = snapshotValues.find( ( dpId * 10 ) + type );
1145  if ( snapIter != snapIend ) {
1146  const std::pair<int,timedMeasurement>& snapEntry = *snapIter;
1147  valueS = snapEntry.second.second;
1148  }
1149  else std::cout << "snapS not found" << std::endl;
1150  }
1151  else std::cout << "rawS not found" << std::endl;
1152  if ( ( layerIter = layerMap.find( rawC ) ) != layerIend ) {
1153  const std::pair<int,int>& layerEntry = *layerIter;
1154  int dpId = layerEntry.second;
1155  snapIter = snapshotValues.find( ( dpId * 10 ) + type );
1156  if ( snapIter != snapIend ) {
1157  const std::pair<int,timedMeasurement>& snapEntry = *snapIter;
1158  valueC = snapEntry.second.second;
1159  }
1160  else std::cout << "snapC not found" << std::endl;
1161  }
1162  else std::cout << "rawC not found" << std::endl;
1163 // std::cout << "layer values... " << type << " " << valueL << " "
1164 // << valueR << " "
1165 // << valueS << " "
1166 // << valueC << std::endl;
1167  return;
1168 }
type
Definition: HCALResponse.h:21
static DTWireId layerId(int rawId, int l_p)
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
std::map< int, timedMeasurement > snapshotValues
std::map< int, int > layerMap
void DTHVStatusHandler::getNewObjects ( )
overridevirtual

Operations

Implements popcon::PopConSourceHandler< DTHVStatus >.

Definition at line 97 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, DTHVStatusData::flagA, DTHVStatusData::flagC, DTHVStatusData::flagS, hSince, hUntil, hvChecker, id(), plotBeamSpotDB::last, lastFound, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< DTHVStatus >::lastPayload(), lastStamp, layerId(), layerMap, popcon::PopConSourceHandler< DTHVStatus >::m_to_transfer, mSince, mUntil, nextFound, cmsPerfSuiteHarvest::now, omds_session, onlineAuthentication, onlineConnect, jets_cff::payload, procSince, procUntil, pSince, pUntil, DTHVStatusId::sectorId, cond::persistency::ConnectionPool::setAuthenticationPath(), DTHVAbstractCheck::setStatus(), snapshotValues, sSince, cond::persistency::Transaction::start(), DTHVStatusId::stationId, sUntil, popcon::PopConSourceHandler< DTHVStatus >::tagInfo(), timeLimit, cond::persistency::Session::transaction(), util_session, DTHVStatusId::wheelId, ySince, and yUntil.

97  {
98 
99  std::cout << "get new objects..." << std::endl;
100 
101  // online DB connection - data
102  std::cout << "configure omds DbConnection" << std::endl;
104  // conn->configure( cond::CmsDefaults );
106  connection.configure();
107  std::cout << "create omds DbSession" << std::endl;
108  omds_session = connection.createSession( onlineConnect );
109  std::cout << "start omds transaction" << std::endl;
111  std::cout << "" << std::endl;
112 
113  // online DB connection - util
114  std::cout << "create util DbSession" << std::endl;
115  util_session = connection.createSession( onlineConnect );
116  std::cout << "startutil transaction" << std::endl;
118  std::cout << "" << std::endl;
119 
120  // buffer DB connection
121  std::cout << "create buffer DbSession" << std::endl;
122  buff_session = connection.createSession( bufferConnect );
123  std::cout << "start buffer transaction" << std::endl;
125 
126  // offline info
127 
128  //to access the information on the tag inside the offline database:
129  cond::TagInfo const & ti = tagInfo();
130  cond::Time_t last = ti.lastInterval.first;
131  std::cout << "latest DCS data (HV) already copied until: "
132  << last << std::endl;
133 
134  coral::TimeStamp coralSince( ySince, mSince, dSince,
135  hSince, pSince, sSince, 0 );
136  procSince = condTime( coralSince );
137  coral::TimeStamp coralUntil( yUntil, mUntil, dUntil,
138  hUntil, pUntil, sUntil, 0 );
139  procUntil = condTime( coralUntil );
140  lastFound = 0;
141  nextFound = 0;
142  timeLimit = 0;
143  lastStamp = 0;
144 
145  if ( last == 0 ) {
146  DTHVStatus* dummyStatus = new DTHVStatus( dataTag );
147  cond::Time_t snc = 1;
148  m_to_transfer.push_back( std::make_pair( dummyStatus, snc ) );
149  last = procSince + 1;
150  std::cout << "no old data... " << last << std::endl;
151  }
152  else {
153  Ref payload = lastPayload();
154  DTHVStatus::const_iterator paylIter = payload->begin();
155  DTHVStatus::const_iterator paylIend = payload->end();
156  while ( paylIter != paylIend ) {
157  const std::pair<DTHVStatusId,DTHVStatusData>& entry = *paylIter++;
158  const DTHVStatusId& chan = entry.first;
159  const DTHVStatusData& data = entry.second;
160  DTWireId id( chan.wheelId, chan.stationId, chan.sectorId,
161  chan. slId, chan. layerId, chan. partId + 10 );
162  hvChecker->setStatus( id.rawId(),
163  data.flagA, data.flagC, data.flagS,
165  aliasMap, layerMap );
166  }
167  }
168  coral::TimeStamp coralLast = coralTime( last );
169  coral::TimeStamp coralProc = coral::TimeStamp::now();
170  cond::Time_t condProc = condTime( coralProc );
171 
172  if ( procSince > condProc ) {
173  std::cout << "Required time interval in the future: "
174  << std::endl
175  << " copy since " << ySince << " "
176  << mSince << " "
177  << dSince
178  << " ( " << procSince << " )" << std::endl
179  << " current time " << coralProc.year( ) << " "
180  << coralProc.month() << " "
181  << coralProc.day( ) << std::endl;
182  }
183  if ( procUntil > condProc ) procUntil = condProc;
184  if ( last > procSince ) {
185  if ( last < procUntil ) {
186  procSince = last;
187  checkNewData();
188  }
189  else {
190  std::cout << "Required time interval already copied: "
191  << std::endl
192  << " copy until " << yUntil << " "
193  << mUntil << " "
194  << dUntil
195  << " ( " << procUntil << " )" << std::endl
196  << " data until " << coralLast.year( ) << " "
197  << coralLast.month() << " "
198  << coralLast.day( ) << std::endl;
199  }
200  }
201  else {
202  std::cout << "Required time interval not contiguous with copied data: "
203  << std::endl
204  << " data until " << coralLast.year( ) << " "
205  << coralLast.month() << " "
206  << coralLast.day( ) << std::endl
207  << " copy since " << ySince << " "
208  << mSince << " "
209  << dSince
210  << " ( " << procSince << " )" << std::endl;
211  }
212 
217 
218  return;
219 
220 }
std::string id() const override
long long int lastStamp
std::map< int, int > aliasMap
cond::Time_t lastFound
cond::persistency::Session omds_session
void start(bool readOnly=true)
Definition: Session.cc:22
cond::Time_t procUntil
cond::persistency::Session buff_session
std::string onlineConnect
static DTWireId layerId(int rawId, int l_p)
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:66
cond::persistency::Session util_session
static coral::TimeStamp coralTime(const cond::Time_t &time)
cond::ValidityInterval lastInterval
Definition: Types.h:75
cond::Time_t nextFound
unsigned long long Time_t
Definition: Time.h:16
cond::Time_t procSince
static cond::Time_t condTime(const coral::TimeStamp &time)
std::map< int, timedMeasurement > snapshotValues
std::map< int, int > layerMap
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:180
std::string onlineAuthentication
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:82
DTHVAbstractCheck * hvChecker
std::string bufferConnect
void setAuthenticationPath(const std::string &p)
cond::Time_t timeLimit
cond::TagInfo_t const & tagInfo() const
std::string DTHVStatusHandler::id ( ) const
overridevirtual

Implements popcon::PopConSourceHandler< DTHVStatus >.

Definition at line 280 of file DTHVStatusHandler.cc.

Referenced by getNewObjects().

280  {
281  return "DTHVStatusHandler";
282 }
DTWireId DTHVStatusHandler::layerId ( int  rawId,
int  l_p 
)
staticprivate

Definition at line 1371 of file DTHVStatusHandler.cc.

References DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), DTSuperLayerId::superLayer(), and DTChamberId::wheel().

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

1371  {
1372  DTWireId chlId( rawId );
1373  int whe = chlId.wheel ();
1374  int sta = chlId.station ();
1375  int sec = chlId.sector ();
1376  int qua = chlId.superLayer();
1377  int lay = chlId.layer ();
1378  DTWireId chl( whe, sta, sec, qua, lay, 10 + l_p );
1379  return chl;
1380 }
DTHVStatus * DTHVStatusHandler::offlineList ( )
private

Definition at line 1025 of file DTHVStatusHandler.cc.

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

Referenced by checkForPeriod(), and copyHVData().

1025  {
1026  DTHVStatus* hv = new DTHVStatus( dataTag );
1027  int type;
1028  float valueA = 0.0;
1029  float valueL = 0.0;
1030  float valueR = 0.0;
1031  float valueS = 0.0;
1032  float valueC = 0.0;
1033  std::map<int,int>::const_iterator layerIter = layerMap.begin();
1034  std::map<int,int>::const_iterator layerIend = layerMap.end();
1035  while ( layerIter != layerIend ) {
1036  const std::pair<int,int>& chanEntry = *layerIter++;
1037  int rawId = chanEntry.first;
1038  DTWireId chlId( rawId );
1039  int whe = chlId.wheel ();
1040  int sta = chlId.station ();
1041  int sec = chlId.sector ();
1042  int qua = chlId.superLayer();
1043  int lay = chlId.layer ();
1044  int l_p = chlId.wire();
1045  if ( l_p != 10 ) continue;
1046  for ( type = 1; type <= 2; type++ ) {
1047  getLayerValues( rawId, type, valueL, valueR, valueS, valueC );
1048  for ( l_p = 0; l_p <= 1; l_p++ ) {
1049  int rPart = layerId( rawId, l_p ).rawId();
1050  switch ( l_p ) {
1051  case 0:
1052  valueA = valueL;
1053  break;
1054  case 1:
1055  valueA = valueR;
1056  break;
1057  default:
1058  break;
1059  }
1060 // std::cout << "layer values: " << type << " " << valueA << " "
1061 // << valueS << " "
1062 // << valueC << std::endl;
1064  rPart, type,
1065  valueA, valueC, valueS,
1067  aliasMap, layerMap );
1068  if ( !flag.a && !flag.c && !flag.s ) continue;
1069  setChannelFlag( hv, whe, sta, sec, qua, lay, l_p, flag );
1070  std::map< int,std::vector<int>* >::const_iterator m_iter =
1071  channelSplit.find( rPart );
1072  std::map< int,std::vector<int>* >::const_iterator m_iend =
1073  channelSplit.end();
1074  if ( m_iter != m_iend ) {
1075  std::vector<int>* cList = m_iter->second;
1076  std::vector<int>::const_iterator l_iter = cList->begin();
1077  std::vector<int>::const_iterator l_iend = cList->end();
1078  while ( l_iter != l_iend ) {
1079  DTWireId chlId( *l_iter++ );
1080  int wh2 = chlId.wheel ();
1081  int st2 = chlId.station ();
1082  int se2 = chlId.sector ();
1083  int qu2 = chlId.superLayer();
1084  int la2 = chlId.layer ();
1085  int lp2 = chlId.wire() - 10;
1086 // std::cout << "duplicate "
1087 // << whe << " " << sta << " " << sec << " "
1088 // << qua << " " << lay << " " << l_p << " ---> "
1089 // << wh2 << " " << st2 << " " << se2 << " "
1090 // << qu2 << " " << la2 << " " << lp2 << std::endl;
1091  setChannelFlag( hv, wh2, st2, se2, qu2, la2, lp2, flag );
1092  }
1093  }
1094  }
1095  }
1096  }
1097  return hv;
1098 }
type
Definition: HCALResponse.h:21
std::map< int, int > aliasMap
void getLayerValues(int rawId, int type, float &valueL, float &valueR, float &valueS, float &valueC)
static DTWireId layerId(int rawId, int l_p)
susybsm::HSCParticleRefVector hv
Definition: classes.h:28
std::map< int, std::vector< int > * > channelSplit
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
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
std::map< int, timedMeasurement > snapshotValues
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)
DTHVAbstractCheck * hvChecker
cond::Time_t DTHVStatusHandler::recoverLastTime ( )
private

Definition at line 756 of file DTHVStatusHandler.cc.

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

Referenced by updateHVStatus().

756  {
757  long long int lastTime = 0LL;
758  long long int chanTime = 0LL;
759  std::map<int,timedMeasurement>::iterator mapIter = snapshotValues.begin();
760  std::map<int,timedMeasurement>::iterator mapIend = snapshotValues.end();
761  while ( mapIter != mapIend ) {
762  const std::pair<int,timedMeasurement>& entry = *mapIter++;
763  chanTime = entry.second.first;
764  if ( lastTime < chanTime ) lastTime = chanTime;
765  }
766  return condTime( lastTime );
767 /*
768  coral::ITable& infoTable =
769  buff_session.nominalSchema().tableHandle( "LOG" );
770  std::auto_ptr<coral::IQuery> infoQuery( infoTable.newQuery() );
771  infoQuery->addToOutputList( "SNAPSHOT" );
772  coral::ICursor& infoCursor = infoQuery->execute();
773  coral::TimeStamp time;
774  while ( infoCursor.next() ) {
775  time = infoCursor.currentRow()["SNAPSHOT"].data<coral::TimeStamp>();
776  }
777  return condTime( time );
778 */
779 }
static cond::Time_t condTime(const coral::TimeStamp &time)
std::map< int, timedMeasurement > snapshotValues
int DTHVStatusHandler::recoverSnapshot ( )
private

Definition at line 711 of file DTHVStatusHandler.cc.

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

Referenced by updateHVStatus().

711  {
712  int missingChannels = 0;
713  std::map<int,int>::const_iterator layIter = layerMap.begin();
714  std::map<int,int>::const_iterator layIend = layerMap.end();
715  std::cout << "retrieve snapshot table..." << std::endl;
716  coral::ITable& hvssTable =
717  buff_session.nominalSchema().tableHandle( "HVSNAPSHOT" );
718  std::auto_ptr<coral::IQuery> hvssQuery( hvssTable.newQuery() );
719  hvssQuery->addToOutputList( "TIME" );
720  hvssQuery->addToOutputList( "WHEEL" );
721  hvssQuery->addToOutputList( "STATION" );
722  hvssQuery->addToOutputList( "SECTOR" );
723  hvssQuery->addToOutputList( "SUPERLAYER" );
724  hvssQuery->addToOutputList( "LAYER" );
725  hvssQuery->addToOutputList( "CHAN" );
726  hvssQuery->addToOutputList( "TYPE" );
727  hvssQuery->addToOutputList( "VALUE" );
728  coral::ICursor& hvssCursor = hvssQuery->execute();
729  while ( hvssCursor.next() ) {
730  coral::TimeStamp time =
731  hvssCursor.currentRow()["TIME"].data<coral::TimeStamp>();
732  int whe = hvssCursor.currentRow()["WHEEL" ].data<int>();
733  int sta = hvssCursor.currentRow()["STATION" ].data<int>();
734  int sec = hvssCursor.currentRow()["SECTOR" ].data<int>();
735  int qua = hvssCursor.currentRow()["SUPERLAYER"].data<int>();
736  int lay = hvssCursor.currentRow()["LAYER" ].data<int>();
737  int l_p = hvssCursor.currentRow()["CHAN" ].data<int>();
738  int mty = hvssCursor.currentRow()["TYPE" ].data<int>();
739  float value = hvssCursor.currentRow()["VALUE" ].data<float>();
740  if ( mty > 2 ) continue;
741  DTWireId wireId( whe, sta, sec, qua, lay, 10 + l_p );
742  layIter = layerMap.find( wireId.rawId() );
743  if ( layIter == layIend ) {
744  continue;
745  }
746  int dpId = ( layIter->second * 10 ) + mty;
747  snapshotValues.insert( std::pair<int,timedMeasurement>(
748  dpId, timedMeasurement(
749  time.total_nanoseconds(), value ) ) );
750  missingChannels++;
751  }
752  return missingChannels;
753 }
DTHVAbstractCheck::timedMeasurement timedMeasurement
cond::persistency::Session buff_session
coral::ISchema & nominalSchema()
Definition: Session.cc:233
std::map< int, timedMeasurement > snapshotValues
std::map< int, int > layerMap
Definition: value.py:1
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 1171 of file DTHVStatusHandler.cc.

References DTHVAbstractCheck::flag::a, DTHVAbstractCheck::flag::c, DTHVStatus::get(), laySplit, DetId::rawId(), DTHVAbstractCheck::flag::s, and DTHVStatus::set().

Referenced by offlineList().

1174  {
1175  int fCell = 0;
1176  int lCell = 99;
1177  int flagA = 0;
1178  int flagC = 0;
1179  int flagS = 0;
1180  int searchStatus = hv->get( whe, sta, sec, qua, lay, l_p,
1181  fCell, lCell, flagA, flagC, flagS );
1182  if ( searchStatus ) {
1183  DTWireId wireId( whe, sta, sec, qua, lay, 10 + l_p );
1184  std::map<int,int>::const_iterator splitIter =
1185  laySplit.find( wireId.rawId() );
1186  std::map<int,int>::const_iterator splitIend =
1187  laySplit.end();
1188  if ( splitIter != splitIend ) {
1189  int code = splitIter->second;
1190  fCell = code / 10000;
1191  lCell = code % 10000;
1192  }
1193  }
1194  flagA |= flag.a;
1195  flagC |= flag.c;
1196  flagS |= flag.s;
1197  hv->set( whe, sta, sec, qua, lay, l_p,
1198  fCell, lCell, flagA, flagC, flagS );
1199  return;
1200 }
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:84
std::map< int, int > laySplit
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:267
void DTHVStatusHandler::updateHVStatus ( )
private

Definition at line 658 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().

658  {
659  int missingChannels = recoverSnapshot();
661  std::cout << " snapshot at " << snapshotTime << " ( "
662  << coralTime( snapshotTime )
663  .total_nanoseconds() << " ) "
664  << std::endl;
665  if ( snapshotTime > procSince ) {
666  coral::TimeStamp coralSnap = coralTime( snapshotTime );
667  std::cout << "too recent snapshot: " << std::endl
668  << " snapshot at " << coralSnap.year( ) << " "
669  << coralSnap.month() << " "
670  << coralSnap.day( ) << std::endl
671  << " copy since " << ySince << " "
672  << mSince << " "
673  << dSince
674  << " ( " << procSince << " )" << std::endl;
675  return;
676  }
677  long long int dTime = bwdTime;
678  dTime <<= 32;
679  cond::Time_t condUntil = procSince;
680  cond::Time_t condSince = condUntil - dTime;
681 
682  while ( missingChannels ) {
683  std::cout << "back iteration: "
684  << condSince << " ( " << coralTime( condSince )
685  .total_nanoseconds() << " ) -> "
686  << condUntil << " ( " << coralTime( condUntil )
687  .total_nanoseconds() << " ) "
688  << std::endl;
689  if ( condSince <= snapshotTime ) condSince = snapshotTime;
690  std::cout << "corrected since: "
691  << condSince << " ( " << coralTime( condSince )
692  .total_nanoseconds() << " ) "
693  << std::endl;
694  if ( condSince >= condUntil ) break;
695  std::cout << "missing... " << missingChannels << std::endl;
696  checkForPeriod( condSince, condUntil, missingChannels, false );
697  condUntil = condSince;
698  condSince = condUntil - dTime;
699  }
700 
702 
703  copyHVData();
704 
706 
707  return;
708 }
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:16
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

std::map<int,int> DTHVStatusHandler::aliasMap
private
cond::persistency::Session DTHVStatusHandler::buff_session
private
std::string DTHVStatusHandler::bufferConnect
private

Definition at line 102 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

long long int DTHVStatusHandler::bwdTime
private

Definition at line 119 of file DTHVStatusHandler.h.

Referenced by updateHVStatus().

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

Definition at line 143 of file DTHVStatusHandler.h.

Referenced by getChannelSplit(), and offlineList().

std::string DTHVStatusHandler::dataTag
private

Definition at line 98 of file DTHVStatusHandler.h.

Referenced by getNewObjects(), and offlineList().

int DTHVStatusHandler::dSince
private

Definition at line 107 of file DTHVStatusHandler.h.

Referenced by getNewObjects(), and updateHVStatus().

bool DTHVStatusHandler::dumpAtEnd
private

Definition at line 118 of file DTHVStatusHandler.h.

Referenced by updateHVStatus().

bool DTHVStatusHandler::dumpAtStart
private

Definition at line 117 of file DTHVStatusHandler.h.

Referenced by updateHVStatus().

int DTHVStatusHandler::dUntil
private

Definition at line 113 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

long long int DTHVStatusHandler::fwdTime
private

Definition at line 120 of file DTHVStatusHandler.h.

Referenced by copyHVData().

int DTHVStatusHandler::hSince
private

Definition at line 108 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

int DTHVStatusHandler::hUntil
private

Definition at line 114 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

DTHVAbstractCheck* DTHVStatusHandler::hvChecker
private
cond::Time_t DTHVStatusHandler::lastFound
private

Definition at line 128 of file DTHVStatusHandler.h.

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

long long int DTHVStatusHandler::lastStamp
private

Definition at line 131 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), and getNewObjects().

DTHVStatus* DTHVStatusHandler::lastStatus
private

Definition at line 103 of file DTHVStatusHandler.h.

Referenced by copyHVData().

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

Definition at line 142 of file DTHVStatusHandler.h.

Referenced by getLayerSplit(), and setChannelFlag().

std::string DTHVStatusHandler::mapVersion
private

Definition at line 138 of file DTHVStatusHandler.h.

Referenced by getLayerSplit().

int DTHVStatusHandler::maxPayload
private

Definition at line 132 of file DTHVStatusHandler.h.

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

long long int DTHVStatusHandler::minTime
private

Definition at line 121 of file DTHVStatusHandler.h.

Referenced by checkForPeriod().

int DTHVStatusHandler::mSince
private

Definition at line 106 of file DTHVStatusHandler.h.

Referenced by getNewObjects(), and updateHVStatus().

int DTHVStatusHandler::mUntil
private

Definition at line 112 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

cond::Time_t DTHVStatusHandler::nextFound
private

Definition at line 129 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), and getNewObjects().

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

Definition at line 134 of file DTHVStatusHandler.h.

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

std::string DTHVStatusHandler::onlineAuthentication
private

Definition at line 101 of file DTHVStatusHandler.h.

Referenced by DTHVStatusHandler(), and getNewObjects().

std::string DTHVStatusHandler::onlineConnect
private

Definition at line 99 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

cond::Time_t DTHVStatusHandler::procSince
private

Definition at line 126 of file DTHVStatusHandler.h.

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

cond::Time_t DTHVStatusHandler::procUntil
private

Definition at line 127 of file DTHVStatusHandler.h.

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

int DTHVStatusHandler::pSince
private

Definition at line 109 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

int DTHVStatusHandler::pUntil
private

Definition at line 115 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

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

Definition at line 139 of file DTHVStatusHandler.h.

Referenced by getChannelSplit().

int DTHVStatusHandler::sSince
private

Definition at line 110 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

int DTHVStatusHandler::sUntil
private

Definition at line 116 of file DTHVStatusHandler.h.

Referenced by getNewObjects().

bool DTHVStatusHandler::switchOff
private

Definition at line 145 of file DTHVStatusHandler.h.

Referenced by copyHVData(), and filterData().

cond::Time_t DTHVStatusHandler::timeLimit
private

Definition at line 130 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), and getNewObjects().

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

Definition at line 144 of file DTHVStatusHandler.h.

Referenced by checkForPeriod(), and filterData().

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

Definition at line 135 of file DTHVStatusHandler.h.

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

std::string DTHVStatusHandler::utilConnect
private

Definition at line 100 of file DTHVStatusHandler.h.

int DTHVStatusHandler::ySince
private

Definition at line 105 of file DTHVStatusHandler.h.

Referenced by getNewObjects(), and updateHVStatus().

int DTHVStatusHandler::yUntil
private

Definition at line 111 of file DTHVStatusHandler.h.

Referenced by getNewObjects().