CMS 3D CMS Logo

RPCStatusSH.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 
12 #include<iostream>
13 
15  m_name(pset.getUntrackedParameter<std::string>("name","RpcData")),
16  host(pset.getUntrackedParameter<std::string>("host", "source db host")),
17  user(pset.getUntrackedParameter<std::string>("user", "source username")),
18  passw(pset.getUntrackedParameter<std::string>("passw", "source password")),
19  m_since(pset.getUntrackedParameter<unsigned long long>("since",5)),
20  m_till(pset.getUntrackedParameter<unsigned long long>("till",0)){
21 }
22 
24 {
25 }
26 
28 
29  std::cout << "------- " << m_name << " - > getNewObjects\n"
30  << "got offlineInfo "<< tagInfo().name
31  << ", size " << tagInfo().size << ", last object valid since "
32  << tagInfo().lastInterval.first << " token "
33  << tagInfo().lastPayloadToken << std::endl;
34 
35  std::cout << " ------ last entry info regarding the payload (if existing): "
36  << logDBEntry().usertext << "last record with the correct tag has been written in the db: "
37  << logDBEntry().destinationDB << std::endl;
38 
39  // snc = tagInfo().lastInterval.first;
40  std::cout << std::endl << "=============================================" << std::endl;
41  std::cout << std::endl << "================== STATUS =================" << std::endl;
42  std::cout << std::endl << "=============================================" << std::endl << std::endl;
43  snc = m_since;
44  std::cout << ">> Range mode [" << snc << ", " << m_till << "]" << std::endl;
45  std::cout << std::endl << "=============================================" << std::endl << std::endl;
46 
47 
48  RPCFw caen ( host, user, passw );
49  std::vector<RPCObStatus::S_Item> Scheck;
50 
51 
52  Scheck = caen.createSTATUS(snc, m_till);
53  Sdata = new RPCObStatus();
54  RPCObStatus::S_Item Sfill;
55  std::vector<RPCObStatus::S_Item>::iterator Sit;
56  for(Sit = Scheck.begin(); Sit != Scheck.end(); Sit++)
57  {
58  Sfill = *(Sit);
59  Sdata->ObStatus_rpc.push_back(Sfill);
60  }
61  std::cout << " >> Final object size: " << Sdata->ObStatus_rpc.size() << std::endl;
62 
63  if (Sdata->ObStatus_rpc.size() > 0) {
64  niov = snc;
65  } else {
66  niov = snc;
67  std::cout << "NO DATA TO BE STORED" << std::endl;
68  }
69 
70 
71  ::timeval tv;
72  tv.tv_sec = niov;
73  tv.tv_usec = 0;
74  edm::Timestamp tmstamp((unsigned long long)tv.tv_sec*1000000+(unsigned long long)tv.tv_usec);
75  std::cout << "UNIX time = " << tmstamp.value() << std::endl;
76 
77  edm::TimeValue_t daqtime=0LL;
78  daqtime=tv.tv_sec;
79  daqtime=(daqtime<<32)+tv.tv_usec;
80  edm::Timestamp daqstamp(daqtime);
81  edm::TimeValue_t dtime = daqstamp.value();
82  std::cout<<"DAQ time = " << dtime <<std::endl;
83 
84  niov = dtime;
85 
86  std::cout << "===> New IOV: since is = " << niov << std::endl;
87  m_to_transfer.push_back(std::make_pair((RPCObStatus*)Sdata,niov));
88 }
89 
unsigned long long snc
Definition: RPCStatusSH.h:36
host
Definition: query.py:114
unsigned long long m_since
Definition: RPCStatusSH.h:45
std::string user
Definition: RPCStatusSH.h:43
std::vector< S_Item > ObStatus_rpc
Definition: RPCObCond.h:61
size_t size
Definition: Types.h:76
Definition: RPCFw.h:32
std::string name
Definition: Types.h:72
unsigned long long niov
Definition: RPCStatusSH.h:38
cond::ValidityInterval lastInterval
Definition: Types.h:74
RPCObStatus * Sdata
Definition: RPCStatusSH.h:34
cond::LogDBEntry_t const & logDBEntry() const
std::vector< RPCObStatus::S_Item > createSTATUS(long long since, long long till)
Definition: RPCFw.cc:214
unsigned long long TimeValue_t
Definition: Timestamp.h:28
RpcDataS(const edm::ParameterSet &pset)
Definition: RPCStatusSH.cc:14
std::string destinationDB
Definition: Types.h:92
std::string lastPayloadToken
Definition: Types.h:75
void getNewObjects()
Definition: RPCStatusSH.cc:27
std::string passw
Definition: RPCStatusSH.h:44
std::string host
Definition: RPCStatusSH.h:42
std::string usertext
Definition: Types.h:94
std::string m_name
Definition: RPCStatusSH.h:41
unsigned long long m_till
Definition: RPCStatusSH.h:46
TimeValue_t value() const
Definition: Timestamp.h:56
cond::TagInfo_t const & tagInfo() const