00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <iostream>
00019 #include <cmath>
00020 #include <fstream>
00021 #include <algorithm>
00022 #include <sstream>
00023
00024 #include "RecoTracker/RingRecord/interface/SortRingsByZR.h"
00025 #include "RecoTracker/RingRecord/interface/SortLayersByZR.h"
00026
00027 #include "RecoTracker/RoadMapMakerESProducer/interface/RoadMaker.h"
00028
00029 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00030
00031 #include "DataFormats/DetId/interface/DetId.h"
00032 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00033 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00034 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00035 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00036 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00037 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00038 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00039 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00040
00041 RoadMaker::RoadMaker(const Rings *rings,
00042 RoadMaker::GeometryStructure structure,
00043 RoadMaker::SeedingType seedingType) :
00044 rings_(rings),
00045 structure_(structure),
00046 seedingType_(seedingType) {
00047
00048
00049 zBS_ = 0;
00050 if(structure_==FullDetector) {
00051 zBS_ = 3*5.3;
00052 } else if (structure_==FullDetectorII) {
00053 zBS_ = 3*5.3;
00054 } else if (structure_==MTCC) {
00055 zBS_ = 3*75.;
00056 } else if (structure_==TIF) {
00057 zBS_ = 3*75.;
00058 } else if (structure_==TIFTIB) {
00059 zBS_ = 5*75.;
00060 } else if (structure_==TIFTOB) {
00061 zBS_ = 5*75.;
00062 } else if (structure_==TIFTIBTOB) {
00063 zBS_ = 5*75.;
00064 } else if (structure_==TIFTOBTEC) {
00065 zBS_ = 5*75.;
00066 } else if (structure_==P5) {
00067 zBS_ = 5*75.;
00068 }
00069
00070 roads_ = new Roads();
00071
00072 constructRoads();
00073
00074 }
00075
00076 RoadMaker::~RoadMaker() {
00077
00078 }
00079
00080 void RoadMaker::constructRoads() {
00081
00082
00083 collectInnerSeedRings();
00084 collectInnerSeedRings1();
00085 collectInnerSeedRings2();
00086
00087
00088 collectOuterSeedRings();
00089 collectOuterSeedRings1();
00090
00091 if ( seedingType_ == TwoRingSeeds ) {
00092
00093 for ( std::vector<const Ring*>::iterator innerRing = innerSeedRings_.begin();
00094 innerRing != innerSeedRings_.end();
00095 ++innerRing ) {
00096
00097 std::vector<std::pair<double,double> > linesInnerSeedRingAndBS = LinesThroughRingAndBS((*innerRing));
00098 for ( std::vector<const Ring*>::iterator outerRing = outerSeedRings_.begin();
00099 outerRing != outerSeedRings_.end();
00100 ++outerRing ) {
00101
00102 if ( CompatibleWithLines(linesInnerSeedRingAndBS, (*outerRing) ) ) {
00103
00104 Roads::RoadSeed seed;
00105
00106
00107 seed.first.push_back((*innerRing));
00108
00109
00110 seed.second.push_back((*outerRing));
00111
00112 Roads::RoadSet set = RingsCompatibleWithSeed(seed);
00113
00114
00115 std::sort(seed.first.begin(),seed.first.end(),SortRingsByZR());
00116 std::sort(seed.second.begin(),seed.second.end(),SortRingsByZR());
00117
00118 roads_->insert(seed,set);
00119 }
00120 }
00121 }
00122
00123 } else if (seedingType_ == FourRingSeeds ) {
00124
00125
00126 for ( std::vector<const Ring*>::iterator innerRing1 = innerSeedRings1_.begin();
00127 innerRing1 != innerSeedRings1_.end();
00128 ++innerRing1 ) {
00129
00130
00131 std::vector<std::pair<double,double> > linesInnerSeedRing1AndBS = LinesThroughRingAndBS((*innerRing1));
00132
00133 for ( std::vector<const Ring*>::iterator innerRing2 = innerSeedRings2_.begin();
00134 innerRing2 != innerSeedRings2_.end();
00135 ++innerRing2 ) {
00136
00137
00138 if ( CompatibleWithLines(linesInnerSeedRing1AndBS, (*innerRing2) ) ) {
00139
00140
00141 std::vector<std::pair<double,double> > linesInnerSeedRing2AndBS = LinesThroughRingAndBS((*innerRing2));
00142
00143
00144 std::vector<std::pair<double,double> > linesInnerSeedRing1AndInnerSeedRing2 = LinesThroughRings(*innerRing1,*innerRing2);
00145
00146 for ( std::vector<const Ring*>::iterator outerRing1 = outerSeedRings1_.begin();
00147 outerRing1 != outerSeedRings1_.end();
00148 ++outerRing1 ) {
00149
00150
00151 if ( CompatibleWithLines(linesInnerSeedRing1AndBS, (*outerRing1) ) &&
00152 CompatibleWithLines(linesInnerSeedRing2AndBS, (*outerRing1) ) &&
00153 CompatibleWithLines(linesInnerSeedRing1AndInnerSeedRing2, (*outerRing1) ) ) {
00154
00155 std::vector<std::pair<double,double> > linesOuterSeedRing1AndBS = LinesThroughRingAndBS((*outerRing1));
00156 std::vector<std::pair<double,double> > linesInnerSeedRing1AndOuterSeedRing1 = LinesThroughRings(*innerRing1,*outerRing1);
00157 std::vector<std::pair<double,double> > linesInnerSeedRing2AndOuterSeedRing1 = LinesThroughRings(*innerRing2,*outerRing1);
00158
00159
00160 Roads::RoadSeed seed;
00161
00162
00163 seed.first.push_back((*innerRing1));
00164 seed.first.push_back((*innerRing2));
00165
00166
00167 seed.second.push_back((*outerRing1));
00168
00169
00170 std::vector<const Ring*> outerRing2Candidates;
00171
00172 for ( std::vector<const Ring*>::iterator outerRing = outerSeedRings_.begin();
00173 outerRing != outerSeedRings_.end();
00174 ++outerRing ) {
00175 if ( CompatibleWithLines(linesInnerSeedRing1AndBS, (*outerRing) ) &&
00176 CompatibleWithLines(linesInnerSeedRing2AndBS, (*outerRing) ) &&
00177 CompatibleWithLines(linesOuterSeedRing1AndBS, (*outerRing) ) &&
00178 CompatibleWithLines(linesInnerSeedRing1AndInnerSeedRing2, (*outerRing) ) &&
00179 CompatibleWithLines(linesInnerSeedRing1AndOuterSeedRing1, (*outerRing) ) &&
00180 CompatibleWithLines(linesInnerSeedRing2AndOuterSeedRing1, (*outerRing) ) ) {
00181 if ( (*outerRing)->getindex() < (*outerRing1)->getindex() ) {
00182 if ( !RingsOnSameLayer((*outerRing),(*outerRing1)) ) {
00183 outerRing2Candidates.push_back((*outerRing));
00184 }
00185 }
00186 }
00187 }
00188
00189 unsigned int size = outerRing2Candidates.size();
00190 if ( size > 0 ) {
00191 if ( size == 1 ) {
00192 seed.second.push_back(outerRing2Candidates[0]);
00193 } else {
00194
00195
00196 const Ring *selectedRing = 0;
00197 double z_2 = ((*outerRing1)->getzmax()+(*outerRing1)->getzmin())/2;
00198 double r_2 = ((*outerRing1)->getrmax()+(*outerRing1)->getrmin())/2;
00199 double z_1 = ((*innerRing1)->getzmax()+(*innerRing1)->getzmin())/2;
00200 double r_1 = ((*innerRing1)->getrmax()+(*innerRing1)->getrmin())/2;
00201 if ( RingInBarrel(*outerRing1) ) {
00202 double slope = (z_2-z_1) /(r_2-r_1);
00203 double intercept = z_1 - slope * r_1;
00204 double zDifference = 999;
00205 for ( std::vector<const Ring*>::iterator ring = outerRing2Candidates.begin();
00206 ring != outerRing2Candidates.end();
00207 ++ring ) {
00208 double z = slope * (((*ring)->getrmax()+(*ring)->getrmin())/2) + intercept;
00209 double diff = std::abs(z-(((*ring)->getzmax()+(*ring)->getzmin())/2));
00210 if ( diff < zDifference ) {
00211 selectedRing = *ring;
00212 zDifference = diff;
00213 }
00214 }
00215 } else {
00216 double slope = (r_2-r_1) /(z_2-z_1);
00217 double intercept = r_1 - slope * z_1;
00218 double rDifference = 999;
00219 for ( std::vector<const Ring*>::iterator ring = outerRing2Candidates.begin();
00220 ring != outerRing2Candidates.end();
00221 ++ring ) {
00222 double r = slope * (((*ring)->getzmax()+(*ring)->getzmin())/2) + intercept;
00223 double diff = std::abs(r-(((*ring)->getrmax()+(*ring)->getrmin())/2));
00224 if ( diff < rDifference ) {
00225 selectedRing = *ring;
00226 rDifference = diff;
00227 }
00228 }
00229 }
00230 seed.second.push_back(selectedRing);
00231 }
00232 }
00233
00234
00235
00236 Roads::RoadSeed tempSeed;
00237 tempSeed.first.push_back((*innerRing1));
00238 tempSeed.second.push_back((*outerRing1));
00239 Roads::RoadSet set = RingsCompatibleWithSeed(tempSeed);
00240
00241
00242 std::sort(seed.first.begin(),seed.first.end(),SortRingsByZR());
00243 std::sort(seed.second.begin(),seed.second.end(),SortRingsByZR());
00244
00245 roads_->insert(seed,set);
00246
00247 }
00248 }
00249 }
00250 }
00251 }
00252 }
00253
00254 edm::LogInfo("RoadSearch") << "Constructed " << roads_->size() << " roads.";
00255
00256 }
00257
00258 void RoadMaker::collectInnerSeedRings() {
00259
00260 if(structure_==FullDetector || structure_==FullDetectorII) {
00261 collectInnerTIBSeedRings();
00262 collectInnerTIDSeedRings();
00263 collectInnerTECSeedRings();
00264 } else if(structure_==MTCC) {
00265 collectInnerTIBSeedRings();
00266 } else if(structure_==TIF) {
00267 collectInnerTIBSeedRings();
00268 collectInnerTOBSeedRings();
00269 collectInnerTIDSeedRings();
00270 collectInnerTECSeedRings();
00271 } else if(structure_==TIFTOB) {
00272 collectInnerTOBSeedRings();
00273 } else if(structure_==TIFTIB) {
00274 collectInnerTIBSeedRings();
00275 collectInnerTIDSeedRings();
00276 } else if(structure_==TIFTIBTOB) {
00277 collectInnerTIBSeedRings();
00278 collectInnerTIDSeedRings();
00279 collectInnerTOBSeedRings();
00280 } else if(structure_==TIFTOBTEC) {
00281 collectInnerTOBSeedRings();
00282 collectInnerTECSeedRings();
00283 } else if(structure_==P5) {
00284 collectInnerTOBSeedRings();
00285 collectInnerTECSeedRings();
00286 }
00287
00288 LogDebug("RoadSearch") << "collected " << innerSeedRings_.size() << " inner seed rings";
00289
00290 }
00291
00292 void RoadMaker::collectInnerTIBSeedRings() {
00293
00294
00295 unsigned int counter = 0, layer_min=0, layer_max=0, fw_bw_min=0, fw_bw_max=0, ext_int_min=0, ext_int_max=0, detector_min = 0, detector_max=0;
00296 if(structure_==FullDetector || structure_==FullDetectorII) {
00297 layer_min = 1;
00298 layer_max = 3;
00299 fw_bw_min = 1;
00300 fw_bw_max = 3;
00301 ext_int_min = 1;
00302 ext_int_max = 3;
00303 detector_min = 1;
00304 detector_max = 4;
00305 } else if(structure_==MTCC) {
00306 layer_min = 1;
00307 layer_max = 2;
00308 fw_bw_min = 2;
00309 fw_bw_max = 3;
00310 ext_int_min = 1;
00311 ext_int_max = 3;
00312 detector_min = 1;
00313 detector_max = 4;
00314 } else if (structure_==TIF) {
00315 layer_min = 1;
00316 layer_max = 3;
00317 fw_bw_min = 1;
00318 fw_bw_max = 3;
00319 ext_int_min = 1;
00320 ext_int_max = 3;
00321 detector_min = 1;
00322 detector_max = 4;
00323 } else if (structure_==TIFTIB) {
00324 layer_min = 1;
00325 layer_max = 2;
00326 fw_bw_min = 1;
00327 fw_bw_max = 3;
00328 ext_int_min = 1;
00329 ext_int_max = 3;
00330 detector_min = 1;
00331 detector_max = 4;
00332 } else if (structure_==TIFTIBTOB) {
00333 layer_min = 1;
00334 layer_max = 3;
00335 fw_bw_min = 1;
00336 fw_bw_max = 3;
00337 ext_int_min = 1;
00338 ext_int_max = 3;
00339 detector_min = 1;
00340 detector_max = 4;
00341 }
00342
00343
00344 for ( unsigned int layer = layer_min; layer < layer_max; ++layer ) {
00345 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
00346 for ( unsigned int ext_int = ext_int_min; ext_int < ext_int_max; ++ext_int ) {
00347 for ( unsigned int detector = detector_min; detector < detector_max; ++detector ) {
00348 const Ring* temp_ring = rings_->getTIBRing(layer,fw_bw,ext_int,detector);
00349 innerSeedRings_.push_back(temp_ring);
00350 ++counter;
00351 LogDebug("RoadSearch") << "collected TIB inner seed ring with index: " << temp_ring->getindex();
00352 }
00353 }
00354 }
00355 }
00356
00357 LogDebug("RoadSearch") << "collected " << counter << " TIB inner seed rings";
00358
00359 }
00360
00361 void RoadMaker::collectInnerTIDSeedRings() {
00362
00363
00364 unsigned int counter = 0;
00365
00366 unsigned int fw_bw_min =0, fw_bw_max = 0,wheel_min = 0, wheel_max = 0, ring_min=0, ring_max = 0;
00367
00368 if(structure_==FullDetector || structure_==FullDetectorII) {
00369 fw_bw_min = 1;
00370 fw_bw_max = 3;
00371 wheel_min = 1;
00372 wheel_max = 4;
00373 ring_min = 1;
00374 ring_max = 3;
00375 } else if(structure_==TIF) {
00376 fw_bw_min = 2;
00377 fw_bw_max = 3;
00378 wheel_min = 1;
00379 wheel_max = 4;
00380 ring_min = 1;
00381 ring_max = 3;
00382 } else if(structure_==TIFTIBTOB) {
00383 fw_bw_min = 2;
00384 fw_bw_max = 3;
00385 wheel_min = 1;
00386 wheel_max = 4;
00387 ring_min = 1;
00388 ring_max = 3;
00389 } else if(structure_==TIFTIB) {
00390 fw_bw_min = 2;
00391 fw_bw_max = 3;
00392 wheel_min = 1;
00393 wheel_max = 4;
00394 ring_min = 1;
00395 ring_max = 2;
00396 }
00397
00398 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
00399 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
00400 for ( unsigned int ring = ring_min; ring < ring_max; ++ring ) {
00401 const Ring* temp_ring = rings_->getTIDRing(fw_bw,wheel,ring);
00402 innerSeedRings_.push_back(temp_ring);
00403 ++counter;
00404 LogDebug("RoadSearch") << "collected TID inner seed ring with index: " << temp_ring->getindex();
00405 }
00406 }
00407 }
00408
00409 LogDebug("RoadSearch") << "collected " << counter << " TID inner seed rings";
00410
00411 }
00412
00413 void RoadMaker::collectInnerTECSeedRings() {
00414
00415
00416 unsigned int counter = 0;
00417
00418 unsigned int fw_bw_min = 1;
00419 unsigned int fw_bw_max = 1;
00420 unsigned int wheel_min = 1;
00421 unsigned int wheel_max = 9;
00422 unsigned int ring_min[9];
00423 unsigned int ring_max[9];
00424
00425 if(structure_==FullDetector || structure_==FullDetectorII) {
00426 fw_bw_max = 3;
00427
00428 ring_min[1] = 1;
00429 ring_max[1] = 3;
00430
00431 ring_min[2] = 1;
00432 ring_max[2] = 3;
00433
00434 ring_min[3] = 1;
00435 ring_max[3] = 3;
00436
00437 ring_min[4] = 2;
00438 ring_max[4] = 3;
00439
00440 ring_min[5] = 2;
00441 ring_max[5] = 3;
00442
00443 ring_min[6] = 2;
00444 ring_max[6] = 3;
00445
00446 ring_min[7] = 1;
00447 ring_max[7] = 1;
00448
00449 ring_min[8] = 1;
00450 ring_max[8] = 1;
00451 } else if (structure_==TIFTOBTEC || structure_==TIF) {
00452 fw_bw_min = 2;
00453 fw_bw_max = 3;
00454
00455 ring_min[1] = 1;
00456 ring_max[1] = 4;
00457
00458 ring_min[2] = 1;
00459 ring_max[2] = 4;
00460
00461 ring_min[3] = 1;
00462 ring_max[3] = 4;
00463
00464 ring_min[4] = 2;
00465 ring_max[4] = 4;
00466
00467 ring_min[5] = 2;
00468 ring_max[5] = 4;
00469
00470 ring_min[6] = 2;
00471 ring_max[6] = 4;
00472
00473 ring_min[7] = 3;
00474 ring_max[7] = 4;
00475
00476 ring_min[8] = 3;
00477 ring_max[8] = 4;
00478 } else if (structure_==P5) {
00479 fw_bw_min = 1;
00480 fw_bw_max = 3;
00481
00482 ring_min[1] = 4;
00483 ring_max[1] = 6;
00484
00485 ring_min[2] = 4;
00486 ring_max[2] = 6;
00487
00488 ring_min[3] = 4;
00489 ring_max[3] = 6;
00490
00491 ring_min[4] = 4;
00492 ring_max[4] = 6;
00493
00494 ring_min[5] = 4;
00495 ring_max[5] = 6;
00496
00497 ring_min[6] = 4;
00498 ring_max[6] = 6;
00499
00500 ring_min[7] = 4;
00501 ring_max[7] = 6;
00502
00503 ring_min[8] = 4;
00504 ring_max[8] = 6;
00505 }
00506
00507 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
00508 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
00509 for ( unsigned int ring = ring_min[wheel]; ring < ring_max[wheel]; ++ring ) {
00510 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,ring);
00511 innerSeedRings_.push_back(temp_ring);
00512 ++counter;
00513 LogDebug("RoadSearch") << "collected TEC inner seed ring with index: " << temp_ring->getindex();
00514 }
00515 }
00516 }
00517
00518 LogDebug("RoadSearch") << "collected " << counter << " TEC inner seed rings";
00519
00520 }
00521
00522 void RoadMaker::collectInnerTOBSeedRings() {
00523
00524
00525 unsigned int counter = 0, layer_min=0, layer_max=0, rod_fw_bw_min=0, rod_fw_bw_max=0, detector_min=0, detector_max=0;
00526 if(structure_==FullDetector || structure_==FullDetectorII) {
00527 layer_min = 5;
00528 layer_max = 7;
00529 rod_fw_bw_min = 1;
00530 rod_fw_bw_max = 3;
00531 detector_min = 1;
00532 detector_max = 7;
00533 } else if (structure_==MTCC) {
00534 layer_min = 1;
00535 layer_max = 3;
00536 rod_fw_bw_min = 2;
00537 rod_fw_bw_max = 3;
00538 detector_min = 1;
00539 detector_max = 7;
00540 } else if (structure_==TIFTOB || structure_==TIFTIBTOB || structure_==TIF) {
00541 layer_min = 1;
00542 layer_max = 3;
00543 rod_fw_bw_min = 1;
00544 rod_fw_bw_max = 3;
00545 detector_min = 1;
00546 detector_max = 7;
00547 } else if (structure_==TIFTOBTEC) {
00548 layer_min = 1;
00549 layer_max = 3;
00550 rod_fw_bw_min = 1;
00551 rod_fw_bw_max = 3;
00552 detector_min = 1;
00553 detector_max = 7;
00554 } else if (structure_==P5) {
00555 layer_min = 3;
00556 layer_max = 5;
00557 rod_fw_bw_min = 1;
00558 rod_fw_bw_max = 3;
00559 detector_min = 1;
00560 detector_max = 7;
00561 }
00562
00563
00564 for ( unsigned int layer = layer_min; layer < layer_max; ++layer ) {
00565 for ( unsigned int rod_fw_bw = rod_fw_bw_min; rod_fw_bw < rod_fw_bw_max; ++rod_fw_bw ) {
00566 for ( unsigned int detector = detector_min; detector < detector_max; ++detector ) {
00567 const Ring* temp_ring = rings_->getTOBRing(layer,rod_fw_bw,detector);
00568 innerSeedRings_.push_back(temp_ring);
00569 ++counter;
00570 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00571 }
00572 }
00573 }
00574
00575 if(structure_==FullDetector || structure_==FullDetectorII) {
00576
00577 const Ring* temp_ring = rings_->getTOBRing(2,1,6);
00578 innerSeedRings_.push_back(temp_ring);
00579 ++counter;
00580 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00581
00582 temp_ring = rings_->getTOBRing(2,2,6);
00583 innerSeedRings_.push_back(temp_ring);
00584 ++counter;
00585 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00586
00587 temp_ring = rings_->getTOBRing(3,1,6);
00588 innerSeedRings_.push_back(temp_ring);
00589 ++counter;
00590 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00591
00592 temp_ring = rings_->getTOBRing(3,2,6);
00593 innerSeedRings_.push_back(temp_ring);
00594 ++counter;
00595 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00596
00597 temp_ring = rings_->getTOBRing(4,1,6);
00598 innerSeedRings_.push_back(temp_ring);
00599 ++counter;
00600 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00601
00602 temp_ring = rings_->getTOBRing(4,2,6);
00603 innerSeedRings_.push_back(temp_ring);
00604 ++counter;
00605 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00606
00607 }
00608
00609 LogDebug("RoadSearch") << "collected " << counter << " TOB inner seed rings";
00610
00611 }
00612
00613 void RoadMaker::collectInnerSeedRings1() {
00614
00615 if(structure_==FullDetector || structure_==FullDetectorII) {
00616 collectInnerTIBSeedRings1();
00617 collectInnerTIDSeedRings1();
00618 collectInnerTECSeedRings1();
00619 } else if(structure_==MTCC) {
00620 collectInnerTIBSeedRings1();
00621 } else if(structure_==TIF) {
00622 collectInnerTIBSeedRings1();
00623 collectInnerTOBSeedRings1();
00624 collectInnerTIDSeedRings1();
00625 collectInnerTECSeedRings1();
00626 } else if(structure_==TIFTOB) {
00627 collectInnerTOBSeedRings1();
00628 } else if(structure_==TIFTIB) {
00629 collectInnerTIBSeedRings1();
00630 collectInnerTIDSeedRings1();
00631 } else if(structure_==TIFTIBTOB) {
00632 collectInnerTIBSeedRings1();
00633 collectInnerTIDSeedRings1();
00634 collectInnerTOBSeedRings1();
00635 } else if(structure_==TIFTOBTEC) {
00636 collectInnerTOBSeedRings1();
00637 collectInnerTECSeedRings1();
00638 }
00639
00640 LogDebug("RoadSearch") << "collected " << innerSeedRings1_.size() << " inner seed rings";
00641
00642 }
00643
00644 void RoadMaker::collectInnerTIBSeedRings1() {
00645
00646
00647 unsigned int counter = 0, layer_min=0, layer_max=0, fw_bw_min=0, fw_bw_max=0, ext_int_min=0, ext_int_max=0, detector_min=0, detector_max=0;
00648 if(structure_==FullDetector || structure_==FullDetectorII) {
00649 layer_min = 1;
00650 layer_max = 2;
00651 fw_bw_min = 1;
00652 fw_bw_max = 3;
00653 ext_int_min = 1;
00654 ext_int_max = 3;
00655 detector_min = 1;
00656 detector_max = 4;
00657 } else if(structure_==MTCC) {
00658 layer_min = 1;
00659 layer_max = 2;
00660 fw_bw_min = 2;
00661 fw_bw_max = 3;
00662 ext_int_min = 1;
00663 ext_int_max = 3;
00664 detector_min = 1;
00665 detector_max = 4;
00666 } else if (structure_==TIF) {
00667 layer_min = 1;
00668 layer_max = 2;
00669 fw_bw_min = 1;
00670 fw_bw_max = 3;
00671 ext_int_min = 1;
00672 ext_int_max = 3;
00673 detector_min = 1;
00674 detector_max = 4;
00675 } else if (structure_==TIFTIB) {
00676 layer_min = 1;
00677 layer_max = 2;
00678 fw_bw_min = 1;
00679 fw_bw_max = 3;
00680 ext_int_min = 1;
00681 ext_int_max = 3;
00682 detector_min = 1;
00683 detector_max = 4;
00684 } else if (structure_==TIFTIBTOB) {
00685 layer_min = 1;
00686 layer_max = 2;
00687 fw_bw_min = 1;
00688 fw_bw_max = 3;
00689 ext_int_min = 1;
00690 ext_int_max = 3;
00691 detector_min = 1;
00692 detector_max = 4;
00693 }
00694
00695 for ( unsigned int layer = layer_min; layer < layer_max; ++layer ) {
00696 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
00697 for ( unsigned int ext_int = ext_int_min; ext_int < ext_int_max; ++ext_int ) {
00698 for ( unsigned int detector = detector_min; detector < detector_max; ++detector ) {
00699 const Ring* temp_ring = rings_->getTIBRing(layer,fw_bw,ext_int,detector);
00700 innerSeedRings1_.push_back(temp_ring);
00701 ++counter;
00702 LogDebug("RoadSearch") << "collected TIB inner seed ring with index: " << temp_ring->getindex();
00703 }
00704 }
00705 }
00706 }
00707
00708 LogDebug("RoadSearch") << "collected " << counter << " TIB inner seed rings";
00709
00710 }
00711
00712 void RoadMaker::collectInnerTIDSeedRings1() {
00713
00714
00715 unsigned int counter = 0;
00716
00717 unsigned int fw_bw_min = 0, fw_bw_max = 0, wheel_min=0, wheel_max = 0, ring_min=0, ring_max = 0;
00718
00719 if(structure_==FullDetector || structure_==FullDetectorII) {
00720 fw_bw_min = 1;
00721 fw_bw_max = 3;
00722 wheel_min = 1;
00723 wheel_max = 4;
00724 ring_min = 1;
00725 ring_max = 2;
00726 } else if(structure_==TIF) {
00727 fw_bw_min = 2;
00728 fw_bw_max = 3;
00729 wheel_min = 1;
00730 wheel_max = 4;
00731 ring_min = 1;
00732 ring_max = 2;
00733 } else if(structure_==TIFTIBTOB) {
00734 fw_bw_min = 2;
00735 fw_bw_max = 3;
00736 wheel_min = 1;
00737 wheel_max = 4;
00738 ring_min = 1;
00739 ring_max = 2;
00740 } else if(structure_==TIFTIB) {
00741 fw_bw_min = 2;
00742 fw_bw_max = 3;
00743 wheel_min = 1;
00744 wheel_max = 4;
00745 ring_min = 1;
00746 ring_max = 2;
00747 }
00748
00749 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
00750 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
00751 for ( unsigned int ring = ring_min; ring < ring_max; ++ring ) {
00752 const Ring* temp_ring = rings_->getTIDRing(fw_bw,wheel,ring);
00753 innerSeedRings1_.push_back(temp_ring);
00754 ++counter;
00755 LogDebug("RoadSearch") << "collected TID inner seed ring with index: " << temp_ring->getindex();
00756 }
00757 }
00758 }
00759
00760 LogDebug("RoadSearch") << "collected " << counter << " TID inner seed rings";
00761
00762 }
00763
00764 void RoadMaker::collectInnerTECSeedRings1() {
00765
00766
00767 unsigned int counter = 0;
00768
00769 unsigned int fw_bw_min = 1;
00770 unsigned int fw_bw_max = 1;
00771 unsigned int wheel_min = 1;
00772 unsigned int wheel_max = 4;
00773 unsigned int ring_min[9];
00774 unsigned int ring_max[9];
00775
00776 if(structure_==FullDetector || structure_==FullDetectorII) {
00777 fw_bw_min = 1;
00778 fw_bw_max = 3;
00779
00780 ring_min[1] = 1;
00781 ring_max[1] = 2;
00782
00783 ring_min[2] = 1;
00784 ring_max[2] = 2;
00785
00786 ring_min[3] = 1;
00787 ring_max[3] = 2;
00788
00789 ring_min[4] = 1;
00790 ring_max[4] = 1;
00791
00792 ring_min[5] = 1;
00793 ring_max[5] = 1;
00794
00795 ring_min[6] = 1;
00796 ring_max[6] = 1;
00797
00798 ring_min[7] = 1;
00799 ring_max[7] = 1;
00800
00801 ring_min[8] = 1;
00802 ring_max[8] = 1;
00803 } else if (structure_==TIFTOBTEC || structure_==TIF) {
00804 fw_bw_min = 2;
00805 fw_bw_max = 3;
00806
00807 ring_min[1] = 1;
00808 ring_max[1] = 2;
00809
00810 ring_min[2] = 1;
00811 ring_max[2] = 2;
00812
00813 ring_min[3] = 1;
00814 ring_max[3] = 2;
00815
00816 ring_min[4] = 1;
00817 ring_max[4] = 1;
00818
00819 ring_min[5] = 1;
00820 ring_max[5] = 1;
00821
00822 ring_min[6] = 1;
00823 ring_max[6] = 1;
00824
00825 ring_min[7] = 1;
00826 ring_max[7] = 1;
00827
00828 ring_min[8] = 1;
00829 ring_max[8] = 1;
00830 }
00831
00832 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
00833 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
00834 for ( unsigned int ring = ring_min[wheel]; ring < ring_max[wheel]; ++ring ) {
00835 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,ring);
00836 innerSeedRings1_.push_back(temp_ring);
00837 ++counter;
00838 LogDebug("RoadSearch") << "collected TEC inner seed ring with index: " << temp_ring->getindex();
00839 }
00840 }
00841 }
00842
00843 LogDebug("RoadSearch") << "collected " << counter << " TEC inner seed rings";
00844
00845 }
00846
00847 void RoadMaker::collectInnerTOBSeedRings1() {
00848
00849
00850 unsigned int counter = 0, layer_min=0, layer_max=0, rod_fw_bw_min=0, rod_fw_bw_max=0, detector_min=0, detector_max=0;
00851 if(structure_==FullDetector || structure_==FullDetectorII) {
00852 layer_min = 5;
00853 layer_max = 6;
00854 rod_fw_bw_min = 1;
00855 rod_fw_bw_max = 3;
00856 detector_min = 1;
00857 detector_max = 7;
00858 } else if (structure_==MTCC) {
00859 layer_min = 1;
00860 layer_max = 3;
00861 rod_fw_bw_min = 2;
00862 rod_fw_bw_max = 3;
00863 detector_min = 1;
00864 detector_max = 7;
00865 } else if (structure_==TIFTOB || structure_==TIFTIBTOB || structure_==TIF) {
00866 layer_min = 1;
00867 layer_max = 2;
00868 rod_fw_bw_min = 1;
00869 rod_fw_bw_max = 3;
00870 detector_min = 1;
00871 detector_max = 7;
00872 } else if (structure_==TIFTOBTEC) {
00873 layer_min = 1;
00874 layer_max = 2;
00875 rod_fw_bw_min = 1;
00876 rod_fw_bw_max = 3;
00877 detector_min = 1;
00878 detector_max = 7;
00879 }
00880
00881 for ( unsigned int layer = layer_min; layer < layer_max; ++layer ) {
00882 for ( unsigned int rod_fw_bw = rod_fw_bw_min; rod_fw_bw < rod_fw_bw_max; ++rod_fw_bw ) {
00883 for ( unsigned int detector = detector_min; detector < detector_max; ++detector ) {
00884 const Ring* temp_ring = rings_->getTOBRing(layer,rod_fw_bw,detector);
00885 innerSeedRings1_.push_back(temp_ring);
00886 ++counter;
00887 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00888 }
00889 }
00890 }
00891
00892 if(structure_==FullDetector) {
00893
00894 const Ring* temp_ring = rings_->getTOBRing(2,1,6);
00895 innerSeedRings1_.push_back(temp_ring);
00896 ++counter;
00897 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00898
00899 temp_ring = rings_->getTOBRing(2,2,6);
00900 innerSeedRings1_.push_back(temp_ring);
00901 ++counter;
00902 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00903
00904 temp_ring = rings_->getTOBRing(3,1,6);
00905 innerSeedRings1_.push_back(temp_ring);
00906 ++counter;
00907 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00908
00909 temp_ring = rings_->getTOBRing(3,2,6);
00910 innerSeedRings1_.push_back(temp_ring);
00911 ++counter;
00912 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00913
00914 temp_ring = rings_->getTOBRing(4,1,6);
00915 innerSeedRings1_.push_back(temp_ring);
00916 ++counter;
00917 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00918
00919 temp_ring = rings_->getTOBRing(4,2,6);
00920 innerSeedRings1_.push_back(temp_ring);
00921 ++counter;
00922 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
00923
00924 }
00925
00926 LogDebug("RoadSearch") << "collected " << counter << " TOB inner seed rings";
00927
00928 }
00929
00930 void RoadMaker::collectInnerSeedRings2() {
00931
00932 if(structure_==FullDetector) {
00933 collectInnerTIBSeedRings2();
00934 collectInnerTIDSeedRings2();
00935 collectInnerTECSeedRings2();
00936 } else if(structure_==FullDetectorII) {
00937 collectInnerTIBSeedRings2();
00938 collectInnerTIDSeedRings2();
00939 collectInnerTECSeedRings2();
00940 } else if(structure_==MTCC) {
00941 collectInnerTIBSeedRings2();
00942 } else if(structure_==TIF) {
00943 collectInnerTIBSeedRings2();
00944 collectInnerTOBSeedRings2();
00945 collectInnerTIDSeedRings2();
00946 collectInnerTECSeedRings2();
00947 } else if(structure_==TIFTOB) {
00948 collectInnerTOBSeedRings2();
00949 } else if(structure_==TIFTIB) {
00950 collectInnerTIBSeedRings2();
00951 collectInnerTIDSeedRings2();
00952 } else if(structure_==TIFTIBTOB) {
00953 collectInnerTIBSeedRings2();
00954 collectInnerTIDSeedRings2();
00955 collectInnerTOBSeedRings2();
00956 } else if(structure_==TIFTOBTEC) {
00957 collectInnerTOBSeedRings2();
00958 collectInnerTECSeedRings2();
00959 }
00960
00961
00962 LogDebug("RoadSearch") << "collected " << innerSeedRings2_.size() << " inner seed rings";
00963
00964 }
00965
00966 void RoadMaker::collectInnerTIBSeedRings2() {
00967
00968
00969 unsigned int counter = 0, layer_min = 0, layer_max=0, fw_bw_min=0, fw_bw_max=0, ext_int_min=0, ext_int_max=0, detector_min=0, detector_max=0;
00970 if(structure_==FullDetector || structure_==FullDetectorII) {
00971 layer_min = 2;
00972 layer_max = 3;
00973 fw_bw_min = 1;
00974 fw_bw_max = 3;
00975 ext_int_min = 1;
00976 ext_int_max = 3;
00977 detector_min = 1;
00978 detector_max = 4;
00979 } else if(structure_==MTCC) {
00980 layer_min = 1;
00981 layer_max = 2;
00982 fw_bw_min = 2;
00983 fw_bw_max = 3;
00984 ext_int_min = 1;
00985 ext_int_max = 3;
00986 detector_min = 1;
00987 detector_max = 4;
00988 } else if(structure_==TIF) {
00989 layer_min = 2;
00990 layer_max = 3;
00991 fw_bw_min = 1;
00992 fw_bw_max = 3;
00993 ext_int_min = 1;
00994 ext_int_max = 3;
00995 detector_min = 1;
00996 detector_max = 4;
00997 } else if(structure_==TIFTIB) {
00998 layer_min = 1;
00999 layer_max = 2;
01000 fw_bw_min = 1;
01001 fw_bw_max = 3;
01002 ext_int_min = 1;
01003 ext_int_max = 3;
01004 detector_min = 1;
01005 detector_max = 4;
01006 } else if(structure_==TIFTIBTOB) {
01007 layer_min = 2;
01008 layer_max = 3;
01009 fw_bw_min = 1;
01010 fw_bw_max = 3;
01011 ext_int_min = 1;
01012 ext_int_max = 3;
01013 detector_min = 1;
01014 detector_max = 4;
01015 } else if(structure_==TIFTOBTEC) {
01016 layer_min = 2;
01017 layer_max = 3;
01018 fw_bw_min = 1;
01019 fw_bw_max = 3;
01020 ext_int_min = 1;
01021 ext_int_max = 3;
01022 detector_min = 1;
01023 detector_max = 4;
01024 }
01025
01026 for ( unsigned int layer = layer_min; layer < layer_max; ++layer ) {
01027 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01028 for ( unsigned int ext_int = ext_int_min; ext_int < ext_int_max; ++ext_int ) {
01029 for ( unsigned int detector = detector_min; detector < detector_max; ++detector ) {
01030 const Ring* temp_ring = rings_->getTIBRing(layer,fw_bw,ext_int,detector);
01031 innerSeedRings2_.push_back(temp_ring);
01032 ++counter;
01033 LogDebug("RoadSearch") << "collected TIB inner seed ring with index: " << temp_ring->getindex();
01034 }
01035 }
01036 }
01037 }
01038
01039 LogDebug("RoadSearch") << "collected " << counter << " TIB inner seed rings";
01040
01041 }
01042
01043 void RoadMaker::collectInnerTIDSeedRings2() {
01044
01045
01046 unsigned int counter = 0;
01047
01048 unsigned int fw_bw_min = 0, fw_bw_max = 0, wheel_min=0, wheel_max = 0, ring_min = 0, ring_max = 0;
01049
01050 if(structure_==FullDetector) {
01051 fw_bw_min = 1;
01052 fw_bw_max = 3;
01053 wheel_min = 1;
01054 wheel_max = 4;
01055 ring_min = 2;
01056 ring_max = 3;
01057 } else if(structure_==FullDetectorII) {
01058 fw_bw_min = 1;
01059 fw_bw_max = 3;
01060 wheel_min = 1;
01061 wheel_max = 4;
01062 ring_min = 2;
01063 ring_max = 4;
01064 } else if(structure_==TIFTIBTOB || structure_==TIF) {
01065 fw_bw_min = 2;
01066 fw_bw_max = 3;
01067 wheel_min = 1;
01068 wheel_max = 4;
01069 ring_min = 2;
01070 ring_max = 3;
01071 } else if(structure_==TIFTIB) {
01072 fw_bw_min = 2;
01073 fw_bw_max = 3;
01074 wheel_min = 1;
01075 wheel_max = 4;
01076 ring_min = 2;
01077 ring_max = 2;
01078 }
01079
01080 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01081 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
01082 for ( unsigned int ring = ring_min; ring < ring_max; ++ring ) {
01083 const Ring* temp_ring = rings_->getTIDRing(fw_bw,wheel,ring);
01084 innerSeedRings2_.push_back(temp_ring);
01085 ++counter;
01086 LogDebug("RoadSearch") << "collected TID inner seed ring with index: " << temp_ring->getindex();
01087 }
01088 }
01089 }
01090
01091 LogDebug("RoadSearch") << "collected " << counter << " TID inner seed rings";
01092
01093 }
01094
01095 void RoadMaker::collectInnerTECSeedRings2() {
01096
01097
01098 unsigned int counter = 0;
01099
01100 unsigned int fw_bw_min = 1;
01101 unsigned int fw_bw_max = 1;
01102 unsigned int wheel_min = 1;
01103 unsigned int wheel_max = 9;
01104 unsigned int ring_min[9];
01105 unsigned int ring_max[9];
01106
01107 if(structure_==FullDetector || structure_==FullDetectorII) {
01108 fw_bw_min = 1;
01109 fw_bw_max = 3;
01110
01111 ring_min[1] = 2;
01112 ring_max[1] = 3;
01113
01114 ring_min[2] = 2;
01115 ring_max[2] = 3;
01116
01117 ring_min[3] = 2;
01118 ring_max[3] = 3;
01119
01120 ring_min[4] = 2;
01121 ring_max[4] = 3;
01122
01123 ring_min[5] = 2;
01124 ring_max[5] = 3;
01125
01126 ring_min[6] = 2;
01127 ring_max[6] = 3;
01128
01129 ring_min[7] = 1;
01130 ring_max[7] = 1;
01131
01132 ring_min[8] = 1;
01133 ring_max[8] = 1;
01134 } else if (structure_==TIFTOBTEC || structure_==TIF) {
01135 fw_bw_min = 2;
01136 fw_bw_max = 3;
01137
01138 ring_min[1] = 3;
01139 ring_max[1] = 4;
01140
01141 ring_min[2] = 3;
01142 ring_max[2] = 4;
01143
01144 ring_min[3] = 3;
01145 ring_max[3] = 4;
01146
01147 ring_min[4] = 3;
01148 ring_max[4] = 4;
01149
01150 ring_min[5] = 3;
01151 ring_max[5] = 4;
01152
01153 ring_min[6] = 3;
01154 ring_max[6] = 4;
01155
01156 ring_min[7] = 3;
01157 ring_max[7] = 4;
01158
01159 ring_min[8] = 3;
01160 ring_max[8] = 4;
01161 }
01162
01163 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01164 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
01165 for ( unsigned int ring = ring_min[wheel]; ring < ring_max[wheel]; ++ring ) {
01166 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,ring);
01167 innerSeedRings2_.push_back(temp_ring);
01168 ++counter;
01169 LogDebug("RoadSearch") << "collected TEC inner seed ring with index: " << temp_ring->getindex();
01170 }
01171 }
01172 }
01173
01174 LogDebug("RoadSearch") << "collected " << counter << " TEC inner seed rings";
01175
01176 }
01177
01178 void RoadMaker::collectInnerTOBSeedRings2() {
01179
01180
01181 unsigned int counter = 0, layer_min=0, layer_max=0, rod_fw_bw_min=0, rod_fw_bw_max=0, detector_min=0, detector_max=0;
01182 if(structure_==FullDetector || structure_==FullDetectorII) {
01183 layer_min = 5;
01184 layer_max = 7;
01185 rod_fw_bw_min = 1;
01186 rod_fw_bw_max = 3;
01187 detector_max = 1;
01188 detector_max = 7;
01189 } else if (structure_==MTCC) {
01190 layer_min = 1;
01191 layer_max = 3;
01192 rod_fw_bw_min = 2;
01193 rod_fw_bw_max = 3;
01194 detector_max = 1;
01195 detector_max = 7;
01196 } else if (structure_==TIFTOB || structure_==TIFTIBTOB || structure_==TIFTOBTEC || structure_==TIF) {
01197 layer_min = 2;
01198 layer_max = 3;
01199 rod_fw_bw_min = 1;
01200 rod_fw_bw_max = 3;
01201 detector_max = 1;
01202 detector_max = 7;
01203 }
01204
01205 for ( unsigned int layer = layer_min; layer < layer_max; ++layer ) {
01206 for ( unsigned int rod_fw_bw = rod_fw_bw_min; rod_fw_bw < rod_fw_bw_max; ++rod_fw_bw ) {
01207 for ( unsigned int detector = detector_min; detector < detector_max; ++detector ) {
01208 const Ring* temp_ring = rings_->getTOBRing(layer,rod_fw_bw,detector);
01209 innerSeedRings2_.push_back(temp_ring);
01210 ++counter;
01211 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01212 }
01213 }
01214 }
01215
01216 if(structure_==FullDetector || structure_==FullDetectorII) {
01217
01218 const Ring* temp_ring = rings_->getTOBRing(2,1,6);
01219 innerSeedRings2_.push_back(temp_ring);
01220 ++counter;
01221 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01222
01223 temp_ring = rings_->getTOBRing(2,2,6);
01224 innerSeedRings2_.push_back(temp_ring);
01225 ++counter;
01226 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01227
01228 temp_ring = rings_->getTOBRing(3,1,6);
01229 innerSeedRings2_.push_back(temp_ring);
01230 ++counter;
01231 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01232
01233 temp_ring = rings_->getTOBRing(3,2,6);
01234 innerSeedRings2_.push_back(temp_ring);
01235 ++counter;
01236 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01237
01238 temp_ring = rings_->getTOBRing(4,1,6);
01239 innerSeedRings2_.push_back(temp_ring);
01240 ++counter;
01241 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01242
01243 temp_ring = rings_->getTOBRing(4,2,6);
01244 innerSeedRings2_.push_back(temp_ring);
01245 ++counter;
01246 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01247
01248 }
01249
01250 LogDebug("RoadSearch") << "collected " << counter << " TOB inner seed rings";
01251
01252 }
01253
01254 void RoadMaker::collectOuterSeedRings() {
01255
01256 if(structure_==FullDetector) {
01257 collectOuterTOBSeedRings();
01258 collectOuterTECSeedRings();
01259 } else if(structure_==FullDetectorII) {
01260 collectOuterTOBSeedRings();
01261 collectOuterTECSeedRings();
01262 } else if (structure_==MTCC) {
01263 collectOuterTOBSeedRings();
01264 } else if (structure_==TIF) {
01265 collectOuterTOBSeedRings();
01266 collectOuterTECSeedRings();
01267 } else if (structure_==TIFTOB) {
01268 collectOuterTOBSeedRings();
01269 } else if (structure_==TIFTIB) {
01270 collectOuterTIBSeedRings();
01271 } else if (structure_==TIFTIBTOB) {
01272 collectOuterTOBSeedRings();
01273 } else if (structure_==TIFTOBTEC) {
01274 collectOuterTOBSeedRings();
01275 collectOuterTECSeedRings();
01276 } else if (structure_==P5) {
01277 collectOuterTOBSeedRings();
01278 collectOuterTECSeedRings();
01279 }
01280
01281
01282
01283 LogDebug("RoadSearch") << "collected " << outerSeedRings_.size() << " outer seed rings";
01284 }
01285
01286 void RoadMaker::collectOuterTIBSeedRings() {
01287
01288
01289 unsigned int counter = 0, layer_min=0, layer_max=0, fw_bw_min=0, fw_bw_max=0, ext_int_min=0, ext_int_max=0, detector_min=0, detector_max=0;
01290 if(structure_==TIFTIB) {
01291 layer_min = 3;
01292 layer_max = 5;
01293 fw_bw_min = 1;
01294 fw_bw_max = 3;
01295 ext_int_min = 1;
01296 ext_int_max = 3;
01297 detector_min = 1;
01298 detector_max = 4;
01299 }
01300
01301 for ( unsigned int layer = layer_min; layer < layer_max; ++layer ) {
01302 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01303 for ( unsigned int ext_int = ext_int_min; ext_int < ext_int_max; ++ext_int ) {
01304 for ( unsigned int detector = detector_min; detector < detector_max; ++detector ) {
01305 const Ring* temp_ring = rings_->getTIBRing(layer,fw_bw,ext_int,detector);
01306 outerSeedRings_.push_back(temp_ring);
01307 ++counter;
01308 LogDebug("RoadSearch") << "collected TIB outer seed ring with index: " << temp_ring->getindex();
01309 }
01310 }
01311 }
01312 }
01313
01314 LogDebug("RoadSearch") << "collected " << counter << " TIB outer seed rings";
01315
01316 }
01317
01318 void RoadMaker::collectOuterTOBSeedRings() {
01319
01320
01321 unsigned int counter = 0, layer_min=0, layer_max=0, rod_fw_bw_min=0, rod_fw_bw_max=0, detector_min=0, detector_max=0;
01322 if(structure_==FullDetector) {
01323 layer_min = 5;
01324 layer_max = 7;
01325 rod_fw_bw_min = 1;
01326 rod_fw_bw_max = 3;
01327 detector_min = 1;
01328 detector_max = 7;
01329 } else if(structure_==FullDetectorII) {
01330 layer_min = 1;
01331 layer_max = 2;
01332 rod_fw_bw_min = 1;
01333 rod_fw_bw_max = 3;
01334 detector_min = 1;
01335 detector_max = 7;
01336 } else if (structure_==MTCC) {
01337 layer_min = 1;
01338 layer_max = 3;
01339 rod_fw_bw_min = 2;
01340 rod_fw_bw_max = 3;
01341 detector_min = 1;
01342 detector_max = 7;
01343 } else if (structure_==TIF) {
01344 layer_min = 5;
01345 layer_max = 7;
01346 rod_fw_bw_min = 1;
01347 rod_fw_bw_max = 3;
01348 detector_min = 1;
01349 detector_max = 7;
01350 } else if (structure_==TIFTOB) {
01351 layer_min = 5;
01352 layer_max = 7;
01353 rod_fw_bw_min = 1;
01354 rod_fw_bw_max = 3;
01355 detector_min = 1;
01356 detector_max = 7;
01357 } else if (structure_==TIFTIBTOB) {
01358 layer_min = 5;
01359 layer_max = 7;
01360 rod_fw_bw_min = 1;
01361 rod_fw_bw_max = 3;
01362 detector_min = 1;
01363 detector_max = 7;
01364 } else if (structure_==TIFTOBTEC) {
01365 layer_min = 5;
01366 layer_max = 7;
01367 rod_fw_bw_min = 1;
01368 rod_fw_bw_max = 3;
01369 detector_min = 1;
01370 detector_max = 7;
01371 } else if (structure_==P5) {
01372 layer_min = 5;
01373 layer_max = 7;
01374 rod_fw_bw_min = 1;
01375 rod_fw_bw_max = 3;
01376 detector_min = 1;
01377 detector_max = 7;
01378 }
01379
01380 for ( unsigned int layer = layer_min; layer < layer_max; ++layer ) {
01381 for ( unsigned int rod_fw_bw = rod_fw_bw_min; rod_fw_bw < rod_fw_bw_max; ++rod_fw_bw ) {
01382 for ( unsigned int detector = detector_min; detector < detector_max; ++detector ) {
01383 const Ring* temp_ring = rings_->getTOBRing(layer,rod_fw_bw,detector);
01384 outerSeedRings_.push_back(temp_ring);
01385 ++counter;
01386 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01387 }
01388 }
01389 }
01390
01391 if(structure_==FullDetector) {
01392
01393 const Ring* temp_ring = rings_->getTOBRing(1,1,6);
01394 outerSeedRings_.push_back(temp_ring);
01395 ++counter;
01396 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01397
01398 temp_ring = rings_->getTOBRing(1,2,6);
01399 outerSeedRings_.push_back(temp_ring);
01400 ++counter;
01401 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01402
01403 temp_ring = rings_->getTOBRing(2,1,6);
01404 outerSeedRings_.push_back(temp_ring);
01405 ++counter;
01406 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01407
01408 temp_ring = rings_->getTOBRing(2,2,6);
01409 outerSeedRings_.push_back(temp_ring);
01410 ++counter;
01411 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01412
01413 temp_ring = rings_->getTOBRing(3,1,6);
01414 outerSeedRings_.push_back(temp_ring);
01415 ++counter;
01416 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01417
01418 temp_ring = rings_->getTOBRing(3,2,6);
01419 outerSeedRings_.push_back(temp_ring);
01420 ++counter;
01421 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01422
01423 temp_ring = rings_->getTOBRing(4,1,6);
01424 outerSeedRings_.push_back(temp_ring);
01425 ++counter;
01426 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01427
01428 temp_ring = rings_->getTOBRing(4,2,6);
01429 outerSeedRings_.push_back(temp_ring);
01430 ++counter;
01431 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01432
01433 }
01434
01435 LogDebug("RoadSearch") << "collected " << counter << " TOB outer seed rings";
01436
01437 }
01438
01439 void RoadMaker::collectOuterTECSeedRings() {
01440
01441
01442 unsigned int counter = 0;
01443
01444 if(structure_==FullDetector) {
01445
01446 unsigned int fw_bw_min = 1;
01447 unsigned int fw_bw_max = 3;
01448 unsigned int wheel_min = 1;
01449 unsigned int wheel_max = 8;
01450
01451 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01452 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
01453 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,6);
01454 outerSeedRings_.push_back(temp_ring);
01455 ++counter;
01456 temp_ring = rings_->getTECRing(fw_bw,wheel,7);
01457 outerSeedRings_.push_back(temp_ring);
01458 ++counter;
01459 LogDebug("RoadSearch") << "collected TEC outer seed ring with index: " << temp_ring->getindex();
01460 }
01461 }
01462
01463
01464 fw_bw_min = 1;
01465 fw_bw_max = 3;
01466 wheel_min = 1;
01467 unsigned int wheel_start = 8;
01468 wheel_max = 10;
01469 unsigned int second_ring_min[10];
01470 unsigned int second_ring_max[10];
01471
01472
01473 second_ring_min[1] = 1;
01474 second_ring_max[1] = 8;
01475
01476 second_ring_min[2] = 1;
01477 second_ring_max[2] = 8;
01478
01479 second_ring_min[3] = 1;
01480 second_ring_max[3] = 8;
01481
01482 second_ring_min[4] = 2;
01483 second_ring_max[4] = 8;
01484
01485 second_ring_min[5] = 2;
01486 second_ring_max[5] = 8;
01487
01488 second_ring_min[6] = 2;
01489 second_ring_max[6] = 8;
01490
01491 second_ring_min[7] = 3;
01492 second_ring_max[7] = 8;
01493
01494 second_ring_min[8] = 3;
01495 second_ring_max[8] = 8;
01496
01497 second_ring_min[9] = 4;
01498 second_ring_max[9] = 8;
01499
01500 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01501 for ( unsigned int wheel = wheel_start; wheel < wheel_max; ++wheel ) {
01502 for ( unsigned int second_ring = second_ring_min[wheel]; second_ring < second_ring_max[wheel]; ++second_ring ) {
01503 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,second_ring);
01504 outerSeedRings_.push_back(temp_ring);
01505 ++counter;
01506 LogDebug("RoadSearch") << "collected TEC outer seed ring with index: " << temp_ring->getindex();
01507 }
01508 }
01509 }
01510 } else if(structure_==FullDetectorII) {
01511
01512 unsigned int fw_bw_min = 1;
01513 unsigned int fw_bw_max = 3;
01514 unsigned int wheel_min = 1;
01515 unsigned int wheel_max = 8;
01516
01517 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01518 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
01519 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,5);
01520 outerSeedRings_.push_back(temp_ring);
01521 ++counter;
01522 temp_ring = rings_->getTECRing(fw_bw,wheel,4);
01523 outerSeedRings_.push_back(temp_ring);
01524 ++counter;
01525 LogDebug("RoadSearch") << "collected TEC outer seed ring with index: " << temp_ring->getindex();
01526 }
01527 }
01528
01529
01530 fw_bw_min = 1;
01531 fw_bw_max = 3;
01532 wheel_min = 1;
01533 unsigned int wheel_start = 8;
01534 wheel_max = 10;
01535 unsigned int second_ring_min[10];
01536 unsigned int second_ring_max[10];
01537
01538
01539 second_ring_min[1] = 1;
01540 second_ring_max[1] = 8;
01541
01542 second_ring_min[2] = 1;
01543 second_ring_max[2] = 8;
01544
01545 second_ring_min[3] = 1;
01546 second_ring_max[3] = 8;
01547
01548 second_ring_min[4] = 2;
01549 second_ring_max[4] = 8;
01550
01551 second_ring_min[5] = 2;
01552 second_ring_max[5] = 8;
01553
01554 second_ring_min[6] = 2;
01555 second_ring_max[6] = 8;
01556
01557 second_ring_min[7] = 3;
01558 second_ring_max[7] = 8;
01559
01560 second_ring_min[8] = 3;
01561 second_ring_max[8] = 6;
01562
01563 second_ring_min[9] = 4;
01564 second_ring_max[9] = 6;
01565
01566 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01567 for ( unsigned int wheel = wheel_start; wheel < wheel_max; ++wheel ) {
01568 for ( unsigned int second_ring = second_ring_min[wheel]; second_ring < second_ring_max[wheel]; ++second_ring ) {
01569 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,second_ring);
01570 outerSeedRings_.push_back(temp_ring);
01571 ++counter;
01572 LogDebug("RoadSearch") << "collected TEC outer seed ring with index: " << temp_ring->getindex();
01573 }
01574 }
01575 }
01576 } else if (structure_==TIFTOBTEC || structure_==TIF) {
01577 unsigned int fw_bw_min = 2;
01578 unsigned int fw_bw_max = 3;
01579 unsigned int wheel_min = 1;
01580 unsigned int wheel_max = 10;
01581 unsigned int ring_min = 6;
01582 unsigned int ring_max = 8;
01583
01584 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01585 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
01586 for ( unsigned int ring = ring_min; ring < ring_max; ++ring ) {
01587 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,ring);
01588 outerSeedRings_.push_back(temp_ring);
01589 ++counter;
01590 LogDebug("RoadSearch") << "collected TEC outer seed ring with index: " << temp_ring->getindex();
01591 }
01592 }
01593 }
01594
01595 } else if (structure_==P5) {
01596 unsigned int fw_bw_min = 1;
01597 unsigned int fw_bw_max = 3;
01598 unsigned int wheel_min = 1;
01599 unsigned int wheel_max = 10;
01600 unsigned int ring_min = 6;
01601 unsigned int ring_max = 8;
01602
01603 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01604 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
01605 for ( unsigned int ring = ring_min; ring < ring_max; ++ring ) {
01606 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,ring);
01607 outerSeedRings_.push_back(temp_ring);
01608 ++counter;
01609 LogDebug("RoadSearch") << "collected TEC outer seed ring with index: " << temp_ring->getindex();
01610 }
01611 }
01612 }
01613
01614 }
01615
01616 LogDebug("RoadSearch") << "collected " << counter << " TEC outer seed rings";
01617
01618 }
01619
01620 void RoadMaker::collectOuterSeedRings1() {
01621
01622 if(structure_==FullDetector) {
01623 collectOuterTOBSeedRings1();
01624 collectOuterTECSeedRings1();
01625 } else if(structure_==FullDetectorII) {
01626 collectOuterTOBSeedRings1();
01627 collectOuterTECSeedRings1();
01628 } else if (structure_==MTCC) {
01629 collectOuterTOBSeedRings1();
01630 } else if (structure_==TIF) {
01631 collectOuterTOBSeedRings1();
01632 collectOuterTECSeedRings1();
01633 } else if (structure_==TIFTOB) {
01634 collectOuterTOBSeedRings1();
01635 } else if (structure_==TIFTIB) {
01636 collectOuterTIBSeedRings1();
01637 } else if (structure_==TIFTIBTOB) {
01638 collectOuterTOBSeedRings1();
01639 } else if (structure_==TIFTOBTEC) {
01640 collectOuterTOBSeedRings1();
01641 collectOuterTECSeedRings1();
01642
01643 }
01644
01645 LogDebug("RoadSearch") << "collected " << outerSeedRings1_.size() << " outer seed rings";
01646 }
01647
01648 void RoadMaker::collectOuterTIBSeedRings1() {
01649
01650
01651 unsigned int counter = 0, layer_min=0, layer_max=0, fw_bw_min=0, fw_bw_max=0, ext_int_min=0, ext_int_max=0, detector_min=0, detector_max=0;
01652 if(structure_==TIFTIB) {
01653 layer_min = 4;
01654 layer_max = 5;
01655 fw_bw_min = 1;
01656 fw_bw_max = 3;
01657 ext_int_min = 1;
01658 ext_int_max = 3;
01659 detector_min = 1;
01660 detector_max = 4;
01661 }
01662
01663 for ( unsigned int layer = layer_min; layer < layer_max; ++layer ) {
01664 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01665 for ( unsigned int ext_int = ext_int_min; ext_int < ext_int_max; ++ext_int ) {
01666 for ( unsigned int detector = detector_min; detector < detector_max; ++detector ) {
01667 const Ring* temp_ring = rings_->getTIBRing(layer,fw_bw,ext_int,detector);
01668 outerSeedRings1_.push_back(temp_ring);
01669 ++counter;
01670 LogDebug("RoadSearch") << "collected TIB outer seed ring with index: " << temp_ring->getindex();
01671 }
01672 }
01673 }
01674 }
01675
01676 LogDebug("RoadSearch") << "collected " << counter << " TIB outer seed rings";
01677
01678 }
01679
01680 void RoadMaker::collectOuterTOBSeedRings1() {
01681
01682
01683 unsigned int counter = 0, layer_min=0, layer_max=0, rod_fw_bw_min=0, rod_fw_bw_max=0, detector_min=0, detector_max=0;
01684 if(structure_==FullDetector) {
01685 layer_min = 6;
01686 layer_max = 7;
01687 rod_fw_bw_min = 1;
01688 rod_fw_bw_max = 3;
01689 detector_min = 1;
01690 detector_max = 7;
01691 } else if(structure_==FullDetectorII) {
01692 layer_min = 2;
01693 layer_max = 3;
01694 rod_fw_bw_min = 1;
01695 rod_fw_bw_max = 3;
01696 detector_min = 1;
01697 detector_max = 7;
01698 } else if (structure_==MTCC) {
01699 layer_min = 1;
01700 layer_max = 3;
01701 rod_fw_bw_min = 2;
01702 rod_fw_bw_max = 3;
01703 detector_min = 1;
01704 detector_max = 7;
01705 } else if (structure_==TIF) {
01706 layer_min = 6;
01707 layer_max = 7;
01708 rod_fw_bw_min = 1;
01709 rod_fw_bw_max = 3;
01710 detector_min = 1;
01711 detector_max = 7;
01712 } else if (structure_==TIFTOB) {
01713 layer_min = 5;
01714 layer_max = 7;
01715 rod_fw_bw_min = 1;
01716 rod_fw_bw_max = 3;
01717 detector_min = 1;
01718 detector_max = 7;
01719 } else if (structure_==TIFTIBTOB) {
01720 layer_min = 6;
01721 layer_max = 7;
01722 rod_fw_bw_min = 1;
01723 rod_fw_bw_max = 3;
01724 detector_min = 1;
01725 detector_max = 7;
01726 } else if (structure_==TIFTOBTEC) {
01727 layer_min = 6;
01728 layer_max = 7;
01729 rod_fw_bw_min = 1;
01730 rod_fw_bw_max = 3;
01731 detector_min = 1;
01732 detector_max = 7;
01733 }
01734
01735
01736 for ( unsigned int layer = layer_min; layer < layer_max; ++layer ) {
01737 for ( unsigned int rod_fw_bw = rod_fw_bw_min; rod_fw_bw < rod_fw_bw_max; ++rod_fw_bw ) {
01738 for ( unsigned int detector = detector_min; detector < detector_max; ++detector ) {
01739 const Ring* temp_ring = rings_->getTOBRing(layer,rod_fw_bw,detector);
01740 outerSeedRings1_.push_back(temp_ring);
01741 ++counter;
01742 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01743 }
01744 }
01745 }
01746
01747 if(structure_==FullDetector) {
01748
01749 const Ring* temp_ring = rings_->getTOBRing(1,1,6);
01750 outerSeedRings1_.push_back(temp_ring);
01751 ++counter;
01752 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01753
01754 temp_ring = rings_->getTOBRing(1,2,6);
01755 outerSeedRings1_.push_back(temp_ring);
01756 ++counter;
01757 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01758
01759 temp_ring = rings_->getTOBRing(2,1,6);
01760 outerSeedRings1_.push_back(temp_ring);
01761 ++counter;
01762 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01763
01764 temp_ring = rings_->getTOBRing(2,2,6);
01765 outerSeedRings1_.push_back(temp_ring);
01766 ++counter;
01767 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01768
01769 temp_ring = rings_->getTOBRing(3,1,6);
01770 outerSeedRings1_.push_back(temp_ring);
01771 ++counter;
01772 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01773
01774 temp_ring = rings_->getTOBRing(3,2,6);
01775 outerSeedRings1_.push_back(temp_ring);
01776 ++counter;
01777 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01778
01779 temp_ring = rings_->getTOBRing(4,1,6);
01780 outerSeedRings1_.push_back(temp_ring);
01781 ++counter;
01782 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01783
01784 temp_ring = rings_->getTOBRing(4,2,6);
01785 outerSeedRings1_.push_back(temp_ring);
01786 ++counter;
01787 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01788
01789 temp_ring = rings_->getTOBRing(5,1,6);
01790 outerSeedRings1_.push_back(temp_ring);
01791 ++counter;
01792 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01793
01794 temp_ring = rings_->getTOBRing(5,2,6);
01795 outerSeedRings1_.push_back(temp_ring);
01796 ++counter;
01797 LogDebug("RoadSearch") << "collected TOB outer seed ring with index: " << temp_ring->getindex();
01798
01799 }
01800
01801 LogDebug("RoadSearch") << "collected " << counter << " TOB outer seed rings";
01802
01803 }
01804
01805 void RoadMaker::collectOuterTECSeedRings1() {
01806
01807
01808 unsigned int counter = 0;
01809
01810 if(structure_==FullDetector) {
01811
01812 unsigned int fw_bw_min = 1;
01813 unsigned int fw_bw_max = 3;
01814 unsigned int wheel_min = 1;
01815 unsigned int wheel_max = 9;
01816
01817 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01818 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
01819 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,7);
01820 outerSeedRings1_.push_back(temp_ring);
01821 ++counter;
01822 LogDebug("RoadSearch") << "collected TEC outer seed ring with index: " << temp_ring->getindex();
01823 }
01824 }
01825
01826
01827 fw_bw_min = 1;
01828 fw_bw_max = 3;
01829 wheel_min = 1;
01830 unsigned int wheel_start = 9;
01831 wheel_max = 10;
01832 unsigned int second_ring_min[10];
01833 unsigned int second_ring_max[10];
01834
01835
01836 second_ring_min[1] = 1;
01837 second_ring_max[1] = 8;
01838
01839 second_ring_min[2] = 1;
01840 second_ring_max[2] = 8;
01841
01842 second_ring_min[3] = 1;
01843 second_ring_max[3] = 8;
01844
01845 second_ring_min[4] = 2;
01846 second_ring_max[4] = 8;
01847
01848 second_ring_min[5] = 2;
01849 second_ring_max[5] = 8;
01850
01851 second_ring_min[6] = 2;
01852 second_ring_max[6] = 8;
01853
01854 second_ring_min[7] = 3;
01855 second_ring_max[7] = 8;
01856
01857 second_ring_min[8] = 3;
01858 second_ring_max[8] = 8;
01859
01860 second_ring_min[9] = 4;
01861 second_ring_max[9] = 8;
01862
01863 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01864 for ( unsigned int wheel = wheel_start; wheel < wheel_max; ++wheel ) {
01865 for ( unsigned int second_ring = second_ring_min[wheel]; second_ring < second_ring_max[wheel]; ++second_ring ) {
01866 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,second_ring);
01867 outerSeedRings1_.push_back(temp_ring);
01868 ++counter;
01869 LogDebug("RoadSearch") << "collected TEC outer seed ring with index: " << temp_ring->getindex();
01870 }
01871 }
01872 }
01873 } else if(structure_==FullDetectorII) {
01874
01875 unsigned int fw_bw_min = 1;
01876 unsigned int fw_bw_max = 3;
01877 unsigned int wheel_min = 1;
01878 unsigned int wheel_max = 9;
01879
01880 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01881 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
01882 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,5);
01883 outerSeedRings1_.push_back(temp_ring);
01884 ++counter;
01885 LogDebug("RoadSearch") << "collected TEC outer seed ring with index: " << temp_ring->getindex();
01886 }
01887 }
01888
01889
01890 fw_bw_min = 1;
01891 fw_bw_max = 3;
01892 wheel_min = 1;
01893 unsigned int wheel_start = 9;
01894 wheel_max = 10;
01895 unsigned int second_ring_min[10];
01896 unsigned int second_ring_max[10];
01897
01898
01899 second_ring_min[1] = 1;
01900 second_ring_max[1] = 8;
01901
01902 second_ring_min[2] = 1;
01903 second_ring_max[2] = 8;
01904
01905 second_ring_min[3] = 1;
01906 second_ring_max[3] = 8;
01907
01908 second_ring_min[4] = 2;
01909 second_ring_max[4] = 8;
01910
01911 second_ring_min[5] = 2;
01912 second_ring_max[5] = 8;
01913
01914 second_ring_min[6] = 2;
01915 second_ring_max[6] = 8;
01916
01917 second_ring_min[7] = 3;
01918 second_ring_max[7] = 8;
01919
01920 second_ring_min[8] = 3;
01921 second_ring_max[8] = 8;
01922
01923 second_ring_min[9] = 4;
01924 second_ring_max[9] = 6;
01925
01926 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01927 for ( unsigned int wheel = wheel_start; wheel < wheel_max; ++wheel ) {
01928 for ( unsigned int second_ring = second_ring_min[wheel]; second_ring < second_ring_max[wheel]; ++second_ring ) {
01929 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,second_ring);
01930 outerSeedRings1_.push_back(temp_ring);
01931 ++counter;
01932 LogDebug("RoadSearch") << "collected TEC outer seed ring with index: " << temp_ring->getindex();
01933 }
01934 }
01935 }
01936 } else if (structure_==TIFTOBTEC || structure_==TIF) {
01937 unsigned int fw_bw_min = 2;
01938 unsigned int fw_bw_max = 3;
01939 unsigned int wheel_min = 1;
01940 unsigned int wheel_max = 10;
01941 unsigned int ring_min = 7;
01942 unsigned int ring_max = 8;
01943
01944 for ( unsigned int fw_bw = fw_bw_min; fw_bw < fw_bw_max; ++fw_bw ) {
01945 for ( unsigned int wheel = wheel_min; wheel < wheel_max; ++wheel ) {
01946 for ( unsigned int ring = ring_min; ring < ring_max; ++ring ) {
01947 const Ring* temp_ring = rings_->getTECRing(fw_bw,wheel,ring);
01948 outerSeedRings1_.push_back(temp_ring);
01949 ++counter;
01950 LogDebug("RoadSearch") << "collected TEC outer seed ring with index: " << temp_ring->getindex();
01951 }
01952 }
01953 }
01954
01955 }
01956 LogDebug("RoadSearch") << "collected " << counter << " TEC outer seed rings";
01957
01958 }
01959
01960 bool RoadMaker::RingsOnSameLayer(const Ring *ring1, const Ring* ring2) {
01961
01962
01963
01964
01965
01966 bool result = false;
01967
01968
01969 const DetId ring1DetId = ring1->getFirst();
01970 const DetId ring2DetId = ring2->getFirst();
01971
01972
01973 if ( (unsigned int)ring1DetId.subdetId() == StripSubdetector::TIB &&
01974 (unsigned int)ring2DetId.subdetId() == StripSubdetector::TIB ) {
01975
01976 TIBDetId ring1DetIdTIB(ring1DetId.rawId());
01977 TIBDetId ring2DetIdTIB(ring2DetId.rawId());
01978
01979 if ( ring1DetIdTIB.layer() == ring2DetIdTIB.layer() ) {
01980 result = true;
01981 }
01982 } else if ( (unsigned int)ring1DetId.subdetId() == StripSubdetector::TOB &&
01983 (unsigned int)ring2DetId.subdetId() == StripSubdetector::TOB ) {
01984
01985 TOBDetId ring1DetIdTOB(ring1DetId.rawId());
01986 TOBDetId ring2DetIdTOB(ring2DetId.rawId());
01987
01988 if ( ring1DetIdTOB.layer() == ring2DetIdTOB.layer() ) {
01989 result = true;
01990 }
01991 } else if ( (unsigned int)ring1DetId.subdetId() == StripSubdetector::TID &&
01992 (unsigned int)ring2DetId.subdetId() == StripSubdetector::TID) {
01993
01994 TIDDetId ring1DetIdTID(ring1DetId.rawId());
01995 TIDDetId ring2DetIdTID(ring2DetId.rawId());
01996
01997 if ( ring1DetIdTID.wheel() == ring2DetIdTID.wheel() ) {
01998 result = true;
01999 }
02000 } else if ( (unsigned int)ring1DetId.subdetId() == StripSubdetector::TEC &&
02001 (unsigned int)ring2DetId.subdetId() == StripSubdetector::TEC ) {
02002
02003 TECDetId ring1DetIdTEC(ring1DetId.rawId());
02004 TECDetId ring2DetIdTEC(ring2DetId.rawId());
02005
02006 if ( ring1DetIdTEC.wheel() == ring2DetIdTEC.wheel() ) {
02007 result = true;
02008 }
02009 } else if ( (unsigned int)ring1DetId.subdetId() == PixelSubdetector::PixelBarrel &&
02010 (unsigned int)ring2DetId.subdetId() == PixelSubdetector::PixelBarrel) {
02011
02012 PXBDetId ring1DetIdPXB(ring1DetId.rawId());
02013 PXBDetId ring2DetIdPXB(ring2DetId.rawId());
02014
02015 if ( ring1DetIdPXB.layer() == ring2DetIdPXB.layer() ) {
02016 result = true;
02017 }
02018 } else if ( (unsigned int)ring1DetId.subdetId() == PixelSubdetector::PixelEndcap &&
02019 (unsigned int)ring2DetId.subdetId() == PixelSubdetector::PixelEndcap) {
02020
02021 PXFDetId ring1DetIdPXF(ring1DetId.rawId());
02022 PXFDetId ring2DetIdPXF(ring2DetId.rawId());
02023
02024 if ( ring1DetIdPXF.disk() == ring2DetIdPXF.disk() ) {
02025 result = true;
02026 }
02027 }
02028
02029 return result;
02030 }
02031
02032 bool RoadMaker::RingInBarrel(const Ring *ring) {
02033
02034
02035
02036
02037
02038 bool result = false;
02039
02040
02041 const DetId ringDetId = ring->getFirst();
02042
02043
02044 if ( (unsigned int)ringDetId.subdetId() == StripSubdetector::TIB ) {
02045 result = true;
02046 } else if ( (unsigned int)ringDetId.subdetId() == StripSubdetector::TOB ) {
02047 result = true;
02048 }
02049
02050 return result;
02051 }
02052
02053 bool RoadMaker::RingsOnSameLayer(std::pair<const Ring*,const Ring*> seed1, std::pair<const Ring*,const Ring*> seed2) {
02054
02055
02056
02057
02058
02059 bool result = false;
02060
02061 result = RingsOnSameLayer(seed1.first,seed2.first) &&
02062 RingsOnSameLayer(seed1.second,seed2.second);
02063
02064 return result;
02065 }
02066
02067 std::vector<std::pair<double,double> > RoadMaker::LinesThroughRingAndBS(const Ring* ring ) {
02068
02069
02070
02071
02072
02073 std::vector<std::pair<double,double> > result;
02074
02075 double z = 0;
02076 double r = 0;;
02077
02078 for (int ic1 = 0; ic1<4; ++ic1) {
02079 switch (ic1) {
02080 case 0: z = ring->getzmin(); r = ring->getrmin(); break;
02081 case 1: z = ring->getzmin(); r = ring->getrmax(); break;
02082 case 2: z = ring->getzmax(); r = ring->getrmax(); break;
02083 case 3: z = ring->getzmax(); r = ring->getrmin(); break;
02084 }
02085 for (int ib = 0; ib<2; ++ib) {
02086 double zb = zBS_*(2*ib-1);
02087 result.push_back(std::pair<double,double>((z-zb)/r,zb));
02088 }
02089 }
02090
02091 return result;
02092 }
02093
02094 std::vector<std::pair<double,double> > RoadMaker::LinesThroughRings(const Ring *ring1,
02095 const Ring *ring2) {
02096
02097
02098
02099
02100
02101 std::vector<std::pair<double,double> > result;
02102
02103 double z1 = 0;
02104 double r1 = 0;;
02105 double z2 = 0;
02106 double r2 = 0;
02107
02108 for (int ic1 = 0; ic1<4; ++ic1) {
02109 switch (ic1) {
02110 case 0: z1 = ring1->getzmin(); r1 = ring1->getrmin(); break;
02111 case 1: z1 = ring1->getzmin(); r1 = ring1->getrmax(); break;
02112 case 2: z1 = ring1->getzmax(); r1 = ring1->getrmax(); break;
02113 case 3: z1 = ring1->getzmax(); r1 = ring1->getrmin(); break;
02114 }
02115 for (int ic2 = 0; ic2<4; ++ic2) {
02116 switch (ic2) {
02117 case 0: z2 = ring2->getzmin(); r2 = ring2->getrmin(); break;
02118 case 1: z2 = ring2->getzmin(); r2 = ring2->getrmax(); break;
02119 case 2: z2 = ring2->getzmax(); r2 = ring2->getrmax(); break;
02120 case 3: z2 = ring2->getzmax(); r2 = ring2->getrmin(); break;
02121 }
02122 result.push_back(std::pair<double,double>((z2 - z1)/(r2 - r1),(r2*z1 - r1*z2)/(r2 - r1)));
02123 }
02124 }
02125
02126 return result;
02127 }
02128
02129 bool RoadMaker::CompatibleWithLines(std::vector<std::pair<double,double> > lines,
02130 const Ring* ring) {
02131
02132
02133
02134
02135
02136 bool result = true;
02137
02138
02139 double zmin = 999;
02140 double zmax = -zmin;
02141 for (int m=0; m<2; ++m) {
02142 double r = m==0 ? ring->getrmin() : ring->getrmax();
02143 for (std::vector<std::pair<double,double> >::iterator line = lines.begin();
02144 line != lines.end();
02145 ++line ) {
02146 double z = line->first*r + line->second;
02147 if (zmin>z) zmin = z;
02148 if (zmax<z) zmax = z;
02149 }
02150 }
02151 if (ring->getzmax()<zmin || ring->getzmin()>zmax) {
02152 result = false;
02153 }
02154
02155 return result;
02156 }
02157
02158 Roads::RoadSet RoadMaker::RingsCompatibleWithSeed(Roads::RoadSeed seed) {
02159
02160
02161
02162
02163
02164 std::vector<const Ring*> tempRings;
02165
02166
02167 std::vector<std::vector<std::pair<double,double> > > lines;
02168
02169 for ( std::vector<const Ring*>::iterator innerRing = seed.first.begin();
02170 innerRing != seed.first.end();
02171 ++innerRing) {
02172
02173 lines.push_back(LinesThroughRingAndBS(*innerRing));
02174
02175 for ( std::vector<const Ring*>::iterator outerRing = seed.second.begin();
02176 outerRing != seed.second.end();
02177 ++outerRing) {
02178
02179 lines.push_back(LinesThroughRings((*innerRing),(*outerRing)));
02180 }
02181 }
02182
02183 for ( std::vector<const Ring*>::iterator outerRing = seed.second.begin();
02184 outerRing != seed.second.end();
02185 ++outerRing) {
02186
02187 lines.push_back(LinesThroughRingAndBS(*outerRing));
02188 }
02189
02190 for ( Rings::const_iterator ring = rings_->begin();
02191 ring != rings_->end();
02192 ++ring ) {
02193 bool compatible = true;
02194 for ( std::vector<std::vector<std::pair<double,double> > >::iterator line = lines.begin();
02195 line != lines.end();
02196 ++line ) {
02197 if ( !CompatibleWithLines(*line, &(ring->second))) {
02198 compatible = false;
02199 }
02200 }
02201 if ( compatible ) {
02202 tempRings.push_back(&(ring->second));
02203 }
02204 }
02205
02206
02207
02208 return SortRingsIntoLayers(tempRings);
02209 }
02210
02211
02212 Roads::RoadSeed RoadMaker::CloneSeed(Roads::RoadSeed seed) {
02213
02214
02215
02216
02217 Roads::RoadSeed result;
02218
02219 for ( std::vector<const Ring*>::iterator ring = seed.first.begin();
02220 ring != seed.first.end();
02221 ++ring ) {
02222 result.first.push_back((*ring));
02223 }
02224
02225 for ( std::vector<const Ring*>::iterator ring = seed.second.begin();
02226 ring != seed.second.end();
02227 ++ring ) {
02228 result.second.push_back((*ring));
02229 }
02230
02231 return result;
02232 }
02233
02234 bool RoadMaker::AddRoad(Roads::RoadSeed seed,
02235 Roads::RoadSet set) {
02236
02237
02238
02239
02240
02241
02242
02243
02244
02245 bool result = true;
02246
02247 for ( Roads::iterator existingRoad = roads_->begin();
02248 existingRoad != roads_->end();
02249 ++existingRoad ) {
02250
02251 Roads::RoadSeed existingSeed = existingRoad->first;
02252
02253
02254 unsigned int includedInner = 0;
02255 unsigned int includedOuter = 0;
02256 for ( std::vector<const Ring*>::iterator existingInnerRing = existingSeed.first.begin();
02257 existingInnerRing != existingSeed.first.end();
02258 ++existingInnerRing ) {
02259 bool ringIncluded = false;
02260 for ( std::vector<const Ring*>::iterator innerRing = seed.first.begin();
02261 innerRing != seed.first.end();
02262 ++innerRing ) {
02263 if ( (*existingInnerRing) == (*innerRing) ) {
02264 ringIncluded = true;
02265 }
02266 }
02267 if ( ringIncluded ) {
02268 ++includedInner;
02269 }
02270 }
02271 for ( std::vector<const Ring*>::iterator existingOuterRing = existingSeed.second.begin();
02272 existingOuterRing != existingSeed.second.end();
02273 ++existingOuterRing ) {
02274 bool ringIncluded = false;
02275 for ( std::vector<const Ring*>::iterator outerRing = seed.second.begin();
02276 outerRing != seed.second.end();
02277 ++outerRing ) {
02278 if ( (*existingOuterRing) == (*outerRing) ) {
02279 ringIncluded = true;
02280 }
02281 }
02282 if ( ringIncluded ) {
02283 ++includedOuter;
02284 }
02285 }
02286
02287 if ( includedInner == existingSeed.first.size() &&
02288 includedOuter == existingSeed.second.size() ) {
02289
02290 roads_->erase(existingRoad);
02291 }
02292 }
02293
02294
02295 std::sort(seed.first.begin(),seed.first.end(),SortRingsByZR());
02296 std::sort(seed.second.begin(),seed.second.end(),SortRingsByZR());
02297
02298 roads_->insert(seed,set);
02299 return result;
02300 }
02301
02302 std::pair<Roads::RoadSeed, Roads::RoadSet> RoadMaker::AddInnerSeedRing(std::pair<Roads::RoadSeed, Roads::RoadSet> input) {
02303
02304
02305
02306 for ( std::vector<const Ring*>::iterator innerSeedRing = innerSeedRings_.begin();
02307 innerSeedRing != innerSeedRings_.end();
02308 ++innerSeedRing ) {
02309 for ( Roads::RoadSet::iterator roadSetVector = input.second.begin();
02310 roadSetVector != input.second.end();
02311 ++roadSetVector ) {
02312 for ( std::vector<const Ring*>::iterator roadSetRing = roadSetVector->begin();
02313 roadSetRing != roadSetVector->end();
02314 ++roadSetRing) {
02315
02316 if ( (*innerSeedRing) == (*roadSetRing) ) {
02317
02318 bool onSameLayer = false;
02319 for ( std::vector<const Ring*>::iterator roadSeedRing = input.first.first.begin();
02320 roadSeedRing != input.first.first.end();
02321 ++roadSeedRing ) {
02322 if ( RingsOnSameLayer((*roadSeedRing),(*innerSeedRing)) ) {
02323 onSameLayer = true;
02324 }
02325 }
02326 if ( !onSameLayer ) {
02327
02328 Roads::RoadSeed seed = CloneSeed(input.first);
02329 seed.first.push_back((*innerSeedRing));
02330
02331 Roads::RoadSet set = RingsCompatibleWithSeed(seed);
02332
02333 if ( SameRoadSet(input.second,set) ) {
02334
02335 AddRoad(seed,set);
02336
02337 std::pair<Roads::RoadSeed, Roads::RoadSet> result(seed,set);
02338
02339 return result;
02340 }
02341 }
02342 }
02343 }
02344 }
02345 }
02346
02347
02348 return input;
02349
02350 }
02351
02352 std::pair<Roads::RoadSeed, Roads::RoadSet> RoadMaker::AddOuterSeedRing(std::pair<Roads::RoadSeed, Roads::RoadSet> input) {
02353
02354
02355
02356 for ( std::vector<const Ring*>::iterator outerSeedRing = outerSeedRings_.begin();
02357 outerSeedRing != outerSeedRings_.end();
02358 ++outerSeedRing ) {
02359 for ( Roads::RoadSet::iterator roadSetVector = input.second.begin();
02360 roadSetVector != input.second.end();
02361 ++roadSetVector ) {
02362 for ( std::vector<const Ring*>::iterator roadSetRing = roadSetVector->begin();
02363 roadSetRing != roadSetVector->end();
02364 ++roadSetRing) {
02365
02366 if ( (*outerSeedRing) == (*roadSetRing) ) {
02367
02368 bool onSameLayer = false;
02369 for ( std::vector<const Ring*>::iterator roadSeedRing = input.first.second.begin();
02370 roadSeedRing != input.first.second.end();
02371 ++roadSeedRing ) {
02372 if ( RingsOnSameLayer((*roadSeedRing),(*outerSeedRing)) ) {
02373 onSameLayer = true;
02374 }
02375 }
02376 if ( !onSameLayer ) {
02377
02378 Roads::RoadSeed seed = CloneSeed(input.first);
02379 seed.second.push_back((*outerSeedRing));
02380
02381 Roads::RoadSet set = RingsCompatibleWithSeed(seed);
02382
02383 AddRoad(seed,set);
02384
02385 std::pair<Roads::RoadSeed, Roads::RoadSet> result(seed,set);
02386
02387 return result;
02388 }
02389 }
02390 }
02391 }
02392 }
02393
02394
02395 return input;
02396
02397 }
02398
02399 bool RoadMaker::SameRoadSet(Roads::RoadSet set1, Roads::RoadSet set2 ) {
02400
02401
02402
02403
02404
02405 unsigned int nRingsSet1 = 0;
02406 unsigned int nRingsSet2 = 0;
02407 for ( Roads::RoadSet::iterator vector1 = set1.begin();
02408 vector1 != set1.end();
02409 ++vector1 ) {
02410 nRingsSet1 += vector1->size();
02411 }
02412
02413 for ( Roads::RoadSet::iterator vector2 = set2.begin();
02414 vector2 != set2.end();
02415 ++vector2 ) {
02416 nRingsSet2 += vector2->size();
02417 }
02418
02419
02420 if ( nRingsSet1 != nRingsSet2 ) {
02421 return false;
02422 }
02423
02424 bool different = false;
02425 for ( Roads::RoadSet::iterator vector1 = set1.begin();
02426 vector1 != set1.end();
02427 ++vector1 ) {
02428 for ( std::vector<const Ring*>::iterator ring1 = vector1->begin();
02429 ring1 != vector1->end();
02430 ++ring1 ) {
02431 bool included = false;
02432 for ( Roads::RoadSet::iterator vector2 = set2.begin();
02433 vector2 != set2.end();
02434 ++vector2 ) {
02435 for ( std::vector<const Ring*>::iterator ring2 = vector2->begin();
02436 ring2 != vector2->end();
02437 ++ring2 ) {
02438 if ( (*ring1) == (*ring2) ) {
02439 included = true;
02440 }
02441 }
02442 }
02443 if ( !included ) {
02444 different = true;
02445 }
02446 }
02447 }
02448
02449 return !different;
02450 }
02451
02452 Roads::RoadSet RoadMaker::SortRingsIntoLayers(std::vector<const Ring*> input) {
02453
02454
02455
02456
02457
02458 Roads::RoadSet set;
02459
02460
02461 std::sort(input.begin(),input.end(),SortRingsByZR());
02462
02463 const Ring *reference = (*(input.begin()));
02464 std::vector<const Ring*> tmp;
02465 tmp.push_back(reference);
02466 for (std::vector<const Ring*>::iterator ring = ++input.begin();
02467 ring != input.end();
02468 ++ring ) {
02469 if ( RingsOnSameLayer(reference,(*ring)) ) {
02470 reference = (*ring);
02471 tmp.push_back(reference);
02472 } else {
02473 set.push_back(tmp);
02474 tmp.clear();
02475 reference = (*ring);
02476 tmp.push_back(reference);
02477 }
02478 }
02479
02480 if ( tmp.size() > 0 ) {
02481 set.push_back(tmp);
02482 }
02483
02484
02485 std::sort(set.begin(),set.end(),SortLayersByZR());
02486
02487
02488 return set;
02489 }