CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
Rings Class Reference

#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
 
iterator end ()
 
const_iterator end () const
 
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 (DetId id, double phi=999999., double z=999999.) const
 
const RinggetRing (unsigned int ringIndex, 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)
 
iterator lower_bound (double z)
 
const_iterator lower_bound (double z) const
 
void readInFromAsciiFile (std::string ascii_file)
 
 Rings ()
 
 Rings (std::string ascii_file)
 
iterator upper_bound (double z)
 
const_iterator upper_bound (double z) const
 
 ~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.

36  {
37  //
38  // default constructor
39  //
40 }
Rings::Rings ( std::string  ascii_file)

Definition at line 42 of file Rings.cc.

References readInFromAsciiFile().

42  {
43  //
44  // constructor reading in ascii file
45  //
46 
47  readInFromAsciiFile(ascii_filename);
48 
49 }
void readInFromAsciiFile(std::string ascii_file)
Definition: Rings.cc:57
Rings::~Rings ( )

Definition at line 51 of file Rings.cc.

51  {
52  //
53  // default destructor
54  //
55 }

Member Function Documentation

iterator Rings::begin ( void  )
inline

Definition at line 42 of file Rings.h.

References ringMap_.

Referenced by RoadMaker::RingsCompatibleWithSeed().

42 { return ringMap_.begin(); }
RingMap ringMap_
Definition: Rings.h:80
const_iterator Rings::begin ( void  ) const
inline

Definition at line 44 of file Rings.h.

References ringMap_.

44 { return ringMap_.begin(); }
RingMap ringMap_
Definition: Rings.h:80
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().

105  {
106  //
107  // dump all rings in ascii file
108  //
109 
110  std::ofstream stream(ascii_filename.c_str());
111 
112  dumpHeader(stream);
113 
114  for ( const_iterator ring = ringMap_.begin(); ring != ringMap_.end(); ++ring ) {
115 
116  stream << ring->second.dump();
117 
118  }
119 
120 }
RingMap::const_iterator const_iterator
Definition: Rings.h:33
void dumpHeader(std::ofstream &stream) const
Definition: Rings.cc:122
RingMap ringMap_
Definition: Rings.h:80
void Rings::dumpHeader ( std::ofstream &  stream) const

Definition at line 122 of file Rings.cc.

Referenced by dump().

122  {
123  //
124  // header with general information about content of rings ascii file
125  //
126 
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;
149 
150 }
iterator Rings::end ( void  )
inline

Definition at line 43 of file Rings.h.

References ringMap_.

Referenced by RoadMaker::RingsCompatibleWithSeed().

43 { return ringMap_.end(); }
RingMap ringMap_
Definition: Rings.h:80
const_iterator Rings::end ( void  ) const
inline

Definition at line 45 of file Rings.h.

References ringMap_.

45 { return ringMap_.end(); }
RingMap ringMap_
Definition: Rings.h:80
const Ring * Rings::getPXBRing ( unsigned int  layer,
unsigned int  detector 
) const

Definition at line 317 of file Rings.cc.

References getRing(), and errorMatrix2Lands_multiChannel::id.

318  {
319 
320  // construct DetID from info using else the first of all entities and return Ring
321  unsigned int ladder = 0;
322 
323  PXBDetId id(layer,ladder,detector);
324 
325  return getRing(DetId(id.rawId()));
326 }
const Ring * getRing(DetId id, double phi=999999., double z=999999.) const
Definition: Rings.cc:152
Definition: DetId.h:20
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 errorMatrix2Lands_multiChannel::id.

332  {
333 
334  // construct DetID from info using else the first of all entities and return Ring
335  unsigned int detector = 0;
336 
337  PXFDetId id(fw_bw+1,disk+1,detector+1,panel+1,module+1);
338 
339  return getRing(DetId(id.rawId()));
340 }
const Ring * getRing(DetId id, double phi=999999., double z=999999.) const
Definition: Rings.cc:152
Definition: DetId.h:20
Definition: vlib.h:209
const Ring * Rings::getRing ( DetId  id,
double  phi = 999999.,
double  z = 999999. 
) 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().

