50 #define M_PI 3.14159265358979323846 69 int convertPhiToHW(
double iphi,
int steps)
const;
71 int convertPtToHW(
double ipt,
int maxPt,
double step)
const;
140 BXVectorInputProducer::BXVectorInputProducer(
const ParameterSet& iConfig) {
143 muShowerToken = consumes<BXVector<l1t::MuonShower>>(iConfig.
getParameter<
InputTag>(
"muShowerInputTag"));
149 produces<BXVector<l1t::EGamma>>();
150 produces<BXVector<l1t::Muon>>();
151 produces<BXVector<l1t::MuonShower>>();
152 produces<BXVector<l1t::Tau>>();
153 produces<BXVector<l1t::Jet>>();
154 produces<BXVector<l1t::EtSum>>();
160 maxNumMuCands_ = iConfig.
getParameter<
unsigned int>(
"maxMuCand");
161 maxNumMuShowerCands_ = iConfig.
getParameter<
unsigned int>(
"maxMuShowerCand");
162 maxNumJetCands_ = iConfig.
getParameter<
unsigned int>(
"maxJetCand");
163 maxNumEGCands_ = iConfig.
getParameter<
unsigned int>(
"maxEGCand");
164 maxNumTauCands_ = iConfig.
getParameter<
unsigned int>(
"maxTauCand");
166 jetEtThreshold_ = iConfig.
getParameter<
double>(
"jetEtThreshold");
167 tauEtThreshold_ = iConfig.
getParameter<
double>(
"tauEtThreshold");
168 egEtThreshold_ = iConfig.
getParameter<
double>(
"egEtThreshold");
169 muEtThreshold_ = iConfig.
getParameter<
double>(
"muEtThreshold");
171 emptyBxTrailer_ = iConfig.
getParameter<
int>(
"emptyBxTrailer");
178 BXVectorInputProducer::~BXVectorInputProducer() {}
188 LogDebug(
"l1t|Global") <<
"BXVectorInputProducer::produce function called...\n";
191 std::vector<l1t::Muon> muonVec;
192 std::vector<l1t::MuonShower> muonShowerVec;
193 std::vector<l1t::EGamma> egammaVec;
194 std::vector<l1t::Tau> tauVec;
195 std::vector<l1t::Jet> jetVec;
196 std::vector<l1t::EtSum> etsumVec;
210 std::vector<int> mu_cands_index;
211 std::vector<int> eg_cands_index;
212 std::vector<int> tau_cands_index;
220 for (std::vector<l1t::EGamma>::const_iterator eg = inputEgammas->begin(
bx); eg != inputEgammas->end(
bx); ++eg) {
221 if (eg->hwPt() > egEtThreshold_ && egammaVec.size() < maxNumEGCands_) {
222 egammaVec.push_back((*eg));
226 LogTrace(
"l1t|Global") <<
">>> input EG collection not found!" << std::endl;
233 if (
mu->hwPt() > muEtThreshold_ && muonVec.size() < maxNumMuCands_) {
234 muonVec.push_back((*
mu));
238 LogTrace(
"l1t|Global") <<
">>> input Mu collection not found!" << std::endl;
243 if (
iEvent.getByToken(muToken, inputMuonShowers)) {
244 for (std::vector<l1t::MuonShower>::const_iterator
mu = inputMuonShowers->begin(
bx);
245 mu != inputMuonShowers->end(
bx);
247 if (
mu->isValid() && muonShowerVec.size() < maxNumMuCands_) {
248 muonShowerVec.push_back((*
mu));
252 LogTrace(
"l1t|Global") <<
">>> input Mu collection not found!" << std::endl;
258 for (std::vector<l1t::Tau>::const_iterator
tau = inputTaus->begin(
bx);
tau != inputTaus->end(
bx); ++
tau) {
259 if (
tau->hwPt() > tauEtThreshold_ && tauVec.size() < maxNumTauCands_) {
260 tauVec.push_back((*
tau));
264 LogTrace(
"l1t|Global") <<
">>> input tau collection not found!" << std::endl;
271 if (
jet->hwPt() > jetEtThreshold_ && jetVec.size() < maxNumJetCands_) {
272 jetVec.push_back((*
jet));
276 LogTrace(
"l1t|Global") <<
">>> input jet collection not found!" << std::endl;
281 if (
iEvent.getByToken(etsumToken, inputEtsums)) {
282 for (std::vector<l1t::EtSum>::const_iterator etsum = inputEtsums->begin(
bx); etsum != inputEtsums->end(
bx);
284 etsumVec.push_back((*etsum));
287 LogTrace(
"l1t|Global") <<
">>> input etsum collection not found!" << std::endl;
291 LogTrace(
"l1t|Global") <<
"Event " << eventCnt_ <<
" EmptyBxEvt " << emptyBxEvt_ <<
" emptyBxTrailer " 292 << emptyBxTrailer_ <<
" diff " << (emptyBxEvt_ - eventCnt_) << std::endl;
295 for (
int iMu = 0; iMu <
int(muonVec_bxm2.size()); iMu++) {
296 muons->push_back(-2, muonVec_bxm2[iMu]);
298 for (
int iMu = 0; iMu <
int(muonVec_bxm1.size()); iMu++) {
299 muons->push_back(-1, muonVec_bxm1[iMu]);
301 for (
int iMu = 0; iMu <
int(muonVec_bx0.size()); iMu++) {
302 muons->push_back(0, muonVec_bx0[iMu]);
304 for (
int iMu = 0; iMu <
int(muonVec_bxp1.size()); iMu++) {
305 muons->push_back(1, muonVec_bxp1[iMu]);
307 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
308 for (
int iMu = 0; iMu <
int(muonVec.size()); iMu++) {
309 muons->push_back(2, muonVec[iMu]);
317 for (
int iMuShower = 0; iMuShower <
int(muonShowerVec_bxm2.size()); iMuShower++) {
318 muonShowers->push_back(-2, muonShowerVec_bxm2[iMuShower]);
320 for (
int iMuShower = 0; iMuShower <
int(muonShowerVec_bxm1.size()); iMuShower++) {
321 muonShowers->push_back(-1, muonShowerVec_bxm1[iMuShower]);
323 for (
int iMuShower = 0; iMuShower <
int(muonShowerVec_bx0.size()); iMuShower++) {
324 muonShowers->push_back(0, muonShowerVec_bx0[iMuShower]);
326 for (
int iMuShower = 0; iMuShower <
int(muonShowerVec_bxp1.size()); iMuShower++) {
327 muonShowers->push_back(1, muonShowerVec_bxp1[iMuShower]);
329 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
330 for (
int iMuShower = 0; iMuShower <
int(muonShowerVec.size()); iMuShower++) {
331 muonShowers->push_back(2, muonShowerVec[iMuShower]);
335 muonShowerVec.clear();
339 for (
int iEG = 0; iEG <
int(egammaVec_bxm2.size()); iEG++) {
340 egammas->push_back(-2, egammaVec_bxm2[iEG]);
342 for (
int iEG = 0; iEG <
int(egammaVec_bxm1.size()); iEG++) {
343 egammas->push_back(-1, egammaVec_bxm1[iEG]);
345 for (
int iEG = 0; iEG <
int(egammaVec_bx0.size()); iEG++) {
346 egammas->push_back(0, egammaVec_bx0[iEG]);
348 for (
int iEG = 0; iEG <
int(egammaVec_bxp1.size()); iEG++) {
349 egammas->push_back(1, egammaVec_bxp1[iEG]);
351 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
352 for (
int iEG = 0; iEG <
int(egammaVec.size()); iEG++) {
353 egammas->push_back(2, egammaVec[iEG]);
361 for (
int iTau = 0; iTau <
int(tauVec_bxm2.size()); iTau++) {
362 taus->push_back(-2, tauVec_bxm2[iTau]);
364 for (
int iTau = 0; iTau <
int(tauVec_bxm1.size()); iTau++) {
365 taus->push_back(-1, tauVec_bxm1[iTau]);
367 for (
int iTau = 0; iTau <
int(tauVec_bx0.size()); iTau++) {
368 taus->push_back(0, tauVec_bx0[iTau]);
370 for (
int iTau = 0; iTau <
int(tauVec_bxp1.size()); iTau++) {
371 taus->push_back(1, tauVec_bxp1[iTau]);
373 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
374 for (
int iTau = 0; iTau <
int(tauVec.size()); iTau++) {
375 taus->push_back(2, tauVec[iTau]);
383 for (
int iJet = 0; iJet <
int(jetVec_bxm2.size()); iJet++) {
384 jets->push_back(-2, jetVec_bxm2[iJet]);
386 for (
int iJet = 0; iJet <
int(jetVec_bxm1.size()); iJet++) {
387 jets->push_back(-1, jetVec_bxm1[iJet]);
389 for (
int iJet = 0; iJet <
int(jetVec_bx0.size()); iJet++) {
390 jets->push_back(0, jetVec_bx0[iJet]);
392 for (
int iJet = 0; iJet <
int(jetVec_bxp1.size()); iJet++) {
393 jets->push_back(1, jetVec_bxp1[iJet]);
395 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
396 for (
int iJet = 0; iJet <
int(jetVec.size()); iJet++) {
397 jets->push_back(2, jetVec[iJet]);
405 for (
int iETsum = 0; iETsum <
int(etsumVec_bxm2.size()); iETsum++) {
406 etsums->push_back(-2, etsumVec_bxm2[iETsum]);
408 for (
int iETsum = 0; iETsum <
int(etsumVec_bxm1.size()); iETsum++) {
409 etsums->push_back(-1, etsumVec_bxm1[iETsum]);
411 for (
int iETsum = 0; iETsum <
int(etsumVec_bx0.size()); iETsum++) {
412 etsums->push_back(0, etsumVec_bx0[iETsum]);
414 for (
int iETsum = 0; iETsum <
int(etsumVec_bxp1.size()); iETsum++) {
415 etsums->push_back(1, etsumVec_bxp1[iETsum]);
417 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
418 for (
int iETsum = 0; iETsum <
int(etsumVec.size()); iETsum++) {
419 etsums->push_back(2, etsumVec[iETsum]);
434 muonVec_bxm2 = muonVec_bxm1;
435 muonShowerVec_bxm2 = muonShowerVec_bxm1;
436 egammaVec_bxm2 = egammaVec_bxm1;
437 tauVec_bxm2 = tauVec_bxm1;
438 jetVec_bxm2 = jetVec_bxm1;
439 etsumVec_bxm2 = etsumVec_bxm1;
441 muonVec_bxm1 = muonVec_bx0;
442 muonShowerVec_bxm1 = muonShowerVec_bx0;
443 egammaVec_bxm1 = egammaVec_bx0;
444 tauVec_bxm1 = tauVec_bx0;
445 jetVec_bxm1 = jetVec_bx0;
446 etsumVec_bxm1 = etsumVec_bx0;
448 muonVec_bx0 = muonVec_bxp1;
449 muonShowerVec_bx0 = muonShowerVec_bxp1;
450 egammaVec_bx0 = egammaVec_bxp1;
451 tauVec_bx0 = tauVec_bxp1;
452 jetVec_bx0 = jetVec_bxp1;
453 etsumVec_bx0 = etsumVec_bxp1;
455 muonVec_bxp1 = muonVec;
456 muonShowerVec_bxp1 = muonShowerVec;
457 egammaVec_bxp1 = egammaVec;
458 tauVec_bxp1 = tauVec;
459 jetVec_bxp1 = jetVec;
460 etsumVec_bxp1 = etsumVec;
464 int BXVectorInputProducer::convertPhiToHW(
double iphi,
int steps)
const {
484 int binNum = (
int)(
ieta / binWidth);
494 int BXVectorInputProducer::convertPtToHW(
double ipt,
int maxPt,
double step)
const {
495 int hwPt =
int(ipt /
step + 0.0001);
T getParameter(std::string const &) const
void addDefault(ParameterSetDescription const &psetDescription)
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)