CMS 3D CMS Logo

RPCIDMapSH.cc
Go to the documentation of this file.
1 /*
2  * See headers for a description
3  *
4  * \author D. Pagano - Dip. Fis. Nucl. e Teo. & INFN Pavia
5  */
6 
11 #include <sys/time.h>
13 #include <iostream>
14 
16  : m_name(pset.getUntrackedParameter<std::string>("name", "RpcData")),
17  host(pset.getUntrackedParameter<std::string>("host", "source db host")),
18  user(pset.getUntrackedParameter<std::string>("user", "source username")),
19  passw(pset.getUntrackedParameter<std::string>("passw", "source password")),
20  m_since(pset.getUntrackedParameter<unsigned long long>("since", 5)),
21  m_till(pset.getUntrackedParameter<unsigned long long>("till", 0)) {}
22 
24 
26  std::cout << "------- " << m_name << " - > getNewObjects\n"
27  << "got offlineInfo" << tagInfo().name << ", size " << tagInfo().size << ", last object valid since "
28  << tagInfo().lastInterval.since << " token " << tagInfo().lastInterval.payloadId << std::endl;
29 
30  std::cout << " ------ last entry info regarding the payload (if existing): " << logDBEntry().usertext
31  << "last record with the correct tag has been written in the db: " << logDBEntry().destinationDB
32  << std::endl;
33 
34  // snc = tagInfo().lastInterval.first;
35 
36  std::cout << std::endl << "==========================================" << std::endl;
37  std::cout << std::endl << "=============== PVSS MAP ===============" << std::endl;
38  std::cout << std::endl << "==========================================" << std::endl << std::endl;
39  snc = m_since;
40  std::cout << ">> Range mode [" << snc << ", " << m_till << "]" << std::endl;
41  std::cout << std::endl << "=============================================" << std::endl << std::endl;
42 
43  RPCFw caen(host, user, passw);
44  std::vector<RPCObPVSSmap::Item> IDMapcheck;
45 
46  IDMapcheck = caen.createIDMAP();
47  IDMapdata = new RPCObPVSSmap();
48  RPCObPVSSmap::Item Ifill;
49  std::vector<RPCObPVSSmap::Item>::iterator Iit;
50  for (Iit = IDMapcheck.begin(); Iit != IDMapcheck.end(); Iit++) {
51  Ifill = *(Iit);
52  IDMapdata->ObIDMap_rpc.push_back(Ifill);
53  }
54  std::cout << " >> Final object size: " << IDMapdata->ObIDMap_rpc.size() << std::endl;
55 
56  if (!IDMapdata->ObIDMap_rpc.empty()) {
57  niov = snc;
58  } else {
59  niov = snc;
60  std::cout << "NO DATA TO BE STORED" << std::endl;
61  }
62 
63  ::timeval tv;
64  tv.tv_sec = niov;
65  tv.tv_usec = 0;
66  edm::Timestamp tmstamp((unsigned long long)tv.tv_sec * 1000000 + (unsigned long long)tv.tv_usec);
67  std::cout << "UNIX time = " << tmstamp.value() << std::endl;
68  edm::TimeValue_t daqtime = 0LL;
69  daqtime = tv.tv_sec;
70  daqtime = (daqtime << 32) + tv.tv_usec;
71  edm::Timestamp daqstamp(daqtime);
72  edm::TimeValue_t dtime = daqstamp.value();
73  std::cout << "DAQ time = " << dtime << std::endl;
74  niov = dtime;
75  std::cout << "===> New IOV: since is = " << niov << std::endl;
76  m_to_transfer.push_back(std::make_pair((RPCObPVSSmap*)IDMapdata, niov));
77 }
string host
Definition: query.py:115
Definition: RPCFw.h:29
RPCObPVSSmapData(const edm::ParameterSet &pset)
Definition: RPCIDMapSH.cc:15
std::vector< RPCObPVSSmap::Item > createIDMAP()
Definition: RPCFw.cc:530
~RPCObPVSSmapData() override
Definition: RPCIDMapSH.cc:23
void getNewObjects() override
Definition: RPCIDMapSH.cc:25
unsigned long long TimeValue_t
Definition: Timestamp.h:21
TimeValue_t value() const
Definition: Timestamp.h:38
double dtime()