50 #define M_PI 3.14159265358979323846
69 void endJob()
override;
73 int convertPhiToHW(
double iphi,
int steps);
74 int convertEtaToHW(
double ieta,
double minEta,
double maxEta,
int steps);
75 int convertPtToHW(
double ipt,
int maxPt,
double step);
150 muShowerToken = consumes<BXVector<l1t::MuonShower>>(iConfig.
getParameter<
InputTag>(
"muShowerInputTag"));
156 produces<BXVector<l1t::EGamma>>();
157 produces<BXVector<l1t::Muon>>();
158 produces<BXVector<l1t::MuonShower>>();
159 produces<BXVector<l1t::Tau>>();
160 produces<BXVector<l1t::Jet>>();
161 produces<BXVector<l1t::EtSum>>();
167 maxNumMuCands_ = iConfig.
getParameter<
unsigned int>(
"maxMuCand");
168 maxNumMuShowerCands_ = iConfig.
getParameter<
unsigned int>(
"maxMuShowerCand");
169 maxNumJetCands_ = iConfig.
getParameter<
unsigned int>(
"maxJetCand");
170 maxNumEGCands_ = iConfig.
getParameter<
unsigned int>(
"maxEGCand");
171 maxNumTauCands_ = iConfig.
getParameter<
unsigned int>(
"maxTauCand");
173 jetEtThreshold_ = iConfig.
getParameter<
double>(
"jetEtThreshold");
174 tauEtThreshold_ = iConfig.
getParameter<
double>(
"tauEtThreshold");
175 egEtThreshold_ = iConfig.
getParameter<
double>(
"egEtThreshold");
176 muEtThreshold_ = iConfig.
getParameter<
double>(
"muEtThreshold");
178 emptyBxTrailer_ = iConfig.
getParameter<
int>(
"emptyBxTrailer");
186 BXVectorInputProducer::~BXVectorInputProducer() {}
196 LogDebug(
"l1t|Global") <<
"BXVectorInputProducer::produce function called...\n";
199 std::vector<l1t::Muon> muonVec;
200 std::vector<l1t::MuonShower> muonShowerVec;
201 std::vector<l1t::EGamma> egammaVec;
202 std::vector<l1t::Tau> tauVec;
203 std::vector<l1t::Jet> jetVec;
204 std::vector<l1t::EtSum> etsumVec;
207 int bxFirst = bxFirst_;
208 int bxLast = bxLast_;
218 std::vector<int> mu_cands_index;
219 std::vector<int> eg_cands_index;
220 std::vector<int> tau_cands_index;
228 for (std::vector<l1t::EGamma>::const_iterator eg = inputEgammas->begin(bx); eg != inputEgammas->end(bx); ++eg) {
229 if (eg->hwPt() > egEtThreshold_ && egammaVec.size() < maxNumEGCands_) {
230 egammaVec.push_back((*eg));
234 LogTrace(
"l1t|Global") <<
">>> input EG collection not found!" << std::endl;
240 for (std::vector<l1t::Muon>::const_iterator
mu = inputMuons->begin(bx);
mu != inputMuons->end(bx); ++
mu) {
241 if (
mu->hwPt() > muEtThreshold_ && muonVec.size() < maxNumMuCands_) {
242 muonVec.push_back((*
mu));
246 LogTrace(
"l1t|Global") <<
">>> input Mu collection not found!" << std::endl;
251 if (iEvent.
getByToken(muToken, inputMuonShowers)) {
252 for (std::vector<l1t::MuonShower>::const_iterator
mu = inputMuonShowers->begin(bx);
253 mu != inputMuonShowers->end(bx);
255 if (
mu->isValid() && muonShowerVec.size() < maxNumMuCands_) {
256 muonShowerVec.push_back((*
mu));
260 LogTrace(
"l1t|Global") <<
">>> input Mu collection not found!" << std::endl;
266 for (std::vector<l1t::Tau>::const_iterator
tau = inputTaus->begin(bx);
tau != inputTaus->end(bx); ++
tau) {
267 if (
tau->hwPt() > tauEtThreshold_ && tauVec.size() < maxNumTauCands_) {
268 tauVec.push_back((*
tau));
272 LogTrace(
"l1t|Global") <<
">>> input tau collection not found!" << std::endl;
278 for (std::vector<l1t::Jet>::const_iterator
jet = inputJets->begin(bx);
jet != inputJets->end(bx); ++
jet) {
279 if (
jet->hwPt() > jetEtThreshold_ && jetVec.size() < maxNumJetCands_) {
280 jetVec.push_back((*
jet));
284 LogTrace(
"l1t|Global") <<
">>> input jet collection not found!" << std::endl;
289 if (iEvent.
getByToken(etsumToken, inputEtsums)) {
290 for (std::vector<l1t::EtSum>::const_iterator etsum = inputEtsums->begin(bx); etsum != inputEtsums->end(bx);
292 etsumVec.push_back((*etsum));
295 LogTrace(
"l1t|Global") <<
">>> input etsum collection not found!" << std::endl;
299 LogTrace(
"l1t|Global") <<
"Event " << eventCnt_ <<
" EmptyBxEvt " << emptyBxEvt_ <<
" emptyBxTrailer "
300 << emptyBxTrailer_ <<
" diff " << (emptyBxEvt_ - eventCnt_) << std::endl;
303 for (
int iMu = 0; iMu < int(muonVec_bxm2.size()); iMu++) {
304 muons->push_back(-2, muonVec_bxm2[iMu]);
306 for (
int iMu = 0; iMu < int(muonVec_bxm1.size()); iMu++) {
307 muons->push_back(-1, muonVec_bxm1[iMu]);
309 for (
int iMu = 0; iMu < int(muonVec_bx0.size()); iMu++) {
310 muons->push_back(0, muonVec_bx0[iMu]);
312 for (
int iMu = 0; iMu < int(muonVec_bxp1.size()); iMu++) {
313 muons->push_back(1, muonVec_bxp1[iMu]);
315 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
316 for (
int iMu = 0; iMu < int(muonVec.size()); iMu++) {
317 muons->push_back(2, muonVec[iMu]);
325 for (
int iMuShower = 0; iMuShower < int(muonShowerVec_bxm2.size()); iMuShower++) {
326 muonShowers->push_back(-2, muonShowerVec_bxm2[iMuShower]);
328 for (
int iMuShower = 0; iMuShower < int(muonShowerVec_bxm1.size()); iMuShower++) {
329 muonShowers->push_back(-1, muonShowerVec_bxm1[iMuShower]);
331 for (
int iMuShower = 0; iMuShower < int(muonShowerVec_bx0.size()); iMuShower++) {
332 muonShowers->push_back(0, muonShowerVec_bx0[iMuShower]);
334 for (
int iMuShower = 0; iMuShower < int(muonShowerVec_bxp1.size()); iMuShower++) {
335 muonShowers->push_back(1, muonShowerVec_bxp1[iMuShower]);
337 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
338 for (
int iMuShower = 0; iMuShower < int(muonShowerVec.size()); iMuShower++) {
339 muonShowers->push_back(2, muonShowerVec[iMuShower]);
343 muonShowerVec.clear();
347 for (
int iEG = 0; iEG < int(egammaVec_bxm2.size()); iEG++) {
348 egammas->push_back(-2, egammaVec_bxm2[iEG]);
350 for (
int iEG = 0; iEG < int(egammaVec_bxm1.size()); iEG++) {
351 egammas->push_back(-1, egammaVec_bxm1[iEG]);
353 for (
int iEG = 0; iEG < int(egammaVec_bx0.size()); iEG++) {
354 egammas->push_back(0, egammaVec_bx0[iEG]);
356 for (
int iEG = 0; iEG < int(egammaVec_bxp1.size()); iEG++) {
357 egammas->push_back(1, egammaVec_bxp1[iEG]);
359 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
360 for (
int iEG = 0; iEG < int(egammaVec.size()); iEG++) {
361 egammas->push_back(2, egammaVec[iEG]);
369 for (
int iTau = 0; iTau < int(tauVec_bxm2.size()); iTau++) {
370 taus->push_back(-2, tauVec_bxm2[iTau]);
372 for (
int iTau = 0; iTau < int(tauVec_bxm1.size()); iTau++) {
373 taus->push_back(-1, tauVec_bxm1[iTau]);
375 for (
int iTau = 0; iTau < int(tauVec_bx0.size()); iTau++) {
376 taus->push_back(0, tauVec_bx0[iTau]);
378 for (
int iTau = 0; iTau < int(tauVec_bxp1.size()); iTau++) {
379 taus->push_back(1, tauVec_bxp1[iTau]);
381 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
382 for (
int iTau = 0; iTau < int(tauVec.size()); iTau++) {
383 taus->push_back(2, tauVec[iTau]);
391 for (
int iJet = 0; iJet < int(jetVec_bxm2.size()); iJet++) {
392 jets->push_back(-2, jetVec_bxm2[iJet]);
394 for (
int iJet = 0; iJet < int(jetVec_bxm1.size()); iJet++) {
395 jets->push_back(-1, jetVec_bxm1[iJet]);
397 for (
int iJet = 0; iJet < int(jetVec_bx0.size()); iJet++) {
398 jets->push_back(0, jetVec_bx0[iJet]);
400 for (
int iJet = 0; iJet < int(jetVec_bxp1.size()); iJet++) {
401 jets->push_back(1, jetVec_bxp1[iJet]);
403 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
404 for (
int iJet = 0; iJet < int(jetVec.size()); iJet++) {
405 jets->push_back(2, jetVec[iJet]);
413 for (
int iETsum = 0; iETsum < int(etsumVec_bxm2.size()); iETsum++) {
414 etsums->push_back(-2, etsumVec_bxm2[iETsum]);
416 for (
int iETsum = 0; iETsum < int(etsumVec_bxm1.size()); iETsum++) {
417 etsums->push_back(-1, etsumVec_bxm1[iETsum]);
419 for (
int iETsum = 0; iETsum < int(etsumVec_bx0.size()); iETsum++) {
420 etsums->push_back(0, etsumVec_bx0[iETsum]);
422 for (
int iETsum = 0; iETsum < int(etsumVec_bxp1.size()); iETsum++) {
423 etsums->push_back(1, etsumVec_bxp1[iETsum]);
425 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
426 for (
int iETsum = 0; iETsum < int(etsumVec.size()); iETsum++) {
427 etsums->push_back(2, etsumVec[iETsum]);
442 muonVec_bxm2 = muonVec_bxm1;
443 muonShowerVec_bxm2 = muonShowerVec_bxm1;
444 egammaVec_bxm2 = egammaVec_bxm1;
445 tauVec_bxm2 = tauVec_bxm1;
446 jetVec_bxm2 = jetVec_bxm1;
447 etsumVec_bxm2 = etsumVec_bxm1;
449 muonVec_bxm1 = muonVec_bx0;
450 muonShowerVec_bxm1 = muonShowerVec_bx0;
451 egammaVec_bxm1 = egammaVec_bx0;
452 tauVec_bxm1 = tauVec_bx0;
453 jetVec_bxm1 = jetVec_bx0;
454 etsumVec_bxm1 = etsumVec_bx0;
456 muonVec_bx0 = muonVec_bxp1;
457 muonShowerVec_bx0 = muonShowerVec_bxp1;
458 egammaVec_bx0 = egammaVec_bxp1;
459 tauVec_bx0 = tauVec_bxp1;
460 jetVec_bx0 = jetVec_bxp1;
461 etsumVec_bx0 = etsumVec_bxp1;
463 muonVec_bxp1 = muonVec;
464 muonShowerVec_bxp1 = muonShowerVec;
465 egammaVec_bxp1 = egammaVec;
466 tauVec_bxp1 = tauVec;
467 jetVec_bxp1 = jetVec;
468 etsumVec_bxp1 = etsumVec;
475 void BXVectorInputProducer::endJob() {}
480 LogDebug(
"l1t|Global") <<
"BXVectorInputProducer::beginRun function called...\n";
489 int BXVectorInputProducer::convertPhiToHW(
double iphi,
int steps) {
496 int hwPhi = int((iphi / phiMax) * steps + 0.00001);
500 int BXVectorInputProducer::convertEtaToHW(
double ieta,
double minEta,
double maxEta,
int steps) {
501 double binWidth = (maxEta - minEta) / steps;
509 int binNum = (int)(ieta / binWidth);
519 int BXVectorInputProducer::convertPtToHW(
double ipt,
int maxPt,
double step) {
520 int hwPt = int(ipt / step + 0.0001);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T getParameter(std::string const &) const