21 TIBRing::TIBRing(vector<const GeomDet*>& theGeomDets):
22 theDets(theGeomDets.
begin(),theGeomDets.
end())
28 theBinFinder = BinFinderType( theDets.front()->surface().position().phi(),
36 LogDebug(
"TkDetLayers") <<
"==== DEBUG TIBRing =====" ;
37 LogDebug(
"TkDetLayers") <<
"radius, thickness, lenght: "
38 << theCylinder->radius() <<
" , "
39 << theCylinder->bounds().thickness() <<
" , "
40 << theCylinder->bounds().length() ;
42 for (vector<const GeomDet*>::const_iterator
i=theDets.begin();
43 i != theDets.end();
i++){
44 LogDebug(
"TkDetLayers") <<
"Ring's Det pos z,perp,eta,phi: "
45 << (**i).position().z() <<
" , "
46 << (**i).position().perp() <<
" , "
47 << (**i).position().eta() <<
" , "
48 << (**i).position().phi() ;
50 LogDebug(
"TkDetLayers") <<
"==== end DEBUG TIBRing =====" ;
56 const vector<const GeometricSearchDet*>&
62 void TIBRing::checkRadius(vector<const GeomDet*>::const_iterator
first,
63 vector<const GeomDet*>::const_iterator
last)
68 for (vector<const GeomDet*>::const_iterator
i=first;
i!=
last;
i++) {
69 float r = (**i).surface().position().perp();
70 if (r < rMin) rMin =
r;
71 if (r > rMax) rMax =
r;
74 "TIBRing construction failed: detectors not at constant radius");
78 void TIBRing::checkPeriodicity(vector<const GeomDet*>::const_iterator first,
79 vector<const GeomDet*>::const_iterator last)
81 vector<double> adj_diff(last-first-1);
82 for (
int i=0; i < static_cast<int>(adj_diff.size());
i++) {
83 vector<const GeomDet*>::const_iterator curent = first +
i;
84 adj_diff[
i] = (**(curent+1)).surface().position().phi() -
85 (**curent).surface().position().phi();
90 if ( fabs(step-phi_step)/phi_step > 0.01) {
91 int ndets = last-
first;
92 edm::LogError(
"TkDetLayers") <<
"TIBRing Warning: not periodic. ndets=" << ndets ;
93 for (
int j=0;
j<ndets;
j++) {
94 edm::LogError(
"TkDetLayers") <<
"Dets(r,phi): (" << theDets[
j]->surface().position().perp()
95 <<
"," << theDets[
j]->surface().position().phi() <<
") " ;
101 void TIBRing::computeHelicity() {
103 const GeomDet& det = *theDets.front();
106 if(normal.
dot(radial)<=0)normal*=-1;
123 pair<bool, TrajectoryStateOnSurface>
126 edm::LogError(
"TkDetLayers") <<
"temporary dummy implementation of TIBRing::compatible()!!" ;
127 return pair<bool,TrajectoryStateOnSurface>();
135 vector<DetGroup> &
result)
const
137 vector<DetGroup> closestResult;
138 SubRingCrossings crossings;
140 if(! crossings.isValid_)
return;
143 Adder::add( *theDets[theBinFinder.binIndex(crossings.closestIndex)],
144 tsos, prop, est, closestResult);
146 if(closestResult.empty()){
147 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 =
min( crossings.closestIndex, crossings.nextIndex) - 1;
198 int posStart =
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());
240 if (!cylCrossing.hasSolution())
return SubRingCrossings();
244 int closestIndex = theBinFinder.binIndex(cylPoint.phi());
246 const Plane& closestPlane( theDets[closestIndex]->surface());
248 LocalPoint closestPos = Crossing( cylPoint, cylDir,
rho, closestPlane).position();
249 float closestDist = closestPos.
x();
252 int nextIndex =
PhiLess()( closestPlane.position().phi(), cylPoint.phi()) ?
253 closestIndex+1 : closestIndex-1;
255 const Plane& nextPlane( theDets[ theBinFinder.binIndex(nextIndex)]->surface());
256 LocalPoint nextPos = Crossing( cylPoint, cylDir,
rho, nextPlane).position();
257 float nextDist = nextPos.
x();
259 if (fabs(closestDist) < fabs(nextDist)) {
260 return SubRingCrossings( closestIndex, nextIndex, nextDist);
263 return SubRingCrossings( nextIndex, closestIndex, closestDist);
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Local3DVector LocalVector
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
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
const T & max(const T &a, const T &b)
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
returns 0 if barrel layer crossed from inside, 1 if from outside
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