CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  hfclusters_(conf.getParameter<edm::InputTag>("hfclusters")),
34  vertices_(conf.existsAs<edm::InputTag>("VertexCollection") ? conf.getParameter<edm::InputTag>("VertexCollection"):(edm::InputTag)"offlinePrimaryVertices"),
35  HFDBversion_(conf.existsAs<int>("HFDBversion") ? conf.getParameter<int>("HFDBversion"):99),//do nothing
36  HFDBvector_(conf.existsAs<std::vector<double> >("HFDBvector") ? conf.getParameter<std::vector<double> >("HFDBvector"):defaultDB_),
37  doPU_(false),
38  Cut2D_(conf.getParameter<double>("intercept2DCut")),
39  defaultSlope2D_((Cut2D_<=0.83)?(0.475):((Cut2D_>0.83 && Cut2D_<=0.9)?(0.275):(0.2))),//fix for hlt unable to add slope variable now
40  hfvars_(HFDBversion_,HFDBvector_),
41  algo_(conf.existsAs<bool>("Correct") ? conf.getParameter<bool>("Correct") : true,
42  conf.getParameter<double>("e9e25Cut"),
43  conf.getParameter<double>("intercept2DCut"),
44  conf.existsAs<double>("intercept2DSlope") ? conf.getParameter<double>("intercept2DSlope") : defaultSlope2D_,
45  conf.getParameter<std::vector<double> >("e1e9Cut"),
46  conf.getParameter<std::vector<double> >("eCOREe9Cut"),
47  conf.getParameter<std::vector<double> >("eSeLCut"),
48  hfvars_)
49 {
50 
51  produces<reco::RecoEcalCandidateCollection>();
52 
53 }
54 
56 
57 
60 
61  e.getByLabel(hfclusters_,super_clus);
62  e.getByLabel(hfclusters_,hf_assoc);
63 
64  int nvertex = 0;
65  if(HFDBversion_!=99){
67  e.getByLabel(vertices_, pvHandle);
68  const reco::VertexCollection & vertices = *pvHandle.product();
69  static const int minNDOF = 4;
70  static const double maxAbsZ = 15.0;
71  static const double maxd0 = 2.0;
72 
73  //count verticies
74 
75  for(reco::VertexCollection::const_iterator vit = vertices.begin(); vit != vertices.end(); ++vit){
76  if(vit->ndof() > minNDOF && ((maxAbsZ <= 0) || fabs(vit->z()) <= maxAbsZ) && ((maxd0 <= 0) || fabs(vit->position().rho()) <= maxd0))
77  nvertex++;
78  }
79  }else{
80  nvertex = 1;
81  }
82 
83 
84 
85  // create return data
86  std::auto_ptr<reco::RecoEcalCandidateCollection> retdata1(new reco::RecoEcalCandidateCollection());
87 
88 
89  algo_.produce(super_clus,*hf_assoc,*retdata1,nvertex);
90 
91  e.put(retdata1);
92 
93 }
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
HFRecoEcalCandidateProducer(edm::ParameterSet const &conf)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
tuple conf
Definition: dbtoconf.py:185
void produce(const edm::Handle< reco::SuperClusterCollection > &SuperClusters, const reco::HFEMClusterShapeAssociationCollection &AssocShapes, reco::RecoEcalCandidateCollection &RecoECand, int nvtx)
T const * product() const
Definition: Handle.h:74
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
virtual void produce(edm::Event &e, edm::EventSetup const &iSetup)