CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
EgammaHLTRechitInRegionsProducer Class Reference

#include <EgammaHLTRechitInRegionsProducer.h>

Inheritance diagram for EgammaHLTRechitInRegionsProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EgammaHLTRechitInRegionsProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~EgammaHLTRechitInRegionsProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

bool doIsolated_
 
std::string hitcollection_
 
std::vector< edm::InputTaghitLabels
 
edm::InputTag hitproducer_
 
std::vector< edm::EDGetTokenT
< EcalRecHitCollection > > 
hitTokens
 
double l1LowerThr_
 
double l1LowerThrIgnoreIsolation_
 
edm::InputTag l1TagIsolated_
 
edm::InputTag l1TagNonIsolated_
 
double l1UpperThr_
 
std::vector< std::string > productLabels
 
double regionEtaMargin_
 
double regionPhiMargin_
 
std::vector< edm::EDGetTokenT
< EcalUncalibratedRecHitCollection > > 
uncalibHitTokens
 
bool useUncalib_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 16 of file EgammaHLTRechitInRegionsProducer.h.

Constructor & Destructor Documentation

EgammaHLTRechitInRegionsProducer::EgammaHLTRechitInRegionsProducer ( const edm::ParameterSet ps)

Definition at line 54 of file EgammaHLTRechitInRegionsProducer.cc.

References doIsolated_, edm::ParameterSet::getParameter(), hitLabels, hitTokens, i, l1LowerThr_, l1LowerThrIgnoreIsolation_, l1TagIsolated_, l1TagNonIsolated_, l1UpperThr_, productLabels, regionEtaMargin_, regionPhiMargin_, uncalibHitTokens, and useUncalib_.

54  {
55 
56  useUncalib_ = ps.getParameter<bool>("useUncalib");
57  //hitproducer_ = ps.getParameter<edm::InputTag>("ecalhitproducer");
58 
59  l1TagIsolated_ = ps.getParameter< edm::InputTag > ("l1TagIsolated");
60  l1TagNonIsolated_ = ps.getParameter< edm::InputTag > ("l1TagNonIsolated");
61  doIsolated_ = ps.getParameter<bool>("doIsolated");
62 
63  l1LowerThr_ = ps.getParameter<double> ("l1LowerThr");
64  l1UpperThr_ = ps.getParameter<double> ("l1UpperThr");
65  l1LowerThrIgnoreIsolation_ = ps.getParameter<double> ("l1LowerThrIgnoreIsolation");
66 
67  regionEtaMargin_ = ps.getParameter<double>("regionEtaMargin");
68  regionPhiMargin_ = ps.getParameter<double>("regionPhiMargin");
69 
70  //const std::vector<std::string> flagnames = ps.getParameter<std::vector<std::string> >("RecHitFlagToBeExcluded");
71  //const std::vector<int> flagsexcl = StringToEnumValue<EcalRecHit::Flags>(flagnames);
72 
73  //const std::vector<std::string> severitynames = ps.getParameter<std::vector<std::string> >("RecHitSeverityToBeExcluded");
74  //const std::vector<int> severitiesexcl = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynames);
75 
76  hitLabels = ps.getParameter<std::vector<edm::InputTag>>("ecalhitLabels");
77  productLabels = ps.getParameter<std::vector<std::string>>("productLabels");
78 
79  if (useUncalib_) {
80  for (unsigned int i=0; i<hitLabels.size(); i++) {
81  uncalibHitTokens.push_back(consumes<EcalUncalibratedRecHitCollection>(hitLabels[i]));
82  produces<EcalUncalibratedRecHitCollection>(productLabels[i]);
83  }
84  } else {
85  for (unsigned int i=0; i<hitLabels.size(); i++) {
86  hitTokens.push_back(consumes<EcalRecHitCollection>(hitLabels[i]));
87  produces<EcalRecHitCollection> (productLabels[i]);
88  }
89  }
90 }
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< EcalUncalibratedRecHitCollection > > uncalibHitTokens
int i
Definition: DBlmapReader.cc:9
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
EgammaHLTRechitInRegionsProducer::~EgammaHLTRechitInRegionsProducer ( )

