50 #define M_PI 3.14159265358979323846
69 void endJob()
override;
73 int convertPhiToHW(
double iphi,
int steps);
75 int convertPtToHW(
double ipt,
int maxPt,
double step);
140 BXVectorInputProducer::BXVectorInputProducer(
const ParameterSet& iConfig) {
148 produces<BXVector<l1t::EGamma>>();
149 produces<BXVector<l1t::Muon>>();
150 produces<BXVector<l1t::Tau>>();
151 produces<BXVector<l1t::Jet>>();
152 produces<BXVector<l1t::EtSum>>();
158 maxNumMuCands_ = iConfig.
getParameter<
unsigned int>(
"maxMuCand");
159 maxNumJetCands_ = iConfig.
getParameter<
unsigned int>(
"maxJetCand");
160 maxNumEGCands_ = iConfig.
getParameter<
unsigned int>(
"maxEGCand");
161 maxNumTauCands_ = iConfig.
getParameter<
unsigned int>(
"maxTauCand");
163 jetEtThreshold_ = iConfig.
getParameter<
double>(
"jetEtThreshold");
164 tauEtThreshold_ = iConfig.
getParameter<
double>(
"tauEtThreshold");
165 egEtThreshold_ = iConfig.
getParameter<
double>(
"egEtThreshold");
166 muEtThreshold_ = iConfig.
getParameter<
double>(
"muEtThreshold");
168 emptyBxTrailer_ = iConfig.
getParameter<
int>(
"emptyBxTrailer");
176 BXVectorInputProducer::~BXVectorInputProducer() {}
186 LogDebug(
"l1t|Global") <<
"BXVectorInputProducer::produce function called...\n";
189 std::vector<l1t::Muon> muonVec;
190 std::vector<l1t::EGamma> egammaVec;
191 std::vector<l1t::Tau> tauVec;
192 std::vector<l1t::Jet> jetVec;
193 std::vector<l1t::EtSum> etsumVec;
206 std::vector<int> mu_cands_index;
207 std::vector<int> eg_cands_index;
208 std::vector<int> tau_cands_index;
216 for (std::vector<l1t::EGamma>::const_iterator eg = inputEgammas->begin(
bx); eg != inputEgammas->end(
bx); ++eg) {
217 if (eg->hwPt() > egEtThreshold_ && egammaVec.size() < maxNumEGCands_) {
218 egammaVec.push_back((*eg));
222 LogTrace(
"l1t|Global") <<
">>> input EG collection not found!" << std::endl;
229 if (
mu->hwPt() > muEtThreshold_ && muonVec.size() < maxNumMuCands_) {
230 muonVec.push_back((*
mu));
234 LogTrace(
"l1t|Global") <<
">>> input Mu collection not found!" << std::endl;
240 for (std::vector<l1t::Tau>::const_iterator
tau = inputTaus->begin(
bx);
tau != inputTaus->end(
bx); ++
tau) {
241 if (
tau->hwPt() > tauEtThreshold_ && tauVec.size() < maxNumTauCands_) {
242 tauVec.push_back((*
tau));
246 LogTrace(
"l1t|Global") <<
">>> input tau collection not found!" << std::endl;
253 if (
jet->hwPt() > jetEtThreshold_ && jetVec.size() < maxNumJetCands_) {
254 jetVec.push_back((*
jet));
258 LogTrace(
"l1t|Global") <<
">>> input jet collection not found!" << std::endl;
263 if (
iEvent.getByToken(etsumToken, inputEtsums)) {
264 for (std::vector<l1t::EtSum>::const_iterator etsum = inputEtsums->begin(
bx); etsum != inputEtsums->end(
bx);
266 etsumVec.push_back((*etsum));
269 LogTrace(
"l1t|Global") <<
">>> input etsum collection not found!" << std::endl;
273 LogTrace(
"l1t|Global") <<
"Event " << eventCnt_ <<
" EmptyBxEvt " << emptyBxEvt_ <<
" emptyBxTrailer "
274 << emptyBxTrailer_ <<
" diff " << (emptyBxEvt_ - eventCnt_) << std::endl;
277 for (
int iMu = 0; iMu <
int(muonVec_bxm2.size()); iMu++) {
278 muons->push_back(-2, muonVec_bxm2[iMu]);
280 for (
int iMu = 0; iMu <
int(muonVec_bxm1.size()); iMu++) {
281 muons->push_back(-1, muonVec_bxm1[iMu]);
283 for (
int iMu = 0; iMu <
int(muonVec_bx0.size()); iMu++) {
284 muons->push_back(0, muonVec_bx0[iMu]);
286 for (
int iMu = 0; iMu <
int(muonVec_bxp1.size()); iMu++) {
287 muons->push_back(1, muonVec_bxp1[iMu]);
289 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
290 for (
int iMu = 0; iMu <
int(muonVec.size()); iMu++) {
291 muons->push_back(2, muonVec[iMu]);
299 for (
int iEG = 0; iEG <
int(egammaVec_bxm2.size()); iEG++) {
300 egammas->push_back(-2, egammaVec_bxm2[iEG]);
302 for (
int iEG = 0; iEG <
int(egammaVec_bxm1.size()); iEG++) {
303 egammas->push_back(-1, egammaVec_bxm1[iEG]);
305 for (
int iEG = 0; iEG <
int(egammaVec_bx0.size()); iEG++) {
306 egammas->push_back(0, egammaVec_bx0[iEG]);
308 for (
int iEG = 0; iEG <
int(egammaVec_bxp1.size()); iEG++) {
309 egammas->push_back(1, egammaVec_bxp1[iEG]);
311 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
312 for (
int iEG = 0; iEG <
int(egammaVec.size()); iEG++) {
313 egammas->push_back(2, egammaVec[iEG]);
321 for (
int iTau = 0; iTau <
int(tauVec_bxm2.size()); iTau++) {
322 taus->push_back(-2, tauVec_bxm2[iTau]);
324 for (
int iTau = 0; iTau <
int(tauVec_bxm1.size()); iTau++) {
325 taus->push_back(-1, tauVec_bxm1[iTau]);
327 for (
int iTau = 0; iTau <
int(tauVec_bx0.size()); iTau++) {
328 taus->push_back(0, tauVec_bx0[iTau]);
330 for (
int iTau = 0; iTau <
int(tauVec_bxp1.size()); iTau++) {
331 taus->push_back(1, tauVec_bxp1[iTau]);
333 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
334 for (
int iTau = 0; iTau <
int(tauVec.size()); iTau++) {
335 taus->push_back(2, tauVec[iTau]);
343 for (
int iJet = 0; iJet <
int(jetVec_bxm2.size()); iJet++) {
344 jets->push_back(-2, jetVec_bxm2[iJet]);
346 for (
int iJet = 0; iJet <
int(jetVec_bxm1.size()); iJet++) {
347 jets->push_back(-1, jetVec_bxm1[iJet]);
349 for (
int iJet = 0; iJet <
int(jetVec_bx0.size()); iJet++) {
350 jets->push_back(0, jetVec_bx0[iJet]);
352 for (
int iJet = 0; iJet <
int(jetVec_bxp1.size()); iJet++) {
353 jets->push_back(1, jetVec_bxp1[iJet]);
355 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
356 for (
int iJet = 0; iJet <
int(jetVec.size()); iJet++) {
357 jets->push_back(2, jetVec[iJet]);
365 for (
int iETsum = 0; iETsum <
int(etsumVec_bxm2.size()); iETsum++) {
366 etsums->push_back(-2, etsumVec_bxm2[iETsum]);
368 for (
int iETsum = 0; iETsum <
int(etsumVec_bxm1.size()); iETsum++) {
369 etsums->push_back(-1, etsumVec_bxm1[iETsum]);
371 for (
int iETsum = 0; iETsum <
int(etsumVec_bx0.size()); iETsum++) {
372 etsums->push_back(0, etsumVec_bx0[iETsum]);
374 for (
int iETsum = 0; iETsum <
int(etsumVec_bxp1.size()); iETsum++) {
375 etsums->push_back(1, etsumVec_bxp1[iETsum]);
377 if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
378 for (
int iETsum = 0; iETsum <
int(etsumVec.size()); iETsum++) {
379 etsums->push_back(2, etsumVec[iETsum]);
393 muonVec_bxm2 = muonVec_bxm1;
394 egammaVec_bxm2 = egammaVec_bxm1;
395 tauVec_bxm2 = tauVec_bxm1;
396 jetVec_bxm2 = jetVec_bxm1;
397 etsumVec_bxm2 = etsumVec_bxm1;
399 muonVec_bxm1 = muonVec_bx0;
400 egammaVec_bxm1 = egammaVec_bx0;
401 tauVec_bxm1 = tauVec_bx0;
402 jetVec_bxm1 = jetVec_bx0;
403 etsumVec_bxm1 = etsumVec_bx0;
405 muonVec_bx0 = muonVec_bxp1;
406 egammaVec_bx0 = egammaVec_bxp1;
407 tauVec_bx0 = tauVec_bxp1;
408 jetVec_bx0 = jetVec_bxp1;
409 etsumVec_bx0 = etsumVec_bxp1;
411 muonVec_bxp1 = muonVec;
412 egammaVec_bxp1 = egammaVec;
413 tauVec_bxp1 = tauVec;
414 jetVec_bxp1 = jetVec;
415 etsumVec_bxp1 = etsumVec;
422 void BXVectorInputProducer::endJob() {}
427 LogDebug(
"l1t|Global") <<
"BXVectorInputProducer::beginRun function called...\n";
436 int BXVectorInputProducer::convertPhiToHW(
double iphi,
int steps) {
456 int binNum = (
int)(
ieta / binWidth);
466 int BXVectorInputProducer::convertPtToHW(
double ipt,
int maxPt,
double step) {
467 int hwPt =
int(ipt /
step + 0.0001);