CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
HLTScoutingEgammaProducer Class Reference

#include <HLTrigger/Egamma/src/HLTScoutingEgammaProducer.cc>

Inheritance diagram for HLTScoutingEgammaProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTScoutingEgammaProducer (const edm::ParameterSet &)
 
 ~HLTScoutingEgammaProducer ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

typedef edm::AssociationMap
< edm::OneToValue< std::vector
< reco::RecoEcalCandidate >
, float, unsigned int > > 
RecoEcalCandMap
 

Private Member Functions

virtual void produce (edm::StreamID sid, edm::Event &iEvent, edm::EventSetup const &setup) const overridefinal
 

Private Attributes

const edm::EDGetTokenT
< RecoEcalCandMap
DetaMap_
 
const edm::EDGetTokenT
< RecoEcalCandMap
DphiMap_
 
const edm::EDGetTokenT
< RecoEcalCandMap
EcalPFClusterIsoMap_
 
const edm::EDGetTokenT
< reco::RecoEcalCandidateCollection
EgammaCandidateCollection_
 
const double egammaEtaCut
 
const edm::EDGetTokenT
< reco::GsfTrackCollection
EgammaGsfTrackCollection_
 
const double egammaHoverECut
 
const double egammaPtCut
 
const edm::EDGetTokenT
< RecoEcalCandMap
EleGsfTrackIsoMap_
 
const edm::EDGetTokenT
< RecoEcalCandMap
HcalPFClusterIsoMap_
 
const edm::EDGetTokenT
< RecoEcalCandMap
HoverEMap_
 
const edm::EDGetTokenT
< RecoEcalCandMap
MissingHitsMap_
 
const edm::EDGetTokenT
< RecoEcalCandMap
OneOEMinusOneOPMap_
 
const edm::EDGetTokenT
< RecoEcalCandMap
SigmaIEtaIEtaMap_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Producer for ScoutingElectron and ScoutingPhoton

Definition at line 44 of file HLTScoutingEgammaProducer.h.

Member Typedef Documentation

Definition at line 46 of file HLTScoutingEgammaProducer.h.

Constructor & Destructor Documentation

HLTScoutingEgammaProducer::HLTScoutingEgammaProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 22 of file HLTScoutingEgammaProducer.cc.

