40 if (EGamma_ && Muon_) {
42 " Wrong configuration : EGamma and Muon should not be true at the same time." ;
82 consumesMany<ESListOfFEDS>();
83 produces<ESListOfFEDS>(OutputLabel_);
93 desc.
add<
bool>(
"debug",
false);
94 desc.
add<
bool>(
"EGamma",
true);
95 desc.
add<
bool>(
"Muon",
false);
96 desc.
add<
bool>(
"Jets",
false);
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.);
109 desc.
add<
double>(
"JETS_regionEtaMargin", 1.0);
110 desc.
add<
double>(
"JETS_regionPhiMargin", 1.0);
111 desc.
add<
double>(
"Ptmin_jets", 50.);
115 desc.
add<
bool>(
"JETS_doCentral",
true);
116 desc.
add<
bool>(
"JETS_doForward",
true);
117 desc.
add<
bool>(
"JETS_doTau",
true);
119 descriptions.
add((
"hltESListOfFEDSProducer"), desc);
135 *TheMapping = *TheMapping_;
139 auto productAddress = std::make_unique<ESListOfFEDS>();
140 std::vector<int> feds;
143 std::vector<int> Done;
146 Egamma(e, iSetup, Done, feds);
160 if ( !EGamma_ && !Muon_ && ! Jets_) {
161 for (
int i=1;
i <= 54;
i++) {
162 if (
std::find(Done.begin(), Done.end(),
i) == Done.end())
168 int nf = (
int)feds.size();
169 for (
int i=0;
i <nf;
i++) {
171 if (debug_)
std::cout <<
"Will unpack FED " << feds[
i] << std::endl;
174 if (debug_ && nf < 1 )
175 std::cout <<
" Warning : no ECAL FED to unpack for Run " << e.
id().
run() <<
" Event " << e.
id().
event() << std::endl;
178 std::vector<int> es_feds = TheESMapping->GetListofFEDs(feds);
181 std::vector< edm::Handle<ESListOfFEDS> > esFEDs_Done;
183 unsigned int esnDone = esFEDs_Done.size();
186 std::cout<<
int(es_feds.size())<<
" feds requested, and ESunpacking have already been done "<<esnDone<<
" times."<<std::endl;
189 for(
int i=0;
i<
int(esFEDs_Done.size());
i++){
190 std::vector<int> done = esFEDs_Done[
i]-> GetList();
191 for(
int n=0;
n<
int(done.size());
n++){
192 for(
int j=0; j<
int(es_feds.size());j++){
193 std::vector<int>::iterator it =
find(es_feds.begin(),es_feds.end(),done[
n]);
194 if( it != es_feds.end()){
203 std::cout<<
"ESListofFEDSProducer: new ES_list will be put into event: total "<<
int(es_feds.size())<<std::endl;
204 for(
int j=0; j<
int(es_feds.size());j++){
212 productAddress.get() -> SetList(es_feds);
221 if (debug_)
std::cout << std::endl << std::endl <<
" enter in EcalListOfFEDSProducer::Egamma" << std::endl;
229 if (EMdoNonIsolated_)
230 e.
getByToken(EMl1TagNonIsolated_, emNonIsolColl);
238 for( l1extra::L1EmParticleCollection::const_iterator emItr = emIsolColl->begin();
239 emItr != emIsolColl->end() ;++emItr ){
241 float pt = emItr ->
pt();
242 if (pt < Ptmin_iso_ )
continue;
243 if (debug_)
std::cout <<
" Here is an L1 isoEM candidate of pt " << pt << std::endl;
245 int etaIndex = emItr->gctEmCand()->etaIndex() ;
246 int phiIndex = emItr->gctEmCand()->phiIndex() ;
253 std::vector<int> feds = ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, EMregionEtaMargin_, EMregionPhiMargin_);
254 for (
int i=0;
i < (
int)feds.size();
i++) {
255 if (
std::find(FEDs.begin(), FEDs.end(), feds[
i]) == FEDs.end() &&
256 std::find(done.begin(), done.end(), feds[
i]) == done.end() ) FEDs.push_back(feds[
i]);
261 if (EMdoNonIsolated_) {
263 for( l1extra::L1EmParticleCollection::const_iterator emItr = emNonIsolColl->begin();
264 emItr != emNonIsolColl->end() ;++emItr ){
266 float pt = emItr ->
pt();
267 if (debug_)
std::cout <<
" Here is an L1 nonisoEM candidate of pt " << pt << std::endl;
268 if (pt < Ptmin_noniso_ )
continue;
270 int etaIndex = emItr->gctEmCand()->etaIndex() ;
271 int phiIndex = emItr->gctEmCand()->phiIndex() ;
279 std::vector<int> feds = ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, EMregionEtaMargin_, EMregionPhiMargin_);
280 for (
int i=0;
i < (
int)feds.size();
i++) {
281 if (
std::find(FEDs.begin(), FEDs.end(), feds[
i]) == FEDs.end() &&
282 std::find(done.begin(), done.end(), feds[
i]) == done.end() ) FEDs.push_back(feds[
i]);
290 for (
int i=0;
i < (
int)FEDs.size();
i++) {
291 std::cout <<
"Egamma: unpack FED " << FEDs[
i] << std::endl;
293 std::cout <<
"Number of FEDS is " << FEDs.size() << std::endl;
302 if (debug_)
std::cout << std::endl << std::endl <<
" enter in EcalListOfFEDSProducer::Muon" << std::endl;
308 for (L1MuonParticleCollection::const_iterator it=muColl->begin(); it != muColl->end(); it++) {
311 double pt = (*it).pt();
312 double eta = (*it).eta();
313 double phi = (*it).phi();
315 if (debug_)
std::cout <<
" here is a L1 muon Seed with (eta,phi) = " <<
316 eta <<
" " << phi <<
" and pt " << pt << std::endl;
317 if (pt < Ptmin_muon_ )
continue;
319 std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, MUregionEtaMargin_, MUregionPhiMargin_);
321 for (
int i=0;
i < (
int)feds.size();
i++) {
322 if (
std::find(FEDs.begin(), FEDs.end(), feds[
i]) == FEDs.end() &&
323 std::find(done.begin(), done.end(), feds[
i]) == done.end() ) FEDs.push_back(feds[
i]);
329 for (
int i=0;
i < (
int)FEDs.size();
i++) {
330 std::cout <<
"Muons: unpack FED " << FEDs[
i] << std::endl;
332 std::cout <<
"Number of FEDS is " << FEDs.size() << std::endl;
343 if (debug_)
std::cout << std::endl << std::endl <<
" enter in EcalListOfFEDSProducer::Jets" << std::endl;
346 if (JETSdoCentral_) {
351 for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) {
353 double pt = it ->
pt();
355 double phi = it -> phi();
357 if (debug_)
std::cout <<
" here is a L1 CentralJet Seed with (eta,phi) = " <<
358 eta <<
" " << phi <<
" and pt " << pt << std::endl;
359 if (pt < Ptmin_jets_ )
continue;
361 std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, JETSregionEtaMargin_, JETSregionPhiMargin_);
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]);
370 if (JETSdoForward_) {
375 for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) {
377 double pt = it ->
pt();
379 double phi = it -> phi();
381 if (debug_)
std::cout <<
" here is a L1 ForwardJet Seed with (eta,phi) = " <<
382 eta <<
" " << phi <<
" and pt " << pt << std::endl;
383 if (pt < Ptmin_jets_ )
continue;
385 std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, JETSregionEtaMargin_, JETSregionPhiMargin_);
387 for (
int i=0;
i < (
int)feds.size();
i++) {
388 if (
std::find(FEDs.begin(), FEDs.end(), feds[
i]) == FEDs.end() &&
389 std::find(done.begin(), done.end(), feds[
i]) == done.end() ) FEDs.push_back(feds[
i]);
399 for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) {
401 double pt = it ->
pt();
403 double phi = it -> phi();
405 if (debug_)
std::cout <<
" here is a L1 TauJet Seed with (eta,phi) = " <<
406 eta <<
" " << phi <<
" and pt " << pt << std::endl;
407 if (pt < Ptmin_jets_ )
continue;
409 std::vector<int> feds = ListOfFEDS(eta, eta, phi-epsilon, phi+epsilon, JETSregionEtaMargin_, JETSregionPhiMargin_);
411 for (
int i=0;
i < (
int)feds.size();
i++) {
412 if (
std::find(FEDs.begin(), FEDs.end(), feds[
i]) == FEDs.end() &&
413 std::find(done.begin(), done.end(), feds[
i]) == done.end() ) FEDs.push_back(feds[
i]);
420 for (
int i=0;
i < (
int)FEDs.size();
i++) {
421 std::cout <<
"Jets: unpack FED " << FEDs[
i] << std::endl;
423 std::cout <<
"Number of FEDS is " << FEDs.size() << std::endl;
431 double phiHigh,
double etamargin,
double phimargin)
434 std::vector<int> FEDs;
439 if (debug_)
std::cout <<
" etaLow etaHigh phiLow phiHigh " << etaLow <<
" " <<
440 etaHigh <<
" " << phiLow <<
" " << phiHigh << std::endl;
443 etaHigh += etamargin;
444 double phiMinus = phiLow - phimargin;
445 double phiPlus = phiHigh + phimargin;
448 double dd = fabs(phiPlus-phiMinus);
449 if (debug_)
std::cout <<
" dd = " << dd << std::endl;
450 if (dd > 2.*
Geom::pi() ) all =
true;
453 while (phiMinus < 0) { phiMinus += 2.*
Geom::pi() ; }
456 double dphi = phiPlus - phiMinus;
457 if (dphi < 0) dphi += 2.*
Geom::pi() ;
458 if (debug_)
std::cout <<
"dphi = " << dphi << std::endl;
460 int fed_low1 = TheMapping -> GetFED(etaLow,phiMinus*180./
Geom::pi());
461 int fed_low2 = TheMapping -> GetFED(etaLow,phiPlus*180./
Geom::pi());
462 if (debug_)
std::cout <<
"fed_low1 fed_low2 " << fed_low1 <<
" " << fed_low2 << std::endl;
463 if (fed_low1 == fed_low2) all =
true;
464 int fed_hi1 = TheMapping -> GetFED(etaHigh,phiMinus*180./
Geom::pi());
465 int fed_hi2 = TheMapping -> GetFED(etaHigh,phiPlus*180./
Geom::pi());
466 if (debug_)
std::cout <<
"fed_hi1 fed_hi2 " << fed_hi1 <<
" " << fed_hi2 << std::endl;
467 if (fed_hi1 == fed_hi2) all =
true;
472 if (debug_)
std::cout <<
" unpack everything in phi ! " << std::endl;
477 if (debug_)
std::cout <<
" with margins : " << etaLow <<
" " << etaHigh <<
" " <<
478 phiMinus <<
" " << phiPlus << std::endl;
483 FEDs = TheMapping -> GetListofFEDs(ecalregion);
void getManyByType(std::vector< Handle< PROD > > &results) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double etaBinHighEdge(unsigned int etaIndex, bool central=true) const
void Muon(edm::Event &e, const edm::EventSetup &es, std::vector< int > &done, std::vector< int > &FEDs)
double etaBinLowEdge(unsigned int etaIndex, bool central=true) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
ESListOfFEDSProducer(const edm::ParameterSet &pset)
std::vector< int > ListOfFEDS(double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin)
void Jets(edm::Event &e, const edm::EventSetup &es, std::vector< int > &done, std::vector< int > &FEDs)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void Egamma(edm::Event &e, const edm::EventSetup &es, std::vector< int > &done, std::vector< int > &FEDs)
void produce(edm::Event &e, const edm::EventSetup &c)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
double emJetPhiBinLowEdge(unsigned int phiIndex) const
T const * product() const
virtual ~ESListOfFEDSProducer()
double emJetPhiBinHighEdge(unsigned int phiIndex) const