File indexing completed on 2025-08-06 08:13:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef SLAMBDAJETHUNTER_H
0012 #define SLAMBDAJETHUNTER_H
0013
0014 #pragma GCC diagnostic push
0015 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0016
0017
0018 #include <map>
0019 #include <cmath>
0020 #include <limits>
0021 #include <string>
0022 #include <vector>
0023 #include <cassert>
0024 #include <utility>
0025 #include <optional>
0026
0027 #include <TFile.h>
0028 #include <TTree.h>
0029 #include <TMath.h>
0030
0031 #include <fastjet/PseudoJet.hh>
0032 #include <fastjet/JetDefinition.hh>
0033 #include <fastjet/ClusterSequence.hh>
0034 #include <fastjet/FunctionOfPseudoJet.hh>
0035
0036 #include <HepMC/GenEvent.h>
0037 #include <HepMC/GenVertex.h>
0038 #include <HepMC/GenParticle.h>
0039
0040 #include <phool/PHCompositeNode.h>
0041
0042 #include <fun4all/SubsysReco.h>
0043 #include <fun4all/Fun4AllReturnCodes.h>
0044
0045 #include <g4main/PHG4Particle.h>
0046 #include <g4main/PHG4Particlev2.h>
0047 #include <g4main/PHG4TruthInfoContainer.h>
0048
0049 #include <scorrelatorutilities/Tools.h>
0050 #include <scorrelatorutilities/Types.h>
0051 #include <scorrelatorutilities/Constants.h>
0052 #include <scorrelatorutilities/Interfaces.h>
0053
0054 #include "SLambdaJetHunterConfig.h"
0055
0056 #pragma GCC diagnostic pop
0057
0058
0059 using namespace std;
0060 using namespace fastjet;
0061
0062
0063
0064 namespace SColdQcdCorrelatorAnalysis {
0065
0066
0067
0068
0069
0070
0071
0072 class SLambdaJetHunter : public SubsysReco {
0073
0074 public:
0075
0076
0077 enum Associator { Barcode, Decay, Distance };
0078
0079
0080 SLambdaJetHunter(const string &name = "SLambdaJetHunter", const bool debug = false);
0081 SLambdaJetHunter(SLambdaJetHunterConfig& config);
0082 ~SLambdaJetHunter() override;
0083
0084
0085 int Init(PHCompositeNode *topNode) override;
0086 int process_event(PHCompositeNode *topNode) override;
0087 int End(PHCompositeNode *topNode) override;
0088
0089
0090 void SetConfig(SLambdaJetHunterConfig& config) {m_config = config;}
0091
0092
0093 SLambdaJetHunterConfig GetConfig() {return m_config;}
0094
0095 private:
0096
0097
0098 void GrabEventInfo(PHCompositeNode* topNode);
0099 void FindLambdas(PHCompositeNode* topNode);
0100 void MakeJets(PHCompositeNode* topNode);
0101 void CollectJetOutput(PHCompositeNode* topNode);
0102 void AssociateLambdasToJets(PHCompositeNode* topNode);
0103 void FillOutputTree();
0104 bool HasParentInfo(const int parent);
0105 bool HasLambda(Types::JetInfo& jet);
0106 bool IsGoodParticle(Types::ParInfo& particle);
0107 bool IsGoodLambda(Types::ParInfo& lambda);
0108 bool IsLambda(const int pid);
0109 bool IsNewLambda(const int id);
0110 bool IsInHepMCDecayChain(const int idToFind, HepMC::GenVertex* vtxToStart);
0111 bool IsInPHG4DecayChain(const int idToFind, const int idLambda, PHCompositeNode* topNode);
0112 double GetLambdaAssocZ(Types::ParInfo& lambda);
0113 double GetLambdaAssocDr(Types::ParInfo& lambda);
0114 uint64_t GetNTaggedJets();
0115 optional<int> HuntLambdasByBarcode(Types::ParInfo& lambda);
0116 optional<int> HuntLambdasByDecayChain(Types::ParInfo& lambda, PHCompositeNode* topNode);
0117 optional<int> HuntLambdasByDistance(Types::ParInfo& lambda);
0118
0119
0120 void InitTree();
0121 void InitOutput();
0122 void SaveAndCloseOutput();
0123 void ResetOutput();
0124
0125
0126 TFile* m_outFile = NULL;
0127 TTree* m_outTree = NULL;
0128
0129
0130 SLambdaJetHunterConfig m_config;
0131
0132
0133 Types::GEvtInfo m_genEvtInfo;
0134 vector<Types::ParInfo> m_lambdaInfo;
0135 vector<Types::JetInfo> m_jetInfo;
0136 vector<vector<Types::CstInfo>> m_cstInfo;
0137
0138
0139 vector<int> m_vecSubEvts;
0140 vector<int> m_vecIDToCheck;
0141 vector<PseudoJet> m_vecFastJets;
0142 vector<HepMC::GenVertex*> m_vecVtxToCheck;
0143 vector<HepMC::GenVertex*> m_vecVtxChecking;
0144
0145
0146 map<int, int> m_mapLambdaJetAssoc;
0147
0148
0149
0150 uint64_t m_evtNJets;
0151 uint64_t m_evtNLambdas;
0152 uint64_t m_evtNTaggedJets;
0153 uint64_t m_evtNChrgPars;
0154 uint64_t m_evtNNeuPars;
0155 double m_evtSumEPar;
0156 double m_evtVtxX;
0157 double m_evtVtxY;
0158 double m_evtVtxZ;
0159
0160 pair<int, int> m_evtPartID;
0161 pair<double, double> m_evtPartPx;
0162 pair<double, double> m_evtPartPy;
0163 pair<double, double> m_evtPartPz;
0164 pair<double, double> m_evtPartE;
0165
0166 vector<int> m_lambdaID;
0167 vector<int> m_lambdaPID;
0168 vector<int> m_lambdaJetID;
0169 vector<int> m_lambdaEmbedID;
0170 vector<double> m_lambdaZ;
0171 vector<double> m_lambdaDr;
0172 vector<double> m_lambdaE;
0173 vector<double> m_lambdaPt;
0174 vector<double> m_lambdaEta;
0175 vector<double> m_lambdaPhi;
0176
0177 vector<bool> m_jetHasLambda;
0178 vector<uint64_t> m_jetNCst;
0179 vector<uint64_t> m_jetID;
0180 vector<double> m_jetE;
0181 vector<double> m_jetPt;
0182 vector<double> m_jetEta;
0183 vector<double> m_jetPhi;
0184
0185 vector<vector<int>> m_cstID;
0186 vector<vector<int>> m_cstPID;
0187 vector<vector<int>> m_cstJetID;
0188 vector<vector<int>> m_cstEmbedID;
0189 vector<vector<double>> m_cstZ;
0190 vector<vector<double>> m_cstDr;
0191 vector<vector<double>> m_cstE;
0192 vector<vector<double>> m_cstPt;
0193 vector<vector<double>> m_cstEta;
0194 vector<vector<double>> m_cstPhi;
0195
0196
0197 struct SLambdaJetHunterConsts {
0198 int pidLambda;
0199 int maxVtxToCheck;
0200 } m_const = {3122, 500};
0201
0202 };
0203
0204 }
0205
0206 #endif
0207
0208