CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
ESListOfFEDSProducer Class Reference

#include <ESListOfFEDSProducer.h>

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

Public Member Functions

void beginJob (void)
 
void Egamma (edm::Event &e, const edm::EventSetup &es, std::vector< int > &done, std::vector< int > &FEDs)
 
void endJob (void)
 
 ESListOfFEDSProducer (const edm::ParameterSet &pset)
 
void Jets (edm::Event &e, const edm::EventSetup &es, std::vector< int > &done, std::vector< int > &FEDs)
 
void Muon (edm::Event &e, const edm::EventSetup &es, std::vector< int > &done, std::vector< int > &FEDs)
 
void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~ESListOfFEDSProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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

std::vector< int > ListOfFEDS (double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin)
 

Private Attributes

edm::EDGetTokenT< l1extra::L1JetParticleCollectionCentralSource_
 
bool debug_
 
bool EGamma_
 
bool EMdoIsolated_
 
bool EMdoNonIsolated_
 
edm::EDGetTokenT< l1extra::L1EmParticleCollectionEMl1TagIsolated_
 
edm::EDGetTokenT< l1extra::L1EmParticleCollectionEMl1TagNonIsolated_
 
double EMregionEtaMargin_
 
double EMregionPhiMargin_
 
bool first_
 
edm::EDGetTokenT< l1extra::L1JetParticleCollectionForwardSource_
 
bool Jets_
 
bool JETSdoCentral_
 
bool JETSdoForward_
 
bool JETSdoTau_
 
double JETSregionEtaMargin_
 
double JETSregionPhiMargin_
 
bool Muon_
 
edm::EDGetTokenT< l1extra::L1MuonParticleCollectionMuonSource_
 
double MUregionEtaMargin_
 
double MUregionPhiMargin_
 
std::string OutputLabel_
 
double Ptmin_iso_
 
double Ptmin_jets_
 
double Ptmin_muon_
 
double Ptmin_noniso_
 
edm::EDGetTokenT< l1extra::L1JetParticleCollectionTauSource_
 
ESElectronicsMapperTheESMapping
 ESElectronicsMapping* TheESMapping;. More...
 
EcalElectronicsMappingTheMapping
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 31 of file ESListOfFEDSProducer.h.

Constructor & Destructor Documentation

ESListOfFEDSProducer::ESListOfFEDSProducer ( const edm::ParameterSet pset)

Definition at line 31 of file ESListOfFEDSProducer.cc.

References Exception, edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

