CMS 3D CMS Logo

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

#include <EcalListOfFEDSProducer.h>

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

Public Member Functions

void beginJob (void) override
 
 EcalListOfFEDSProducer (const edm::ParameterSet &pset)
 
void Egamma (edm::Event &e, const edm::EventSetup &es, std::vector< int > &done, std::vector< int > &FEDs)
 
void endJob (void) override
 
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) override
 
 ~EcalListOfFEDSProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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_
 
edm::InputTag Pi0ListToIgnore_
 
double Ptmin_iso_
 
double Ptmin_jets_
 
double Ptmin_muon_
 
double Ptmin_noniso_
 
edm::EDGetTokenT< l1extra::L1JetParticleCollectionTauSource_
 
EcalElectronicsMappingTheMapping
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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 30 of file EcalListOfFEDSProducer.h.

Constructor & Destructor Documentation

EcalListOfFEDSProducer::EcalListOfFEDSProducer ( const edm::ParameterSet pset)

Definition at line 27 of file EcalListOfFEDSProducer.cc.

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

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

Definition at line 83 of file EcalListOfFEDSProducer.cc.

83  {
84  delete TheMapping;
85 }
EcalElectronicsMapping * TheMapping

Member Function Documentation

void EcalListOfFEDSProducer::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 120 of file EcalListOfFEDSProducer.cc.

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

Definition at line 194 of file EcalListOfFEDSProducer.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.

194  {
195 
196  // std::vector<int> FEDs;
197 
198  if (debug_) std::cout << std::endl << std::endl << " enter in EcalListOfFEDSProducer::Egamma" << std::endl;
199 
200  //Get the L1 EM Particle Collection
201  //Get the L1 EM Particle Collection
203  if(EMdoIsolated_)
204  e.getByToken(EMl1TagIsolated_, emIsolColl);
205  //Get the L1 EM Particle Collection
207  if (EMdoNonIsolated_)
208  e.getByToken(EMl1TagNonIsolated_, emNonIsolColl);
209 
210  // Get the CaloGeometry
211  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
212  es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
213 
214  if(EMdoIsolated_) {
215 
216  for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin();
217  emItr != emIsolColl->end() ;++emItr ){
218 
219  float pt = emItr -> pt();
220  if (pt < Ptmin_iso_ ) continue;
221  if (debug_) std::cout << " Here is an L1 isoEM candidate of pt " << pt << std::endl;
222  // Access the GCT hardware object corresponding to the L1Extra EM object.
223  int etaIndex = emItr->gctEmCand()->etaIndex() ;
224  int phiIndex = emItr->gctEmCand()->phiIndex() ;
225  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
226  double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
227  double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
228  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
229  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
230 
231  std::vector<int> feds = ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, EMregionEtaMargin_, EMregionPhiMargin_);
232  for (int i=0; i < (int)feds.size(); i++) {
233  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
234  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
235  }
236  } // end loop on L1EmParticleCollection
237  } // endif doIsolated_
238 
239  if (EMdoNonIsolated_) {
240 
241  for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin();
242  emItr != emNonIsolColl->end() ;++emItr ){
243 
244  float pt = emItr -> pt();
245  if (debug_) std::cout << " Here is an L1 nonisoEM candidate of pt " << pt << std::endl;
246  if (pt < Ptmin_noniso_ ) continue;
247  // Access the GCT hardware object corresponding to the L1Extra EM object.
248  int etaIndex = emItr->gctEmCand()->etaIndex() ;
249  int phiIndex = emItr->gctEmCand()->phiIndex() ;
250  // std::cout << " etaIndex phiIndex " << etaIndex << " " << phiIndex << std::endl;
251  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
252  double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
253  double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
254  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
255  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
256 
257  std::vector<int> feds = ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, EMregionEtaMargin_, EMregionPhiMargin_);
258  for (int i=0; i < (int)feds.size(); i++) {
259  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
260  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
261 
262  }
263 
264  } // end loop on L1EmParticleCollection
265  }
266 
267  // std::cout << "end of get list of feds " << std::endl;
268 
269  if (debug_) {
270  std::cout << std::endl;
271  for (int i=0; i < (int)FEDs.size(); i++) {
272  std::cout << "Egamma: unpack FED " << FEDs[i] << std::endl;
273  }
274  std::cout << "Number of FEDS is " << FEDs.size() << std::endl;
275  }
276 
277  // return FEDs;
278 
279 }
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:508
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const T & get() const
Definition: EventSetup.h:55
std::vector< int > ListOfFEDS(double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin)
edm::EDGetTokenT< l1extra::L1EmParticleCollection > EMl1TagIsolated_
edm::EDGetTokenT< l1extra::L1EmParticleCollection > EMl1TagNonIsolated_
double emJetPhiBinLowEdge(unsigned int phiIndex) const
double emJetPhiBinHighEdge(unsigned int phiIndex) const
void EcalListOfFEDSProducer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 123 of file EcalListOfFEDSProducer.cc.

124 {}
void EcalListOfFEDSProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 87 of file EcalListOfFEDSProducer.cc.

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

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

