src
Geometry
CaloEventSetup
plugins
EcalTrigTowerConstituentsMapBuilder.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: EcalTrigTowerConstituentsMapBuilder
4
// Class: EcalTrigTowerConstituentsMapBuilder
5
//
13
//
14
// Original Author: Paolo Meridiani
15
//
16
//
17
18
#include "
Geometry/CaloEventSetup/plugins/EcalTrigTowerConstituentsMapBuilder.h
"
19
#include "
DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h
"
20
#include "
DataFormats/EcalDetId/interface/EEDetId.h
"
21
22
#include <fstream>
23
24
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
25
26
EcalTrigTowerConstituentsMapBuilder::EcalTrigTowerConstituentsMapBuilder
(
const
edm::ParameterSet
& iConfig)
27
: mapFile_(iConfig.getUntrackedParameter<
std
::
string
>(
"MapFile"
,
""
)) {
28
setWhatProduced
(
this
);
29
}
30
31
EcalTrigTowerConstituentsMapBuilder::~EcalTrigTowerConstituentsMapBuilder
() {}
32
33
EcalTrigTowerConstituentsMapBuilder::ReturnType
EcalTrigTowerConstituentsMapBuilder::produce
(
34
const
IdealGeometryRecord
& iRecord) {
35
auto
prod
= std::make_unique<EcalTrigTowerConstituentsMap>();
36
37
if
(!
mapFile_
.empty()) {
38
parseTextMap
(
mapFile_
, *
prod
);
39
}
40
return
prod
;
41
}
42
43
void
EcalTrigTowerConstituentsMapBuilder::parseTextMap
(
const
std::string
&
filename
,
44
EcalTrigTowerConstituentsMap
& theMap) {
45
edm::FileInPath
eff(
filename
);
46
47
std::ifstream
f
(eff.
fullPath
().c_str());
48
if
(!
f
.good())
49
return
;
50
51
int
ietaTower, iphiTower;
52
int
ix, iy, iz;
53
char
line
[80];
// a buffer for the line to read
54
char
ch;
// a temporary for holding the end of line
55
while
((ch =
f
.peek()) !=
'-'
) {
56
f
.get(
line
, 80,
'\n'
);
// read 80 characters to end of line
57
f
.get(ch);
// eat out the '\n'
58
// extract the numbers
59
60
int
nread = sscanf(
line
,
" %d %d %d %d %d"
, &ix, &iy, &iz, &ietaTower, &iphiTower);
61
if
(nread == 5) {
62
EEDetId
eeid(ix, iy, iz, 0);
63
EcalTrigTowerDetId
etid(iz,
EcalEndcap
, ietaTower, iphiTower);
64
theMap.
assign
(
DetId
(eeid), etid);
65
}
66
}
67
// Pass comment line
68
f
.get(
line
, 80,
'\n'
);
// read 80 characters to end of line
69
f
.get(ch);
// eat out the '\n'
70
// Next info line
71
f
.get(
line
, 80,
'\n'
);
// read 80 characters to end of line
72
f
.get(ch);
// eat out the '\n'
73
f
.close();
74
return
;
75
}
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition:
ESProducer.h:163
EcalTrigTowerConstituentsMap::assign
void assign(const DetId &cell, const EcalTrigTowerDetId &tower)
set the association between a DetId and a tower
Definition:
EcalTrigTowerConstituentsMap.cc:162
EcalTrigTowerConstituentsMapBuilder::~EcalTrigTowerConstituentsMapBuilder
~EcalTrigTowerConstituentsMapBuilder() override
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:31
MessageLogger.h
edm::FileInPath::fullPath
std::string fullPath() const
Definition:
FileInPath.cc:161
EcalTrigTowerConstituentsMapBuilder::produce
ReturnType produce(const IdealGeometryRecord &)
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:33
EcalTrigTowerConstituentsMap
Definition:
EcalTrigTowerConstituentsMap.h:19
dumpMFGeometry_cfg.prod
prod
Definition:
dumpMFGeometry_cfg.py:24
corrVsCorr.filename
filename
Definition:
corrVsCorr.py:123
EcalTrigTowerDetId
Definition:
EcalTrigTowerDetId.h:14
std
Definition:
JetResolutionObject.h:76
EcalTrigTowerConstituentsMapBuilder.h
EcalTrigTowerConstituentsMapBuilder::EcalTrigTowerConstituentsMapBuilder
EcalTrigTowerConstituentsMapBuilder(const edm::ParameterSet &)
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:26
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
EEDetId
Definition:
EEDetId.h:14
mps_splice.line
line
Definition:
mps_splice.py:76
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
EcalTrigTowerConstituentsMapBuilder::mapFile_
std::string mapFile_
Definition:
EcalTrigTowerConstituentsMapBuilder.h:46
edm::FileInPath
Definition:
FileInPath.h:61
DetId
Definition:
DetId.h:17
IdealGeometryRecord
Definition:
IdealGeometryRecord.h:25
EcalTrigTowerConstituentsMapBuilder::parseTextMap
void parseTextMap(const std::string &filename, EcalTrigTowerConstituentsMap &theMap)
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:43
edm::ParameterSet
Definition:
ParameterSet.h:48
EEDetId.h
EcalEndcap
Definition:
EcalSubdetector.h:10
EcalTrigTowerConstituentsMapBuilder::ReturnType
std::unique_ptr< EcalTrigTowerConstituentsMap > ReturnType
Definition:
EcalTrigTowerConstituentsMapBuilder.h:40
EcalTrigTowerDetId.h
Generated for CMSSW Reference Manual by
1.8.14