CMS 3D CMS Logo

RPCGasSH.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 << "=================== GAS ==================" << 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<RPCObGas::Item> Gascheck;
45 
46  Gascheck = caen.createGAS(snc, m_till);
47  Gasdata = new RPCObGas();
48  RPCObGas::Item Ifill;
49  std::vector<RPCObGas::Item>::iterator Iit;
50  for (Iit = Gascheck.begin(); Iit != Gascheck.end(); Iit++) {
51  Ifill = *(Iit);
52  Gasdata->ObGas_rpc.push_back(Ifill);
53  }
54  std::cout << " >> Final object size: " << Gasdata->ObGas_rpc.size() << std::endl;
55 
56  if (!Gasdata->ObGas_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 
69  edm::TimeValue_t daqtime = 0LL;
70  daqtime = tv.tv_sec;
71  daqtime = (daqtime << 32) + tv.tv_usec;
72  edm::Timestamp daqstamp(daqtime);
73  edm::TimeValue_t dtime = daqstamp.value();
74  std::cout << "DAQ time = " << dtime << std::endl;
75 
76  niov = dtime;
77 
78  std::cout << "===> New IOV: since is = " << niov << std::endl;
79  m_to_transfer.push_back(std::make_pair((RPCObGas*)Gasdata, niov));
80 }
RpcObGasData(const edm::ParameterSet &pset)
Definition: RPCGasSH.cc:15
void getNewObjects() override
Definition: RPCGasSH.cc:25
string host
Definition: query.py:115
Definition: RPCFw.h:29
~RpcObGasData() override
Definition: RPCGasSH.cc:23
std::vector< RPCObGas::Item > createGAS(long long since, long long till)
Definition: RPCFw.cc:287
unsigned long long TimeValue_t
Definition: Timestamp.h:21
TimeValue_t value() const
Definition: Timestamp.h:38
double dtime()