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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () 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<reco::BeamSpot>(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<CaloTowerCollection>(conf.getParameter<edm::InputTag>("hcalTowers"));
85  hcalCfg.hOverEPtMin = conf.getParameter<double>("hOverEPtMin");
86  }
87  hcalHelper_ = std::make_unique<ElectronHcalHelper>(hcalCfg);
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);
104 
105  superClusters_[0] = consumes<reco::SuperClusterCollection>(conf.getParameter<edm::InputTag>("barrelSuperClusters"));
106  superClusters_[1] = consumes<reco::SuperClusterCollection>(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 198 of file ElectronSeedProducer.cc.

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

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

◆ filterClusters()

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

Definition at line 162 of file ElectronSeedProducer.cc.

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

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

References allowHGCal_, beamSpotTag_, MillePedeFileConverter_cfg::e, filterClusters(), hcalHelper_, hgcClusterTools_, mps_fire::i, edm::Ref< C, T, F >::id(), initialSeeds_, LogDebug, matcher_, eostools::move(), SurveyInfoScenario_cff::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:355
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:48
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:45
ElectronSeedProducer::allowHGCal_
bool allowHGCal_
Definition: ElectronSeedProducer.cc:57
edm::RefVector
Definition: EDProductfwd.h:27
EcalBarrel
Definition: EcalSubdetector.h:10
edm::Ref< SuperClusterCollection >
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
ElectronHcalHelper::Configuration::hcalTowers
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
Definition: ElectronHcalHelper.h:31
PVValHelper::eta
Definition: PVValidationHelpers.h:69
ElectronHcalHelper::Configuration::hOverEConeSize
double hOverEConeSize
Definition: ElectronHcalHelper.h:25
ElectronHcalHelper::Configuration
Definition: ElectronHcalHelper.h:23
HLT_2018_cff.superClusters
superClusters
Definition: HLT_2018_cff.py:13791
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:232
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
ElectronSeedProducer::applyHOverECut_
bool applyHOverECut_
Definition: ElectronSeedProducer.cc:51
ElectronSeedGenerator::Tokens::token_vtx
edm::EDGetTokenT< std::vector< reco::Vertex > > token_vtx
Definition: ElectronSeedGenerator.h:44
ElectronSeedGenerator::Tokens
Definition: ElectronSeedGenerator.h:43
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:162
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::Ref::id
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
ElectronSeedProducer::matcher_
std::unique_ptr< ElectronSeedGenerator > matcher_
Definition: ElectronSeedProducer.cc:49
eostools.move
def move(src, dest)
Definition: eostools.py:511
ElectronHcalHelper::Configuration::hOverEPtMin
double hOverEPtMin
Definition: ElectronHcalHelper.h:32
ElectronHcalHelper::Configuration::useTowers
bool useTowers
Definition: ElectronHcalHelper.h:28
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:2121
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37