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::stream::EDProducer<>

Public Member Functions

void Egamma (edm::Event &e, const edm::EventSetup &es, std::vector< int > &done, std::vector< int > &FEDs)
 
 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) override
 
 ~ESListOfFEDSProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::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::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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 ( )
override

Definition at line 86 of file ESListOfFEDSProducer.cc.

86  {
87  delete TheMapping;
88 }
EcalElectronicsMapping * TheMapping

Member Function Documentation

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

Definition at line 211 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.

211  {
212 
213  // std::vector<int> FEDs;
214 
215  if (debug_) std::cout << std::endl << std::endl << " enter in EcalListOfFEDSProducer::Egamma" << std::endl;
216 
217  //Get the L1 EM Particle Collection
219  if(EMdoIsolated_)
220  e.getByToken(EMl1TagIsolated_, emIsolColl);
221  //Get the L1 EM Particle Collection
223  if (EMdoNonIsolated_)
224  e.getByToken(EMl1TagNonIsolated_, emNonIsolColl);
225 
226  // Get the CaloGeometry
227  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
228  es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
229 
230  if(EMdoIsolated_) {
231 
232  for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin();
233  emItr != emIsolColl->end() ;++emItr ){
234 
235  float pt = emItr -> pt();
236  if (pt < Ptmin_iso_ ) continue;
237  if (debug_) std::cout << " Here is an L1 isoEM candidate of pt " << pt << std::endl;
238  // Access the GCT hardware object corresponding to the L1Extra EM object.
239  int etaIndex = emItr->gctEmCand()->etaIndex() ;
240  int phiIndex = emItr->gctEmCand()->phiIndex() ;
241  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
242  double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
243  double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
244  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
245  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
246 
247  std::vector<int> feds = ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, EMregionEtaMargin_, EMregionPhiMargin_);
248  for (int i=0; i < (int)feds.size(); i++) {
249  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
250  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
251  }
252  } // end loop on L1EmParticleCollection
253  } // endif doIsolated_
254 
255  if (EMdoNonIsolated_) {
256 
257  for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin();
258  emItr != emNonIsolColl->end() ;++emItr ){
259 
260  float pt = emItr -> pt();
261  if (debug_) std::cout << " Here is an L1 nonisoEM candidate of pt " << pt << std::endl;
262  if (pt < Ptmin_noniso_ ) continue;
263  // Access the GCT hardware object corresponding to the L1Extra EM object.
264  int etaIndex = emItr->gctEmCand()->etaIndex() ;
265  int phiIndex = emItr->gctEmCand()->phiIndex() ;
266  // std::cout << " etaIndex phiIndex " << etaIndex << " " << phiIndex << std::endl;
267  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
268  double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
269  double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
270  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
271  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
272 
273  std::vector<int> feds = ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, EMregionEtaMargin_, EMregionPhiMargin_);
274  for (int i=0; i < (int)feds.size(); i++) {
275  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
276  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
277 
278  }
279  } // end loop on L1EmParticleCollection
280  }
281 
282  if (debug_) {
283  std::cout << std::endl;
284  for (int i=0; i < (int)FEDs.size(); i++) {
285  std::cout << "Egamma: unpack FED " << FEDs[i] << std::endl;
286  }
287  std::cout << "Number of FEDS is " << FEDs.size() << std::endl;
288  }
289 
290  // return FEDs;
291 
292 }
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:517
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)
T get() const
Definition: EventSetup.h:71
double emJetPhiBinLowEdge(unsigned int phiIndex) const
double emJetPhiBinHighEdge(unsigned int phiIndex) const
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 333 of file ESListOfFEDSProducer.cc.

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

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

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

