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;
245 double pt = mcParticle.
pt();
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]]];
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]]];
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;
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)
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]);
676 for (
int iTau = 0; iTau <
int(tauVec.size()); iTau++) {
677 taus->push_back(2, tauVec[iTau]);
698 for (
int iJet = 0; iJet <
int(jetVec.size()); iJet++) {
699 jets->push_back(2, jetVec[iJet]);
720 for (
int iETsum = 0; iETsum <
int(etsumVec.size()); iETsum++) {
721 etsums->push_back(2, etsumVec[iETsum]);
734 extCond->push_back(2, extCond_bx);
BXVector< GlobalExtBlk > GlobalExtBlkBxCollection
void reset()
reset the content of a GlobalExtBlk
virtual double pt() const =0
transverse momentum
virtual int status() const =0
status word
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
isoSum
===> compute the isolation and find the most isolated track
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity