Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:12

0001 #include "RecoTracker/MeasurementDet/interface/LayerCollector.h"
0002 #include "RecoTracker/MeasurementDet/interface/StartingLayerFinder.h"
0003 #include "TrackingTools/DetLayers/interface/NavigationSchool.h"
0004 
0005 using namespace std;
0006 
0007 vector<const DetLayer*> LayerCollector::allLayers(const FTS& aFts) const {
0008   vector<const DetLayer*> myLayers;
0009 
0010   FTS myFts(aFts.parameters());
0011 
0012   vector<const DetLayer*> nextLayers = theStartingLayerFinder(myFts, deltaR(), deltaZ());
0013 
0014   vector<const DetLayer*> dummy;
0015 
0016   bool inside = true;
0017   while (inside) {
0018     inside = false;
0019     for (vector<const DetLayer*>::iterator ilay = nextLayers.begin(); ilay != nextLayers.end(); ilay++) {
0020       TSOS pTsos = propagator()->propagate(myFts, (**ilay).surface());
0021 
0022       if (pTsos.isValid()) {
0023         inside = true;
0024 
0025         if ((**ilay).location() == GeomDetEnumerators::barrel) {
0026           Range barrZRange((**ilay).position().z() - 0.5 * ((**ilay).surface().bounds().length()),
0027                            (**ilay).position().z() + 0.5 * ((**ilay).surface().bounds().length()));
0028           Range trajZRange(pTsos.globalPosition().z() - deltaZ(), pTsos.globalPosition().z() + deltaZ());
0029 
0030           if (rangesIntersect(trajZRange, barrZRange))
0031             myLayers.push_back(*ilay);
0032 
0033         } else if ((**ilay).location() == GeomDetEnumerators::endcap) {
0034           const ForwardDetLayer* fwd = dynamic_cast<const ForwardDetLayer*>(*ilay);
0035           Range fwdRRange((*fwd).specificSurface().innerRadius(), (*fwd).specificSurface().outerRadius());
0036           Range trajRRange(pTsos.globalPosition().perp() - deltaR(), pTsos.globalPosition().perp() + deltaR());
0037 
0038           if (rangesIntersect(trajRRange, fwdRRange))
0039             myLayers.push_back(*ilay);
0040         }
0041 
0042         myFts = FTS(pTsos.globalParameters());
0043 
0044         nextLayers = theSchool->nextLayers(**ilay, *pTsos.freeState(), propagator()->propagationDirection());
0045 
0046         break;
0047       }
0048     }
0049   }
0050 
0051   return myLayers;
0052 }
0053 
0054 vector<const BarrelDetLayer*> LayerCollector::barrelLayers(const FTS& aFts) const {
0055   vector<const DetLayer*> all = allLayers(aFts);
0056   vector<const BarrelDetLayer*> barrelLayers;
0057 
0058   for (vector<const DetLayer*>::iterator ilay = all.begin(); ilay != all.end(); ilay++) {
0059     if (const BarrelDetLayer* myBarrel = dynamic_cast<const BarrelDetLayer*>(*ilay))
0060       barrelLayers.push_back(myBarrel);
0061   }
0062 
0063   return barrelLayers;
0064 }
0065 
0066 vector<const ForwardDetLayer*> LayerCollector::forwardLayers(const FTS& aFts) const {
0067   vector<const DetLayer*> all = allLayers(aFts);
0068   vector<const ForwardDetLayer*> fwdLayers;
0069 
0070   for (vector<const DetLayer*>::iterator ilay = all.begin(); ilay != all.end(); ilay++) {
0071     if (const ForwardDetLayer* myFwd = dynamic_cast<const ForwardDetLayer*>(*ilay))
0072       fwdLayers.push_back(myFwd);
0073   }
0074 
0075   return fwdLayers;
0076 }