426 {
427 
428  std::vector<int> FEDs;
429 
430  if (phimargin > Geom::pi()) phimargin = Geom::pi() ;
431 
432 
433  if (debug_) std::cout << " etaLow etaHigh phiLow phiHigh " << etaLow << " " <<
434  etaHigh << " " << phiLow << " " << phiHigh << std::endl;
435 
436  etaLow -= etamargin;
437  etaHigh += etamargin;
438  double phiMinus = phiLow - phimargin;
439  double phiPlus = phiHigh + phimargin;
440 
441  bool all = false;
442  double dd = fabs(phiPlus-phiMinus);
443  if (debug_) std::cout << " dd = " << dd << std::endl;
444  if (dd > 2.*Geom::pi() ) all = true;
445 
446  while (phiPlus > Geom::pi()) { phiPlus -= 2.*Geom::pi() ; }
447  while (phiMinus < 0) { phiMinus += 2.*Geom::pi() ; }
448  if ( phiMinus > Geom::pi()) phiMinus -= 2.*Geom::pi() ;
449 
450  double dphi = phiPlus - phiMinus;
451  if (dphi < 0) dphi += 2.*Geom::pi() ;
452  if (debug_) std::cout << "dphi = " << dphi << std::endl;
453  if (dphi > Geom::pi()) {
454  int fed_low1 = TheMapping -> GetFED(etaLow,phiMinus*180./Geom::pi());
455  int fed_low2 = TheMapping -> GetFED(etaLow,phiPlus*180./Geom::pi());
456  if (debug_) std::cout << "fed_low1 fed_low2 " << fed_low1 << " " << fed_low2 << std::endl;
457  if (fed_low1 == fed_low2) all = true;
458  int fed_hi1 = TheMapping -> GetFED(etaHigh,phiMinus*180./Geom::pi());
459  int fed_hi2 = TheMapping -> GetFED(etaHigh,phiPlus*180./Geom::pi());
460  if (debug_) std::cout << "fed_hi1 fed_hi2 " << fed_hi1 << " " << fed_hi2 << std::endl;
461  if (fed_hi1 == fed_hi2) all = true;
462  }
463 
464 
465  if (all) {
466  if (debug_) std::cout << " unpack everything in phi ! " << std::endl;
467  phiMinus = -20 * Geom::pi() / 180.; // -20 deg
468  phiPlus = -40 * Geom::pi() / 180.; // -20 deg
469  }
470 
471  if (debug_) std::cout << " with margins : " << etaLow << " " << etaHigh << " " <<
472  phiMinus << " " << phiPlus << std::endl;
473 
474 
475  const RectangularEtaPhiRegion ecalregion(etaLow,etaHigh,phiMinus,phiPlus);
476 
477  FEDs = TheMapping -> GetListofFEDs(ecalregion);
478 
479  return FEDs;
480 }
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 294 of file ESListOfFEDSProducer.cc.

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

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

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 123 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().

