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 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
 
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 Member Functions

bool counterExceeded () const
 

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_
 
int nEvt_
 
int nMaxPrintout_
 
double regionEtaMargin_
 
double regionPhiMargin_
 

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 52 of file EgammaHLTRechitInRegionsProducer.cc.

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

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

Definition at line 85 of file EgammaHLTRechitInRegionsProducer.cc.

86 {}

Member Function Documentation

bool EgammaHLTRechitInRegionsProducer::counterExceeded ( ) const
inlineprivate
void EgammaHLTRechitInRegionsProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 88 of file EgammaHLTRechitInRegionsProducer.cc.

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

88  {
90  std::vector<edm::InputTag> inputTags;
91  inputTags.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
92  inputTags.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
93  inputTags.push_back(edm::InputTag("hltESRegionalEgammaRecHit:EcalRecHitsES"));
94  desc.add<std::vector<edm::InputTag>>("ecalhitLabels", inputTags);
95  desc.add<edm::InputTag>("ecalhitproducer", edm::InputTag("ecalRecHit"));
96  desc.add<edm::InputTag>("l1TagIsolated", edm::InputTag("l1extraParticles","Isolated"));
97  desc.add<edm::InputTag>("l1TagNonIsolated", edm::InputTag("l1extraParticles","NonIsolated"));
98  desc.add<bool>("doIsolated", true);
99  desc.add<double>("l1LowerThr", 5.0);
100  desc.add<double>("l1UpperThr", 999.);
101  desc.add<double>("l1LowerThrIgnoreIsolation", 0.0);
102  desc.add<double>("regionEtaMargin", 0.14);
103  desc.add<double>("regionPhiMargin", 0.4);
104  desc.add<std::vector<std::string> >("RecHitFlagToBeExcluded", std::vector<std::string>());
105  desc.add<std::vector<std::string> >("RecHitSeverityToBeExcluded", std::vector<std::string>());
106  descriptions.add(("hltEgammaHLTRechitInRegionsProducer"), desc);
107 }
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 109 of file EgammaHLTRechitInRegionsProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), doIsolated_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, alcaDQMUpload::encode(), 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_, nEvt_, or, position, edm::Handle< T >::product(), edm::Event::put(), regionEtaMargin_, and regionPhiMargin_.