31  {
32 
33  debug_ = pset.getUntrackedParameter<bool>("debug");
34 
35  // Pi0ListToIgnore_ = pset.getParameter<edm::InputTag>("Pi0ListToIgnore");
36  EGamma_ = pset.getUntrackedParameter<bool>("EGamma",false);
37  Muon_ = pset.getUntrackedParameter<bool>("Muon",false);
38  Jets_ = pset.getUntrackedParameter<bool>("Jets",false);
39 
40  if (EGamma_ && Muon_) {
41  throw cms::Exception("ESListOfFEDSProducer") <<
42  " Wrong configuration : EGamma and Muon should not be true at the same time." ;
43  }
44 
45  if (EGamma_) {
46  EMl1TagIsolated_ = consumes<l1extra::L1EmParticleCollection>(pset.getUntrackedParameter<edm::InputTag>("EM_l1TagIsolated"));
47  EMl1TagNonIsolated_ = consumes<l1extra::L1EmParticleCollection>(pset.getUntrackedParameter<edm::InputTag>("EM_l1TagNonIsolated"));
48  EMdoIsolated_ = pset.getUntrackedParameter<bool>("EM_doIsolated",true);
49  EMdoNonIsolated_ = pset.getUntrackedParameter<bool>("EM_doNonIsolated",true);
50  EMregionEtaMargin_ = pset.getUntrackedParameter<double>("EM_regionEtaMargin",0.25);
51  EMregionPhiMargin_ = pset.getUntrackedParameter<double>("EM_regionPhiMargin",0.40);
52  Ptmin_iso_ = pset.getUntrackedParameter<double>("Ptmin_iso",0.);
53  Ptmin_noniso_ = pset.getUntrackedParameter<double>("Ptmin_noniso",0.);
54  }
55 
56  if (Muon_) {
57  MUregionEtaMargin_ = pset.getUntrackedParameter<double>("MU_regionEtaMargin",1.0);
58  MUregionPhiMargin_ = pset.getUntrackedParameter<double>("MU_regionPhiMargin",1.0);
59  Ptmin_muon_ = pset.getUntrackedParameter<double>("Ptmin_muon",0.);
60  MuonSource_ = consumes<l1extra::L1MuonParticleCollection>(pset.getUntrackedParameter<edm::InputTag>("MuonSource"));
61  }
62 
63  if (Jets_) {
64  JETSregionEtaMargin_ = pset.getUntrackedParameter<double>("JETS_regionEtaMargin",1.0);
65  JETSregionPhiMargin_ = pset.getUntrackedParameter<double>("JETS_regionPhiMargin",1.0);
66  Ptmin_jets_ = pset.getUntrackedParameter<double>("Ptmin_jets",0.);
67  CentralSource_ = consumes<l1extra::L1JetParticleCollection>(pset.getUntrackedParameter<edm::InputTag>("CentralSource"));
68  ForwardSource_ = consumes<l1extra::L1JetParticleCollection>(pset.getUntrackedParameter<edm::InputTag>("ForwardSource"));
69  TauSource_ = consumes<l1extra::L1JetParticleCollection>(pset.getUntrackedParameter<edm::InputTag>("TauSource"));
70  JETSdoCentral_ = pset.getUntrackedParameter<bool>("JETS_doCentral",true);
71  JETSdoForward_ = pset.getUntrackedParameter<bool>("JETS_doForward",true);
72  JETSdoTau_ = pset.getUntrackedParameter<bool>("JETS_doTau",true);
73  }
74 
75  OutputLabel_ = pset.getUntrackedParameter<std::string>("OutputLabel");
76 
78  first_ = true;
79 
81 
82  consumesMany<ESListOfFEDS>();
83  produces<ESListOfFEDS>(OutputLabel_);
84 }
edm::EDGetTokenT< l1extra::L1JetParticleCollection > CentralSource_
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > MuonSource_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > ForwardSource_
ESElectronicsMapper * TheESMapping
ESElectronicsMapping* TheESMapping;.
edm::EDGetTokenT< l1extra::L1EmParticleCollection > EMl1TagIsolated_
edm::EDGetTokenT< l1extra::L1EmParticleCollection > EMl1TagNonIsolated_
EcalElectronicsMapping * TheMapping
edm::EDGetTokenT< l1extra::L1JetParticleCollection > TauSource_
ESListOfFEDSProducer::~ESListOfFEDSProducer ( )
virtual

Definition at line 86 of file ESListOfFEDSProducer.cc.

86  {
87  delete TheMapping;
88 }
EcalElectronicsMapping * TheMapping

Member Function Documentation

void ESListOfFEDSProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 123 of file ESListOfFEDSProducer.cc.

124 {}
void ESListOfFEDSProducer::Egamma ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  done,
std::vector< int > &  FEDs 
)

Definition at line 217 of file ESListOfFEDSProducer.cc.

References gather_cfg::cout, L1CaloGeometry::emJetPhiBinHighEdge(), L1CaloGeometry::emJetPhiBinLowEdge(), L1CaloGeometry::etaBinHighEdge(), L1CaloGeometry::etaBinLowEdge(), spr::find(), edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, createfilelist::int, and EnergyCorrector::pt.

