File indexing completed on 2025-08-06 08:13:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #define SCORRELATORUTILITIES_VTXINTERFACES_CC
0011
0012
0013 #include "VtxInterfaces.h"
0014
0015
0016 using namespace std;
0017 using namespace findNode;
0018
0019
0020
0021
0022
0023 namespace SColdQcdCorrelatorAnalysis {
0024
0025
0026
0027
0028 GlobalVertexMap* Interfaces::GetVertexMap(PHCompositeNode* topNode) {
0029
0030
0031 GlobalVertexMap* mapVtx = getClass<GlobalVertexMap>(topNode, "GlobalVertexMap");
0032
0033
0034 const bool isVtxMapGood = (mapVtx && !(mapVtx -> empty()));
0035 if (!isVtxMapGood) {
0036 cerr << PHWHERE
0037 << "PANIC: GlobalVertexMap node is missing or empty!\n"
0038 << " Please turn on the do_global flag in the main macro in order to reconstruct the global vertex!"
0039 << endl;
0040 assert(isVtxMapGood);
0041 }
0042 return mapVtx;
0043
0044 }
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 GlobalVertex* Interfaces::GetGlobalVertex(PHCompositeNode* topNode, optional<int> iVtxToGrab) {
0055
0056
0057 GlobalVertexMap* mapVtx = GetVertexMap(topNode);
0058
0059
0060 GlobalVertex* vtx = NULL;
0061 if (iVtxToGrab.has_value()) {
0062 vtx = mapVtx -> get(iVtxToGrab.value());
0063 } else {
0064 vtx = mapVtx -> begin() -> second;
0065 }
0066
0067
0068 if (!vtx) {
0069 cerr << PHWHERE
0070 << "PANIC: no vertex!"
0071 << endl;
0072 assert(vtx);
0073 }
0074 return vtx;
0075
0076 }
0077
0078
0079
0080
0081
0082
0083 ROOT::Math::XYZVector Interfaces::GetRecoVtx(PHCompositeNode* topNode) {
0084
0085 const GlobalVertex* vtx = GetGlobalVertex(topNode);
0086 return ROOT::Math::XYZVector(vtx -> get_x(), vtx -> get_y(), vtx -> get_z());
0087
0088 }
0089
0090 }
0091
0092