Go to the documentation of this file.00001 #include "RecoTracker/TkNavigation/interface/CosmicNavigationSchool.h"
00002 #include "RecoTracker/TkNavigation/interface/SimpleNavigationSchool.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004
00005 #include "RecoTracker/TkNavigation/interface/SimpleBarrelNavigableLayer.h"
00006 #include "RecoTracker/TkNavigation/interface/SimpleForwardNavigableLayer.h"
00007 #include "RecoTracker/TkNavigation/interface/SimpleNavigableLayer.h"
00008 #include "RecoTracker/TkNavigation/interface/DiskLessInnerRadius.h"
00009 #include "RecoTracker/TkNavigation/interface/SymmetricLayerFinder.h"
00010
00011 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
00012 #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h"
00013 #include "TrackingTools/DetLayers/src/DetBelowZ.h"
00014 #include "TrackingTools/DetLayers/src/DetLessZ.h"
00015 #include "TrackingTools/DetLayers/interface/NavigationSetter.h"
00016
00017 #include <functional>
00018 #include <algorithm>
00019 #include <map>
00020 #include <cmath>
00021
00022 using namespace std;
00023
00024 CosmicNavigationSchool::CosmicNavigationSchoolConfiguration::CosmicNavigationSchoolConfiguration(const edm::ParameterSet conf){
00025 noPXB=conf.getParameter<bool>("noPXB");
00026 noPXF=conf.getParameter<bool>("noPXF");
00027 noTIB=conf.getParameter<bool>("noTIB");
00028 noTID=conf.getParameter<bool>("noTID");
00029 noTOB=conf.getParameter<bool>("noTOB");
00030 noTEC=conf.getParameter<bool>("noTEC");
00031 self = conf.getParameter<bool>("selfSearch");
00032 allSelf = conf.getParameter<bool>("allSelf");
00033 }
00034
00035 CosmicNavigationSchool::CosmicNavigationSchool(const GeometricSearchTracker* theInputTracker,
00036 const MagneticField* field)
00037 {
00038 build(theInputTracker, field, CosmicNavigationSchoolConfiguration());
00039 }
00040
00041 void CosmicNavigationSchool::build(const GeometricSearchTracker* theInputTracker,
00042 const MagneticField* field,
00043 const CosmicNavigationSchoolConfiguration conf)
00044 {
00045 LogTrace("CosmicNavigationSchool") << "*********Running CosmicNavigationSchool***********" ;
00046 theBarrelLength = 0;theField = field; theTracker = theInputTracker;
00047
00048 theAllDetLayersInSystem=&theInputTracker->allLayers();
00049
00050
00051 vector<BarrelDetLayer*> blc = theTracker->barrelLayers();
00052 for ( vector<BarrelDetLayer*>::iterator i = blc.begin(); i != blc.end(); i++) {
00053 if (conf.noPXB && (*i)->subDetector() == GeomDetEnumerators::PixelBarrel) continue;
00054 if (conf.noTOB && (*i)->subDetector() == GeomDetEnumerators::TOB) continue;
00055 if (conf.noTIB && (*i)->subDetector() == GeomDetEnumerators::TIB) continue;
00056 theBarrelLayers.push_back( (*i) );
00057 }
00058
00059
00060 vector<ForwardDetLayer*> flc = theTracker->forwardLayers();
00061 for ( vector<ForwardDetLayer*>::iterator i = flc.begin(); i != flc.end(); i++) {
00062 if (conf.noPXF && (*i)->subDetector() == GeomDetEnumerators::PixelEndcap) continue;
00063 if (conf.noTEC && (*i)->subDetector() == GeomDetEnumerators::TEC) continue;
00064 if (conf.noTID && (*i)->subDetector() == GeomDetEnumerators::TID) continue;
00065 theForwardLayers.push_back( (*i) );
00066 }
00067
00068 FDLI middle = find_if( theForwardLayers.begin(), theForwardLayers.end(),
00069 not1(DetBelowZ(0)));
00070 theLeftLayers = FDLC( theForwardLayers.begin(), middle);
00071 theRightLayers = FDLC( middle, theForwardLayers.end());
00072
00073 SymmetricLayerFinder symFinder( theForwardLayers);
00074
00075
00076 linkBarrelLayers( symFinder);
00077 linkForwardLayers( symFinder);
00078 establishInverseRelations( symFinder );
00079
00080 if (conf.self){
00081
00082
00083 NavigationSetter setter(*this);
00084
00085
00086 const std::vector< BarrelDetLayer * > & tobL = theInputTracker->tobLayers();
00087 if (tobL.size()>=1){
00088 if (conf.allSelf){
00089 LogDebug("CosmicNavigationSchool")<<" adding all TOB self search.";
00090 for (std::vector< BarrelDetLayer * >::const_iterator lIt = tobL.begin(); lIt!=tobL.end(); ++lIt)
00091 dynamic_cast<SimpleNavigableLayer*>((*lIt)->navigableLayer())->theSelfSearch = true;
00092 }else{
00093 SimpleNavigableLayer* navigableLayer = dynamic_cast<SimpleNavigableLayer*>(tobL.front()->navigableLayer());
00094 LogDebug("CosmicNavigationSchool")<<" adding TOB1 to TOB1.";
00095 navigableLayer->theSelfSearch = true;
00096 }
00097 }
00098 const std::vector< BarrelDetLayer * > & tibL = theInputTracker->tibLayers();
00099 if (tibL.size()>=1){
00100 if (conf.allSelf){
00101 LogDebug("CosmicNavigationSchool")<<" adding all TIB self search.";
00102 for (std::vector< BarrelDetLayer * >::const_iterator lIt = tibL.begin(); lIt!=tibL.end(); ++lIt)
00103 dynamic_cast<SimpleNavigableLayer*>((*lIt)->navigableLayer())->theSelfSearch = true;
00104 }else{
00105 SimpleNavigableLayer* navigableLayer = dynamic_cast<SimpleNavigableLayer*>(tibL.front()->navigableLayer());
00106 LogDebug("CosmicNavigationSchool")<<" adding tib1 to tib1.";
00107 navigableLayer->theSelfSearch = true;
00108 }
00109 }
00110 const std::vector< BarrelDetLayer * > & pxbL = theInputTracker->pixelBarrelLayers();
00111 if (pxbL.size()>=1){
00112 if (conf.allSelf){
00113 LogDebug("CosmicNavigationSchool")<<" adding all PXB self search.";
00114 for (std::vector< BarrelDetLayer * >::const_iterator lIt = pxbL.begin(); lIt!=pxbL.end(); ++lIt)
00115 dynamic_cast<SimpleNavigableLayer*>((*lIt)->navigableLayer())->theSelfSearch = true;
00116 }else{
00117 SimpleNavigableLayer* navigableLayer = dynamic_cast<SimpleNavigableLayer*>(pxbL.front()->navigableLayer());
00118 LogDebug("CosmicNavigationSchool")<<" adding pxb1 to pxb1.";
00119 navigableLayer->theSelfSearch = true;
00120 }
00121 }
00122 }
00123 }
00124
00125 void CosmicNavigationSchool::
00126 linkBarrelLayers( SymmetricLayerFinder& symFinder)
00127 {
00128
00129
00130
00131
00132 for ( BDLI i = theBarrelLayers.begin(); i != theBarrelLayers.end(); i++) {
00133 BDLC reachableBL;
00134 FDLC leftFL;
00135 FDLC rightFL;
00136
00137
00138 if ( i+1 != theBarrelLayers.end()) reachableBL.push_back(*(i+1));
00139
00140
00141 if (i != theBarrelLayers.end() - 1) {
00142 linkNextForwardLayer( *i, rightFL);
00143 }
00144
00145
00146 if ( i+2 < theBarrelLayers.end()) {
00147 linkNextLargerLayer( i, theBarrelLayers.end(), reachableBL);
00148 }
00149
00150 theBarrelNLC.push_back( new
00151 SimpleBarrelNavigableLayer( *i, reachableBL,
00152 symFinder.mirror(rightFL),
00153 rightFL,theField, 5.,false));
00154 }
00155 }
00156
00157
00158 void CosmicNavigationSchool::establishInverseRelations(SymmetricLayerFinder& symFinder) {
00159
00160
00161
00162
00163 NavigationSetter setter(*this);
00164
00165
00166
00167 typedef map<const DetLayer*, vector<BarrelDetLayer*>, less<const DetLayer*> > BarrelMapType;
00168 typedef map<const DetLayer*, vector<ForwardDetLayer*>, less<const DetLayer*> > ForwardMapType;
00169
00170
00171 BarrelMapType reachedBarrelLayersMap;
00172 ForwardMapType reachedForwardLayersMap;
00173
00174
00175 for ( BDLI bli = theBarrelLayers.begin();
00176 bli!=theBarrelLayers.end(); bli++) {
00177 DLC reachedLC = (**bli).nextLayers( insideOut);
00178 for ( DLI i = reachedLC.begin(); i != reachedLC.end(); i++) {
00179 reachedBarrelLayersMap[*i].push_back( *bli);
00180 }
00181 }
00182
00183 for ( FDLI fli = theForwardLayers.begin();
00184 fli!=theForwardLayers.end(); fli++) {
00185 DLC reachedLC = (**fli).nextLayers( insideOut);
00186 for ( DLI i = reachedLC.begin(); i != reachedLC.end(); i++) {
00187 reachedForwardLayersMap[*i].push_back( *fli);
00188 }
00189 }
00190
00191
00192 vector<DetLayer*> lc = theTracker->allLayers();
00193 for ( vector<DetLayer*>::iterator i = lc.begin(); i != lc.end(); i++) {
00194 SimpleNavigableLayer* navigableLayer = dynamic_cast<SimpleNavigableLayer*>((**i).navigableLayer());
00195 if (navigableLayer)
00196 navigableLayer->setInwardLinks( reachedBarrelLayersMap[*i],reachedForwardLayersMap[*i] );
00197 }
00198
00199 buildAdditionalForwardLinks(symFinder);
00200
00201 }
00202
00203
00204 void CosmicNavigationSchool::buildAdditionalBarrelLinks(){
00205 for ( vector<BarrelDetLayer*>::iterator i = theBarrelLayers.begin(); i != theBarrelLayers.end(); i++) {
00206 SimpleNavigableLayer* navigableLayer =
00207 dynamic_cast<SimpleNavigableLayer*>((**i).navigableLayer());
00208 if (i+1 != theBarrelLayers.end() )navigableLayer->setAdditionalLink(*(i+1), outsideIn);
00209 }
00210 }
00211
00212
00213 void CosmicNavigationSchool::buildAdditionalForwardLinks(SymmetricLayerFinder& symFinder){
00214
00215 SimpleNavigableLayer* firstR = dynamic_cast<SimpleNavigableLayer*>(theRightLayers.front()->navigableLayer());
00216 SimpleNavigableLayer* firstL = dynamic_cast<SimpleNavigableLayer*>(theLeftLayers.front()->navigableLayer());
00217 firstR->setCheckCrossingSide(false);
00218 firstL->setCheckCrossingSide(false);
00219
00220 for ( vector<ForwardDetLayer*>::iterator i = theRightLayers.begin(); i != theRightLayers.end(); i++){
00221
00222 SimpleForwardNavigableLayer* nfl = dynamic_cast<SimpleForwardNavigableLayer*>((*i)->navigableLayer());
00223 SimpleForwardNavigableLayer* mnfl = dynamic_cast<SimpleForwardNavigableLayer*>(symFinder.mirror(*i)->navigableLayer());
00224 for (vector<BarrelDetLayer*>::iterator j = theBarrelLayers.begin(); j != theBarrelLayers.end(); j++){
00225 if ((*i)->specificSurface().outerRadius() < (*j)->specificSurface().radius() &&
00226 fabs((*i)->specificSurface().position().z()) < (*j)->surface().bounds().length()/2.){
00227 nfl ->setAdditionalLink(*j, outsideIn);
00228 mnfl->setAdditionalLink(*j, outsideIn);
00229 break;
00230 }
00231 }
00232 }
00233 }
00234