#include <RecoTracker/RingRecord/interface/Rings.h>
Public Types | |
typedef RingMap::const_iterator | const_iterator |
typedef RingMap::iterator | iterator |
typedef std::multimap< double, Ring > | RingMap |
Public Member Functions | |
const_iterator | begin () const |
iterator | begin () |
void | dump (std::string ascii_filename="rings.dat") const |
void | dumpHeader (std::ofstream &stream) const |
const_iterator | end () const |
iterator | end () |
const Ring * | getPXBRing (unsigned int layer, unsigned int detector) const |
const Ring * | getPXFRing (unsigned int fw_bw, unsigned int disk, unsigned int panel, unsigned int module) const |
const Ring * | getRing (unsigned int ringIndex, double z=999999.) const |
const Ring * | getRing (DetId id, double phi=999999., double z=999999.) const |
const Ring * | getTECRing (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 * | getTIDRing (unsigned int fw_bw, unsigned int wheel, unsigned int ring) const |
const Ring * | getTOBRing (unsigned int layer, unsigned int rod_fw_bw, unsigned int detector) const |
void | insert (double z, Ring &ring) |
const_iterator | lower_bound (double z) const |
iterator | lower_bound (double z) |
void | readInFromAsciiFile (std::string ascii_file) |
Rings (std::string ascii_file) | |
Rings () | |
const_iterator | upper_bound (double z) const |
iterator | upper_bound (double z) |
~Rings () | |
Private Attributes | |
RingMap | ringMap_ |
Definition at line 27 of file Rings.h.
typedef RingMap::const_iterator Rings::const_iterator |
typedef RingMap::iterator Rings::iterator |
typedef std::multimap<double,Ring> Rings::RingMap |
Rings::Rings | ( | ) |
Rings::Rings | ( | std::string | ascii_file | ) |
Definition at line 42 of file Rings.cc.
References readInFromAsciiFile().
00042 { 00043 // 00044 // constructor reading in ascii file 00045 // 00046 00047 readInFromAsciiFile(ascii_filename); 00048 00049 }
Rings::~Rings | ( | ) |
const_iterator Rings::begin | ( | void | ) | const [inline] |
Definition at line 42 of file Rings.h.
References ringMap_.
Referenced by RoadMaker::RingsCompatibleWithSeed().
00042 { return ringMap_.begin(); }
void Rings::dump | ( | std::string | ascii_filename = "rings.dat" |
) | const |
Definition at line 105 of file Rings.cc.
References dumpHeader(), and ringMap_.
Referenced by RingMakerESProducer::produce().
00105 { 00106 // 00107 // dump all rings in ascii file 00108 // 00109 00110 std::ofstream stream(ascii_filename.c_str()); 00111 00112 dumpHeader(stream); 00113 00114 for ( const_iterator ring = ringMap_.begin(); ring != ringMap_.end(); ++ring ) { 00115 00116 stream << ring->second.dump(); 00117 00118 } 00119 00120 }
void Rings::dumpHeader | ( | std::ofstream & | stream | ) | const |
Definition at line 122 of file Rings.cc.
References lat::endl().
Referenced by dump().
00122 { 00123 // 00124 // header with general information about content of rings ascii file 00125 // 00126 00127 stream << "#" << std::endl; 00128 stream << "# Rings for the RoadSearch tracking algorithm" << std::endl; 00129 stream << "# Ascii Dump" << std::endl; 00130 stream << "# " << std::endl; 00131 stream << "# Content:" << std::endl; 00132 stream << "# " << std::endl; 00133 stream << "# a dump of all Rings:" << std::endl; 00134 stream << "#" << std::endl; 00135 stream << "# Ring : index, rmin, rmax, zmin, zmax, std::multimap<phi,DetId>: Ring of DetUnits mapped in phi" << std::endl; 00136 stream << "# " << std::endl; 00137 stream << "# Ascii-Format:" << std::endl; 00138 stream << "# " << std::endl; 00139 stream << "# Ring:" << std::endl; 00140 stream << "#" << std::endl; 00141 stream << "# ### Ring: <index> ###" << std::endl; 00142 stream << "# <index> <rmin> <rmax> <zmin> <zmax>" << std::endl; 00143 stream << "# <number of DetId's in std::vector<DetId> >" << std::endl; 00144 stream << "# <phi of DetUnit described by DetId> <DetId::rawId()>" << std::endl; 00145 stream << "# <phi of DetUnit described by DetId> <DetId::rawId()>" << std::endl; 00146 stream << "# ..." << std::endl; 00147 stream << "#" << std::endl; 00148 stream << "#" << std::endl; 00149 00150 }
const_iterator Rings::end | ( | void | ) | const [inline] |
Definition at line 43 of file Rings.h.
References ringMap_.
Referenced by RoadMaker::RingsCompatibleWithSeed().
00043 { return ringMap_.end(); }
const Ring * Rings::getPXFRing | ( | unsigned int | fw_bw, | |
unsigned int | disk, | |||
unsigned int | panel, | |||
unsigned int | module | |||
) | const |
Definition at line 177 of file Rings.cc.
References ringMap_.
00177 { 00178 // 00179 // loop over rings to discover ring which has RingIndex ringIndex 00180 // loop is restricted to window in z 00181 00182 // calculate window around given z (if z == 999999. set window to maximum) 00183 // window is += 1.5 times the longest sensor in z (TOB: ~20 cm) 00184 double z_min = -999999.; 00185 double z_max = 999999.; 00186 double delta_z = 1.5 * 20.; 00187 if ( z != 999999. ) { 00188 z_min = z - delta_z; 00189 z_max = z + delta_z; 00190 } 00191 00192 for ( const_iterator ring = ringMap_.lower_bound(z_min); ring != ringMap_.upper_bound(z_max); ++ring ) { 00193 if ( ring->second.getindex() == ringIndex ) { 00194 return &(ring->second); 00195 } 00196 } 00197 00198 return 0; 00199 }
Definition at line 152 of file Rings.cc.
References ringMap_.
Referenced by getPXBRing(), getPXFRing(), Roads::getRing(), getTECRing(), getTIBRing(), getTIDRing(), getTOBRing(), and Roads::readInFromAsciiFile().
00152 { 00153 // 00154 // loop over rings to discover ring which contains DetId id 00155 // loop is restricted to window in z 00156 00157 // calculate window around given z (if z == 999999. set window to maximum) 00158 // window is += 1.5 times the longest sensor in z (TOB: ~20 cm) 00159 double z_min = -999999.; 00160 double z_max = 999999.; 00161 double delta_z = 1.5 * 20.; 00162 if ( z != 999999. ) { 00163 z_min = z - delta_z; 00164 z_max = z + delta_z; 00165 } 00166 00167 // loop over rings 00168 for ( const_iterator ring = ringMap_.lower_bound(z_min); ring != ringMap_.upper_bound(z_max); ++ring ) { 00169 if ( ring->second.containsDetId(id,phi) ) { 00170 return &(ring->second); 00171 } 00172 } 00173 00174 return 0; 00175 }
Definition at line 257 of file Rings.cc.
Referenced by RoadMaker::collectInnerTECSeedRings(), RoadMaker::collectInnerTECSeedRings1(), RoadMaker::collectInnerTECSeedRings2(), RoadMaker::collectOuterTECSeedRings(), and RoadMaker::collectOuterTECSeedRings1().
00259 { 00260 00261 // try to construct first detid from fw_bw, wheel, ring 00262 // set petal and module to 1 (zero in c-array terms) 00263 // check for combination if petal_fw_bw is valid, otherwise set to 0 is valid 00264 // if not, increase them to get a valid id 00265 00266 int petal_fw_bw = 1; 00267 int petal = 1; 00268 int module = 1; 00269 00270 const Ring* int_ring = 0; 00271 00272 // first try stereo = 0, then stereo = 2, then fail 00273 TECDetId id(fw_bw,wheel,petal_fw_bw,petal,ring,module,0); 00274 int_ring = getRing(DetId(id.rawId())); 00275 if ( int_ring == 0 ) { 00276 TECDetId id(fw_bw,wheel,petal_fw_bw,petal,ring,module,2); 00277 int_ring = getRing(DetId(id.rawId())); 00278 } 00279 00280 if ( int_ring == 0 ) { 00281 edm::LogError("RoadSearch") << "TEC Ring for fw_bw: " << fw_bw 00282 << " wheel: " << wheel 00283 << " ring: " << ring 00284 << " with rawId: " << id.rawId() 00285 << " could not be found."; 00286 } 00287 00288 return int_ring; 00289 }
const Ring * Rings::getTIBRing | ( | unsigned int | layer, | |
unsigned int | fw_bw, | |||
unsigned int | ext_int, | |||
unsigned int | detector | |||
) | const |
Definition at line 201 of file Rings.cc.
Referenced by RoadMaker::collectInnerTIBSeedRings(), RoadMaker::collectInnerTIBSeedRings1(), RoadMaker::collectInnerTIBSeedRings2(), RoadMaker::collectOuterTIBSeedRings(), and RoadMaker::collectOuterTIBSeedRings1().
00204 { 00205 00206 // construct DetID from info using else the first of all entities and return Ring 00207 00208 const Ring* ring = 0; 00209 00210 // first try stereo = 0, then stereo = 2, then fail 00211 TIBDetId id(layer,fw_bw,ext_int,1,detector,0); 00212 ring = getRing(DetId(id.rawId())); 00213 if ( ring == 0 ) { 00214 TIBDetId id(layer,fw_bw,ext_int,1,detector,2); 00215 ring = getRing(DetId(id.rawId())); 00216 } 00217 00218 if ( ring == 0 ) { 00219 edm::LogError("RoadSearch") << "TIB Ring for layer: " << layer 00220 << " fw_bw: " << fw_bw 00221 << " ext_int: " << ext_int 00222 << " detector: " << detector 00223 << " with rawId: " << id.rawId() 00224 << " could not be found."; 00225 } 00226 00227 return ring; 00228 }
Definition at line 230 of file Rings.cc.
Referenced by RoadMaker::collectInnerTIDSeedRings(), RoadMaker::collectInnerTIDSeedRings1(), and RoadMaker::collectInnerTIDSeedRings2().
00232 { 00233 00234 // construct DetID from info using else the first of all entities and return Ring 00235 00236 const Ring* int_ring = 0; 00237 00238 // first try stereo = 0, then stereo = 2, then fail 00239 TIDDetId id(fw_bw,wheel,ring,1,1,0); 00240 int_ring = getRing(DetId(id.rawId())); 00241 if ( int_ring == 0 ) { 00242 TIDDetId id(fw_bw,wheel,ring,1,1,2); 00243 int_ring = getRing(DetId(id.rawId())); 00244 } 00245 00246 if ( int_ring == 0 ) { 00247 edm::LogError("RoadSearch") << "TID Ring for fw_bw: " << fw_bw 00248 << " wheel: " << wheel 00249 << " ring: " << ring 00250 << " with rawId: " << id.rawId() 00251 << " could not be found."; 00252 } 00253 00254 return int_ring; 00255 }
const Ring * Rings::getTOBRing | ( | unsigned int | layer, | |
unsigned int | rod_fw_bw, | |||
unsigned int | detector | |||
) | const |
Definition at line 291 of file Rings.cc.
Referenced by RoadMaker::collectInnerTOBSeedRings(), RoadMaker::collectInnerTOBSeedRings1(), RoadMaker::collectInnerTOBSeedRings2(), RoadMaker::collectOuterTOBSeedRings(), and RoadMaker::collectOuterTOBSeedRings1().
00293 { 00294 00295 // construct DetID from info using else the first of all entities and return Ring 00296 const Ring* ring = 0; 00297 00298 // first try stereo = 0, then stereo = 2, then fail 00299 TOBDetId id(layer,rod_fw_bw,1,detector,0); 00300 ring = getRing(DetId(id.rawId())); 00301 if ( ring == 0 ) { 00302 TOBDetId id(layer,rod_fw_bw,1,detector,2); 00303 ring = getRing(DetId(id.rawId())); 00304 } 00305 00306 if ( ring == 0 ) { 00307 edm::LogError("RoadSearch") << "TOB Ring for layer: " << layer 00308 << " rod_fw_bw: " << rod_fw_bw 00309 << " detector: " << detector 00310 << " with rawId: " << id.rawId() 00311 << " could not be found."; 00312 } 00313 00314 return ring; 00315 }
Definition at line 40 of file Rings.h.
References ringMap_.
Referenced by RingMaker::constructPXBRings(), RingMaker::constructPXFRings(), RingMaker::constructTECRings(), RingMaker::constructTIBRings(), RingMaker::constructTIDRings(), and RingMaker::constructTOBRings().
const_iterator Rings::lower_bound | ( | double | z | ) | const [inline] |
iterator Rings::lower_bound | ( | double | z | ) | [inline] |
void Rings::readInFromAsciiFile | ( | std::string | ascii_file | ) |
Definition at line 57 of file Rings.cc.
References Ring::addId(), i, index, iggi_31X_cfg::input, parsecf::pyparsing::line(), phi, and ringMap_.
Referenced by Rings().
00057 { 00058 // 00059 // read in all rings stored in ascii file 00060 // 00061 00062 std::ifstream input(ascii_filename.c_str()); 00063 std::istringstream stream; 00064 std::string line; 00065 unsigned int index, type; 00066 float rmin,rmax,zmin,zmax; 00067 unsigned int ndetid = 0; 00068 double phi; 00069 unsigned int detid; 00070 00071 while ( std::getline(input,line) ) { 00072 if ( !std::isspace(line[0]) && !(line[0] == 35) ) { 00073 00074 // ring 00075 stream.str(line); 00076 stream.clear(); 00077 stream >> index >> rmin >> rmax >> zmin >> zmax >> type; 00078 Ring ring(index,rmin,rmax,zmin,zmax,type); 00079 std::getline(input,line); 00080 while (std::isspace(line[0]) || (line[0] == 35) ) { 00081 std::getline(input,line); 00082 } 00083 stream.str(line); 00084 stream.clear(); 00085 stream >> ndetid; 00086 for (unsigned int i = 0; i < ndetid; ++i ) { 00087 std::getline(input,line); 00088 while (std::isspace(line[0]) || (line[0] == 35) ) { 00089 std::getline(input,line); 00090 } 00091 stream.str(line); 00092 stream.clear(); 00093 stream >> phi >> detid; 00094 ring.addId(phi,DetId(detid)); 00095 } 00096 double center_z = zmin + ((zmax-zmin)/2); 00097 ringMap_.insert(std::make_pair(center_z,ring)); 00098 } 00099 } 00100 00101 edm::LogInfo("RoadSearch") << "Read in: " << ringMap_.size() << " Rings from file: " << ascii_filename; 00102 00103 }
const_iterator Rings::upper_bound | ( | double | z | ) | const [inline] |
iterator Rings::upper_bound | ( | double | z | ) | [inline] |
RingMap Rings::ringMap_ [private] |
Definition at line 80 of file Rings.h.
Referenced by begin(), dump(), end(), getRing(), insert(), lower_bound(), readInFromAsciiFile(), and upper_bound().