49 #define M_PI 3.14159265358979323846
68 void endJob()
override;
72 int convertPhiToHW(
double iphi,
int steps);
74 int convertPtToHW(
double ipt,
int maxPt,
double step);
139 BXVectorInputProducer::BXVectorInputProducer(
const ParameterSet& iConfig) {
147 produces<BXVector<l1t::EGamma>>();
148 produces<BXVector<l1t::Muon>>();
149 produces<BXVector<l1t::Tau>>();
150 produces<BXVector<l1t::Jet>>();
151 produces<BXVector<l1t::EtSum>>();
157 maxNumMuCands_ = iConfig.
getParameter<
unsigned int>(
"maxMuCand");
158 maxNumJetCands_ = iConfig.
getParameter<
unsigned int>(
"maxJetCand");
159 maxNumEGCands_ = iConfig.
getParameter<
unsigned int>(
"maxEGCand");
160 maxNumTauCands_ = iConfig.
getParameter<
unsigned int>(
"maxTauCand");
162 jetEtThreshold_ = iConfig.
getParameter<
double>(
"jetEtThreshold");
163 tauEtThreshold_ = iConfig.
getParameter<
double>(
"tauEtThreshold");
164 egEtThreshold_ = iConfig.
getParameter<
double>(
"egEtThreshold");
165 muEtThreshold_ = iConfig.
getParameter<
double>(
"muEtThreshold");
167 emptyBxTrailer_ = iConfig.
getParameter<
int>(
"emptyBxTrailer");
175 BXVectorInputProducer::~BXVectorInputProducer() {}
185 LogDebug(
"l1t|Global") <<
"BXVectorInputProducer::produce function called...\n";
188 std::vector<l1t::Muon> muonVec;
189 std::vector<l1t::EGamma> egammaVec;
190 std::vector<l1t::Tau> tauVec;
191 std::vector<l1t::Jet> jetVec;
192 std::vector<l1t::EtSum> etsumVec;
205 std::vector<int> mu_cands_index;
206 std::vector<int> eg_cands_index;
207 std::vector<int> tau_cands_index;
215 for (std::vector<l1t::EGamma>::const_iterator eg = inputEgammas->begin(
bx); eg != inputEgammas->end(
bx); ++eg) {
216 if (eg->hwPt() > egEtThreshold_ && egammaVec.size() < maxNumEGCands_) {
217 egammaVec.push_back((*eg));
221 LogTrace(
"l1t|Global") <<
">>> input EG collection not found!" << std::endl;
228 if (
mu->hwPt() > muEtThreshold_ && muonVec.size() < maxNumMuCands_) {
229 muonVec.push_back((*
mu));
233 LogTrace(
"l1t|Global") <<
">>> input Mu collection not found!" << std::endl;
239 for (std::vector<l1t::Tau>::const_iterator
tau = inputTaus->begin(
bx);
tau != inputTaus->end(
bx); ++
tau) {
240 if (
tau->hwPt() > tauEtThreshold_ && tauVec.size() < maxNumTauCands_) {
241 tauVec.push_back((*
tau));
245 LogTrace(
"l1t|Global") <<
">>> input tau collection not found!" << std::endl;
252 if (
jet->hwPt() > jetEtThreshold_ && jetVec.size() < maxNumJetCands_) {
253 jetVec.push_back((*
jet));
257 LogTrace(
"l1t|Global") <<
">>> input jet collection not found!" << std::endl;
262 if (
iEvent.getByToken(etsumToken, inputEtsums)) {
263 for (std::vector<l1t::EtSum>::const_iterator etsum = inputEtsums->begin(
bx); etsum != inputEtsums->end(
bx);
265 etsumVec.push_back((*etsum));
268 LogTrace(
"l1t|Global") <<
">>> input etsum collection not found!" << std::endl;
272 LogTrace(
"l1t|Global") <<
"Event " << eventCnt_ <<
" EmptyBxEvt " << emptyBxEvt_ <<
" emptyBxTrailer "
273 << emptyBxTrailer_ <<
" diff " << (emptyBxEvt_ - eventCnt_) << std::endl;
276 for (
int iMu = 0; iMu <
int(muonVec_bxm2.size()); iMu++) {
277 muons->push_back(-2, muonVec_bxm2[iMu]);
279 for (
int iMu = 0; iMu <
int(muonVec_bxm1.size()); iMu++) {
280 muons->push_back(-1, muonVec_bxm1[iMu]);
282 for (
int iMu = 0; iMu <
int(muonVec_bx0.size()); iMu++) {
283 muons->push_back(0, muonVec_bx0[iMu]);
285 for (
int iMu = 0; iMu <
int(muonVec_bxp1.size()); iMu++) {
286 muons->push_back(1, muonVec_bxp1[iMu]);
288 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
289 for (
int iMu = 0; iMu <
int(muonVec.size()); iMu++) {
290 muons->push_back(2, muonVec[iMu]);
298 for (
int iEG = 0; iEG <
int(egammaVec_bxm2.size()); iEG++) {
299 egammas->push_back(-2, egammaVec_bxm2[iEG]);
301 for (
int iEG = 0; iEG <
int(egammaVec_bxm1.size()); iEG++) {
302 egammas->push_back(-1, egammaVec_bxm1[iEG]);
304 for (
int iEG = 0; iEG <
int(egammaVec_bx0.size()); iEG++) {
305 egammas->push_back(0, egammaVec_bx0[iEG]);
307 for (
int iEG = 0; iEG <
int(egammaVec_bxp1.size()); iEG++) {
308 egammas->push_back(1, egammaVec_bxp1[iEG]);
310 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
311 for (
int iEG = 0; iEG <
int(egammaVec.size()); iEG++) {
312 egammas->push_back(2, egammaVec[iEG]);
320 for (
int iTau = 0; iTau <
int(tauVec_bxm2.size()); iTau++) {
321 taus->push_back(-2, tauVec_bxm2[iTau]);
323 for (
int iTau = 0; iTau <
int(tauVec_bxm1.size()); iTau++) {
324 taus->push_back(-1, tauVec_bxm1[iTau]);
326 for (
int iTau = 0; iTau <
int(tauVec_bx0.size()); iTau++) {
327 taus->push_back(0, tauVec_bx0[iTau]);
329 for (
int iTau = 0; iTau <
int(tauVec_bxp1.size()); iTau++) {
330 taus->push_back(1, tauVec_bxp1[iTau]);
332 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
333 for (
int iTau = 0; iTau <
int(tauVec.size()); iTau++) {
334 taus->push_back(2, tauVec[iTau]);
342 for (
int iJet = 0; iJet <
int(jetVec_bxm2.size()); iJet++) {
343 jets->push_back(-2, jetVec_bxm2[iJet]);
345 for (
int iJet = 0; iJet <
int(jetVec_bxm1.size()); iJet++) {
346 jets->push_back(-1, jetVec_bxm1[iJet]);
348 for (
int iJet = 0; iJet <
int(jetVec_bx0.size()); iJet++) {
349 jets->push_back(0, jetVec_bx0[iJet]);
351 for (
int iJet = 0; iJet <
int(jetVec_bxp1.size()); iJet++) {
352 jets->push_back(1, jetVec_bxp1[iJet]);
354 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
355 for (
int iJet = 0; iJet <
int(jetVec.size()); iJet++) {
356 jets->push_back(2, jetVec[iJet]);
364 for (
int iETsum = 0; iETsum <
int(etsumVec_bxm2.size()); iETsum++) {
365 etsums->push_back(-2, etsumVec_bxm2[iETsum]);
367 for (
int iETsum = 0; iETsum <
int(etsumVec_bxm1.size()); iETsum++) {
368 etsums->push_back(-1, etsumVec_bxm1[iETsum]);
370 for (
int iETsum = 0; iETsum <
int(etsumVec_bx0.size()); iETsum++) {
371 etsums->push_back(0, etsumVec_bx0[iETsum]);
373 for (
int iETsum = 0; iETsum <
int(etsumVec_bxp1.size()); iETsum++) {
374 etsums->push_back(1, etsumVec_bxp1[iETsum]);
376 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
377 for (
int iETsum = 0; iETsum <
int(etsumVec.size()); iETsum++) {
378 etsums->push_back(2, etsumVec[iETsum]);
392 muonVec_bxm2 = muonVec_bxm1;
393 egammaVec_bxm2 = egammaVec_bxm1;
394 tauVec_bxm2 = tauVec_bxm1;
395 jetVec_bxm2 = jetVec_bxm1;
396 etsumVec_bxm2 = etsumVec_bxm1;
398 muonVec_bxm1 = muonVec_bx0;
399 egammaVec_bxm1 = egammaVec_bx0;
400 tauVec_bxm1 = tauVec_bx0;
401 jetVec_bxm1 = jetVec_bx0;
402 etsumVec_bxm1 = etsumVec_bx0;
404 muonVec_bx0 = muonVec_bxp1;
405 egammaVec_bx0 = egammaVec_bxp1;
406 tauVec_bx0 = tauVec_bxp1;
407 jetVec_bx0 = jetVec_bxp1;
408 etsumVec_bx0 = etsumVec_bxp1;
410 muonVec_bxp1 = muonVec;
411 egammaVec_bxp1 = egammaVec;
412 tauVec_bxp1 = tauVec;
413 jetVec_bxp1 = jetVec;
414 etsumVec_bxp1 = etsumVec;
421 void BXVectorInputProducer::endJob() {}
426 LogDebug(
"l1t|Global") <<
"BXVectorInputProducer::beginRun function called...\n";
435 int BXVectorInputProducer::convertPhiToHW(
double iphi,
int steps) {
455 int binNum = (
int)(
ieta / binWidth);
465 int BXVectorInputProducer::convertPtToHW(
double ipt,
int maxPt,
double step) {
466 int hwPt =
int(ipt /
step + 0.0001);