197 LogDebug(
"l1t|Global") <<
"GenToInputProducer::produce function called...\n";
200 std::vector<l1t::Muon> muonVec;
201 std::vector<l1t::EGamma> egammaVec;
202 std::vector<l1t::Tau> tauVec;
203 std::vector<l1t::Jet> jetVec;
204 std::vector<l1t::EtSum> etsumVec;
237 std::vector<int> mu_cands_index;
238 std::vector<int> eg_cands_index;
239 std::vector<int> tau_cands_index;
244 for(
size_t k = 0;
k < genParticles->size();
k++ ){
249 double pt = mcParticle.
pt();
252 if( status!=1 && !(
abs(pdgId)==15 && status==2) )
continue;
254 int absId =
abs(pdgId);
257 else if( absId==13 && pt>=
muEtThreshold_ ) mu_cands_index.push_back(
k);
262 LogTrace(
"l1t|Global") <<
">>> GenParticles collection not found!" << std::endl;
268 int numMuCands = int( mu_cands_index.size() );
269 Int_t idxMu[numMuCands];
270 double muPtSorted[numMuCands];
271 for(
int iMu=0; iMu<numMuCands; iMu++ ) muPtSorted[iMu] = genParticles->at(mu_cands_index[iMu]).pt();
273 TMath::Sort(numMuCands,muPtSorted,idxMu);
274 for(
int iMu=0; iMu<numMuCands; iMu++ ){
278 const reco::Candidate & mcParticle = (*genParticles)[mu_cands_index[idxMu[iMu]]];
283 int qual =
gRandom->Integer(16);
285 int charge = ( mcParticle.
charge()<0 ) ? 1 : 0;
291 if( eta>=9999 )
continue;
293 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *
p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
295 l1t::Muon mu(*p4, pt, eta, phi, qual, charge, chargeValid, iso, mip, tag);
296 muonVec.push_back(
mu);
301 int numEgCands = int( eg_cands_index.size() );
302 Int_t idxEg[numEgCands];
303 double egPtSorted[numEgCands];
304 for(
int iEg=0; iEg<numEgCands; iEg++ ) egPtSorted[iEg] = genParticles->at(eg_cands_index[iEg]).pt();
306 TMath::Sort(numEgCands,egPtSorted,idxEg);
307 for(
int iEg=0; iEg<numEgCands; iEg++ ){
311 const reco::Candidate & mcParticle = (*genParticles)[eg_cands_index[idxEg[iEg]]];
320 if( eta>=9999 )
continue;
322 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
325 egammaVec.push_back(eg);
331 int numTauCands = int( tau_cands_index.size() );
332 Int_t idxTau[numTauCands];
333 double tauPtSorted[numTauCands];
334 for(
int iTau=0; iTau<numTauCands; iTau++ ) tauPtSorted[iTau] = genParticles->at(tau_cands_index[iTau]).pt();
336 TMath::Sort(numTauCands,tauPtSorted,idxTau);
337 for(
int iTau=0; iTau<numTauCands; iTau++ ){
341 const reco::Candidate & mcParticle = (*genParticles)[tau_cands_index[idxTau[iTau]]];
350 if( eta>=9999 )
continue;
352 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
355 tauVec.push_back(
tau);
361 int maxOtherTaus = 8;
362 int numCurrentEGs = int( egammaVec.size() );
363 int numCurrentTaus = int( tauVec.size() );
365 int numExtraEGs=0, numExtraTaus=0;
376 for(reco::GenJetCollection::const_iterator genJet = genJets->begin(); genJet!=genJets->end(); ++genJet ){
379 sumEt += genJet->et();
386 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
393 if( eta>=9999 )
continue;
398 jetVec.push_back(
jet);
403 if( (numExtraEGs+numCurrentEGs)<
maxNumEGCands_ && numExtraEGs<maxOtherEGs ){
413 l1t::EGamma eg(*p4, EGpt, EGeta, EGphi, EGqual, EGiso);
414 egammaVec.push_back(eg);
417 if( (numExtraTaus+numCurrentTaus)<
maxNumTauCands_ && numExtraTaus<maxOtherTaus ){
426 l1t::Tau tau(*p4, Taupt, Taueta, Tauphi, Tauqual, Tauiso);
427 tauVec.push_back(
tau);
433 LogTrace(
"l1t|Global") <<
">>> GenJets collection not found!" << std::endl;
443 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
446 l1t::EtSum etmiss(*p4, l1t::EtSum::EtSumType::kMissingEt,pt, 0,phi, 0);
447 etsumVec.push_back(etmiss);
453 l1t::EtSum htmiss(*p4, l1t::EtSum::EtSumType::kMissingHt,pt, 0,phi, 0);
454 etsumVec.push_back(htmiss);
459 LogTrace(
"l1t|Global") <<
">>> GenMet collection not found!" << std::endl;
465 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
466 l1t::EtSum etTotal(*p4, l1t::EtSum::EtSumType::kTotalEt,pt, 0, 0, 0);
467 etsumVec.push_back(etTotal);
470 l1t::EtSum htTotal(*p4, l1t::EtSum::EtSumType::kTotalHt,pt, 0, 0, 0);
471 etsumVec.push_back(htTotal);
484 for(
int iMu=0; iMu<int(
muonVec_bx0.size()); iMu++ ){
491 for(
int iMu=0; iMu<int(muonVec.size()); iMu++ ){
492 muons->push_back(2, muonVec[iMu]);
513 for(
int iEG=0; iEG<int(egammaVec.size()); iEG++ ){
514 egammas->push_back(2, egammaVec[iEG]);
522 for(
int iTau=0; iTau<int(
tauVec_bxm2.size()); iTau++ ){
525 for(
int iTau=0; iTau<int(
tauVec_bxm1.size()); iTau++ ){
528 for(
int iTau=0; iTau<int(
tauVec_bx0.size()); iTau++ ){
531 for(
int iTau=0; iTau<int(
tauVec_bxp1.size()); iTau++ ){
535 for(
int iTau=0; iTau<int(tauVec.size()); iTau++ ){
536 taus->push_back(2, tauVec[iTau]);
544 for(
int iJet=0; iJet<int(
jetVec_bxm2.size()); iJet++ ){
547 for(
int iJet=0; iJet<int(
jetVec_bxm1.size()); iJet++ ){
550 for(
int iJet=0; iJet<int(
jetVec_bx0.size()); iJet++ ){
553 for(
int iJet=0; iJet<int(
jetVec_bxp1.size()); iJet++ ){
557 for(
int iJet=0; iJet<int(jetVec.size()); iJet++ ){
558 jets->push_back(2, jetVec[iJet]);
566 for(
int iETsum=0; iETsum<int(
etsumVec_bxm2.size()); iETsum++ ){
569 for(
int iETsum=0; iETsum<int(
etsumVec_bxm1.size()); iETsum++ ){
572 for(
int iETsum=0; iETsum<int(
etsumVec_bx0.size()); iETsum++ ){
575 for(
int iETsum=0; iETsum<int(
etsumVec_bxp1.size()); iETsum++ ){
579 for(
int iETsum=0; iETsum<int(etsumVec.size()); iETsum++ ){
580 etsums->push_back(2, etsumVec[iETsum]);
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual double pt() const =0
transverse momentum
virtual int status() const =0
status word
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Abs< T >::type abs(const T &t)
virtual int charge() const =0
electric charge
virtual int pdgId() const =0
PDG identifier.
TLorentzVector genMet(const HepMC::GenEvent *all, double etamin=-9999., double etamax=9999.)
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity