54 useUncalib_ (ps.getParameter<bool>(
"useUncalib")),
55 l1TagIsolated_ (ps.getParameter< edm::InputTag > (
"l1TagIsolated")),
56 l1TagNonIsolated_(ps.getParameter< edm::InputTag > (
"l1TagNonIsolated")),
57 doIsolated_ (ps.getParameter<bool>(
"doIsolated")),
58 l1LowerThr_ (ps.getParameter<double> (
"l1LowerThr")),
59 l1UpperThr_ (ps.getParameter<double> (
"l1UpperThr")),
60 l1LowerThrIgnoreIsolation_(ps.getParameter<double> (
"l1LowerThrIgnoreIsolation")),
61 regionEtaMargin_(ps.getParameter<double>(
"regionEtaMargin")),
62 regionPhiMargin_(ps.getParameter<double>(
"regionPhiMargin")),
63 hitLabels (ps.getParameter<std::vector<edm::InputTag>>(
"ecalhitLabels")),
64 productLabels(ps.getParameter<std::vector<std::
string>>(
"productLabels")) {
87 std::vector<std::string> productTags;
88 productTags.push_back(
"EcalRegionalRecHitsEB");
89 productTags.push_back(
"EcalRegionalRecHitsEE");
90 desc.
add<std::vector<std::string>>(
"productLabels", productTags);
91 std::vector<edm::InputTag> inputTags;
92 inputTags.push_back(
edm::InputTag(
"hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
93 inputTags.push_back(
edm::InputTag(
"hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
94 inputTags.push_back(
edm::InputTag(
"hltESRegionalEgammaRecHit:EcalRecHitsES"));
95 desc.
add<std::vector<edm::InputTag>>(
"ecalhitLabels", inputTags);
99 desc.
add<
bool>(
"useUncalib",
true);
100 desc.
add<
bool>(
"doIsolated",
true);
101 desc.
add<
double>(
"l1LowerThr", 5.0);
102 desc.
add<
double>(
"l1UpperThr", 999.);
103 desc.
add<
double>(
"l1LowerThrIgnoreIsolation", 0.0);
104 desc.
add<
double>(
"regionEtaMargin", 0.14);
105 desc.
add<
double>(
"regionPhiMargin", 0.4);
109 template<
typename T1>
117 std::auto_ptr<const CaloSubdetectorTopology>
topology;
126 evt.
getByLabel(l1TagNonIsolated_, emNonIsolColl);
132 std::vector<EcalEtaPhiRegion> regions;
133 if(doIsolated_) getEtaPhiRegions(®ions, *emIsolColl, *l1CaloGeom,
true);
135 if(!doIsolated_
or (l1LowerThrIgnoreIsolation_ < 64)) getEtaPhiRegions(®ions, *emNonIsolColl, *l1CaloGeom,
false);
141 for (
unsigned int i=0;
i<hitLabels.size();
i++) {
145 if (!(urhcH[i].isValid())) {
146 edm::LogError(
"ProductNotFound")<<
"could not get a handle on the EcalRecHitCollection! (" << hitLabels[
i].encode() <<
")" << std::endl;
151 if (uncalibRecHits->
size() > 0) {
152 if ((*uncalibRecHits)[0].id().subdetId() ==
EcalBarrel) {
155 }
else if ((*uncalibRecHits)[0].
id().subdetId() ==
EcalEndcap) {
158 }
else if ((*uncalibRecHits)[0].
id().subdetId() ==
EcalPreshower) {
161 }
else throw(std::runtime_error(
"\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
163 if(regions.size() != 0) {
166 for (it = uncalibRecHits->
begin(); it != uncalibRecHits->
end(); it++){
170 std::vector<EcalEtaPhiRegion>::const_iterator region;
171 for (region=regions.begin(); region!=regions.end(); region++) {
172 if (region->inRegion(position))
173 uhits->push_back(*it);
178 evt.
put(uhits, productLabels[i]);
185 for (
unsigned int i=0;
i<hitLabels.size();
i++) {
189 if (!(rhcH[i].isValid())) {
190 edm::LogError(
"ProductNotFound")<<
"could not get a handle on the EcalRecHitCollection! (" << hitLabels[
i].encode() <<
")" << std::endl;
195 if (recHits->
size() > 0) {
196 if ((*recHits)[0].id().subdetId() ==
EcalBarrel) {
199 }
else if ((*recHits)[0].
id().subdetId() ==
EcalEndcap) {
205 }
else throw(std::runtime_error(
"\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
207 if(regions.size() != 0) {
209 for (it = recHits->
begin(); it != recHits->
end(); it++){
213 std::vector<EcalEtaPhiRegion>::const_iterator region;
214 for (region=regions.begin(); region!=regions.end(); region++) {
215 if (region->inRegion(position))
216 hits->push_back(*it);
221 evt.
put(hits, productLabels[i]);
229 for (
unsigned int candItr = 0 ; candItr < theCandidateCollection.size(); candItr++){
233 if(doIsolated_ and (emItr.
et() < l1LowerThrIgnoreIsolation_))
continue;
236 if ((emItr.
et() > l1LowerThr_) and (emItr.
et() < l1UpperThr_)) {
248 etaLow -= regionEtaMargin_;
249 etaHigh += regionEtaMargin_;
250 phiLow -= regionPhiMargin_;
251 phiHigh += regionPhiMargin_;
260 template<
typename T1>
262 for (
unsigned int candItr = 0 ; candItr < theCandidateCollection.size(); candItr++){
263 T1 emItr = theCandidateCollection.at(candItr);
264 if ((emItr.et() > l1LowerThr_) and (emItr.et() < l1UpperThr_)) {
266 double etaLow = emItr.eta() - regionEtaMargin_;
267 double etaHigh = emItr.eta() + regionEtaMargin_;
268 double phiLow = emItr.phi() - regionPhiMargin_;
269 double phiHigh = emItr.phi() + regionPhiMargin_;
HLTRechitInRegionsProducer(const edm::ParameterSet &ps)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
std::vector< T1 > T1Collection
double etaBinHighEdge(unsigned int etaIndex, bool central=true) const
HLTRechitInRegionsProducer< reco::RecoChargedCandidate > MuonHLTRechitInRegionsProducer
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
const std::vector< edm::InputTag > hitLabels
virtual double et() const
transverse energy
CaloTopology const * topology(0)
double etaBinLowEdge(unsigned int etaIndex, bool central=true) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
HLTRechitInRegionsProducer< l1extra::L1EmParticle > EgammaHLTRechitInRegionsProducer
#define DEFINE_FWK_MODULE(type)
const std::vector< std::string > productLabels
std::vector< EcalUncalibratedRecHit >::const_iterator const_iterator
const L1GctEmCand * gctEmCand() const
unsigned phiIndex() const
get phi index (0-17)
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
unsigned etaIndex() const
get eta index -6 to -0, +0 to +6 (bit 3 is sign, 1 for -ve Z, 0 for +ve Z)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const_iterator end() const
void produce(edm::Event &, const edm::EventSetup &) override
T const * product() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
~HLTRechitInRegionsProducer()
ESHandle< TrackerGeometry > geometry
static int position[264][3]
double emJetPhiBinLowEdge(unsigned int phiIndex) const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
void getEtaPhiRegions(std::vector< EcalEtaPhiRegion > *, T1Collection, const L1CaloGeometry &, bool)
const_iterator begin() const
std::vector< edm::EDGetTokenT< EcalUncalibratedRecHitCollection > > uncalibHitTokens
double emJetPhiBinHighEdge(unsigned int phiIndex) const