22  :
23  EgammaCandidateCollection_(consumes<reco::RecoEcalCandidateCollection>
24  (iConfig.getParameter<edm::InputTag>("EgammaCandidates"))),
25  EgammaGsfTrackCollection_(consumes<reco::GsfTrackCollection>
26  (iConfig.getParameter<edm::InputTag>("EgammaGsfTracks"))),
27  SigmaIEtaIEtaMap_(consumes<RecoEcalCandMap>(iConfig.getParameter<edm::InputTag>(
28  "SigmaIEtaIEtaMap"))),
29  HoverEMap_(consumes<RecoEcalCandMap>(iConfig.getParameter<edm::InputTag>("HoverEMap"))),
30  DetaMap_(consumes<RecoEcalCandMap>(iConfig.getParameter<edm::InputTag>("DetaMap"))),
31  DphiMap_(consumes<RecoEcalCandMap>(iConfig.getParameter<edm::InputTag>("DphiMap"))),
32  MissingHitsMap_(consumes<RecoEcalCandMap>(iConfig.getParameter<edm::InputTag>(
33  "MissingHitsMap"))),
34  OneOEMinusOneOPMap_(consumes<RecoEcalCandMap>(iConfig.getParameter<edm::InputTag>(
35  "OneOEMinusOneOPMap"))),
36  EcalPFClusterIsoMap_(consumes<RecoEcalCandMap>(iConfig.getParameter<edm::InputTag>(
37  "EcalPFClusterIsoMap"))),
38  EleGsfTrackIsoMap_(consumes<RecoEcalCandMap>(iConfig.getParameter<edm::InputTag>(
39  "EleGsfTrackIsoMap"))),
40  HcalPFClusterIsoMap_(consumes<RecoEcalCandMap>(iConfig.getParameter<edm::InputTag>(
41  "HcalPFClusterIsoMap"))),
42  egammaPtCut(iConfig.getParameter<double>("egammaPtCut")),
43  egammaEtaCut(iConfig.getParameter<double>("egammaEtaCut")),
44  egammaHoverECut(iConfig.getParameter<double>("egammaHoverECut"))
45 {
46  //register products
47  produces<ScoutingElectronCollection>();
48  produces<ScoutingPhotonCollection>();
49 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< RecoEcalCandMap > SigmaIEtaIEtaMap_
const edm::EDGetTokenT< reco::GsfTrackCollection > EgammaGsfTrackCollection_
const edm::EDGetTokenT< RecoEcalCandMap > EleGsfTrackIsoMap_
const edm::EDGetTokenT< RecoEcalCandMap > HoverEMap_
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > EgammaCandidateCollection_
const edm::EDGetTokenT< RecoEcalCandMap > DetaMap_
const edm::EDGetTokenT< RecoEcalCandMap > OneOEMinusOneOPMap_
const edm::EDGetTokenT< RecoEcalCandMap > MissingHitsMap_
const edm::EDGetTokenT< RecoEcalCandMap > DphiMap_
const edm::EDGetTokenT< RecoEcalCandMap > HcalPFClusterIsoMap_
const edm::EDGetTokenT< RecoEcalCandMap > EcalPFClusterIsoMap_
HLTScoutingEgammaProducer::~HLTScoutingEgammaProducer ( )

Definition at line 51 of file HLTScoutingEgammaProducer.cc.

52 { }

Member Function Documentation

void HLTScoutingEgammaProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 209 of file HLTScoutingEgammaProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_25ns10e33_v2_cff::InputTag.

209  {
211  desc.add<edm::InputTag>("EgammaCandidates", edm::InputTag("hltEgammaCandidates"));
212  desc.add<edm::InputTag>("EgammaGsfTracks", edm::InputTag("hltEgammaGsfTracks"));
213  desc.add<edm::InputTag>("SigmaIEtaIEtaMap", edm::InputTag(
214  "hltEgammaClusterShape:sigmaIEtaIEta5x5"));
215  desc.add<edm::InputTag>("HoverEMap", edm::InputTag("hltEgammaHoverE"));
216  desc.add<edm::InputTag>("DetaMap", edm::InputTag("hltEgammaGsfTrackVars:Deta"));
217  desc.add<edm::InputTag>("DphiMap", edm::InputTag("hltEgammaGsfTrackVars:Dphi"));
218  desc.add<edm::InputTag>("MissingHitsMap", edm::InputTag("hltEgammaGsfTrackVars:MissingHits"));
219  desc.add<edm::InputTag>("OneOEMinusOneOPMap", edm::InputTag(
220  "hltEgammaGsfTrackVars:OneOESuperMinusOneOP"));
221  desc.add<edm::InputTag>("EcalPFClusterIsoMap", edm::InputTag("hltEgammaEcalPFClusterIso"));
222  desc.add<edm::InputTag>("EleGsfTrackIsoMap", edm::InputTag("hltEgammaEleGsfTrackIso"));
223  desc.add<edm::InputTag>("HcalPFClusterIsoMap", edm::InputTag("hltEgammaHcalPFClusterIso"));
224  desc.add<double>("egammaPtCut", 4.0);
225  desc.add<double>("egammaEtaCut", 2.5);
226  desc.add<double>("egammaHoverECut", 1.0);
227  descriptions.add("hltScoutingEgammaProducer", desc);
228 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTScoutingEgammaProducer::produce ( edm::StreamID  sid,
edm::Event iEvent,
edm::EventSetup const &  setup 
) const
finaloverrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 55 of file HLTScoutingEgammaProducer.cc.

References edm::RefToBase< T >::castTo(), RecoTauCleanerPlugins::charge, DetaMap_, DphiMap_, EcalPFClusterIsoMap_, EgammaCandidateCollection_, egammaEtaCut, EgammaGsfTrackCollection_, egammaHoverECut, egammaPtCut, EleGsfTrackIsoMap_, edm::Event::getByToken(), edm::getRef(), HcalPFClusterIsoMap_, HoverEMap_, cmsHarvester::index, edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNull(), MissingHitsMap_, eostools::move(), OneOEMinusOneOPMap_, edm::Event::put(), fileCollector::seed, and SigmaIEtaIEtaMap_.

56 {
57  using namespace edm;
58 
59  std::unique_ptr<ScoutingElectronCollection> outElectrons(new ScoutingElectronCollection());
60  std::unique_ptr<ScoutingPhotonCollection> outPhotons(new ScoutingPhotonCollection());
61 
62  // Get RecoEcalCandidate
63  Handle<reco::RecoEcalCandidateCollection> EgammaCandidateCollection;
65  EgammaCandidateCollection)){
66  iEvent.put(std::move(outElectrons));
67  iEvent.put(std::move(outPhotons));
68  return;
69  }
70 
71  // Get GsfTrack
72  Handle<reco::GsfTrackCollection> EgammaGsfTrackCollection;
74  EgammaGsfTrackCollection)){
75  iEvent.put(std::move(outElectrons));
76  iEvent.put(std::move(outPhotons));
77  return;
78  }
79 
80  // Get SigmaIEtaIEtaMap
81  Handle<RecoEcalCandMap> SigmaIEtaIEtaMap;
82  if(!iEvent.getByToken(SigmaIEtaIEtaMap_, SigmaIEtaIEtaMap)){
83  iEvent.put(std::move(outElectrons));
84  iEvent.put(std::move(outPhotons));
85  return;
86  }
87 
88  // Get HoverEMap
89  Handle<RecoEcalCandMap> HoverEMap;
90  if(!iEvent.getByToken(HoverEMap_, HoverEMap)){
91  iEvent.put(std::move(outElectrons));
92  iEvent.put(std::move(outPhotons));
93  return;
94  }
95 
96  // Get DetaMap
98  if(!iEvent.getByToken(DetaMap_, DetaMap)){
99  iEvent.put(std::move(outElectrons));
100  iEvent.put(std::move(outPhotons));
101  return;
102  }
103 
104  // Get DphiMap
105  Handle<RecoEcalCandMap> DphiMap;
106  if(!iEvent.getByToken(DphiMap_, DphiMap)){
107  iEvent.put(std::move(outElectrons));
108  iEvent.put(std::move(outPhotons));
109  return;
110  }
111 
112  // Get MissingHitsMap
113  Handle<RecoEcalCandMap> MissingHitsMap;
114  if(!iEvent.getByToken(MissingHitsMap_, MissingHitsMap)){
115  iEvent.put(std::move(outElectrons));
116  iEvent.put(std::move(outPhotons));
117  return;
118  }
119 
120  // Get 1/E - 1/p Map
121  Handle<RecoEcalCandMap> OneOEMinusOneOPMap;
122  if(!iEvent.getByToken(OneOEMinusOneOPMap_, OneOEMinusOneOPMap)){
123  iEvent.put(std::move(outElectrons));
124  iEvent.put(std::move(outPhotons));
125  return;
126  }
127 
128  // Get EcalPFClusterIsoMap
129  Handle<RecoEcalCandMap> EcalPFClusterIsoMap;
130  if(!iEvent.getByToken(EcalPFClusterIsoMap_, EcalPFClusterIsoMap)){
131  iEvent.put(std::move(outElectrons));
132  iEvent.put(std::move(outPhotons));
133  return;
134  }
135 
136  // Get EleGsfTrackIsoMap
137  Handle<RecoEcalCandMap> EleGsfTrackIsoMap;
138  if(!iEvent.getByToken(EleGsfTrackIsoMap_, EleGsfTrackIsoMap)){
139  iEvent.put(std::move(outElectrons));
140  iEvent.put(std::move(outPhotons));
141  return;
142  }
143 
144  // Get HcalPFClusterIsoMap
145  Handle<RecoEcalCandMap> HcalPFClusterIsoMap;
146  if(!iEvent.getByToken(HcalPFClusterIsoMap_, HcalPFClusterIsoMap)){
147  iEvent.put(std::move(outElectrons));
148  iEvent.put(std::move(outPhotons));
149  return;
150  }
151 
152  // Produce electrons and photons
153  int index = 0;
154  for (auto &candidate : *EgammaCandidateCollection) {
155  reco::RecoEcalCandidateRef candidateRef = getRef(EgammaCandidateCollection, index);
156  ++index;
157  if (candidateRef.isNull() && !candidateRef.isAvailable())
158  continue;
159 
160  if ((*HoverEMap)[candidateRef] > egammaHoverECut)
161  continue;
162  if (candidate.pt() < egammaPtCut)
163  continue;
164  if (fabs(candidate.eta()) > egammaEtaCut)
165  continue;
166 
167  reco::SuperClusterRef scRef = candidate.superCluster();
168  if (scRef.isNull() && !scRef.isAvailable())
169  continue;
170  float d0 = 0.0;
171  float dz = 0.0;
172  int charge = -999;
173  for (auto &track: *EgammaGsfTrackCollection) {
174  RefToBase<TrajectorySeed> seed = track.extra()->seedRef();
176  RefToBase<reco::CaloCluster> caloCluster = elseed->caloCluster();
177  reco::SuperClusterRef scRefFromTrk = caloCluster.castTo<reco::SuperClusterRef>() ;
178  if (scRefFromTrk == scRef) {
179  d0 = track.d0();
180  dz = track.dz();
181  charge = track.charge();
182  }
183  }
184  if (charge == -999) { // No associated track. Candidate is a scouting photon
185  outPhotons->emplace_back(candidate.pt(), candidate.eta(), candidate.phi(),
186  candidate.mass(), (*SigmaIEtaIEtaMap)[candidateRef],
187  (*HoverEMap)[candidateRef],
188  (*EcalPFClusterIsoMap)[candidateRef],
189  (*HcalPFClusterIsoMap)[candidateRef]);
190  } else { // Candidate is a scouting electron
191  outElectrons->emplace_back(candidate.pt(), candidate.eta(), candidate.phi(),
192  candidate.mass(), d0, dz, (*DetaMap)[candidateRef],
193  (*DphiMap)[candidateRef], (*SigmaIEtaIEtaMap)[candidateRef],
194  (*HoverEMap)[candidateRef],
195  (*OneOEMinusOneOPMap)[candidateRef],
196  (*MissingHitsMap)[candidateRef], charge,
197  (*EcalPFClusterIsoMap)[candidateRef],
198  (*HcalPFClusterIsoMap)[candidateRef],
199  (*EleGsfTrackIsoMap)[candidateRef]);
200  }
201  }
202 
203  // Put output
204  iEvent.put(std::move(outElectrons));
205  iEvent.put(std::move(outPhotons));
206 }
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
Definition: getRef.h:28
bool isAvailable() const
Definition: Ref.h:576
const edm::EDGetTokenT< RecoEcalCandMap > SigmaIEtaIEtaMap_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
const edm::EDGetTokenT< reco::GsfTrackCollection > EgammaGsfTrackCollection_
const edm::EDGetTokenT< RecoEcalCandMap > EleGsfTrackIsoMap_
const edm::EDGetTokenT< RecoEcalCandMap > HoverEMap_
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > EgammaCandidateCollection_
const edm::EDGetTokenT< RecoEcalCandMap > DetaMap_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
def move
Definition: eostools.py:510
bool isNull() const
Checks for null.
Definition: Ref.h:249
std::vector< ScoutingElectron > ScoutingElectronCollection
const edm::EDGetTokenT< RecoEcalCandMap > OneOEMinusOneOPMap_
const edm::EDGetTokenT< RecoEcalCandMap > MissingHitsMap_
const edm::EDGetTokenT< RecoEcalCandMap > DphiMap_
REF castTo() const
Definition: RefToBase.h:286
const edm::EDGetTokenT< RecoEcalCandMap > HcalPFClusterIsoMap_
std::vector< ScoutingPhoton > ScoutingPhotonCollection
const edm::EDGetTokenT< RecoEcalCandMap > EcalPFClusterIsoMap_

