CMS 3D CMS Logo

ElectronNHitSeedProducer.cc
Go to the documentation of this file.
1 //******************************************************************************
2 //
3 // Part of the refactorisation of of the E/gamma pixel matching for 2017 pixels
4 // This refactorisation converts the monolithic approach to a series of
5 // independent producer modules, with each modules performing a specific
6 // job as recommended by the 2017 tracker framework
7 //
8 //
9 // The module produces the ElectronSeeds, similarly to ElectronSeedProducer
10 // although with a varible number of required hits
11 //
12 //
13 // Author : Sam Harper (RAL), 2017
14 //
15 //*******************************************************************************
16 
25 
35 
37 
39 public:
41 
42  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const final;
43 
44  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
45 
46 private:
48 
49  std::vector<edm::EDGetTokenT<std::vector<reco::SuperClusterRef>>> superClustersTokens_;
56 };
57 
58 namespace {
59  int getLayerOrDiskNr(DetId detId, const TrackerTopology& trackerTopo) {
60  if (detId.subdetId() == PixelSubdetector::PixelBarrel) {
61  return trackerTopo.pxbLayer(detId);
62  } else if (detId.subdetId() == PixelSubdetector::PixelEndcap) {
63  return trackerTopo.pxfDisk(detId);
64  } else
65  return -1;
66  }
67 
68  reco::ElectronSeed::PMVars makeSeedPixelVar(const TrajSeedMatcher::MatchInfo& matchInfo,
69  const TrackerTopology& trackerTopo) {
70  int layerOrDisk = getLayerOrDiskNr(matchInfo.detId, trackerTopo);
72  pmVars.setDet(matchInfo.detId, layerOrDisk);
73  pmVars.setDPhi(matchInfo.dPhiPos, matchInfo.dPhiNeg);
74  pmVars.setDRZ(matchInfo.dRZPos, matchInfo.dRZNeg);
75 
76  return pmVars;
77  }
78 
79 } // namespace
80 
82  : matcherConfiguration_(pset.getParameter<edm::ParameterSet>("matcherConfig"), consumesCollector()),
83  initialSeedsToken_(consumes(pset.getParameter<edm::InputTag>("initialSeeds"))),
84  verticesToken_(consumes(pset.getParameter<edm::InputTag>("vertices"))),
85  beamSpotToken_(consumes(pset.getParameter<edm::InputTag>("beamSpot"))),
86  measTkEvtToken_(consumes(pset.getParameter<edm::InputTag>("measTkEvt"))),
87  putToken_{produces<reco::ElectronSeedCollection>()},
88  trackerTopologyToken_{esConsumes()} {
89  for (const auto& scTag : pset.getParameter<std::vector<edm::InputTag>>("superClusters")) {
90  superClustersTokens_.emplace_back(consumes(scTag));
91  }
92 }
93 
96  desc.add<edm::InputTag>("initialSeeds", {"hltElePixelSeedsCombined"});
97  desc.add<edm::InputTag>("vertices", {});
98  desc.add<edm::InputTag>("beamSpot", {"hltOnlineBeamSpot"});
99  desc.add<edm::InputTag>("measTkEvt", {"hltSiStripClusters"});
100  desc.add<std::vector<edm::InputTag>>("superClusters", {{"hltEgammaSuperClustersToPixelMatch"}});
102 
103  descriptions.add("electronNHitSeedProducer", desc);
104 }
105 
107  auto const& trackerTopology = iSetup.getData(trackerTopologyToken_);
108 
109  reco::ElectronSeedCollection eleSeeds{};
110 
112  iEvent.get(beamSpotToken_).position(),
114  iSetup,
115  iEvent.get(measTkEvtToken_)};
116 
117  // Loop over all super-cluster collections (typically barrel and forward are supplied separately)
118  for (const auto& superClustersToken : superClustersTokens_) {
119  for (auto& superClusRef : iEvent.get(superClustersToken)) {
120  //the eta of the supercluster when mustache clustered is slightly biased due to bending in magnetic field
121  //the eta of its seed cluster is a better estimate of the orginal position
122  GlobalPoint caloPosition(GlobalPoint::Polar(superClusRef->seed()->position().theta(), //seed theta
123  superClusRef->position().phi(), //supercluster phi
124  superClusRef->position().r())); //supercluster r
125 
126  for (auto const& matchedSeed : matcher(caloPosition, superClusRef->energy())) {
127  reco::ElectronSeed eleSeed(matchedSeed.seed);
128  reco::ElectronSeed::CaloClusterRef caloClusRef(superClusRef);
129  eleSeed.setCaloCluster(caloClusRef);
130  eleSeed.setNrLayersAlongTraj(matchedSeed.nrValidLayers);
131  for (auto const& matchInfo : matchedSeed.matchInfos) {
132  eleSeed.addHitInfo(makeSeedPixelVar(matchInfo, trackerTopology));
133  }
134  eleSeeds.emplace_back(eleSeed);
135  }
136  }
137  }
138  iEvent.emplace(putToken_, std::move(eleSeeds));
139 }
140 
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
TrajSeedMatcher::MatchInfo
Definition: TrajSeedMatcher.h:69
ElectronNHitSeedProducer::beamSpotToken_
const edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: ElectronNHitSeedProducer.cc:52
reco::ElectronSeed::setCaloCluster
void setCaloCluster(const CaloClusterRef &clus)
Definition: ElectronSeed.h:85
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
ElectronNHitSeedProducer::putToken_
const edm::EDPutTokenT< reco::ElectronSeedCollection > putToken_
Definition: ElectronNHitSeedProducer.cc:54
TrajSeedMatcher.h
edm::EDGetTokenT< TrajectorySeedCollection >
TrajSeedMatcher::MatchInfo::dRZNeg
const float dRZNeg
Definition: TrajSeedMatcher.h:72
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EDPutTokenT< reco::ElectronSeedCollection >
TrackerTopology
Definition: TrackerTopology.h:16
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
reco::ElectronSeed::PMVars::setDPhi
void setDPhi(float pos, float neg)
Definition: ElectronSeed.cc:174
Geom::Spherical2Cartesian
Definition: CoordinateSets.h:58
TrajSeedMatcher::makePSetDescription
static edm::ParameterSetDescription makePSetDescription()
Definition: TrajSeedMatcher.cc:118
ElectronNHitSeedProducer::superClustersTokens_
std::vector< edm::EDGetTokenT< std::vector< reco::SuperClusterRef > > > superClustersTokens_
Definition: ElectronNHitSeedProducer.cc:49
ElectronSeedFwd.h
TrackerTopology::pxbLayer
unsigned int pxbLayer(const DetId &id) const
Definition: TrackerTopology.h:144
TrajSeedMatcher::Configuration
Definition: TrajSeedMatcher.h:124
DetId
Definition: DetId.h:17
ElectronNHitSeedProducer::ElectronNHitSeedProducer
ElectronNHitSeedProducer(const edm::ParameterSet &)
Definition: ElectronNHitSeedProducer.cc:81
MakerMacros.h
TrackerTopology.h
reco::ElectronSeed
Definition: ElectronSeed.h:51
TrackerTopologyRcd.h
ElectronNHitSeedProducer::initialSeedsToken_
const edm::EDGetTokenT< TrajectorySeedCollection > initialSeedsToken_
Definition: ElectronNHitSeedProducer.cc:50
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
BeamSpot.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
reco::ElectronSeed::PMVars::setDet
void setDet(int iDetId, int iLayerOrDiskNr)
Definition: ElectronSeed.cc:184
TrajSeedMatcher::MatchInfo::dPhiPos
const float dPhiPos
Definition: TrajSeedMatcher.h:73
reco::ElectronSeedCollection
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
Definition: ElectronSeedFwd.h:10
Point3DBase< float, GlobalTag >
ParameterSetDescription.h
EDGetToken.h
reco::ElectronSeed::addHitInfo
void addHitInfo(const PMVars &hitVars)
Definition: ElectronSeed.h:89
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
ElectronNHitSeedProducer::measTkEvtToken_
const edm::EDGetTokenT< MeasurementTrackerEvent > measTkEvtToken_
Definition: ElectronNHitSeedProducer.cc:53
ElectronNHitSeedProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: ElectronNHitSeedProducer.cc:94
edm::ParameterSet
Definition: ParameterSet.h:47
TrajSeedMatcher
Definition: TrajSeedMatcher.h:54
Event.h
ParameterSet
Definition: Functions.h:16
TrajSeedMatcher::MatchInfo::detId
const DetId detId
Definition: TrajSeedMatcher.h:70
ElectronNHitSeedProducer
Definition: ElectronNHitSeedProducer.cc:38
iEvent
int iEvent
Definition: GenABIO.cc:224
TrackerTopology::pxfDisk
unsigned int pxfDisk(const DetId &id) const
Definition: TrackerTopology.h:446
edm::EventSetup
Definition: EventSetup.h:58
TrajSeedMatcher::MatchInfo::dRZPos
const float dRZPos
Definition: TrajSeedMatcher.h:71
TrajectorySeedCollection.h
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
reco::ElectronSeed::setNrLayersAlongTraj
void setNrLayersAlongTraj(int val)
Definition: ElectronSeed.h:90
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
SuperClusterFwd.h
Vertex.h
SuperCluster.h
TrajSeedMatcher::MatchInfo::dPhiNeg
const float dPhiNeg
Definition: TrajSeedMatcher.h:74
EventSetup.h
edm::RefToBase< CaloCluster >
ConsumesCollector.h
ParameterSet.h
EDProducer.h
reco::ElectronSeed::PMVars
Definition: ElectronSeed.h:53
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
ElectronNHitSeedProducer::matcherConfiguration_
const TrajSeedMatcher::Configuration matcherConfiguration_
Definition: ElectronNHitSeedProducer.cc:47
ElectronNHitSeedProducer::trackerTopologyToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
Definition: ElectronNHitSeedProducer.cc:55
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
reco::ElectronSeed::PMVars::setDRZ
void setDRZ(float pos, float neg)
Definition: ElectronSeed.cc:179
ElectronSeed.h
ElectronNHitSeedProducer::verticesToken_
const edm::EDGetTokenT< std::vector< reco::Vertex > > verticesToken_
Definition: ElectronNHitSeedProducer.cc:51
ElectronNHitSeedProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const final
Definition: ElectronNHitSeedProducer.cc:106