Main Page
Namespaces
Classes
Package Documentation
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
{
29
setWhatProduced
(
this
);
30
}
31
32
EcalTrigTowerConstituentsMapBuilder::~EcalTrigTowerConstituentsMapBuilder
()
33
{
34
}
35
36
EcalTrigTowerConstituentsMapBuilder::ReturnType
37
EcalTrigTowerConstituentsMapBuilder::produce
(
const
IdealGeometryRecord
& iRecord)
38
{
39
auto
prod
= std::make_unique<EcalTrigTowerConstituentsMap>();
40
41
if
(!
mapFile_
.empty()) {
42
parseTextMap
(
mapFile_
,*
prod
);
43
}
44
return
prod
;
45
}
46
47
void
EcalTrigTowerConstituentsMapBuilder::parseTextMap
(
const
std::string
&
filename
,
EcalTrigTowerConstituentsMap
& theMap) {
48
edm::FileInPath
eff(filename);
49
50
std::ifstream
f
(eff.
fullPath
().c_str());
51
if
(!
f
.good())
52
return
;
53
54
int
ietaTower,iphiTower;
55
int
ix,iy,iz;
56
char
line
[80];
// a buffer for the line to read
57
char
ch;
// a temporary for holding the end of line
58
while
((ch =
f
.peek()) !=
'-'
) {
59
f
.get(line,80,
'\n'
);
// read 80 characters to end of line
60
f
.get(ch);
// eat out the '\n'
61
// extract the numbers
62
63
int
nread = sscanf (line,
" %d %d %d %d %d"
,&ix,&iy,&iz,&ietaTower, &iphiTower);
64
if
(nread == 5) {
65
EEDetId
eeid(ix,iy,iz,0);
66
EcalTrigTowerDetId
etid(iz,
EcalEndcap
,ietaTower,iphiTower);
67
theMap.
assign
(
DetId
(eeid),etid);
68
}
69
70
}
71
// Pass comment line
72
f
.get(line,80,
'\n'
);
// read 80 characters to end of line
73
f
.get(ch);
// eat out the '\n'
74
// Next info line
75
f
.get(line,80,
'\n'
);
// read 80 characters to end of line
76
f
.get(ch);
// eat out the '\n'
77
f
.close();
78
return
;
79
}
parseEventContent.prod
prod
Definition:
parseEventContent.py:153
EcalTrigTowerConstituentsMap::assign
void assign(const DetId &cell, const EcalTrigTowerDetId &tower)
set the association between a DetId and a tower
Definition:
EcalTrigTowerConstituentsMap.cc:159
MessageLogger.h
geometryCSVtoXML.line
line
Definition:
geometryCSVtoXML.py:15
EcalTrigTowerConstituentsMapBuilder::produce
ReturnType produce(const IdealGeometryRecord &)
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
EcalTrigTowerConstituentsMap
Definition:
EcalTrigTowerConstituentsMap.h:19
corrVsCorr.filename
filename
Definition:
corrVsCorr.py:121
EcalTrigTowerDetId
Definition:
EcalTrigTowerDetId.h:16
std
Definition:
JetResolutionObject.h:76
EcalTrigTowerConstituentsMapBuilder.h
EcalTrigTowerConstituentsMapBuilder::EcalTrigTowerConstituentsMapBuilder
EcalTrigTowerConstituentsMapBuilder(const edm::ParameterSet &)
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:26
EcalTrigTowerConstituentsMapBuilder::~EcalTrigTowerConstituentsMapBuilder
~EcalTrigTowerConstituentsMapBuilder()
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:32
edm::ESProducer::setWhatProduced
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition:
ESProducer.h:115
EEDetId
Definition:
EEDetId.h:15
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
EcalTrigTowerConstituentsMapBuilder::mapFile_
std::string mapFile_
Definition:
EcalTrigTowerConstituentsMapBuilder.h:47
edm::FileInPath
Definition:
FileInPath.h:68
DetId
Definition:
DetId.h:18
IdealGeometryRecord
Definition:
IdealGeometryRecord.h:26
EcalTrigTowerConstituentsMapBuilder::parseTextMap
void parseTextMap(const std::string &filename, EcalTrigTowerConstituentsMap &theMap)
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:47
edm::ParameterSet
Definition:
ParameterSet.h:36
EEDetId.h
EcalEndcap
Definition:
EcalSubdetector.h:11
EcalTrigTowerConstituentsMapBuilder::ReturnType
std::unique_ptr< EcalTrigTowerConstituentsMap > ReturnType
Definition:
EcalTrigTowerConstituentsMapBuilder.h:41
EcalTrigTowerDetId.h
edm::FileInPath::fullPath
std::string fullPath() const
Definition:
FileInPath.cc:184
Generated for CMSSW Reference Manual by
1.8.11