File indexing completed on 2024-04-06 12:27:10
0001 #ifndef RecoMuon_MCSeedGenerator_MCMuonSeedGenerator_H
0002 #define RecoMuon_MCSeedGenerator_MCMuonSeedGenerator_H
0003
0004
0005
0006
0007
0008
0009
0010 #include "FWCore/Framework/interface/stream/EDProducer.h"
0011 #include "FWCore/Utilities/interface/InputTag.h"
0012 #include "FWCore/Framework/interface/ESHandle.h"
0013
0014 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
0015 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0016
0017 #include "DataFormats/DetId/interface/DetId.h"
0018 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0019
0020 class MuonServiceProxy;
0021 class TrajectorySeed;
0022 class SimTrack;
0023 class SimVertex;
0024
0025 namespace edm {
0026 class ParameterSet;
0027 class Event;
0028 class EventSetup;
0029 }
0030
0031 class MCMuonSeedGenerator2 : public edm::stream::EDProducer<> {
0032 public:
0033 enum SeedType { FromHits, FromTracks };
0034
0035
0036 MCMuonSeedGenerator2(const edm::ParameterSet &);
0037
0038
0039 ~MCMuonSeedGenerator2();
0040
0041
0042
0043 virtual void produce(edm::Event &, const edm::EventSetup &);
0044
0045 private:
0046 struct RadiusComparatorInOut {
0047 RadiusComparatorInOut(edm::ESHandle<GlobalTrackingGeometry> tg) : theTG(tg) {}
0048
0049 bool operator()(const PSimHit *a, const PSimHit *b) const {
0050 const GeomDet *geomDetA = theTG->idToDet(DetId(a->detUnitId()));
0051 const GeomDet *geomDetB = theTG->idToDet(DetId(b->detUnitId()));
0052
0053 double distA = geomDetA->toGlobal(a->localPosition()).mag();
0054 double distB = geomDetB->toGlobal(b->localPosition()).mag();
0055
0056 return distA < distB;
0057 }
0058
0059 edm::ESHandle<GlobalTrackingGeometry> theTG;
0060 };
0061
0062 private:
0063 TrajectorySeed *createSeedFromHit(const PSimHit *);
0064 TrajectorySeed *createSeedFromTrack(const SimTrack &simTrack, const SimVertex &simVertex, DetId detId);
0065
0066 edm::InputTag theCSCSimHitLabel;
0067 edm::InputTag theDTSimHitLabel;
0068 edm::InputTag theRPCSimHitLabel;
0069 edm::InputTag theSimTrackLabel;
0070 edm::InputTag theSimVertexLabel;
0071
0072 SeedType theSeedType;
0073
0074
0075 MuonServiceProxy *theService;
0076
0077 double theErrorScale;
0078 };
0079
0080 #endif