217  {
218 
219  // std::vector<int> FEDs;
220 
221  if (debug_) std::cout << std::endl << std::endl << " enter in EcalListOfFEDSProducer::Egamma" << std::endl;
222 
223  //Get the L1 EM Particle Collection
225  if(EMdoIsolated_)
226  e.getByToken(EMl1TagIsolated_, emIsolColl);
227  //Get the L1 EM Particle Collection
229  if (EMdoNonIsolated_)
230  e.getByToken(EMl1TagNonIsolated_, emNonIsolColl);
231 
232  // Get the CaloGeometry
233  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
234  es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
235 
236  if(EMdoIsolated_) {
237 
238  for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin();
239  emItr != emIsolColl->end() ;++emItr ){
240 
241  float pt = emItr -> pt();
242  if (pt < Ptmin_iso_ ) continue;
243  if (debug_) std::cout << " Here is an L1 isoEM candidate of pt " << pt << std::endl;
244  // Access the GCT hardware object corresponding to the L1Extra EM object.
245  int etaIndex = emItr->gctEmCand()->etaIndex() ;
246  int phiIndex = emItr->gctEmCand()->phiIndex() ;
247  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
248  double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
249  double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
250  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
251  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
252 
253  std::vector<int> feds = ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, EMregionEtaMargin_, EMregionPhiMargin_);
254  for (int i=0; i < (int)feds.size(); i++) {
255  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
256  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
257  }
258  } // end loop on L1EmParticleCollection
259  } // endif doIsolated_
260 
261  if (EMdoNonIsolated_) {
262 
263  for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin();
264  emItr != emNonIsolColl->end() ;++emItr ){
265 
266  float pt = emItr -> pt();
267  if (debug_) std::cout << " Here is an L1 nonisoEM candidate of pt " << pt << std::endl;
268  if (pt < Ptmin_noniso_ ) continue;
269  // Access the GCT hardware object corresponding to the L1Extra EM object.
270  int etaIndex = emItr->gctEmCand()->etaIndex() ;
271  int phiIndex = emItr->gctEmCand()->phiIndex() ;
272  // std::cout << " etaIndex phiIndex " << etaIndex << " " << phiIndex << std::endl;
273  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
274  double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
275  double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
276  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
277  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
278 
279  std::vector<int> feds = ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, EMregionEtaMargin_, EMregionPhiMargin_);
280  for (int i=0; i < (int)feds.size(); i++) {
281  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
282  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
283 
284  }
285  } // end loop on L1EmParticleCollection
286  }
287 
288  if (debug_) {
289  std::cout << std::endl;
290  for (int i=0; i < (int)FEDs.size(); i++) {
291  std::cout << "Egamma: unpack FED " << FEDs[i] << std::endl;
292  }
293  std::cout << "Number of FEDS is " << FEDs.size() << std::endl;
294  }
295 
296  // return FEDs;
297 
298 }
double etaBinHighEdge(unsigned int etaIndex, bool central=true) const
double etaBinLowEdge(unsigned int etaIndex, bool central=true) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< l1extra::L1EmParticleCollection > EMl1TagIsolated_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
edm::EDGetTokenT< l1extra::L1EmParticleCollection > EMl1TagNonIsolated_
std::vector< int > ListOfFEDS(double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin)
const T & get() const
Definition: EventSetup.h:56
double emJetPhiBinLowEdge(unsigned int phiIndex) const
double emJetPhiBinHighEdge(unsigned int phiIndex) const
void ESListOfFEDSProducer::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 126 of file ESListOfFEDSProducer.cc.

127 {}
void ESListOfFEDSProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 90 of file ESListOfFEDSProducer.cc.

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

