192 LogDebug(
"GtGenToInputProducer") <<
"GenToInputProducer::produce function called...\n";
195 std::vector<l1t::Muon> muonVec;
196 std::vector<l1t::EGamma> egammaVec;
197 std::vector<l1t::Tau> tauVec;
198 std::vector<l1t::Jet> jetVec;
199 std::vector<l1t::EtSum> etsumVec;
207 double MaxLepPt_ = 255;
208 double MaxJetPt_ = 1023;
209 double MaxEt_ = 2047;
211 double MaxCaloEta_ = 5.0;
212 double MaxMuonEta_ = 2.45;
214 double PhiStepCalo_ = 144;
215 double PhiStepMuon_ = 576;
218 double EtaStepCalo_ = 230;
219 double EtaStepMuon_ = 450;
222 double PtStep_ = 0.5;
232 std::vector<int> mu_cands_index;
233 std::vector<int> eg_cands_index;
234 std::vector<int> tau_cands_index;
243 double pt = mcParticle.
pt();
252 eg_cands_index.push_back(
k);
254 mu_cands_index.push_back(
k);
256 tau_cands_index.push_back(
k);
259 LogTrace(
"GtGenToInputProducer") <<
">>> GenParticles collection not found!" << std::endl;
263 int numMuCands =
int(mu_cands_index.size());
264 Int_t idxMu[numMuCands];
265 double muPtSorted[numMuCands];
266 for (
int iMu = 0; iMu < numMuCands; iMu++)
267 muPtSorted[iMu] =
genParticles->at(mu_cands_index[iMu]).pt();
269 TMath::Sort(numMuCands, muPtSorted, idxMu);
270 for (
int iMu = 0; iMu < numMuCands; iMu++) {
274 const reco::Candidate& mcParticle = (*genParticles)[mu_cands_index[idxMu[iMu]]];
279 int qual =
gRandom->Integer(16);
280 int iso =
gRandom->Integer(4) % 2;
303 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
304 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
328 muonVec.push_back(
mu);
332 int numEgCands =
int(eg_cands_index.size());
333 Int_t idxEg[numEgCands];
334 double egPtSorted[numEgCands];
335 for (
int iEg = 0; iEg < numEgCands; iEg++)
336 egPtSorted[iEg] =
genParticles->at(eg_cands_index[iEg]).pt();
338 TMath::Sort(numEgCands, egPtSorted, idxEg);
339 for (
int iEg = 0; iEg < numEgCands; iEg++) {
343 const reco::Candidate& mcParticle = (*genParticles)[eg_cands_index[idxEg[iEg]]];
348 int qual =
gRandom->Integer(2);
349 int iso =
gRandom->Integer(4) % 2;
355 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
356 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
359 egammaVec.push_back(eg);
363 int numTauCands =
int(tau_cands_index.size());
364 Int_t idxTau[numTauCands];
365 double tauPtSorted[numTauCands];
366 for (
int iTau = 0; iTau < numTauCands; iTau++)
367 tauPtSorted[iTau] =
genParticles->at(tau_cands_index[iTau]).pt();
369 TMath::Sort(numTauCands, tauPtSorted, idxTau);
370 for (
int iTau = 0; iTau < numTauCands; iTau++) {
374 const reco::Candidate& mcParticle = (*genParticles)[tau_cands_index[idxTau[iTau]]];
379 int qual =
gRandom->Integer(2);
380 int iso =
gRandom->Integer(4) % 2;
386 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
387 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
390 tauVec.push_back(
tau);
395 int maxOtherTaus = 8;
396 int numCurrentEGs =
int(egammaVec.size());
397 int numCurrentTaus =
int(tauVec.size());
399 int numExtraEGs = 0, numExtraTaus = 0;
410 for (reco::GenJetCollection::const_iterator genJet =
genJets->begin(); genJet !=
genJets->end(); ++genJet) {
412 sumEt += genJet->et();
421 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
422 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
425 int eta =
convertEtaToHW(genJet->eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
432 int qual =
gRandom->Integer(2);
435 jetVec.push_back(
jet);
440 if ((numExtraEGs + numCurrentEGs) <
maxNumEGCands_ && numExtraEGs < maxOtherEGs) {
444 int EGeta =
convertEtaToHW(genJet->eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
447 int EGqual =
gRandom->Integer(2);
448 int EGiso =
gRandom->Integer(4) % 2;
450 l1t::EGamma eg(*p4, EGpt, EGeta, EGphi, EGqual, EGiso);
451 egammaVec.push_back(eg);
454 if ((numExtraTaus + numCurrentTaus) <
maxNumTauCands_ && numExtraTaus < maxOtherTaus) {
458 int Taueta =
convertEtaToHW(genJet->eta(), -MaxCaloEta_, MaxCaloEta_, EtaStepCalo_);
460 int Tauqual =
gRandom->Integer(2);
461 int Tauiso =
gRandom->Integer(4) % 2;
463 l1t::Tau tau(*p4, Taupt, Taueta, Tauphi, Tauqual, Tauiso);
464 tauVec.push_back(
tau);
469 LogTrace(
"GtGenToInputProducer") <<
">>> GenJets collection not found!" << std::endl;
474 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>* p4 =
475 new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>>();
487 int nAsymEt = 255 *
gRandom->Rndm();
489 int nAsymHt = 255 *
gRandom->Rndm();
491 int nAsymEtHF = 255 *
gRandom->Rndm();
493 int nAsymHtHF = 255 *
gRandom->Rndm();
500 int hfP0val =
gRandom->Poisson(4.);
505 int hfM0val =
gRandom->Poisson(4.);
510 int hfP1val =
gRandom->Poisson(4.);
515 int hfM1val =
gRandom->Poisson(4.);
521 int cent30val(0), cent74val(0);
522 int centa =
gRandom->Poisson(2.);
523 int centb =
gRandom->Poisson(2.);
524 if (centa >= centb) {
539 centralval |= cent30val & 0xF;
540 centralval |= (cent74val & 0xF) <<
shift;
571 LogTrace(
"GtGenToInputProducer") <<
">>> GenMet collection not found!" << std::endl;
581 etsumVec.push_back(etTotal);
582 etsumVec.push_back(etEmTotal);
583 etsumVec.push_back(hfP0);
585 etsumVec.push_back(htTotal);
586 etsumVec.push_back(towerCounts);
587 etsumVec.push_back(hfM0);
589 etsumVec.push_back(
etmiss);
590 etsumVec.push_back(AsymEt);
591 etsumVec.push_back(hfP1);
593 etsumVec.push_back(
htmiss);
594 etsumVec.push_back(AsymHt);
595 etsumVec.push_back(hfM1);
597 etsumVec.push_back(etmissHF);
598 etsumVec.push_back(AsymEtHF);
600 etsumVec.push_back(htmissHF);
601 etsumVec.push_back(AsymHtHF);
602 etsumVec.push_back(centrality);
605 if ((
iEvent.id().event()) % 2 == 0) {
606 for (
int i = 0;
i < 255;
i =
i + 2)
609 for (
int i = 1;
i < 255;
i =
i + 2)
630 for (
int iMu = 0; iMu <
int(muonVec.size()); iMu++) {
631 muons->push_back(2, muonVec[iMu]);
652 for (
int iEG = 0; iEG <
int(egammaVec.size()); iEG++) {
653 egammas->push_back(2, egammaVec[iEG]);
674 for (
int iTau = 0; iTau <
int(tauVec.size()); iTau++) {
675 taus->push_back(2, tauVec[iTau]);
696 for (
int iJet = 0; iJet <
int(jetVec.size()); iJet++) {
697 jets->push_back(2, jetVec[iJet]);
718 for (
int iETsum = 0; iETsum <
int(etsumVec.size()); iETsum++) {
719 etsums->push_back(2, etsumVec[iETsum]);
732 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