CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
ElectronSeedProducer Class Reference
Inheritance diagram for ElectronSeedProducer:
edm::stream::EDProducer<>

Public Member Functions

 ElectronSeedProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) final
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

reco::SuperClusterRefVector filterClusters (math::XYZPoint const &beamSpotPosition, const edm::Handle< reco::SuperClusterCollection > &superClusters) const
 

Private Attributes

bool allowHGCal_
 
bool applyHOverECut_ = true
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotTag_
 
std::unique_ptr< ElectronHcalHelperhcalHelper_ = nullptr
 
std::unique_ptr< hgcal::ClusterToolshgcClusterTools_
 
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > initialSeeds_
 
std::unique_ptr< ElectronSeedGeneratormatcher_
 
double maxHOverEBarrel_
 
double maxHOverEEndcaps_
 
double SCEtCut_
 
edm::EDGetTokenT< reco::SuperClusterCollectionsuperClusters_ [2]
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Description: EDProducer of ElectronSeed objects

Implementation: <Notes on="" implementation>="">

Definition at line 33 of file ElectronSeedProducer.cc.

Constructor & Destructor Documentation

◆ ElectronSeedProducer()

ElectronSeedProducer::ElectronSeedProducer ( const edm::ParameterSet conf)
explicit

Definition at line 63 of file ElectronSeedProducer.cc.

64  :
65 
67  edm::vector_transform(conf.getParameter<std::vector<edm::InputTag>>("initialSeedsVector"),
68  [this](edm::InputTag const& tag) { return consumes<TrajectorySeedCollection>(tag); })}
69 
70 {
71  SCEtCut_ = conf.getParameter<double>("SCEtCut");
72  auto theconsumes = consumesCollector();
73 
74  // new beamSpot tag
75  beamSpotTag_ = consumes(conf.getParameter<edm::InputTag>("beamSpot"));
76 
77  // for H/E
78  applyHOverECut_ = conf.getParameter<bool>("applyHOverECut");
79  if (applyHOverECut_) {
81  hcalCfg.hOverEConeSize = conf.getParameter<double>("hOverEConeSize");
82  if (hcalCfg.hOverEConeSize > 0) {
83  hcalCfg.useTowers = true;
84  hcalCfg.hcalTowers = consumes(conf.getParameter<edm::InputTag>("hcalTowers"));
85  hcalCfg.hOverEPtMin = conf.getParameter<double>("hOverEPtMin");
86  }
87  hcalHelper_ = std::make_unique<ElectronHcalHelper>(hcalCfg, consumesCollector());
88 
89  allowHGCal_ = conf.getParameter<bool>("allowHGCal");
90  if (allowHGCal_) {
91  const edm::ParameterSet& hgcCfg = conf.getParameterSet("HGCalConfig");
92  hgcClusterTools_ = std::make_unique<hgcal::ClusterTools>(hgcCfg, theconsumes);
93  }
94 
95  maxHOverEBarrel_ = conf.getParameter<double>("maxHOverEBarrel");
96  maxHOverEEndcaps_ = conf.getParameter<double>("maxHOverEEndcaps");
97  }
98 
100  esg_tokens.token_bs = beamSpotTag_;
101  esg_tokens.token_vtx = mayConsume<reco::VertexCollection>(conf.getParameter<edm::InputTag>("vertices"));
102 
103  matcher_ = std::make_unique<ElectronSeedGenerator>(conf, esg_tokens, consumesCollector());
104 
105  superClusters_[0] = consumes(conf.getParameter<edm::InputTag>("barrelSuperClusters"));
106  superClusters_[1] = consumes(conf.getParameter<edm::InputTag>("endcapSuperClusters"));
107 
108  //register your products
109  produces<ElectronSeedCollection>();
110 }

References edm::ParameterSet::getParameter(), GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 197 of file ElectronSeedProducer.cc.