90  {
91 
93  desc.add<bool>("debug", false);
94  desc.add<bool>("EGamma", true);
95  desc.add<bool>("Muon", false);
96  desc.add<bool>("Jets", false);
97  desc.add<edm::InputTag>("EM_l1TagIsolated", edm::InputTag("l1extraParticles","Isolated"));
98  desc.add<edm::InputTag>("EM_l1TagNonIsolated", edm::InputTag("l1extraParticles","NonIsolated"));
99  desc.add<bool>("EM_doIsolated", true);
100  desc.add<bool>("EM_doNonIsolated", true);
101  desc.add<double>("EM_regionEtaMargin", 0.25);
102  desc.add<double>("EM_regionPhiMargin", 0.40);
103  desc.add<double>("Ptmin_iso", 5.0);
104  desc.add<double>("Ptmin_noniso", 5.0);
105  desc.add<double>("MU_regionEtaMargin", 1.0);
106  desc.add<double>("MU_regionPhiMargin", 1.0);
107  desc.add<double>("Ptmin_muon", 0.);
108  desc.add<edm::InputTag>("MuonSource", edm::InputTag("l1extraParticles"));
109  desc.add<double>("JETS_regionEtaMargin", 1.0);
110  desc.add<double>("JETS_regionPhiMargin", 1.0);
111  desc.add<double>("Ptmin_jets", 50.);
112  desc.add<edm::InputTag>("CentralSource", edm::InputTag("l1extraParticles","Central"));
113  desc.add<edm::InputTag>("ForwardSource", edm::InputTag("l1extraParticles","Forward"));
114  desc.add<edm::InputTag>("TauSource", edm::InputTag("l1extraParticles","Tau"));
115  desc.add<bool>("JETS_doCentral", true);
116  desc.add<bool>("JETS_doForward", true);
117  desc.add<bool>("JETS_doTau", true);
118  desc.add<std::string>("OutputLabel", "");
119  descriptions.add(("hltESListOfFEDSProducer"), desc);
120 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void ESListOfFEDSProducer::Jets ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  done,
std::vector< int > &  FEDs 
)

Definition at line 339 of file ESListOfFEDSProducer.cc.

References gather_cfg::cout, geometryDiff::epsilon, stringResolutionProvider_cfi::eta, spr::find(), edm::Event::getByToken(), mps_fire::i, createfilelist::int, and EnergyCorrector::pt.

339  {
340 
341  // std::vector<int> FEDs;
342 
343  if (debug_) std::cout << std::endl << std::endl << " enter in EcalListOfFEDSProducer::Jets" << std::endl;
344  double epsilon = 0.01;
345 
346  if (JETSdoCentral_) {
347 
349  e.getByToken(CentralSource_,jetColl);
350 
351  for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) {
352 
353  double pt = it -> pt();
354  double eta = it -> eta();
355  double phi = it -> phi();
356 
357  if (debug_) std::cout << " here is a L1 CentralJet Seed with (eta,phi) = " <<
358  eta << " " << phi << " and pt " << pt << std::endl;
359  if (pt < Ptmin_jets_ ) continue;
360 
361  std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, JETSregionEtaMargin_, JETSregionPhiMargin_);
362 
363  for (int i=0; i < (int)feds.size(); i++) {
364  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
365  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
366  }
367  }
368  }
369 
370  if (JETSdoForward_) {
371 
373  e.getByToken(ForwardSource_,jetColl);
374 
375  for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) {
376 
377  double pt = it -> pt();
378  double eta = it -> eta();
379  double phi = it -> phi();
380 
381  if (debug_) std::cout << " here is a L1 ForwardJet Seed with (eta,phi) = " <<
382  eta << " " << phi << " and pt " << pt << std::endl;
383  if (pt < Ptmin_jets_ ) continue;
384 
385  std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, JETSregionEtaMargin_, JETSregionPhiMargin_);
386 
387  for (int i=0; i < (int)feds.size(); i++) {
388  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
389  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
390  }
391  }
392  }
393 
394  if (JETSdoTau_) {
395 
397  e.getByToken(TauSource_,jetColl);
398 
399  for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) {
400 
401  double pt = it -> pt();
402  double eta = it -> eta();
403  double phi = it -> phi();
404 
405  if (debug_) std::cout << " here is a L1 TauJet Seed with (eta,phi) = " <<
406  eta << " " << phi << " and pt " << pt << std::endl;
407  if (pt < Ptmin_jets_ ) continue;
408 
409  std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, JETSregionEtaMargin_, JETSregionPhiMargin_);
410 
411  for (int i=0; i < (int)feds.size(); i++) {
412  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
413  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
414  }
415  }
416  }
417 
418  if (debug_) {
419  std::cout << std::endl;
420  for (int i=0; i < (int)FEDs.size(); i++) {
421  std::cout << "Jets: unpack FED " << FEDs[i] << std::endl;
422  }
423  std::cout << "Number of FEDS is " << FEDs.size() << std::endl;
424  }
425 
426  // return FEDs;
427 }
edm::EDGetTokenT< l1extra::L1JetParticleCollection > CentralSource_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > ForwardSource_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< int > ListOfFEDS(double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin)
edm::EDGetTokenT< l1extra::L1JetParticleCollection > TauSource_
std::vector< int > ESListOfFEDSProducer::ListOfFEDS ( double  etaLow,
double  etaHigh,
double  phiLow,
double  phiHigh,
double  etamargin,
double  phimargin 
)
private

