#include <Rings.h>
Public Types | |
typedef RingMap::const_iterator | const_iterator |
typedef RingMap::iterator | iterator |
typedef std::multimap< double, Ring > | RingMap |
Public Member Functions | |
iterator | begin () |
const_iterator | begin () const |
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 (DetId id, double phi=999999., double z=999999.) const |
const Ring * | getRing (unsigned int ringIndex, 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) |
iterator | lower_bound (double z) |
const_iterator | lower_bound (double z) const |
void | readInFromAsciiFile (std::string ascii_file) |
Rings (std::string ascii_file) | |
Rings () | |
iterator | upper_bound (double z) |
const_iterator | upper_bound (double z) const |
~Rings () | |
Private Attributes | |
RingMap | ringMap_ |
typedef RingMap::const_iterator Rings::const_iterator |
typedef RingMap::iterator Rings::iterator |
typedef std::multimap<double,Ring> Rings::RingMap |
Rings::Rings | ( | std::string | ascii_file | ) |
Definition at line 42 of file Rings.cc.
References readInFromAsciiFile().
{ // // constructor reading in ascii file // readInFromAsciiFile(ascii_filename); }
iterator Rings::begin | ( | void | ) | [inline] |
Definition at line 42 of file Rings.h.
References ringMap_.
Referenced by RoadMaker::RingsCompatibleWithSeed().
{ return ringMap_.begin(); }
const_iterator Rings::begin | ( | void | ) | const [inline] |
void Rings::dump | ( | std::string | ascii_filename = "rings.dat" | ) | const |
Definition at line 105 of file Rings.cc.
References dumpHeader(), relativeConstraints::ring, and ringMap_.
Referenced by RingMakerESProducer::produce().
{ // // dump all rings in ascii file // std::ofstream stream(ascii_filename.c_str()); dumpHeader(stream); for ( const_iterator ring = ringMap_.begin(); ring != ringMap_.end(); ++ring ) { stream << ring->second.dump(); } }
void Rings::dumpHeader | ( | std::ofstream & | stream | ) | const |
Definition at line 122 of file Rings.cc.
Referenced by dump().
{ // // header with general information about content of rings ascii file // stream << "#" << std::endl; stream << "# Rings for the RoadSearch tracking algorithm" << std::endl; stream << "# Ascii Dump" << std::endl; stream << "# " << std::endl; stream << "# Content:" << std::endl; stream << "# " << std::endl; stream << "# a dump of all Rings:" << std::endl; stream << "#" << std::endl; stream << "# Ring : index, rmin, rmax, zmin, zmax, std::multimap<phi,DetId>: Ring of DetUnits mapped in phi" << std::endl; stream << "# " << std::endl; stream << "# Ascii-Format:" << std::endl; stream << "# " << std::endl; stream << "# Ring:" << std::endl; stream << "#" << std::endl; stream << "# ### Ring: <index> ###" << std::endl; stream << "# <index> <rmin> <rmax> <zmin> <zmax>" << std::endl; stream << "# <number of DetId's in std::vector<DetId> >" << std::endl; stream << "# <phi of DetUnit described by DetId> <DetId::rawId()>" << std::endl; stream << "# <phi of DetUnit described by DetId> <DetId::rawId()>" << std::endl; stream << "# ..." << std::endl; stream << "#" << std::endl; stream << "#" << std::endl; }
const_iterator Rings::end | ( | void | ) | const [inline] |
iterator Rings::end | ( | void | ) | [inline] |
Definition at line 43 of file Rings.h.
References ringMap_.
Referenced by RoadMaker::RingsCompatibleWithSeed().
{ return ringMap_.end(); }
const Ring * Rings::getPXBRing | ( | unsigned int | layer, |
unsigned int | detector | ||
) | const |
const Ring * Rings::getPXFRing | ( | unsigned int | fw_bw, |
unsigned int | disk, | ||
unsigned int | panel, | ||
unsigned int | module | ||
) | const |
Definition at line 152 of file Rings.cc.
References relativeConstraints::ring, and ringMap_.
Referenced by getPXBRing(), getPXFRing(), Roads::getRing(), getTECRing(), getTIBRing(), getTIDRing(), getTOBRing(), and Roads::readInFromAsciiFile().
{ // // loop over rings to discover ring which contains DetId id // loop is restricted to window in z // calculate window around given z (if z == 999999. set window to maximum) // window is += 1.5 times the longest sensor in z (TOB: ~20 cm) double z_min = -999999.; double z_max = 999999.; double delta_z = 1.5 * 20.; if ( z != 999999. ) { z_min = z - delta_z; z_max = z + delta_z; } // loop over rings for ( const_iterator ring = ringMap_.lower_bound(z_min); ring != ringMap_.upper_bound(z_max); ++ring ) { if ( ring->second.containsDetId(id,phi) ) { return &(ring->second); } } return 0; }
const Ring * Rings::getRing | ( | unsigned int | ringIndex, |
double | z = 999999. |
||
) | const |
Definition at line 177 of file Rings.cc.
References relativeConstraints::ring, and ringMap_.
{ // // loop over rings to discover ring which has RingIndex ringIndex // loop is restricted to window in z // calculate window around given z (if z == 999999. set window to maximum) // window is += 1.5 times the longest sensor in z (TOB: ~20 cm) double z_min = -999999.; double z_max = 999999.; double delta_z = 1.5 * 20.; if ( z != 999999. ) { z_min = z - delta_z; z_max = z + delta_z; } for ( const_iterator ring = ringMap_.lower_bound(z_min); ring != ringMap_.upper_bound(z_max); ++ring ) { if ( ring->second.getindex() == ringIndex ) { return &(ring->second); } } return 0; }
const Ring * Rings::getTECRing | ( | unsigned int | fw_bw, |
unsigned int | wheel, | ||
unsigned int | ring | ||
) | const |
Definition at line 257 of file Rings.cc.
References getRing().
Referenced by RoadMaker::collectInnerTECSeedRings(), RoadMaker::collectInnerTECSeedRings1(), RoadMaker::collectInnerTECSeedRings2(), RoadMaker::collectOuterTECSeedRings(), and RoadMaker::collectOuterTECSeedRings1().
{ // try to construct first detid from fw_bw, wheel, ring // set petal and module to 1 (zero in c-array terms) // check for combination if petal_fw_bw is valid, otherwise set to 0 is valid // if not, increase them to get a valid id int petal_fw_bw = 1; int petal = 1; int module = 1; const Ring* int_ring = 0; // first try stereo = 0, then stereo = 2, then fail TECDetId id(fw_bw,wheel,petal_fw_bw,petal,ring,module,0); int_ring = getRing(DetId(id.rawId())); if ( int_ring == 0 ) { TECDetId id(fw_bw,wheel,petal_fw_bw,petal,ring,module,2); int_ring = getRing(DetId(id.rawId())); } if ( int_ring == 0 ) { edm::LogError("RoadSearch") << "TEC Ring for fw_bw: " << fw_bw << " wheel: " << wheel << " ring: " << ring << " with rawId: " << id.rawId() << " could not be found."; } return int_ring; }
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.
References getRing(), and relativeConstraints::ring.
Referenced by RoadMaker::collectInnerTIBSeedRings(), RoadMaker::collectInnerTIBSeedRings1(), RoadMaker::collectInnerTIBSeedRings2(), RoadMaker::collectOuterTIBSeedRings(), and RoadMaker::collectOuterTIBSeedRings1().
{ // construct DetID from info using else the first of all entities and return Ring const Ring* ring = 0; // first try stereo = 0, then stereo = 2, then fail TIBDetId id(layer,fw_bw,ext_int,1,detector,0); ring = getRing(DetId(id.rawId())); if ( ring == 0 ) { TIBDetId id(layer,fw_bw,ext_int,1,detector,2); ring = getRing(DetId(id.rawId())); } if ( ring == 0 ) { edm::LogError("RoadSearch") << "TIB Ring for layer: " << layer << " fw_bw: " << fw_bw << " ext_int: " << ext_int << " detector: " << detector << " with rawId: " << id.rawId() << " could not be found."; } return ring; }
const Ring * Rings::getTIDRing | ( | unsigned int | fw_bw, |
unsigned int | wheel, | ||
unsigned int | ring | ||
) | const |
Definition at line 230 of file Rings.cc.
References getRing().
Referenced by RoadMaker::collectInnerTIDSeedRings(), RoadMaker::collectInnerTIDSeedRings1(), and RoadMaker::collectInnerTIDSeedRings2().
{ // construct DetID from info using else the first of all entities and return Ring const Ring* int_ring = 0; // first try stereo = 0, then stereo = 2, then fail TIDDetId id(fw_bw,wheel,ring,1,1,0); int_ring = getRing(DetId(id.rawId())); if ( int_ring == 0 ) { TIDDetId id(fw_bw,wheel,ring,1,1,2); int_ring = getRing(DetId(id.rawId())); } if ( int_ring == 0 ) { edm::LogError("RoadSearch") << "TID Ring for fw_bw: " << fw_bw << " wheel: " << wheel << " ring: " << ring << " with rawId: " << id.rawId() << " could not be found."; } return int_ring; }
const Ring * Rings::getTOBRing | ( | unsigned int | layer, |
unsigned int | rod_fw_bw, | ||
unsigned int | detector | ||
) | const |
Definition at line 291 of file Rings.cc.
References getRing(), and relativeConstraints::ring.
Referenced by RoadMaker::collectInnerTOBSeedRings(), RoadMaker::collectInnerTOBSeedRings1(), RoadMaker::collectInnerTOBSeedRings2(), RoadMaker::collectOuterTOBSeedRings(), and RoadMaker::collectOuterTOBSeedRings1().
{ // construct DetID from info using else the first of all entities and return Ring const Ring* ring = 0; // first try stereo = 0, then stereo = 2, then fail TOBDetId id(layer,rod_fw_bw,1,detector,0); ring = getRing(DetId(id.rawId())); if ( ring == 0 ) { TOBDetId id(layer,rod_fw_bw,1,detector,2); ring = getRing(DetId(id.rawId())); } if ( ring == 0 ) { edm::LogError("RoadSearch") << "TOB Ring for layer: " << layer << " rod_fw_bw: " << rod_fw_bw << " detector: " << detector << " with rawId: " << id.rawId() << " could not be found."; } return ring; }
void Rings::insert | ( | double | z, |
Ring & | ring | ||
) | [inline] |
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().
iterator Rings::lower_bound | ( | double | z | ) | [inline] |
const_iterator Rings::lower_bound | ( | double | z | ) | const [inline] |
void Rings::readInFromAsciiFile | ( | std::string | ascii_file | ) |
Definition at line 57 of file Rings.cc.
References Ring::addId(), cond::rpcobgas::detid, i, getHLTprescales::index, LaserDQM_cfg::input, geometryCSVtoXML::line, phi, relativeConstraints::ring, and ringMap_.
Referenced by Rings().
{ // // read in all rings stored in ascii file // std::ifstream input(ascii_filename.c_str()); std::istringstream stream; std::string line; unsigned int index, type; float rmin,rmax,zmin,zmax; unsigned int ndetid = 0; double phi; unsigned int detid; while ( std::getline(input,line) ) { if ( !std::isspace(line[0]) && !(line[0] == 35) ) { // ring stream.str(line); stream.clear(); stream >> index >> rmin >> rmax >> zmin >> zmax >> type; Ring ring(index,rmin,rmax,zmin,zmax,type); std::getline(input,line); while (std::isspace(line[0]) || (line[0] == 35) ) { std::getline(input,line); } stream.str(line); stream.clear(); stream >> ndetid; for (unsigned int i = 0; i < ndetid; ++i ) { std::getline(input,line); while (std::isspace(line[0]) || (line[0] == 35) ) { std::getline(input,line); } stream.str(line); stream.clear(); stream >> phi >> detid; ring.addId(phi,DetId(detid)); } double center_z = zmin + ((zmax-zmin)/2); ringMap_.insert(std::make_pair(center_z,ring)); } } edm::LogInfo("RoadSearch") << "Read in: " << ringMap_.size() << " Rings from file: " << ascii_filename; }
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().