Definition at line 322 of file EcalListOfFEDSProducer.cc.

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

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

Definition at line 412 of file EcalListOfFEDSProducer.cc.

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

413  {
414 
415  std::vector<int> FEDs;
416 
417  if (phimargin > Geom::pi()) phimargin = Geom::pi() ;
418 
419 
420  if (debug_) std::cout << " etaLow etaHigh phiLow phiHigh " << etaLow << " " <<
421  etaHigh << " " << phiLow << " " << phiHigh << std::endl;
422 
423  etaLow -= etamargin;
424  etaHigh += etamargin;
425  double phiMinus = phiLow - phimargin;
426  double phiPlus = phiHigh + phimargin;
427 
428  bool all = false;
429  double dd = fabs(phiPlus-phiMinus);
430  if (debug_) std::cout << " dd = " << dd << std::endl;
431  if (dd > 2.*Geom::pi() ) all = true;
432 
433  while (phiPlus > Geom::pi()) { phiPlus -= 2.*Geom::pi() ; }
434  while (phiMinus < 0) { phiMinus += 2.*Geom::pi() ; }
435  if ( phiMinus > Geom::pi()) phiMinus -= 2.*Geom::pi() ;
436 
437  double dphi = phiPlus - phiMinus;
438  if (dphi < 0) dphi += 2.*Geom::pi() ;
439  if (debug_) std::cout << "dphi = " << dphi << std::endl;
440  if (dphi > Geom::pi()) {
441  int fed_low1 = TheMapping -> GetFED(etaLow,phiMinus*180./Geom::pi());
442  int fed_low2 = TheMapping -> GetFED(etaLow,phiPlus*180./Geom::pi());
443  if (debug_) std::cout << "fed_low1 fed_low2 " << fed_low1 << " " << fed_low2 << std::endl;
444  if (fed_low1 == fed_low2) all = true;
445  int fed_hi1 = TheMapping -> GetFED(etaHigh,phiMinus*180./Geom::pi());
446  int fed_hi2 = TheMapping -> GetFED(etaHigh,phiPlus*180./Geom::pi());
447  if (debug_) std::cout << "fed_hi1 fed_hi2 " << fed_hi1 << " " << fed_hi2 << std::endl;
448  if (fed_hi1 == fed_hi2) all = true;
449  }
450 
451 
452  if (all) {
453  if (debug_) std::cout << " unpack everything in phi ! " << std::endl;
454  phiMinus = -20 * Geom::pi() / 180.; // -20 deg
455  phiPlus = -40 * Geom::pi() / 180.; // -20 deg
456  }
457 
458  if (debug_) std::cout << " with margins : " << etaLow << " " << etaHigh << " " <<
459  phiMinus << " " << phiPlus << std::endl;
460 
461 
462  const EcalEtaPhiRegion ecalregion(etaLow,etaHigh,phiMinus,phiPlus);
463 
464  FEDs = TheMapping -> GetListofFEDs(ecalregion);
465  return FEDs;
466 }
EcalElectronicsMapping * TheMapping
constexpr double pi()
Definition: Pi.h:31
void EcalListOfFEDSProducer::Muon ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  done,
std::vector< int > &  FEDs 
)

Definition at line 281 of file EcalListOfFEDSProducer.cc.

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

281  {
282 
283  // std::vector<int> FEDs;
284 
285  if (debug_) std::cout << std::endl << std::endl << " enter in EcalListOfFEDSProducer::Muon" << std::endl;
286 
288  e.getByToken(MuonSource_, muColl);
289 
290  double epsilon = 0.01;
291 
292  for (L1MuonParticleCollection::const_iterator it=muColl->begin(); it != muColl->end(); it++) {
293  const L1MuGMTExtendedCand muonCand = (*it).gmtMuonCand();
294  double pt = (*it).pt();
295  double eta = (*it).eta();
296  double phi = (*it).phi();
297 
298  if (debug_) std::cout << " here is a L1 muon Seed with (eta,phi) = " <<
299  eta << " " << phi << " and pt " << pt << std::endl;
300  if (pt < Ptmin_muon_ ) continue;
301 
302  std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, MUregionEtaMargin_, MUregionPhiMargin_);
303 
304  for (int i=0; i < (int)feds.size(); i++) {
305  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
306  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
307  }
308  }
309 
310  if (debug_) {
311  std::cout << std::endl;
312  for (int i=0; i < (int)FEDs.size(); i++) {
313  std::cout << "Muons: unpack FED " << FEDs[i] << std::endl;
314  }
315  std::cout << "Number of FEDS is " << FEDs.size() << std::endl;
316  }
317 
318  // return FEDs;
319 
320 }
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > MuonSource_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
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 EcalListOfFEDSProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 126 of file EcalListOfFEDSProducer.cc.

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

