CMS 3D CMS Logo

Rings Class Reference

#include <RecoTracker/RingRecord/interface/Rings.h>

List of all members.

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 RinggetPXBRing (unsigned int layer, unsigned int detector) const
const RinggetPXFRing (unsigned int fw_bw, unsigned int disk, unsigned int panel, unsigned int module) const
const RinggetRing (unsigned int ringIndex, double z=999999.) const
const RinggetRing (DetId id, double phi=999999., double z=999999.) const
const RinggetTECRing (unsigned int fw_bw, unsigned int wheel, unsigned int ring) const
const RinggetTIBRing (unsigned int layer, unsigned int fw_bw, unsigned int ext_int, unsigned int detector) const
const RinggetTIDRing (unsigned int fw_bw, unsigned int wheel, unsigned int ring) const
const RinggetTOBRing (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_


Detailed Description

Definition at line 27 of file Rings.h.


Member Typedef Documentation

typedef RingMap::const_iterator Rings::const_iterator

Definition at line 33 of file Rings.h.

typedef RingMap::iterator Rings::iterator

Definition at line 32 of file Rings.h.

typedef std::multimap<double,Ring> Rings::RingMap

Definition at line 31 of file Rings.h.


Constructor & Destructor Documentation

Rings::Rings (  ) 

Definition at line 36 of file Rings.cc.

00036              {
00037   //
00038   // default constructor
00039   //
00040 }

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 (  ) 

Definition at line 51 of file Rings.cc.

00051               { 
00052   //
00053   // default destructor
00054   //
00055 }


Member Function Documentation

const_iterator Rings::begin ( void   )  const [inline]

Definition at line 44 of file Rings.h.

References ringMap_.

00044 { return ringMap_.begin(); }

iterator Rings::begin ( void   )  [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 45 of file Rings.h.

References ringMap_.

00045 { return ringMap_.end();   }

iterator Rings::end ( void   )  [inline]

Definition at line 43 of file Rings.h.

References ringMap_.

Referenced by RoadMaker::RingsCompatibleWithSeed().

00043 { return ringMap_.end();   }

const Ring * Rings::getPXBRing ( unsigned int  layer,
unsigned int  detector 
) const

Definition at line 317 of file Rings.cc.

References getRing(), and id.

00318                                                      {
00319 
00320   // construct DetID from info using else the first of all entities and return Ring
00321   unsigned int ladder = 0;
00322 
00323   PXBDetId id(layer,ladder,detector);
00324 
00325   return getRing(DetId(id.rawId()));
00326 }

const Ring * Rings::getPXFRing ( unsigned int  fw_bw,
unsigned int  disk,
unsigned int  panel,
unsigned int  module 
) const

Definition at line 329 of file Rings.cc.

References getRing(), and id.

00332                                                    {
00333   
00334   // construct DetID from info using else the first of all entities and return Ring
00335   unsigned int detector = 0;
00336   
00337   PXFDetId id(fw_bw+1,disk+1,detector+1,panel+1,module+1);
00338   
00339   return getRing(DetId(id.rawId()));
00340 }

const Ring * Rings::getRing ( unsigned int  ringIndex,
double  z = 999999. 
) 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 }

const Ring * Rings::getRing ( DetId  id,
double  phi = 999999.,
double  z = 999999. 
) const

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 }

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(), and id.

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.

References getRing(), and id.

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 }

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(), and id.

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.

References getRing(), and id.

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 }

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().

00040 { ringMap_.insert(std::make_pair(z,ring)); }

const_iterator Rings::lower_bound ( double  z  )  const [inline]

Definition at line 48 of file Rings.h.

References ringMap_.

00048 { return ringMap_.lower_bound(z); }

iterator Rings::lower_bound ( double  z  )  [inline]

Definition at line 46 of file Rings.h.

References ringMap_.

00046 { return ringMap_.lower_bound(z); }

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]

Definition at line 49 of file Rings.h.

References ringMap_.

00049 { return ringMap_.upper_bound(z); }

iterator Rings::upper_bound ( double  z  )  [inline]

Definition at line 47 of file Rings.h.

References ringMap_.

00047 { return ringMap_.upper_bound(z); }


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:48 2009 for CMSSW by  doxygen 1.5.4