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

Public Member Functions

 EcalListOfFEDSProducer (const edm::ParameterSet &pset)
 
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)
 
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::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_
 
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::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 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::Egamma ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  done,
std::vector< int > &  FEDs 
)

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

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

316  {
317 
318  // std::vector<int> FEDs;
319 
320  if (debug_) std::cout << std::endl << std::endl << " enter in EcalListOfFEDSProducer::Jets" << std::endl;
321  double epsilon = 0.01;
322 
323  if (JETSdoCentral_) {
325  e.getByToken(CentralSource_,jetColl);
326 
327  for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) {
328 
329  double pt = it -> pt();
330  double eta = it -> eta();
331  double phi = it -> phi();
332 
333  if (debug_) std::cout << " here is a L1 CentralJet Seed with (eta,phi) = " <<
334  eta << " " << phi << " and pt " << pt << std::endl;
335 
336  if (pt < Ptmin_jets_ ) continue;
337 
338  std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, JETSregionEtaMargin_, JETSregionPhiMargin_);
339 
340  for (int i=0; i < (int)feds.size(); i++) {
341  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
342  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
343  }
344  }
345  }
346 
347  if (JETSdoForward_) {
349  e.getByToken(ForwardSource_,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 ForwardJet 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 (JETSdoTau_) {
372  e.getByToken(TauSource_,jetColl);
373 
374  for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) {
375 
376  double pt = it -> pt();
377  double eta = it -> eta();
378  double phi = it -> phi();
379 
380  if (debug_) std::cout << " here is a L1 TauJet Seed with (eta,phi) = " <<
381  eta << " " << phi << " and pt " << pt << std::endl;
382  if (pt < Ptmin_jets_ ) continue;
383 
384  std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, JETSregionEtaMargin_, JETSregionPhiMargin_);
385 
386  for (int i=0; i < (int)feds.size(); i++) {
387  if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() &&
388  std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]);
389  }
390  }
391  }
392 
393 
394 
395  if (debug_) {
396  std::cout << std::endl;
397  for (int i=0; i < (int)FEDs.size(); i++) {
398  std::cout << "Jets: unpack FED " << FEDs[i] << std::endl;
399  }
400  std::cout << "Number of FEDS is " << FEDs.size() << std::endl;
401  }
402  // return FEDs;
403 }
edm::EDGetTokenT< l1extra::L1JetParticleCollection > CentralSource_
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
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 406 of file EcalListOfFEDSProducer.cc.

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

407  {
408 
409  std::vector<int> FEDs;
410 
411  if (phimargin > Geom::pi()) phimargin = Geom::pi() ;
412 
413 
414  if (debug_) std::cout << " etaLow etaHigh phiLow phiHigh " << etaLow << " " <<
415  etaHigh << " " << phiLow << " " << phiHigh << std::endl;
416 
417  etaLow -= etamargin;
418  etaHigh += etamargin;
419  double phiMinus = phiLow - phimargin;
420  double phiPlus = phiHigh + phimargin;
421 
422  bool all = false;
423  double dd = fabs(phiPlus-phiMinus);
424  if (debug_) std::cout << " dd = " << dd << std::endl;
425  if (dd > 2.*Geom::pi() ) all = true;
426 
427  while (phiPlus > Geom::pi()) { phiPlus -= 2.*Geom::pi() ; }
428  while (phiMinus < 0) { phiMinus += 2.*Geom::pi() ; }
429  if ( phiMinus > Geom::pi()) phiMinus -= 2.*Geom::pi() ;
430 
431  double dphi = phiPlus - phiMinus;
432  if (dphi < 0) dphi += 2.*Geom::pi() ;
433  if (debug_) std::cout << "dphi = " << dphi << std::endl;
434  if (dphi > Geom::pi()) {
435  int fed_low1 = TheMapping -> GetFED(etaLow,phiMinus*180./Geom::pi());
436  int fed_low2 = TheMapping -> GetFED(etaLow,phiPlus*180./Geom::pi());
437  if (debug_) std::cout << "fed_low1 fed_low2 " << fed_low1 << " " << fed_low2 << std::endl;
438  if (fed_low1 == fed_low2) all = true;
439  int fed_hi1 = TheMapping -> GetFED(etaHigh,phiMinus*180./Geom::pi());
440  int fed_hi2 = TheMapping -> GetFED(etaHigh,phiPlus*180./Geom::pi());
441  if (debug_) std::cout << "fed_hi1 fed_hi2 " << fed_hi1 << " " << fed_hi2 << std::endl;
442  if (fed_hi1 == fed_hi2) all = true;
443  }
444 
445 
446  if (all) {
447  if (debug_) std::cout << " unpack everything in phi ! " << std::endl;
448  phiMinus = -20 * Geom::pi() / 180.; // -20 deg
449  phiPlus = -40 * Geom::pi() / 180.; // -20 deg
450  }
451 
452  if (debug_) std::cout << " with margins : " << etaLow << " " << etaHigh << " " <<
453  phiMinus << " " << phiPlus << std::endl;
454 
455 
456  const RectangularEtaPhiRegion ecalregion(etaLow,etaHigh,phiMinus,phiPlus);
457 
458  FEDs = TheMapping -> GetListofFEDs(ecalregion);
459  return FEDs;
460 }
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 275 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.

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

Definition at line 120 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(), nanoDQM_cfi::Muon, edm::ESHandle< T >::product(), edm::Event::put(), and edm::EventID::run().

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

Member Data Documentation

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

Definition at line 67 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::debug_
private

Definition at line 74 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::EGamma_
private

Definition at line 44 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::EMdoIsolated_
private

Definition at line 47 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::EMdoNonIsolated_
private

Definition at line 48 of file EcalListOfFEDSProducer.h.

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

Definition at line 45 of file EcalListOfFEDSProducer.h.

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

Definition at line 46 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::EMregionEtaMargin_
private

Definition at line 49 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::EMregionPhiMargin_
private

Definition at line 50 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::first_
private

Definition at line 73 of file EcalListOfFEDSProducer.h.

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

Definition at line 68 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::Jets_
private

Definition at line 60 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::JETSdoCentral_
private

Definition at line 61 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::JETSdoForward_
private

Definition at line 62 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::JETSdoTau_
private

Definition at line 63 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::JETSregionEtaMargin_
private

Definition at line 64 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::JETSregionPhiMargin_
private

Definition at line 65 of file EcalListOfFEDSProducer.h.

bool EcalListOfFEDSProducer::Muon_
private

Definition at line 54 of file EcalListOfFEDSProducer.h.

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

Definition at line 58 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::MUregionEtaMargin_
private

Definition at line 55 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::MUregionPhiMargin_
private

Definition at line 56 of file EcalListOfFEDSProducer.h.

std::string EcalListOfFEDSProducer::OutputLabel_
private

Definition at line 71 of file EcalListOfFEDSProducer.h.

edm::InputTag EcalListOfFEDSProducer::Pi0ListToIgnore_
private

Definition at line 43 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::Ptmin_iso_
private

Definition at line 51 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::Ptmin_jets_
private

Definition at line 66 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::Ptmin_muon_
private

Definition at line 57 of file EcalListOfFEDSProducer.h.

double EcalListOfFEDSProducer::Ptmin_noniso_
private

Definition at line 52 of file EcalListOfFEDSProducer.h.

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

Definition at line 69 of file EcalListOfFEDSProducer.h.

EcalElectronicsMapping* EcalListOfFEDSProducer::TheMapping
private

Definition at line 72 of file EcalListOfFEDSProducer.h.