152  {
153  //
154  // loop over rings to discover ring which contains DetId id
155  // loop is restricted to window in z
156 
157  // calculate window around given z (if z == 999999. set window to maximum)
158  // window is += 1.5 times the longest sensor in z (TOB: ~20 cm)
159  double z_min = -999999.;
160  double z_max = 999999.;
161  double delta_z = 1.5 * 20.;
162  if ( z != 999999. ) {
163  z_min = z - delta_z;
164  z_max = z + delta_z;
165  }
166 
167  // loop over rings
168  for ( const_iterator ring = ringMap_.lower_bound(z_min); ring != ringMap_.upper_bound(z_max); ++ring ) {
169  if ( ring->second.containsDetId(id,phi) ) {
170  return &(ring->second);
171  }
172  }
173 
174  return 0;
175 }
RingMap::const_iterator const_iterator
Definition: Rings.h:33
double double double z
RingMap ringMap_
Definition: Rings.h:80
Definition: DDAxes.h:10
const Ring * Rings::getRing ( unsigned int  ringIndex,
double  z = 999999. 
) const

Definition at line 177 of file Rings.cc.

References relativeConstraints::ring, and ringMap_.

177  {
178  //
179  // loop over rings to discover ring which has RingIndex ringIndex
180  // loop is restricted to window in z
181 
182  // calculate window around given z (if z == 999999. set window to maximum)
183  // window is += 1.5 times the longest sensor in z (TOB: ~20 cm)
184  double z_min = -999999.;
185  double z_max = 999999.;
186  double delta_z = 1.5 * 20.;
187  if ( z != 999999. ) {
188  z_min = z - delta_z;
189  z_max = z + delta_z;
190  }
191 
192  for ( const_iterator ring = ringMap_.lower_bound(z_min); ring != ringMap_.upper_bound(z_max); ++ring ) {
193  if ( ring->second.getindex() == ringIndex ) {
194  return &(ring->second);
195  }
196  }
197 
198  return 0;
199 }
RingMap::const_iterator const_iterator
Definition: Rings.h:33
double double double z
RingMap ringMap_
Definition: Rings.h:80
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 errorMatrix2Lands_multiChannel::id.

Referenced by RoadMaker::collectInnerTECSeedRings(), RoadMaker::collectInnerTECSeedRings1(), RoadMaker::collectInnerTECSeedRings2(), RoadMaker::collectOuterTECSeedRings(), and RoadMaker::collectOuterTECSeedRings1().

259  {
260 
261  // try to construct first detid from fw_bw, wheel, ring
262  // set petal and module to 1 (zero in c-array terms)
263  // check for combination if petal_fw_bw is valid, otherwise set to 0 is valid
264  // if not, increase them to get a valid id
265 
266  int petal_fw_bw = 1;
267  int petal = 1;
268  int module = 1;
269 
270  const Ring* int_ring = 0;
271 
272  // first try stereo = 0, then stereo = 2, then fail
273  TECDetId id(fw_bw,wheel,petal_fw_bw,petal,ring,module,0);
274  int_ring = getRing(DetId(id.rawId()));
275  if ( int_ring == 0 ) {
276  TECDetId id(fw_bw,wheel,petal_fw_bw,petal,ring,module,2);
277  int_ring = getRing(DetId(id.rawId()));
278  }
279 
280  if ( int_ring == 0 ) {
281  edm::LogError("RoadSearch") << "TEC Ring for fw_bw: " << fw_bw
282  << " wheel: " << wheel
283  << " ring: " << ring
284  << " with rawId: " << id.rawId()
285  << " could not be found.";
286  }
287 
288  return int_ring;
289 }
const Ring * getRing(DetId id, double phi=999999., double z=999999.) const
Definition: Rings.cc:152
Definition: Ring.h:31
Definition: DetId.h:20
Definition: vlib.h:209
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(), errorMatrix2Lands_multiChannel::id, and relativeConstraints::ring.

Referenced by RoadMaker::collectInnerTIBSeedRings(), RoadMaker::collectInnerTIBSeedRings1(), RoadMaker::collectInnerTIBSeedRings2(), RoadMaker::collectOuterTIBSeedRings(), and RoadMaker::collectOuterTIBSeedRings1().

204  {
205 
206  // construct DetID from info using else the first of all entities and return Ring
207 
208  const Ring* ring = 0;
209 
210  // first try stereo = 0, then stereo = 2, then fail
211  TIBDetId id(layer,fw_bw,ext_int,1,detector,0);
212  ring = getRing(DetId(id.rawId()));
213  if ( ring == 0 ) {
214  TIBDetId id(layer,fw_bw,ext_int,1,detector,2);
215  ring = getRing(DetId(id.rawId()));
216  }
217 
218  if ( ring == 0 ) {
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.";
225  }
226 
227  return ring;
228 }
const Ring * getRing(DetId id, double phi=999999., double z=999999.) const
Definition: Rings.cc:152
Definition: Ring.h:31
Definition: DetId.h:20
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 errorMatrix2Lands_multiChannel::id.

Referenced by RoadMaker::collectInnerTIDSeedRings(), RoadMaker::collectInnerTIDSeedRings1(), and RoadMaker::collectInnerTIDSeedRings2().

