vector<Jet> GenVecbos::SISCone(vector<TLorentzVector> InputCollection, double Rparam, double thePtMin){ fastjet::SISConePlugin* mPlugin; fastjet::SISConePlugin::SplitMergeScale scale = fastjet::SISConePlugin::SM_pttilde; mPlugin = new fastjet::SISConePlugin(Rparam, 0.75, 0, thePtMin, false, scale); std::vector<fastjet::PseudoJet> input_vectors; int index_=0; for(int i = 0; i < InputCollection.size(); i++){ double px = InputCollection[i].Px(); double py = InputCollection[i].Py(); double pz = InputCollection[i].Pz(); double E = InputCollection[i].E(); fastjet::PseudoJet PsJet(px,py,pz,E); PsJet.set_user_index(index_); input_vectors.push_back(PsJet); index_++; } vector<Jet> output; if(index_ == 0) return output; fastjet::JetDefinition jetDefinition(mPlugin); fastjet::ClusterSequence clusterSequence(input_vectors, jetDefinition); vector<fastjet::PseudoJet> inclusiveJets = clusterSequence.inclusive_jets(1.0); for(std::vector<fastjet::PseudoJet>::const_iterator itJet=inclusiveJets.begin(); itJet!=inclusiveJets.end();itJet++){ double px = (*itJet).px(); double py = (*itJet).py(); double pz = (*itJet).pz(); double E = (*itJet).E(); TLorentzVector J(px,py,pz,E); output.push_back(Jet(J,0.0,0.0)); } delete mPlugin; return output; }
void JetCollection::add (Int_t nJets, Float_t * pt, Float_t * eta, Float_t * flavor, Float_t * csv, std::string type) { for(Int_t i = 0; i < nJets; ++i) { jets.push_back(Jet(pt[i], eta[i], flavor[i], csv[i], i, type)); } }
StatusCode DelphesSaveGenJets::saveOutput(Delphes& delphes, const fcc::MCParticleCollection& mcParticles) { // Create the collections auto colGenJets = m_genJets.createAndPut(); auto colJetsFlavor = m_jetFlavorTags.createAndPut(); auto ascColJetsToFlavor = m_jetFlavorAssociations.createAndPut(); auto ascColGenJetsToMC = m_mcAssociations.createAndPut(); const TObjArray* delphesColl = delphes.ImportArray(m_delphesArrayName.c_str()); if (delphesColl == nullptr) { warning() << "Delphes collection " << m_delphesArrayName << " not present. Skipping it." << endmsg; return StatusCode::SUCCESS; } for(int j = 0; j < delphesColl->GetEntries(); ++j) { auto cand = static_cast<Candidate *>(delphesColl->At(j)); // Jet info auto jet = colGenJets->create(); auto bareJet = fcc::BareJet(); bareJet.Area = -1; bareJet.P4.Px = cand->Momentum.Px(); bareJet.P4.Py = cand->Momentum.Py(); bareJet.P4.Pz = cand->Momentum.Pz(); bareJet.P4.Mass = cand->Mass; jet.Core(bareJet); // Flavor-tag info auto flavorTag = colJetsFlavor->create(); auto relationToFlavor = ascColJetsToFlavor->create(); flavorTag.Value(cand->Flavor); relationToFlavor.Jet(jet); relationToFlavor.Tag(flavorTag); // Debug: print FCC-EDM jets info if (msgLevel() <= MSG::DEBUG) { double energy = sqrt(jet.Core().P4.Px*jet.Core().P4.Px + jet.Core().P4.Py*jet.Core().P4.Py + jet.Core().P4.Pz*jet.Core().P4.Pz + jet.Core().P4.Mass*jet.Core().P4.Mass); debug() << "Gen Jet: " << " Id: " << std::setw(3) << j+1 << " Flavor: " << std::setw(3) << relationToFlavor.Tag().Value() << std::scientific << " Px: " << std::setprecision(2) << std::setw(9) << jet.Core().P4.Px << " Py: " << std::setprecision(2) << std::setw(9) << jet.Core().P4.Py << " Pz: " << std::setprecision(2) << std::setw(9) << jet.Core().P4.Pz << " E: " << std::setprecision(2) << std::setw(9) << energy << " M: " << std::setprecision(2) << std::setw(9) << jet.Core().P4.Mass << std::fixed << std::endl; } // Reference to MC - Delphes holds references to all objects related to the Jet object, // several relations might exist -> find "recursively" in a tree history the MC particle. // Add index to the reference index field to avoid double counting std::set<int> idRefMCPart; // Avoid double counting when referencingh MC particles // Recursive procedure stops after the relation found is the one to MC particle and not to // a particle object. If particle not related to MC particle (<0 value) findJetPartMC(cand, mcParticles.size(), idRefMCPart); // Debug: print variable double totSimE = 0; for (auto id : idRefMCPart) { auto relationToMC = ascColGenJetsToMC->create(); relationToMC.Jet(jet); relationToMC.Particle(mcParticles.at(id)); // Debug: print FCC-EDM jet relation info if (msgLevel() <= MSG::DEBUG) { double recE = sqrt(relationToMC.Jet().Core().P4.Px*relationToMC.Jet().Core().P4.Px + relationToMC.Jet().Core().P4.Py*relationToMC.Jet().Core().P4.Py + relationToMC.Jet().Core().P4.Pz*relationToMC.Jet().Core().P4.Pz + relationToMC.Jet().Core().P4.Mass*relationToMC.Jet().Core().P4.Mass); double simE = sqrt(relationToMC.Particle().Core().P4.Px*relationToMC.Particle().Core().P4.Px + relationToMC.Particle().Core().P4.Py*relationToMC.Particle().Core().P4.Py + relationToMC.Particle().Core().P4.Pz*relationToMC.Particle().Core().P4.Pz + relationToMC.Particle().Core().P4.Mass*relationToMC.Particle().Core().P4.Mass); totSimE += simE; debug() << " RefId: " << std::setw(3) << id+1 << " Rel E: " << std::setprecision(2) << std::scientific << std::setw(9) << simE << " " << std::setw(9) << totSimE << " <-> " << std::setw(9) << recE << std::fixed << std::endl; } // Debug } // Debug: print end-line if (msgLevel() <= MSG::DEBUG) debug() << endmsg; } // For - jets return StatusCode::SUCCESS; }