CMS 3D CMS Logo

PATElectronProducer.cc
Go to the documentation of this file.
1 //
3 
7 
13 
16 
19 
22 
25 
30 
39 
41 
43 
45 
46 #include <vector>
47 #include <memory>
48 
49 using namespace pat;
50 using namespace std;
51 
53  : // general configurables
54  electronToken_(consumes<edm::View<reco::GsfElectron>>(iConfig.getParameter<edm::InputTag>("electronSource"))),
55  hConversionsToken_(consumes<reco::ConversionCollection>(edm::InputTag("allConversions"))),
56  embedGsfElectronCore_(iConfig.getParameter<bool>("embedGsfElectronCore")),
57  embedGsfTrack_(iConfig.getParameter<bool>("embedGsfTrack")),
58  embedSuperCluster_(iConfig.getParameter<bool>("embedSuperCluster")),
59  embedPflowSuperCluster_(iConfig.getParameter<bool>("embedPflowSuperCluster")),
60  embedSeedCluster_(iConfig.getParameter<bool>("embedSeedCluster")),
61  embedBasicClusters_(iConfig.getParameter<bool>("embedBasicClusters")),
62  embedPreshowerClusters_(iConfig.getParameter<bool>("embedPreshowerClusters")),
63  embedPflowBasicClusters_(iConfig.getParameter<bool>("embedPflowBasicClusters")),
64  embedPflowPreshowerClusters_(iConfig.getParameter<bool>("embedPflowPreshowerClusters")),
65  embedTrack_(iConfig.getParameter<bool>("embedTrack")),
66  addGenMatch_(iConfig.getParameter<bool>("addGenMatch")),
67  embedGenMatch_(addGenMatch_ ? iConfig.getParameter<bool>("embedGenMatch") : false),
68  embedRecHits_(iConfig.getParameter<bool>("embedRecHits")),
69  // pflow configurables
70  useParticleFlow_(iConfig.getParameter<bool>("useParticleFlow")),
71  usePfCandidateMultiMap_(iConfig.getParameter<bool>("usePfCandidateMultiMap")),
72  pfElecToken_(!usePfCandidateMultiMap_
73  ? consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("pfElectronSource"))
74  : edm::EDGetTokenT<reco::PFCandidateCollection>()),
75  pfCandidateMapToken_(!usePfCandidateMultiMap_ ? mayConsume<edm::ValueMap<reco::PFCandidatePtr>>(
76  iConfig.getParameter<edm::InputTag>("pfCandidateMap"))
77  : edm::EDGetTokenT<edm::ValueMap<reco::PFCandidatePtr>>()),
78  pfCandidateMultiMapToken_(usePfCandidateMultiMap_
79  ? consumes<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(
80  iConfig.getParameter<edm::InputTag>("pfCandidateMultiMap"))
81  : edm::EDGetTokenT<edm::ValueMap<std::vector<reco::PFCandidateRef>>>()),
82  embedPFCandidate_(iConfig.getParameter<bool>("embedPFCandidate")),
83  // mva input variables
84  addMVAVariables_(iConfig.getParameter<bool>("addMVAVariables")),
85  reducedBarrelRecHitCollection_(iConfig.getParameter<edm::InputTag>("reducedBarrelRecHitCollection")),
86  reducedBarrelRecHitCollectionToken_(mayConsume<EcalRecHitCollection>(reducedBarrelRecHitCollection_)),
87  reducedEndcapRecHitCollection_(iConfig.getParameter<edm::InputTag>("reducedEndcapRecHitCollection")),
88  reducedEndcapRecHitCollectionToken_(mayConsume<EcalRecHitCollection>(reducedEndcapRecHitCollection_)),
89  ecalClusterToolsESGetTokens_{consumesCollector()},
90  // PFCluster Isolation maps
91  addPFClusterIso_(iConfig.getParameter<bool>("addPFClusterIso")),
92  addPuppiIsolation_(iConfig.getParameter<bool>("addPuppiIsolation")),
93  ecalPFClusterIsoT_(consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("ecalPFClusterIsoMap"))),
94  hcalPFClusterIsoT_(consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("hcalPFClusterIsoMap"))),
95  // embed high level selection variables?
96  embedHighLevelSelection_(iConfig.getParameter<bool>("embedHighLevelSelection")),
97  beamLineToken_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamLineSrc"))),
98  pvToken_(mayConsume<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("pvSrc"))),
99  addElecID_(iConfig.getParameter<bool>("addElectronID")),
100  pTComparator_(),
101  isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation")
102  : edm::ParameterSet(),
103  consumesCollector(),
104  false),
105  addEfficiencies_(iConfig.getParameter<bool>("addEfficiencies")),
106  addResolutions_(iConfig.getParameter<bool>("addResolutions")),
107  useUserData_(iConfig.exists("userData"))
108 
109 {
110  // MC matching configurables (scheduled mode)
111 
112  if (addGenMatch_) {
113  if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
114  genMatchTokens_.push_back(consumes<edm::Association<reco::GenParticleCollection>>(
115  iConfig.getParameter<edm::InputTag>("genParticleMatch")));
116  } else {
117  genMatchTokens_ = edm::vector_transform(
118  iConfig.getParameter<std::vector<edm::InputTag>>("genParticleMatch"),
119  [this](edm::InputTag const& tag) { return consumes<edm::Association<reco::GenParticleCollection>>(tag); });
120  }
121  }
122  // resolution configurables
123  if (addResolutions_) {
124  resolutionLoader_ = pat::helper::KinResolutionsLoader(iConfig.getParameter<edm::ParameterSet>("resolutions"));
125  }
126  if (addPuppiIsolation_) {
127  //puppi
128  PUPPIIsolation_charged_hadrons_ =
129  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiIsolationChargedHadrons"));
130  PUPPIIsolation_neutral_hadrons_ =
131  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiIsolationNeutralHadrons"));
132  PUPPIIsolation_photons_ =
133  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiIsolationPhotons"));
134  //puppiNoLeptons
135  PUPPINoLeptonsIsolation_charged_hadrons_ =
136  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationChargedHadrons"));
137  PUPPINoLeptonsIsolation_neutral_hadrons_ =
138  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationNeutralHadrons"));
139  PUPPINoLeptonsIsolation_photons_ =
140  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationPhotons"));
141  }
142  // electron ID configurables
143  if (addElecID_) {
144  // it might be a single electron ID
145  if (iConfig.existsAs<edm::InputTag>("electronIDSource")) {
146  elecIDSrcs_.push_back(NameTag("", iConfig.getParameter<edm::InputTag>("electronIDSource")));
147  }
148  // or there might be many of them
149  if (iConfig.existsAs<edm::ParameterSet>("electronIDSources")) {
150  // please don't configure me twice
151  if (!elecIDSrcs_.empty()) {
152  throw cms::Exception("Configuration")
153  << "PATElectronProducer: you can't specify both 'electronIDSource' and 'electronIDSources'\n";
154  }
155  // read the different electron ID names
156  edm::ParameterSet idps = iConfig.getParameter<edm::ParameterSet>("electronIDSources");
157  std::vector<std::string> names = idps.getParameterNamesForType<edm::InputTag>();
158  for (std::vector<std::string>::const_iterator it = names.begin(), ed = names.end(); it != ed; ++it) {
159  elecIDSrcs_.push_back(NameTag(*it, idps.getParameter<edm::InputTag>(*it)));
160  }
161  }
162  // but in any case at least once
163  if (elecIDSrcs_.empty()) {
164  throw cms::Exception("Configuration")
165  << "PATElectronProducer: id addElectronID is true, you must specify either:\n"
166  << "\tInputTag electronIDSource = <someTag>\n"
167  << "or\n"
168  << "\tPSet electronIDSources = { \n"
169  << "\t\tInputTag <someName> = <someTag> // as many as you want \n "
170  << "\t}\n";
171  }
172  }
173  elecIDTokens_ = edm::vector_transform(
174  elecIDSrcs_, [this](NameTag const& tag) { return mayConsume<edm::ValueMap<float>>(tag.second); });
175  // construct resolution calculator
176 
177  // // IsoDeposit configurables
178  // if (iConfig.exists("isoDeposits")) {
179  // edm::ParameterSet depconf = iConfig.getParameter<edm::ParameterSet>("isoDeposits");
180  // if (depconf.exists("tracker")) isoDepositLabels_.push_back(std::make_pair(TrackerIso, depconf.getParameter<edm::InputTag>("tracker")));
181  // if (depconf.exists("ecal")) isoDepositLabels_.push_back(std::make_pair(ECalIso, depconf.getParameter<edm::InputTag>("ecal")));
182  // if (depconf.exists("hcal")) isoDepositLabels_.push_back(std::make_pair(HCalIso, depconf.getParameter<edm::InputTag>("hcal")));
183 
184  // if (depconf.exists("user")) {
185  // std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
186  // std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
187  // int key = UserBaseIso;
188  // for ( ; it != ed; ++it, ++key) {
189  // isoDepositLabels_.push_back(std::make_pair(IsolationKeys(key), *it));
190  // }
191  // }
192  // }
193  // isoDepositTokens_ = edm::vector_transform(isoDepositLabels_, [this](std::pair<IsolationKeys,edm::InputTag> const & label){return consumes<edm::ValueMap<IsoDeposit> >(label.second);});
194 
195  // for mini-iso
196  computeMiniIso_ = iConfig.getParameter<bool>("computeMiniIso");
197  miniIsoParamsE_ = iConfig.getParameter<std::vector<double>>("miniIsoParamsE");
198  miniIsoParamsB_ = iConfig.getParameter<std::vector<double>>("miniIsoParamsB");
199  if (computeMiniIso_ && (miniIsoParamsE_.size() != 9 || miniIsoParamsB_.size() != 9)) {
200  throw cms::Exception("ParameterError") << "miniIsoParams must have exactly 9 elements.\n";
201  }
202  if (computeMiniIso_)
203  pcToken_ = consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("pfCandsForMiniIso"));
204 
205  // read isoDeposit labels, for direct embedding
206  readIsolationLabels(iConfig, "isoDeposits", isoDepositLabels_, isoDepositTokens_);
207  // read isolation value labels, for direct embedding
208  readIsolationLabels(iConfig, "isolationValues", isolationValueLabels_, isolationValueTokens_);
209  // read isolation value labels for non PF identified electron, for direct embedding
210  readIsolationLabels(iConfig, "isolationValuesNoPFId", isolationValueLabelsNoPFId_, isolationValueNoPFIdTokens_);
211  // Efficiency configurables
212  if (addEfficiencies_) {
213  efficiencyLoader_ =
214  pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
215  }
216  // Check to see if the user wants to add user data
217  if (useUserData_) {
218  userDataHelper_ =
219  PATUserDataHelper<Electron>(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector());
220  }
221 
222  // consistency check
223  if (useParticleFlow_ && usePfCandidateMultiMap_)
224  throw cms::Exception("Configuration", "usePfCandidateMultiMap not supported when useParticleFlow is set to true");
225 
226  // produces vector of muons
227  produces<std::vector<Electron>>();
228 }
229 
231 
233  // switch off embedding (in unschedules mode)
234  if (iEvent.isRealData()) {
235  addGenMatch_ = false;
236  embedGenMatch_ = false;
237  }
238 
239  edm::ESHandle<CaloTopology> theCaloTopology;
240  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
241  ecalTopology_ = &(*theCaloTopology);
242 
243  // Get the collection of electrons from the event
245  iEvent.getByToken(electronToken_, electrons);
246 
248  if (computeMiniIso_)
249  iEvent.getByToken(pcToken_, pc);
250 
251  // for additional mva variables
252  edm::InputTag reducedEBRecHitCollection(string("reducedEcalRecHitsEB"));
253  edm::InputTag reducedEERecHitCollection(string("reducedEcalRecHitsEE"));
254  //EcalClusterLazyTools lazyTools(iEvent, iSetup, reducedEBRecHitCollection, reducedEERecHitCollection);
255  EcalClusterLazyTools lazyTools(iEvent,
259 
260  // for conversion veto selection
262  iEvent.getByToken(hConversionsToken_, hConversions);
263 
264  // Get the ESHandle for the transient track builder, if needed for
265  // high level selection embedding
267 
268  if (isolator_.enabled())
269  isolator_.beginEvent(iEvent, iSetup);
270 
275 
277  for (size_t j = 0, nd = isoDepositTokens_.size(); j < nd; ++j) {
278  iEvent.getByToken(isoDepositTokens_[j], deposits[j]);
279  }
280 
282  for (size_t j = 0; j < isolationValueTokens_.size(); ++j) {
284  }
285 
287  for (size_t j = 0; j < isolationValueNoPFIdTokens_.size(); ++j) {
289  }
290 
291  // prepare the MC matching
292  GenAssociations genMatches(genMatchTokens_.size());
293  if (addGenMatch_) {
294  for (size_t j = 0, nd = genMatchTokens_.size(); j < nd; ++j) {
295  iEvent.getByToken(genMatchTokens_[j], genMatches[j]);
296  }
297  }
298 
299  // prepare ID extraction
300  std::vector<edm::Handle<edm::ValueMap<float>>> idhandles;
301  std::vector<pat::Electron::IdPair> ids;
302  if (addElecID_) {
303  idhandles.resize(elecIDSrcs_.size());
304  ids.resize(elecIDSrcs_.size());
305  for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
306  iEvent.getByToken(elecIDTokens_[i], idhandles[i]);
307  ids[i].first = elecIDSrcs_[i].first;
308  }
309  }
310 
311  // prepare the high level selection:
312  // needs beamline
313  reco::TrackBase::Point beamPoint(0, 0, 0);
316  bool beamSpotIsValid = false;
317  bool primaryVertexIsValid = false;
318 
319  // Get the beamspot
320  edm::Handle<reco::BeamSpot> beamSpotHandle;
321  iEvent.getByToken(beamLineToken_, beamSpotHandle);
322 
324  // Get the primary vertex
326  iEvent.getByToken(pvToken_, pvHandle);
327 
328  // This is needed by the IPTools methods from the tracking group
329  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", trackBuilder);
330 
331  if (pvHandle.isValid() && !pvHandle->empty()) {
332  primaryVertex = pvHandle->at(0);
333  primaryVertexIsValid = true;
334  } else {
335  edm::LogError("DataNotAvailable")
336  << "No primary vertex available from EventSetup, not adding high level selection \n";
337  }
338  }
339  //value maps for puppi isolation
340  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_charged_hadrons;
341  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_neutral_hadrons;
342  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_photons;
343  //value maps for puppiNoLeptons isolation
344  edm::Handle<edm::ValueMap<float>> PUPPINoLeptonsIsolation_charged_hadrons;
345  edm::Handle<edm::ValueMap<float>> PUPPINoLeptonsIsolation_neutral_hadrons;
346  edm::Handle<edm::ValueMap<float>> PUPPINoLeptonsIsolation_photons;
347  if (addPuppiIsolation_) {
348  //puppi
349  iEvent.getByToken(PUPPIIsolation_charged_hadrons_, PUPPIIsolation_charged_hadrons);
350  iEvent.getByToken(PUPPIIsolation_neutral_hadrons_, PUPPIIsolation_neutral_hadrons);
351  iEvent.getByToken(PUPPIIsolation_photons_, PUPPIIsolation_photons);
352  //puppiNoLeptons
353  iEvent.getByToken(PUPPINoLeptonsIsolation_charged_hadrons_, PUPPINoLeptonsIsolation_charged_hadrons);
354  iEvent.getByToken(PUPPINoLeptonsIsolation_neutral_hadrons_, PUPPINoLeptonsIsolation_neutral_hadrons);
355  iEvent.getByToken(PUPPINoLeptonsIsolation_photons_, PUPPINoLeptonsIsolation_photons);
356  }
357 
358  std::vector<Electron>* patElectrons = new std::vector<Electron>();
359 
360  if (useParticleFlow_) {
362  iEvent.getByToken(pfElecToken_, pfElectrons);
363  unsigned index = 0;
364 
365  for (reco::PFCandidateConstIterator i = pfElectrons->begin(); i != pfElectrons->end(); ++i, ++index) {
367  reco::PFCandidatePtr ptrToPFElectron(pfElectrons, index);
368  // reco::CandidateBaseRef pfBaseRef( pfRef );
369 
370  reco::GsfTrackRef PfTk = i->gsfTrackRef();
371 
372  bool Matched = false;
373  bool MatchedToAmbiguousGsfTrack = false;
374  for (edm::View<reco::GsfElectron>::const_iterator itElectron = electrons->begin(); itElectron != electrons->end();
375  ++itElectron) {
376  unsigned int idx = itElectron - electrons->begin();
377  auto elePtr = electrons->ptrAt(idx);
378  if (Matched || MatchedToAmbiguousGsfTrack)
379  continue;
380 
381  reco::GsfTrackRef EgTk = itElectron->gsfTrack();
382 
383  if (itElectron->gsfTrack() == i->gsfTrackRef()) {
384  Matched = true;
385  } else {
386  for (auto const& it : itElectron->ambiguousGsfTracks()) {
387  MatchedToAmbiguousGsfTrack |= (bool)(i->gsfTrackRef() == it);
388  }
389  }
390 
391  if (Matched || MatchedToAmbiguousGsfTrack) {
392  // ptr needed for finding the matched gen particle
393  reco::CandidatePtr ptrToGsfElectron(electrons, idx);
394 
395  // ref to base needed for the construction of the pat object
396  const edm::RefToBase<reco::GsfElectron>& elecsRef = electrons->refAt(idx);
397  Electron anElectron(elecsRef);
398  anElectron.setPFCandidateRef(pfRef);
399  if (addPuppiIsolation_) {
400  anElectron.setIsolationPUPPI((*PUPPIIsolation_charged_hadrons)[elePtr],
401  (*PUPPIIsolation_neutral_hadrons)[elePtr],
402  (*PUPPIIsolation_photons)[elePtr]);
403  anElectron.setIsolationPUPPINoLeptons((*PUPPINoLeptonsIsolation_charged_hadrons)[elePtr],
404  (*PUPPINoLeptonsIsolation_neutral_hadrons)[elePtr],
405  (*PUPPINoLeptonsIsolation_photons)[elePtr]);
406  } else {
407  anElectron.setIsolationPUPPI(-999., -999., -999.);
408  anElectron.setIsolationPUPPINoLeptons(-999., -999., -999.);
409  }
410 
411  //it should be always true when particleFlow electrons are used.
412  anElectron.setIsPF(true);
413 
414  if (embedPFCandidate_)
415  anElectron.embedPFCandidate();
416 
417  if (useUserData_) {
418  userDataHelper_.add(anElectron, iEvent, iSetup);
419  }
420 
421  double ip3d = -999; // for mva variable
422 
423  // embed high level selection
425  // get the global track
426  const reco::GsfTrackRef& track = PfTk;
427 
428  // Make sure the collection it points to is there
429  if (track.isNonnull() && track.isAvailable()) {
430  reco::TransientTrack tt = trackBuilder->build(track);
431  embedHighLevel(anElectron, track, tt, primaryVertex, primaryVertexIsValid, beamSpot, beamSpotIsValid);
432 
433  std::pair<bool, Measurement1D> ip3dpv = IPTools::absoluteImpactParameter3D(tt, primaryVertex);
434  ip3d = ip3dpv.second.value(); // for mva variable
435  }
436  }
437 
438  //Electron Id
439 
440  if (addElecID_) {
441  //STANDARD EL ID
442  for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
443  ids[i].second = (*idhandles[i])[elecsRef];
444  }
445  //SPECIFIC PF ID
446  ids.push_back(std::make_pair("pf_evspi", pfRef->mva_e_pi()));
447  ids.push_back(std::make_pair("pf_evsmu", pfRef->mva_e_mu()));
448  anElectron.setElectronIDs(ids);
449  }
450 
451  if (addMVAVariables_) {
452  // add missing mva variables
453  const auto& vCov = lazyTools.localCovariances(*(itElectron->superCluster()->seed()));
454  anElectron.setMvaVariables(vCov[1], ip3d);
455  }
456  // PFClusterIso
457  if (addPFClusterIso_) {
458  // Get PFCluster Isolation
459  edm::Handle<edm::ValueMap<float>> ecalPFClusterIsoMapH;
460  iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH);
461  edm::Handle<edm::ValueMap<float>> hcalPFClusterIsoMapH;
462  iEvent.getByToken(hcalPFClusterIsoT_, hcalPFClusterIsoMapH);
464  newPFIsol.sumEcalClusterEt = (*ecalPFClusterIsoMapH)[elecsRef];
465  newPFIsol.sumHcalClusterEt = (*hcalPFClusterIsoMapH)[elecsRef];
466  anElectron.setPfIsolationVariables(newPFIsol);
467  }
468 
469  std::vector<DetId> selectedCells;
470  bool barrel = itElectron->isEB();
471  //loop over sub clusters
472  if (embedBasicClusters_) {
473  for (reco::CaloCluster_iterator clusIt = itElectron->superCluster()->clustersBegin();
474  clusIt != itElectron->superCluster()->clustersEnd();
475  ++clusIt) {
476  //get seed (max energy xtal)
477  DetId seed = lazyTools.getMaximum(**clusIt).first;
478  //get all xtals in 5x5 window around the seed
479  std::vector<DetId> dets5x5 =
482  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
483 
484  //get all xtals belonging to cluster
485  for (const std::pair<DetId, float>& hit : (*clusIt)->hitsAndFractions()) {
486  selectedCells.push_back(hit.first);
487  }
488  }
489  }
490 
491  if (embedPflowBasicClusters_ && itElectron->parentSuperCluster().isNonnull()) {
492  for (reco::CaloCluster_iterator clusIt = itElectron->parentSuperCluster()->clustersBegin();
493  clusIt != itElectron->parentSuperCluster()->clustersEnd();
494  ++clusIt) {
495  //get seed (max energy xtal)
496  DetId seed = lazyTools.getMaximum(**clusIt).first;
497  //get all xtals in 5x5 window around the seed
498  std::vector<DetId> dets5x5 =
501  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
502 
503  //get all xtals belonging to cluster
504  for (const std::pair<DetId, float>& hit : (*clusIt)->hitsAndFractions()) {
505  selectedCells.push_back(hit.first);
506  }
507  }
508  }
509 
510  //remove duplicates
511  std::sort(selectedCells.begin(), selectedCells.end());
512  std::unique(selectedCells.begin(), selectedCells.end());
513 
514  // Retrieve the corresponding RecHits
515 
517  if (barrel)
518  iEvent.getByToken(reducedBarrelRecHitCollectionToken_, rechitsH);
519  else
520  iEvent.getByToken(reducedEndcapRecHitCollectionToken_, rechitsH);
521 
522  EcalRecHitCollection selectedRecHits;
523  const EcalRecHitCollection* recHits = rechitsH.product();
524 
525  unsigned nSelectedCells = selectedCells.size();
526  for (unsigned icell = 0; icell < nSelectedCells; ++icell) {
527  EcalRecHitCollection::const_iterator it = recHits->find(selectedCells[icell]);
528  if (it != recHits->end()) {
529  selectedRecHits.push_back(*it);
530  }
531  }
532  selectedRecHits.sort();
533  if (embedRecHits_)
534  anElectron.embedRecHits(&selectedRecHits);
535 
536  // set conversion veto selection
537  bool passconversionveto = false;
538  if (hConversions.isValid()) {
539  // this is recommended method
540  passconversionveto =
541  !ConversionTools::hasMatchedConversion(*itElectron, *hConversions, beamSpotHandle->position());
542  } else {
543  // use missing hits without vertex fit method
544  passconversionveto =
545  itElectron->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) < 1;
546  }
547 
548  anElectron.setPassConversionVeto(passconversionveto);
549 
550  // fillElectron(anElectron,elecsRef,pfBaseRef,
551  // genMatches, deposits, isolationValues);
552 
553  //COLIN small warning !
554  // we are currently choosing to take the 4-momentum of the PFCandidate;
555  // the momentum of the GsfElectron is saved though
556  // we must therefore match the GsfElectron.
557  // because of this, we should not change the source of the electron matcher
558  // to the collection of PFElectrons in the python configuration
559  // I don't know what to do with the efficiencyLoader, since I don't know
560  // what this class is for.
562  anElectron, ptrToPFElectron, ptrToGsfElectron, ptrToGsfElectron, genMatches, deposits, isolationValues);
563 
564  //COLIN need to use fillElectron2 in the non-pflow case as well, and to test it.
565 
566  if (computeMiniIso_)
567  setElectronMiniIso(anElectron, pc.product());
568 
569  patElectrons->push_back(anElectron);
570  }
571  }
572  //if( !Matched && !MatchedToAmbiguousGsfTrack) std::cout << "!!!!A pf electron could not be matched to a gsf!!!!" << std::endl;
573  }
574  }
575 
576  else {
580  bool pfCandsPresent = false, valMapPresent = false;
582  iEvent.getByToken(pfCandidateMultiMapToken_, ValMultiMapH);
583  } else {
584  pfCandsPresent = iEvent.getByToken(pfElecToken_, pfElectrons);
585  valMapPresent = iEvent.getByToken(pfCandidateMapToken_, ValMapH);
586  }
587 
588  for (edm::View<reco::GsfElectron>::const_iterator itElectron = electrons->begin(); itElectron != electrons->end();
589  ++itElectron) {
590  // construct the Electron from the ref -> save ref to original object
591  //FIXME: looks like a lot of instances could be turned into const refs
592  unsigned int idx = itElectron - electrons->begin();
594  reco::CandidateBaseRef elecBaseRef(elecsRef);
595  Electron anElectron(elecsRef);
596  auto elePtr = electrons->ptrAt(idx);
597 
598  // Is this GsfElectron also identified as an e- in the particle flow?
599  bool pfId = false;
600 
602  for (const reco::PFCandidateRef& pf : (*ValMultiMapH)[elePtr]) {
603  if (pf->particleId() == reco::PFCandidate::e) {
604  pfId = true;
605  anElectron.setPFCandidateRef(pf);
606  break;
607  }
608  }
609  } else if (pfCandsPresent) {
610  // PF electron collection not available.
611  const reco::GsfTrackRef& trkRef = itElectron->gsfTrack();
612  int index = 0;
613  for (reco::PFCandidateConstIterator ie = pfElectrons->begin(); ie != pfElectrons->end(); ++ie, ++index) {
614  if (ie->particleId() != reco::PFCandidate::e)
615  continue;
616  const reco::GsfTrackRef& pfTrkRef = ie->gsfTrackRef();
617  if (trkRef == pfTrkRef) {
618  pfId = true;
620  anElectron.setPFCandidateRef(pfRef);
621  break;
622  }
623  }
624  } else if (valMapPresent) {
625  // use value map if PF collection not available
626  const edm::ValueMap<reco::PFCandidatePtr>& myValMap(*ValMapH);
627  // Get the PFCandidate
628  const reco::PFCandidatePtr& pfElePtr(myValMap[elecsRef]);
629  pfId = pfElePtr.isNonnull();
630  }
631  // set PFId function
632  anElectron.setIsPF(pfId);
633 
634  // add resolution info
635 
636  // Isolation
637  if (isolator_.enabled()) {
639  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
640  // better to loop backwards, so the vector is resized less times
641  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(),
642  ed = isolatorTmpStorage_.rend();
643  it != ed;
644  ++it) {
645  anElectron.setIsolation(it->first, it->second);
646  }
647  }
648 
649  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
650  anElectron.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[elecsRef]);
651  }
652 
653  // add electron ID info
654  if (addElecID_) {
655  for (size_t i = 0; i < elecIDSrcs_.size(); ++i) {
656  ids[i].second = (*idhandles[i])[elecsRef];
657  }
658  anElectron.setElectronIDs(ids);
659  }
660 
661  if (useUserData_) {
662  userDataHelper_.add(anElectron, iEvent, iSetup);
663  }
664 
665  double ip3d = -999; //for mva variable
666 
667  // embed high level selection
669  // get the global track
670  reco::GsfTrackRef track = itElectron->gsfTrack();
671 
672  // Make sure the collection it points to is there
673  if (track.isNonnull() && track.isAvailable()) {
674  reco::TransientTrack tt = trackBuilder->build(track);
675  embedHighLevel(anElectron, track, tt, primaryVertex, primaryVertexIsValid, beamSpot, beamSpotIsValid);
676 
677  std::pair<bool, Measurement1D> ip3dpv = IPTools::absoluteImpactParameter3D(tt, primaryVertex);
678  ip3d = ip3dpv.second.value(); // for mva variable
679  }
680  }
681 
682  if (addMVAVariables_) {
683  // add mva variables
684  const auto& vCov = lazyTools.localCovariances(*(itElectron->superCluster()->seed()));
685  anElectron.setMvaVariables(vCov[1], ip3d);
686  }
687 
688  // PFCluster Isolation
689  if (addPFClusterIso_) {
690  // Get PFCluster Isolation
691  edm::Handle<edm::ValueMap<float>> ecalPFClusterIsoMapH;
692  iEvent.getByToken(ecalPFClusterIsoT_, ecalPFClusterIsoMapH);
693  edm::Handle<edm::ValueMap<float>> hcalPFClusterIsoMapH;
694  iEvent.getByToken(hcalPFClusterIsoT_, hcalPFClusterIsoMapH);
696  newPFIsol.sumEcalClusterEt = (*ecalPFClusterIsoMapH)[elecsRef];
697  newPFIsol.sumHcalClusterEt = (*hcalPFClusterIsoMapH)[elecsRef];
698  anElectron.setPfIsolationVariables(newPFIsol);
699  }
700 
701  if (addPuppiIsolation_) {
702  anElectron.setIsolationPUPPI((*PUPPIIsolation_charged_hadrons)[elePtr],
703  (*PUPPIIsolation_neutral_hadrons)[elePtr],
704  (*PUPPIIsolation_photons)[elePtr]);
705  anElectron.setIsolationPUPPINoLeptons((*PUPPINoLeptonsIsolation_charged_hadrons)[elePtr],
706  (*PUPPINoLeptonsIsolation_neutral_hadrons)[elePtr],
707  (*PUPPINoLeptonsIsolation_photons)[elePtr]);
708  } else {
709  anElectron.setIsolationPUPPI(-999., -999., -999.);
710  anElectron.setIsolationPUPPINoLeptons(-999., -999., -999.);
711  }
712 
713  std::vector<DetId> selectedCells;
714  bool barrel = itElectron->isEB();
715  //loop over sub clusters
716  if (embedBasicClusters_) {
717  for (reco::CaloCluster_iterator clusIt = itElectron->superCluster()->clustersBegin();
718  clusIt != itElectron->superCluster()->clustersEnd();
719  ++clusIt) {
720  //get seed (max energy xtal)
721  DetId seed = lazyTools.getMaximum(**clusIt).first;
722  //get all xtals in 5x5 window around the seed
723  std::vector<DetId> dets5x5 =
726  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
727 
728  //get all xtals belonging to cluster
729  for (const std::pair<DetId, float>& hit : (*clusIt)->hitsAndFractions()) {
730  selectedCells.push_back(hit.first);
731  }
732  }
733  }
734 
735  if (embedPflowBasicClusters_ && itElectron->parentSuperCluster().isNonnull()) {
736  for (reco::CaloCluster_iterator clusIt = itElectron->parentSuperCluster()->clustersBegin();
737  clusIt != itElectron->parentSuperCluster()->clustersEnd();
738  ++clusIt) {
739  //get seed (max energy xtal)
740  DetId seed = lazyTools.getMaximum(**clusIt).first;
741  //get all xtals in 5x5 window around the seed
742  std::vector<DetId> dets5x5 =
745  selectedCells.insert(selectedCells.end(), dets5x5.begin(), dets5x5.end());
746 
747  //get all xtals belonging to cluster
748  for (const std::pair<DetId, float>& hit : (*clusIt)->hitsAndFractions()) {
749  selectedCells.push_back(hit.first);
750  }
751  }
752  }
753 
754  //remove duplicates
755  std::sort(selectedCells.begin(), selectedCells.end());
756  std::unique(selectedCells.begin(), selectedCells.end());
757 
758  // Retrieve the corresponding RecHits
759 
761  if (barrel)
762  iEvent.getByToken(reducedBarrelRecHitCollectionToken_, rechitsH);
763  else
764  iEvent.getByToken(reducedEndcapRecHitCollectionToken_, rechitsH);
765 
766  EcalRecHitCollection selectedRecHits;
767  const EcalRecHitCollection* recHits = rechitsH.product();
768 
769  unsigned nSelectedCells = selectedCells.size();
770  for (unsigned icell = 0; icell < nSelectedCells; ++icell) {
771  EcalRecHitCollection::const_iterator it = recHits->find(selectedCells[icell]);
772  if (it != recHits->end()) {
773  selectedRecHits.push_back(*it);
774  }
775  }
776  selectedRecHits.sort();
777  if (embedRecHits_)
778  anElectron.embedRecHits(&selectedRecHits);
779 
780  // set conversion veto selection
781  bool passconversionveto = false;
782  if (hConversions.isValid()) {
783  // this is recommended method
784  passconversionveto =
785  !ConversionTools::hasMatchedConversion(*itElectron, *hConversions, beamSpotHandle->position());
786  } else {
787  // use missing hits without vertex fit method
788  passconversionveto =
789  itElectron->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) < 1;
790  }
791  anElectron.setPassConversionVeto(passconversionveto);
792 
793  // add sel to selected
794  fillElectron(
795  anElectron, elecsRef, elecBaseRef, genMatches, deposits, pfId, isolationValues, isolationValuesNoPFId);
796 
797  if (computeMiniIso_)
798  setElectronMiniIso(anElectron, pc.product());
799 
800  patElectrons->push_back(anElectron);
801  }
802  }
803 
804  // sort electrons in pt
806 
807  // add the electrons to the event output
808  std::unique_ptr<std::vector<Electron>> ptr(patElectrons);
809  iEvent.put(std::move(ptr));
810 
811  // clean up
812  if (isolator_.enabled())
814 }
815 
817  const edm::RefToBase<reco::GsfElectron>& elecRef,
818  const reco::CandidateBaseRef& baseRef,
819  const GenAssociations& genMatches,
820  const IsoDepositMaps& deposits,
821  const bool pfId,
824  //COLIN: might want to use the PFCandidate 4-mom. Which one is in use now?
825  // if (useParticleFlow_)
826  // aMuon.setP4( aMuon.pfCandidateRef()->p4() );
827 
828  //COLIN:
829  //In the embedding case, the reference cannot be used to look into a value map.
830  //therefore, one has to had the PFCandidateRef to this function, which becomes a bit
831  //too much specific.
832 
833  // in fact, this function needs a baseref or ptr for genmatch
834  // and a baseref or ptr for isodeposits and isolationvalues.
835  // baseref is not needed
836  // the ptrForIsolation and ptrForMatching should be defined upstream.
837 
838  // is the concrete elecRef needed for the efficiency loader? what is this loader?
839  // how can we make it compatible with the particle flow electrons?
840 
842  anElectron.embedGsfElectronCore();
843  if (embedGsfTrack_)
844  anElectron.embedGsfTrack();
845  if (embedSuperCluster_)
846  anElectron.embedSuperCluster();
848  anElectron.embedPflowSuperCluster();
849  if (embedSeedCluster_)
850  anElectron.embedSeedCluster();
852  anElectron.embedBasicClusters();
854  anElectron.embedPreshowerClusters();
856  anElectron.embedPflowBasicClusters();
858  anElectron.embedPflowPreshowerClusters();
859  if (embedTrack_)
860  anElectron.embedTrack();
861 
862  // store the match to the generated final state muons
863  if (addGenMatch_) {
864  for (size_t i = 0, n = genMatches.size(); i < n; ++i) {
865  if (useParticleFlow_) {
866  reco::GenParticleRef genElectron = (*genMatches[i])[anElectron.pfCandidateRef()];
867  anElectron.addGenParticleRef(genElectron);
868  } else {
869  reco::GenParticleRef genElectron = (*genMatches[i])[elecRef];
870  anElectron.addGenParticleRef(genElectron);
871  }
872  }
873  if (embedGenMatch_)
874  anElectron.embedGenParticle();
875  }
876 
877  if (efficiencyLoader_.enabled()) {
878  efficiencyLoader_.setEfficiencies(anElectron, elecRef);
879  }
880 
881  if (resolutionLoader_.enabled()) {
882  resolutionLoader_.setResolutions(anElectron);
883  }
884 
885  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
886  if (useParticleFlow_) {
887  reco::PFCandidateRef pfcandref = anElectron.pfCandidateRef();
888  assert(!pfcandref.isNull());
889  reco::CandidatePtr source = pfcandref->sourceCandidatePtr(0);
891  } else
892  anElectron.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[elecRef]);
893  }
894 
895  for (size_t j = 0; j < isolationValues.size(); ++j) {
896  if (useParticleFlow_) {
897  reco::CandidatePtr source = anElectron.pfCandidateRef()->sourceCandidatePtr(0);
899  } else if (pfId) {
900  anElectron.setIsolation(isolationValueLabels_[j].first, (*isolationValues[j])[elecRef]);
901  }
902  }
903 
904  //for electrons not identified as PF electrons
905  for (size_t j = 0; j < isolationValuesNoPFId.size(); ++j) {
906  if (!pfId) {
908  }
909  }
910 }
911 
913  const reco::CandidatePtr& candPtrForIsolation,
914  const reco::CandidatePtr& candPtrForGenMatch,
915  const reco::CandidatePtr& candPtrForLoader,
916  const GenAssociations& genMatches,
917  const IsoDepositMaps& deposits,
918  const IsolationValueMaps& isolationValues) const {
919  //COLIN/Florian: use the PFCandidate 4-mom.
920  anElectron.setEcalDrivenMomentum(anElectron.p4());
921  anElectron.setP4(anElectron.pfCandidateRef()->p4());
922 
923  // is the concrete elecRef needed for the efficiency loader? what is this loader?
924  // how can we make it compatible with the particle flow electrons?
925 
927  anElectron.embedGsfElectronCore();
928  if (embedGsfTrack_)
929  anElectron.embedGsfTrack();
930  if (embedSuperCluster_)
931  anElectron.embedSuperCluster();
933  anElectron.embedPflowSuperCluster();
934  if (embedSeedCluster_)
935  anElectron.embedSeedCluster();
937  anElectron.embedBasicClusters();
939  anElectron.embedPreshowerClusters();
941  anElectron.embedPflowBasicClusters();
943  anElectron.embedPflowPreshowerClusters();
944  if (embedTrack_)
945  anElectron.embedTrack();
946 
947  // store the match to the generated final state muons
948 
949  if (addGenMatch_) {
950  for (size_t i = 0, n = genMatches.size(); i < n; ++i) {
951  reco::GenParticleRef genElectron = (*genMatches[i])[candPtrForGenMatch];
952  anElectron.addGenParticleRef(genElectron);
953  }
954  if (embedGenMatch_)
955  anElectron.embedGenParticle();
956  }
957 
958  //COLIN what's this? does it have to be GsfElectron specific?
959  if (efficiencyLoader_.enabled()) {
960  efficiencyLoader_.setEfficiencies(anElectron, candPtrForLoader);
961  }
962 
963  if (resolutionLoader_.enabled()) {
964  resolutionLoader_.setResolutions(anElectron);
965  }
966 
967  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
969  isoDepositLabels_[j].first == pat::HcalIso || deposits[j]->contains(candPtrForGenMatch.id())) {
970  anElectron.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[candPtrForGenMatch]);
971  } else if (deposits[j]->contains(candPtrForIsolation.id())) {
972  anElectron.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[candPtrForIsolation]);
973  } else {
974  anElectron.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
975  }
976  }
977 
978  for (size_t j = 0; j < isolationValues.size(); ++j) {
980  isolationValueLabels_[j].first == pat::HcalIso || isolationValues[j]->contains(candPtrForGenMatch.id())) {
981  anElectron.setIsolation(isolationValueLabels_[j].first, (*isolationValues[j])[candPtrForGenMatch]);
982  } else if (isolationValues[j]->contains(candPtrForIsolation.id())) {
983  anElectron.setIsolation(isolationValueLabels_[j].first, (*isolationValues[j])[candPtrForIsolation]);
984  } else {
986  (*isolationValues[j])[candPtrForIsolation->sourceCandidatePtr(0)]);
987  }
988  }
989 }
990 
992  pat::PFIsolation miniiso;
993  if (anElectron.isEE())
994  miniiso = pat::getMiniPFIsolation(pc,
995  anElectron.polarP4(),
996  miniIsoParamsE_[0],
997  miniIsoParamsE_[1],
998  miniIsoParamsE_[2],
999  miniIsoParamsE_[3],
1000  miniIsoParamsE_[4],
1001  miniIsoParamsE_[5],
1002  miniIsoParamsE_[6],
1003  miniIsoParamsE_[7],
1004  miniIsoParamsE_[8]);
1005  else
1006  miniiso = pat::getMiniPFIsolation(pc,
1007  anElectron.polarP4(),
1008  miniIsoParamsB_[0],
1009  miniIsoParamsB_[1],
1010  miniIsoParamsB_[2],
1011  miniIsoParamsB_[3],
1012  miniIsoParamsB_[4],
1013  miniIsoParamsB_[5],
1014  miniIsoParamsB_[6],
1015  miniIsoParamsB_[7],
1016  miniIsoParamsB_[8]);
1017  anElectron.setMiniPFIsolation(miniiso);
1018 }
1019 
1020 // ParameterSet description for module
1023  iDesc.setComment("PAT electron producer module");
1024 
1025  // input source
1026  iDesc.add<edm::InputTag>("pfCandidateMap", edm::InputTag("no default"))->setComment("input collection");
1027  iDesc.add<edm::InputTag>("electronSource", edm::InputTag("no default"))->setComment("input collection");
1028 
1029  iDesc.ifValue(
1030  edm::ParameterDescription<bool>("addPFClusterIso", false, true),
1032  "ecalPFClusterIsoMap", edm::InputTag("electronEcalPFClusterIsolationProducer"), true) and
1034  "hcalPFClusterIsoMap", edm::InputTag("electronHcalPFClusterIsolationProducer"), true)) or
1035  false >> (edm::ParameterDescription<edm::InputTag>("ecalPFClusterIsoMap", edm::InputTag(""), true) and
1036  edm::ParameterDescription<edm::InputTag>("hcalPFClusterIsoMap", edm::InputTag(""), true)));
1037 
1038  iDesc.ifValue(edm::ParameterDescription<bool>("addPuppiIsolation", false, true),
1040  "puppiIsolationChargedHadrons",
1041  edm::InputTag("egmElectronPUPPIIsolation", "h+-DR030-BarVeto000-EndVeto001"),
1042  true) and
1044  "puppiIsolationNeutralHadrons",
1045  edm::InputTag("egmElectronPUPPIIsolation", "h0-DR030-BarVeto000-EndVeto000"),
1046  true) and
1048  "puppiIsolationPhotons",
1049  edm::InputTag("egmElectronPUPPIIsolation", "gamma-DR030-BarVeto000-EndVeto008"),
1050  true) and
1052  "puppiNoLeptonsIsolationChargedHadrons",
1053  edm::InputTag("egmElectronPUPPINoLeptonsIsolation", "gamma-DR030-BarVeto000-EndVeto008"),
1054  true) and
1056  "puppiNoLeptonsIsolationNeutralHadrons",
1057  edm::InputTag("egmElectronPUPPINoLeptonsIsolation", "gamma-DR030-BarVeto000-EndVeto008"),
1058  true) and
1060  "puppiNoLeptonsIsolationPhotons",
1061  edm::InputTag("egmElectronPUPPINoLeptonsIsolation", "gamma-DR030-BarVeto000-EndVeto008"),
1062  true)) or
1063  false >> edm::EmptyGroupDescription());
1064 
1065  // embedding
1066  iDesc.add<bool>("embedGsfElectronCore", true)->setComment("embed external gsf electron core");
1067  iDesc.add<bool>("embedGsfTrack", true)->setComment("embed external gsf track");
1068  iDesc.add<bool>("embedSuperCluster", true)->setComment("embed external super cluster");
1069  iDesc.add<bool>("embedPflowSuperCluster", true)->setComment("embed external super cluster");
1070  iDesc.add<bool>("embedSeedCluster", true)->setComment("embed external seed cluster");
1071  iDesc.add<bool>("embedBasicClusters", true)->setComment("embed external basic clusters");
1072  iDesc.add<bool>("embedPreshowerClusters", true)->setComment("embed external preshower clusters");
1073  iDesc.add<bool>("embedPflowBasicClusters", true)->setComment("embed external pflow basic clusters");
1074  iDesc.add<bool>("embedPflowPreshowerClusters", true)->setComment("embed external pflow preshower clusters");
1075  iDesc.add<bool>("embedTrack", false)->setComment("embed external track");
1076  iDesc.add<bool>("embedRecHits", true)->setComment("embed external RecHits");
1077 
1078  // pf specific parameters
1079  iDesc.add<edm::InputTag>("pfElectronSource", edm::InputTag("pfElectrons"))
1080  ->setComment("particle flow input collection");
1081  auto&& usePfCandidateMultiMap = edm::ParameterDescription<bool>("usePfCandidateMultiMap", false, true);
1082  usePfCandidateMultiMap.setComment(
1083  "take ParticleFlow candidates from pfCandidateMultiMap instead of matching to pfElectrons by Gsf track "
1084  "reference");
1086  true >> edm::ParameterDescription<edm::InputTag>("pfCandidateMultiMap", true) or
1087  false >> edm::EmptyGroupDescription());
1088  iDesc.add<bool>("useParticleFlow", false)->setComment("whether to use particle flow or not");
1089  iDesc.add<bool>("embedPFCandidate", false)->setComment("embed external particle flow object");
1090 
1091  // MC matching configurables
1092  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
1093  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
1094  std::vector<edm::InputTag> emptySourceVector;
1095  iDesc
1096  .addNode(edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
1097  edm::ParameterDescription<std::vector<edm::InputTag>>("genParticleMatch", emptySourceVector, true))
1098  ->setComment("input with MC match information");
1099 
1100  // electron ID configurables
1101  iDesc.add<bool>("addElectronID", true)->setComment("add electron ID variables");
1102  edm::ParameterSetDescription electronIDSourcesPSet;
1103  electronIDSourcesPSet.setAllowAnything();
1104  iDesc
1105  .addNode(
1106  edm::ParameterDescription<edm::InputTag>("electronIDSource", edm::InputTag(), true) xor
1107  edm::ParameterDescription<edm::ParameterSetDescription>("electronIDSources", electronIDSourcesPSet, true))
1108  ->setComment("input with electron ID variables");
1109 
1110  // mini-iso
1111  iDesc.add<bool>("computeMiniIso", false)->setComment("whether or not to compute and store electron mini-isolation");
1112  iDesc.add<edm::InputTag>("pfCandsForMiniIso", edm::InputTag("packedPFCandidates"))
1113  ->setComment("collection to use to compute mini-iso");
1114  iDesc.add<std::vector<double>>("miniIsoParamsE", std::vector<double>())
1115  ->setComment("mini-iso parameters to use for endcap electrons");
1116  iDesc.add<std::vector<double>>("miniIsoParamsB", std::vector<double>())
1117  ->setComment("mini-iso parameters to use for barrel electrons");
1118 
1119  // IsoDeposit configurables
1120  edm::ParameterSetDescription isoDepositsPSet;
1121  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
1122  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
1123  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
1124  isoDepositsPSet.addOptional<edm::InputTag>("pfAllParticles");
1125  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
1126  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
1127  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
1128  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
1129  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
1130  isoDepositsPSet.addOptional<std::vector<edm::InputTag>>("user");
1131  iDesc.addOptional("isoDeposits", isoDepositsPSet);
1132 
1133  // isolation values configurables
1134  edm::ParameterSetDescription isolationValuesPSet;
1135  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
1136  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
1137  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
1138  isolationValuesPSet.addOptional<edm::InputTag>("pfAllParticles");
1139  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
1140  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
1141  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
1142  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
1143  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
1144  isolationValuesPSet.addOptional<std::vector<edm::InputTag>>("user");
1145  iDesc.addOptional("isolationValues", isolationValuesPSet);
1146 
1147  // isolation values configurables
1148  edm::ParameterSetDescription isolationValuesNoPFIdPSet;
1149  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("tracker");
1150  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("ecal");
1151  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("hcal");
1152  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfAllParticles");
1153  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedHadrons");
1154  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfChargedAll");
1155  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
1156  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
1157  isolationValuesNoPFIdPSet.addOptional<edm::InputTag>("pfPhotons");
1158  isolationValuesNoPFIdPSet.addOptional<std::vector<edm::InputTag>>("user");
1159  iDesc.addOptional("isolationValuesNoPFId", isolationValuesNoPFIdPSet);
1160 
1161  // Efficiency configurables
1162  edm::ParameterSetDescription efficienciesPSet;
1163  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
1164  iDesc.add("efficiencies", efficienciesPSet);
1165  iDesc.add<bool>("addEfficiencies", false);
1166 
1167  // Check to see if the user wants to add user data
1168  edm::ParameterSetDescription userDataPSet;
1170  iDesc.addOptional("userData", userDataPSet);
1171 
1172  // electron shapes
1173  iDesc.add<bool>("addMVAVariables", true)->setComment("embed extra variables in pat::Electron : sip3d, sigmaIEtaIPhi");
1174  iDesc.add<edm::InputTag>("reducedBarrelRecHitCollection", edm::InputTag("reducedEcalRecHitsEB"));
1175  iDesc.add<edm::InputTag>("reducedEndcapRecHitCollection", edm::InputTag("reducedEcalRecHitsEE"));
1176 
1177  edm::ParameterSetDescription isolationPSet;
1178  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
1179  iDesc.add("userIsolation", isolationPSet);
1180 
1181  // Resolution configurables
1183 
1184  iDesc.add<bool>("embedHighLevelSelection", true)->setComment("embed high level selection");
1185  edm::ParameterSetDescription highLevelPSet;
1186  highLevelPSet.setAllowAnything();
1187  iDesc.addNode(edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true))
1188  ->setComment("input with high level selection");
1190  ->setComment("input with high level selection");
1191 
1192  descriptions.add("PATElectronProducer", iDesc);
1193 }
1194 
1195 // embed various impact parameters with errors
1196 // embed high level selection
1201  bool primaryVertexIsValid,
1203  bool beamspotIsValid) {
1204  // Correct to PV
1205  // PV2D
1206  anElectron.setDB(track->dxy(primaryVertex.position()),
1207  track->dxyError(primaryVertex.position(), primaryVertex.covariance()),
1209 
1210  // PV3D
1211  std::pair<bool, Measurement1D> result =
1213  double d0_corr = result.second.value();
1214  double d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1215  anElectron.setDB(d0_corr, d0_err, pat::Electron::PV3D);
1216 
1217  // Correct to beam spot
1218  // BS2D
1219  anElectron.setDB(track->dxy(beamspot), track->dxyError(beamspot), pat::Electron::BS2D);
1220 
1221  // make a fake vertex out of beam spot
1222  reco::Vertex vBeamspot(beamspot.position(), beamspot.covariance3D());
1223 
1224  // BS3D
1225  result = IPTools::signedImpactParameter3D(tt, GlobalVector(track->px(), track->py(), track->pz()), vBeamspot);
1226  d0_corr = result.second.value();
1227  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1228  anElectron.setDB(d0_corr, d0_err, pat::Electron::BS3D);
1229 
1230  // PVDZ
1231  anElectron.setDB(
1232  track->dz(primaryVertex.position()), std::hypot(track->dzError(), primaryVertex.zError()), pat::Electron::PVDZ);
1233 }
1234 
1236 
ConfigurationDescriptions.h
reco::GsfElectron::isEE
bool isEE() const
Definition: GsfElectron.h:336
pat::PATElectronProducer::isolatorTmpStorage_
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
Definition: PATElectronProducer.h:167
pat::Electron::embedTrack
void embedTrack()
method to store the electron's Track internally
pat::PATElectronProducer::isolationValueNoPFIdTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueNoPFIdTokens_
Definition: PATElectronProducer.h:173
electrons_cff.bool
bool
Definition: electrons_cff.py:366
pat::PATUserDataHelper
Assists in assimilating all pat::UserData into pat objects.
Definition: PATUserDataHelper.h:49
edm::SortedCollection::sort
void sort()
Definition: SortedCollection.h:302
mps_fire.i
i
Definition: mps_fire.py:428
pat::EcalIso
Definition: Isolation.h:11
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
pat::PATElectronProducer::embedGsfTrack_
const bool embedGsfTrack_
Definition: PATElectronProducer.h:64
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
pat::PATElectronProducer::elecIDSrcs_
std::vector< NameTag > elecIDSrcs_
Definition: PATElectronProducer.h:160
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
pat::PATElectronProducer::genMatchTokens_
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
Definition: PATElectronProducer.h:84
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
PFIsolation.h
MessageLogger.h
pat::PATElectronProducer::addPFClusterIso_
const bool addPFClusterIso_
Definition: PATElectronProducer.h:102
funct::false
false
Definition: Factorize.h:29
pat::Electron::PV2D
Definition: Electron.h:190
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
reco::PFCandidatePtr
edm::Ptr< PFCandidate > PFCandidatePtr
persistent Ptr to a PFCandidate
Definition: PFCandidateFwd.h:27
edm::Handle::product
T const * product() const
Definition: Handle.h:70
electronProducer_cff.isolationValues
isolationValues
Definition: electronProducer_cff.py:26
pat::PATElectronProducer::embedHighLevel
void embedHighLevel(pat::Electron &anElectron, reco::GsfTrackRef track, reco::TransientTrack &tt, reco::Vertex &primaryVertex, bool primaryVertexIsValid, reco::BeamSpot &beamspot, bool beamspotIsValid)
Definition: PATElectronProducer.cc:1197
pat::PATElectronProducer::fillElectron2
void fillElectron2(Electron &anElectron, const reco::CandidatePtr &candPtrForIsolation, const reco::CandidatePtr &candPtrForGenMatch, const reco::CandidatePtr &candPtrForLoader, const GenAssociations &genMatches, const IsoDepositMaps &deposits, const IsolationValueMaps &isolationValues) const
Definition: PATElectronProducer.cc:912
pat::PATElectronProducer::PUPPINoLeptonsIsolation_photons_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_photons_
Definition: PATElectronProducer.h:189
reco::PFCandidate::e
Definition: PFCandidate.h:47
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
sistrip::View
View
Definition: ConstantsForView.h:26
pat::Electron::embedSeedCluster
void embedSeedCluster()
method to store the electron's seedcluster internally
PFCandidate.h
pat::Electron::embedPreshowerClusters
void embedPreshowerClusters()
method to store the electron's preshower clusters
pat::helper::EfficiencyLoader
Definition: EfficiencyLoader.h:16
pat::PATElectronProducer::setElectronMiniIso
void setElectronMiniIso(pat::Electron &anElectron, const pat::PackedCandidateCollection *pc)
Definition: PATElectronProducer.cc:991
pat::ConversionCollection
std::vector< Conversion > ConversionCollection
Definition: Conversion.h:13
pat::PATElectronProducer::resolutionLoader_
pat::helper::KinResolutionsLoader resolutionLoader_
Definition: PATElectronProducer.h:179
pat::PATElectronProducer::isolationValueLabels_
IsolationLabels isolationValueLabels_
Definition: PATElectronProducer.h:170
Electron
Definition: Electron.py:1
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
pat::helper::MultiIsolator::fill
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Definition: MultiIsolator.h:84
edm
HLT enums.
Definition: AlignableModifier.h:19
pat::PATElectronProducer::embedRecHits_
const bool embedRecHits_
Definition: PATElectronProducer.h:75
IPTools::absoluteImpactParameter3D
std::pair< bool, Measurement1D > absoluteImpactParameter3D(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:38
pat::PATUserDataHelper::fillDescription
static void fillDescription(edm::ParameterSetDescription &iDesc)
Definition: PATUserDataHelper.h:135
TrackerIsolationPt.h
pat::PATElectronProducer::pvToken_
const edm::EDGetTokenT< std::vector< reco::Vertex > > pvToken_
Definition: PATElectronProducer.h:110
reco::GsfElectron::PflowIsolationVariables
Definition: GsfElectron.h:605
pat::Electron::setEcalDrivenMomentum
void setEcalDrivenMomentum(const Candidate::LorentzVector &mom)
Definition: Electron.h:204
pat::Electron::embedGsfElectronCore
void embedGsfElectronCore()
method to store the electron's core internally
reco::PFCandidateConstIterator
PFCandidateCollection::const_iterator PFCandidateConstIterator
iterator
Definition: PFCandidateFwd.h:18
pat::Electron::setPassConversionVeto
void setPassConversionVeto(bool flag)
Definition: Electron.h:257
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
pat::PATElectronProducer::elecIDTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< float > > > elecIDTokens_
Definition: PATElectronProducer.h:161
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
pat::Electron::setIsolationPUPPINoLeptons
void setIsolationPUPPINoLeptons(float chargedhadrons_, float neutralhadrons_, float photons_)
sets PUPPINoLeptons isolations
Definition: Electron.h:167
pat::Lepton::setIsolation
void setIsolation(IsolationKeys key, float value)
Definition: Lepton.h:115
pat::helper::EfficiencyLoader::enabled
bool enabled() const
'true' if this there is at least one efficiency configured
Definition: EfficiencyLoader.h:25
pat::Electron::BS2D
Definition: Electron.h:190
cms::cuda::assert
assert(be >=bs)
pat::Electron::embedRecHits
void embedRecHits(const EcalRecHitCollection *rechits)
method to store the RecHits internally - can be called from the PATElectronProducer
edm::PtrVectorItr
Definition: PtrVector.h:51
pat::Electron::setIsolationPUPPI
void setIsolationPUPPI(float chargedhadrons_, float neutralhadrons_, float photons_)
sets PUPPI isolations
Definition: Electron.h:161
edm::SortedCollection< EcalRecHit >
pat::PATElectronProducer::embedPflowBasicClusters_
const bool embedPflowBasicClusters_
Definition: PATElectronProducer.h:70
electronProducer_cff.isolationValuesNoPFId
isolationValuesNoPFId
Definition: electronProducer_cff.py:34
pat::PATObject::addGenParticleRef
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:751
pat::PATElectronProducer::embedHighLevelSelection_
const bool embedHighLevelSelection_
embed high level selection variables?
Definition: PATElectronProducer.h:108
pat::PATElectronProducer::IsoDepositMaps
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
Definition: PATElectronProducer.h:113
pat::PATElectronProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: PATElectronProducer.cc:232
EmptyGroupDescription.h
EcalClusterLazyTools.h
CaloTopologyRecord
Definition: CaloTopologyRecord.h:10
pat::PATElectronProducer::userDataHelper_
pat::PATUserDataHelper< pat::Electron > userDataHelper_
Definition: PATElectronProducer.h:190
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
pat::PATElectronProducer::PUPPINoLeptonsIsolation_charged_hadrons_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_charged_hadrons_
Definition: PATElectronProducer.h:187
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
TransientTrack.h
pat::PATElectronProducer::isolationValueLabelsNoPFId_
IsolationLabels isolationValueLabelsNoPFId_
Definition: PATElectronProducer.h:172
Association.h
pat::Electron::embedPflowBasicClusters
void embedPflowBasicClusters()
method to store the electron's pflow basic clusters
pat::PATElectronProducer::embedGenMatch_
bool embedGenMatch_
Definition: PATElectronProducer.h:74
edm::Handle
Definition: AssociativeIterator.h:50
edm::ParameterSetDescription::addOptional
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:105
pat::Electron::pfCandidateRef
reco::PFCandidateRef pfCandidateRef() const
reference to the source PFCandidates; null if this has been built from a standard electron
edm::SortedCollection::push_back
void push_back(T const &t)
Definition: SortedCollection.h:188
pat::Electron::embedPflowSuperCluster
void embedPflowSuperCluster()
method to store the electron's PflowSuperCluster internally
pat::helper::MultiIsolator::IsolationValuePairs
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:17
EcalBarrel
Definition: EcalSubdetector.h:10
pat::helper::KinResolutionsLoader::enabled
bool enabled() const
'true' if this there is at least one efficiency configured
Definition: KinResolutionsLoader.h:27
pat::Electron::embedGsfTrack
void embedGsfTrack()
method to store the electron's GsfTrack internally
pat::PATElectronProducer::useUserData_
const bool useUserData_
Definition: PATElectronProducer.h:181
pat::PATElectronProducer::embedPreshowerClusters_
const bool embedPreshowerClusters_
Definition: PATElectronProducer.h:69
pat::PATElectronProducer::pTComparator_
const GreaterByPt< Electron > pTComparator_
Definition: PATElectronProducer.h:164
pat::Electron::BS3D
Definition: Electron.h:190
pat::PATElectronProducer::pfCandidateMapToken_
const edm::EDGetTokenT< edm::ValueMap< reco::PFCandidatePtr > > pfCandidateMapToken_
Definition: PATElectronProducer.h:90
pat::helper::MultiIsolator::enabled
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:55
edm::Ref< PFCandidateCollection >
FileInPath.h
pat::PATElectronProducer::pfElecToken_
const edm::EDGetTokenT< reco::PFCandidateCollection > pfElecToken_
Definition: PATElectronProducer.h:89
pat::PATElectronProducer::embedPflowSuperCluster_
const bool embedPflowSuperCluster_
Definition: PATElectronProducer.h:66
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
pat::helper::MultiIsolator::endEvent
void endEvent()
Definition: MultiIsolator.cc:85
GenParticle.h
pat::PATElectronProducer::embedSeedCluster_
const bool embedSeedCluster_
Definition: PATElectronProducer.h:67
pat::Electron::setDB
void setDB(double dB, double edB, IPTYPE type)
Set impact parameter of a certain type and its uncertainty.
fileCollector.seed
seed
Definition: fileCollector.py:127
BeamMonitor_cff.primaryVertex
primaryVertex
hltOfflineBeamSpot for HLTMON
Definition: BeamMonitor_cff.py:7
DetId
Definition: DetId.h:17
electronIdMVAProducer_cfi.reducedEBRecHitCollection
reducedEBRecHitCollection
Definition: electronIdMVAProducer_cfi.py:7
MakerMacros.h
reco::GsfElectron::setP4
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:188
pat::PATElectronProducer::usePfCandidateMultiMap_
const bool usePfCandidateMultiMap_
Definition: PATElectronProducer.h:88
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
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
pat::PATElectronProducer::pfCandidateMultiMapToken_
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > pfCandidateMultiMapToken_
Definition: PATElectronProducer.h:91
pat::getMiniPFIsolation
PFIsolation getMiniPFIsolation(const pat::PackedCandidateCollection *pfcands, const reco::Candidate::PolarLorentzVector &p4, float mindr=0.05, float maxdr=0.2, float kt_scale=10.0, float ptthresh=0.5, float deadcone_ch=0.0001, float deadcone_pu=0.01, float deadcone_ph=0.01, float deadcone_nh=0.01, float dZ_cut=0.0)
Definition: MiniIsolation.cc:19
l1t::PFCandidateRef
edm::Ref< l1t::PFCandidateCollection > PFCandidateRef
Definition: PFCandidate.h:58
pat::PATElectronProducer::isoDepositTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
Definition: PATElectronProducer.h:169
pat::PATElectronProducer::isolationValueTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
Definition: PATElectronProducer.h:171
pat::Electron::embedPflowPreshowerClusters
void embedPflowPreshowerClusters()
method to store the electron's pflow preshower clusters
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
IPTools::signedImpactParameter3D
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:81
pat::PATUserDataHelper::add
void add(ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
Definition: PATUserDataHelper.h:114
electronIdMVAProducer_cfi.reducedEERecHitCollection
reducedEERecHitCollection
Definition: electronIdMVAProducer_cfi.py:8
pat::PATElectronProducer::embedBasicClusters_
const bool embedBasicClusters_
Definition: PATElectronProducer.h:68
pat::helper::EfficiencyLoader::newEvent
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
Definition: EfficiencyLoader.cc:21
pat::PATElectronProducer::embedGsfElectronCore_
const bool embedGsfElectronCore_
Definition: PATElectronProducer.h:63
pat::Electron::PV3D
Definition: Electron.h:190
GenParticleFwd.h
ConversionTools::hasMatchedConversion
static bool hasMatchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
Definition: ConversionTools.cc:181
reco::BeamSpot
Definition: BeamSpot.h:21
TransientTrackRecord
Definition: TransientTrackRecord.h:11
source
static const std::string source
Definition: EdmProvDump.cc:47
pat::helper::KinResolutionsLoader
Definition: KinResolutionsLoader.h:18
pat::Lepton::setIsoDeposit
void setIsoDeposit(IsolationKeys key, const IsoDeposit &dep)
Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
Definition: Lepton.h:191
edm::ESHandle< CaloTopology >
PATElectronProducer.h
beamspot
Definition: BeamSpotWrite2Txt.h:8
pat::Electron::embedBasicClusters
void embedBasicClusters()
method to store the electron's basic clusters
MiniIsolation.h
CaloIsolationEnergy.h
reco::BeamSpot::position
const Point & position() const
position
Definition: BeamSpot.h:59
ParameterSetDescription.h
EcalClusterLazyTools
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
pat::Electron::embedSuperCluster
void embedSuperCluster()
method to store the electron's SuperCluster internally
CaloGeometryRecord.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::vector_transform
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
Vertex.h
EcalSubdetector.h
EcalEndcap
Definition: EcalSubdetector.h:10
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
pat::Electron::setMvaVariables
void setMvaVariables(double sigmaIetaIphi, double ip3d)
set missing mva input variables
pat::helper::KinResolutionsLoader::setResolutions
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
Definition: KinResolutionsLoader.h:49
pat::PATElectronProducer::PUPPIIsolation_charged_hadrons_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
Definition: PATElectronProducer.h:183
pat::Electron::setIsPF
void setIsPF(bool hasPFCandidate)
Definition: Electron.h:174
TransientTrackBuilder.h
pat::PATElectronProducer::hcalPFClusterIsoT_
const edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
Definition: PATElectronProducer.h:105
edm::ParameterSet
Definition: ParameterSet.h:47
edm::ParameterSetDescription::setComment
void setComment(std::string const &value)
Definition: ParameterSetDescription.cc:33
edm::Ptr::id
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:158
electronIsolatorFromEffectiveArea_cfi.pfElectrons
pfElectrons
Definition: electronIsolatorFromEffectiveArea_cfi.py:5
pat::helper::KinResolutionsLoader::fillDescription
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
Definition: KinResolutionsLoader.cc:34
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
CaloTopology::getSubdetectorTopology
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
pat::PATElectronProducer::embedSuperCluster_
const bool embedSuperCluster_
Definition: PATElectronProducer.h:65
reco::GsfElectron::setPfIsolationVariables
void setPfIsolationVariables(const PflowIsolationVariables &iso)
Definition: GsfElectron.h:666
CaloTopologyRecord.h
edm::ParameterSetDescription::ifValue
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T >> cases)
Definition: ParameterSetDescription.h:220
pat::TrackIso
Definition: Isolation.h:10
electrons_cff.ip3d
ip3d
Definition: electrons_cff.py:357
pat::PATElectronProducer::reducedEndcapRecHitCollectionToken_
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
Definition: PATElectronProducer.h:99
pat::PATElectronProducer::embedPflowPreshowerClusters_
const bool embedPflowPreshowerClusters_
Definition: PATElectronProducer.h:71
edm::ParameterSet::getParameterNamesForType
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::HcalIso
Definition: Isolation.h:12
pat::PATElectronProducer::addElecID_
const bool addElecID_
Definition: PATElectronProducer.h:158
GsfTrack.h
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
pat::PATElectronProducer::electronToken_
const edm::EDGetTokenT< edm::View< reco::GsfElectron > > electronToken_
Definition: PATElectronProducer.h:61
pat::Lepton::setMiniPFIsolation
void setMiniPFIsolation(PFIsolation const &iso)
Definition: Lepton.h:217
pat::PATElectronProducer::ecalTopology_
const CaloTopology * ecalTopology_
Definition: PATElectronProducer.h:192
edm::Association
Definition: Association.h:18
edm::EventSetup
Definition: EventSetup.h:58
edm::ParameterSetDescription::addNode
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
Definition: ParameterSetDescription.cc:41
pat::PATElectronProducer::embedPFCandidate_
const bool embedPFCandidate_
Definition: PATElectronProducer.h:92
pat
Definition: HeavyIon.h:7
edm::contains
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:37
edm::ParameterSetDescription::setAllowAnything
void setAllowAnything()
allow any parameter label/value pairs
Definition: ParameterSetDescription.cc:37
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
TransientTrackRecord.h
DetId::Ecal
Definition: DetId.h:27
pat::PATElectronProducer::hConversionsToken_
const edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
Definition: PATElectronProducer.h:62
get
#define get
pat::helper::KinResolutionsLoader::newEvent
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
Definition: KinResolutionsLoader.cc:27
reco::GsfElectron::p4
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:211
pat::PATElectronProducer::~PATElectronProducer
~PATElectronProducer() override
Definition: PATElectronProducer.cc:230
l1t::PFCandidateCollection
std::vector< l1t::PFCandidate > PFCandidateCollection
Definition: PFCandidate.h:57
pat::Electron::embedPFCandidate
void embedPFCandidate()
embed the PFCandidate pointed to by pfCandidateRef_
EcalClusterLazyToolsBase::ESGetTokens::get
ESData get(edm::EventSetup const &eventSetup) const
Definition: EcalClusterLazyTools.h:64
pat::PATElectronProducer::PUPPIIsolation_photons_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
Definition: PATElectronProducer.h:185
pat::PATElectronProducer::addMVAVariables_
const bool addMVAVariables_
mva input variables
Definition: PATElectronProducer.h:95
pat::PATElectronProducer::useParticleFlow_
const bool useParticleFlow_
pflow specific
Definition: PATElectronProducer.h:87
edm::Ptr< PFCandidate >
pat::PATElectronProducer::addPuppiIsolation_
const bool addPuppiIsolation_
Definition: PATElectronProducer.h:103
pat::PackedCandidateCollection
std::vector< pat::PackedCandidate > PackedCandidateCollection
Definition: PackedCandidate.h:1131
pat::PATElectronProducer::PATElectronProducer
PATElectronProducer(const edm::ParameterSet &iConfig)
Definition: PATElectronProducer.cc:52
pat::PATElectronProducer::isolator_
pat::helper::MultiIsolator isolator_
Definition: PATElectronProducer.h:166
CaloTopology.h
ValueMap.h
pat::PATElectronProducer::IsolationValueMaps
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
Definition: PATElectronProducer.h:114
reco::TrackBase::Point
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
CaloSubdetectorTopology::getWindow
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Definition: CaloSubdetectorTopology.cc:4
pat::PATElectronProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PATElectronProducer.cc:1021
pat::PFIsolation
Definition: PFIsolation.h:12
pat::PATElectronProducer::embedTrack_
const bool embedTrack_
Definition: PATElectronProducer.h:72
reco::Matched
Definition: TrackInfoEnum.h:16
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
IPTools.h
pat::PATElectronProducer::pcToken_
edm::EDGetTokenT< pat::PackedCandidateCollection > pcToken_
Definition: PATElectronProducer.h:77
GsfTrackFwd.h
reco::TransientTrack
Definition: TransientTrack.h:19
pat::helper::MultiIsolator::beginEvent
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
Definition: MultiIsolator.cc:79
pat::PATElectronProducer::miniIsoParamsB_
std::vector< double > miniIsoParamsB_
Definition: PATElectronProducer.h:80
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
isFinite.h
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
pat::helper::EfficiencyLoader::setEfficiencies
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
Definition: EfficiencyLoader.h:41
pat::PATElectronProducer::fillElectron
void fillElectron(Electron &aElectron, const ElectronBaseRef &electronRef, const reco::CandidateBaseRef &baseRef, const GenAssociations &genMatches, const IsoDepositMaps &deposits, const bool pfId, const IsolationValueMaps &isolationValues, const IsolationValueMaps &isolationValuesNoPFId) const
common electron filling, for both the standard and PF2PAT case
Definition: PATElectronProducer.cc:816
packedPFCandidateRefMixer_cfi.pf
pf
Definition: packedPFCandidateRefMixer_cfi.py:4
pat::PATElectronProducer::addGenMatch_
bool addGenMatch_
Definition: PATElectronProducer.h:73
transform.h
edm::ValueMap< float >
reco::GsfElectron::PflowIsolationVariables::sumHcalClusterEt
float sumHcalClusterEt
Definition: GsfElectron.h:617
Exception
Definition: hltDiff.cc:245
pat::PATElectronProducer::ecalPFClusterIsoT_
const edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
Definition: PATElectronProducer.h:104
reco::HitPattern::MISSING_INNER_HITS
Definition: HitPattern.h:155
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
pat::PATElectronProducer::beamLineToken_
const edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
Definition: PATElectronProducer.h:109
pat::Electron::PVDZ
Definition: Electron.h:190
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::RefToBase
Definition: AssociativeIterator.h:54
pat::PATElectronProducer::PUPPINoLeptonsIsolation_neutral_hadrons_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_neutral_hadrons_
Definition: PATElectronProducer.h:188
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
patElectronEAIsoCorrectionProducer_cfi.patElectrons
patElectrons
Definition: patElectronEAIsoCorrectionProducer_cfi.py:4
TransientTrackBuilder::build
reco::TransientTrack build(const reco::Track *p) const
Definition: TransientTrackBuilder.cc:20
pat::PATElectronProducer::GenAssociations
std::vector< edm::Handle< edm::Association< reco::GenParticleCollection > > > GenAssociations
Definition: PATElectronProducer.h:82
electronProducer_cfi.usePfCandidateMultiMap
usePfCandidateMultiMap
Definition: electronProducer_cfi.py:11
mps_fire.result
result
Definition: mps_fire.py:311
pat::Electron
Analysis-level electron class.
Definition: Electron.h:51
pat::PATElectronProducer::ecalClusterToolsESGetTokens_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
Definition: PATElectronProducer.h:100
reco::LeafCandidate::polarP4
const PolarLorentzVector & polarP4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:116
reco::GsfElectron::pfIsolationVariables
const PflowIsolationVariables & pfIsolationVariables() const
Definition: GsfElectron.h:657
edm::ParameterDescriptionNode::setComment
void setComment(std::string const &value)
Definition: ParameterDescriptionNode.cc:106
pat::PATElectronProducer::isoDepositLabels_
IsolationLabels isoDepositLabels_
Definition: PATElectronProducer.h:168
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
pat::Electron::setPFCandidateRef
void setPFCandidateRef(const reco::PFCandidateRef &ref)
add a reference to the source IsolatedPFCandidate
Definition: Electron.h:179
pat::PATObject::embedGenParticle
void embedGenParticle()
Definition: PATObject.h:768
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
pat::PATElectronProducer::miniIsoParamsE_
std::vector< double > miniIsoParamsE_
Definition: PATElectronProducer.h:79
pat::Electron::setElectronIDs
void setElectronIDs(const std::vector< IdPair > &ids)
Store multiple electron ID values, discarding existing ones. The first one in the list becomes the 'd...
Definition: Electron.h:141
edm::EmptyGroupDescription
Definition: EmptyGroupDescription.h:15
edm::ParameterDescription
Definition: ParameterDescription.h:110
CandIsolatorFromDeposits_cfi.deposits
deposits
Definition: CandIsolatorFromDeposits_cfi.py:4
reco::GsfElectron::PflowIsolationVariables::sumEcalClusterEt
float sumEcalClusterEt
Definition: GsfElectron.h:616
edm::InputTag
Definition: InputTag.h:15
pat::PATElectronProducer::efficiencyLoader_
pat::helper::EfficiencyLoader efficiencyLoader_
Definition: PATElectronProducer.h:176
reco::Vertex
Definition: Vertex.h:35
pat::PATElectronProducer
Produces pat::Electron's.
Definition: PATElectronProducer.h:50
hit
Definition: SiStripHitEffFromCalibTree.cc:88
pat::PATElectronProducer::computeMiniIso_
bool computeMiniIso_
Definition: PATElectronProducer.h:78
PFCandidateFwd.h
ConversionTools.h
pat::PATElectronProducer::reducedBarrelRecHitCollectionToken_
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
Definition: PATElectronProducer.h:97
pat::PATElectronProducer::PUPPIIsolation_neutral_hadrons_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
Definition: PATElectronProducer.h:184