Definition at line 430 of file ESListOfFEDSProducer.cc.

References Vispa.Plugins.EdmBrowser.EdmDataAccessor::all(), gather_cfg::cout, createTree::dd, and Geom::pi().

432 {
433 
434  std::vector<int> FEDs;
435 
436  if (phimargin > Geom::pi()) phimargin = Geom::pi() ;
437 
438 
439  if (debug_) std::cout << " etaLow etaHigh phiLow phiHigh " << etaLow << " " <<
440  etaHigh << " " << phiLow << " " << phiHigh << std::endl;
441 
442  etaLow -= etamargin;
443  etaHigh += etamargin;
444  double phiMinus = phiLow - phimargin;
445  double phiPlus = phiHigh + phimargin;
446 
447  bool all = false;
448  double dd = fabs(phiPlus-phiMinus);
449  if (debug_) std::cout << " dd = " << dd << std::endl;
450  if (dd > 2.*Geom::pi() ) all = true;
451 
452  while (phiPlus > Geom::pi()) { phiPlus -= 2.*Geom::pi() ; }
453  while (phiMinus < 0) { phiMinus += 2.*Geom::pi() ; }
454  if ( phiMinus > Geom::pi()) phiMinus -= 2.*Geom::pi() ;
455 
456  double dphi = phiPlus - phiMinus;
457  if (dphi < 0) dphi += 2.*Geom::pi() ;
458  if (debug_) std::cout << "dphi = " << dphi << std::endl;
459  if (dphi > Geom::pi()) {
460  int fed_low1 = TheMapping -> GetFED(etaLow,phiMinus*180./Geom::pi());
461  int fed_low2 = TheMapping -> GetFED(etaLow,phiPlus*180./Geom::pi());
462  if (debug_) std::cout << "fed_low1 fed_low2 " << fed_low1 << " " << fed_low2 << std::endl;
463  if (fed_low1 == fed_low2) all = true;
464  int fed_hi1 = TheMapping -> GetFED(etaHigh,phiMinus*180./Geom::pi());
465  int fed_hi2 = TheMapping -> GetFED(etaHigh,phiPlus*180./Geom::pi());
466  if (debug_) std::cout << "fed_hi1 fed_hi2 " << fed_hi1 << " " << fed_hi2 << std::endl;
467  if (fed_hi1 == fed_hi2) all = true;
468  }
469 
470 
471  if (all) {
472  if (debug_) std::cout << " unpack everything in phi ! " << std::endl;
473  phiMinus = -20 * Geom::pi() / 180.; // -20 deg
474  phiPlus = -40 * Geom::pi() / 180.; // -20 deg
475  }
476 
477  if (debug_) std::cout << " with margins : " << etaLow << " " << etaHigh << " " <<
478  phiMinus << " " << phiPlus << std::endl;
479 
480 
481  const EcalEtaPhiRegion ecalregion(etaLow,etaHigh,phiMinus,phiPlus);
482 
483  FEDs = TheMapping -> GetListofFEDs(ecalregion);
484 
485  return FEDs;
486 }
EcalElectronicsMapping * TheMapping
constexpr double pi()
Definition: Pi.h:31
void ESListOfFEDSProducer::Muon ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  done,
std::vector< int > &  FEDs 
)

Definition at line 300 of file ESListOfFEDSProducer.cc.

References gather_cfg::cout, geometryDiff::epsilon, stringResolutionProvider_cfi::eta, spr::find(), edm::Event::getByToken(), mps_fire::i, createfilelist::int, and EnergyCorrector::pt.

