CMS 3D CMS Logo

EgammaHLTHcalIsolationProducersRegional.cc
Go to the documentation of this file.
1 
11 
14 
19 
20 
26 
28  : recoEcalCandidateProducer_ (consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer")))
29  , hbheRecHitProducer_ (consumes<HBHERecHitCollection>(config.getParameter<edm::InputTag>("hbheRecHitProducer")))
30  , rhoProducer_ (consumes<double>(config.getParameter<edm::InputTag>("rhoProducer")))
31  , doRhoCorrection_ (config.getParameter<bool>("doRhoCorrection"))
32  , rhoMax_ (config.getParameter<double>("rhoMax"))
33  , rhoScale_ (config.getParameter<double>("rhoScale"))
34  , doEtSum_ (config.getParameter<bool>("doEtSum"))
35  , effectiveAreaBarrel_ (config.getParameter<double>("effectiveAreaBarrel"))
36  , effectiveAreaEndcap_ (config.getParameter<double>("effectiveAreaEndcap"))
37  , isolAlgo_ (new EgammaHLTHcalIsolation(config.getParameter<double>("eMinHB"),
38  config.getParameter<double>("eMinHE"),
39  config.getParameter<double>("etMinHB"),
40  config.getParameter<double>("etMinHE"),
41  config.getParameter<double>("innerCone"),
42  config.getParameter<double>("outerCone"),
43  config.getParameter<int>("depth")))
44 {
45  //register your products
46  produces < reco::RecoEcalCandidateIsolationMap >();
47 }
48 
50  delete isolAlgo_;
51 }
52 
55  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltL1SeededRecoEcalCandidate"));
56  desc.add<edm::InputTag>(("hbheRecHitProducer"), edm::InputTag("hltHbhereco"));
57  desc.add<edm::InputTag>(("rhoProducer"), edm::InputTag("fixedGridRhoFastjetAllCalo"));
58  desc.add<bool>(("doRhoCorrection"), false);
59  desc.add<double>(("rhoMax"), 9.9999999E7);
60  desc.add<double>(("rhoScale"), 1.0);
61  desc.add<double>(("eMinHB"), 0.7);
62  desc.add<double>(("eMinHE"), 0.8);
63  desc.add<double>(("etMinHB"), -1.0);
64  desc.add<double>(("etMinHE"), -1.0);
65  desc.add<double>(("innerCone"), 0);
66  desc.add<double>(("outerCone"), 0.15);
67  desc.add<int>(("depth"), -1);
68  desc.add<bool>(("doEtSum"), false);
69  desc.add<double>(("effectiveAreaBarrel"), 0.105);
70  desc.add<double>(("effectiveAreaEndcap"), 0.170);
71  descriptions.add(("hltEgammaHLTHcalIsolationProducersRegional"), desc);
72 }
73 
75 
76  // Get the HLT filtered objects
78  iEvent.getByToken(recoEcalCandidateProducer_,recoEcalCandHandle);
79 
80  // Get the barrel hcal hits
81  edm::Handle<HBHERecHitCollection> hbheRecHitHandle;
82  iEvent.getByToken(hbheRecHitProducer_, hbheRecHitHandle);
83  const HBHERecHitCollection* hbheRecHitCollection = hbheRecHitHandle.product();
84 
85  edm::ESHandle<HcalChannelQuality> hcalChStatusHandle;
86  iSetup.get<HcalChannelQualityRcd>().get( "withTopo", hcalChStatusHandle );
87  const HcalChannelQuality* hcalChStatus = hcalChStatusHandle.product();
88 
90  iSetup.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComp);
91 
92  edm::Handle<double> rhoHandle;
93  double rho = 0.0;
94  if (doRhoCorrection_) {
95  iEvent.getByToken(rhoProducer_, rhoHandle);
96  rho = *(rhoHandle.product());
97  }
98 
99  if (rho > rhoMax_)
100  rho = rhoMax_;
101 
102  rho = rho*rhoScale_;
103 
104  edm::ESHandle<CaloGeometry> caloGeomHandle;
105  iSetup.get<CaloGeometryRecord>().get(caloGeomHandle);
106  const CaloGeometry* caloGeom = caloGeomHandle.product();
107 
108  reco::RecoEcalCandidateIsolationMap isoMap(recoEcalCandHandle);
109 
110 
111  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoEcalCandHandle->begin(); iRecoEcalCand != recoEcalCandHandle->end(); iRecoEcalCand++){
112 
113  reco::RecoEcalCandidateRef recoEcalCandRef(recoEcalCandHandle,iRecoEcalCand -recoEcalCandHandle ->begin());
114 
115  float isol = 0;
116  if(doEtSum_) {
117  isol = isolAlgo_->getEtSum(recoEcalCandRef->superCluster()->eta(),
118  recoEcalCandRef->superCluster()->phi(),hbheRecHitCollection,caloGeom,
119  hcalSevLvlComp.product(),hcalChStatus);
120 
121  if (doRhoCorrection_) {
122  if (fabs(recoEcalCandRef->superCluster()->eta()) < 1.442)
123  isol = isol - rho*effectiveAreaBarrel_;
124  else
125  isol = isol - rho*effectiveAreaEndcap_;
126  }
127  } else {
128  isol = isolAlgo_->getESum(recoEcalCandRef->superCluster()->eta(),recoEcalCandRef->superCluster()->phi(),
129  hbheRecHitCollection,caloGeom,
130  hcalSevLvlComp.product(),hcalChStatus);
131  }
132 
133  isoMap.insert(recoEcalCandRef, isol);
134  }
135 
136  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(isoMap));
137 
138 }
139 
140 //define this as a plug-in
141 //DEFINE_FWK_MODULE(EgammaHLTHcalIsolationProducersRegional);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
const edm::EDGetTokenT< HBHERecHitCollection > hbheRecHitProducer_
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
Definition: config.py:1
int iEvent
Definition: GenABIO.cc:230
ParameterDescriptionBase * add(U const &iLabel, T const &value)
float getEtSum(float candEta, float candPhi, const HBHERecHitCollection *hbhe, const CaloGeometry *geometry) const
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
T const * product() const
Definition: Handle.h:81
void insert(const key_type &k, const data_type &v)
insert an association
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
fixed size matrix
#define begin
Definition: vmac.h:32
HLT enums.
float getESum(float candEta, float candPhi, const HBHERecHitCollection *hbhe, const CaloGeometry *geometry) const
T get() const
Definition: EventSetup.h:68
T const * product() const
Definition: ESHandle.h:84
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)