CMS 3D CMS Logo

HFRecoEcalCandidateProducer.cc
Go to the documentation of this file.
1 //
2 // Package: EgammaHFProducers
3 // Class: HFRecoEcalCandidateProducers
4 //
7 //
8 // Original Author: Kevin Klapoetke University of Minnesota
9 // Created: Wed 26 Sept 2007
10 // $Id:
11 //
12 //
13 
25 
27 #include "HFValueStruct.h"
28 
29 #include <vector>
30 #include <memory>
31 
33 public:
34  explicit HFRecoEcalCandidateProducer(edm::ParameterSet const& conf);
35  void produce(edm::Event& e, edm::EventSetup const& iSetup) override;
36 
37 private:
38  std::vector<double> defaultDB_;
41  std::vector<double> HFDBvector_;
42  bool doPU_;
43  double Cut2D_;
47 };
48 
51 
53  : defaultDB_(std::vector<double>()),
54  hfclustersSC_(consumes<reco::SuperClusterCollection>(conf.getParameter<edm::InputTag>("hfclusters"))),
55  hfclustersHFEM_(
56  consumes<reco::HFEMClusterShapeAssociationCollection>(conf.getParameter<edm::InputTag>("hfclusters"))),
57 
58  HFDBversion_(conf.existsAs<int>("HFDBversion") ? conf.getParameter<int>("HFDBversion") : 99), //do nothing
59  HFDBvector_(conf.existsAs<std::vector<double> >("HFDBvector")
60  ? conf.getParameter<std::vector<double> >("HFDBvector")
61  : defaultDB_),
62  doPU_(false),
63  Cut2D_(conf.getParameter<double>("intercept2DCut")),
64  defaultSlope2D_(
65  (Cut2D_ <= 0.83)
66  ? (0.475)
67  : ((Cut2D_ > 0.83 && Cut2D_ <= 0.9) ? (0.275) : (0.2))), //fix for hlt unable to add slope variable now
68  hfvars_(HFDBversion_, HFDBvector_),
69  algo_(conf.existsAs<bool>("Correct") ? conf.getParameter<bool>("Correct") : true,
70  conf.getParameter<double>("e9e25Cut"),
71  conf.getParameter<double>("intercept2DCut"),
72  conf.existsAs<double>("intercept2DSlope") ? conf.getParameter<double>("intercept2DSlope") : defaultSlope2D_,
73  conf.getParameter<std::vector<double> >("e1e9Cut"),
74  conf.getParameter<std::vector<double> >("eCOREe9Cut"),
75  conf.getParameter<std::vector<double> >("eSeLCut"),
76  hfvars_) {
77  if (conf.existsAs<edm::InputTag>("VertexCollection")) {
78  vertices_ = consumes<reco::VertexCollection>(conf.getParameter<edm::InputTag>("VertexCollection"));
79  } else
80  vertices_ = consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVertices"));
81 
82  produces<reco::RecoEcalCandidateCollection>();
83 }
84 
88 
89  e.getByToken(hfclustersSC_, super_clus);
90  e.getByToken(hfclustersHFEM_, hf_assoc);
91 
92  int nvertex = 0;
93  if (HFDBversion_ != 99) {
95  e.getByToken(vertices_, pvHandle);
96  const reco::VertexCollection& vertices = *pvHandle.product();
97  static const int minNDOF = 4;
98  static const double maxAbsZ = 15.0;
99  static const double maxd0 = 2.0;
100 
101  //count verticies
102 
103  for (reco::VertexCollection::const_iterator vit = vertices.begin(); vit != vertices.end(); ++vit) {
104  if (vit->ndof() > minNDOF && ((maxAbsZ <= 0) || fabs(vit->z()) <= maxAbsZ) &&
105  ((maxd0 <= 0) || fabs(vit->position().rho()) <= maxd0))
106  nvertex++;
107  }
108  } else {
109  nvertex = 1;
110  }
111 
112  // create return data
113  auto retdata1 = std::make_unique<reco::RecoEcalCandidateCollection>();
114 
115  algo_.produce(super_clus, *hf_assoc, *retdata1, nvertex);
116 
117  e.put(std::move(retdata1));
118 }
Handle.h
electrons_cff.bool
bool
Definition: electrons_cff.py:366
funct::false
false
Definition: Factorize.h:29
edm::Handle::product
T const * product() const
Definition: Handle.h:70
HFEMClusterShapeAssociation.h
HFRecoEcalCandidateProducer::HFRecoEcalCandidateProducer
HFRecoEcalCandidateProducer(edm::ParameterSet const &conf)
Definition: HFRecoEcalCandidateProducer.cc:52
HFRecoEcalCandidateAlgo::produce
void produce(const edm::Handle< reco::SuperClusterCollection > &SuperClusters, const reco::HFEMClusterShapeAssociationCollection &AssocShapes, reco::RecoEcalCandidateCollection &RecoECand, int nvtx) const
Definition: HFRecoEcalCandidateAlgo.cc:105
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
EDProducer.h
reco::HFValueStruct
Definition: HFValueStruct.h:8
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
HFRecoEcalCandidateProducer::hfclustersHFEM_
edm::EDGetToken hfclustersHFEM_
Definition: HFRecoEcalCandidateProducer.cc:39
HFRecoEcalCandidateProducer::Cut2D_
double Cut2D_
Definition: HFRecoEcalCandidateProducer.cc:43
HFRecoEcalCandidateProducer::produce
void produce(edm::Event &e, edm::EventSetup const &iSetup) override
Definition: HFRecoEcalCandidateProducer.cc:85
HFRecoEcalCandidateProducer::algo_
HFRecoEcalCandidateAlgo algo_
Definition: HFRecoEcalCandidateProducer.cc:46
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
HFRecoEcalCandidateProducer::vertices_
edm::EDGetToken vertices_
Definition: HFRecoEcalCandidateProducer.cc:39
MakerMacros.h
HFRecoEcalCandidateProducer::HFDBversion_
int HFDBversion_
Definition: HFRecoEcalCandidateProducer.cc:40
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HFRecoEcalCandidateAlgo
Definition: HFRecoEcalCandidateAlgo.h:23
HFRecoEcalCandidateProducer::hfclustersSC_
edm::EDGetToken hfclustersSC_
Definition: HFRecoEcalCandidateProducer.cc:39
HFRecoEcalCandidateProducer::doPU_
bool doPU_
Definition: HFRecoEcalCandidateProducer.cc:42
commonCuts_cff.maxAbsZ
maxAbsZ
Definition: commonCuts_cff.py:8
Vertex.h
reco::HFEMClusterShapeAssociationCollection
edm::AssociationMap< edm::OneToOne< SuperClusterCollection, HFEMClusterShapeCollection > > HFEMClusterShapeAssociationCollection
Definition: HFEMClusterShapeAssociation.h:16
HFRecoEcalCandidateAlgo.h
funct::true
true
Definition: Factorize.h:173
edm::ParameterSet
Definition: ParameterSet.h:47
HFValueStruct.h
Event.h
HFRecoEcalCandidateProducer::hfvars_
reco::HFValueStruct hfvars_
Definition: HFRecoEcalCandidateProducer.cc:45
createfilelist.int
int
Definition: createfilelist.py:10
HFRecoEcalCandidateProducer
Definition: HFRecoEcalCandidateProducer.cc:32
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
HFRecoEcalCandidateProducer::defaultDB_
std::vector< double > defaultDB_
Definition: HFRecoEcalCandidateProducer.cc:38
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:58
edm::EDGetToken
Definition: EDGetToken.h:35
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
RecoEcalCandidate.h
SuperCluster.h
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
HFRecoEcalCandidateProducer::HFDBvector_
std::vector< double > HFDBvector_
Definition: HFRecoEcalCandidateProducer.cc:41
commonCuts_cff.maxd0
maxd0
Definition: commonCuts_cff.py:9
ParameterSet.h
edm::Event
Definition: Event.h:73
HFEMClusterShape.h
edm::InputTag
Definition: InputTag.h:15
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HFRecoEcalCandidateProducer::defaultSlope2D_
double defaultSlope2D_
Definition: HFRecoEcalCandidateProducer.cc:44