62 std::ifstream
input(ascii_filename.c_str());
63 std::istringstream stream;
66 float rmin,rmax,zmin,zmax;
67 unsigned int ndetid = 0;
71 while ( std::getline(
input,line) ) {
72 if ( !std::isspace(line[0]) && !(line[0] == 35) ) {
77 stream >> index >> rmin >> rmax >> zmin >> zmax >>
type;
78 Ring ring(index,rmin,rmax,zmin,zmax,type);
79 std::getline(
input,line);
80 while (std::isspace(line[0]) || (line[0] == 35) ) {
81 std::getline(
input,line);
86 for (
unsigned int i = 0;
i < ndetid; ++
i ) {
87 std::getline(
input,line);
88 while (std::isspace(line[0]) || (line[0] == 35) ) {
89 std::getline(
input,line);
93 stream >> phi >>
detid;
96 double center_z = zmin + ((zmax-zmin)/2);
97 ringMap_.insert(std::make_pair(center_z,ring));
101 edm::LogInfo(
"RoadSearch") <<
"Read in: " <<
ringMap_.size() <<
" Rings from file: " << ascii_filename;
110 std::ofstream stream(ascii_filename.c_str());
116 stream <<
ring->second.dump();
127 stream <<
"#" << std::endl;
128 stream <<
"# Rings for the RoadSearch tracking algorithm" << std::endl;
129 stream <<
"# Ascii Dump" << std::endl;
130 stream <<
"# " << std::endl;
131 stream <<
"# Content:" << std::endl;
132 stream <<
"# " << std::endl;
133 stream <<
"# a dump of all Rings:" << std::endl;
134 stream <<
"#" << std::endl;
135 stream <<
"# Ring : index, rmin, rmax, zmin, zmax, std::multimap<phi,DetId>: Ring of DetUnits mapped in phi" << std::endl;
136 stream <<
"# " << std::endl;
137 stream <<
"# Ascii-Format:" << std::endl;
138 stream <<
"# " << std::endl;
139 stream <<
"# Ring:" << std::endl;
140 stream <<
"#" << std::endl;
141 stream <<
"# ### Ring: <index> ###" << std::endl;
142 stream <<
"# <index> <rmin> <rmax> <zmin> <zmax>" << std::endl;
143 stream <<
"# <number of DetId's in std::vector<DetId> >" << std::endl;
144 stream <<
"# <phi of DetUnit described by DetId> <DetId::rawId()>" << std::endl;
145 stream <<
"# <phi of DetUnit described by DetId> <DetId::rawId()>" << std::endl;
146 stream <<
"# ..." << std::endl;
147 stream <<
"#" << std::endl;
148 stream <<
"#" << std::endl;
159 double z_min = -999999.;
160 double z_max = 999999.;
161 double delta_z = 1.5 * 20.;
162 if ( z != 999999. ) {
169 if (
ring->second.containsDetId(
id,phi) ) {
170 return &(
ring->second);
184 double z_min = -999999.;
185 double z_max = 999999.;
186 double delta_z = 1.5 * 20.;
187 if ( z != 999999. ) {
193 if (
ring->second.getindex() == ringIndex ) {
194 return &(
ring->second);
203 unsigned int ext_int,
204 unsigned int detector)
const {
211 TIBDetId id(layer,fw_bw,ext_int,1,detector,0);
214 TIBDetId id(layer,fw_bw,ext_int,1,detector,2);
219 edm::LogError(
"RoadSearch") <<
"TIB Ring for layer: " << layer
220 <<
" fw_bw: " << fw_bw
221 <<
" ext_int: " << ext_int
222 <<
" detector: " << detector
223 <<
" with rawId: " <<
id.rawId()
224 <<
" could not be found.";
232 unsigned int ring)
const {
236 const Ring* int_ring = 0;
241 if ( int_ring == 0 ) {
246 if ( int_ring == 0 ) {
247 edm::LogError(
"RoadSearch") <<
"TID Ring for fw_bw: " << fw_bw
248 <<
" wheel: " << wheel
250 <<
" with rawId: " <<
id.rawId()
251 <<
" could not be found.";
259 unsigned int ring)
const {
270 const Ring* int_ring = 0;
273 TECDetId id(fw_bw,wheel,petal_fw_bw,petal,ring,module,0);
275 if ( int_ring == 0 ) {
276 TECDetId id(fw_bw,wheel,petal_fw_bw,petal,ring,module,2);
280 if ( int_ring == 0 ) {
281 edm::LogError(
"RoadSearch") <<
"TEC Ring for fw_bw: " << fw_bw
282 <<
" wheel: " << wheel
284 <<
" with rawId: " <<
id.rawId()
285 <<
" could not be found.";
292 unsigned int rod_fw_bw,
293 unsigned int detector)
const {
307 edm::LogError(
"RoadSearch") <<
"TOB Ring for layer: " << layer
308 <<
" rod_fw_bw: " << rod_fw_bw
309 <<
" detector: " << detector
310 <<
" with rawId: " <<
id.rawId()
311 <<
" could not be found.";
318 unsigned int detector)
const {
321 unsigned int ladder = 0;
332 unsigned int module)
const {
335 unsigned int detector = 0;
337 PXFDetId id(fw_bw+1,disk+1,detector+1,panel+1,module+1);
const Ring * getTOBRing(unsigned int layer, unsigned int rod_fw_bw, unsigned int detector) const
const Ring * getRing(DetId id, double phi=999999., double z=999999.) const
RingMap::const_iterator const_iterator
void dump(std::string ascii_filename="rings.dat") const
void dumpHeader(std::ofstream &stream) const
const Ring * getPXFRing(unsigned int fw_bw, unsigned int disk, unsigned int panel, unsigned int module) const
const Ring * getTIDRing(unsigned int fw_bw, unsigned int wheel, unsigned int ring) const
const Ring * getTIBRing(unsigned int layer, unsigned int fw_bw, unsigned int ext_int, unsigned int detector) const
const Ring * getPXBRing(unsigned int layer, unsigned int detector) const
void readInFromAsciiFile(std::string ascii_file)
const Ring * getTECRing(unsigned int fw_bw, unsigned int wheel, unsigned int ring) const
void addId(double phi, DetId id)