Go to the documentation of this file.00001
00009 #include <iostream>
00010 #include <vector>
00011 #include <memory>
00012
00013
00014 #include "FWCore/Framework/interface/Event.h"
00015 #include "FWCore/Framework/interface/EventSetup.h"
00016 #include "DataFormats/Common/interface/Handle.h"
00017 #include "FWCore/Framework/interface/ESHandle.h"
00018 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00019 #include "FWCore/Utilities/interface/Exception.h"
00020
00021 #include "DataFormats/EgammaReco/interface/HFEMClusterShape.h"
00022 #include "DataFormats/EgammaReco/interface/HFEMClusterShapeAssociation.h"
00023 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00024 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
00025 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h"
00026
00027 #include "RecoEgamma/EgammaHFProducers/plugins/HFRecoEcalCandidateProducer.h"
00028 #include "DataFormats/VertexReco/interface/Vertex.h"
00029 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00030
00031 HFRecoEcalCandidateProducer::HFRecoEcalCandidateProducer(edm::ParameterSet const& conf):
00032 defaultDB_(std::vector<double>()),
00033 hfclusters_(conf.getParameter<edm::InputTag>("hfclusters")),
00034 vertices_(conf.existsAs<edm::InputTag>("VertexCollection") ? conf.getParameter<edm::InputTag>("VertexCollection"):(edm::InputTag)"offlinePrimaryVertices"),
00035 HFDBversion_(conf.existsAs<int>("HFDBversion") ? conf.getParameter<int>("HFDBversion"):99),
00036 HFDBvector_(conf.existsAs<std::vector<double> >("HFDBvector") ? conf.getParameter<std::vector<double> >("HFDBvector"):defaultDB_),
00037 doPU_(false),
00038 Cut2D_(conf.getParameter<double>("intercept2DCut")),
00039 defaultSlope2D_((Cut2D_<=0.83)?(0.475):((Cut2D_>0.83 && Cut2D_<=0.9)?(0.275):(0.2))),
00040 hfvars_(HFDBversion_,HFDBvector_),
00041 algo_(conf.existsAs<bool>("Correct") ? conf.getParameter<bool>("Correct") : true,
00042 conf.getParameter<double>("e9e25Cut"),
00043 conf.getParameter<double>("intercept2DCut"),
00044 conf.existsAs<double>("intercept2DSlope") ? conf.getParameter<double>("intercept2DSlope") : defaultSlope2D_,
00045 conf.getParameter<std::vector<double> >("e1e9Cut"),
00046 conf.getParameter<std::vector<double> >("eCOREe9Cut"),
00047 conf.getParameter<std::vector<double> >("eSeLCut"),
00048 hfvars_)
00049 {
00050
00051 produces<reco::RecoEcalCandidateCollection>();
00052
00053 }
00054
00055 void HFRecoEcalCandidateProducer::produce(edm::Event & e, edm::EventSetup const& iSetup) {
00056
00057
00058 edm::Handle<reco::SuperClusterCollection> super_clus;
00059 edm::Handle<reco::HFEMClusterShapeAssociationCollection> hf_assoc;
00060
00061 e.getByLabel(hfclusters_,super_clus);
00062 e.getByLabel(hfclusters_,hf_assoc);
00063
00064 int nvertex = 0;
00065 if(HFDBversion_!=99){
00066 edm:: Handle<reco::VertexCollection> pvHandle;
00067 e.getByLabel(vertices_, pvHandle);
00068 const reco::VertexCollection & vertices = *pvHandle.product();
00069 static const int minNDOF = 4;
00070 static const double maxAbsZ = 15.0;
00071 static const double maxd0 = 2.0;
00072
00073
00074
00075 for(reco::VertexCollection::const_iterator vit = vertices.begin(); vit != vertices.end(); ++vit){
00076 if(vit->ndof() > minNDOF && ((maxAbsZ <= 0) || fabs(vit->z()) <= maxAbsZ) && ((maxd0 <= 0) || fabs(vit->position().rho()) <= maxd0))
00077 nvertex++;
00078 }
00079 }else{
00080 nvertex = 1;
00081 }
00082
00083
00084
00085
00086 std::auto_ptr<reco::RecoEcalCandidateCollection> retdata1(new reco::RecoEcalCandidateCollection());
00087
00088
00089 algo_.produce(super_clus,*hf_assoc,*retdata1,nvertex);
00090
00091 e.put(retdata1);
00092
00093 }
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105