CMS 3D CMS Logo

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