Go to the documentation of this file.00001
00014 #ifndef MuonIdentification_MuonShowerInformationFiller_h
00015 #define MuonIdentification_MuonShowerInformationFiller_h
00016
00017 #include <vector>
00018
00019 #include "FWCore/Framework/interface/Frameworkfwd.h"
00020 #include "DataFormats/Common/interface/ValueMap.h"
00021
00022 #include "FWCore/Framework/interface/ESHandle.h"
00023 #include "FWCore/Utilities/interface/InputTag.h"
00024 #include "DataFormats/Common/interface/Handle.h"
00025 #include "DataFormats/Math/interface/deltaPhi.h"
00026 #include "DataFormats/Math/interface/deltaR.h"
00027 #include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
00028 #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
00029 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
00030 #include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
00031 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
00032 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00033 #include "DataFormats/MuonReco/interface/Muon.h"
00034 #include "DataFormats/TrackReco/interface/Track.h"
00035 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00036
00037 #include "Geometry/DTGeometry/interface/DTGeometry.h"
00038 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
00039
00040 #include "DataFormats/MuonReco/interface/MuonShower.h"
00041
00042 namespace edm {class ParameterSet; class Event; class EventSetup;}
00043 namespace reco {class TransientTrack; class MuonShower;}
00044
00045 class MuonServiceProxy;
00046 class Trajectory;
00047 class Cylinder;
00048 class BoundDisk;
00049 class BarrelDetLayer;
00050 class ForwardDetLayer;
00051 class TransientTrackingRecHitBuilder;
00052 class GeometricSearchTracker;
00053 class GlobalTrackingGeometry;
00054 class MuonDetLayerGeometry;
00055
00056
00057 class MuonShowerInformationFiller {
00058
00059 public:
00060
00061 typedef TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer;
00062 typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer;
00063 typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer;
00064
00065 public:
00066
00068 MuonShowerInformationFiller() {};
00069 MuonShowerInformationFiller(const edm::ParameterSet&);
00070
00072 ~MuonShowerInformationFiller();
00073
00075 reco::MuonShower fillShowerInformation( const reco::Muon& muon, const edm::Event&, const edm::EventSetup&);
00076
00078 virtual void setEvent(const edm::Event&);
00079
00081 void setServices(const edm::EventSetup&);
00082
00083
00084 void fillHitsByStation(const reco::Muon&);
00085
00086 protected:
00087
00088 const MuonServiceProxy* getService() const { return theService; }
00089
00090 private:
00091
00092 std::vector<float> theStationShowerDeltaR;
00093 std::vector<float> theStationShowerTSize;
00094 std::vector<int> theAllStationHits;
00095 std::vector<int> theCorrelatedStationHits;
00096
00097 MuonServiceProxy* theService;
00098
00099 GlobalPoint crossingPoint(const GlobalPoint&, const GlobalPoint&, const BarrelDetLayer* ) const;
00100 GlobalPoint crossingPoint(const GlobalPoint&, const GlobalPoint&, const Cylinder& ) const;
00101 GlobalPoint crossingPoint(const GlobalPoint&, const GlobalPoint&, const ForwardDetLayer* ) const;
00102 GlobalPoint crossingPoint(const GlobalPoint&, const GlobalPoint&, const BoundDisk& ) const;
00103 std::vector<const GeomDet*> dtPositionToDets(const GlobalPoint&) const;
00104 std::vector<const GeomDet*> cscPositionToDets(const GlobalPoint&) const;
00105 MuonRecHitContainer findPerpCluster(MuonRecHitContainer& muonRecHits) const;
00106 MuonRecHitContainer findPhiCluster(MuonRecHitContainer&, const GlobalPoint&) const;
00107 TransientTrackingRecHit::ConstRecHitContainer findThetaCluster(TransientTrackingRecHit::ConstRecHitContainer&, const GlobalPoint&) const;
00108 TransientTrackingRecHit::ConstRecHitContainer hitsFromSegments(const GeomDet*,edm::Handle<DTRecSegment4DCollection>, edm::Handle<CSCSegmentCollection>) const;
00109 std::vector<const GeomDet*> getCompatibleDets(const reco::Track&) const;
00110
00111 struct LessMag {
00112 LessMag(const GlobalPoint& point) : thePoint(point) {}
00113 bool operator()(const GlobalPoint& lhs,
00114 const GlobalPoint& rhs) const{
00115 return (lhs - thePoint).mag() < (rhs -thePoint).mag();
00116 }
00117 bool operator()(const MuonTransientTrackingRecHit::MuonRecHitPointer& lhs,
00118 const MuonTransientTrackingRecHit::MuonRecHitPointer& rhs) const{
00119 return (lhs->globalPosition() - thePoint).mag() < (rhs->globalPosition() -thePoint).mag();
00120 }
00121 GlobalPoint thePoint;
00122 };
00123
00124 struct LessDPhi {
00125 LessDPhi(const GlobalPoint& point) : thePoint(point) {}
00126 bool operator()(const MuonTransientTrackingRecHit::MuonRecHitPointer& lhs,
00127 const MuonTransientTrackingRecHit::MuonRecHitPointer& rhs) const{
00128 return deltaPhi(lhs->globalPosition().phi(), thePoint.phi()) < deltaPhi(rhs->globalPosition().phi(), thePoint.phi());
00129 }
00130 GlobalPoint thePoint;
00131 };
00132
00133 struct AbsLessDPhi {
00134 AbsLessDPhi(const GlobalPoint& point) : thePoint(point) {}
00135 bool operator()(const MuonTransientTrackingRecHit::MuonRecHitPointer& lhs,
00136 const MuonTransientTrackingRecHit::MuonRecHitPointer& rhs) const{
00137 return ( fabs(deltaPhi(lhs->globalPosition().phi(), thePoint.phi())) < fabs(deltaPhi(rhs->globalPosition().phi(), thePoint.phi())) );
00138 }
00139 GlobalPoint thePoint;
00140 };
00141
00142 struct AbsLessDTheta {
00143 AbsLessDTheta(const GlobalPoint& point) : thePoint(point) {}
00144 bool operator()(const TransientTrackingRecHit::ConstRecHitPointer& lhs,
00145 const TransientTrackingRecHit::ConstRecHitPointer& rhs) const{
00146 return ( fabs(lhs->globalPosition().phi() - thePoint.phi()) < fabs(rhs->globalPosition().phi() - thePoint.phi()) );
00147 }
00148 GlobalPoint thePoint;
00149 };
00150
00151 struct LessPhi {
00152 LessPhi() : thePoint(0,0,0) {}
00153 bool operator()(const MuonTransientTrackingRecHit::MuonRecHitPointer& lhs,
00154 const MuonTransientTrackingRecHit::MuonRecHitPointer& rhs) const{
00155 return (lhs->globalPosition().phi() < rhs->globalPosition().phi());
00156 }
00157 GlobalPoint thePoint;
00158 };
00159
00160 struct LessPerp {
00161 LessPerp() : thePoint(0,0,0) {}
00162 bool operator()(const MuonTransientTrackingRecHit::MuonRecHitPointer& lhs,
00163 const MuonTransientTrackingRecHit::MuonRecHitPointer& rhs) const{
00164 return (lhs->globalPosition().perp() < rhs->globalPosition().perp());
00165 }
00166 GlobalPoint thePoint;
00167 };
00168
00169 struct LessAbsMag {
00170 LessAbsMag() : thePoint(0,0,0) {}
00171 bool operator()(const MuonTransientTrackingRecHit::MuonRecHitPointer& lhs,
00172 const MuonTransientTrackingRecHit::MuonRecHitPointer& rhs) const{
00173 return (lhs->globalPosition().mag() < rhs->globalPosition().mag());
00174 }
00175 GlobalPoint thePoint;
00176 };
00177
00178 std::string category_;
00179
00180 unsigned long long theCacheId_TRH;
00181 unsigned long long theCacheId_MT;
00182
00183 std::string theTrackerRecHitBuilderName;
00184 edm::ESHandle<TransientTrackingRecHitBuilder> theTrackerRecHitBuilder;
00185
00186 std::string theMuonRecHitBuilderName;
00187 edm::ESHandle<TransientTrackingRecHitBuilder> theMuonRecHitBuilder;
00188
00189 edm::InputTag theDTRecHitLabel;
00190 edm::InputTag theCSCRecHitLabel;
00191 edm::InputTag theCSCSegmentsLabel;
00192 edm::InputTag theDT4DRecSegmentLabel;
00193 edm::Handle<DTRecHitCollection> theDTRecHits;
00194 edm::Handle<CSCRecHit2DCollection> theCSCRecHits;
00195 edm::Handle<CSCSegmentCollection> theCSCSegments;
00196 edm::Handle<DTRecSegment4DCollection> theDT4DRecSegments;
00197
00198
00199 edm::ESHandle<GeometricSearchTracker> theTracker;
00200 edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
00201 edm::ESHandle<MagneticField> theField;
00202 edm::ESHandle<CSCGeometry> theCSCGeometry;
00203 edm::ESHandle<DTGeometry> theDTGeometry;
00204
00205 };
00206 #endif