CMS 3D CMS Logo

PFClusterProducerFromHGC3DClusters.cc
Go to the documentation of this file.
1 #include <memory>
2 
8 
15 
16 namespace l1tpf {
18  public:
21 
22  private:
24  bool emOnly_;
25  double etCut_;
28  bool hasEmId_;
31 
32  void produce(edm::Event &, const edm::EventSetup &) override;
33 
34  }; // class
35 } // namespace l1tpf
36 
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 }
64 
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 }
l1tpf::PFClusterProducerFromHGC3DClusters::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: PFClusterProducerFromHGC3DClusters.cc:65
ParametricResolution.h
electrons_cff.bool
bool
Definition: electrons_cff.py:393
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
l1tpf::HGC3DClusterEgID::prepareTMVA
void prepareTMVA()
Definition: HGC3DClusterEgID.cc:17
l1tpf::PFClusterProducerFromHGC3DClusters::etCut_
double etCut_
Definition: PFClusterProducerFromHGC3DClusters.cc:25
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
AlcaSiPixelAliHarvester0T_cff.method
method
Definition: AlcaSiPixelAliHarvester0T_cff.py:41
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
l1t::HGCalMulticlusterBxCollection
BXVector< HGCalMulticluster > HGCalMulticlusterBxCollection
Definition: HGCalMulticluster.h:95
l1t::PFCluster::setIsEM
void setIsEM(bool isEM)
Definition: PFCluster.h:60
EDProducer.h
l1tpf::PFClusterProducerFromHGC3DClusters::preEmId_
StringCutObjectSelector< l1t::HGCalMulticluster > preEmId_
Definition: PFClusterProducerFromHGC3DClusters.cc:26
edm::Handle
Definition: AssociativeIterator.h:50
l1tpf::HGC3DClusterEgID::method
std::string method()
Definition: HGC3DClusterEgID.h:29
l1tpf::PFClusterProducerFromHGC3DClusters
Definition: PFClusterProducerFromHGC3DClusters.cc:17
MakerMacros.h
l1tpf::ParametricResolution
Definition: ParametricResolution.h:10
l1tpf::corrector
Definition: corrector.h:15
HGCalMulticluster.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
l1tpf::PFClusterProducerFromHGC3DClusters::~PFClusterProducerFromHGC3DClusters
~PFClusterProducerFromHGC3DClusters() override
Definition: PFClusterProducerFromHGC3DClusters.cc:20
l1tpf::PFClusterProducerFromHGC3DClusters::resol_
l1tpf::ParametricResolution resol_
Definition: PFClusterProducerFromHGC3DClusters.cc:30
BXVector::begin
const_iterator begin(int bx) const
l1tpf::PFClusterProducerFromHGC3DClusters::emOnly_
bool emOnly_
Definition: PFClusterProducerFromHGC3DClusters.cc:24
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
l1tpf::PFClusterProducerFromHGC3DClusters::src_
edm::EDGetTokenT< l1t::HGCalMulticlusterBxCollection > src_
Definition: PFClusterProducerFromHGC3DClusters.cc:23
BXVector::end
const_iterator end(int bx) const
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ParameterSet
Definition: Functions.h:16
BXVector::key
unsigned int key(const_iterator &iter) const
Definition: BXVector.h:101
l1t
delete x;
Definition: CaloConfig.h:22
l1tpf::PFClusterProducerFromHGC3DClusters::hasEmId_
bool hasEmId_
Definition: PFClusterProducerFromHGC3DClusters.cc:28
iEvent
int iEvent
Definition: GenABIO.cc:224
l1tpf::PFClusterProducerFromHGC3DClusters::PFClusterProducerFromHGC3DClusters
PFClusterProducerFromHGC3DClusters(const edm::ParameterSet &)
Definition: PFClusterProducerFromHGC3DClusters.cc:37
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:57
HGC3DClusterEgID.h
edm::Ptr
Definition: AssociationVector.h:31
electrons_cff.hoe
hoe
Definition: electrons_cff.py:425
PFCluster.h
l1tpf::HGC3DClusterEgID
Definition: HGC3DClusterEgID.h:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
StringCutObjectSelector.h
Frameworkfwd.h
StringCutObjectSelector< l1t::HGCalMulticluster >
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
l1t::PFCluster
Definition: PFCluster.h:10
l1tpf
Definition: HGC3DClusterEgID.h:20
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterSet.h
edm::Event
Definition: Event.h:73
l1tpf::PFClusterProducerFromHGC3DClusters::corrector_
l1tpf::corrector corrector_
Definition: PFClusterProducerFromHGC3DClusters.cc:29
corrector.h
l1tpf::PFClusterProducerFromHGC3DClusters::emVsPionID_
l1tpf::HGC3DClusterEgID emVsPionID_
Definition: PFClusterProducerFromHGC3DClusters.cc:27
l1tpf::PFClusterProducerFromHGC3DClusters::emVsPUID_
l1tpf::HGC3DClusterEgID emVsPUID_
Definition: PFClusterProducerFromHGC3DClusters.cc:27