CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/Alignment/KalmanAlignmentAlgorithm/src/KalmanAlignmentSetup.cc

Go to the documentation of this file.
00001 
00002 #include "Alignment/KalmanAlignmentAlgorithm/interface/KalmanAlignmentSetup.h"
00003 
00004 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00005 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00006 
00007 #include <algorithm>
00008 #include <iostream>
00009 
00010 KalmanAlignmentSetup::KalmanAlignmentSetup( const std::string& id,
00011                                                             const TrajectoryFitter* fitter,
00012                                                             const Propagator* propagator,
00013                                                             const std::vector< SubDetId >& trackingIds,
00014                                                             const unsigned int minTrackingHits,
00015                                                             const SortingDirection sortingDir,
00016                                                             const TrajectoryFitter* externalFitter,
00017                                                             const Propagator* externalPropagator,
00018                                                             const std::vector< SubDetId >& externalIds,
00019                                                             const unsigned int minExternalHits,
00020                                                             const SortingDirection externalSortingDir,
00021                                                             TrajectoryFactoryBase* trajectoryFactory,
00022                                                             KalmanAlignmentUpdator* alignmentUpdator,
00023                                                             KalmanAlignmentMetricsUpdator* metricsUpdator ) :
00024   theId( id ),
00025   theFitter( fitter->clone() ),
00026   thePropagator( propagator->clone() ),
00027   theTrackingSubDetIds( trackingIds ),
00028   theMinTrackingHits( minTrackingHits ),
00029   theSortingDir( sortingDir ),
00030   theExternalFitter( externalFitter->clone() ),
00031   theExternalPropagator( externalPropagator->clone() ),
00032   theExternalTrackingSubDetIds( externalIds ),
00033   theMinExternalHits( minExternalHits ),
00034   theExternalSortingDir( externalSortingDir ),
00035   theTrajectoryFactory( trajectoryFactory ),
00036   theAlignmentUpdator( alignmentUpdator ),
00037   theMetricsUpdator( metricsUpdator )
00038 {}
00039 
00040 
00041 KalmanAlignmentSetup::KalmanAlignmentSetup( const KalmanAlignmentSetup& setup ) :
00042   theId( setup.id() ),
00043   theFitter( setup.fitter()->clone() ),
00044   thePropagator( setup.propagator()->clone() ),
00045   theTrackingSubDetIds( setup.getTrackingSubDetIds() ),
00046   theMinTrackingHits( setup.minTrackingHits() ),
00047   theSortingDir( setup.sortingDirection() ),
00048   theExternalFitter( setup.externalFitter()->clone() ),
00049   theExternalPropagator( setup.externalPropagator()->clone() ),
00050   theExternalTrackingSubDetIds( setup.getExternalTrackingSubDetIds() ),
00051   theMinExternalHits( setup.minExternalHits() ),
00052   theExternalSortingDir( setup.externalSortingDirection() ),
00053   theTrajectoryFactory( setup.trajectoryFactory() ),
00054   theAlignmentUpdator( setup.alignmentUpdator() ),
00055   theMetricsUpdator( setup.metricsUpdator() )
00056 {}
00057 
00058 
00059 KalmanAlignmentSetup::~KalmanAlignmentSetup( void )
00060 {
00061   if ( theFitter ) delete theFitter;
00062   if ( theExternalFitter ) delete theExternalFitter;
00063 
00064   if ( thePropagator ) delete thePropagator;
00065   if ( theExternalPropagator ) delete theExternalPropagator;
00066 }
00067 
00068 
00069 bool KalmanAlignmentSetup::useForTracking( const ConstRecHitPointer& recHit ) const
00070 {
00071   const DetId detId( recHit->det()->geographicalId() );
00072   const SubDetId subdetId( detId.subdetId() );
00073 
00074 //   const GlobalPoint position( recHit->det()->position() );
00075 //   if ( ( position.phi() < 0.785 ) || ( position.phi() > 2.356 ) ) return false;
00076 
00077   std::vector< SubDetId >::const_iterator itFindSubDetId =
00078     std::find( theTrackingSubDetIds.begin(), theTrackingSubDetIds.end(), subdetId );
00079 
00080 //   bool doubleSided = false;
00081 //   if ( subdetId == 3 ) 
00082 //   { 
00083 //     TIBDetId tibid( detId.rawId() ); 
00084 //     if ( tibid.layer() < 3 ) doubleSided = true;
00085 //   }
00086 //   else if ( subdetId == 5 )
00087 //   { 
00088 //     TOBDetId tobid( detId.rawId() ); 
00089 //     if ( tobid.layer() < 3 ) doubleSided = true;
00090 //   }
00091 
00092   return ( itFindSubDetId != theTrackingSubDetIds.end() );// && doubleSided;
00093 
00094 }
00095 
00096 
00097 bool KalmanAlignmentSetup::useForExternalTracking( const ConstRecHitPointer& recHit ) const
00098 {
00099 
00100   const DetId detId( recHit->det()->geographicalId() );
00101   const SubDetId subdetId( detId.subdetId() );
00102 
00103 //   const GlobalPoint position( recHit->det()->position() );
00104 //   if ( ( position.phi() < 0.785 ) || ( position.phi() > 2.356 ) ) return false;
00105 
00106   std::vector< SubDetId >::const_iterator itFindSubDetId =
00107     std::find( theExternalTrackingSubDetIds.begin(), theExternalTrackingSubDetIds.end(), subdetId );
00108 
00109 //   bool doubleSided = false;
00110 //   if ( subdetId == 3 ) 
00111 //   { 
00112 //     TIBDetId tibid( detId.rawId() ); 
00113 //     if ( tibid.layer() < 3 ) doubleSided = true;
00114 //   }
00115 //   else if ( subdetId == 5 )
00116 //   { 
00117 //     TOBDetId tobid( detId.rawId() ); 
00118 //     if ( tobid.layer() < 3 ) doubleSided = true;
00119 //   }
00120 
00121   return ( itFindSubDetId != theExternalTrackingSubDetIds.end() );// && !doubleSided;
00122 }