232  {
233 
234  // construct DetID from info using else the first of all entities and return Ring
235 
236  const Ring* int_ring = 0;
237 
238  // first try stereo = 0, then stereo = 2, then fail
239  TIDDetId id(fw_bw,wheel,ring,1,1,0);
240  int_ring = getRing(DetId(id.rawId()));
241  if ( int_ring == 0 ) {
242  TIDDetId id(fw_bw,wheel,ring,1,1,2);
243  int_ring = getRing(DetId(id.rawId()));
244  }
245 
246  if ( int_ring == 0 ) {
247  edm::LogError("RoadSearch") << "TID Ring for fw_bw: " << fw_bw
248  << " wheel: " << wheel
249  << " ring: " << ring
250  << " with rawId: " << id.rawId()
251  << " could not be found.";
252  }
253 
254  return int_ring;
255 }
const Ring * getRing(DetId id, double phi=999999., double z=999999.) const
Definition: Rings.cc:152
Definition: Ring.h:31
Definition: DetId.h:20
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(), errorMatrix2Lands_multiChannel::id, and relativeConstraints::ring.

Referenced by RoadMaker::collectInnerTOBSeedRings(), RoadMaker::collectInnerTOBSeedRings1(), RoadMaker::collectInnerTOBSeedRings2(), RoadMaker::collectOuterTOBSeedRings(), and RoadMaker::collectOuterTOBSeedRings1().

293  {
294 
295  // construct DetID from info using else the first of all entities and return Ring
296  const Ring* ring = 0;
297 
298  // first try stereo = 0, then stereo = 2, then fail
299  TOBDetId id(layer,rod_fw_bw,1,detector,0);
300  ring = getRing(DetId(id.rawId()));
301  if ( ring == 0 ) {
302  TOBDetId id(layer,rod_fw_bw,1,detector,2);
303  ring = getRing(DetId(id.rawId()));
304  }
305 
306  if ( ring == 0 ) {
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.";
312  }
313 
314  return ring;
315 }
const Ring * getRing(DetId id, double phi=999999., double z=999999.) const
Definition: Rings.cc:152
Definition: Ring.h:31
Definition: DetId.h:20
void Rings::insert ( double  z,
Ring ring 
)
inline
iterator Rings::lower_bound ( double  z)
inline

Definition at line 46 of file Rings.h.

References ringMap_.

46 { return ringMap_.lower_bound(z); }
double double double z
RingMap ringMap_
Definition: Rings.h:80
const_iterator Rings::lower_bound ( double  z) const
inline

Definition at line 48 of file Rings.h.

References ringMap_.

48 { return ringMap_.lower_bound(z); }
double double double z
RingMap ringMap_
Definition: Rings.h:80
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().

57  {
58  //
59  // read in all rings stored in ascii file
60  //
61 
62  std::ifstream input(ascii_filename.c_str());
63  std::istringstream stream;
64  std::string line;
65  unsigned int index, type;
66  float rmin,rmax,zmin,zmax;
67  unsigned int ndetid = 0;
68  double phi;
69  unsigned int detid;
70 
71  while ( std::getline(input,line) ) {
72  if ( !std::isspace(line[0]) && !(line[0] == 35) ) {
73 
74  // ring
75  stream.str(line);
76  stream.clear();
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);
82  }
83  stream.str(line);
84  stream.clear();
85  stream >> ndetid;
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);
90  }
91  stream.str(line);
92  stream.clear();
93  stream >> phi >> detid;
94  ring.addId(phi,DetId(detid));
95  }
96  double center_z = zmin + ((zmax-zmin)/2);
97  ringMap_.insert(std::make_pair(center_z,ring));
98  }
99  }
100 
101  edm::LogInfo("RoadSearch") << "Read in: " << ringMap_.size() << " Rings from file: " << ascii_filename;
102 
103 }
type
Definition: HCALResponse.h:22
int i
Definition: DBlmapReader.cc:9
RingMap ringMap_
Definition: Rings.h:80
Definition: Ring.h:31
Definition: DetId.h:20
Definition: DDAxes.h:10
iterator Rings::upper_bound ( double  z)
inline

Definition at line 47 of file Rings.h.

References ringMap_.

47 { return ringMap_.upper_bound(z); }
double double double z
RingMap ringMap_
Definition: Rings.h:80
const_iterator Rings::upper_bound ( double  z) const
inline

Definition at line 49 of file Rings.h.

References ringMap_.

49 { return ringMap_.upper_bound(z); }
double double double z
RingMap ringMap_
Definition: Rings.h:80

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