21 TIBRing::TIBRing(vector<const GeomDet*>& theGeomDets):
23 theDets(theGeomDets.
begin(),theGeomDets.
end())
29 theBinFinder = BinFinderType( theDets.front()->surface().position().phi(),
37 LogDebug(
"TkDetLayers") <<
"==== DEBUG TIBRing =====" ;
38 LogDebug(
"TkDetLayers") <<
"radius, thickness, lenght: "
39 << theCylinder->radius() <<
" , "
40 << theCylinder->bounds().thickness() <<
" , "
41 << theCylinder->bounds().length() ;
43 for (vector<const GeomDet*>::const_iterator
i=theDets.begin();
44 i != theDets.end();
i++){
45 LogDebug(
"TkDetLayers") <<
"Ring's Det pos z,perp,eta,phi: "
46 << (**i).position().z() <<
" , "
47 << (**i).position().perp() <<
" , "
48 << (**i).position().eta() <<
" , "
49 << (**i).position().phi() ;
51 LogDebug(
"TkDetLayers") <<
"==== end DEBUG TIBRing =====" ;
57 const vector<const GeometricSearchDet*>&
63 void TIBRing::checkRadius(vector<const GeomDet*>::const_iterator
first,
64 vector<const GeomDet*>::const_iterator
last)
69 for (vector<const GeomDet*>::const_iterator
i=first;
i!=
last;
i++) {
70 float r = (**i).surface().position().perp();
71 if (r < rMin) rMin =
r;
72 if (r > rMax) rMax =
r;
75 "TIBRing construction failed: detectors not at constant radius");
79 void TIBRing::checkPeriodicity(vector<const GeomDet*>::const_iterator first,
80 vector<const GeomDet*>::const_iterator last)
82 vector<double> adj_diff(last-first-1);
83 for (
int i=0; i < static_cast<int>(adj_diff.size());
i++) {
84 vector<const GeomDet*>::const_iterator curent = first +
i;
85 adj_diff[
i] = (**(curent+1)).surface().position().phi() -
86 (**curent).surface().position().phi();
91 if (
std::abs(step-phi_step)/phi_step > 0.01) {
92 int ndets = last-
first;
93 edm::LogError(
"TkDetLayers") <<
"TIBRing Warning: not periodic. ndets=" << ndets ;
94 for (
int j=0;
j<ndets;
j++) {
95 edm::LogError(
"TkDetLayers") <<
"Dets(r,phi): (" << theDets[
j]->surface().position().perp()
96 <<
"," << theDets[
j]->surface().position().phi() <<
") " ;
102 void TIBRing::computeHelicity() {
104 const GeomDet& det = *theDets.front();
107 if(normal.
dot(radial)<=0)normal*=-1;
124 pair<bool, TrajectoryStateOnSurface>
127 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of TIBRing::compatible()!!" ;
128 return pair<bool,TrajectoryStateOnSurface>();
136 vector<DetGroup> &
result)
const
138 vector<DetGroup> closestResult;
139 SubRingCrossings crossings;
141 if(! crossings.isValid_)
return;
144 Adder::add( *theDets[theBinFinder.binIndex(crossings.closestIndex)],
145 tsos, prop, est, closestResult);
147 if(closestResult.empty()){
148 Adder::add( *theDets[theBinFinder.binIndex(crossings.nextIndex)],
156 float detWidth = closestGel.det()->surface().bounds().width();
157 if (crossings.nextDistance < detWidth + window) {
158 vector<DetGroup> nextResult;
159 if (
Adder::add( *theDets[theBinFinder.binIndex(crossings.nextIndex)],
160 tsos, prop, est, nextResult)) {
162 if (crossings.closestIndex < crossings.nextIndex) {
165 theHelicity, crossingSide);
170 theHelicity, crossingSide);
174 result.swap(closestResult);
177 result.swap(closestResult);
181 if (window > 0.5
f*detWidth) {
182 searchNeighbors( tsos, prop, est, crossings, window, result);
189 const SubRingCrossings& crossings,
191 vector<DetGroup>& result)
const
197 int negStart =
std::min( crossings.closestIndex, crossings.nextIndex) - 1;
198 int posStart =
std::max( crossings.closestIndex, crossings.nextIndex) + 1;
200 int quarter = theDets.size()/4;
201 for (
int idet=negStart; idet >= negStart - quarter+1; idet--) {
202 const GeomDet* neighbor = theDets[theBinFinder.binIndex(idet)];
205 vector<DetGroup> tmp1;
206 if (!
Adder::add( *neighbor, tsos, prop, est, tmp1))
break;
207 vector<DetGroup> tmp2; tmp2.swap(result);
208 vector<DetGroup> newResult;
209 Merger::orderAndMergeTwoLevels(std::move(tmp1), std::move(tmp2), newResult, theHelicity, crossingSide);
210 result.swap(newResult);
212 for (
int idet=posStart; idet < posStart + quarter-1; idet++) {
213 const GeomDet* neighbor = theDets[theBinFinder.binIndex(idet)];
216 vector<DetGroup> tmp1;
217 if (!
Adder::add( *neighbor, tsos, prop, est, tmp1))
break;
218 vector<DetGroup> tmp2; tmp2.swap(result);
219 vector<DetGroup> newResult;
220 Merger::orderAndMergeTwoLevels(std::move(tmp2), std::move(tmp1), newResult, theHelicity, crossingSide);
221 result.swap(newResult);
226 TIBRing::SubRingCrossings
238 propDir,specificSurface(),
241 if (!cylCrossing.hasSolution())
return SubRingCrossings();
245 int closestIndex = theBinFinder.binIndex(cylPoint.barePhi());
247 const Plane& closestPlane( theDets[closestIndex]->surface());
249 LocalPoint closestPos = Crossing::positionOnly( cylPoint, cylDir, rho, closestPlane);
250 float closestDist = closestPos.
x();
253 int nextIndex =
PhiLess()( closestPlane.position().barePhi(), cylPoint.barePhi()) ?
254 closestIndex+1 : closestIndex-1;
256 const Plane& nextPlane( theDets[ theBinFinder.binIndex(nextIndex)]->surface());
257 LocalPoint nextPos = Crossing::positionOnly( cylPoint, cylDir, rho, nextPlane);
258 float nextDist = nextPos.x();
261 return SubRingCrossings( closestIndex, nextIndex, nextDist);
264 return SubRingCrossings( nextIndex, closestIndex, closestDist);
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Local3DVector LocalVector
static int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
returns 0 if barrel layer crossed from inside, 1 if from outside
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Vector2DBase< float, LocalTag > Local2DVector
double stat_mean(const CONT &cont)
const Plane & surface() const
The nominal surface of the GeomDet.
virtual PropagationDirection propagationDirection() const GCC11_FINAL
const T & max(const T &a, const T &b)
Abs< T >::type abs(const T &t)
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
GlobalVector globalMomentum() const
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
const PositionType & position() const
double transverseCurvature() const