190 LogDebug(
"GtGenToInputProducer") <<
"GenToInputProducer::produce function called...\n";
193 std::vector<l1t::Muon> muonVec;
194 std::vector<l1t::EGamma> egammaVec;
195 std::vector<l1t::Tau> tauVec;
196 std::vector<l1t::Jet> jetVec;
197 std::vector<l1t::EtSum> etsumVec;
205 double MaxLepPt_ = 255;
206 double MaxJetPt_ = 1023;
207 double MaxEt_ = 2047;
209 double MaxCaloEta_ = 5.0;
210 double MaxMuonEta_ = 2.45;
212 double PhiStepCalo_ = 144;
213 double PhiStepMuon_ = 576;
216 double EtaStepCalo_ = 230;
217 double EtaStepMuon_ = 450;
220 double PtStep_ = 0.5;
230 std::vector<int> mu_cands_index;
231 std::vector<int> eg_cands_index;
232 std::vector<int> tau_cands_index;
236 for (
size_t k = 0;
k < genParticles->size();
k++) {
241 double pt = mcParticle.
pt();
244 if (status != 1 && !(
abs(pdgId) == 15 && status == 2))
247 int absId =
abs(pdgId);
250 eg_cands_index.push_back(
k);
252 mu_cands_index.push_back(
k);
254 tau_cands_index.push_back(
k);
257 LogTrace(
"GtGenToInputProducer") <<
">>> GenParticles collection not found!" << std::endl;
261 int numMuCands =
int(mu_cands_index.size());
262 Int_t idxMu[numMuCands];
263 double muPtSorted[numMuCands];
264 for (
int iMu = 0; iMu < numMuCands; iMu++)
265 muPtSorted[iMu] = genParticles->at(mu_cands_index[iMu]).pt();
267 TMath::Sort(numMuCands, muPtSorted, idxMu);
268 for (
int iMu = 0; iMu < numMuCands; iMu++) {
272 const reco::Candidate& mcParticle = (*genParticles)[mu_cands_index[idxMu[iMu]]];
277 int qual =
gRandom->Integer(16);
278 int iso =
gRandom->Integer(4) % 2;
288 int hwEtaAtVtx =
eta;
289 int hwPhiAtVtx =
phi;
295 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>*
p4 =
296 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
315 muonVec.push_back(
mu);
319 int numEgCands =
int(eg_cands_index.size());
320 Int_t idxEg[numEgCands];
321 double egPtSorted[numEgCands];
322 for (
int iEg = 0; iEg < numEgCands; iEg++)
323 egPtSorted[iEg] = genParticles->at(eg_cands_index[iEg]).pt();
325 TMath::Sort(numEgCands, egPtSorted, idxEg);
326 for (
int iEg = 0; iEg < numEgCands; iEg++) {
330 const reco::Candidate& mcParticle = (*genParticles)[eg_cands_index[idxEg[iEg]]];
333 int eta =
convertEtaToHW(mcParticle.
eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
336 int iso =
gRandom->Integer(4) % 2;
342 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
343 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
346 egammaVec.push_back(eg);
350 int numTauCands =
int(tau_cands_index.size());
351 Int_t idxTau[numTauCands];
352 double tauPtSorted[numTauCands];
353 for (
int iTau = 0; iTau < numTauCands; iTau++)
354 tauPtSorted[iTau] = genParticles->at(tau_cands_index[iTau]).pt();
356 TMath::Sort(numTauCands, tauPtSorted, idxTau);
357 for (
int iTau = 0; iTau < numTauCands; iTau++) {
361 const reco::Candidate& mcParticle = (*genParticles)[tau_cands_index[idxTau[iTau]]];
364 int eta =
convertEtaToHW(mcParticle.
eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
367 int iso =
gRandom->Integer(4) % 2;
373 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
374 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
377 tauVec.push_back(
tau);
382 int maxOtherTaus = 8;
383 int numCurrentEGs =
int(egammaVec.size());
384 int numCurrentTaus =
int(tauVec.size());
386 int numExtraEGs = 0, numExtraTaus = 0;
397 for (reco::GenJetCollection::const_iterator genJet = genJets->begin(); genJet != genJets->end(); ++genJet) {
399 sumEt += genJet->et();
408 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
409 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
412 int eta =
convertEtaToHW(genJet->eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
422 jetVec.push_back(
jet);
427 if ((numExtraEGs + numCurrentEGs) <
maxNumEGCands_ && numExtraEGs < maxOtherEGs) {
431 int EGeta =
convertEtaToHW(genJet->eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
435 int EGiso =
gRandom->Integer(4) % 2;
437 l1t::EGamma eg(*p4, EGpt, EGeta, EGphi, EGqual, EGiso);
438 egammaVec.push_back(eg);
441 if ((numExtraTaus + numCurrentTaus) <
maxNumTauCands_ && numExtraTaus < maxOtherTaus) {
445 int Taueta =
convertEtaToHW(genJet->eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
448 int Tauiso =
gRandom->Integer(4) % 2;
450 l1t::Tau tau(*p4, Taupt, Taueta, Tauphi, Tauqual, Tauiso);
451 tauVec.push_back(
tau);
456 LogTrace(
"GtGenToInputProducer") <<
">>> GenJets collection not found!" << std::endl;
461 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
462 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
474 int nAsymEt = 255 *
gRandom->Rndm();
476 int nAsymHt = 255 *
gRandom->Rndm();
478 int nAsymEtHF = 255 *
gRandom->Rndm();
480 int nAsymHtHF = 255 *
gRandom->Rndm();
487 int hfP0val =
gRandom->Poisson(4.);
492 int hfM0val =
gRandom->Poisson(4.);
497 int hfP1val =
gRandom->Poisson(4.);
502 int hfM1val =
gRandom->Poisson(4.);
508 int cent30val(0), cent74val(0);
509 int centa =
gRandom->Poisson(2.);
510 int centb =
gRandom->Poisson(2.);
511 if (centa >= centb) {
526 centralval |= cent30val & 0xF;
527 centralval |= (cent74val & 0xF) << shift;
547 mptHf =
convertPtToHW(genMet->front().pt() * 1.1, MaxEt_, PtStep_);
548 mphiHf =
convertPhiToHW(genMet->front().phi() + 3.14 / 7., PhiStepCalo_);
551 mhpt =
convertPtToHW(genMet->front().pt() * 0.9, MaxEt_, PtStep_);
552 mhphi =
convertPhiToHW(genMet->front().phi() + 3.14 / 5., PhiStepCalo_);
555 mhptHf =
convertPtToHW(genMet->front().pt() * 0.95, MaxEt_, PtStep_);
556 mhphiHf =
convertPhiToHW(genMet->front().phi() + 3.14 / 6., PhiStepCalo_);
558 LogTrace(
"GtGenToInputProducer") <<
">>> GenMet collection not found!" << std::endl;
568 etsumVec.push_back(etTotal);
569 etsumVec.push_back(etEmTotal);
570 etsumVec.push_back(hfP0);
572 etsumVec.push_back(htTotal);
573 etsumVec.push_back(towerCounts);
574 etsumVec.push_back(hfM0);
576 etsumVec.push_back(etmiss);
577 etsumVec.push_back(AsymEt);
578 etsumVec.push_back(hfP1);
580 etsumVec.push_back(htmiss);
581 etsumVec.push_back(AsymHt);
582 etsumVec.push_back(hfM1);
584 etsumVec.push_back(etmissHF);
585 etsumVec.push_back(AsymEtHF);
587 etsumVec.push_back(htmissHF);
588 etsumVec.push_back(AsymHtHF);
589 etsumVec.push_back(centrality);
592 if ((
iEvent.id().event()) % 2 == 0) {
593 for (
int i = 0;
i < 255;
i =
i + 2)
596 for (
int i = 1;
i < 255;
i =
i + 2)
617 for (
int iMu = 0; iMu <
int(muonVec.size()); iMu++) {
618 muons->push_back(2, muonVec[iMu]);
639 for (
int iEG = 0; iEG <
int(egammaVec.size()); iEG++) {
640 egammas->push_back(2, egammaVec[iEG]);
661 for (
int iTau = 0; iTau <
int(tauVec.size()); iTau++) {
662 taus->push_back(2, tauVec[iTau]);
683 for (
int iJet = 0; iJet <
int(jetVec.size()); iJet++) {
684 jets->push_back(2, jetVec[iJet]);
705 for (
int iETsum = 0; iETsum <
int(etsumVec.size()); iETsum++) {
706 etsums->push_back(2, etsumVec[iETsum]);
719 extCond->push_back(2, extCond_bx);
BXVector< GlobalExtBlk > GlobalExtBlkBxCollection
void reset()
reset the content of a GlobalExtBlk
virtual int status() const =0
status word
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
void setExternalDecision(unsigned int bit, bool val)
Set decision bits.
virtual double eta() const =0
momentum pseudorapidity
virtual double pt() const =0
transverse momentum
TLorentzVector genMet(const HepMC::GenEvent *all, double etamin=-9999., double etamax=9999.)
virtual int charge() const =0
electric charge
static unsigned int const shift
isoSum
===> compute the isolation and find the most isolated track
virtual double phi() const =0
momentum azimuthal angle