CMS 3D CMS Logo

SuperClusterImporter.cc
Go to the documentation of this file.
7 
8 // for single tower H/E
10 
11 //quick pT for superclusters
12 inline double ptFast(const double energy, const math::XYZPoint& position, const math::XYZPoint& origin) {
13  const auto v = position - origin;
14  return energy * std::sqrt(v.perp2() / v.mag2());
15 }
16 
17 #include <unordered_map>
18 
20 public:
22 
23  void updateEventSetup(const edm::EventSetup& es) override;
24 
25  void importToBlock(const edm::Event&, ElementList&) const override;
26 
27 private:
30  const double _maxHoverE, _pTbyPass, _minSCPt;
31  std::unique_ptr<EgammaHadTower> _hadTower;
33  static const math::XYZPoint _zero;
34 };
35 
37 
39 
41  : BlockElementImporterBase(conf, sumes),
42  _srcEB(sumes.consumes<reco::SuperClusterCollection>(conf.getParameter<edm::InputTag>("source_eb"))),
43  _srcEE(sumes.consumes<reco::SuperClusterCollection>(conf.getParameter<edm::InputTag>("source_ee"))),
44  _srcTowers(sumes.consumes<CaloTowerCollection>(conf.getParameter<edm::InputTag>("source_towers"))),
45  _maxHoverE(conf.getParameter<double>("maximumHoverE")),
46  _pTbyPass(conf.getParameter<double>("minPTforBypass")),
47  _minSCPt(conf.getParameter<double>("minSuperClusterPt")),
48  _hadTower(nullptr),
49  _superClustersArePF(conf.getParameter<bool>("superClustersArePF")) {}
50 
53 }
54 
56  auto eb_scs = e.getHandle(_srcEB);
57  auto ee_scs = e.getHandle(_srcEE);
58  auto const& towers = e.get(_srcTowers);
59  elems.reserve(elems.size() + eb_scs->size() + ee_scs->size());
60  // setup our elements so that all the SCs are grouped together
61  auto SCs_end =
62  std::partition(elems.begin(), elems.end(), [](auto const& a) { return a->type() == reco::PFBlockElement::SC; });
63  // add eb superclusters
64  auto bsc = eb_scs->cbegin();
65  auto esc = eb_scs->cend();
66  reco::PFBlockElementSuperCluster* scbe = nullptr;
68  for (auto sc = bsc; sc != esc; ++sc) {
69  scref = reco::SuperClusterRef(eb_scs, std::distance(bsc, sc));
70  PFBlockElementSCEqual myEqual(scref);
71  auto sc_elem = std::find_if(elems.begin(), SCs_end, myEqual);
72  const double scpT = ptFast(sc->energy(), sc->position(), _zero);
73  const auto towersBehindCluster = _hadTower->towersOf(*sc);
74  const double H_tower = (_hadTower->getDepth1HcalESum(towersBehindCluster, towers) +
75  _hadTower->getDepth2HcalESum(towersBehindCluster, towers));
76  const double HoverE = H_tower / sc->energy();
77  if (sc_elem == SCs_end && scpT > _minSCPt && (scpT > _pTbyPass || HoverE < _maxHoverE)) {
78  scbe = new reco::PFBlockElementSuperCluster(scref);
80  SCs_end = elems.emplace(SCs_end, scbe);
81  ++SCs_end; // point to element *after* the new one
82  }
83  } // loop on eb superclusters
84  // add ee superclusters
85  bsc = ee_scs->cbegin();
86  esc = ee_scs->cend();
87  for (auto sc = bsc; sc != esc; ++sc) {
88  scref = reco::SuperClusterRef(ee_scs, std::distance(bsc, sc));
89  PFBlockElementSCEqual myEqual(scref);
90  auto sc_elem = std::find_if(elems.begin(), SCs_end, myEqual);
91  const double scpT = ptFast(sc->energy(), sc->position(), _zero);
92  const auto towersBehindCluster = _hadTower->towersOf(*sc);
93  const double H_tower = (_hadTower->getDepth1HcalESum(towersBehindCluster, towers) +
94  _hadTower->getDepth2HcalESum(towersBehindCluster, towers));
95  const double HoverE = H_tower / sc->energy();
96  if (sc_elem == SCs_end && scpT > _minSCPt && (scpT > _pTbyPass || HoverE < _maxHoverE)) {
97  scbe = new reco::PFBlockElementSuperCluster(scref);
99  SCs_end = elems.emplace(SCs_end, scbe);
100  ++SCs_end; // point to element *after* the new one
101  }
102  } // loop on ee superclusters
103  elems.shrink_to_fit();
104 }
electrons_cff.bool
bool
Definition: electrons_cff.py:372
EgammaHadTower::SingleTower
Definition: EgammaHadTower.h:19
SuperClusterImporter
Definition: SuperClusterImporter.cc:19
edm::EDGetTokenT< reco::SuperClusterCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
PhotonSelectorAlgo.h
reco::PFBlockElementSuperCluster
Cluster Element.
Definition: PFBlockElementSuperCluster.h:15
reco::PFBlockElement::SC
Definition: PFBlockElement.h:41
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
edm::SortedCollection< CaloTower >
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
findQualityFiles.v
v
Definition: findQualityFiles.py:179
EgammaHadTower.h
edm::Ref< SuperClusterCollection >
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
bsc_activity_cfg.bsc
bsc
Definition: bsc_activity_cfg.py:31
SuperClusterImporter::importToBlock
void importToBlock(const edm::Event &, ElementList &) const override
Definition: SuperClusterImporter.cc:55
BlockElementImporterBase.h
PFBlockElementSCEqual
Definition: PFBlockElementSCEqual.h:7
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::SuperClusterRef
edm::Ref< SuperClusterCollection > SuperClusterRef
reference to an object in a collection of SuperCluster objects
Definition: SuperClusterFwd.h:15
PFCluster.h
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
SuperClusterImporter::_hadTower
std::unique_ptr< EgammaHadTower > _hadTower
Definition: SuperClusterImporter.cc:31
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
SuperClusterImporter::_srcEB
edm::EDGetTokenT< reco::SuperClusterCollection > _srcEB
Definition: SuperClusterImporter.cc:28
BlockElementImporterBase::ElementList
std::vector< std::unique_ptr< reco::PFBlockElement > > ElementList
Definition: BlockElementImporterBase.h:16
reco::PFBlockElementSuperCluster::setFromPFSuperCluster
void setFromPFSuperCluster(bool val)
Definition: PFBlockElementSuperCluster.h:61
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
a
double a
Definition: hdecay.h:119
edmplugin::PluginFactory
Definition: PluginFactory.h:34
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
SuperClusterImporter::_srcTowers
edm::EDGetTokenT< CaloTowerCollection > _srcTowers
Definition: SuperClusterImporter.cc:29
PFBlockElementSuperCluster.h
SuperClusterImporter::_minSCPt
const double _minSCPt
Definition: SuperClusterImporter.cc:30
edm::EventSetup
Definition: EventSetup.h:57
SuperClusterImporter::_maxHoverE
const double _maxHoverE
Definition: SuperClusterImporter.cc:30
SuperClusterImporter::_srcEE
edm::EDGetTokenT< reco::SuperClusterCollection > _srcEE
Definition: SuperClusterImporter.cc:28
HLT_2018_cff.towers
towers
Definition: HLT_2018_cff.py:35030
SuperCluster.h
SuperClusterImporter::updateEventSetup
void updateEventSetup(const edm::EventSetup &es) override
Definition: SuperClusterImporter.cc:51
SuperClusterImporter::_zero
static const math::XYZPoint _zero
Definition: SuperClusterImporter.cc:33
ptFast
double ptFast(const double energy, const math::XYZPoint &position, const math::XYZPoint &origin)
Definition: SuperClusterImporter.cc:12
SuperClusterImporter::_superClustersArePF
bool _superClustersArePF
Definition: SuperClusterImporter.cc:32
PFBlockElementSCEqual.h
EgammaHadTower
Definition: EgammaHadTower.h:17
SuperClusterImporter::_pTbyPass
const double _pTbyPass
Definition: SuperClusterImporter.cc:30
edm::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
SuperClusterImporter::SuperClusterImporter
SuperClusterImporter(const edm::ParameterSet &, edm::ConsumesCollector &)
Definition: SuperClusterImporter.cc:40
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
BlockElementImporterBase
Definition: BlockElementImporterBase.h:14