===== selected links ===== ==== automatic gallery ==== * http://sigal.saimon.org/en/latest/ * needed for installation: http://lipyrary.blogspot.fr/2009/08/how-to-add-new-module-search-path.html ==== tutorials ==== * [[https://www.coursera.org/course/db|introduction to databases]] ==== useful stuff ==== * [[http://www.physik.uzh.ch/~che/FeynDiag/index.php|Feynman diagram library]] ==== teaching and seminars ==== * [[http://www.physik.unizh.ch/seminars/tpseminar/|Seminar on Particle and Astrophysics (Autumn Semester 2013)]] ==== Code ==== Sorting a vector based on another vector: http://stackoverflow.com/questions/236172/how-do-i-sort-a-stdvector-by-the-values-of-a-different-stdvector struct tlvordering { bool operator ()(std::pair::const_iterator> const& a, std::pair::const_iterator> const& b) { return (*(a.second)).Pt() > (b.second->Pt()); } }; template std::vector sort_from_tlvref( std::vector const& in, std::vector::const_iterator> > const& reference ) { std::vector ret(in.size()); size_t const size = in.size(); for (size_t i = 0; i < size; ++i) ret[i] = in[reference[i].first]; return ret; } void sortJetsByPt(std::vector& selJets, // index vector std::vector& selJetsP4, std::vector& selJetsSVMassBins, std::vector& selJetsSVMassSum, std::vector< std::vector >& selJetsBTags, std::vector& selJetsFlav) { // make a pair of index order and TLorentzVector std::vector::const_iterator> > order(selJetsP4.size()); size_t n = 0; for (std::vector::const_iterator it = selJetsP4.begin(); it != selJetsP4.end(); ++it, ++n) { order[n] = std::make_pair(n, it); } // sort order pair by jet Pt sort(order.begin(), order.end(), tlvordering()); // user order pair as reference for sorting all vectors selJets = sort_from_tlvref(selJets, order); selJetsP4 = sort_from_tlvref(selJetsP4, order); selJetsSVMassBins = sort_from_tlvref(selJetsSVMassBins, order); selJetsSVMassSum = sort_from_tlvref(selJetsSVMassSum, order); selJetsBTags = sort_from_tlvref(selJetsBTags, order); selJetsFlav = sort_from_tlvref(selJetsFlav, order); // loop over jets and change order // for (size_t iJ = 0; iJ < selJets.size()-1; ++iJ) { // // if (selJetsP4[iJ].Pt() < selJetsP4[iJ+1].Pt()) { // jetOrder[iJ] = iJ+1 // } // } }