1 #ifndef RecoEgamma_EgammayHLTProducers_HLTRecHitInAllL1RegionsProducer_h_
2 #define RecoEgamma_EgammayHLTProducers_HLTRecHitInAllL1RegionsProducer_h_
62 minEt_(para.getParameter<double>(
"minEt")),
63 maxEt_(para.getParameter<double>(
"maxEt")),
66 token_(consumesColl.consumes<T1>(para.getParameter<edm::
InputTag>(
"inputColl"))){}
73 template<
typename RecHitType>
100 template<
typename RecHitType>
104 for(
auto& pset : l1InputRegions){
106 l1RegionData_.emplace_back(createL1RegionData(type,pset,consumesCollector()));
108 recHitLabels_ =para.
getParameter<std::vector<edm::InputTag>>(
"recHitLabels");
109 productLabels_=para.
getParameter<std::vector<std::string>>(
"productLabels");
111 for (
unsigned int collNr=0; collNr<recHitLabels_.size(); collNr++) {
112 recHitTokens_.push_back(consumes<RecHitCollectionType>(recHitLabels_[collNr]));
113 produces<RecHitCollectionType> (productLabels_[collNr]);
116 template<
typename RecHitType>
120 std::vector<std::string> productTags;
121 productTags.push_back(
"EcalRegionalRecHitsEB");
122 productTags.push_back(
"EcalRegionalRecHitsEE");
123 desc.
add<std::vector<std::string>>(
"productLabels", productTags);
125 recHitLabels.push_back(
edm::InputTag(
"hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
126 recHitLabels.push_back(
edm::InputTag(
"hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
127 recHitLabels.push_back(
edm::InputTag(
"hltESRegionalEgammaRecHit:EcalRecHitsES"));
137 l1InputRegions.push_back(emIsoPSet);
142 emNonIsoPSet.
addParameter<
double>(
"regionEtaMargin",0.14);
143 emNonIsoPSet.
addParameter<
double>(
"regionPhiMargin",0.4);
145 l1InputRegions.push_back(emNonIsoPSet);
149 l1InputRegionDesc.
add<
double>(
"minEt");
150 l1InputRegionDesc.
add<
double>(
"maxEt");
151 l1InputRegionDesc.
add<
double>(
"regionEtaMargin");
152 l1InputRegionDesc.
add<
double>(
"regionPhiMargin");
154 desc.
addVPSet(
"l1InputRegions",l1InputRegionDesc,l1InputRegions);
160 template<
typename RecHitType>
171 std::vector<EcalEtaPhiRegion> regions;
172 std::for_each(l1RegionData_.begin(),l1RegionData_.end(),
173 [&
event,®ions,l1CaloGeom](
const std::unique_ptr<L1RegionDataBase>&
input)
174 {
input->getEtaPhiRegions(event,regions,*l1CaloGeom);}
177 for(
size_t recHitCollNr=0;recHitCollNr<recHitTokens_.size();recHitCollNr++){
179 event.getByToken(recHitTokens_[recHitCollNr],recHits);
188 if(!recHits->empty()){
190 if(!regions.empty()){
195 for(
const auto&
region : regions){
196 if(
region.inRegion(position)) {
197 filteredRecHits->push_back(recHit);
205 event.put(filteredRecHits,productLabels_[recHitCollNr]);
214 template<
typename RecHitType>
217 if(type==
"L1EmParticle"){
219 }
else if(type==
"L1JetParticle"){
221 }
else if(type==
"L1MuonParticle"){
225 throw cms::Exception(
"InvalidConfig") <<
" type "<<type<<
" is not recognised, this means the rec-hit you think you are keeping may not be and you should fix this error as it can lead to hard to find efficiency loses"<<std::endl;
232 template<
typename L1CollType>
236 event.getByToken(token_,l1Cands);
238 for(
const auto& l1Cand : *l1Cands){
239 if(l1Cand.et() >= minEt_ && l1Cand.et() < maxEt_){
241 double etaLow = l1Cand.eta() - regionEtaMargin_;
242 double etaHigh = l1Cand.eta() + regionEtaMargin_;
243 double phiLow = l1Cand.phi() - regionPhiMargin_;
244 double phiHigh = l1Cand.phi() + regionPhiMargin_;
255 event.getByToken(token_,l1Cands);
257 for(
const auto& l1Cand : *l1Cands){
258 if(l1Cand.et() >= minEt_ && l1Cand.et() < maxEt_){
261 int etaIndex = l1Cand.gctJetCand()->etaIndex();
262 int phiIndex = l1Cand.gctJetCand()->phiIndex();
270 etaLow -= regionEtaMargin_;
271 etaHigh += regionEtaMargin_;
272 phiLow -= regionPhiMargin_;
273 phiHigh += regionPhiMargin_;
285 event.getByToken(token_,l1Cands);
287 for(
const auto& l1Cand : *l1Cands){
288 if(l1Cand.et() >= minEt_ && l1Cand.et() < maxEt_){
291 int etaIndex = l1Cand.gctEmCand()->etaIndex();
292 int phiIndex = l1Cand.gctEmCand()->phiIndex();
300 etaLow -= regionEtaMargin_;
301 etaHigh += regionEtaMargin_;
302 phiLow -= regionPhiMargin_;
303 phiHigh += regionPhiMargin_;
void getEtaPhiRegions(const edm::Event &, std::vector< EcalEtaPhiRegion > &, const L1CaloGeometry &) const override
T getParameter(std::string const &) const
std::string defaultModuleLabel()
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
double etaBinHighEdge(unsigned int etaIndex, bool central=true) const
HLTRecHitInAllL1RegionsProducer< EcalRecHit > HLTEcalRecHitInAllL1RegionsProducer
double etaBinLowEdge(unsigned int etaIndex, bool central=true) const
std::vector< std::unique_ptr< L1RegionDataBase > > l1RegionData_
void produce(edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
L1RegionData(const edm::ParameterSet ¶, edm::ConsumesCollector &consumesColl)
virtual ~L1RegionDataBase()
HLTRecHitInAllL1RegionsProducer(const edm::ParameterSet &ps)
std::vector< edm::InputTag > recHitLabels_
~HLTRecHitInAllL1RegionsProducer()
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static std::string const input
std::vector< std::string > productLabels_
void addParameter(std::string const &name, T const &value)
HLTRecHitInAllL1RegionsProducer< EcalUncalibratedRecHit > HLTEcalUncalibratedRecHitInAllL1RegionsProducer
ParameterDescriptionBase * add(U const &iLabel, T const &value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::EDGetTokenT< T1 > token_
SubDetector subDetGeom[18]
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static int position[264][3]
virtual void getEtaPhiRegions(const edm::Event &, std::vector< EcalEtaPhiRegion > &, const L1CaloGeometry &) const =0
double emJetPhiBinLowEdge(unsigned int phiIndex) const
std::vector< edm::EDGetTokenT< RecHitCollectionType > > recHitTokens_
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
L1RegionDataBase * createL1RegionData(const std::string &, const edm::ParameterSet &, edm::ConsumesCollector &&)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
double emJetPhiBinHighEdge(unsigned int phiIndex) const