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