193 LogDebug(
"l1t|Global") <<
"GenToInputProducer::produce function called...\n";
196 std::vector<l1t::Muon> muonVec;
197 std::vector<l1t::EGamma> egammaVec;
198 std::vector<l1t::Tau> tauVec;
199 std::vector<l1t::Jet> jetVec;
200 std::vector<l1t::EtSum> etsumVec;
233 std::vector<int> mu_cands_index;
234 std::vector<int> eg_cands_index;
235 std::vector<int> tau_cands_index;
240 for(
size_t k = 0;
k < genParticles->size();
k++ ){
245 double pt = mcParticle.
pt();
248 if( status!=1 && !(
abs(pdgId)==15 && status==2) )
continue;
250 int absId =
abs(pdgId);
253 else if( absId==13 && pt>=
muEtThreshold_ ) mu_cands_index.push_back(
k);
258 LogTrace(
"l1t|Global") <<
">>> GenParticles collection not found!" << std::endl;
264 int numMuCands = int( mu_cands_index.size() );
265 Int_t idxMu[numMuCands];
266 double muPtSorted[numMuCands];
267 for(
int iMu=0; iMu<numMuCands; iMu++ ) 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]]];
287 if( eta>=9999 )
continue;
289 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *
p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
291 l1t::Muon mu(*p4, pt, eta, phi, qual, charge, chargeValid, iso, mip, tag);
292 muonVec.push_back(
mu);
297 int numEgCands = int( eg_cands_index.size() );
298 Int_t idxEg[numEgCands];
299 double egPtSorted[numEgCands];
300 for(
int iEg=0; iEg<numEgCands; iEg++ ) egPtSorted[iEg] = genParticles->at(eg_cands_index[iEg]).pt();
302 TMath::Sort(numEgCands,egPtSorted,idxEg);
303 for(
int iEg=0; iEg<numEgCands; iEg++ ){
307 const reco::Candidate & mcParticle = (*genParticles)[eg_cands_index[idxEg[iEg]]];
316 if( eta>=9999 )
continue;
318 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
321 egammaVec.push_back(eg);
327 int numTauCands = int( tau_cands_index.size() );
328 Int_t idxTau[numTauCands];
329 double tauPtSorted[numTauCands];
330 for(
int iTau=0; iTau<numTauCands; iTau++ ) tauPtSorted[iTau] = genParticles->at(tau_cands_index[iTau]).pt();
332 TMath::Sort(numTauCands,tauPtSorted,idxTau);
333 for(
int iTau=0; iTau<numTauCands; iTau++ ){
337 const reco::Candidate & mcParticle = (*genParticles)[tau_cands_index[idxTau[iTau]]];
346 if( eta>=9999 )
continue;
348 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
351 tauVec.push_back(
tau);
357 int maxOtherTaus = 8;
358 int numCurrentEGs = int( egammaVec.size() );
359 int numCurrentTaus = int( tauVec.size() );
361 int numExtraEGs=0, numExtraTaus=0;
372 for(reco::GenJetCollection::const_iterator genJet = genJets->begin(); genJet!=genJets->end(); ++genJet ){
375 sumEt += genJet->et();
382 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
389 if( eta>=9999 )
continue;
394 jetVec.push_back(
jet);
399 if( (numExtraEGs+numCurrentEGs)<
maxNumEGCands_ && numExtraEGs<maxOtherEGs ){
409 l1t::EGamma eg(*p4, EGpt, EGeta, EGphi, EGqual, EGiso);
410 egammaVec.push_back(eg);
413 if( (numExtraTaus+numCurrentTaus)<
maxNumTauCands_ && numExtraTaus<maxOtherTaus ){
422 l1t::Tau tau(*p4, Taupt, Taueta, Tauphi, Tauqual, Tauiso);
423 tauVec.push_back(
tau);
429 LogTrace(
"l1t|Global") <<
">>> GenJets collection not found!" << std::endl;
439 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
442 l1t::EtSum etmiss(*p4, l1t::EtSum::EtSumType::kMissingEt,pt, 0,phi, 0);
443 etsumVec.push_back(etmiss);
449 l1t::EtSum htmiss(*p4, l1t::EtSum::EtSumType::kMissingHt,pt, 0,phi, 0);
450 etsumVec.push_back(htmiss);
455 LogTrace(
"l1t|Global") <<
">>> GenMet collection not found!" << std::endl;
461 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 =
new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
462 l1t::EtSum etTotal(*p4, l1t::EtSum::EtSumType::kTotalEt,pt, 0, 0, 0);
463 etsumVec.push_back(etTotal);
466 l1t::EtSum htTotal(*p4, l1t::EtSum::EtSumType::kTotalHt,pt, 0, 0, 0);
467 etsumVec.push_back(htTotal);
480 for(
int iMu=0; iMu<int(
muonVec_bx0.size()); iMu++ ){
487 for(
int iMu=0; iMu<int(muonVec.size()); iMu++ ){
488 muons->push_back(2, muonVec[iMu]);
509 for(
int iEG=0; iEG<int(egammaVec.size()); iEG++ ){
510 egammas->push_back(2, egammaVec[iEG]);
518 for(
int iTau=0; iTau<int(
tauVec_bxm2.size()); iTau++ ){
521 for(
int iTau=0; iTau<int(
tauVec_bxm1.size()); iTau++ ){
524 for(
int iTau=0; iTau<int(
tauVec_bx0.size()); iTau++ ){
527 for(
int iTau=0; iTau<int(
tauVec_bxp1.size()); iTau++ ){
531 for(
int iTau=0; iTau<int(tauVec.size()); iTau++ ){
532 taus->push_back(2, tauVec[iTau]);
540 for(
int iJet=0; iJet<int(
jetVec_bxm2.size()); iJet++ ){
543 for(
int iJet=0; iJet<int(
jetVec_bxm1.size()); iJet++ ){
546 for(
int iJet=0; iJet<int(
jetVec_bx0.size()); iJet++ ){
549 for(
int iJet=0; iJet<int(
jetVec_bxp1.size()); iJet++ ){
553 for(
int iJet=0; iJet<int(jetVec.size()); iJet++ ){
554 jets->push_back(2, jetVec[iJet]);
562 for(
int iETsum=0; iETsum<int(
etsumVec_bxm2.size()); iETsum++ ){
565 for(
int iETsum=0; iETsum<int(
etsumVec_bxm1.size()); iETsum++ ){
568 for(
int iETsum=0; iETsum<int(
etsumVec_bx0.size()); iETsum++ ){
571 for(
int iETsum=0; iETsum<int(
etsumVec_bxp1.size()); iETsum++ ){
575 for(
int iETsum=0; iETsum<int(etsumVec.size()); iETsum++ ){
576 etsums->push_back(2, etsumVec[iETsum]);
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual float eta() const =0
momentum pseudorapidity
virtual int status() const =0
status word
virtual float phi() const =0
momentum azimuthal angle
virtual float pt() const =0
transverse momentum
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.)