CondTools
Ecal
src
EcalLaser_weekly_Handler.cc
Go to the documentation of this file.
1
#include "
CondTools/Ecal/interface/EcalLaser_weekly_Handler.h
"
2
#include "
OnlineDB/EcalCondDB/interface/EcalLogicID.h
"
3
#include "
OnlineDB/EcalCondDB/interface/LMFSextuple.h
"
4
#include "
FWCore/ParameterSet/interface/ParameterSetfwd.h
"
5
#include "
CondCore/CondDB/interface/Time.h
"
6
#include "
DataFormats/Provenance/interface/Timestamp.h
"
7
#include "
OnlineDB/EcalCondDB/interface/Tm.h
"
8
9
#include <iostream>
10
#include <iomanip>
11
#include <sstream>
12
13
popcon::EcalLaser_weekly_Handler::EcalLaser_weekly_Handler
(
const
edm::ParameterSet
& ps)
14
: m_name(ps.getUntrackedParameter<
std
::
string
>(
"name"
,
"EcalLaser_weekly_Handler"
)) {
15
// wrongBy = ps.getUntrackedParameter<double>("WrongBy",1.0);
16
std::cout
<<
"EcalLaser Source handler constructor\n"
<< std::endl;
17
}
18
19
popcon::EcalLaser_weekly_Handler::~EcalLaser_weekly_Handler
() {
20
// do nothing
21
}
22
23
void
popcon::EcalLaser_weekly_Handler::getNewObjects
() {
24
// uint64_t iov[1] = {5726925116361670656};
25
// int file[1] = {190111};
26
// int file[1] = {190708};
27
const
size_t
nLmes = 92;
28
// cond::Time_t iovStart = 0;
29
uint64_t
t1
,
t2
,
t3
;
30
31
int
iIov = 0;
32
33
std::cout
<<
"------- Ecal -> getNewObjects\n"
;
34
35
unsigned
long
long
max_since = 1;
36
Ref
payload
= lastPayload();
37
38
// here popcon tells us which is the last since of the last object in the
39
// offline DB
40
max_since =
tagInfo
().lastInterval.since;
41
// Tm max_since_tm((max_since >> 32)*1000000);
42
Tm
max_since_tm(max_since);
43
// get the last object in the orcoff
44
edm::Timestamp
t_min =
edm::Timestamp
(18446744073709551615ULL);
45
46
const
EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap
& laserRatiosMap =
payload
->getLaserMap();
47
std::cout
<<
"payload->getLaserMap(): OK "
<< std::endl;
48
std::cout
<<
"Its size is "
<< laserRatiosMap.
size
() << std::endl;
49
const
EcalLaserAPDPNRatios::EcalLaserTimeStampMap
& laserTimeMap =
payload
->getTimeMap();
50
std::cout
<<
"payload->getTimeMap(): OK "
<< std::endl;
51
std::cout
<<
"Last Object in Offline DB has SINCE = "
<< max_since <<
" -> "
<< max_since_tm.
cmsNanoSeconds
() <<
" ("
52
<< max_since_tm <<
")"
53
<<
" and SIZE = "
<<
tagInfo
().size << std::endl;
54
// loop through light modules and determine the minimum date among the
55
// available channels
56
for
(
int
i
= 0;
i
< 92;
i
++) {
57
EcalLaserAPDPNRatios::EcalLaserTimeStamp
timestamp
= laserTimeMap[
i
];
58
if
(t_min >
timestamp
.t1) {
59
t_min =
timestamp
.t1;
60
}
61
}
62
63
std::cout
<<
"WOW: we just retrieved the last valid record from DB "
<< std::endl;
64
//std::cout <<"Its tmin is "<< Tm((t_min.value() >> 32)*1000000)
65
std::cout
<<
"Its tmin is "
<<
Tm
(t_min.
value
()) << std::endl;
66
67
// for(int week = 0; week < 1; week++) {
68
EcalLaserAPDPNRatios
* corrSet =
new
EcalLaserAPDPNRatios
;
69
70
EcalLaserAPDPNRatios::EcalLaserAPDPNpair
corr
;
71
int
fileIOV;
72
std::cout
<<
" which input IOV do you want "
<< std::endl;
73
std::cin >> fileIOV;
74
std::ifstream fWeek;
75
std::ostringstream oss;
76
oss << fileIOV;
77
std::string
fname
=
"../../../Tools/DBDump/bin/weekly_"
+ oss.str();
78
fWeek.open(
fname
.c_str());
79
if
(!fWeek.is_open()) {
80
std::cout
<<
"ERROR : can't open file 'weekly_"
<< oss.str() << std::endl;
81
exit
(-1);
82
}
83
std::cout
<<
" file weekly_"
<< oss.str() <<
" opened"
<< std::endl;
84
85
// find the timestamp for this run
86
std::ifstream fRunStartTime;
87
fRunStartTime.open(
"RunStartTime"
);
88
if
(!fRunStartTime.is_open()) {
89
std::cout
<<
"ERROR : cannot open file RunStartTime"
<< std::endl;
90
exit
(1);
91
}
92
uint64_t
iov = 0;
93
while
(!fRunStartTime.eof()) {
94
int
run
;
95
uint64_t
start
;
96
fRunStartTime >>
run
>>
start
;
97
if
(
run
== fileIOV) {
98
iov =
start
;
99
std::cout
<<
"run "
<<
run
<<
" timestamp "
<<
start
<<
"\n"
;
100
break
;
101
}
else
if
(
run
== fileIOV) {
102
std::cout
<<
" run "
<< fileIOV <<
" not found in RunStartTime. Let us give up"
<< std::endl;
103
exit
(-1);
104
}
105
}
106
fRunStartTime.close();
107
EcalLaserAPDPNRatios::EcalLaserTimeStamp
t
;
108
109
t1
= iov;
110
// t3 = t1 + 2597596220620800; // 1 week << 32
111
t3
=
t1
+ 7792788661862400;
// 3 weeks << 32
112
t2
=
t1
+ (
t3
-
t1
) / 2;
113
// iovStart = t1;
114
for
(
size_t
i
= 0;
i
< nLmes; ++
i
) {
115
t
.t1 =
edm::Timestamp
(
t1
);
116
t
.t2 =
edm::Timestamp
(
t2
);
117
t
.t3 =
edm::Timestamp
(
t3
);
118
corrSet->setTime(
i
,
t
);
119
}
120
121
int
rawId;
122
float
corrp;
123
for
(
int
iChannel = 0; iChannel <
kEBChannels
; iChannel++) {
124
EBDetId
ebId =
EBDetId::unhashIndex
(iChannel);
125
fWeek >> rawId >> corrp;
126
corr
.p1 =
corr
.p2 =
corr
.p3 = corrp;
127
corrSet->setValue((
int
)ebId,
corr
);
128
}
129
for
(
int
iChannel = 0; iChannel <
kEEChannels
; iChannel++) {
130
EEDetId
eeId =
EEDetId::unhashIndex
(iChannel);
131
fWeek >> rawId >> corrp;
132
corr
.p1 =
corr
.p2 =
corr
.p3 = corrp;
133
corrSet->setValue((
int
)eeId,
corr
);
134
}
135
fWeek.close();
136
137
std::cout
<<
"Write IOV "
<< iIov <<
" starting from "
<< fileIOV <<
"... "
<< std::endl;
138
// db_->writeOne(corrSet, iovStart, "EcalLaserAPDPNRatiosRcd");
139
m_to_transfer.push_back(std::make_pair(corrSet, fileIOV));
140
iIov++;
141
// } // end loop over week
142
std::cout
<<
"Ecal -> end of getNewObjects -----------\n"
;
143
}
RandomServiceHelper.t2
t2
Definition:
RandomServiceHelper.py:257
popcon::EcalLaser_weekly_Handler::~EcalLaser_weekly_Handler
~EcalLaser_weekly_Handler() override
Definition:
EcalLaser_weekly_Handler.cc:19
mps_fire.i
i
Definition:
mps_fire.py:355
start
Definition:
start.py:1
kEEChannels
Definition:
EcalFloatCondObjectContainerUtils.h:9
EBDetId
Definition:
EBDetId.h:17
EEDetId::unhashIndex
static EEDetId unhashIndex(int hi)
Definition:
EEDetId.cc:65
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
EBDetId::unhashIndex
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition:
EBDetId.h:110
edm::Timestamp::value
TimeValue_t value() const
Definition:
Timestamp.h:45
EcalCondObjectContainer::size
size_t size() const
Definition:
EcalCondObjectContainer.h:82
EcalCondObjectContainer< EcalLaserAPDPNpair >
cond::timestamp
Definition:
Time.h:19
RandomServiceHelper.t1
t1
Definition:
RandomServiceHelper.py:256
alignCSCRings.corr
dictionary corr
Definition:
alignCSCRings.py:124
jets_cff.payload
payload
Definition:
jets_cff.py:34
OrderedSet.t
t
Definition:
OrderedSet.py:90
RandomServiceHelper.t3
t3
Definition:
RandomServiceHelper.py:258
Tm
Definition:
Tm.h:13
EEDetId
Definition:
EEDetId.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
Time.h
EcalLaserAPDPNRatios::EcalLaserAPDPNpair
Definition:
EcalLaserAPDPNRatios.h:16
edm::ParameterSet
Definition:
ParameterSet.h:36
Timestamp.h
popcon::EcalLaser_weekly_Handler::getNewObjects
void getNewObjects() override
Definition:
EcalLaser_weekly_Handler.cc:23
Tm.h
EcalLaserAPDPNRatios::EcalLaserTimeStampMap
std::vector< EcalLaserTimeStamp > EcalLaserTimeStampMap
Definition:
EcalLaserAPDPNRatios.h:34
EcalLogicID.h
alignmentValidation.fname
string fname
main script
Definition:
alignmentValidation.py:959
std
Definition:
JetResolutionObject.h:76
writedatasetfile.run
run
Definition:
writedatasetfile.py:27
reco::JetExtendedAssociation::Ref
edm::Ref< Container > Ref
Definition:
JetExtendedAssociation.h:32
EcalLaser_weekly_Handler.h
ParameterSetfwd.h
dumpRecoGeometry_cfg.tagInfo
tagInfo
Definition:
dumpRecoGeometry_cfg.py:194
cond::uint64_t
unsigned long long uint64_t
Definition:
Time.h:13
beamvalidation.exit
def exit(msg="")
Definition:
beamvalidation.py:53
EcalLaserAPDPNRatios
Definition:
EcalLaserAPDPNRatios.h:14
command_line.start
start
Definition:
command_line.py:167
kEBChannels
Definition:
EcalFloatCondObjectContainerUtils.h:9
Tm::cmsNanoSeconds
uint64_t cmsNanoSeconds() const
Definition:
Tm.cc:92
EcalLaserAPDPNRatios::EcalLaserTimeStamp
Definition:
EcalLaserAPDPNRatios.h:24
popcon::EcalLaser_weekly_Handler::EcalLaser_weekly_Handler
EcalLaser_weekly_Handler(edm::ParameterSet const &)
Definition:
EcalLaser_weekly_Handler.cc:13
LMFSextuple.h
edm::Timestamp
Definition:
Timestamp.h:30
Generated for CMSSW Reference Manual by
1.8.16