194 LogDebug(
"GtGenToInputProducer") <<
"GenToInputProducer::produce function called...\n";
197 std::vector<l1t::Muon> muonVec;
198 std::vector<l1t::EGamma> egammaVec;
199 std::vector<l1t::Tau> tauVec;
200 std::vector<l1t::Jet> jetVec;
201 std::vector<l1t::EtSum> etsumVec;
209 double MaxLepPt_ = 255;
210 double MaxJetPt_ = 1023;
211 double MaxEt_ = 2047;
213 double MaxCaloEta_ = 5.0;
214 double MaxMuonEta_ = 2.45;
216 double PhiStepCalo_ = 144;
217 double PhiStepMuon_ = 576;
220 double EtaStepCalo_ = 230;
221 double EtaStepMuon_ = 450;
224 double PtStep_ = 0.5;
234 std::vector<int> mu_cands_index;
235 std::vector<int> eg_cands_index;
236 std::vector<int> tau_cands_index;
240 for (
size_t k = 0;
k < genParticles->size();
k++) {
244 int pdgId = mcParticle.
pdgId();
245 double pt = mcParticle.
pt();
248 if (status != 1 && !(
abs(pdgId) == 15 && status == 2))
251 int absId =
abs(pdgId);
254 eg_cands_index.push_back(
k);
256 mu_cands_index.push_back(
k);
258 tau_cands_index.push_back(
k);
261 LogTrace(
"GtGenToInputProducer") <<
">>> GenParticles collection not found!" << std::endl;
265 int numMuCands = int(mu_cands_index.size());
266 Int_t idxMu[numMuCands];
267 double muPtSorted[numMuCands];
268 for (
int iMu = 0; iMu < numMuCands; iMu++)
269 muPtSorted[iMu] = genParticles->at(mu_cands_index[iMu]).pt();
271 TMath::Sort(numMuCands, muPtSorted, idxMu);
272 for (
int iMu = 0; iMu < numMuCands; iMu++) {
276 const reco::Candidate& mcParticle = (*genParticles)[mu_cands_index[idxMu[iMu]]];
281 int qual =
gRandom->Integer(16);
282 int iso =
gRandom->Integer(4) % 2;
292 int hwEtaAtVtx =
eta;
293 int hwPhiAtVtx =
phi;
294 double etaAtVtx = 0.0;
295 double phiAtVtx = 0.0;
296 int hwPtUnconstrained =
298 double ptUnconstrained = 0.0;
305 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
306 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
330 muonVec.push_back(
mu);
334 int numEgCands = int(eg_cands_index.size());
335 Int_t idxEg[numEgCands];
336 double egPtSorted[numEgCands];
337 for (
int iEg = 0; iEg < numEgCands; iEg++)
338 egPtSorted[iEg] = genParticles->at(eg_cands_index[iEg]).pt();
340 TMath::Sort(numEgCands, egPtSorted, idxEg);
341 for (
int iEg = 0; iEg < numEgCands; iEg++) {
345 const reco::Candidate& mcParticle = (*genParticles)[eg_cands_index[idxEg[iEg]]];
348 int eta =
convertEtaToHW(mcParticle.
eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
350 int qual =
gRandom->Integer(2);
351 int iso =
gRandom->Integer(4) % 2;
357 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
358 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
361 egammaVec.push_back(eg);
365 int numTauCands = int(tau_cands_index.size());
366 Int_t idxTau[numTauCands];
367 double tauPtSorted[numTauCands];
368 for (
int iTau = 0; iTau < numTauCands; iTau++)
369 tauPtSorted[iTau] = genParticles->at(tau_cands_index[iTau]).pt();
371 TMath::Sort(numTauCands, tauPtSorted, idxTau);
372 for (
int iTau = 0; iTau < numTauCands; iTau++) {
376 const reco::Candidate& mcParticle = (*genParticles)[tau_cands_index[idxTau[iTau]]];
379 int eta =
convertEtaToHW(mcParticle.
eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
381 int qual =
gRandom->Integer(2);
382 int iso =
gRandom->Integer(4) % 2;
388 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
389 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
392 tauVec.push_back(
tau);
397 int maxOtherTaus = 8;
398 int numCurrentEGs = int(egammaVec.size());
399 int numCurrentTaus = int(tauVec.size());
401 int numExtraEGs = 0, numExtraTaus = 0;
412 for (reco::GenJetCollection::const_iterator genJet = genJets->begin(); genJet != genJets->end(); ++genJet) {
414 sumEt += genJet->et();
423 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
424 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
427 int eta =
convertEtaToHW(genJet->eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
434 int qual =
gRandom->Integer(2);
437 jetVec.push_back(
jet);
442 if ((numExtraEGs + numCurrentEGs) <
maxNumEGCands_ && numExtraEGs < maxOtherEGs) {
446 int EGeta =
convertEtaToHW(genJet->eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
449 int EGqual =
gRandom->Integer(2);
450 int EGiso =
gRandom->Integer(4) % 2;
452 l1t::EGamma eg(*p4, EGpt, EGeta, EGphi, EGqual, EGiso);
453 egammaVec.push_back(eg);
456 if ((numExtraTaus + numCurrentTaus) <
maxNumTauCands_ && numExtraTaus < maxOtherTaus) {
460 int Taueta =
convertEtaToHW(genJet->eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
462 int Tauqual =
gRandom->Integer(2);
463 int Tauiso =
gRandom->Integer(4) % 2;
465 l1t::Tau tau(*p4, Taupt, Taueta, Tauphi, Tauqual, Tauiso);
466 tauVec.push_back(
tau);
471 LogTrace(
"GtGenToInputProducer") <<
">>> GenJets collection not found!" << std::endl;
476 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
477 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
489 int nAsymEt = 255 *
gRandom->Rndm();
491 int nAsymHt = 255 *
gRandom->Rndm();
493 int nAsymEtHF = 255 *
gRandom->Rndm();
495 int nAsymHtHF = 255 *
gRandom->Rndm();
502 int hfP0val =
gRandom->Poisson(4.);
507 int hfM0val =
gRandom->Poisson(4.);
512 int hfP1val =
gRandom->Poisson(4.);
517 int hfM1val =
gRandom->Poisson(4.);
523 int cent30val(0), cent74val(0);
524 int centa =
gRandom->Poisson(2.);
525 int centb =
gRandom->Poisson(2.);
526 if (centa >= centb) {
541 centralval |= cent30val & 0xF;
542 centralval |= (cent74val & 0xF) << shift;
562 mptHf =
convertPtToHW(genMet->front().pt() * 1.1, MaxEt_, PtStep_);
563 mphiHf =
convertPhiToHW(genMet->front().phi() + 3.14 / 7., PhiStepCalo_);
566 mhpt =
convertPtToHW(genMet->front().pt() * 0.9, MaxEt_, PtStep_);
567 mhphi =
convertPhiToHW(genMet->front().phi() + 3.14 / 5., PhiStepCalo_);
570 mhptHf =
convertPtToHW(genMet->front().pt() * 0.95, MaxEt_, PtStep_);
571 mhphiHf =
convertPhiToHW(genMet->front().phi() + 3.14 / 6., PhiStepCalo_);
573 LogTrace(
"GtGenToInputProducer") <<
">>> GenMet collection not found!" << std::endl;
583 etsumVec.push_back(etTotal);
584 etsumVec.push_back(etEmTotal);
585 etsumVec.push_back(hfP0);
587 etsumVec.push_back(htTotal);
588 etsumVec.push_back(towerCounts);
589 etsumVec.push_back(hfM0);
591 etsumVec.push_back(etmiss);
592 etsumVec.push_back(AsymEt);
593 etsumVec.push_back(hfP1);
595 etsumVec.push_back(htmiss);
596 etsumVec.push_back(AsymHt);
597 etsumVec.push_back(hfM1);
599 etsumVec.push_back(etmissHF);
600 etsumVec.push_back(AsymEtHF);
602 etsumVec.push_back(htmissHF);
603 etsumVec.push_back(AsymHtHF);
604 etsumVec.push_back(centrality);
607 if ((iEvent.
id().
event()) % 2 == 0) {
608 for (
int i = 0;
i < 255;
i =
i + 2)
611 for (
int i = 1;
i < 255;
i =
i + 2)
619 for (
int iMu = 0; iMu < int(
muonVec_bxm2.size()); iMu++) {
622 for (
int iMu = 0; iMu < int(
muonVec_bxm1.size()); iMu++) {
625 for (
int iMu = 0; iMu < int(
muonVec_bx0.size()); iMu++) {
628 for (
int iMu = 0; iMu < int(
muonVec_bxp1.size()); iMu++) {
632 for (
int iMu = 0; iMu < int(muonVec.size()); iMu++) {
633 muons->push_back(2, muonVec[iMu]);
654 for (
int iEG = 0; iEG < int(egammaVec.size()); iEG++) {
655 egammas->push_back(2, egammaVec[iEG]);
663 for (
int iTau = 0; iTau < int(
tauVec_bxm2.size()); iTau++) {
666 for (
int iTau = 0; iTau < int(
tauVec_bxm1.size()); iTau++) {
669 for (
int iTau = 0; iTau < int(
tauVec_bx0.size()); iTau++) {
672 for (
int iTau = 0; iTau < int(
tauVec_bxp1.size()); iTau++) {
676 for (
int iTau = 0; iTau < int(tauVec.size()); iTau++) {
677 taus->push_back(2, tauVec[iTau]);
685 for (
int iJet = 0; iJet < int(
jetVec_bxm2.size()); iJet++) {
688 for (
int iJet = 0; iJet < int(
jetVec_bxm1.size()); iJet++) {
691 for (
int iJet = 0; iJet < int(
jetVec_bx0.size()); iJet++) {
694 for (
int iJet = 0; iJet < int(
jetVec_bxp1.size()); iJet++) {
698 for (
int iJet = 0; iJet < int(jetVec.size()); iJet++) {
699 jets->push_back(2, jetVec[iJet]);
707 for (
int iETsum = 0; iETsum < int(
etsumVec_bxm2.size()); iETsum++) {
710 for (
int iETsum = 0; iETsum < int(
etsumVec_bxm1.size()); iETsum++) {
713 for (
int iETsum = 0; iETsum < int(
etsumVec_bx0.size()); iETsum++) {
716 for (
int iETsum = 0; iETsum < int(
etsumVec_bxp1.size()); iETsum++) {
720 for (
int iETsum = 0; iETsum < int(etsumVec.size()); iETsum++) {
721 etsums->push_back(2, etsumVec[iETsum]);
734 extCond->push_back(2, extCond_bx);
EventNumber_t event() const
BXVector< GlobalExtBlk > GlobalExtBlkBxCollection
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void reset()
reset the content of a GlobalExtBlk
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual double pt() const =0
transverse momentum
virtual int status() const =0
status word
tuple isoSum
===> require is not the leading lepton and opposite to the leading lepton
Abs< T >::type abs(const T &t)
virtual int charge() const =0
electric charge
void setExternalDecision(unsigned int bit, bool val)
Set decision bits.
virtual int pdgId() const =0
PDG identifier.
TLorentzVector genMet(const HepMC::GenEvent *all, double etamin=-9999., double etamax=9999.)
static unsigned int const shift
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity