File indexing completed on 2023-10-25 10:06:14
0001 #ifndef Validation_EventGenerator_HepMCValidationHelper
0002 #define Validation_EventGenerator_HepMCValidationHelper
0003
0004 #include <HepMC/GenEvent.h>
0005 #include <vector>
0006 #include "TLorentzVector.h"
0007
0008 namespace HepMCValidationHelper {
0009 template <class T>
0010 inline bool GreaterByE(const T& a1, const T& a2) {
0011 return a1.E() > a2.E();
0012 }
0013
0014
0015 inline bool sortByPt(const HepMC::GenParticle* a, const HepMC::GenParticle* b) {
0016 return a->momentum().perp() > b->momentum().perp();
0017 }
0018
0019 template <class T>
0020 inline bool sortByPtRef(const T lhs, const T rhs) {
0021 return lhs->pt() > rhs->pt();
0022 }
0023
0024
0025 inline bool sortByE(const HepMC::GenParticle* a, const HepMC::GenParticle* b) {
0026 return a->momentum().e() > b->momentum().e();
0027 }
0028
0029
0030 inline bool sortByRapidity(const HepMC::GenParticle* a, const HepMC::GenParticle* b) {
0031 const HepMC::FourVector& amom = a->momentum();
0032 const HepMC::FourVector& bmom = b->momentum();
0033 double rapa = 0.5 * std::log((amom.e() + amom.z()) / (amom.e() - amom.z()));
0034 double rapb = 0.5 * std::log((bmom.e() + bmom.z()) / (bmom.e() - bmom.z()));
0035 return rapa > rapb;
0036 }
0037
0038
0039 inline bool sortByPseudoRapidity(const HepMC::GenParticle* a, const HepMC::GenParticle* b) {
0040 return a->momentum().eta() > b->momentum().eta();
0041 }
0042
0043 void findDescendents(const HepMC::GenParticle* a, std::vector<const HepMC::GenParticle*>& descendents);
0044
0045
0046 void allStatus1(const HepMC::GenEvent* all, std::vector<const HepMC::GenParticle*>& status1);
0047
0048
0049 void allStatus2(const HepMC::GenEvent* all, std::vector<const HepMC::GenParticle*>& status2);
0050
0051
0052 void allStatus3(const HepMC::GenEvent* all, std::vector<const HepMC::GenParticle*>& status3);
0053
0054
0055
0056 void findFSRPhotons(const std::vector<const HepMC::GenParticle*>& leptons,
0057 const std::vector<const HepMC::GenParticle*>& all,
0058 double deltaR,
0059 std::vector<const HepMC::GenParticle*>& photons);
0060
0061
0062
0063 void findFSRPhotons(const std::vector<const HepMC::GenParticle*>& leptons,
0064 const HepMC::GenEvent* all,
0065 double deltaR,
0066 std::vector<const HepMC::GenParticle*>& photons);
0067
0068
0069 bool isChargedLepton(const HepMC::GenParticle* part);
0070
0071
0072 bool isNeutrino(const HepMC::GenParticle* part);
0073
0074
0075 bool isTau(const HepMC::GenParticle* part);
0076
0077
0078
0079
0080 void removeIsolatedLeptons(const HepMC::GenEvent* all,
0081 double deltaR,
0082 double sumPt,
0083 std::vector<const HepMC::GenParticle*>& pruned);
0084
0085
0086 void allStatus1(const HepMC::GenEvent* all, std::vector<const HepMC::GenParticle*>& status1);
0087
0088
0089 void allVisibleParticles(const HepMC::GenEvent* all, std::vector<const HepMC::GenParticle*>& visible);
0090
0091
0092 TLorentzVector genMet(const HepMC::GenEvent* all, double etamin = -9999., double etamax = 9999.);
0093
0094 }
0095
0096 #endif