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("l1tTTTracksFromTrackletEmulation", "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 
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:232
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > ecalCandsToken_
Definition: config.py:1
edm::Ref< ElectronCollection > ElectronRef
reference to an object in a collection of Electron objects
Definition: ElectronFwd.h:15
static edm::ParameterSetDescription makePSetDescription()
U second(std::pair< T, U > const &p)
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< reco::ElectronCollection > elesToken_
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::pair< int, double > calIsol(const reco::TrackBase &trk, const L1TrackCollection &l1Tks) const
std::vector< Electron > ElectronCollection
collectin of Electron objects
Definition: ElectronFwd.h:9
EgammaHLTEleL1TrackIsolProducer(const edm::ParameterSet &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
fixed size matrix
HLT enums.
~EgammaHLTEleL1TrackIsolProducer() override=default
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< L1Track > L1TrackCollection
Definition: L1Track.h:9
def move(src, dest)
Definition: eostools.py:511
const edm::EDGetTokenT< L1TrackCollection > l1TrksToken_