36 theCategory =
"TSGForRoadSearch|TrackerSeedGenerator";
88 std::vector<TrajectorySeed> &
result) {
120 if (fts.position().mag() == 0 && fts.momentum().mag() == 0) {
147 if (!
inner.isValid()) {
156 double z =
inner.globalPosition().z();
164 if (fabs(
z) < ptidc.front()->surface().position().z()) {
165 inLayer = blc.front();
166 }
else if (fabs(
z) < ptecc.front()->surface().position().z()) {
167 inLayer = (
z < 0) ? ntidc.front() : ptidc.front();
169 inLayer = (
z < 0) ? ntecc.front() : ptecc.front();
173 std::vector<DetLayer::DetWithState> compatible;
174 compatible.reserve(10);
179 while (compatible.empty()) {
189 inLayer = (
z < 0) ? ntidc.front() : ptidc.front();
192 inLayer = (
z < 0) ? ntecc.front() : ptecc.front();
233 if (!
outer.isValid()) {
242 double z =
outer.globalPosition().z();
248 <<
"TEC1 z: " << ptecc.front()->surface().position().z();
250 unsigned int layerShift = 0;
252 if (fabs(
z) < ptecc.front()->surface().position().z()) {
253 inLayer = *(blc.rbegin() + layerShift);
256 unsigned int tecIt = 1;
257 for (; tecIt != ptecc.size(); tecIt++) {
259 <<
"z: " << ptecc[tecIt]->surface().position().z();
260 if (fabs(
z) < ptecc[tecIt]->surface().
position().
z()) {
261 inLayer = (
z < 0) ? ntecc[tecIt - 1] : ptecc[tecIt - 1];
262 layerShift = tecIt - 1;
269 inLayer = (
z < 0) ? ntecc.back() : ptecc.back();
275 std::vector<DetLayer::DetWithState> compatible;
276 compatible.reserve(10);
281 while (compatible.empty()) {
289 if (layerShift >= blc.size()) {
290 LogDebug(
theCategory) <<
"all barrel layers are exhausted to find starting state. no seed,";
293 inLayer = *(blc.rbegin() + layerShift);
296 if (layerShift == 0) {
297 LogDebug(
theCategory) <<
"failed to get a compatible module on a TEC layer, using the last TOB layer.";
298 inLayer = *(blc.rbegin() + layerShift);
302 inLayer = (
z < 0) ? ntecc[layerShift] : ptecc[layerShift];
337 if (!
inner.isValid()) {
346 double z =
inner.globalPosition().z();
355 if ((ppxlc.empty() || npxlc.empty()) && (ptidc.empty() || ptecc.empty())) {
362 std::vector<const ForwardDetLayer *>::const_iterator layerIt;
367 if (fz < fabs(((
z > 0) ? ppxlc : npxlc).front()->surface().
position().
z())) {
368 inLayer = blc.front();
369 }
else if (fz < fabs(((
z > 0) ? ppxlc : npxlc).back()->surface().
position().
z())) {
370 layerIt = ((
z > 0) ? ppxlc : npxlc).begin();
372 }
else if (fz < fabs(((
z > 0) ? ptidc : ntidc).front()->surface().
position().
z())) {
373 layerIt = ((
z > 0) ? ppxlc : npxlc).end() - 1;
375 }
else if (fz < fabs(((
z > 0) ? ptecc : ntecc).front()->surface().
position().
z())) {
376 layerIt = ((
z > 0) ? ptidc : ntidc).begin();
378 }
else if (fz < fabs(((
z > 0) ? ptecc : ntecc).back()->surface().
position().
z())) {
379 layerIt = ((
z > 0) ? ptecc : ntecc).begin();
387 std::vector<DetLayer::DetWithState> compatible;
388 compatible.reserve(10);
393 if (compatible.empty()) {
394 std::vector<const ForwardDetLayer *>::const_iterator pxlEnd = (
z > 0) ? ppxlc.end() : npxlc.end();
395 std::vector<const ForwardDetLayer *>::const_iterator tidEnd = (
z > 0) ? ptidc.end() : ntidc.end();
396 std::vector<const ForwardDetLayer *>::const_iterator tecEnd = (
z > 0) ? ptecc.end() : ntecc.end();
397 std::vector<const ForwardDetLayer *>::const_iterator pxlBegin = (
z > 0) ? ppxlc.begin() : npxlc.begin();
398 std::vector<const ForwardDetLayer *>::const_iterator tidBegin = (
z > 0) ? ptidc.begin() : ntidc.begin();
399 std::vector<const ForwardDetLayer *>::const_iterator tecBegin = (
z > 0) ? ptecc.begin() : ntecc.begin();
402 if (!dynamic_cast<const ForwardDetLayer *>(inLayer))
403 layerIt = pxlBegin--;
405 while (compatible.empty()) {
410 if (layerIt == pxlEnd)
417 if (layerIt == tidEnd)
423 if (layerIt == tecEnd) {
431 <<
"this should not happen... ever. Please report. GeomDetEnumerators::PixelBarrel. no seed.";
436 <<
"this should not happen... ever. Please report. GeomDetEnumerators::TIB. no seed.";
441 <<
"this should not happen... ever. Please report. GeomDetEnumerators::TOB. no seed.";
450 (*layerIt)->compatibleDetsV(
464 std::vector<DetLayer::DetWithState> &compatible,
466 std::vector<TrajectorySeed> &
result)
const {
467 if (compatible.empty()) {
474 for (std::vector<DetLayer::DetWithState>::iterator DWSit = compatible.begin(); DWSit != compatible.end(); ++DWSit) {
475 bool aBareTS =
false;
476 const GeomDet *gd = DWSit->first;
486 for (std::vector<TrajectoryMeasurement>::iterator Mit =
tmp.begin(); Mit !=
tmp.end(); ++Mit) {
498 if (
hit->isValid()) {
532 compatible.front().second, compatible.front().first->geographicalId().rawId());
534 << compatible.front().second
535 <<
"on detector: " << compatible.front().first->geographicalId().rawId();