CMS 3D CMS Logo

Functions
ElectronSelector.h File Reference
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/HLTReco/interface/TriggerEvent.h"
#include "DataFormats/Math/interface/deltaR.h"
#include "DataFormats/Math/interface/LorentzVector.h"
#include <vector>

Go to the source code of this file.

Functions

std::vector< reco::GsfElectronRefelectronSelector (const std::vector< reco::GsfElectronRef > &electrons, const edm::Handle< trigger::TriggerEvent > &pHLT, const int filterId, const std::vector< double > &Cuts)
 

Function Documentation

std::vector<reco::GsfElectronRef> electronSelector ( const std::vector< reco::GsfElectronRef > &  electrons,
const edm::Handle< trigger::TriggerEvent > &  pHLT,
const int  filterId,
const std::vector< double > &  Cuts 
)

Definition at line 8 of file ElectronSelector.h.

References gather_cfg::cout, reco::deltaR(), trigger::TriggerEvent::filterKeys(), trigger::TriggerEvent::getObjects(), edm::Ref< C, T, F >::id(), gen::k, edm::Ref< C, T, F >::key(), and relativeConstraints::ring.

Referenced by ErsatzMEt::analyze().

11 {
12  std::vector<reco::GsfElectronRef> ChosenOnes;
13  const trigger::Keys& ring = pHLT->filterKeys(filterId);
14  const trigger::TriggerObjectCollection& HltObjColl = pHLT->getObjects();
15  //const edm::ValueMap<double>& eIsoMapTrk = *eIsoMap[0];
16  //const edm::ValueMap<double>& eIsoMapEcal = *eIsoMap[1];
17  //const edm::ValueMap<double>& eIsoMapHcal = *eIsoMap[2];
18  edm::LogDebug_("electronSelector", "", 16)<< "Number of electrons to select from = "<< electrons.size();
19  for(std::vector<reco::GsfElectronRef>::const_iterator Relec = electrons.begin(); Relec != electrons.end(); ++Relec)
20  {
21  reco::GsfElectronRef elec = *Relec;
22  edm::LogDebug_("electronSelector", "", 17) <<"Analysing elec, id = "<< elec.id() <<"\tkey = "<< elec.key();
23  double scEta = elec->superCluster()->eta();
24  if(fabs(scEta) < 1.4442 || fabs(scEta) > 1.56)
25  {
26  bool HLTMatch = false;
27  for(unsigned int k = 0; k < ring.size(); ++k)
28  {
29  const trigger::TriggerObject& HltObj = HltObjColl[ring[k]];
30  if(reco::deltaR(*elec, HltObj) < 0.1) HLTMatch = true;
31  }
32  edm::LogDebug_("electronSelector", "", 16) << "HLT Match = "<<HLTMatch;
33  std::cout << "HLT Match = " << HLTMatch << std::endl;
34 // if(HLTMatch) ChosenOnes.push_back(elec);
35  if(HLTMatch)
36  {
37  if(fabs(scEta) < 1.479)
38  {
39  float sIhIh = elec->scSigmaIEtaIEta();
40  edm::LogDebug_("electronSelector","",32)<<"SigIetaIeta = "<< sIhIh
41  <<"\tCut Value = "<< Cuts[1];
42  if(sIhIh < Cuts[1])
43  {
44  edm::LogDebug_("elecSel","",39)<<"dEta = "<< elec->deltaEtaSuperClusterTrackAtVtx()
45  <<"\tCut Value = "<< Cuts[2];
46  if(fabs(elec->deltaEtaSuperClusterTrackAtVtx()) < Cuts[2])
47  {
48  edm::LogDebug_("elecSel","",39)<<"dPhi = "<< elec->deltaPhiSuperClusterTrackAtVtx()
49  <<"\tCut Value = "<< Cuts[3];
50  if(fabs(elec->deltaPhiSuperClusterTrackAtVtx()) < Cuts[3])
51  {
52  float trckiso = elec->isolationVariables03().tkSumPt;
53  edm::LogDebug_("","",29) << "Track isolation = " << trckiso
54  <<"\tCut Value = "<< Cuts[4];
55  if(trckiso < Cuts[4])
56  {
57  float ecaliso = elec->isolationVariables04().ecalRecHitSumEt;
58  edm::LogDebug_("","",29) << "ECAL isolation = " << ecaliso
59  <<"\tCut Value = "<< Cuts[5];
60  if(ecaliso < Cuts[5])
61  {
62  float hcaliso = elec->isolationVariables04().hcalDepth1TowerSumEt
63  + elec->isolationVariables04().hcalDepth2TowerSumEt;
64  edm::LogDebug_("","",29) << "HCAL isolation = " << hcaliso
65  <<"\tCut Value = "<< Cuts[6];
66  if(hcaliso < Cuts[6]) ChosenOnes.push_back(elec);
67  }
68  }
69  }
70  }
71  }
72  }else{
73  float sIhIh = elec->scSigmaIEtaIEta();
74  edm::LogDebug_("electronSelector","",32)<<"SigIetaIeta = "<< sIhIh
75  <<"\tCut Value = "<< Cuts[7];
76  if(sIhIh < Cuts[7])
77  {
78  edm::LogDebug_("elecSel","",39)<<"dEta = "<< elec->deltaEtaSuperClusterTrackAtVtx()
79  <<"\tCut Value = "<< Cuts[8];
80  if(fabs(elec->deltaEtaSuperClusterTrackAtVtx()) < Cuts[8])
81  {
82  edm::LogDebug_("elecSel","",39)<<"dPhi = "<< elec->deltaPhiSuperClusterTrackAtVtx()
83  <<"\tCut Value = "<< Cuts[9];
84  if(fabs(elec->deltaPhiSuperClusterTrackAtVtx()) < Cuts[9])
85  {
86  float trckiso = elec->isolationVariables03().tkSumPt;
87  edm::LogDebug_("","",29) << "Track isolation = " << trckiso
88  <<"\tCut Value = "<< Cuts[10];
89  if(trckiso < Cuts[10])
90  {
91  float ecaliso = elec->isolationVariables04().ecalRecHitSumEt;
92  edm::LogDebug_("","",29) << "ECAL isolation = " << ecaliso
93  <<"\tCut Value = "<< Cuts[11];
94  if(ecaliso < Cuts[11])
95  {
96  float hcaliso = elec->isolationVariables04().hcalDepth1TowerSumEt
97  + elec->isolationVariables04().hcalDepth2TowerSumEt;
98  edm::LogDebug_("","",29) << "HCAL isolation = " << hcaliso
99  <<"\tCut Value = "<< Cuts[12];
100  if(hcaliso < Cuts[12]) ChosenOnes.push_back(elec);
101  }
102  }
103  }
104  }
105  }
106  }
107 // ChosenOnes.push_back(elec);
108  }
109  }
110  }
111  return ChosenOnes;
112 }
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
key_type key() const
Accessor for product key.
Definition: Ref.h:263
ProductID id() const
Accessor for product ID.
Definition: Ref.h:257
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
int k[5][pyjets_maxn]
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
std::vector< size_type > Keys