Definition at line 93 of file EgammaHLTRechitInRegionsProducer.cc.

94 {}

Member Function Documentation

void EgammaHLTRechitInRegionsProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 96 of file EgammaHLTRechitInRegionsProducer.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

96  {
98  std::vector<std::string> productTags;
99  productTags.push_back("EcalRegionalRecHitsEB");
100  productTags.push_back("EcalRegionalRecHitsEE");
101  desc.add<std::vector<std::string>>("productLabels", productTags);
102  std::vector<edm::InputTag> inputTags;
103  inputTags.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
104  inputTags.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
105  inputTags.push_back(edm::InputTag("hltESRegionalEgammaRecHit:EcalRecHitsES"));
106  desc.add<std::vector<edm::InputTag>>("ecalhitLabels", inputTags);
107  //desc.add<edm::InputTag>("ecalhitproducer", edm::InputTag("ecalRecHit"));
108  desc.add<edm::InputTag>("l1TagIsolated", edm::InputTag("l1extraParticles","Isolated"));
109  desc.add<edm::InputTag>("l1TagNonIsolated", edm::InputTag("l1extraParticles","NonIsolated"));
110  desc.add<bool>("useUncalib", true);
111  desc.add<bool>("doIsolated", true);
112  desc.add<double>("l1LowerThr", 5.0);
113  desc.add<double>("l1UpperThr", 999.);
114  desc.add<double>("l1LowerThrIgnoreIsolation", 0.0);
115  desc.add<double>("regionEtaMargin", 0.14);
116  desc.add<double>("regionPhiMargin", 0.4);
117  //desc.add<std::vector<std::string> >("RecHitFlagToBeExcluded", std::vector<std::string>());
118  //desc.add<std::vector<std::string> >("RecHitSeverityToBeExcluded", std::vector<std::string>());
119  descriptions.add(("hltEgammaHLTRechitInRegionsProducer"), desc);
120 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EgammaHLTRechitInRegionsProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 122 of file EgammaHLTRechitInRegionsProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), doIsolated_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, edm::SortedCollection< T, SORT >::end(), geometry, edm::EventSetup::get(), edm::Event::getByLabel(), edm::Event::getByToken(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), hitLabels, hitTokens, i, l1LowerThr_, l1LowerThrIgnoreIsolation_, l1TagIsolated_, l1TagNonIsolated_, l1UpperThr_, or, position, edm::Handle< T >::product(), productLabels, edm::Event::put(), regionEtaMargin_, regionPhiMargin_, edm::SortedCollection< T, SORT >::size(), ecaldqm::topology(), uncalibHitTokens, and useUncalib_.

