1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#include "ExSourceHandler.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
//#include<iostream>
#include <sstream>
#include <vector>
#include <string>
#include <sstream>
#include "CondCore/CondDB/interface/Serialization.h"
namespace {
void fill(Pedestals& p, int nc) {
p.m_pedestals.reserve(nc);
for (int ichannel = 1; ichannel <= nc; ++ichannel) {
Pedestals::Item item;
item.m_mean = 1.11 * ichannel;
item.m_variance = 1.12 * ichannel;
p.m_pedestals.push_back(item);
}
}
} // namespace
popcon::ExPedestalSource::ExPedestalSource(const edm::ParameterSet& pset)
: m_name(pset.getUntrackedParameter<std::string>("name", "ExPedestalSource")),
m_since(pset.getUntrackedParameter<long long>("firstSince", 5)),
m_increment(pset.getUntrackedParameter<long long>("increment", 10)),
m_number(pset.getUntrackedParameter<long long>("number", 3)) {}
popcon::ExPedestalSource::~ExPedestalSource() {}
void popcon::ExPedestalSource::getNewObjects() {
edm::LogInfo("ExPedestalsSource") << "------- " << m_name
<< " - > getNewObjects\n"
//check whats already inside of database
<< "got offlineInfo" << tagInfo().name << ", size " << tagInfo().size
<< ", last object valid since " << tagInfo().lastInterval.since << " token "
<< tagInfo().lastInterval.payloadId << std::endl;
//edm::LogInfo ("ExPedestalsSource")
// << " ------ last entry info regarding the payload (if existing): " <<logDBEntry().usertext
// << "; last record with the correct tag (if existing) has been written in the db: "
// <<logDBEntry().destinationDB<< std::endl;
if (tagInfo().size > 0) {
Ref payload = lastPayload();
edm::LogInfo("ExPedestalsSource") << "size of last payload " << payload->m_pedestals.size() << std::endl;
}
std::cout << "first since = " << m_since << std::endl;
Pedestals* p0 = new Pedestals;
fill(*p0, 3);
m_to_transfer.push_back(std::make_pair((Pedestals*)p0, m_since));
unsigned long long since = (unsigned long long)(m_since + m_increment * (m_number - 1));
std::cout << "last since = " << since << std::endl;
unsigned long long size = 5;
for (unsigned long long j = 1; j < (unsigned long long)m_number; ++j) {
Pedestals* p1 = new Pedestals;
fill(*p1, size);
m_to_transfer.push_back(std::make_pair((Pedestals*)p1, since));
since -= m_increment;
size += 2;
}
std::ostringstream ss;
ss << "num=" << m_number << ","
<< "firstSize=3,"
<< "lastSize=" << size - 2 << std::endl;
std::ostringstream fsince;
fsince << "iov fisrtsince == " << m_since;
m_userTextLog = ss.str() + ";" + fsince.str();
edm::LogInfo("ExPedestalsSource") << "------- " << m_name << " - > getNewObjects" << std::endl;
}
|