Go to the documentation of this file.00001
00008 #include "RecoMuon/DetLayers/interface/MuDetRing.h"
00009 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00010 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00011 #include "TrackingTools/DetLayers/interface/MeasurementEstimator.h"
00012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00013
00014 #include <iostream>
00015 #include <vector>
00016
00017 using namespace std;
00018
00019 MuDetRing::MuDetRing(vector<const GeomDet*>::const_iterator first,
00020 vector<const GeomDet*>::const_iterator last) :
00021 ForwardDetRingOneZ(first,last)
00022 {
00023 init();
00024 }
00025
00026
00027 MuDetRing::MuDetRing(const vector<const GeomDet*>& vdets) :
00028 ForwardDetRingOneZ(vdets)
00029 {
00030 init();
00031 }
00032
00033
00034 void MuDetRing::init()
00035 {
00036 theBinFinder = BinFinderType(basicComponents().front()->position().phi(),
00037 basicComponents().size());
00038 }
00039
00040 MuDetRing::~MuDetRing(){}
00041
00042
00043 const vector<const GeometricSearchDet*>&
00044 MuDetRing::components() const {
00045
00046 cout << "temporary dummy implementation of MuDetRing::components()!!" << endl;
00047 static vector<const GeometricSearchDet*> result;
00048 return result;
00049 }
00050
00051
00052 pair<bool, TrajectoryStateOnSurface>
00053 MuDetRing::compatible(const TrajectoryStateOnSurface& ts, const Propagator& prop,
00054 const MeasurementEstimator& est) const {
00055
00056 const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuDetRing";
00057 TrajectoryStateOnSurface ms = prop.propagate(ts,specificSurface());
00058
00059 LogTrace(metname) << "MuDetRing::compatible, Surface at Z: "
00060 << specificSurface().position().z()
00061 << " R1: " << specificSurface().innerRadius()
00062 << " R2: " << specificSurface().outerRadius()
00063 << " TS at Z,R: " << ts.globalPosition().z() << ","
00064 << ts.globalPosition().perp();
00065 if (ms.isValid()) {
00066 LogTrace(metname) << " DEST at Z,R: " << ms.globalPosition().z() << ","
00067 << ms.globalPosition().perp()
00068 << " local Z: " << ms.localPosition().z() << endl;
00069 }
00070 else
00071 LogTrace(metname) << " DEST: not valid" <<endl;
00072
00073
00074 if (ms.isValid()) return make_pair(est.estimate(ms, specificSurface()) != 0, ms);
00075 else return make_pair(false, ms);
00076 }
00077
00078
00079 vector<GeometricSearchDet::DetWithState>
00080 MuDetRing::compatibleDets( const TrajectoryStateOnSurface& startingState,
00081 const Propagator& prop,
00082 const MeasurementEstimator& est) const {
00083
00084 const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuDetRing";
00085
00086 LogTrace(metname) << "MuDetRing::compatibleDets, Surface at Z: "
00087 << surface().position().z()
00088 << " R1: " << specificSurface().innerRadius()
00089 << " R2: " << specificSurface().outerRadius()
00090 << " TS at Z,R: " << startingState.globalPosition().z() << ","
00091 << startingState.globalPosition().perp() << " DetRing pos." << position();
00092
00093 vector<DetWithState> result;
00094
00095
00096 pair<bool, TrajectoryStateOnSurface> compat =
00097 compatible(startingState, prop, est);
00098 if (!compat.first) {
00099 LogTrace(metname) << " MuDetRing::compatibleDets: not compatible"
00100 << " (should not have been selected!)";
00101 return result;
00102 }
00103
00104
00105 TrajectoryStateOnSurface& tsos = compat.second;
00106 GlobalPoint startPos = tsos.globalPosition();
00107 int closest = theBinFinder.binIndex(startPos.phi());
00108 const vector<const GeomDet*> dets = basicComponents();
00109 LogTrace(metname) << " MuDetRing::compatibleDets, closest det: " << closest
00110 << " Phi: " << dets[closest]->surface().position().phi()
00111 << " impactPhi " << startPos.phi();
00112
00113
00114
00115 add(closest, result, tsos, prop, est);
00116
00117 int nclosest = result.size(); int nnextdet=0;
00118
00119
00120 float dphi=0;
00121 if (!result.empty()) {
00122 float nSigmas = 3.;
00123 if (result.back().second.hasError()) {
00124 dphi = nSigmas*
00125 atan(sqrt(result.back().second.localError().positionError().xx())/
00126 result.back().second.globalPosition().perp());
00127 }
00128 } else {
00129 LogTrace(metname) << " MuDetRing::compatibleDets, closest not compatible!";
00130
00131 }
00132
00133 for (int idet=closest+1; idet < closest+int(dets.size())/4+1; idet++){
00134
00135
00136 int idetp = theBinFinder.binIndex(idet);
00137 {
00138 LogTrace(metname) << " next det:" << idetp
00139 << " at Z: " << dets[idetp]->position().z()
00140 << " phi: " << dets[idetp]->position().phi()
00141 << " FTS phi " << startPos.phi()
00142 << " max dphi " << dphi;
00143 nnextdet++;
00144 if ( !add(idetp, result, tsos, prop, est)) break;
00145 }
00146 }
00147
00148 for (int idet=closest-1; idet > closest-int(dets.size())/4-1; idet--){
00149
00150
00151 int idetp = theBinFinder.binIndex(idet);
00152 {
00153 LogTrace(metname) << " previous det:" << idetp << " " << idet << " " << closest-dets.size()/4-1
00154 << " at Z: " << dets[idetp]->position().z()
00155 << " phi: " << dets[idetp]->position().phi()
00156 << " FTS phi " << startPos.phi()
00157 << " max dphi" << dphi;
00158 nnextdet++;
00159 if ( !add(idetp, result, tsos, prop, est)) break;
00160 }
00161 }
00162
00163 LogTrace(metname) << " MuDetRing::compatibleDets, size: " << result.size()
00164 << " on closest: " << nclosest << " # checked dets: " << nnextdet+1;
00165
00166 if (result.size()==0) {
00167 LogTrace(metname) << " ***Ring not compatible,should have been discarded before!!!";
00168 }
00169
00170 return result;
00171 }
00172
00173
00174 vector<DetGroup>
00175 MuDetRing::groupedCompatibleDets( const TrajectoryStateOnSurface& startingState,
00176 const Propagator& prop,
00177 const MeasurementEstimator& est) const {
00178
00179
00180 cout << "dummy implementation of MuDetRod::groupedCompatibleDets()" << endl;
00181 vector<DetGroup> result;
00182 return result;
00183 }