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  template <typename T>
60  inline auto convertToGP(const T& orgPoint) {
61  return GlobalPoint(orgPoint.x(), orgPoint.y(), orgPoint.z());
62  }
63 
64  int getLayerOrDiskNr(DetId detId, const TrackerTopology& trackerTopo) {
65  if (detId.subdetId() == PixelSubdetector::PixelBarrel) {
66  return trackerTopo.pxbLayer(detId);
67  } else if (detId.subdetId() == PixelSubdetector::PixelEndcap) {
68  return trackerTopo.pxfDisk(detId);
69  } else
70  return -1;
71  }
72 
73  reco::ElectronSeed::PMVars makeSeedPixelVar(const TrajSeedMatcher::MatchInfo& matchInfo,
74  const TrackerTopology& trackerTopo) {
75  int layerOrDisk = getLayerOrDiskNr(matchInfo.detId, trackerTopo);
77  pmVars.setDet(matchInfo.detId, layerOrDisk);
78  pmVars.setDPhi(matchInfo.dPhiPos, matchInfo.dPhiNeg);
79  pmVars.setDRZ(matchInfo.dRZPos, matchInfo.dRZNeg);
80 
81  return pmVars;
82  }
83 
84 } // namespace
85 
87  : matcherConfiguration_(pset.getParameter<edm::ParameterSet>("matcherConfig"), consumesCollector()),
88  initialSeedsToken_(consumes<TrajectorySeedCollection>(pset.getParameter<edm::InputTag>("initialSeeds"))),
89  verticesToken_(consumes<std::vector<reco::Vertex>>(pset.getParameter<edm::InputTag>("vertices"))),
90  beamSpotToken_(consumes<reco::BeamSpot>(pset.getParameter<edm::InputTag>("beamSpot"))),
91  measTkEvtToken_(consumes<MeasurementTrackerEvent>(pset.getParameter<edm::InputTag>("measTkEvt"))),
92  putToken_{produces<reco::ElectronSeedCollection>()},
93  trackerTopologyToken_{esConsumes<TrackerTopology, TrackerTopologyRcd>()} {
94  for (const auto& scTag : pset.getParameter<std::vector<edm::InputTag>>("superClusters")) {
95  superClustersTokens_.emplace_back(consumes<std::vector<reco::SuperClusterRef>>(scTag));
96  }
97 }
98 
101  desc.add<edm::InputTag>("initialSeeds", {"hltElePixelSeedsCombined"});
102  desc.add<edm::InputTag>("vertices", {});
103  desc.add<edm::InputTag>("beamSpot", {"hltOnlineBeamSpot"});
104  desc.add<edm::InputTag>("measTkEvt", {"hltSiStripClusters"});
105  desc.add<std::vector<edm::InputTag>>("superClusters", {{"hltEgammaSuperClustersToPixelMatch"}});
107 
108  descriptions.add("electronNHitSeedProducer", desc);
109 }
110 
112  auto const& trackerTopology = iSetup.getData(trackerTopologyToken_);
113 
115 
116  reco::ElectronSeedCollection eleSeeds{};
117  auto const& initialSeeds = iEvent.get(initialSeedsToken_);
118 
119  auto primVtxPos = convertToGP(iEvent.get(beamSpotToken_).position());
120 
121  // Loop over all super-cluster collections (typically barrel and forward are supplied separately)
122  for (const auto& superClustersToken : superClustersTokens_) {
123  for (auto& superClusRef : iEvent.get(superClustersToken)) {
124  //the eta of the supercluster when mustache clustered is slightly biased due to bending in magnetic field
125  //the eta of its seed cluster is a better estimate of the orginal position
126  GlobalPoint caloPosition(GlobalPoint::Polar(superClusRef->seed()->position().theta(), //seed theta
127  superClusRef->position().phi(), //supercluster phi
128  superClusRef->position().r())); //supercluster r
129 
130  const auto matchedSeeds = matcher(initialSeeds, caloPosition, primVtxPos, superClusRef->energy());
131 
132  for (auto& matchedSeed : matchedSeeds) {
133  reco::ElectronSeed eleSeed(matchedSeed.seed());
134  reco::ElectronSeed::CaloClusterRef caloClusRef(superClusRef);
135  eleSeed.setCaloCluster(caloClusRef);
136  eleSeed.setNrLayersAlongTraj(matchedSeed.nrValidLayers());
137  for (auto& matchInfo : matchedSeed.matches()) {
138  eleSeed.addHitInfo(makeSeedPixelVar(matchInfo, trackerTopology));
139  }
140  eleSeeds.emplace_back(eleSeed);
141  }
142  }
143  }
144  iEvent.emplace(putToken_, std::move(eleSeeds));
145 }
146 
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
TrajSeedMatcher::MatchInfo
Definition: TrajSeedMatcher.h:67
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
ElectronNHitSeedProducer::beamSpotToken_
const edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: ElectronNHitSeedProducer.cc:52
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
TrajectorySeedCollection
std::vector< TrajectorySeed > TrajectorySeedCollection
Definition: TrajectorySeedCollection.h:6
ElectronNHitSeedProducer::putToken_
const edm::EDPutTokenT< reco::ElectronSeedCollection > putToken_
Definition: ElectronNHitSeedProducer.cc:54
align::BeamSpot
Definition: StructureType.h:89
TrajSeedMatcher.h
edm::EDGetTokenT< TrajectorySeedCollection >
TrajSeedMatcher::MatchInfo::detId
DetId detId
Definition: TrajSeedMatcher.h:69
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EDPutTokenT< reco::ElectronSeedCollection >
TrackerTopology
Definition: TrackerTopology.h:16
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:92
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
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:147
DetId
Definition: DetId.h:17
ElectronNHitSeedProducer::ElectronNHitSeedProducer
ElectronNHitSeedProducer(const edm::ParameterSet &)
Definition: ElectronNHitSeedProducer.cc:86
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
HLT_2018_cff.initialSeeds
initialSeeds
Definition: HLT_2018_cff.py:13901
TrajSeedMatcher::MatchInfo::dRZNeg
float dRZNeg
Definition: TrajSeedMatcher.h:70
reco::ElectronSeedCollection
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
Definition: ElectronSeedFwd.h:10
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
ParameterSetDescription.h
EDGetToken.h
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
Vertex.h
ElectronNHitSeedProducer::measTkEvtToken_
const edm::EDGetTokenT< MeasurementTrackerEvent > measTkEvtToken_
Definition: ElectronNHitSeedProducer.cc:53
ElectronNHitSeedProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: ElectronNHitSeedProducer.cc:99
TrajSeedMatcher::MatchInfo::dPhiNeg
float dPhiNeg
Definition: TrajSeedMatcher.h:71
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
MeasurementTrackerEvent
Definition: MeasurementTrackerEvent.h:15
edm::ParameterSet
Definition: ParameterSet.h:36
TrajSeedMatcher
Definition: TrajSeedMatcher.h:52
Event.h
ParameterSet
Definition: Functions.h:16
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
TrajSeedMatcher::MatchInfo::dRZPos
float dRZPos
Definition: TrajSeedMatcher.h:70
edm::EventSetup
Definition: EventSetup.h:57
TrajectorySeedCollection.h
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:113
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
HltBtagValidation_cff.Vertex
Vertex
Definition: HltBtagValidation_cff.py:32
SuperClusterFwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
SuperCluster.h
EventSetup.h
edm::RefToBase< CaloCluster >
TrajSeedMatcher::MatchInfo::dPhiPos
float dPhiPos
Definition: TrajSeedMatcher.h:71
ConsumesCollector.h
ParameterSet.h
EDProducer.h
reco::ElectronSeed::PMVars
Definition: ElectronSeed.h:53
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:111