109  {
110 
111  std::auto_ptr<EcalRecHitCollection> hitsEB(new EcalRecHitCollection);
112  std::auto_ptr<EcalRecHitCollection> hitsEE(new EcalRecHitCollection);
113  std::auto_ptr<EcalRecHitCollection> hitsES(new EcalRecHitCollection);
114 
116 
117  for (unsigned int i=0; i<hitLabels.size(); i++) {
118  evt.getByToken(hitTokens[i], rhcH[i]);
119  if (!(rhcH[i].isValid())) {
120  edm::LogError("ProductNotFound")<< "could not get a handle on the EcalRecHitCollection! (" << hitLabels[i].encode() << ")" << std::endl;
121  return;
122  }
123  }
124 
125  // get the collection geometry:
126  edm::ESHandle<CaloGeometry> geoHandle;
127  es.get<CaloGeometryRecord>().get(geoHandle);
128  const CaloGeometry& geometry = *geoHandle;
129  const CaloSubdetectorGeometry *geometry_p;
130  std::auto_ptr<const CaloSubdetectorTopology> topology;
131 
132  //edm::ESHandle<EcalSeverityLevelAlgo> sevlv;
133  //es.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
134  //const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
135 
136  //Get the L1 EM Particle Collection
137  //Get the L1 EM Particle Collection
139  if(doIsolated_)
140  evt.getByLabel(l1TagIsolated_, emIsolColl);
141 
142  //Get the L1 EM Particle Collection
144  evt.getByLabel(l1TagNonIsolated_, emNonIsolColl);
145 
146  // Get the CaloGeometry
147  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
148  es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
149 
150  std::vector<EcalEtaPhiRegion> regions;
151 
152  if(doIsolated_) {
153  for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin(); emItr != emIsolColl->end() ;++emItr ) {
154  if ((emItr->et() > l1LowerThr_) and (emItr->et() < l1UpperThr_)) {
155 
156  // Access the GCT hardware object corresponding to the L1Extra EM object.
157  int etaIndex = emItr->gctEmCand()->etaIndex();
158  int phiIndex = emItr->gctEmCand()->phiIndex();
159 
160  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
161  double etaLow = l1CaloGeom->etaBinLowEdge(etaIndex);
162  double etaHigh = l1CaloGeom->etaBinHighEdge(etaIndex);
163  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
164  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
165 
166  etaLow -= regionEtaMargin_;
167  etaHigh += regionEtaMargin_;
168  phiLow -= regionPhiMargin_;
169  phiHigh += regionPhiMargin_;
170 
171  regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh));
172  }
173  }
174  }
175 
177  for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin(); emItr != emNonIsolColl->end() ;++emItr ) {
178 
179  if(doIsolated_ and (emItr->et() < l1LowerThrIgnoreIsolation_))
180  continue;
181 
182  if ((emItr->et() > l1LowerThr_) and (emItr->et() < l1UpperThr_)) {
183 
184  // Access the GCT hardware object corresponding to the L1Extra EM object.
185  int etaIndex = emItr->gctEmCand()->etaIndex();
186  int phiIndex = emItr->gctEmCand()->phiIndex();
187 
188  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
189  double etaLow = l1CaloGeom->etaBinLowEdge(etaIndex);
190  double etaHigh = l1CaloGeom->etaBinHighEdge(etaIndex);
191  double phiLow = l1CaloGeom->emJetPhiBinLowEdge(phiIndex);
192  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge(phiIndex);
193 
194  etaLow -= regionEtaMargin_;
195  etaHigh += regionEtaMargin_;
196  phiLow -= regionPhiMargin_;
197  phiHigh += regionPhiMargin_;
198 
199  regions.push_back(EcalEtaPhiRegion(etaLow,etaHigh,phiLow,phiHigh));
200  }
201  }
202  }
203 
204  for (unsigned int i=0; i<hitLabels.size(); i++) {
205  const EcalRecHitCollection *recHits = rhcH[i].product();
206  if(hitLabels[i].encode() == "hltEcalRegionalEgammaRecHit:EcalRecHitsEB") {
207  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
208  topology.reset(new EcalBarrelTopology(geoHandle));
209  } else if(hitLabels[i].encode() == "hltEcalRegionalEgammaRecHit:EcalRecHitsEE") {
210  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
211  topology.reset(new EcalEndcapTopology(geoHandle));
212  } else if(hitLabels[i].encode() == "hltESRegionalEgammaRecHit:EcalRecHitsES") {
213  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
214  topology.reset(new EcalPreshowerTopology (geoHandle));
215  } else throw(std::runtime_error("\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
216 
217  if(regions.size() != 0) {
219 
220  for (it = recHits->begin(); it != recHits->end(); it++){
221  //Make the vector of seeds that we're going to use.
222  //One of the few places position is used, needed for ET calculation.
223  const CaloCellGeometry *this_cell = (*geometry_p).getGeometry(it->id());
224  GlobalPoint position = this_cell->getPosition();
225 
226  std::vector<EcalEtaPhiRegion>::const_iterator region;
227  for (region=regions.begin(); region!=regions.end(); region++) {
228  //std::cout << region->etaLow() << " " << region->etaHigh() << " " << region->phiLow() << " " << region->phiHigh() << std::endl;
229  //std::cout << i << " - " << position.eta() << " " << position.phi() << std::endl;
230  if (region->inRegion(position)) {
231  if (i == 0)
232  hitsEB->push_back(*it);
233  if (i == 1)
234  hitsEE->push_back(*it);
235  if (i == 2)
236  hitsES->push_back(*it);
237  }
238  }
239  }
240  }
241  }
242 
243  //std::cout << hitsEB->size() << " " << hitsEE->size() << " " << hitsES->size() << std::endl;
244  evt.put(hitsEB, "EcalRegionalRecHitsEB");
245  evt.put(hitsEE, "EcalRegionalRecHitsEE");
246  evt.put(hitsES, "EcalRegionalRecHitsES");
247 
248  nEvt_++;
249 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::vector< EcalRecHit >::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
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 31 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

std::string EgammaHLTRechitInRegionsProducer::hitcollection_
private

Definition at line 33 of file EgammaHLTRechitInRegionsProducer.h.

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

Definition at line 45 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

edm::InputTag EgammaHLTRechitInRegionsProducer::hitproducer_
private

Definition at line 32 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer().

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

Definition at line 46 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

double EgammaHLTRechitInRegionsProducer::l1LowerThr_
private

Definition at line 38 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

double EgammaHLTRechitInRegionsProducer::l1LowerThrIgnoreIsolation_
private

Definition at line 40 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

edm::InputTag EgammaHLTRechitInRegionsProducer::l1TagIsolated_
private

Definition at line 35 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

edm::InputTag EgammaHLTRechitInRegionsProducer::l1TagNonIsolated_
private

Definition at line 36 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

double EgammaHLTRechitInRegionsProducer::l1UpperThr_
private

Definition at line 39 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

int EgammaHLTRechitInRegionsProducer::nEvt_
private
int EgammaHLTRechitInRegionsProducer::nMaxPrintout_
private

Definition at line 28 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by counterExceeded().

double EgammaHLTRechitInRegionsProducer::regionEtaMargin_
private

Definition at line 42 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().

double EgammaHLTRechitInRegionsProducer::regionPhiMargin_
private

Definition at line 43 of file EgammaHLTRechitInRegionsProducer.h.

Referenced by EgammaHLTRechitInRegionsProducer(), and produce().