CMS 3D CMS Logo

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

Public Member Functions

 PFClusterProducerFromL1EGClusters (const edm::ParameterSet &)
 
 ~PFClusterProducerFromL1EGClusters () 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_
 
std::vector< double > const etaBounds_
 
double etCut_
 
std::vector< unsigned int > const maxClustersEtaPhi_
 
std::vector< double > const phiBounds_
 
l1tpf::ParametricResolution resol_
 
edm::EDGetTokenT< BXVector< l1t::EGamma > > 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 14 of file PFClusterProducerFromL1EGClusters.cc.

Constructor & Destructor Documentation

◆ PFClusterProducerFromL1EGClusters()

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

Definition at line 33 of file PFClusterProducerFromL1EGClusters.cc.

References etaBounds_, Exception, maxClustersEtaPhi_, and phiBounds_.

34  : src_(consumes<BXVector<l1t::EGamma>>(iConfig.getParameter<edm::InputTag>("src"))),
35  etCut_(iConfig.getParameter<double>("etMin")),
36  etaBounds_(iConfig.getParameter<std::vector<double>>("etaBounds")),
37  phiBounds_(iConfig.getParameter<std::vector<double>>("phiBounds")),
38  maxClustersEtaPhi_(iConfig.getParameter<std::vector<unsigned int>>("maxClustersEtaPhi")),
39  corrector_(iConfig.getParameter<std::string>("corrector"), -1),
40  resol_(iConfig.getParameter<edm::ParameterSet>("resol")) {
41  produces<l1t::PFClusterCollection>("all");
42  produces<l1t::PFClusterCollection>("selected");
43  if ((etaBounds_.size() - 1) * (phiBounds_.size() - 1) != maxClustersEtaPhi_.size()) {
44  throw cms::Exception("Configuration")
45  << "Size mismatch between eta/phi bounds and max clusters: " << (etaBounds_.size() - 1) << " x "
46  << (phiBounds_.size() - 1) << " != " << maxClustersEtaPhi_.size() << "\n";
47  }
48  if (!std::is_sorted(etaBounds_.begin(), etaBounds_.end())) {
49  throw cms::Exception("Configuration") << "etaBounds is not sorted\n";
50  }
51  if (!std::is_sorted(phiBounds_.begin(), phiBounds_.end())) {
52  throw cms::Exception("Configuration") << "phiBounds is not sorted\n";
53  }
54 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< BXVector< l1t::EGamma > > src_

◆ ~PFClusterProducerFromL1EGClusters()

l1tpf::PFClusterProducerFromL1EGClusters::~PFClusterProducerFromL1EGClusters ( )
inlineoverride

Definition at line 17 of file PFClusterProducerFromL1EGClusters.cc.

17 {}

Member Function Documentation

◆ produce()

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

Definition at line 56 of file PFClusterProducerFromL1EGClusters.cc.

References funct::abs(), bsc_activity_cfg::clusters, PVValHelper::eta, l1tpf_calo::GridSelector::fill(), l1trig_cff::hwQual, iEvent, cuy::ii, dqmdumpme::indices, eostools::move(), MillePedeFileConverter_cfg::out, DiDispStaMuonMonitor_cfi::pt, l1tpf_calo::GridSelector::returnSorted(), and l1t::PFCluster::setPtError().

56  {
57  std::unique_ptr<l1t::PFClusterCollection> out(new l1t::PFClusterCollection());
58  std::unique_ptr<l1t::PFClusterCollection> out_sel(new l1t::PFClusterCollection());
60  iEvent.getByToken(src_, clusters);
61 
63 
64  unsigned int index = 0;
65  for (auto it = clusters->begin(), ed = clusters->end(); it != ed; ++it, ++index) {
66  if (it->pt() <= etCut_)
67  continue;
68 
69  l1t::PFCluster cluster(
70  it->pt(), it->eta(), it->phi(), /*hOverE=*/0., /*isEM=*/true); // it->hovere() seems to return random values
71  if (corrector_.valid())
72  corrector_.correctPt(cluster);
73  cluster.setPtError(resol_(cluster.pt(), std::abs(cluster.eta())));
74  cluster.setHwQual(it->hwQual());
75  out->push_back(cluster);
76  out->back().addConstituent(edm::Ptr<l1t::L1Candidate>(clusters, index));
77  selector.fill(cluster.pt(), cluster.eta(), cluster.phi(), index);
78  }
79  std::vector<unsigned int> indices = selector.returnSorted();
80  for (unsigned int ii = 0; ii < indices.size(); ii++) {
81  unsigned int theIndex = indices[ii];
82  l1t::PFCluster cluster((clusters->begin() + theIndex)->pt(),
83  (clusters->begin() + theIndex)->eta(),
84  (clusters->begin() + theIndex)->phi(),
85  /*hOverE=*/0.,
86  /*isEM=*/true); // it->hovere() seems to return random values
87  if (corrector_.valid())
88  corrector_.correctPt(cluster);
89  cluster.setPtError(resol_(cluster.pt(), std::abs(cluster.eta())));
90  cluster.setHwQual((clusters->begin() + theIndex)->hwQual());
91  out_sel->push_back(cluster);
92  out_sel->back().addConstituent(edm::Ptr<l1t::L1Candidate>(clusters, theIndex));
93  }
94 
95  iEvent.put(std::move(out), "all");
96  iEvent.put(std::move(out_sel), "selected");
97 }
bool valid() const
Definition: corrector.h:39
void fill(float pt, float eta, float phi, unsigned int index)
int iEvent
Definition: GenABIO.cc:224
void correctPt(l1t::PFCluster &cluster, float preserveEmEt=true) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< unsigned int > returnSorted()
ii
Definition: cuy.py:589
std::vector< l1t::PFCluster > PFClusterCollection
Definition: PFCluster.h:87
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< BXVector< l1t::EGamma > > src_

Member Data Documentation

◆ corrector_

l1tpf::corrector l1tpf::PFClusterProducerFromL1EGClusters::corrector_
private

Definition at line 25 of file PFClusterProducerFromL1EGClusters.cc.

◆ etaBounds_

std::vector<double> const l1tpf::PFClusterProducerFromL1EGClusters::etaBounds_
private

◆ etCut_

double l1tpf::PFClusterProducerFromL1EGClusters::etCut_
private

Definition at line 21 of file PFClusterProducerFromL1EGClusters.cc.

◆ maxClustersEtaPhi_

std::vector<unsigned int> const l1tpf::PFClusterProducerFromL1EGClusters::maxClustersEtaPhi_
private

◆ phiBounds_

std::vector<double> const l1tpf::PFClusterProducerFromL1EGClusters::phiBounds_
private

◆ resol_

l1tpf::ParametricResolution l1tpf::PFClusterProducerFromL1EGClusters::resol_
private

Definition at line 26 of file PFClusterProducerFromL1EGClusters.cc.

◆ src_

edm::EDGetTokenT<BXVector<l1t::EGamma> > l1tpf::PFClusterProducerFromL1EGClusters::src_
private

Definition at line 20 of file PFClusterProducerFromL1EGClusters.cc.