50 std::ifstream
input(ascii_filename.c_str());
53 unsigned int counter = 0;
54 std::istringstream stream;
56 unsigned int nroads = 0;
57 unsigned int nrings = 0;
58 unsigned int nlayers = 0;
59 unsigned int index = 0;
62 std::getline(
input,line);
63 while (std::isspace(line[0]) || (line[0] == 35) ) {
64 std::getline(
input,line);
70 for (
unsigned int road = 0;
74 std::getline(
input,line);
75 while (std::isspace(line[0]) || (line[0] == 35) ) {
76 std::getline(
input,line);
78 std::vector<const Ring*> innerSeedRings;
82 for (
unsigned int i = 0;
87 std::getline(
input,line);
88 while (std::isspace(line[0]) || (line[0] == 35) ) {
89 std::getline(
input,line);
98 std::getline(
input,line);
99 while (std::isspace(line[0]) || (line[0] == 35) ) {
100 std::getline(
input,line);
102 std::vector<const Ring*> outerSeedRings;
106 for (
unsigned int i = 0;
111 std::getline(
input,line);
112 while (std::isspace(line[0]) || (line[0] == 35) ) {
113 std::getline(
input,line);
122 RoadSeed seed(innerSeedRings,outerSeedRings);
128 std::getline(
input,line);
129 while (std::isspace(line[0]) || (line[0] == 35) ) {
130 std::getline(
input,line);
136 for (
unsigned int i = 0;
140 std::vector<const Ring*> layer;
143 std::getline(
input,line);
144 while (std::isspace(line[0]) || (line[0] == 35) ) {
145 std::getline(
input,line);
150 for (
unsigned int j = 0;
j < nrings; ++
j ) {
151 std::getline(
input,line);
152 while (std::isspace(line[0]) || (line[0] == 35) ) {
153 std::getline(
input,line);
160 set.push_back(layer);
165 roadMap_.insert(make_pair(seed,set));
169 edm::LogInfo(
"RoadSearch") <<
"Read in: " << counter <<
" RoadSets from file: " << ascii_filename;
175 std::ofstream stream(ascii_filename.c_str());
179 stream <<
"### Road information ###" << std::endl;
180 stream <<
roadMap_.size() << std::endl;
182 unsigned int counter = 0;
190 stream <<
"### RoadMap Entry " << counter <<
" ###" << std::endl;
192 RoadSeed seed = (*roaditerator).first;
195 stream <<
"### RoadSeed First Ring ###" << std::endl;
196 stream << seed.first.size() << std::endl;
197 for (std::vector<const Ring*>::const_iterator
ring = seed.first.begin();
198 ring != seed.first.end();
200 stream << (*ring)->getindex() << std::endl;
202 stream <<
"### RoadSeed Second Ring ###" << std::endl;
203 stream << seed.second.size() << std::endl;
204 for (std::vector<const Ring*>::const_iterator
ring = seed.second.begin();
205 ring != seed.second.end();
207 stream << (*ring)->getindex() << std::endl;
210 stream <<
"### RoadSet ###" << std::endl;
211 stream << set.size() << std::endl;
212 for ( RoadSet::const_iterator layer = set.begin(); layer != set.end(); ++layer ) {
213 stream <<
"### Layer ###" << std::endl;
214 stream << layer->size() << std::endl;
215 for ( std::vector<const Ring*>::const_iterator
ring = layer->begin();
216 ring != layer->end();
218 stream << (*ring)->getindex() << std::endl;
226 stream <<
"#" << std::endl;
227 stream <<
"# Roads for the RoadSearch tracking algorithm" << std::endl;
228 stream <<
"# Ascii Dump" << std::endl;
229 stream <<
"# " << std::endl;
230 stream <<
"# Content:" << std::endl;
231 stream <<
"# " << std::endl;
232 stream <<
"# a dump of the RoadMap structure:" << std::endl;
233 stream <<
"#" << std::endl;
234 stream <<
"# Road Information: <number of roads>" << std::endl;
235 stream <<
"# Ring: index, rmin, rmax, zmin, zmax, std::vector<DetId>: Ring of DetUnits in phi taken from ring service" << std::endl;
236 stream <<
"# RoadSeed: std::pair<std::vector<const Ring*>,std::vector<const Ring*> >: inner and outer Ring Seed for the Road" << std::endl;
237 stream <<
"# RoadSet : std::vector<std::vectro<const Ring*> >: all Rings belonging to a road structured in layers" << std::endl;
238 stream <<
"# RoadMap: std::multimap<RoadSeed,RoadSet>: main container for the Roads" << std::endl;
239 stream <<
"# " << std::endl;
240 stream <<
"# Ascii-Format:" << std::endl;
241 stream <<
"# " << std::endl;
242 stream <<
"# Road Information:" << std::endl;
243 stream <<
"# <number of roads>" << std::endl;
244 stream <<
"#" << std::endl;
245 stream <<
"# RoadMap for each road:" << std::endl;
246 stream <<
"#" << std::endl;
247 stream <<
"# ### RoadMap Entry ###" << std::endl;
248 stream <<
"# ### RoadSeed First Ring ###" << std::endl;
249 stream <<
"# <number of inner seed rings>" << std::endl;
250 stream <<
"# <index>" << std::endl;
251 stream <<
"# <index>" << std::endl;
252 stream <<
"# ..." << std::endl;
253 stream <<
"# ### RoadSeed Second Ring ###" << std::endl;
254 stream <<
"# <number of outer seed rings>" << std::endl;
255 stream <<
"# <index>" << std::endl;
256 stream <<
"# <index>" << std::endl;
257 stream <<
"# ..." << std::endl;
258 stream <<
"# ### RoadSet ###" << std::endl;
259 stream <<
"# <number of Layers in RoadSet>" << std::endl;
260 stream <<
"# ### Layer ###" << std::endl;
261 stream <<
"# <number of rings in layer>" << std::endl;
262 stream <<
"# <index>" << std::endl;
263 stream <<
"# <index>" << std::endl;
264 stream <<
"# ..." << std::endl;
265 stream <<
"# ### Layer ###" << std::endl;
266 stream <<
"# ..." << std::endl;
267 stream <<
"#" << std::endl;
268 stream <<
"#" << std::endl;
274 double InnerSeedRingPhi,
275 double OuterSeedRingPhi,
276 double dphi_scalefactor)
const {
285 for ( std::vector<const Ring*>::const_iterator innerRing = road->first.first.begin();
286 innerRing != road->first.first.end();
288 if ( (*innerRing)->getType() == innerSeedRingType ) {
289 for ( std::vector<const Ring*>::const_iterator outerRing = road->first.second.begin();
290 outerRing != road->first.second.end();
292 if ( (*outerRing)->getType() == outerSeedRingType ) {
293 if ( (*innerRing)->containsDetId(InnerSeedRing,InnerSeedRingPhi,dphi_scalefactor) &&
294 (*outerRing)->containsDetId(OuterSeedRing,OuterSeedRingPhi,dphi_scalefactor) ) {
295 return &(road->first);
303 edm::LogError(
"RoadSearch") <<
"RoadSeed could not be found for inner SeedRing type: " << innerSeedRingType <<
" DetId: " << InnerSeedRing.
rawId()
304 <<
" at " << InnerSeedRingPhi
305 <<
" and outer SeedRing type : " << outerSeedRingType <<
" DetID: " << OuterSeedRing.
rawId()
306 <<
" at " << OuterSeedRingPhi;
311 std::vector<double> seedRingHitsPhi,
312 double dphi_scalefactor)
const {
318 unsigned int found = 0;
319 for (
unsigned int detIdCounter = 0;
320 detIdCounter < seedRingDetIds.size();
323 double phi = seedRingHitsPhi[detIdCounter];
326 bool foundInInnerRing =
false;
327 for ( std::vector<const Ring*>::const_iterator innerRing = road->first.first.begin();
328 innerRing != road->first.first.end();
330 if ( (*innerRing)->getType() ==
type ) {
331 if ( (*innerRing)->containsDetId(
id,phi,dphi_scalefactor) ) {
333 foundInInnerRing =
true;
338 if ( !foundInInnerRing ) {
339 for ( std::vector<const Ring*>::const_iterator outerRing = road->first.second.begin();
340 outerRing != road->first.second.end();
342 if ( (*outerRing)->getType() ==
type ) {
343 if ( (*outerRing)->containsDetId(
id,phi,dphi_scalefactor) ) {
350 if ( found == seedRingDetIds.size() ) {
351 return &(road->first);
356 std::ostringstream ost;
358 ost <<
"RoadSeed could not be found for following hits:\n";
359 for (
unsigned int detIdCounter = 0;
360 detIdCounter < seedRingDetIds.size();
362 ost <<
"Hit DetId: " << seedRingDetIds[detIdCounter].rawId() <<
" phi: " << seedRingHitsPhi[detIdCounter] <<
"\n";
374 bool TOBRing =
false;
375 for ( std::vector<const Ring*>::const_iterator
ring = seed->second.begin();
376 ring != seed->second.end();
const Ring * getRing(DetId id, double phi=999999., double z=999999.) const
static DetId ReturnRPhiId(const DetId id)
void dumpHeader(std::ofstream &stream) const
void readInFromAsciiFile(std::string ascii_file)
std::vector< std::vector< const Ring * > > RoadSet
uint32_t rawId() const
get the raw id
std::pair< std::vector< const Ring * >, std::vector< const Ring * > > RoadSeed
RoadMap::const_iterator const_iterator
const Ring::type getRingType(DetId id) const
const type getRoadType(const RoadSeed *const seed) const
void dump(std::string ascii_filename="roads.dat") const
const RoadSeed * getRoadSeed(DetId InnerSeedRing, DetId OuterSeedRing, double InnerSeedRingPhi=999999., double OuterSeedRingPhi=999999., double dphi_scalefactor=1.5) const
void set(const std::string &name, int value)
set the flag, with a run-time name