22 SimpleBarrelNavigableLayer::
25 const FDLC& outerLeftFL,
26 const FDLC& outerRightFL,
29 bool checkCrossingSide) :
31 theDetLayer( detLayer),
32 theOuterBarrelLayers( outerBLC),
33 theOuterLeftForwardLayers( outerLeftFL),
34 theOuterRightForwardLayers( outerRightFL)
38 theNegOuterLayers.reserve( outerBLC.size() + outerLeftFL.size());
39 thePosOuterLayers.reserve( outerBLC.size() + outerRightFL.size());
41 for (ConstBDLI bl=outerBLC.begin(); bl!=outerBLC.end(); bl++)
42 theNegOuterLayers.push_back( *bl);
43 thePosOuterLayers = theNegOuterLayers;
45 for (ConstFDLI fl=outerLeftFL.begin(); fl!=outerLeftFL.end(); fl++)
46 theNegOuterLayers.push_back( *fl);
47 for (ConstFDLI fl=outerRightFL.begin(); fl!=outerRightFL.end(); fl++)
48 thePosOuterLayers.push_back( *fl);
51 sort( theNegOuterLayers.begin(), theNegOuterLayers.end(),
TkLayerLess());
52 sort( thePosOuterLayers.begin(), thePosOuterLayers.end(),
TkLayerLess());
53 sort(theOuterBarrelLayers.begin(), theOuterBarrelLayers.end(),
TkLayerLess());
54 sort(theOuterLeftForwardLayers.begin(), theOuterLeftForwardLayers.end(),
TkLayerLess());
55 sort(theOuterRightForwardLayers.begin(), theOuterRightForwardLayers.end(),
TkLayerLess());
60 vector<const DetLayer*>
63 vector<const DetLayer*>
result;
69 result = theNegOuterLayers;
70 for ( DLC::const_iterator
i=thePosOuterLayers.begin();
71 i!=thePosOuterLayers.end();
i++) {
77 result = theNegInnerLayers;
78 for ( DLC::const_iterator
i=thePosInnerLayers.begin();
79 i!=thePosInnerLayers.end();
i++) {
87 vector<const DetLayer*>
95 vector<const DetLayer*>
result;
102 auto const momentum = fts.
momentum();
107 bool isInOutTrackBarrel = (transversePosition.dot(momentum)>0);
110 bool isInOutTrackFWD = momentum.z()*zpos>0;
119 <<
"isInOutTrackBarrel: " << isInOutTrackBarrel << endl
120 <<
"isInOutTrackFWD: " << isInOutTrackFWD << endl
121 <<
"dirOppositeXORisInOutTrackFWD: " << dirOppositeXORisInOutTrackFWD << endl
122 <<
"dirOppositeXORisInOutTrackBarrel: "<< dirOppositeXORisInOutTrackBarrel << endl;
124 bool signZmomentumXORdir = (( (momentum.z() > 0) && !(dir ==
alongMomentum) ) ||
128 if likely( dirOppositeXORisInOutTrackBarrel && dirOppositeXORisInOutTrackFWD) {
129 if ( signZmomentumXORdir ) {
130 wellInside( ftsWithoutErrors, dir, theNegOuterLayers, result);
133 wellInside( ftsWithoutErrors, dir, thePosOuterLayers, result);
135 }
else if (!dirOppositeXORisInOutTrackBarrel && !dirOppositeXORisInOutTrackFWD){
136 if ( signZmomentumXORdir ) {
137 wellInside( ftsWithoutErrors, dir, thePosInnerLayers, result);
140 wellInside( ftsWithoutErrors, dir, theNegInnerLayers, result);
142 }
else if (!dirOppositeXORisInOutTrackBarrel && dirOppositeXORisInOutTrackFWD){
143 wellInside(ftsWithoutErrors, dir, theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(),
result);
145 if (signZmomentumXORdir){
146 wellInside(ftsWithoutErrors, dir, theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(),
result);
147 wellInside(ftsWithoutErrors, dir, theOuterLeftForwardLayers.begin(), theOuterLeftForwardLayers.end(),
result);
149 wellInside(ftsWithoutErrors, dir, theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(),
result);
150 wellInside(ftsWithoutErrors, dir, theOuterRightForwardLayers.begin(), theOuterRightForwardLayers.end(),
result);
153 if (signZmomentumXORdir){
154 wellInside(ftsWithoutErrors, dir, theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(),
result);
156 wellInside(ftsWithoutErrors, dir, theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(),
result);
158 wellInside(ftsWithoutErrors, dir, theOuterBarrelLayers.begin(), theOuterBarrelLayers.end(),
result);
163 LogDebug(
"SimpleBarrelNavigableLayer") <<
"goingIntoTheBarrel: " << goingIntoTheBarrel;
166 if unlikely(theSelfSearch && result.size()==0){
167 if (!goingIntoTheBarrel){
168 LogDebug(
"SimpleBarrelNavigableLayer")<<
" state is not going toward the center of the barrel. not adding self search.";}
171 LogDebug(
"SimpleBarrelNavigableLayer")<<
" I am trying to added myself as a next layer.";
172 wellInside(ftsWithoutErrors, dir, bl, result);
173 unsigned int after=result.size();
175 LogDebug(
"SimpleBarrelNavigableLayer")<<
" I have added myself as a next layer.";
183 vector<const DetLayer*>
185 edm::LogError(
"TkNavigation") <<
"ERROR: compatibleLayers() method used without all reachableLayers are set" ;
186 throw DetLayerException(
"compatibleLayers() method used without all reachableLayers are set");
187 return vector<const DetLayer*>();
192 void SimpleBarrelNavigableLayer::setDetLayer(
DetLayer* dl) {
193 cerr <<
"Warniong: SimpleBarrelNavigableLayer::setDetLayer called."
194 << endl <<
"This should never happen!" << endl;
197 void SimpleBarrelNavigableLayer::setInwardLinks(
const BDLC& theBarrelv,
198 const FDLC& theForwardv,
201 theInnerBarrelLayers=theBarrelv;
203 sort(theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(),
sorter);
206 ConstFDLI middle = find_if( theForwardv.begin(),theForwardv.end(),
208 theInnerLeftForwardLayers=FDLC(theForwardv.begin(),middle);
209 theInnerRightForwardLayers=FDLC(middle,theForwardv.end());
212 sort(theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(),
sorter);
213 sort(theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(),
sorter);
218 theNegInnerLayers.reserve( theInnerBarrelLayers.size() + theInnerLeftForwardLayers.size());
219 thePosInnerLayers.reserve( theInnerBarrelLayers.size() + theInnerRightForwardLayers.size());
221 for (ConstBDLI bl=theInnerBarrelLayers.begin(); bl!=theInnerBarrelLayers.end(); bl++)
222 theNegInnerLayers.push_back( *bl);
223 thePosInnerLayers = theNegInnerLayers;
225 for (ConstFDLI fl=theInnerLeftForwardLayers.begin(); fl!=theInnerLeftForwardLayers.end(); fl++)
226 theNegInnerLayers.push_back( *fl);
227 for (ConstFDLI fl=theInnerRightForwardLayers.begin(); fl!=theInnerRightForwardLayers.end(); fl++)
228 thePosInnerLayers.push_back( *fl);
231 sort( theNegInnerLayers.begin(), theNegInnerLayers.end(),
sorter);
232 sort( thePosInnerLayers.begin(), thePosInnerLayers.end(),
sorter);
233 sort(theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(),
sorter);
234 sort(theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(),
sorter);
235 sort(theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(),
sorter);
244 theOuterBarrelLayers.push_back(badditional);
245 theNegOuterLayers.push_back(badditional);
246 thePosOuterLayers.push_back(badditional);
249 theInnerBarrelLayers.push_back(badditional);
250 theNegInnerLayers.push_back(badditional);
251 thePosInnerLayers.push_back(badditional);
253 }
else if (fadditional){
254 double zpos = fadditional->
position().
z();
257 theOuterRightForwardLayers.push_back(fadditional);
258 thePosOuterLayers.push_back(fadditional);
261 theOuterLeftForwardLayers.push_back(fadditional);
262 theNegOuterLayers.push_back(fadditional);
266 theInnerRightForwardLayers.push_back(fadditional);
267 thePosInnerLayers.push_back(fadditional);
270 theInnerLeftForwardLayers.push_back(fadditional);
271 theNegInnerLayers.push_back(fadditional);
274 edm::LogError(
"TkNavigation") <<
"trying to add neither a ForwardDetLayer nor a BarrelDetLayer";
const GlobalTrajectoryParameters & parameters() const
static int position[TOTALCHAMBERS][3]
GlobalVector momentum() const
GlobalPoint position() const
virtual const Surface::PositionType & position() const
Returns position of the surface.