#include <EcalListOfFEDSProducer.h>
Definition at line 19 of file EcalListOfFEDSProducer.h.
EcalListOfFEDSProducer::EcalListOfFEDSProducer | ( | const edm::ParameterSet & | pset | ) |
Definition at line 41 of file EcalListOfFEDSProducer.cc.
References Exception, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().
{ debug_ = pset.getUntrackedParameter<bool>("debug"); Pi0ListToIgnore_ = pset.getParameter<edm::InputTag>("Pi0ListToIgnore"); EGamma_ = pset.getUntrackedParameter<bool>("EGamma",false); Muon_ = pset.getUntrackedParameter<bool>("Muon",false); Jets_ = pset.getUntrackedParameter<bool>("Jets",false); if (EGamma_ && Muon_) { throw cms::Exception("EcalListOfFEDSProducer") << " Wrong configuration : EGamma and Muon should not be true at the same time." ; } if (EGamma_) { EMl1TagIsolated_ = pset.getUntrackedParameter<edm::InputTag>("EM_l1TagIsolated"); EMl1TagNonIsolated_ = pset.getUntrackedParameter<edm::InputTag>("EM_l1TagNonIsolated"); EMdoIsolated_ = pset.getUntrackedParameter<bool>("EM_doIsolated",true); EMdoNonIsolated_ = pset.getUntrackedParameter<bool>("EM_doNonIsolated",true); EMregionEtaMargin_ = pset.getUntrackedParameter<double>("EM_regionEtaMargin",0.25); EMregionPhiMargin_ = pset.getUntrackedParameter<double>("EM_regionPhiMargin",0.40); Ptmin_iso_ = pset.getUntrackedParameter<double>("Ptmin_iso",0.); Ptmin_noniso_ = pset.getUntrackedParameter<double>("Ptmin_noniso",0.); } if (Muon_) { MUregionEtaMargin_ = pset.getUntrackedParameter<double>("MU_regionEtaMargin",1.0); MUregionPhiMargin_ = pset.getUntrackedParameter<double>("MU_regionPhiMargin",1.0); Ptmin_muon_ = pset.getUntrackedParameter<double>("Ptmin_muon",0.); MuonSource_ = pset.getUntrackedParameter<edm::InputTag>("MuonSource"); } if (Jets_) { JETSregionEtaMargin_ = pset.getUntrackedParameter<double>("JETS_regionEtaMargin",1.0); JETSregionPhiMargin_ = pset.getUntrackedParameter<double>("JETS_regionPhiMargin",1.0); Ptmin_jets_ = pset.getUntrackedParameter<double>("Ptmin_jets",0.); CentralSource_ = pset.getUntrackedParameter<edm::InputTag>("CentralSource"); ForwardSource_ = pset.getUntrackedParameter<edm::InputTag>("ForwardSource"); TauSource_ = pset.getUntrackedParameter<edm::InputTag>("TauSource"); JETSdoCentral_ = pset.getUntrackedParameter<bool>("JETS_doCentral",true); JETSdoForward_ = pset.getUntrackedParameter<bool>("JETS_doForward",true); JETSdoTau_ = pset.getUntrackedParameter<bool>("JETS_doTau",true); } OutputLabel_ = pset.getUntrackedParameter<std::string>("OutputLabel"); TheMapping = new EcalElectronicsMapping(); first_ = true; produces<EcalListOfFEDS>(OutputLabel_); }
EcalListOfFEDSProducer::~EcalListOfFEDSProducer | ( | ) | [virtual] |
Definition at line 99 of file EcalListOfFEDSProducer.cc.
{ delete TheMapping; }
void EcalListOfFEDSProducer::beginJob | ( | void | ) | [virtual] |
void EcalListOfFEDSProducer::Egamma | ( | edm::Event & | e, |
const edm::EventSetup & | es, | ||
std::vector< int > & | done, | ||
std::vector< int > & | FEDs | ||
) |
Definition at line 181 of file EcalListOfFEDSProducer.cc.
References gather_cfg::cout, spr::find(), edm::EventSetup::get(), edm::Event::getByLabel(), and i.
{ // std::vector<int> FEDs; if (debug_) std::cout << std::endl << std::endl << " enter in EcalListOfFEDSProducer::Egamma" << std::endl; //Get the L1 EM Particle Collection //Get the L1 EM Particle Collection edm::Handle< l1extra::L1EmParticleCollection > emIsolColl ; if(EMdoIsolated_) e.getByLabel(EMl1TagIsolated_, emIsolColl); //Get the L1 EM Particle Collection edm::Handle< l1extra::L1EmParticleCollection > emNonIsolColl ; if (EMdoNonIsolated_) e.getByLabel(EMl1TagNonIsolated_, emNonIsolColl); // Get the CaloGeometry edm::ESHandle<L1CaloGeometry> l1CaloGeom ; es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ; if(EMdoIsolated_) { for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin(); emItr != emIsolColl->end() ;++emItr ){ float pt = emItr -> pt(); if (pt < Ptmin_iso_ ) continue; if (debug_) std::cout << " Here is an L1 isoEM candidate of pt " << pt << std::endl; // Access the GCT hardware object corresponding to the L1Extra EM object. int etaIndex = emItr->gctEmCand()->etaIndex() ; int phiIndex = emItr->gctEmCand()->phiIndex() ; // Use the L1CaloGeometry to find the eta, phi bin boundaries. double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ; double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ; double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ; double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ; std::vector<int> feds = ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, EMregionEtaMargin_, EMregionPhiMargin_); for (int i=0; i < (int)feds.size(); i++) { if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() && std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]); } } // end loop on L1EmParticleCollection } // endif doIsolated_ if (EMdoNonIsolated_) { for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin(); emItr != emNonIsolColl->end() ;++emItr ){ float pt = emItr -> pt(); if (debug_) std::cout << " Here is an L1 nonisoEM candidate of pt " << pt << std::endl; if (pt < Ptmin_noniso_ ) continue; // Access the GCT hardware object corresponding to the L1Extra EM object. int etaIndex = emItr->gctEmCand()->etaIndex() ; int phiIndex = emItr->gctEmCand()->phiIndex() ; // std::cout << " etaIndex phiIndex " << etaIndex << " " << phiIndex << std::endl; // Use the L1CaloGeometry to find the eta, phi bin boundaries. double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ; double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ; double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ; double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ; std::vector<int> feds = ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, EMregionEtaMargin_, EMregionPhiMargin_); for (int i=0; i < (int)feds.size(); i++) { if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() && std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]); } } // end loop on L1EmParticleCollection } // std::cout << "end of get list of feds " << std::endl; if (debug_) { std::cout << std::endl; for (int i=0; i < (int)FEDs.size(); i++) { std::cout << "Egamma: unpack FED " << FEDs[i] << std::endl; } std::cout << "Number of FEDS is " << FEDs.size() << std::endl; } // return FEDs; }
void EcalListOfFEDSProducer::endJob | ( | void | ) | [virtual] |
void EcalListOfFEDSProducer::Jets | ( | edm::Event & | e, |
const edm::EventSetup & | es, | ||
std::vector< int > & | done, | ||
std::vector< int > & | FEDs | ||
) |
Definition at line 320 of file EcalListOfFEDSProducer.cc.
References gather_cfg::cout, epsilon, eta(), spr::find(), edm::Event::getByLabel(), i, and phi.
{ // std::vector<int> FEDs; if (debug_) std::cout << std::endl << std::endl << " enter in EcalListOfFEDSProducer::Jets" << std::endl; double epsilon = 0.01; // Get the CaloGeometry // edm::ESHandle<L1CaloGeometry> l1CaloGeom ; // es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ; if (JETSdoCentral_) { edm::Handle<L1JetParticleCollection> jetColl; e.getByLabel(CentralSource_,jetColl); for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) { double pt = it -> pt(); double eta = it -> eta(); double phi = it -> phi(); if (debug_) std::cout << " here is a L1 CentralJet Seed with (eta,phi) = " << eta << " " << phi << " and pt " << pt << std::endl; // int etaIndex = it->gctJetCand()->etaIndex() ; // int phiIndex = it->gctJetCand()->phiIndex() ; // double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ; // double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ; // double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ; // double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ; // if (debug_) std::cout << " etaLow .. " << etaLow << " " << etaHigh << " " << phiLow << " " << phiHigh << std::endl; if (pt < Ptmin_jets_ ) continue; std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, JETSregionEtaMargin_, JETSregionPhiMargin_); for (int i=0; i < (int)feds.size(); i++) { if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() && std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]); } } } if (JETSdoForward_) { edm::Handle<L1JetParticleCollection> jetColl; e.getByLabel(ForwardSource_,jetColl); for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) { double pt = it -> pt(); double eta = it -> eta(); double phi = it -> phi(); if (debug_) std::cout << " here is a L1 ForwardJet Seed with (eta,phi) = " << eta << " " << phi << " and pt " << pt << std::endl; if (pt < Ptmin_jets_ ) continue; std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, JETSregionEtaMargin_, JETSregionPhiMargin_); for (int i=0; i < (int)feds.size(); i++) { if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() && std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]); } } } if (JETSdoTau_) { edm::Handle<L1JetParticleCollection> jetColl; e.getByLabel(TauSource_,jetColl); for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) { double pt = it -> pt(); double eta = it -> eta(); double phi = it -> phi(); if (debug_) std::cout << " here is a L1 TauJet Seed with (eta,phi) = " << eta << " " << phi << " and pt " << pt << std::endl; if (pt < Ptmin_jets_ ) continue; std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, JETSregionEtaMargin_, JETSregionPhiMargin_); for (int i=0; i < (int)feds.size(); i++) { if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() && std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]); } } } if (debug_) { std::cout << std::endl; for (int i=0; i < (int)FEDs.size(); i++) { std::cout << "Jets: unpack FED " << FEDs[i] << std::endl; } std::cout << "Number of FEDS is " << FEDs.size() << std::endl; } // return FEDs; }
std::vector< int > EcalListOfFEDSProducer::ListOfFEDS | ( | double | etaLow, |
double | etaHigh, | ||
double | phiLow, | ||
double | phiHigh, | ||
double | etamargin, | ||
double | phimargin | ||
) | [private] |
Definition at line 427 of file EcalListOfFEDSProducer.cc.
References cond::ecalcond::all, gather_cfg::cout, createTree::dd, reco_application_2006h2rawdata_ecalLocalReco_cfg::FEDs, Geom::pi(), and pi.
{ std::vector<int> FEDs; if (phimargin > Geom::pi()) phimargin = Geom::pi() ; if (debug_) std::cout << " etaLow etaHigh phiLow phiHigh " << etaLow << " " << etaHigh << " " << phiLow << " " << phiHigh << std::endl; etaLow -= etamargin; etaHigh += etamargin; double phiMinus = phiLow - phimargin; double phiPlus = phiHigh + phimargin; bool all = false; double dd = fabs(phiPlus-phiMinus); if (debug_) std::cout << " dd = " << dd << std::endl; if (dd > 2.*Geom::pi() ) all = true; while (phiPlus > Geom::pi()) { phiPlus -= 2.*Geom::pi() ; } while (phiMinus < 0) { phiMinus += 2.*Geom::pi() ; } if ( phiMinus > Geom::pi()) phiMinus -= 2.*Geom::pi() ; double dphi = phiPlus - phiMinus; if (dphi < 0) dphi += 2.*Geom::pi() ; if (debug_) std::cout << "dphi = " << dphi << std::endl; if (dphi > Geom::pi()) { int fed_low1 = TheMapping -> GetFED(etaLow,phiMinus*180./Geom::pi()); int fed_low2 = TheMapping -> GetFED(etaLow,phiPlus*180./Geom::pi()); if (debug_) std::cout << "fed_low1 fed_low2 " << fed_low1 << " " << fed_low2 << std::endl; if (fed_low1 == fed_low2) all = true; int fed_hi1 = TheMapping -> GetFED(etaHigh,phiMinus*180./Geom::pi()); int fed_hi2 = TheMapping -> GetFED(etaHigh,phiPlus*180./Geom::pi()); if (debug_) std::cout << "fed_hi1 fed_hi2 " << fed_hi1 << " " << fed_hi2 << std::endl; if (fed_hi1 == fed_hi2) all = true; } if (all) { if (debug_) std::cout << " unpack everything in phi ! " << std::endl; phiMinus = -20 * Geom::pi() / 180.; // -20 deg phiPlus = -40 * Geom::pi() / 180.; // -20 deg } if (debug_) std::cout << " with margins : " << etaLow << " " << etaHigh << " " << phiMinus << " " << phiPlus << std::endl; const EcalEtaPhiRegion ecalregion(etaLow,etaHigh,phiMinus,phiPlus); FEDs = TheMapping -> GetListofFEDs(ecalregion); /* if (debug_) { int nn = (int)FEDs.size(); for (int ii=0; ii < nn; ii++) { std::cout << "unpack fed " << FEDs[ii] << std::endl; } } */ return FEDs; }
void EcalListOfFEDSProducer::Muon | ( | edm::Event & | e, |
const edm::EventSetup & | es, | ||
std::vector< int > & | done, | ||
std::vector< int > & | FEDs | ||
) |
Definition at line 273 of file EcalListOfFEDSProducer.cc.
References gather_cfg::cout, epsilon, eta(), spr::find(), edm::Event::getByLabel(), i, and phi.
{ // std::vector<int> FEDs; if (debug_) std::cout << std::endl << std::endl << " enter in EcalListOfFEDSProducer::Muon" << std::endl; edm::Handle<L1MuonParticleCollection> muColl; e.getByLabel(MuonSource_, muColl); double epsilon = 0.01; for (L1MuonParticleCollection::const_iterator it=muColl->begin(); it != muColl->end(); it++) { const L1MuGMTExtendedCand muonCand = (*it).gmtMuonCand(); double pt = (*it).pt(); double eta = (*it).eta(); double phi = (*it).phi(); if (debug_) std::cout << " here is a L1 muon Seed with (eta,phi) = " << eta << " " << phi << " and pt " << pt << std::endl; if (pt < Ptmin_muon_ ) continue; std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, MUregionEtaMargin_, MUregionPhiMargin_); for (int i=0; i < (int)feds.size(); i++) { if ( std::find(FEDs.begin(), FEDs.end(), feds[i]) == FEDs.end() && std::find(done.begin(), done.end(), feds[i]) == done.end() ) FEDs.push_back(feds[i]); } } if (debug_) { std::cout << std::endl; for (int i=0; i < (int)FEDs.size(); i++) { std::cout << "Muons: unpack FED " << FEDs[i] << std::endl; } std::cout << "Number of FEDS is " << FEDs.size() << std::endl; } // return FEDs; }
void EcalListOfFEDSProducer::produce | ( | edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 110 of file EcalListOfFEDSProducer.cc.
References gather_cfg::cout, run_regression::done, edm::EventID::event(), spr::find(), edm::EventSetup::get(), edm::Event::getManyByType(), i, edm::EventBase::id(), errorMatrix2Lands_multiChannel::id, METSkim_cff::Jets, FEDNumbering::MINECALFEDID, edm::ESHandle< T >::product(), edm::Event::put(), and edm::EventID::run().
{ if (first_) { edm::ESHandle< EcalElectronicsMapping > ecalmapping; iSetup.get< EcalMappingRcd >().get(ecalmapping); const EcalElectronicsMapping* TheMapping_ = ecalmapping.product(); *TheMapping = *TheMapping_; first_ = false; } std::auto_ptr<EcalListOfFEDS> productAddress(new EcalListOfFEDS); std::vector<int> feds; // the list of FEDS produced by this module // ---- First, get the list of ECAL FEDs which have already been unpacked std::vector< edm::Handle<EcalListOfFEDS> > FEDs_Done; std::vector<int> Done; e.getManyByType(FEDs_Done); unsigned int nDone = FEDs_Done.size(); if (debug_) std::cout << " ECAL unpacking module has already run " << nDone << " times. " << std::endl; for (unsigned int id=0; id < nDone; id++) { // ignore the FEDs coming from unpacking in pi0 paths if( Pi0ListToIgnore_.label() == FEDs_Done[id].provenance()->moduleLabel() ){continue;} std::vector<int> done = FEDs_Done[id]-> GetList(); for (int jd=0; jd < (int)done.size(); jd++) { Done.push_back(done[jd] - FEDNumbering::MINECALFEDID); } } if (debug_) std::cout << " For this event, " << Done.size() << " ECAL FEDs have already been unpacked." << std::endl; if (EGamma_) { // feds = Egamma(e, iSetup, Done); Egamma(e, iSetup, Done, feds); } if (Muon_) { // feds = Muon(e, iSetup, Done); Muon(e, iSetup, Done, feds); } if (Jets_) { // feds = Jets(e, iSetup, Done); Jets(e, iSetup, Done, feds); } if ( !EGamma_ && !Muon_ && ! Jets_) { for (int i=1; i <= 54; i++) { if ( std::find(Done.begin(), Done.end(), i) == Done.end()) feds.push_back(i); } } int nf = (int)feds.size(); for (int i=0; i <nf; i++) { feds[i] += FEDNumbering::MINECALFEDID; if (debug_) std::cout << "Will unpack FED " << feds[i] << std::endl; } if (debug_ && nf < 1 ) std::cout << " Warning : no ECAL FED to unpack for Run " << e.id().run() << " Event " << e.id().event() << std::endl; productAddress.get() -> SetList(feds); e.put(productAddress,OutputLabel_); }
Definition at line 59 of file EcalListOfFEDSProducer.h.
bool EcalListOfFEDSProducer::debug_ [private] |
Definition at line 66 of file EcalListOfFEDSProducer.h.
bool EcalListOfFEDSProducer::EGamma_ [private] |
Definition at line 36 of file EcalListOfFEDSProducer.h.
bool EcalListOfFEDSProducer::EMdoIsolated_ [private] |
Definition at line 39 of file EcalListOfFEDSProducer.h.
bool EcalListOfFEDSProducer::EMdoNonIsolated_ [private] |
Definition at line 40 of file EcalListOfFEDSProducer.h.
Definition at line 37 of file EcalListOfFEDSProducer.h.
Definition at line 38 of file EcalListOfFEDSProducer.h.
double EcalListOfFEDSProducer::EMregionEtaMargin_ [private] |
Definition at line 41 of file EcalListOfFEDSProducer.h.
double EcalListOfFEDSProducer::EMregionPhiMargin_ [private] |
Definition at line 42 of file EcalListOfFEDSProducer.h.
bool EcalListOfFEDSProducer::first_ [private] |
Definition at line 65 of file EcalListOfFEDSProducer.h.
Definition at line 60 of file EcalListOfFEDSProducer.h.
bool EcalListOfFEDSProducer::Jets_ [private] |
Definition at line 52 of file EcalListOfFEDSProducer.h.
bool EcalListOfFEDSProducer::JETSdoCentral_ [private] |
Definition at line 53 of file EcalListOfFEDSProducer.h.
bool EcalListOfFEDSProducer::JETSdoForward_ [private] |
Definition at line 54 of file EcalListOfFEDSProducer.h.
bool EcalListOfFEDSProducer::JETSdoTau_ [private] |
Definition at line 55 of file EcalListOfFEDSProducer.h.
double EcalListOfFEDSProducer::JETSregionEtaMargin_ [private] |
Definition at line 56 of file EcalListOfFEDSProducer.h.
double EcalListOfFEDSProducer::JETSregionPhiMargin_ [private] |
Definition at line 57 of file EcalListOfFEDSProducer.h.
bool EcalListOfFEDSProducer::Muon_ [private] |
Definition at line 46 of file EcalListOfFEDSProducer.h.
Definition at line 50 of file EcalListOfFEDSProducer.h.
double EcalListOfFEDSProducer::MUregionEtaMargin_ [private] |
Definition at line 47 of file EcalListOfFEDSProducer.h.
double EcalListOfFEDSProducer::MUregionPhiMargin_ [private] |
Definition at line 48 of file EcalListOfFEDSProducer.h.
std::string EcalListOfFEDSProducer::OutputLabel_ [private] |
Definition at line 63 of file EcalListOfFEDSProducer.h.
Definition at line 35 of file EcalListOfFEDSProducer.h.
double EcalListOfFEDSProducer::Ptmin_iso_ [private] |
Definition at line 43 of file EcalListOfFEDSProducer.h.
double EcalListOfFEDSProducer::Ptmin_jets_ [private] |
Definition at line 58 of file EcalListOfFEDSProducer.h.
double EcalListOfFEDSProducer::Ptmin_muon_ [private] |
Definition at line 49 of file EcalListOfFEDSProducer.h.
double EcalListOfFEDSProducer::Ptmin_noniso_ [private] |
Definition at line 44 of file EcalListOfFEDSProducer.h.
Definition at line 61 of file EcalListOfFEDSProducer.h.
Definition at line 64 of file EcalListOfFEDSProducer.h.