CMS 3D CMS Logo

TrackDetectorAssociator.h

Go to the documentation of this file.
00001 #ifndef TrackAssociator_TrackDetectorAssociator_h
00002 #define TrackAssociator_TrackDetectorAssociator_h 1
00003 
00004 // -*- C++ -*-
00005 //
00006 // Package:    TrackAssociator
00007 // Class:      TrackDetectorAssociator
00008 // 
00009 /*
00010 
00011  Description: main class of tools to associate a track to calorimeter and muon detectors
00012 
00013 */
00014 //
00015 // Original Author:  Dmytro Kovalskyi
00016 //         Created:  Fri Apr 21 10:59:41 PDT 2006
00017 // $Id: TrackDetectorAssociator.h,v 1.14 2008/08/07 02:06:23 dmytro Exp $
00018 //
00019 //
00020 
00021 #include "FWCore/Framework/interface/Event.h"
00022 #include "FWCore/Framework/interface/EventSetup.h"
00023 #include "DataFormats/Common/interface/Handle.h"
00024 #include "FWCore/Framework/interface/ESHandle.h"
00025 #include "DataFormats/Common/interface/OrphanHandle.h"
00026 
00027 #include "DataFormats/TrackReco/interface/TrackBase.h"
00028 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00029 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
00030 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00031 
00032 #include "TrackingTools/TrackAssociator/interface/CaloDetIdAssociator.h"
00033 #include "TrackingTools/TrackAssociator/interface/EcalDetIdAssociator.h"
00034 #include "TrackingTools/TrackAssociator/interface/MuonDetIdAssociator.h"
00035 #include "TrackingTools/TrackAssociator/interface/HcalDetIdAssociator.h"
00036 #include "TrackingTools/TrackAssociator/interface/HODetIdAssociator.h"
00037 
00038 #include "TrackingTools/TrackAssociator/interface/TrackDetMatchInfo.h"
00039 #include "TrackingTools/TrackAssociator/interface/CachedTrajectory.h"
00040 
00041 #include "DataFormats/CaloTowers/interface/CaloTower.h"
00042 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
00043 #include "DataFormats/TrackReco/interface/Track.h"
00044 #include "DataFormats/TrackingRecHit/interface/RecSegment.h"
00045 
00046 #include "SimDataFormats/Track/interface/SimTrack.h"
00047 #include "SimDataFormats/Vertex/interface/SimVertex.h"
00048 
00049 #include "TrackingTools/TrackAssociator/interface/TrackAssociatorParameters.h"
00050 
00051 class TrackDetectorAssociator {
00052  public:
00053    TrackDetectorAssociator();
00054    ~TrackDetectorAssociator();
00055    
00056    typedef TrackAssociatorParameters AssociatorParameters;
00057    enum Direction { Any, InsideOut, OutsideIn };
00058    
00072    TrackDetMatchInfo            associate( const edm::Event&,
00073                                            const edm::EventSetup&,
00074                                            const FreeTrajectoryState&,
00075                                            const AssociatorParameters& );
00078    TrackDetMatchInfo            associate( const edm::Event& iEvent,
00079                                            const edm::EventSetup& iSetup,
00080                                            const AssociatorParameters& parameters,
00081                                            const FreeTrajectoryState* innerState,
00082                                            const FreeTrajectoryState* outerState=0);
00084    TrackDetMatchInfo            associate( const edm::Event&,
00085                                            const edm::EventSetup&,
00086                                            const reco::Track&,
00087                                            const AssociatorParameters&,
00088                                            Direction direction = Any );
00090    TrackDetMatchInfo            associate( const edm::Event&,
00091                                            const edm::EventSetup&,
00092                                            const SimTrack&,
00093                                            const SimVertex&,
00094                                            const AssociatorParameters& );
00096    TrackDetMatchInfo            associate( const edm::Event&,
00097                                            const edm::EventSetup&,
00098                                            const GlobalVector&,
00099                                            const GlobalPoint&,
00100                                            const int,
00101                                            const AssociatorParameters& );
00102    
00104    void setPropagator( const Propagator* );
00105    
00107    void useDefaultPropagator();
00108    
00110    static FreeTrajectoryState getFreeTrajectoryState( const edm::EventSetup&, 
00111                                                       const reco::Track& );
00112    static FreeTrajectoryState getFreeTrajectoryState( const edm::EventSetup&, 
00113                                                       const SimTrack&, 
00114                                                       const SimVertex& );
00115    static FreeTrajectoryState getFreeTrajectoryState( const edm::EventSetup&,
00116                                                       const GlobalVector&,
00117                                                       const GlobalPoint&,
00118                                                       const int);
00119         
00120    static bool                crossedIP(const reco::Track& track);
00121 
00122  private:
00123    DetIdAssociator::MapRange getMapRange( const std::pair<float,float>& delta,
00124                                           const float dR );
00125 
00126    void fillEcal(       const edm::Event&,
00127                         TrackDetMatchInfo&, 
00128                         const AssociatorParameters&);
00129    
00130    void fillCaloTowers( const edm::Event&,
00131                         TrackDetMatchInfo&,
00132                         const AssociatorParameters&);
00133    
00134    void fillHcal(       const edm::Event&,
00135                         TrackDetMatchInfo&,
00136                         const AssociatorParameters&);
00137    
00138    void fillHO(         const edm::Event&,
00139                         TrackDetMatchInfo&,
00140                         const AssociatorParameters&);
00141   
00142    void fillMuon(       const edm::Event&,
00143                         TrackDetMatchInfo&,
00144                         const AssociatorParameters&);
00145    
00146    void fillCaloTruth(  const edm::Event&,
00147                         TrackDetMatchInfo&,
00148                         const AssociatorParameters&);
00149    
00150    void addTAMuonSegmentMatch(TAMuonChamberMatch&,
00151                             const RecSegment*,
00152                             const AssociatorParameters&);
00153    
00154    void getTAMuonChamberMatches(std::vector<TAMuonChamberMatch>& matches,
00155                               const AssociatorParameters& parameters);
00156   
00157    void           init( const edm::EventSetup&);
00158    
00159    math::XYZPoint getPoint( const GlobalPoint& point)
00160      {
00161         return math::XYZPoint(point.x(),point.y(),point.z());
00162      }
00163    
00164    math::XYZPoint getPoint( const LocalPoint& point)
00165      {
00166         return math::XYZPoint(point.x(),point.y(),point.z());
00167      }
00168    
00169    math::XYZVector getVector( const GlobalVector& vec)
00170      {
00171         return math::XYZVector(vec.x(),vec.y(),vec.z());
00172      }
00173    
00174    math::XYZVector getVector( const LocalVector& vec)
00175      {
00176         return math::XYZVector(vec.x(),vec.y(),vec.z());
00177      }
00178    
00179    const Propagator* ivProp_;
00180    Propagator* defProp_;
00181    CachedTrajectory cachedTrajectory_;
00182    bool useDefaultPropagator_;
00183    
00184    edm::ESHandle<DetIdAssociator> ecalDetIdAssociator_;
00185    edm::ESHandle<DetIdAssociator> hcalDetIdAssociator_;
00186    edm::ESHandle<DetIdAssociator>   hoDetIdAssociator_;
00187    edm::ESHandle<DetIdAssociator> caloDetIdAssociator_;
00188    edm::ESHandle<DetIdAssociator> muonDetIdAssociator_;
00189    
00190    edm::ESHandle<CaloGeometry> theCaloGeometry_;
00191    edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry_;
00192 };
00193 #endif

Generated on Tue Jun 9 17:48:28 2009 for CMSSW by  doxygen 1.5.4