126  {
127 
128  if (first_) {
130  iSetup.get< EcalMappingRcd >().get(ecalmapping);
131  const EcalElectronicsMapping* TheMapping_ = ecalmapping.product();
132  *TheMapping = *TheMapping_;
133  first_ = false;
134  }
135 
136  auto productAddress = std::make_unique<EcalListOfFEDS>();
137 
138  std::vector<int> feds; // the list of FEDS produced by this module
139 
140 
141  // ---- First, get the list of ECAL FEDs which have already been unpacked
142 
143  std::vector< edm::Handle<EcalListOfFEDS> > FEDs_Done;
144  std::vector<int> Done;
145  e.getManyByType(FEDs_Done);
146  unsigned int nDone = FEDs_Done.size();
147  if (debug_) std::cout << " ECAL unpacking module has already run " << nDone << " times. " << std::endl;
148  for (unsigned int id=0; id < nDone; id++) {
149  // ignore the FEDs coming from unpacking in pi0 paths
150  if( Pi0ListToIgnore_.label() == FEDs_Done[id].provenance()->moduleLabel() ){continue;}
151  std::vector<int> done = FEDs_Done[id]-> GetList();
152  for (int jd=0; jd < (int)done.size(); jd++) {
153  Done.push_back(done[jd] - FEDNumbering::MINECALFEDID);
154  }
155  }
156  if (debug_) std::cout << " For this event, " << Done.size() << " ECAL FEDs have already been unpacked." << std::endl;
157 
158 
159  if (EGamma_) {
160  // feds = Egamma(e, iSetup, Done);
161  Egamma(e, iSetup, Done, feds);
162  }
163 
164  if (Muon_) {
165  // feds = Muon(e, iSetup, Done);
166  Muon(e, iSetup, Done, feds);
167  }
168 
169  if (Jets_) {
170  // feds = Jets(e, iSetup, Done);
171  Jets(e, iSetup, Done, feds);
172  }
173 
174  if ( !EGamma_ && !Muon_ && ! Jets_) {
175  for (int i=1; i <= 54; i++) {
176  if ( std::find(Done.begin(), Done.end(), i) == Done.end())
177  feds.push_back(i);
178  }
179  }
180 
181  int nf = (int)feds.size();
182  for (int i=0; i <nf; i++) {
183  feds[i] += FEDNumbering::MINECALFEDID;
184  if (debug_) std::cout << "Will unpack FED " << feds[i] << std::endl;
185  }
186 
187  if (debug_ && nf < 1 )
188  std::cout << " Warning : no ECAL FED to unpack for Run " << e.id().run() << " Event " << e.id().event() << std::endl;
189 
190  productAddress.get() -> SetList(feds);
191  e.put(std::move(productAddress),OutputLabel_);
192 }
RunNumber_t run() const
Definition: EventID.h:39
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:498
EventNumber_t event() const
Definition: EventID.h:41
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
void Muon(edm::Event &e, const edm::EventSetup &es, std::vector< int > &done, std::vector< int > &FEDs)
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)
void Jets(edm::Event &e, const edm::EventSetup &es, std::vector< int > &done, std::vector< int > &FEDs)
EcalElectronicsMapping * TheMapping
std::string const & label() const
Definition: InputTag.h:36
edm::EventID id() const
Definition: EventBase.h:60
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 68 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::debug_
private

Definition at line 75 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::EGamma_
private

Definition at line 45 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::EMdoIsolated_
private

Definition at line 48 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::EMdoNonIsolated_
private

Definition at line 49 of file EcalListOfFEDSProducer.h.

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

Definition at line 46 of file EcalListOfFEDSProducer.h.

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

Definition at line 47 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::EMregionEtaMargin_
private

Definition at line 50 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::EMregionPhiMargin_
private

Definition at line 51 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::first_
private

Definition at line 74 of file EcalListOfFEDSProducer.h.

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

Definition at line 69 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::Jets_
private

Definition at line 61 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::JETSdoCentral_
private

Definition at line 62 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::JETSdoForward_
private

Definition at line 63 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::JETSdoTau_
private

Definition at line 64 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::JETSregionEtaMargin_
private

Definition at line 65 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::JETSregionPhiMargin_
private

Definition at line 66 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::Muon_
private

Definition at line 55 of file EcalListOfFEDSProducer.h.

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

Definition at line 59 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::MUregionEtaMargin_
private

Definition at line 56 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::MUregionPhiMargin_
private

Definition at line 57 of file EcalListOfFEDSProducer.h.

std::string EcalListOfFEDSProducer::OutputLabel_
private

Definition at line 72 of file EcalListOfFEDSProducer.h.

edm::InputTag EcalListOfFEDSProducer::Pi0ListToIgnore_
private

Definition at line 44 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::Ptmin_iso_
private

Definition at line 52 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::Ptmin_jets_
private

Definition at line 67 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::Ptmin_muon_
private

Definition at line 58 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::Ptmin_noniso_
private

Definition at line 53 of file EcalListOfFEDSProducer.h.

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

Definition at line 70 of file EcalListOfFEDSProducer.h.

EcalElectronicsMapping* EcalListOfFEDSProducer::TheMapping
private

Definition at line 73 of file EcalListOfFEDSProducer.h.