300  {
301 
302  if (debug_) std::cout << std::endl << std::endl << " enter in EcalListOfFEDSProducer::Muon" << std::endl;
304  e.getByToken(MuonSource_, muColl);
305 
306  double epsilon = 0.01;
307 
308  for (L1MuonParticleCollection::const_iterator it=muColl->begin(); it != muColl->end(); it++) {
309 
310  const L1MuGMTExtendedCand muonCand = (*it).gmtMuonCand();
311  double pt = (*it).pt();
312  double eta = (*it).eta();
313  double phi = (*it).phi();
314 
315  if (debug_) std::cout << " here is a L1 muon Seed with (eta,phi) = " <<
316  eta << " " << phi << " and pt " << pt << std::endl;
317  if (pt < Ptmin_muon_ ) continue;
318 
319  std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, MUregionEtaMargin_, MUregionPhiMargin_);
320 
321  for (int i=0; i < (int)feds.size(); i++) {
322  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
323  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
324  }
325  }
326 
327  if (debug_) {
328  std::cout << std::endl;
329  for (int i=0; i < (int)FEDs.size(); i++) {
330  std::cout << "Muons: unpack FED " << FEDs[i] << std::endl;
331  }
332  std::cout << "Number of FEDS is " << FEDs.size() << std::endl;
333  }
334 
335  // return FEDs;
336 
337 }
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > MuonSource_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< int > ListOfFEDS(double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin)
void ESListOfFEDSProducer::produce ( edm::Event e,
const edm::EventSetup c 
)

commented out at this moment, for muon and jets.

get ES List of FEDs ,given the ecal FED list

now push list of ES FEDs into event.

Definition at line 129 of file ESListOfFEDSProducer.cc.

References gather_cfg::cout, edm::EventID::event(), spr::find(), edm::EventSetup::get(), edm::Event::getManyByType(), mps_fire::i, edm::EventBase::id(), createfilelist::int, FEDNumbering::MINECALFEDID, eostools::move(), gen::n, edm::ESHandle< T >::product(), edm::Event::put(), and edm::EventID::run().

129  {
130 
131  if (first_) {
133  iSetup.get< EcalMappingRcd >().get(ecalmapping);
134  const EcalElectronicsMapping* TheMapping_ = ecalmapping.product();
135  *TheMapping = *TheMapping_;
136  first_ = false;
137  }
138 
139  auto productAddress = std::make_unique<ESListOfFEDS>();
140  std::vector<int> feds; // the list of Ecal FEDS produced
141 
143  std::vector<int> Done;
144  if (EGamma_) {
145  // feds = Egamma(e, iSetup, Done);
146  Egamma(e, iSetup, Done, feds);
147  }
148 
149  if (Muon_) {
151  // feds = Muon(e, iSetup, Done);
152  // Muon(e, iSetup, Done, feds);
153  }
154 
155  if (Jets_) {
156  // feds = Jets(e, iSetup, Done);
157  //Jets(e, iSetup, Done, feds);
158  }
159 
160  if ( !EGamma_ && !Muon_ && ! Jets_) {
161  for (int i=1; i <= 54; i++) {
162  if ( std::find(Done.begin(), Done.end(), i) == Done.end())
163  feds.push_back(i);
164  }
165  }
166 
167 
168  int nf = (int)feds.size();
169  for (int i=0; i <nf; i++) {
170  feds[i] += FEDNumbering::MINECALFEDID;
171  if (debug_) std::cout << "Will unpack FED " << feds[i] << std::endl;
172  }
173 
174  if (debug_ && nf < 1 )
175  std::cout << " Warning : no ECAL FED to unpack for Run " << e.id().run() << " Event " << e.id().event() << std::endl;
176 
178  std::vector<int> es_feds = TheESMapping->GetListofFEDs(feds);
179 
180  //check ES List if some of them already done
181  std::vector< edm::Handle<ESListOfFEDS> > esFEDs_Done;
182  e.getManyByType(esFEDs_Done);
183  unsigned int esnDone = esFEDs_Done.size();
184 
185  if(debug_){
186  std::cout<<int(es_feds.size())<<" feds requested, and ESunpacking have already been done "<<esnDone<<" times."<<std::endl;
187  }
188 
189  for(int i=0; i<int(esFEDs_Done.size());i++){
190  std::vector<int> done = esFEDs_Done[i]-> GetList();
191  for(int n=0; n<int(done.size());n++){
192  for(int j=0; j<int(es_feds.size());j++){
193  std::vector<int>::iterator it = find(es_feds.begin(),es_feds.end(),done[n]);
194  if( it != es_feds.end()){
195  es_feds.erase(it);
196  j--;
197  }
198  }
199  }
200  }
201 
202  if (debug_ ){
203  std::cout<<"ESListofFEDSProducer: new ES_list will be put into event: total "<<int(es_feds.size())<<std::endl;
204  for(int j=0; j<int(es_feds.size());j++){
205  std::cout<<es_feds[j]<<" ";
206  }
207  std::cout<<std::endl;
208  }
209 
210 
212  productAddress.get() -> SetList(es_feds);
213  e.put(std::move(productAddress),OutputLabel_);
214 
215 }
RunNumber_t run() const
Definition: EventID.h:39
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:450
EventNumber_t event() const
Definition: EventID.h:41
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
ESElectronicsMapper * TheESMapping
ESElectronicsMapping* TheESMapping;.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
void Egamma(edm::Event &e, const edm::EventSetup &es, std::vector< int > &done, std::vector< int > &FEDs)
EcalElectronicsMapping * TheMapping
edm::EventID id() const
Definition: EventBase.h:60
T const * product() const
Definition: ESHandle.h:86
std::vector< int > GetListofFEDs(const std::vector< int > &eeFEDs) const
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<l1extra::L1JetParticleCollection> ESListOfFEDSProducer::CentralSource_
private

