CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/RecoTracker/TkNavigation/src/LayerCollector.cc

Go to the documentation of this file.
00001 #include "RecoTracker/TkNavigation/interface/LayerCollector.h"
00002 #include "RecoTracker/TkNavigation/interface/StartingLayerFinder.h" 
00003 
00004 using namespace std;
00005 
00006 vector<const DetLayer*> LayerCollector::allLayers(const FTS& aFts) const {
00007 
00008 
00009   vector<const DetLayer*> myLayers;
00010 
00011 
00012 
00013   FTS myFts(aFts.parameters());
00014 
00015   vector<const DetLayer*> nextLayers = finder()->startingLayers(myFts, deltaR(), deltaZ());
00016 
00017   vector<const DetLayer*> dummy;
00018 
00019 
00020 
00021 
00022   bool inside = true;
00023   while(inside) {
00024 
00025     inside = false;
00026     for(vector<const DetLayer*>::iterator ilay = nextLayers.begin(); ilay != nextLayers.end(); ilay++) {
00027 
00028       
00029       TSOS pTsos = propagator()->propagate(myFts, (**ilay).surface());
00030 
00031 
00032       if(pTsos.isValid()) {
00033 
00034         inside = true;
00035 
00036      
00037 
00038         if((**ilay).location() == GeomDetEnumerators::barrel) {
00039 
00040           Range barrZRange((**ilay).position().z() - 
00041                            0.5*((**ilay).surface().bounds().length()),
00042                            (**ilay).position().z() + 
00043                            0.5*((**ilay).surface().bounds().length()));
00044           Range trajZRange(pTsos.globalPosition().z() - deltaZ(),
00045                            pTsos.globalPosition().z() + deltaZ());
00046           
00047           if(rangesIntersect(trajZRange, barrZRange)) 
00048             myLayers.push_back(*ilay);
00049 
00050         } else if((**ilay).location() == GeomDetEnumerators::endcap) {
00051 
00052           const ForwardDetLayer* fwd = 
00053             dynamic_cast<const ForwardDetLayer*>(*ilay);
00054           Range fwdRRange((*fwd).specificSurface().innerRadius(),
00055                           (*fwd).specificSurface().outerRadius());
00056           Range trajRRange(pTsos.globalPosition().perp() - deltaR(),
00057                            pTsos.globalPosition().perp() + deltaR());
00058 
00059           if(rangesIntersect(trajRRange, fwdRRange)) 
00060             myLayers.push_back(*ilay);
00061          
00062         }
00063 
00064         myFts = FTS(pTsos.globalParameters());
00065  
00066         
00067         nextLayers = (**ilay).nextLayers(*pTsos.freeState(), 
00068                                          propagator()->propagationDirection());
00069 
00070 
00071         break;
00072 
00073 
00074       }     
00075 
00076 
00077 
00078     }
00079   }
00080 
00081 
00082 
00083   
00084   return myLayers;
00085 }
00086 
00087 vector<const BarrelDetLayer*> LayerCollector::barrelLayers(const FTS& aFts) const {
00088 
00089   vector<const DetLayer*> all = allLayers(aFts);
00090   vector<const BarrelDetLayer*> barrelLayers;
00091 
00092 
00093   for(vector<const DetLayer*>::iterator ilay = all.begin();
00094       ilay != all.end(); ilay++) {
00095 
00096     if(const BarrelDetLayer* myBarrel = 
00097        dynamic_cast<const BarrelDetLayer*>(*ilay))
00098       barrelLayers.push_back(myBarrel);
00099   }
00100 
00101 
00102   return barrelLayers;
00103 }
00104   
00105 vector<const ForwardDetLayer*> LayerCollector::forwardLayers(const FTS& aFts) const {
00106   
00107   vector<const DetLayer*> all = allLayers(aFts);
00108   vector<const ForwardDetLayer*> fwdLayers;
00109 
00110 
00111   for(vector<const DetLayer*>::iterator ilay = all.begin();
00112       ilay != all.end(); ilay++) {
00113     
00114     if(const ForwardDetLayer* myFwd = 
00115        dynamic_cast<const ForwardDetLayer*>(*ilay))
00116       fwdLayers.push_back(myFwd);
00117   }
00118 
00119   
00120   return fwdLayers;
00121 }
00122 
00123 
00124 
00125 
00126 
00127 
00128 
00129