CMS 3D CMS Logo

HFRecoEcalCandidateProducer.cc
Go to the documentation of this file.
1 
9 #include <iostream>
10 #include <vector>
11 #include <memory>
12 
13 // Framework
20 //
26 
30 
32  : defaultDB_(std::vector<double>()),
33  hfclustersSC_(consumes<reco::SuperClusterCollection>(conf.getParameter<edm::InputTag>("hfclusters"))),
34  hfclustersHFEM_(
35  consumes<reco::HFEMClusterShapeAssociationCollection>(conf.getParameter<edm::InputTag>("hfclusters"))),
36 
37  HFDBversion_(conf.existsAs<int>("HFDBversion") ? conf.getParameter<int>("HFDBversion") : 99), //do nothing
38  HFDBvector_(conf.existsAs<std::vector<double> >("HFDBvector")
39  ? conf.getParameter<std::vector<double> >("HFDBvector")
40  : defaultDB_),
41  doPU_(false),
42  Cut2D_(conf.getParameter<double>("intercept2DCut")),
43  defaultSlope2D_(
44  (Cut2D_ <= 0.83)
45  ? (0.475)
46  : ((Cut2D_ > 0.83 && Cut2D_ <= 0.9) ? (0.275) : (0.2))), //fix for hlt unable to add slope variable now
47  hfvars_(HFDBversion_, HFDBvector_),
48  algo_(conf.existsAs<bool>("Correct") ? conf.getParameter<bool>("Correct") : true,
49  conf.getParameter<double>("e9e25Cut"),
50  conf.getParameter<double>("intercept2DCut"),
51  conf.existsAs<double>("intercept2DSlope") ? conf.getParameter<double>("intercept2DSlope") : defaultSlope2D_,
52  conf.getParameter<std::vector<double> >("e1e9Cut"),
53  conf.getParameter<std::vector<double> >("eCOREe9Cut"),
54  conf.getParameter<std::vector<double> >("eSeLCut"),
55  hfvars_) {
56  if (conf.existsAs<edm::InputTag>("VertexCollection")) {
57  vertices_ = consumes<reco::VertexCollection>(conf.getParameter<edm::InputTag>("VertexCollection"));
58  } else
59  vertices_ = consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVertices"));
60 
61  produces<reco::RecoEcalCandidateCollection>();
62 }
63 
67 
68  e.getByToken(hfclustersSC_, super_clus);
69  e.getByToken(hfclustersHFEM_, hf_assoc);
70 
71  int nvertex = 0;
72  if (HFDBversion_ != 99) {
74  e.getByToken(vertices_, pvHandle);
75  const reco::VertexCollection& vertices = *pvHandle.product();
76  static const int minNDOF = 4;
77  static const double maxAbsZ = 15.0;
78  static const double maxd0 = 2.0;
79 
80  //count verticies
81 
82  for (reco::VertexCollection::const_iterator vit = vertices.begin(); vit != vertices.end(); ++vit) {
83  if (vit->ndof() > minNDOF && ((maxAbsZ <= 0) || fabs(vit->z()) <= maxAbsZ) &&
84  ((maxd0 <= 0) || fabs(vit->position().rho()) <= maxd0))
85  nvertex++;
86  }
87  } else {
88  nvertex = 1;
89  }
90 
91  // create return data
92  auto retdata1 = std::make_unique<reco::RecoEcalCandidateCollection>();
93 
94  algo_.produce(super_clus, *hf_assoc, *retdata1, nvertex);
95 
96  e.put(std::move(retdata1));
97 }
Handle.h
electrons_cff.bool
bool
Definition: electrons_cff.py:393
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
HFEMClusterShapeAssociation.h
HFRecoEcalCandidateProducer::HFRecoEcalCandidateProducer
HFRecoEcalCandidateProducer(edm::ParameterSet const &conf)
Definition: HFRecoEcalCandidateProducer.cc:31
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:89353
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.h:31
HFRecoEcalCandidateProducer::produce
void produce(edm::Event &e, edm::EventSetup const &iSetup) override
Definition: HFRecoEcalCandidateProducer.cc:64
HFRecoEcalCandidateProducer::algo_
HFRecoEcalCandidateAlgo algo_
Definition: HFRecoEcalCandidateProducer.h:38
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
HFRecoEcalCandidateProducer::vertices_
edm::EDGetToken vertices_
Definition: HFRecoEcalCandidateProducer.h:31
HFRecoEcalCandidateProducer::HFDBversion_
int HFDBversion_
Definition: HFRecoEcalCandidateProducer.h:32
HFRecoEcalCandidateProducer::hfclustersSC_
edm::EDGetToken hfclustersSC_
Definition: HFRecoEcalCandidateProducer.h:31
commonCuts_cff.maxAbsZ
maxAbsZ
Definition: commonCuts_cff.py:8
Vertex.h
reco::HFEMClusterShapeAssociationCollection
edm::AssociationMap< edm::OneToOne< SuperClusterCollection, HFEMClusterShapeCollection > > HFEMClusterShapeAssociationCollection
Definition: HFEMClusterShapeAssociation.h:16
funct::true
true
Definition: Factorize.h:173
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
createfilelist.int
int
Definition: createfilelist.py:10
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::EventSetup
Definition: EventSetup.h:57
VertexFwd.h
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
RecoEcalCandidateFwd.h
commonCuts_cff.maxd0
maxd0
Definition: commonCuts_cff.py:9
HFRecoEcalCandidateProducer.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