122  {
123 
124  // get the collection geometry:
125  edm::ESHandle<CaloGeometry> geoHandle;
126  es.get<CaloGeometryRecord>().get(geoHandle);
127  const CaloGeometry& geometry = *geoHandle;
128  const CaloSubdetectorGeometry *geometry_p;
129  std::auto_ptr<const CaloSubdetectorTopology> topology;
130 
131  //Get the L1 EM Particle Collection
132  //Get the L1 EM Particle Collection
134  if(doIsolated_)
135  evt.getByLabel(l1TagIsolated_, emIsolColl);
136 
137  //Get the L1 EM Particle Collection
139  evt.getByLabel(l1TagNonIsolated_, emNonIsolColl);
140 
141  // Get the CaloGeometry
142  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
143  es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
144 
145  std::vector<EcalEtaPhiRegion> regions;
146  if(doIsolated_) {
147  for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin(); emItr != emIsolColl->end() ;++emItr ) {
148  if ((emItr->et() > l1LowerThr_) and (emItr->et() < l1UpperThr_)) {
149 
150  // Access the GCT hardware object corresponding to the L1Extra EM object.
151  int etaIndex = emItr->gctEmCand()->etaIndex();
152  int phiIndex = emItr->gctEmCand()->phiIndex();
153 
154  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
155  double etaLow = l1CaloGeom->etaBinLowEdge(etaIndex);
156  double etaHigh = l1CaloGeom->etaBinHighEdge(etaIndex);
157  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
158  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
159 
160  etaLow -= regionEtaMargin_;
161  etaHigh += regionEtaMargin_;
162  phiLow -= regionPhiMargin_;
163  phiHigh += regionPhiMargin_;
164 
165  regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh));
166  }
167  }
168  }
169 
171  for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin(); emItr != emNonIsolColl->end() ;++emItr ) {
172 
173  if(doIsolated_ and (emItr->et() < l1LowerThrIgnoreIsolation_))
174  continue;
175 
176  if ((emItr->et() > l1LowerThr_) and (emItr->et() < l1UpperThr_)) {
177 
178  // Access the GCT hardware object corresponding to the L1Extra EM object.
179  int etaIndex = emItr->gctEmCand()->etaIndex();
180  int phiIndex = emItr->gctEmCand()->phiIndex();
181 
182  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
183  double etaLow = l1CaloGeom->etaBinLowEdge(etaIndex);
184  double etaHigh = l1CaloGeom->etaBinHighEdge(etaIndex);
185  double phiLow = l1CaloGeom->emJetPhiBinLowEdge(phiIndex);
186  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge(phiIndex);
187 
188  etaLow -= regionEtaMargin_;
189  etaHigh += regionEtaMargin_;
190  phiLow -= regionPhiMargin_;
191  phiHigh += regionPhiMargin_;
192 
193  regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh));
194  }
195  }
196  }
197  if (useUncalib_) {
199  for (unsigned int i=0; i<hitLabels.size(); i++) {
200  std::auto_ptr<EcalUncalibratedRecHitCollection> uhits(new EcalUncalibratedRecHitCollection);
201 
202  evt.getByToken(uncalibHitTokens[i], urhcH[i]);
203  if (!(urhcH[i].isValid())) {
204  edm::LogError("ProductNotFound")<< "could not get a handle on the EcalRecHitCollection! (" << hitLabels[i].encode() << ")" << std::endl;
205  return;
206  }
207  const EcalUncalibratedRecHitCollection* uncalibRecHits = urhcH[i].product();
208 
209  if (uncalibRecHits->size() == 0)
210  continue;
211 
212  if ((*uncalibRecHits)[0].id().subdetId() == EcalBarrel) {
213  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
214  topology.reset(new EcalBarrelTopology(geoHandle));
215  } else if ((*uncalibRecHits)[0].id().subdetId() == EcalEndcap) {
216  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
217  topology.reset(new EcalEndcapTopology(geoHandle));
218  } else if ((*uncalibRecHits)[0].id().subdetId() == EcalPreshower) {
219  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
220  topology.reset(new EcalPreshowerTopology (geoHandle));
221  } else throw(std::runtime_error("\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
222 
223  if(regions.size() != 0) {
225 
226  for (it = uncalibRecHits->begin(); it != uncalibRecHits->end(); it++){
227  const CaloCellGeometry *this_cell = (*geometry_p).getGeometry(it->id());
228  GlobalPoint position = this_cell->getPosition();
229 
230  std::vector<EcalEtaPhiRegion>::const_iterator region;
231  for (region=regions.begin(); region!=regions.end(); region++) {
232  if (region->inRegion(position))
233  uhits->push_back(*it);
234  }
235  }
236  }
237 
238  evt.put(uhits, productLabels[i]);
239  }
240  } else {
242 
243  for (unsigned int i=0; i<hitLabels.size(); i++) {
244  std::auto_ptr<EcalRecHitCollection> hits(new EcalRecHitCollection);
245 
246  evt.getByToken(hitTokens[i], rhcH[i]);
247  if (!(rhcH[i].isValid())) {
248  edm::LogError("ProductNotFound")<< "could not get a handle on the EcalRecHitCollection! (" << hitLabels[i].encode() << ")" << std::endl;
249  return;
250  }
251  const EcalRecHitCollection* recHits = rhcH[i].product();
252 
253  if (recHits->size() == 0)
254  continue;
255 
256  if ((*recHits)[0].id().subdetId() == EcalBarrel) {
257  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
258  topology.reset(new EcalBarrelTopology(geoHandle));
259  } else if ((*recHits)[0].id().subdetId() == EcalEndcap) {
260  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
261  topology.reset(new EcalEndcapTopology(geoHandle));
262  } else if ((*recHits)[0].id().subdetId() == EcalPreshower) {
263  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
264  topology.reset(new EcalPreshowerTopology (geoHandle));
265  } else throw(std::runtime_error("\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
266 
267  if(regions.size() != 0) {
269  for (it = recHits->begin(); it != recHits->end(); it++){
270  const CaloCellGeometry *this_cell = (*geometry_p).getGeometry(it->id());
271  GlobalPoint position = this_cell->getPosition();
272 
273  std::vector<EcalEtaPhiRegion>::const_iterator region;
274  for (region=regions.begin(); region!=regions.end(); region++) {
275  if (region->inRegion(position))
276  hits->push_back(*it);
277  }
278  }
279  }
280 
281  evt.put(hits, productLabels[i]);
282  }
283  }
284 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
std::vector< edm::EDGetTokenT< EcalUncalibratedRecHitCollection > > uncalibHitTokens
int i
Definition: DBlmapReader.cc:9
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
Definition: Activities.doc:12
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::vector< EcalUncalibratedRecHit >::const_iterator const_iterator
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
const_iterator end() const
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: Handle.h:81
ESHandle< TrackerGeometry > geometry
size_type size() const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
const_iterator begin() const

Member Data Documentation

bool EgammaHLTRechitInRegionsProducer::doIsolated_
private

Definition at line 28 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

std::string EgammaHLTRechitInRegionsProducer::hitcollection_
private

Definition at line 30 of file EgammaHLTRechitInRegionsProducer.h.

std::vector<edm::InputTag> EgammaHLTRechitInRegionsProducer::hitLabels
private

Definition at line 42 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

edm::InputTag EgammaHLTRechitInRegionsProducer::hitproducer_
private

Definition at line 29 of file EgammaHLTRechitInRegionsProducer.h.

std::vector<edm::EDGetTokenT<EcalRecHitCollection> > EgammaHLTRechitInRegionsProducer::hitTokens
private

Definition at line 44 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

double EgammaHLTRechitInRegionsProducer::l1LowerThr_
private

Definition at line 35 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

double EgammaHLTRechitInRegionsProducer::l1LowerThrIgnoreIsolation_
private

Definition at line 37 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

edm::InputTag EgammaHLTRechitInRegionsProducer::l1TagIsolated_
private

Definition at line 32 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

edm::InputTag EgammaHLTRechitInRegionsProducer::l1TagNonIsolated_
private

Definition at line 33 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

double EgammaHLTRechitInRegionsProducer::l1UpperThr_
private

Definition at line 36 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

std::vector<std::string> EgammaHLTRechitInRegionsProducer::productLabels
private

Definition at line 43 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

double EgammaHLTRechitInRegionsProducer::regionEtaMargin_
private

Definition at line 39 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

double EgammaHLTRechitInRegionsProducer::regionPhiMargin_
private

Definition at line 40 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

std::vector<edm::EDGetTokenT<EcalUncalibratedRecHitCollection> > EgammaHLTRechitInRegionsProducer::uncalibHitTokens
private

Definition at line 45 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

bool EgammaHLTRechitInRegionsProducer::useUncalib_
private

Definition at line 27 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().