123  {
124 
125  if (first_) {
127  iSetup.get< EcalMappingRcd >().get(ecalmapping);
128  const EcalElectronicsMapping* TheMapping_ = ecalmapping.product();
129  *TheMapping = *TheMapping_;
130  first_ = false;
131  }
132 
133  auto productAddress = std::make_unique<ESListOfFEDS>();
134  std::vector<int> feds; // the list of Ecal FEDS produced
135 
137  std::vector<int> Done;
138  if (EGamma_) {
139  // feds = Egamma(e, iSetup, Done);
140  Egamma(e, iSetup, Done, feds);
141  }
142 
143  if (Muon_) {
145  // feds = Muon(e, iSetup, Done);
146  // Muon(e, iSetup, Done, feds);
147  }
148 
149  if (Jets_) {
150  // feds = Jets(e, iSetup, Done);
151  //Jets(e, iSetup, Done, feds);
152  }
153 
154  if ( !EGamma_ && !Muon_ && ! Jets_) {
155  for (int i=1; i <= 54; i++) {
156  if ( std::find(Done.begin(), Done.end(), i) == Done.end())
157  feds.push_back(i);
158  }
159  }
160 
161 
162  int nf = (int)feds.size();
163  for (int i=0; i <nf; i++) {
164  feds[i] += FEDNumbering::MINECALFEDID;
165  if (debug_) std::cout << "Will unpack FED " << feds[i] << std::endl;
166  }
167 
168  if (debug_ && nf < 1 )
169  std::cout << " Warning : no ECAL FED to unpack for Run " << e.id().run() << " Event " << e.id().event() << std::endl;
170 
172  std::vector<int> es_feds = TheESMapping->GetListofFEDs(feds);
173 
174  //check ES List if some of them already done
175  std::vector< edm::Handle<ESListOfFEDS> > esFEDs_Done;
176  e.getManyByType(esFEDs_Done);
177  unsigned int esnDone = esFEDs_Done.size();
178 
179  if(debug_){
180  std::cout<<int(es_feds.size())<<" feds requested, and ESunpacking have already been done "<<esnDone<<" times."<<std::endl;
181  }
182 
183  for(int i=0; i<int(esFEDs_Done.size());i++){
184  std::vector<int> done = esFEDs_Done[i]-> GetList();
185  for(int n=0; n<int(done.size());n++){
186  for(int j=0; j<int(es_feds.size());j++){
187  std::vector<int>::iterator it = find(es_feds.begin(),es_feds.end(),done[n]);
188  if( it != es_feds.end()){
189  es_feds.erase(it);
190  j--;
191  }
192  }
193  }
194  }
195 
196  if (debug_ ){
197  std::cout<<"ESListofFEDSProducer: new ES_list will be put into event: total "<<int(es_feds.size())<<std::endl;
198  for(int j=0; j<int(es_feds.size());j++){
199  std::cout<<es_feds[j]<<" ";
200  }
201  std::cout<<std::endl;
202  }
203 
204 
206  productAddress.get() -> SetList(es_feds);
207  e.put(std::move(productAddress),OutputLabel_);
208 
209 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
ESElectronicsMapper * TheESMapping
ESElectronicsMapping* TheESMapping;.
void getManyByType(std::vector< Handle< PROD >> &results) 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
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:59
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:511

Member Data Documentation

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

Definition at line 67 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::debug_
private

Definition at line 78 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::EGamma_
private

Definition at line 44 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::EMdoIsolated_
private

Definition at line 47 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::EMdoNonIsolated_
private

Definition at line 48 of file ESListOfFEDSProducer.h.

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

Definition at line 45 of file ESListOfFEDSProducer.h.

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

Definition at line 46 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::EMregionEtaMargin_
private

Definition at line 49 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::EMregionPhiMargin_
private

Definition at line 50 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::first_
private

Definition at line 77 of file ESListOfFEDSProducer.h.

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

Definition at line 68 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::Jets_
private

Definition at line 60 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::JETSdoCentral_
private

Definition at line 61 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::JETSdoForward_
private

Definition at line 62 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::JETSdoTau_
private

Definition at line 63 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::JETSregionEtaMargin_
private

Definition at line 64 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::JETSregionPhiMargin_
private

Definition at line 65 of file ESListOfFEDSProducer.h.

bool ESListOfFEDSProducer::Muon_
private

Definition at line 54 of file ESListOfFEDSProducer.h.

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

Definition at line 58 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::MUregionEtaMargin_
private

Definition at line 55 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::MUregionPhiMargin_
private

Definition at line 56 of file ESListOfFEDSProducer.h.

std::string ESListOfFEDSProducer::OutputLabel_
private

Definition at line 71 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::Ptmin_iso_
private

Definition at line 51 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::Ptmin_jets_
private

Definition at line 66 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::Ptmin_muon_
private

Definition at line 57 of file ESListOfFEDSProducer.h.

double ESListOfFEDSProducer::Ptmin_noniso_
private

Definition at line 52 of file ESListOfFEDSProducer.h.

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

Definition at line 69 of file ESListOfFEDSProducer.h.

ESElectronicsMapper* ESListOfFEDSProducer::TheESMapping
private

ESElectronicsMapping* TheESMapping;.

Definition at line 75 of file ESListOfFEDSProducer.h.

EcalElectronicsMapping* ESListOfFEDSProducer::TheMapping
private

Definition at line 72 of file ESListOfFEDSProducer.h.