Go to the documentation of this file.00001 #include "RecoTracker/DebugTools/interface/GetTrackTrajInfo.h"
00002
00003 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
00004 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
00005 #include "RecoTracker/Record/interface/CkfComponentsRecord.h"
00006
00007
00008 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00009 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00010
00011 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00012 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00013 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00014 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00015 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00016 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00017
00018 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h"
00019 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
00020
00021 #include "TrackingTools/DetLayers/interface/NavigationSchool.h"
00022 #include "RecoTracker/Record/interface/NavigationSchoolRecord.h"
00023 #include "TrackingTools/DetLayers/interface/NavigationSetter.h"
00024
00025 #include "TrackingTools/Records/interface/TransientTrackRecord.h"
00026 #include "DataFormats/Math/interface/deltaPhi.h"
00027
00028 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00029
00030 #include "FWCore/Utilities/interface/Exception.h"
00031
00032 std::vector< GetTrackTrajInfo::Result > GetTrackTrajInfo::analyze(const edm::EventSetup& iSetup, const reco::Track& track)
00033 {
00034
00035
00036 std::vector< GetTrackTrajInfo::Result > results;
00037
00038
00039 edm::ESHandle<GeometricSearchTracker> tracker;
00040 iSetup.get<TrackerRecoGeometryRecord>().get( tracker );
00041
00042
00043 edm::ESHandle<NavigationSchool> theSchool;
00044 iSetup.get<NavigationSchoolRecord>().get("SimpleNavigationSchool",theSchool);
00045 NavigationSetter junk(*theSchool);
00046
00047
00048 edm::ESHandle<MagneticField> magField;
00049 iSetup.get<IdealMagneticFieldRecord>().get(magField);
00050 AnalyticalPropagator propagator(&(*magField), alongMomentum);
00051
00052
00053
00054
00055 Chi2MeasurementEstimator estimator(30.,3.0);
00056
00057
00058 iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",trkTool_);
00059 reco::TransientTrack t_trk = trkTool_->build(track);
00060 TrajectoryStateOnSurface initTSOS = t_trk.impactPointState();
00061 LogDebug("GTTI")<<"TRACK TSOS POS: x="<<initTSOS.globalPosition().x()<<" y="<<initTSOS.globalPosition().y()<<" z="<<initTSOS.globalPosition().z();
00062
00063
00064
00065
00066
00067
00068 bool posSide = track.eta() > 0;
00069
00070
00071 const reco::HitPattern& hp = track.hitPattern();
00072
00073
00074
00075
00076 for (int i = 0; i < hp.numberOfHits(); i++) {
00077 uint32_t hit = hp.getHitPattern(i);
00078 if (hp.trackerHitFilter(hit) && hp.validHitFilter(hit)) {
00079 uint32_t subDet = hp.getSubStructure(hit);
00080 uint32_t layer = hp.getLayer(hit);
00081
00082 LogDebug("GTTI")<<" hit in subdet="<<subDet<<" layer="<<layer;
00083
00084
00085 const DetLayer* detLayer = 0;
00086 if (subDet == StripSubdetector::TIB) {
00087 detLayer = tracker->tibLayers()[layer - 1];
00088 } else if (subDet == StripSubdetector::TOB) {
00089 detLayer = tracker->tobLayers()[layer - 1];
00090 } else if (subDet == StripSubdetector::TID) {
00091 detLayer = posSide ? tracker->posTidLayers()[layer - 1] : tracker->negTidLayers()[layer - 1];
00092 } else if (subDet == StripSubdetector::TEC) {
00093 detLayer = posSide ? tracker->posTecLayers()[layer - 1] : tracker->negTecLayers()[layer - 1];
00094 } else if (subDet == PixelSubdetector::PixelBarrel) {
00095 detLayer = tracker->pixelBarrelLayers()[layer - 1];
00096 } else if (subDet == PixelSubdetector::PixelEndcap) {
00097 detLayer = posSide ? tracker->posPixelForwardLayers()[layer - 1] : tracker->negPixelForwardLayers()[layer - 1];
00098 }
00099
00100
00101 Result result;
00102 result.detLayer = detLayer;
00103
00104
00105 std::pair<bool, TrajectoryStateOnSurface> layCross = detLayer->compatible(initTSOS, propagator, estimator);
00106 if (layCross.first) {
00107 LogDebug("GTTI")<<"crossed layer at "<<" x="<<layCross.second.globalPosition().x()<<" y="<<layCross.second.globalPosition().y()<<" z="<<layCross.second.globalPosition().z();
00108
00109
00110
00111 const PropagationDirection along = alongMomentum;
00112 propagator.setPropagationDirection(along);
00113 std::vector< GeometricSearchDet::DetWithState > detWithState = detLayer->compatibleDets(initTSOS, propagator, estimator);
00114
00115 if(detWithState.size() > 0) {
00116
00117 result.valid = true;
00118 result.accurate = true;
00119 result.detTSOS = detWithState.front().second;
00120 LogDebug("GTTI")<<" Det in this layer compatible with TSOS: subdet="<<subDet<<" layer="<<layer;
00121 LogDebug("GTTI")<<" crossed sensor at x="<<result.detTSOS.globalPosition().x()<<" y="<<result.detTSOS.globalPosition().y()<<" z="<<result.detTSOS.globalPosition().z();
00122
00123 } else {
00124
00125 result.valid = true;
00126 result.accurate = false;
00127 result.detTSOS = layCross.second;
00128 LogDebug("GTTI")<<" WARNING: TSOS not compatible with any det in this layer, despite having a hit in it !";
00129 }
00130
00131 } else {
00132
00133 result.valid = false;
00134 LogDebug("GTTI")<<" WARNING: track failed to cross layer, despite having a hit in hit !";
00135 }
00136
00137 results.push_back(result);
00138 }
00139 }
00140
00141 return results;
00142 }