Member Data Documentation

const edm::EDGetTokenT<RecoEcalCandMap> HLTScoutingEgammaProducer::DetaMap_
private

Definition at line 61 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const edm::EDGetTokenT<RecoEcalCandMap> HLTScoutingEgammaProducer::DphiMap_
private

Definition at line 62 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const edm::EDGetTokenT<RecoEcalCandMap> HLTScoutingEgammaProducer::EcalPFClusterIsoMap_
private

Definition at line 65 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const edm::EDGetTokenT<reco::RecoEcalCandidateCollection> HLTScoutingEgammaProducer::EgammaCandidateCollection_
private

Definition at line 57 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const double HLTScoutingEgammaProducer::egammaEtaCut
private

Definition at line 70 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const edm::EDGetTokenT<reco::GsfTrackCollection> HLTScoutingEgammaProducer::EgammaGsfTrackCollection_
private

Definition at line 58 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const double HLTScoutingEgammaProducer::egammaHoverECut
private

Definition at line 71 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const double HLTScoutingEgammaProducer::egammaPtCut
private

Definition at line 69 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const edm::EDGetTokenT<RecoEcalCandMap> HLTScoutingEgammaProducer::EleGsfTrackIsoMap_
private

Definition at line 66 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const edm::EDGetTokenT<RecoEcalCandMap> HLTScoutingEgammaProducer::HcalPFClusterIsoMap_
private

Definition at line 67 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const edm::EDGetTokenT<RecoEcalCandMap> HLTScoutingEgammaProducer::HoverEMap_
private

Definition at line 60 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const edm::EDGetTokenT<RecoEcalCandMap> HLTScoutingEgammaProducer::MissingHitsMap_
private

Definition at line 63 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const edm::EDGetTokenT<RecoEcalCandMap> HLTScoutingEgammaProducer::OneOEMinusOneOPMap_
private

Definition at line 64 of file HLTScoutingEgammaProducer.h.

Referenced by produce().

const edm::EDGetTokenT<RecoEcalCandMap> HLTScoutingEgammaProducer::SigmaIEtaIEtaMap_
private

Definition at line 59 of file HLTScoutingEgammaProducer.h.

Referenced by produce().