CMS 3D CMS Logo

EgammaHLTEleL1TrackIsolProducer.cc
Go to the documentation of this file.
1 // Author: Sam Harper (RAL/CERN)
2 // L1 track isolation producer for the HLT
3 // A quick primer on how the E/gamma HLT works w.r.t to ID variables
4 // 1. the supercluster is the primary object
5 // 2. superclusters get id variables associated to them via association maps keyed
6 // to the supercluster
7 // However here we also need to read in electron objects as we need to solve for which
8 // GsfTrack associated to the supercluster to use for the isolation
9 // The electron producer solves for this and assigns the electron the best GsfTrack
10 // which we will use for the vz of the electron
11 // One thing which Swagata Mukherjee pointed out is that we have to be careful of
12 // is getting a bad GsfTrack with a bad vertex which will give us a fake vz which then
13 // leads to a perfectly isolated electron as that random vz is not a vertex
14 
22 
30 
32 
33 #include <memory>
34 
36 public:
38  ~EgammaHLTEleL1TrackIsolProducer() override = default;
39  void produce(edm::StreamID sid, edm::Event&, const edm::EventSetup&) const override;
40  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
41 
42 private:
47 };
48 
50  : ecalCandsToken_(consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("ecalCands"))),
51  elesToken_(consumes<reco::ElectronCollection>(config.getParameter<edm::InputTag>("eles"))),
52  l1TrksToken_(consumes<L1TrackCollection>(config.getParameter<edm::InputTag>("l1Tracks"))),
53  isolAlgo_(config.getParameter<edm::ParameterSet>("isolCfg")) {
54  produces<reco::RecoEcalCandidateIsolationMap>();
55 }
56 
59  desc.add<edm::InputTag>("ecalCands", edm::InputTag("hltEgammaCandidates"));
60  desc.add<edm::InputTag>("eles", edm::InputTag("hltEgammaGsfElectrons"));
61  desc.add<edm::InputTag>("l1Tracks", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"));
63  descriptions.add("hltEgammaHLTEleL1TrackIsolProducer", desc);
64 }
67  const edm::EventSetup& iSetup) const {
68  auto ecalCands = iEvent.getHandle(ecalCandsToken_);
69  auto eles = iEvent.getHandle(elesToken_);
70  auto l1Trks = iEvent.getHandle(l1TrksToken_);
71 
72  auto recoEcalCandMap = std::make_unique<reco::RecoEcalCandidateIsolationMap>(ecalCands);
73 
74  for (size_t candNr = 0; candNr < ecalCands->size(); candNr++) {
75  reco::RecoEcalCandidateRef recoEcalCandRef(ecalCands, candNr);
76  reco::ElectronRef eleRef;
77  for (size_t eleNr = 0; eleNr < eles->size(); eleNr++) {
78  if ((*eles)[eleNr].superCluster() == recoEcalCandRef->superCluster()) {
79  eleRef = reco::ElectronRef(eles, eleNr);
80  break;
81  }
82  }
83 
84  float isol =
85  eleRef.isNonnull() ? isolAlgo_.calIsol(*eleRef->gsfTrack(), *l1Trks).second : std::numeric_limits<float>::max();
86 
87  recoEcalCandMap->insert(recoEcalCandRef, isol);
88  }
89  iEvent.put(std::move(recoEcalCandMap));
90 }
91 
RecoEcalCandidateIsolation.h
ConfigurationDescriptions.h
EgammaHLTEleL1TrackIsolProducer::isolAlgo_
EgammaL1TkIsolation isolAlgo_
Definition: EgammaHLTEleL1TrackIsolProducer.cc:46
edm::StreamID
Definition: StreamID.h:30
reco::RecoEcalCandidateCollection
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
Definition: RecoEcalCandidateFwd.h:9
EgammaHLTEleL1TrackIsolProducer::ecalCandsToken_
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > ecalCandsToken_
Definition: EgammaHLTEleL1TrackIsolProducer.cc:43
edm::EDGetTokenT< reco::RecoEcalCandidateCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
EgammaHLTEleL1TrackIsolProducer::l1TrksToken_
const edm::EDGetTokenT< L1TrackCollection > l1TrksToken_
Definition: EgammaHLTEleL1TrackIsolProducer.cc:45
reco::ElectronRef
edm::Ref< ElectronCollection > ElectronRef
reference to an object in a collection of Electron objects
Definition: ElectronFwd.h:15
edm::Ref
Definition: AssociativeIterator.h:58
EgammaHLTEleL1TrackIsolProducer
Definition: EgammaHLTEleL1TrackIsolProducer.cc:35
config
Definition: config.py:1
MakerMacros.h
EgammaHLTEleL1TrackIsolProducer::~EgammaHLTEleL1TrackIsolProducer
~EgammaHLTEleL1TrackIsolProducer() override=default
Track.h
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
EgammaL1TkIsolation::makePSetDescription
static edm::ParameterSetDescription makePSetDescription()
Definition: EgammaL1TkIsolation.h:18
EgammaHLTEleL1TrackIsolProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: EgammaHLTEleL1TrackIsolProducer.cc:57
EgammaL1TkIsolation
Definition: EgammaL1TkIsolation.h:13
ParameterSetDescription.h
EgammaHLTEleL1TrackIsolProducer::EgammaHLTEleL1TrackIsolProducer
EgammaHLTEleL1TrackIsolProducer(const edm::ParameterSet &)
Definition: EgammaHLTEleL1TrackIsolProducer.cc:49
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
ElectronFwd.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ParameterSet
Definition: Functions.h:16
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
reco::ElectronCollection
std::vector< Electron > ElectronCollection
collectin of Electron objects
Definition: ElectronFwd.h:9
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
EgammaHLTEleL1TrackIsolProducer::elesToken_
const edm::EDGetTokenT< reco::ElectronCollection > elesToken_
Definition: EgammaHLTEleL1TrackIsolProducer.cc:44
Electron.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
RecoEcalCandidate.h
Frameworkfwd.h
EgammaHLTEleL1TrackIsolProducer::produce
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
Definition: EgammaHLTEleL1TrackIsolProducer.cc:65
RecoEcalCandidateFwd.h
ParameterSet.h
EDProducer.h
hltEgammaHLTExtra_cfi.ecalCands
ecalCands
Definition: hltEgammaHLTExtra_cfi.py:7
edm::Event
Definition: Event.h:73
EgammaL1TkIsolation.h
L1TrackCollection
std::vector< L1Track > L1TrackCollection
Definition: L1Track.h:9
edm::InputTag
Definition: InputTag.h:15
EgammaL1TkIsolation::calIsol
std::pair< int, double > calIsol(const reco::TrackBase &trk, const L1TrackCollection &l1Tks) const
Definition: EgammaL1TkIsolation.cc:32