00001 #ifndef RecoTracker_DebugTools_GetTrackTrajInfo_H 00002 #define RecoTracker_DebugTools_GetTrackTrajInfo_H 00003 00004 /* 00005 * Determine the track trajectory and detLayer at each layer that the track produces a hit in. 00006 * This info can then be used to get the coordinates and momentum vector of the track at each of these 00007 * layers etc. 00008 * 00009 * Call function analyze() for each track you are interested in. See comments below for that function. 00010 * From the "result" that it returns, you can do things such as result.detTSOS.globalPosition(), 00011 * to get the estimated position at which the track intercepts the layer. 00012 * 00013 * N.B. This information is obtained by extrapolating the track trajectory from its point of closest 00014 * approach to the beam-line. It is therefore approximate, and should not be used for hit resolution 00015 * studies. 00016 * If you are using RECO, you can get more precise results by refitting the track instead of using this 00017 * class. However, this class will work even on AOD. 00018 * 00019 * N.B. Your _cfg.py must load RecoTracker.Configuration.RecoTracker_cff to use this. 00020 * 00021 * Author: Ian Tomalin 00022 * Date: Oct. 2011 00023 */ 00024 00025 #include <memory> 00026 #include "FWCore/Framework/interface/Frameworkfwd.h" 00027 #include "FWCore/Framework/interface/Event.h" 00028 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00029 #include "FWCore/Framework/interface/ESHandle.h" 00030 00031 #include "FWCore/Framework/interface/EventSetup.h" 00032 #include "DataFormats/TrackReco/interface/Track.h" 00033 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" 00034 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" 00035 00036 #include <vector> 00037 00038 class DetLayer; 00039 00040 class GetTrackTrajInfo { 00041 00042 public: 00043 00044 // Used to return results. 00045 struct Result { 00046 // If this is false, the information in the struct for this hit is invalid, as the track trajectory 00047 // did not cross this layer. (Should only happen in very rare cases). 00048 bool valid; 00049 // If this is false, then although the track trajectory intercepted the layer, it did not intercept 00050 // a sensor inside the layer. (Can happen rarely, if the track scattered, for example). 00051 // If it is false, the detTSOS is evaluated at the intercept with the layer, not with the sensor, 00052 // so will be slightly less accurate. 00053 bool accurate; 00054 // This is the DetLayer returned by GeometricSearchTracker. 00055 // You can cast it into a specific type, such as BarrelDetLayer, before using it. 00056 const DetLayer* detLayer; 00057 // This is the track trajectory evaluated at the sensor. You can use it to get the coordinates 00058 // where the track crosses the sensor and its momentum vector at that point. 00059 TrajectoryStateOnSurface detTSOS; 00060 }; 00061 00062 GetTrackTrajInfo() {} 00063 00064 ~GetTrackTrajInfo() {} 00065 00066 // For each hit on the track, return the information listed in the struct Result above. 00067 // (See comments for struct Results). 00068 // There is a one-to-one correspondence between this vector and the hits returned by track::hitPattern(). 00069 // i.e. They are ordered by the order in which the track crossed them. 00070 std::vector<Result> analyze(const edm::EventSetup& iSetup, const reco::Track& track); 00071 00072 private: 00073 // Create map indicating r/z values of all layers/disks. 00074 void init (const edm::EventSetup& iSetup); 00075 00076 private: 00077 // Makes TransientTracks needed for vertex fitting. 00078 edm::ESHandle<TransientTrackBuilder> trkTool_; 00079 }; 00080 00081 #endif