Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
// $Id: EcalTrigTowerConstituentsMapBuilder.cc,v 1.3 2009/04/08 20:36:57 heltsley Exp $
16
//
17
//
18
19
20
// user include files
21
#include "
Geometry/CaloEventSetup/plugins/EcalTrigTowerConstituentsMapBuilder.h
"
22
#include "
DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h
"
23
#include "
DataFormats/EcalDetId/interface/EBDetId.h
"
24
#include "
DataFormats/EcalDetId/interface/EEDetId.h
"
25
26
#include <iostream>
27
#include <fstream>
28
29
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
30
31
//
32
// constructors and destructor
33
//
34
EcalTrigTowerConstituentsMapBuilder::EcalTrigTowerConstituentsMapBuilder
(
const
edm::ParameterSet
& iConfig) :
35
mapFile_(iConfig.getUntrackedParameter<std::string>(
"MapFile"
,
""
))
36
{
37
//the following line is needed to tell the framework what
38
// data is being produced
39
setWhatProduced
(
this
);
40
41
//now do what ever other initialization is needed
42
}
43
44
45
EcalTrigTowerConstituentsMapBuilder::~EcalTrigTowerConstituentsMapBuilder
()
46
{
47
}
48
49
//
50
// member functions
51
//
52
53
// ------------ method called to produce the data ------------
54
EcalTrigTowerConstituentsMapBuilder::ReturnType
55
EcalTrigTowerConstituentsMapBuilder::produce
(
const
IdealGeometryRecord
& iRecord)
56
{
57
std::auto_ptr<EcalTrigTowerConstituentsMap>
prod
(
new
EcalTrigTowerConstituentsMap
());
58
59
if
(!
mapFile_
.empty()) {
60
parseTextMap
(
mapFile_
,*prod);
61
}
62
return
prod
;
63
}
64
65
void
EcalTrigTowerConstituentsMapBuilder::parseTextMap
(
const
std::string&
filename
,
EcalTrigTowerConstituentsMap
& theMap) {
66
edm::FileInPath
eff(filename);
67
68
std::ifstream
f
(eff.
fullPath
().c_str());
69
if
(!
f
.good())
70
return
;
71
72
int
ietaTower,iphiTower;
73
int
ix,iy,iz;
74
char
line
[80];
// a buffer for the line to read
75
char
ch;
// a temporary for holding the end of line
76
while
((ch =
f
.peek()) !=
'-'
) {
77
f
.get(line,80,
'\n'
);
// read 80 characters to end of line
78
f
.get(ch);
// eat out the '\n'
79
// extract the numbers
80
/*
81
int mod,cry;
82
int nread = sscanf (line, " %d %d %d %d",&mod,&cry,&ietaTower,&iphiTower);
83
if (nread == 4 )
84
{
85
EEDetId eeid(mod,cry,1,EEDetId::SCCRYSTALMODE);
86
EcalTrigTowerDetId etid(1,EcalEndcap,ietaTower-45+17,iphiTower);
87
// std::cout << eeid << "\n->" << etid << std::endl;
88
theMap.assign(DetId(eeid),etid);
89
}
90
*/
91
int
nread = sscanf (line,
" %d %d %d %d %d"
,&ix,&iy,&iz,&ietaTower, &iphiTower);
92
if
(nread == 5) {
93
EEDetId
eeid(ix,iy,iz,0);
94
// std::cout << "-- manu ix eta phi " << DetId(eeid).rawId() << " " << iz << " " << ietaTower << " " << iphiTower << std::endl;
95
EcalTrigTowerDetId
etid(iz,
EcalEndcap
,ietaTower,iphiTower);
96
theMap.
assign
(
DetId
(eeid),etid);
97
}
98
99
}
100
// Pass comment line
101
f
.get(line,80,
'\n'
);
// read 80 characters to end of line
102
f
.get(ch);
// eat out the '\n'
103
// Next info line
104
f
.get(line,80,
'\n'
);
// read 80 characters to end of line
105
f
.get(ch);
// eat out the '\n'
106
// extract the numbers
107
// int nTE;
108
// sscanf (line, " %d",&nTE);
109
// nTowEta_e=nTE;
110
// while ((ch = f.peek()) != EOF) {
111
// f.get(line,80,'\n'); // read 80 characters to end of line
112
// f.get(ch); // eat out the '\n'
113
// // extract the numbers
114
// float bound;
115
// sscanf (line, " %f", &bound);
116
// eta_boundaries.push_back(bound);
117
// }
118
119
f
.close();
120
return
;
121
}
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
EcalTrigTowerConstituentsMapBuilder::produce
ReturnType produce(const IdealGeometryRecord &)
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:55
EcalTrigTowerConstituentsMap
Definition:
EcalTrigTowerConstituentsMap.h:20
EcalTrigTowerDetId
Definition:
EcalTrigTowerDetId.h:17
EcalTrigTowerConstituentsMapBuilder.h
EcalTrigTowerConstituentsMapBuilder::EcalTrigTowerConstituentsMapBuilder
EcalTrigTowerConstituentsMapBuilder(const edm::ParameterSet &)
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:34
EcalTrigTowerConstituentsMapBuilder::~EcalTrigTowerConstituentsMapBuilder
~EcalTrigTowerConstituentsMapBuilder()
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:45
edm::ESProducer::setWhatProduced
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition:
ESProducer.h:115
geometryCSVtoXML.line
tuple line
Definition:
geometryCSVtoXML.py:15
EEDetId
Definition:
EEDetId.h:16
EcalTrigTowerConstituentsMapBuilder::ReturnType
std::auto_ptr< EcalTrigTowerConstituentsMap > ReturnType
Definition:
EcalTrigTowerConstituentsMapBuilder.h:43
f
double f[11][100]
Definition:
MuScleFitUtils.cc:79
EcalTrigTowerConstituentsMapBuilder::mapFile_
std::string mapFile_
Definition:
EcalTrigTowerConstituentsMapBuilder.h:49
CrabTask.prod
tuple prod
Definition:
CrabTask.py:87
edm::FileInPath
Definition:
FileInPath.h:68
DetId
Definition:
DetId.h:20
IdealGeometryRecord
Definition:
IdealGeometryRecord.h:27
EcalTrigTowerConstituentsMapBuilder::parseTextMap
void parseTextMap(const std::string &filename, EcalTrigTowerConstituentsMap &theMap)
Definition:
EcalTrigTowerConstituentsMapBuilder.cc:65
lut2db_cfg.filename
tuple filename
Definition:
lut2db_cfg.py:20
edm::ParameterSet
Definition:
ParameterSet.h:31
EBDetId.h
EEDetId.h
EcalEndcap
Definition:
EcalSubdetector.h:12
EcalTrigTowerDetId.h
edm::FileInPath::fullPath
std::string fullPath() const
Definition:
FileInPath.cc:170
Generated for CMSSW Reference Manual by
1.8.5