CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
l1tpf::PFClusterProducerFromHGC3DClusters Class Reference
Inheritance diagram for l1tpf::PFClusterProducerFromHGC3DClusters:
edm::stream::EDProducer<>

Public Member Functions

 PFClusterProducerFromHGC3DClusters (const edm::ParameterSet &)
 
 ~PFClusterProducerFromHGC3DClusters () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

l1tpf::corrector corrector_
 
bool emOnly_
 
l1tpf::HGC3DClusterEgID emVsPionID_
 
l1tpf::HGC3DClusterEgID emVsPUID_
 
double etCut_
 
bool hasEmId_
 
StringCutObjectSelector
< l1t::HGCalMulticluster
preEmId_
 
l1tpf::ParametricResolution resol_
 
edm::EDGetTokenT
< l1t::HGCalMulticlusterBxCollection
src_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 17 of file PFClusterProducerFromHGC3DClusters.cc.

Constructor & Destructor Documentation

l1tpf::PFClusterProducerFromHGC3DClusters::PFClusterProducerFromHGC3DClusters ( const edm::ParameterSet iConfig)
explicit

Definition at line 37 of file PFClusterProducerFromHGC3DClusters.cc.

References emVsPionID_, emVsPUID_, hasEmId_, l1tpf::HGC3DClusterEgID::method(), and l1tpf::HGC3DClusterEgID::prepareTMVA().

38  : src_(consumes<l1t::HGCalMulticlusterBxCollection>(iConfig.getParameter<edm::InputTag>("src"))),
39  emOnly_(iConfig.getParameter<bool>("emOnly")),
40  etCut_(iConfig.getParameter<double>("etMin")),
41  preEmId_(iConfig.getParameter<std::string>("preEmId")),
42  emVsPionID_(iConfig.getParameter<edm::ParameterSet>("emVsPionID")),
43  emVsPUID_(iConfig.getParameter<edm::ParameterSet>("emVsPUID")),
44  hasEmId_((iConfig.existsAs<std::string>("preEmId") && !iConfig.getParameter<std::string>("preEmId").empty()) ||
45  !emVsPionID_.method().empty()),
46  corrector_(iConfig.getParameter<std::string>("corrector"),
47  emOnly_ || iConfig.getParameter<std::string>("corrector").empty()
48  ? -1
49  : iConfig.getParameter<double>("correctorEmfMax")),
50  resol_(iConfig.getParameter<edm::ParameterSet>("resol")) {
51  if (!emVsPionID_.method().empty()) {
53  }
54  if (!emVsPUID_.method().empty()) {
56  }
57 
58  produces<l1t::PFClusterCollection>();
59  if (hasEmId_) {
60  produces<l1t::PFClusterCollection>("em");
61  produces<l1t::PFClusterCollection>("had");
62  }
63 }
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< l1t::HGCalMulticlusterBxCollection > src_
StringCutObjectSelector< l1t::HGCalMulticluster > preEmId_
l1tpf::PFClusterProducerFromHGC3DClusters::~PFClusterProducerFromHGC3DClusters ( )
inlineoverride

Definition at line 20 of file PFClusterProducerFromHGC3DClusters.cc.

20 {}

Member Function Documentation

void l1tpf::PFClusterProducerFromHGC3DClusters::produce ( edm::Event iEvent,
const edm::EventSetup  
)
overrideprivate

Definition at line 65 of file PFClusterProducerFromHGC3DClusters.cc.

References funct::abs(), edm::Event::getByToken(), photons_cff::hoe, eostools::move(), submitPVResolutionJobs::out, DiDispStaMuonMonitor_cfi::pt, push_back(), edm::Event::put(), and l1t::PFCluster::setIsEM().

65  {
66  auto out = std::make_unique<l1t::PFClusterCollection>();
67  std::unique_ptr<l1t::PFClusterCollection> outEm, outHad;
68  if (hasEmId_) {
69  outEm = std::make_unique<l1t::PFClusterCollection>();
70  outHad = std::make_unique<l1t::PFClusterCollection>();
71  }
73  iEvent.getByToken(src_, multiclusters);
74 
75  for (auto it = multiclusters->begin(0), ed = multiclusters->end(0); it != ed; ++it) {
76  float pt = it->pt(), hoe = it->hOverE();
77  bool isEM = hasEmId_ ? preEmId_(*it) : emOnly_;
78  if (emOnly_) {
79  if (hoe == -1)
80  continue;
81  pt /= (1 + hoe);
82  hoe = 0;
83  }
84  if (pt <= etCut_)
85  continue;
86 
87  l1t::PFCluster cluster(pt, it->eta(), it->phi(), hoe, /*isEM=*/isEM);
88  if (!emVsPUID_.method().empty()) {
89  if (!emVsPUID_.passID(*it, cluster)) {
90  continue;
91  }
92  }
93  if (!emVsPionID_.method().empty()) {
94  cluster.setIsEM(emVsPionID_.passID(*it, cluster));
95  }
96  if (corrector_.valid())
97  corrector_.correctPt(cluster);
98  cluster.setPtError(resol_(cluster.pt(), std::abs(cluster.eta())));
99 
100  out->push_back(cluster);
101  out->back().addConstituent(edm::Ptr<l1t::L1Candidate>(multiclusters, multiclusters->key(it)));
102  if (hasEmId_) {
103  (isEM ? outEm : outHad)->push_back(out->back());
104  }
105  }
106 
107  iEvent.put(std::move(out));
108  if (hasEmId_) {
109  iEvent.put(std::move(outEm), "em");
110  iEvent.put(std::move(outHad), "had");
111  }
112 }
bool valid() const
Definition: corrector.h:35
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
def move
Definition: eostools.py:511
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< l1t::HGCalMulticlusterBxCollection > src_
void setIsEM(bool isEM)
Definition: PFCluster.h:60
deadvectors[0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
StringCutObjectSelector< l1t::HGCalMulticluster > preEmId_
void correctPt(l1t::PFCluster &cluster, float preserveEmEt=true) const
Definition: corrector.cc:154
float passID(l1t::HGCalMulticluster c, l1t::PFCluster &cpf)

Member Data Documentation

l1tpf::corrector l1tpf::PFClusterProducerFromHGC3DClusters::corrector_
private

Definition at line 29 of file PFClusterProducerFromHGC3DClusters.cc.

bool l1tpf::PFClusterProducerFromHGC3DClusters::emOnly_
private

Definition at line 24 of file PFClusterProducerFromHGC3DClusters.cc.

l1tpf::HGC3DClusterEgID l1tpf::PFClusterProducerFromHGC3DClusters::emVsPionID_
private
l1tpf::HGC3DClusterEgID l1tpf::PFClusterProducerFromHGC3DClusters::emVsPUID_
private
double l1tpf::PFClusterProducerFromHGC3DClusters::etCut_
private

Definition at line 25 of file PFClusterProducerFromHGC3DClusters.cc.

bool l1tpf::PFClusterProducerFromHGC3DClusters::hasEmId_
private
StringCutObjectSelector<l1t::HGCalMulticluster> l1tpf::PFClusterProducerFromHGC3DClusters::preEmId_
private

Definition at line 26 of file PFClusterProducerFromHGC3DClusters.cc.

l1tpf::ParametricResolution l1tpf::PFClusterProducerFromHGC3DClusters::resol_
private

Definition at line 30 of file PFClusterProducerFromHGC3DClusters.cc.

edm::EDGetTokenT<l1t::HGCalMulticlusterBxCollection> l1tpf::PFClusterProducerFromHGC3DClusters::src_
private

Definition at line 23 of file PFClusterProducerFromHGC3DClusters.cc.