CondTools
Ecal
src
EcalTPGLinPed.cc
Go to the documentation of this file.
1
#include "
CondTools/Ecal/interface/EcalTPGLinPed.h
"
2
#include "
CondTools/Ecal/interface/EcalTPGPedestalsHandler.h
"
3
#include "
OnlineDB/EcalCondDB/interface/EcalLogicID.h
"
4
#include "
OnlineDB/EcalCondDB/interface/LMFSextuple.h
"
5
#include "
FWCore/ParameterSet/interface/ParameterSetfwd.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::EcalTPGLinPed::EcalTPGLinPed
(
const
edm::ParameterSet
& ps)
14
: m_name(ps.getUntrackedParameter<
std
::
string
>(
"name"
,
"EcalTPGLinPedHandler"
)) {
15
std::cout
<<
"EcalTPGLinPed constructor\n"
<< std::endl;
16
}
17
18
popcon::EcalTPGLinPed::~EcalTPGLinPed
() {
19
// do nothing
20
}
21
22
void
popcon::EcalTPGLinPed::getNewObjects
() {
23
std::cout
<<
"------- Ecal -> getNewObjects\n"
;
24
25
unsigned
long
long
max_since = 1;
26
Ref
payload
= lastPayload();
27
28
// here popcon tells us which is the last since of the last object in the offline DB
29
max_since =
tagInfo
().lastInterval.since;
30
Tm
max_since_tm(max_since);
31
32
int
fileIOV;
33
std::cout
<<
"LinPed which input IOV do you want "
<< std::endl;
34
std::cin >> fileIOV;
35
std::ifstream fLin;
36
std::ostringstream oss;
37
oss << fileIOV;
38
std::string
fname
=
"/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_"
+ oss.str() +
"_spikekill.txt"
;
39
fLin.open(
fname
.c_str());
40
if
(!fLin.is_open()) {
41
std::cout
<<
"ERROR : can't open file '"
<<
fname
<< std::endl;
42
return
;
43
}
44
std::cout
<<
" file "
<<
fname
<<
" opened"
<< std::endl;
45
std::string
line
;
46
for
(
int
i
= 0;
i
< 85;
i
++)
47
getline(fLin,
line
);
48
char
cryst[10];
49
uint32_t ped[
kGains
],
mult
[
kGains
],
shift
[
kGains
];
50
uint32_t
id
;
51
EcalTPGLinearizationConst
* linC =
new
EcalTPGLinearizationConst
;
52
EcalTPGPedestals
* peds =
new
EcalTPGPedestals
;
53
for
(
int
iChannel = 0; iChannel <
kEBChannels
; iChannel++) {
54
getline(fLin,
line
);
55
sscanf(
line
.c_str(),
"%s %u"
, cryst, &
id
);
56
for
(
int
gain
= 0;
gain
<
kGains
;
gain
++) {
57
getline(fLin,
line
);
58
sscanf(
line
.c_str(),
"%X %X %X"
, &ped[
gain
], &
mult
[
gain
], &
shift
[
gain
]);
59
}
60
EcalTPGLinearizationConst::Item
item
;
61
item
.mult_x1 =
mult
[2];
62
item
.mult_x6 =
mult
[1];
63
item
.mult_x12 =
mult
[0];
64
item
.shift_x1 =
shift
[2];
65
item
.shift_x6 =
shift
[1];
66
item
.shift_x12 =
shift
[0];
67
68
EcalTPGPedestals::Item
itemPed;
69
itemPed.
mean_x1
= ped[2];
70
itemPed.
mean_x6
= ped[1];
71
itemPed.
mean_x12
= ped[0];
72
73
linC->
insert
(std::make_pair(
id
,
item
));
74
peds->
insert
(std::make_pair(
id
, itemPed));
75
}
// end loop over EB channels
76
getline(fLin,
line
);
// comment before EE crystals
77
std::cout
<<
" comment line "
<<
line
<< std::endl;
78
for
(
int
iChannel = 0; iChannel <
kEEChannels
; iChannel++) {
79
getline(fLin,
line
);
80
// std::cout << " line " << line << std::endl;
81
sscanf(
line
.c_str(),
"%s %u"
, cryst, &
id
);
82
// std::cout << cryst << " id " << id << std::endl;
83
for
(
int
gain
= 0;
gain
<
kGains
;
gain
++) {
84
getline(fLin,
line
);
85
// std::cout << " line g " << line << std::endl;
86
sscanf(
line
.c_str(),
"%X %X %X"
, &ped[
gain
], &
mult
[
gain
], &
shift
[
gain
]);
87
// std::cout << " gain " << gain << " ped " << ped[gain] << " mult " << mult[gain] << " shift " << shift[gain]<< std::endl;
88
}
89
EcalTPGLinearizationConst::Item
item
;
90
item
.mult_x1 =
mult
[2];
91
item
.mult_x6 =
mult
[1];
92
item
.mult_x12 =
mult
[0];
93
item
.shift_x1 =
shift
[2];
94
item
.shift_x6 =
shift
[1];
95
item
.shift_x12 =
shift
[0];
96
97
EcalTPGPedestals::Item
itemPed;
98
itemPed.
mean_x1
= ped[2];
99
itemPed.
mean_x6
= ped[1];
100
itemPed.
mean_x12
= ped[0];
101
102
linC->
insert
(std::make_pair(
id
,
item
));
103
peds->
insert
(std::make_pair(
id
, itemPed));
104
}
// end loop over EE channels
105
fLin.close();
106
// for the time beeing just transfer pedestal
107
// m_to_transfer.push_back(std::make_pair(linC, fileIOV));
108
m_to_transfer.push_back(std::make_pair(peds, fileIOV));
109
110
std::cout
<<
"Ecal -> end of getNewObjects -----------\n"
;
111
}
popcon::EcalTPGLinPed::EcalTPGLinPed
EcalTPGLinPed(edm::ParameterSet const &)
Definition:
EcalTPGLinPed.cc:13
mps_fire.i
i
Definition:
mps_fire.py:355
EcalTPGPedestal::mean_x1
uint32_t mean_x1
Definition:
EcalTPGPedestals.h:12
kEEChannels
Definition:
EcalFloatCondObjectContainerUtils.h:9
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
EcalTPGPedestals
EcalTPGPedestalsMap EcalTPGPedestals
Definition:
EcalTPGPedestals.h:19
EcalTPGPedestal
Definition:
EcalTPGPedestals.h:8
EcalTPGLinearizationConstant
Definition:
EcalTPGLinearizationConst.h:8
EcalCondObjectContainer< EcalTPGLinearizationConstant >
popcon::EcalTPGLinPed::getNewObjects
void getNewObjects() override
Definition:
EcalTPGLinPed.cc:22
popcon::EcalTPGLinPed::~EcalTPGLinPed
~EcalTPGLinPed() override
Definition:
EcalTPGLinPed.cc:18
jets_cff.payload
payload
Definition:
jets_cff.py:34
Tm
Definition:
Tm.h:13
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:36
Timestamp.h
EcalTPGLinPed.h
EcalTPGPedestal::mean_x6
uint32_t mean_x6
Definition:
EcalTPGPedestals.h:11
Tm.h
B2GTnPMonitor_cfi.item
item
Definition:
B2GTnPMonitor_cfi.py:147
PedestalClient_cfi.gain
gain
Definition:
PedestalClient_cfi.py:37
EcalLogicID.h
alignmentValidation.fname
string fname
main script
Definition:
alignmentValidation.py:959
EcalTPGPedestalsHandler.h
std
Definition:
JetResolutionObject.h:76
kGains
const Int_t kGains
Definition:
EcalPedestalsHandler.cc:13
EcalCondObjectContainer::insert
void insert(std::pair< uint32_t, Item > const &a)
Definition:
EcalCondObjectContainer.h:38
edm::shift
static unsigned const int shift
Definition:
LuminosityBlockID.cc:7
triggerObjects_cff.id
id
Definition:
triggerObjects_cff.py:31
reco::JetExtendedAssociation::Ref
edm::Ref< Container > Ref
Definition:
JetExtendedAssociation.h:32
ParameterSetfwd.h
dumpRecoGeometry_cfg.tagInfo
tagInfo
Definition:
dumpRecoGeometry_cfg.py:194
VarParsing.mult
mult
Definition:
VarParsing.py:659
kEBChannels
Definition:
EcalFloatCondObjectContainerUtils.h:9
mps_splice.line
line
Definition:
mps_splice.py:76
EcalTPGLinearizationConst
EcalTPGLinearizationConstMap EcalTPGLinearizationConst
Definition:
EcalTPGLinearizationConst.h:23
EcalTPGPedestal::mean_x12
uint32_t mean_x12
Definition:
EcalTPGPedestals.h:10
LMFSextuple.h
Generated for CMSSW Reference Manual by
1.8.16