197  {
199 
200  // steering
201  desc.add<std::vector<edm::InputTag>>("initialSeedsVector", {});
202  desc.add<bool>("useRecoVertex", false);
203  desc.add<edm::InputTag>("vertices", {"offlinePrimaryVerticesWithBS"});
204  desc.add<edm::InputTag>("beamSpot", {"offlineBeamSpot"});
205  desc.add<bool>("dynamicPhiRoad", true);
206 
207  // SC filtering
208  desc.add<double>("SCEtCut", 0.0);
209 
210  // H/E
211  desc.add<bool>("applyHOverECut", true);
212  desc.add<double>("hOverEConeSize", 0.15);
213  desc.add<double>("maxHOverEBarrel", 0.15);
214  desc.add<double>("maxHOverEEndcaps", 0.15);
215 
216  // H/E towers
217  desc.add<edm::InputTag>("hcalTowers", {"towerMaker"});
218  desc.add<double>("hOverEPtMin", 0.0);
219 
220  // H/E equivalent for HGCal
221  desc.add<bool>("allowHGCal", false);
223  psd4.add<edm::InputTag>("HGCEEInput", {"HGCalRecHit", "HGCEERecHits"});
224  psd4.add<edm::InputTag>("HGCFHInput", {"HGCalRecHit", "HGCHEFRecHits"});
225  psd4.add<edm::InputTag>("HGCBHInput", {"HGCalRecHit", "HGCHEBRecHits"});
226  desc.add<edm::ParameterSetDescription>("HGCalConfig", psd4);
227 
228  // r/z windows
229  desc.add<double>("nSigmasDeltaZ1", 5.0); // in case beam spot is used for the matching
230  desc.add<double>("deltaZ1WithVertex", 25.0); // in case reco vertex is used for the matching
231  desc.add<double>("z2MaxB", 0.09);
232  desc.add<double>("r2MaxF", 0.15);
233  desc.add<double>("rMaxI", 0.2); // intermediate region SC in EB and 2nd hits in PXF
234 
235  // phi windows (dynamic)
236  desc.add<double>("LowPtThreshold", 5.0);
237  desc.add<double>("HighPtThreshold", 35.0);
238  desc.add<double>("SizeWindowENeg", 0.675);
239  desc.add<double>("DeltaPhi1Low", 0.23);
240  desc.add<double>("DeltaPhi1High", 0.08);
241  desc.add<double>("DeltaPhi2B", 0.008);
242  desc.add<double>("DeltaPhi2F", 0.012);
243 
244  // phi windows (non dynamic, overwritten in case dynamic is selected)
245  desc.add<double>("ePhiMin1", -0.125);
246  desc.add<double>("ePhiMax1", 0.075);
247  desc.add<double>("PhiMax2B", 0.002);
248  desc.add<double>("PhiMax2F", 0.003);
249 
250  desc.add<edm::InputTag>("barrelSuperClusters",
251  {"particleFlowSuperClusterECAL", "particleFlowSuperClusterECALBarrel"});
252  desc.add<edm::InputTag>("endcapSuperClusters",
253  {"particleFlowSuperClusterECAL", "particleFlowSuperClusterECALEndcapWithPreshower"});
254 
255  descriptions.add("ecalDrivenElectronSeeds", desc);
256 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and submitPVResolutionJobs::desc.

◆ filterClusters()

SuperClusterRefVector ElectronSeedProducer::filterClusters ( math::XYZPoint const &  beamSpotPosition,
const edm::Handle< reco::SuperClusterCollection > &  superClusters 
) const
private

Definition at line 161 of file ElectronSeedProducer.cc.

162  {
163  SuperClusterRefVector sclRefs;
164 
165  for (unsigned int i = 0; i < superClusters->size(); ++i) {
166  auto const& scl = (*superClusters)[i];
167  double sclEta = EleRelPoint(scl.position(), beamSpotPosition).eta();
168  if (scl.energy() / cosh(sclEta) > SCEtCut_) {
169  if (applyHOverECut_) {
170  bool hoeVeto = false;
171  double had = hcalHelper_->hcalESumDepth1(scl) + hcalHelper_->hcalESumDepth2(scl);
172  double scle = scl.energy();
173  int det_group = scl.seed()->hitsAndFractions()[0].first.det();
174  int detector = scl.seed()->hitsAndFractions()[0].first.subdetId();
175  if (detector == EcalBarrel && had / scle < maxHOverEBarrel_)
176  hoeVeto = true;
177  else if (!allowHGCal_ && detector == EcalEndcap && had / scle < maxHOverEEndcaps_)
178  hoeVeto = true;
179  else if (allowHGCal_ && EcalTools::isHGCalDet((DetId::Detector)det_group)) {
180  float had_fraction = hgcClusterTools_->getClusterHadronFraction(*(scl.seed()));
181  hoeVeto = (had_fraction >= 0.f && had_fraction < maxHOverEEndcaps_);
182  }
183  if (hoeVeto) {
184  sclRefs.push_back({superClusters, i});
185  }
186  } else {
187  sclRefs.push_back({superClusters, i});
188  }
189  }
190  }
191  LogDebug("ElectronSeedProducer") << "Filtered out " << sclRefs.size() << " superclusters from "
192  << superClusters->size();
193 
194  return sclRefs;
195 }

References allowHGCal_, applyHOverECut_, hgcalTestNeighbor_cfi::detector, EcalBarrel, EcalEndcap, PVValHelper::eta, hcalHelper_, hgcClusterTools_, mps_fire::i, EcalTools::isHGCalDet(), LogDebug, maxHOverEBarrel_, maxHOverEEndcaps_, edm::RefVector< C, T, F >::push_back(), SCEtCut_, edm::RefVector< C, T, F >::size(), and HLT_FULL_cff::superClusters.

Referenced by produce().

◆ produce()

void ElectronSeedProducer::produce ( edm::Event e,
const edm::EventSetup iSetup 
)
final

Definition at line 112 of file ElectronSeedProducer.cc.

112  {
113  LogDebug("ElectronSeedProducer") << "[ElectronSeedProducer::produce] entering ";
114 
115  std::vector<TrajectorySeedCollection const*> initialSeedCollections;
116  std::unique_ptr<TrajectorySeedCollection> initialSeedCollectionPtr = nullptr; //created on the fly
117 
118  if (hcalHelper_) {
119  hcalHelper_->beginEvent(e, iSetup);
120  if (allowHGCal_) {
121  hgcClusterTools_->getEventSetup(iSetup);
122  hgcClusterTools_->getEvent(e);
123  }
124  }
125 
126  matcher_->setupES(iSetup);
127 
128  // get initial TrajectorySeeds
129  initialSeedCollections.clear();
130  for (auto const& seeds : initialSeeds_) {
131  initialSeedCollections.push_back(&e.get(seeds));
132  }
133 
134  auto seeds = std::make_unique<ElectronSeedCollection>();
135  auto const& beamSportPosition = e.get(beamSpotTag_).position();
136 
137  // loop over barrel + endcap
138  for (unsigned int i = 0; i < 2; i++) {
139  auto clusterRefs = filterClusters(beamSportPosition, e.getHandle(superClusters_[i]));
140  matcher_->run(e, clusterRefs, initialSeedCollections, *seeds);
141  }
142 
143  // store the accumulated result
144 #ifdef EDM_ML_DEBUG
145  for (auto const& seed : *seeds) {
146  SuperClusterRef superCluster = seed.caloCluster().castTo<SuperClusterRef>();
147  LogDebug("ElectronSeedProducer") << "new seed with " << seed.nHits() << " hits"
148  << ", charge " << seed.getCharge() << " and cluster energy "
149  << superCluster->energy() << " PID " << superCluster.id();
150  }
151 #endif
152  e.put(std::move(seeds));
153 }

References allowHGCal_, beamSpotTag_, MillePedeFileConverter_cfg::e, filterClusters(), hcalHelper_, hgcClusterTools_, mps_fire::i, edm::Ref< C, T, F >::id(), initialSeeds_, LogDebug, matcher_, eostools::move(), fileCollector::seed, InitialStep_cff::seeds, and superClusters_.

Member Data Documentation

◆ allowHGCal_

bool ElectronSeedProducer::allowHGCal_
private

Definition at line 57 of file ElectronSeedProducer.cc.

Referenced by filterClusters(), and produce().

◆ applyHOverECut_

bool ElectronSeedProducer::applyHOverECut_ = true
private

Definition at line 51 of file ElectronSeedProducer.cc.

Referenced by filterClusters().

◆ beamSpotTag_

edm::EDGetTokenT<reco::BeamSpot> ElectronSeedProducer::beamSpotTag_
private

Definition at line 47 of file ElectronSeedProducer.cc.

Referenced by produce().

◆ hcalHelper_

std::unique_ptr<ElectronHcalHelper> ElectronSeedProducer::hcalHelper_ = nullptr
private

Definition at line 52 of file ElectronSeedProducer.cc.

Referenced by filterClusters(), and produce().

◆ hgcClusterTools_

std::unique_ptr<hgcal::ClusterTools> ElectronSeedProducer::hgcClusterTools_
private

Definition at line 58 of file ElectronSeedProducer.cc.

Referenced by filterClusters(), and produce().

◆ initialSeeds_

std::vector<edm::EDGetTokenT<TrajectorySeedCollection> > ElectronSeedProducer::initialSeeds_
private

Definition at line 46 of file ElectronSeedProducer.cc.

Referenced by produce().

◆ matcher_

std::unique_ptr<ElectronSeedGenerator> ElectronSeedProducer::matcher_
private

Definition at line 49 of file ElectronSeedProducer.cc.

Referenced by produce().

◆ maxHOverEBarrel_

double ElectronSeedProducer::maxHOverEBarrel_
private

Definition at line 53 of file ElectronSeedProducer.cc.

Referenced by filterClusters().

◆ maxHOverEEndcaps_

double ElectronSeedProducer::maxHOverEEndcaps_
private

Definition at line 54 of file ElectronSeedProducer.cc.

Referenced by filterClusters().

◆ SCEtCut_

double ElectronSeedProducer::SCEtCut_
private

Definition at line 55 of file ElectronSeedProducer.cc.

Referenced by filterClusters().

◆ superClusters_

edm::EDGetTokenT<reco::SuperClusterCollection> ElectronSeedProducer::superClusters_[2]
private

Definition at line 45 of file ElectronSeedProducer.cc.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:428
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
ElectronSeedProducer::maxHOverEBarrel_
double maxHOverEBarrel_
Definition: ElectronSeedProducer.cc:53
EcalTools::isHGCalDet
static bool isHGCalDet(DetId::Detector thedet)
identify HGCal cells
Definition: EcalTools.h:49
ElectronSeedProducer::maxHOverEEndcaps_
double maxHOverEEndcaps_
Definition: ElectronSeedProducer.cc:54
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ElectronSeedGenerator::Tokens::token_bs
edm::EDGetTokenT< reco::BeamSpot > token_bs
Definition: ElectronSeedGenerator.h:50
ElectronSeedProducer::allowHGCal_
bool allowHGCal_
Definition: ElectronSeedProducer.cc:57
edm::RefVector
Definition: EDProductfwd.h:27
EcalBarrel
Definition: EcalSubdetector.h:10
edm::Ref< SuperClusterCollection >
HLT_FULL_cff.superClusters
superClusters
Definition: HLT_FULL_cff.py:15173
fileCollector.seed
seed
Definition: fileCollector.py:127
EleRelPoint
Definition: ElectronUtilities.h:25
ElectronSeedProducer::beamSpotTag_
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
Definition: ElectronSeedProducer.cc:47
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
PVValHelper::eta
Definition: PVValidationHelpers.h:70
ElectronHcalHelper::Configuration::hOverEConeSize
double hOverEConeSize
Definition: ElectronHcalHelper.h:27
ElectronHcalHelper::Configuration
Definition: ElectronHcalHelper.h:25
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
EcalEndcap
Definition: EcalSubdetector.h:10
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:231
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
ElectronSeedProducer::applyHOverECut_
bool applyHOverECut_
Definition: ElectronSeedProducer.cc:51
ElectronSeedGenerator::Tokens::token_vtx
edm::EDGetTokenT< std::vector< reco::Vertex > > token_vtx
Definition: ElectronSeedGenerator.h:49
ElectronSeedGenerator::Tokens
Definition: ElectronSeedGenerator.h:48
DetId::Detector
Detector
Definition: DetId.h:24
ElectronSeedProducer::superClusters_
edm::EDGetTokenT< reco::SuperClusterCollection > superClusters_[2]
Definition: ElectronSeedProducer.cc:45
edm::RefVector::push_back
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
ElectronSeedProducer::filterClusters
reco::SuperClusterRefVector filterClusters(math::XYZPoint const &beamSpotPosition, const edm::Handle< reco::SuperClusterCollection > &superClusters) const
Definition: ElectronSeedProducer.cc:161
edm::Ref::id
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
ElectronSeedProducer::matcher_
std::unique_ptr< ElectronSeedGenerator > matcher_
Definition: ElectronSeedProducer.cc:49
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
ElectronSeedProducer::hgcClusterTools_
std::unique_ptr< hgcal::ClusterTools > hgcClusterTools_
Definition: ElectronSeedProducer.cc:58
ElectronSeedProducer::SCEtCut_
double SCEtCut_
Definition: ElectronSeedProducer.cc:55
ElectronSeedProducer::hcalHelper_
std::unique_ptr< ElectronHcalHelper > hcalHelper_
Definition: ElectronSeedProducer.cc:52
edm::RefVector::size
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
ElectronSeedProducer::initialSeeds_
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > initialSeeds_
Definition: ElectronSeedProducer.cc:46
edm::InputTag
Definition: InputTag.h:15
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2128
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37