Definition at line 69 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::debug_
private

Definition at line 80 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::EGamma_
private

Definition at line 46 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::EMdoIsolated_
private

Definition at line 49 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::EMdoNonIsolated_
private

Definition at line 50 of file ESListOfFEDSProducer.h.

edm::EDGetTokenT<l1extra::L1EmParticleCollection> ESListOfFEDSProducer::EMl1TagIsolated_
private

Definition at line 47 of file ESListOfFEDSProducer.h.

edm::EDGetTokenT<l1extra::L1EmParticleCollection> ESListOfFEDSProducer::EMl1TagNonIsolated_
private

Definition at line 48 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::EMregionEtaMargin_
private

Definition at line 51 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::EMregionPhiMargin_
private

Definition at line 52 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::first_
private

Definition at line 79 of file ESListOfFEDSProducer.h.

edm::EDGetTokenT<l1extra::L1JetParticleCollection> ESListOfFEDSProducer::ForwardSource_
private

Definition at line 70 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::Jets_
private

Definition at line 62 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::JETSdoCentral_
private

Definition at line 63 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::JETSdoForward_
private

Definition at line 64 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::JETSdoTau_
private

Definition at line 65 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::JETSregionEtaMargin_
private

Definition at line 66 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::JETSregionPhiMargin_
private

Definition at line 67 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::Muon_
private

Definition at line 56 of file ESListOfFEDSProducer.h.

edm::EDGetTokenT<l1extra::L1MuonParticleCollection> ESListOfFEDSProducer::MuonSource_
private

Definition at line 60 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::MUregionEtaMargin_
private

Definition at line 57 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::MUregionPhiMargin_
private

Definition at line 58 of file ESListOfFEDSProducer.h.

std::string ESListOfFEDSProducer::OutputLabel_
private

Definition at line 73 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::Ptmin_iso_
private

Definition at line 53 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::Ptmin_jets_
private

Definition at line 68 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::Ptmin_muon_
private

Definition at line 59 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::Ptmin_noniso_
private

Definition at line 54 of file ESListOfFEDSProducer.h.

edm::EDGetTokenT<l1extra::L1JetParticleCollection> ESListOfFEDSProducer::TauSource_
private

Definition at line 71 of file ESListOfFEDSProducer.h.

ESElectronicsMapper* ESListOfFEDSProducer::TheESMapping
private

ESElectronicsMapping* TheESMapping;.

Definition at line 77 of file ESListOfFEDSProducer.h.

EcalElectronicsMapping* ESListOfFEDSProducer::TheMapping
private

Definition at line 74 of file ESListOfFEDSProducer.h.