From 2f22beed8e5ff769e3fbfe748364dfb809c6360f Mon Sep 17 00:00:00 2001 From: hoobidoobidoo Date: Wed, 24 Jul 2024 17:07:42 -0400 Subject: [PATCH 1/5] Outputting ls and md cut info along with modularization of that code --- SDL/MiniDoublet.h | 1 + SDL/Segment.h | 139 +++++++++++++++++++++++++++++++--- code/core/write_sdl_ntuple.cc | 92 +++++++++++++++++++++- 3 files changed, 216 insertions(+), 16 deletions(-) diff --git a/SDL/MiniDoublet.h b/SDL/MiniDoublet.h index e4ba62ee..6cc156aa 100644 --- a/SDL/MiniDoublet.h +++ b/SDL/MiniDoublet.h @@ -1,5 +1,6 @@ #ifndef MiniDoublet_cuh #define MiniDoublet_cuh +#define OUTPUT_MD_CUTS #include "Constants.h" #include "EndcapGeometry.h" diff --git a/SDL/Segment.h b/SDL/Segment.h index d9f7a0aa..4cb0e2b9 100644 --- a/SDL/Segment.h +++ b/SDL/Segment.h @@ -1,5 +1,6 @@ #ifndef Segment_cuh #define Segment_cuh +#define OUTPUT_LS_CUTS #include "Constants.h" #include "EndcapGeometry.h" @@ -15,6 +16,15 @@ namespace SDL { FPX* dPhiChanges; FPX* dPhiChangeMins; FPX* dPhiChangeMaxs; +#ifdef OUTPUT_LS_CUTS + FPX* zHis; + FPX* zLos; + FPX* rtHis; + FPX* rtLos; + FPX* dAlphaInners; + FPX* dAlphaOuters; + FPX* dAlphaInnerOuters; +#endif uint16_t* innerLowerModuleIndices; uint16_t* outerLowerModuleIndices; unsigned int* seedIdx; @@ -52,6 +62,17 @@ namespace SDL { dPhiChanges = alpaka::getPtrNative(segmentsbuf.dPhiChanges_buf); dPhiChangeMins = alpaka::getPtrNative(segmentsbuf.dPhiChangeMins_buf); dPhiChangeMaxs = alpaka::getPtrNative(segmentsbuf.dPhiChangeMaxs_buf); + +#ifdef OUTPUT_LS_CUTS + zHis = alpaka::getPtrNative(segmentsbuf.zHis_buf); + zLos = alpaka::getPtrNative(segmentsbuf.zLos_buf); + rtHis = alpaka::getPtrNative(segmentsbuf.rtHis_buf); + rtLos = alpaka::getPtrNative(segmentsbuf.rtLos_buf); + dAlphaInners = alpaka::getPtrNative(segmentsbuf.dAlphaInners_buf); + dAlphaOuters = alpaka::getPtrNative(segmentsbuf.dAlphaOuters_buf); + dAlphaInnerOuters = alpaka::getPtrNative(segmentsbuf.dAlphaInnerOuters_buf); + +#endif innerLowerModuleIndices = alpaka::getPtrNative(segmentsbuf.innerLowerModuleIndices_buf); outerLowerModuleIndices = alpaka::getPtrNative(segmentsbuf.outerLowerModuleIndices_buf); seedIdx = alpaka::getPtrNative(segmentsbuf.seedIdx_buf); @@ -91,6 +112,17 @@ namespace SDL { Buf dPhiChanges_buf; Buf dPhiChangeMins_buf; Buf dPhiChangeMaxs_buf; + +#ifdef OUTPUT_LS_CUTS + Buf zHis_buf; + Buf zLos_buf; + Buf rtHis_buf; + Buf rtLos_buf; + Buf dAlphaInners_buf; + Buf dAlphaOuters_buf; + Buf dAlphaInnerOuters_buf; +#endif + Buf innerLowerModuleIndices_buf; Buf outerLowerModuleIndices_buf; Buf seedIdx_buf; @@ -132,6 +164,16 @@ namespace SDL { dPhiChanges_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn, queue)), dPhiChangeMins_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn, queue)), dPhiChangeMaxs_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn, queue)), +#ifdef OUTPUT_LS_CUTS + zHis_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn, queue)), + zLos_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn, queue)), + rtHis_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn, queue)), + rtLos_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn, queue)), + dAlphaInners_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn,queue)), + dAlphaOuters_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn, queue)), + dAlphaInnerOuters_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn, queue)), +#endif + innerLowerModuleIndices_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn, queue)), outerLowerModuleIndices_buf(allocBufWrapper(devAccIn, nMemoryLocationsIn, queue)), seedIdx_buf(allocBufWrapper(devAccIn, maxPixelSegments, queue)), @@ -331,11 +373,8 @@ namespace SDL { modulesInGPU.sides[innerLowerModuleIndex] == SDL::Center) { dAlphaThresholdValues[0] = dAlpha_Bfield + alpaka::math::sqrt(acc, dAlpha_res * dAlpha_res + sdMuls * sdMuls); } else { - dAlphaThresholdValues[0] = - dAlpha_Bfield + - alpaka::math::sqrt(acc, dAlpha_res * dAlpha_res + sdMuls * sdMuls + sdLumForInnerMini * sdLumForInnerMini); + dAlphaThresholdValues[0] = dAlpha_Bfield + alpaka::math::sqrt(acc, dAlpha_res * dAlpha_res + sdMuls *sdMuls + sdLumForInnerMini * sdLumForOuterMini); } - if (modulesInGPU.subdets[outerLowerModuleIndex] == SDL::Barrel and modulesInGPU.sides[outerLowerModuleIndex] == SDL::Center) { dAlphaThresholdValues[1] = dAlpha_Bfield + alpaka::math::sqrt(acc, dAlpha_res * dAlpha_res + sdMuls * sdMuls); @@ -348,7 +387,7 @@ namespace SDL { //Inner to outer dAlphaThresholdValues[2] = dAlpha_Bfield + alpaka::math::sqrt(acc, dAlpha_res * dAlpha_res + sdMuls * sdMuls); }; - +#ifdef OUTPUT_LS_CUTS ALPAKA_FN_ACC ALPAKA_FN_INLINE void addSegmentToMemory(struct SDL::segments& segmentsInGPU, unsigned int lowerMDIndex, unsigned int upperMDIndex, @@ -362,6 +401,13 @@ namespace SDL { float& dPhiChange, float& dPhiChangeMin, float& dPhiChangeMax, + float& zHi, + float& zLo, + float& rtHi, + float& rtLo, + float& dAlphaInner, + float& dAlphaOuter, + float& dAlphaInnerOuter, unsigned int idx) { //idx will be computed in the kernel, which is the index into which the //segment will be written @@ -380,7 +426,52 @@ namespace SDL { segmentsInGPU.dPhiChanges[idx] = __F2H(dPhiChange); segmentsInGPU.dPhiChangeMins[idx] = __F2H(dPhiChangeMin); segmentsInGPU.dPhiChangeMaxs[idx] = __F2H(dPhiChangeMax); - } + + //hubert + segmentsInGPU.zHis[idx] = __F2H(zHi); + segmentsInGPU.zLos[idx] = __F2H(zLo); + segmentsInGPU.rtHis[idx] = __F2H(rtHi); + segmentsInGPU.rtLos[idx] = __F2H(rtLo); + segmentsInGPU.dAlphaInners[idx] = __F2H(dAlphaInner); + segmentsInGPU.dAlphaOuters[idx] = __F2H(dAlphaOuter); + segmentsInGPU.dAlphaInnerOuters[idx] = __F2H(dAlphaInnerOuter); + + }; +#else + + ALPAKA_FN_ACC ALPAKA_FN_INLINE void addSegmentToMemory(struct SDL::segments& segmentsInGPU, + unsigned int lowerMDIndex, + unsigned int upperMDIndex, + uint16_t innerLowerModuleIndex, + uint16_t outerLowerModuleIndex, + unsigned int innerMDAnchorHitIndex, + unsigned int outerMDAnchorHitIndex, + float& dPhi, + float& dPhiMin, + float& dPhiMax, + float& dPhiChange, + float& dPhiChangeMin, + float& dPhiChangeMax, + unsigned int idx) { + //idx will be computed in the kernel, which is the index into which the + //segment will be written + //nSegments will be incremented in the kernel + //printf("seg: %u %u %u %u\n",lowerMDIndex, upperMDIndex,innerLowerModuleIndex,outerLowerModuleIndex); + segmentsInGPU.mdIndices[idx * 2] = lowerMDIndex; + segmentsInGPU.mdIndices[idx * 2 + 1] = upperMDIndex; + segmentsInGPU.innerLowerModuleIndices[idx] = innerLowerModuleIndex; + segmentsInGPU.outerLowerModuleIndices[idx] = outerLowerModuleIndex; + segmentsInGPU.innerMiniDoubletAnchorHitIndices[idx] = innerMDAnchorHitIndex; + segmentsInGPU.outerMiniDoubletAnchorHitIndices[idx] = outerMDAnchorHitIndex; + + segmentsInGPU.dPhis[idx] = __F2H(dPhi); + segmentsInGPU.dPhiMins[idx] = __F2H(dPhiMin); + segmentsInGPU.dPhiMaxs[idx] = __F2H(dPhiMax); + segmentsInGPU.dPhiChanges[idx] = __F2H(dPhiChange); + segmentsInGPU.dPhiChangeMins[idx] = __F2H(dPhiChangeMin); + segmentsInGPU.dPhiChangeMaxs[idx] = __F2H(dPhiChangeMax); + }; +#endif template ALPAKA_FN_ACC ALPAKA_FN_INLINE void addPixelSegmentToMemory(TAcc const& acc, @@ -883,8 +974,8 @@ namespace SDL { } else { unsigned int segmentModuleIdx = alpaka::atomicOp(acc, &segmentsInGPU.nSegments[innerLowerModuleIndex], 1u); - unsigned int segmentIdx = rangesInGPU.segmentModuleIndices[innerLowerModuleIndex] + segmentModuleIdx; - + unsigned int segmentIdx = rangesInGPU.segmentModuleIndices[innerLowerModuleIndex] + segmentModuleIdx; +#ifdef OUTPUT_LS_CUTS addSegmentToMemory(segmentsInGPU, innerMDIndex, outerMDIndex, @@ -898,7 +989,32 @@ namespace SDL { dPhiChange, dPhiChangeMin, dPhiChangeMax, + zHi, + zLo, + rtHi, + rtLo, + dAlphaInnerMDSegment, + dAlphaOuterMDSegment, + dAlphaInnerMDOuterMD, segmentIdx); + +#else + addSegmentToMemory(segmentsInGPU, + innerMDIndex, + outerMDIndex, + innerLowerModuleIndex, + outerLowerModuleIndex, + innerMiniDoubletAnchorHitIndex, + outerMiniDoubletAnchorHitIndex, + dPhi, + dPhiMin, + dPhiMax, + dPhiChange, + dPhiChangeMin, + dPhiChangeMax, + segmentIdx); + +#endif } } } @@ -991,11 +1107,10 @@ namespace SDL { else { occupancy = 0; #ifdef Warnings - printf("Unhandled case in createSegmentArrayRanges! Module index = %i\n", i); + printf("Unhandled case in createSegmentArrayRanges! Module index = %i\n",i); #endif } - - int nTotSegs = alpaka::atomicOp(acc, &nTotalSegments, occupancy); + int nTotSegs = alpaka::atomicOp(acc, &nTotalSegments, occupancy); rangesInGPU.segmentModuleIndices[i] = nTotSegs; rangesInGPU.segmentModuleOccupancy[i] = occupancy; } @@ -1127,4 +1242,4 @@ namespace SDL { }; } // namespace SDL -#endif +#endif \ No newline at end of file diff --git a/code/core/write_sdl_ntuple.cc b/code/core/write_sdl_ntuple.cc index dd88a476..b1fd1de4 100644 --- a/code/core/write_sdl_ntuple.cc +++ b/code/core/write_sdl_ntuple.cc @@ -1,5 +1,4 @@ #include "write_sdl_ntuple.h" - //________________________________________________________________________________________________________________________________ void createOutputBranches() { @@ -159,6 +158,12 @@ void createGnnNtupleBranches() ana.tx->createBranch>("MD_eta"); ana.tx->createBranch>("MD_phi"); ana.tx->createBranch>("MD_dphichange"); + + //hubert + ana.tx->createBranch>("MD_dphi"); + ana.tx->createBranch>("MD_dz"); + + ana.tx->createBranch>("MD_isFake"); ana.tx->createBranch>("MD_tpType"); ana.tx->createBranch>("MD_detId"); @@ -756,6 +761,10 @@ void setGnnNtupleMiniDoublet(SDL::Event* event, unsigned int MD) // Obtaining dPhiChange float dphichange = miniDoubletsInGPU.dphichanges[MD]; + + //Huberts addition: + float dphi = miniDoubletsInGPU.dphis[MD]; + float dz = miniDoubletsInGPU.dzs[MD]; // Computing pt const float kRinv1GeVf = (2.99792458e-3 * 3.8); @@ -784,6 +793,11 @@ void setGnnNtupleMiniDoublet(SDL::Event* event, unsigned int MD) ana.tx->pushbackToBranch("MD_1_x", hit1_x); ana.tx->pushbackToBranch("MD_1_y", hit1_y); ana.tx->pushbackToBranch("MD_1_z", hit1_z); + + // hubert + ana.tx->pushbackToBranch("MD_dz", dz); + ana.tx->pushbackToBranch("MD_dphi", dphi); + // ana.tx->pushbackToBranch("MD_sim_idx", simidxs.size() > 0 ? simidxs[0] : -999); } @@ -1448,7 +1462,17 @@ void createOutputBranches_v2() // ana.tx->createBranch> ("md_pt"); // pt (computed based on delta phi change) ana.tx->createBranch> ("md_eta"); // eta (computed based on anchor hit's eta) - ana.tx->createBranch> ("md_phi"); // phi (computed based on anchor hit's phi) + ana.tx->createBranch> ("md_phi"); // phi (computed based on anchor hit's phi) + +#ifdef OUTPUT_MD_CUTS + ana.tx->createBranch> ("md_dphi"); + ana.tx->createBranch> ("md_dphichange"); + ana.tx->createBranch> ("md_dz"); +#endif + + + + ana.tx->createBranch> ("md_anchor_x"); // anchor hit x ana.tx->createBranch> ("md_anchor_y"); // anchor hit y ana.tx->createBranch> ("md_anchor_z"); // anchor hit z @@ -1475,6 +1499,22 @@ void createOutputBranches_v2() ana.tx->createBranch> ("ls_mdIdx1"); // index to the second MD ana.tx->createBranch> ("ls_isFake"); // 1 if md is fake 0 other if not ana.tx->createBranch> ("ls_simIdx"); // idx of best matched (highest nhit and > 75%) simulated track +#ifdef OUTPUT_LS_CUTS + ana.tx->createBranch> ("ls_zLos"); + ana.tx->createBranch> ("ls_zHis"); + ana.tx->createBranch> ("ls_rtLos"); + ana.tx->createBranch> ("ls_rtHis"); + ana.tx->createBranch> ("ls_dPhis"); + ana.tx->createBranch> ("ls_dPhiMins"); + ana.tx->createBranch> ("ls_dPhiMaxs"); + ana.tx->createBranch> ("ls_dPhiChanges"); + ana.tx->createBranch> ("ls_dPhiChangeMins"); + ana.tx->createBranch> ("ls_dPhiChangeMaxs"); + ana.tx->createBranch> ("ls_dAlphaInners"); + ana.tx->createBranch> ("ls_dAlphaOuters"); + ana.tx->createBranch> ("ls_dAlphaInnerOuters"); + +#endif ana.tx->createBranch>> ("ls_simIdxAll"); // list of idx of all matched (> 0%) simulated track ana.tx->createBranch>>("ls_simIdxAllFrac"); // list of idx of all matched (> 0%) simulated track @@ -1859,6 +1899,8 @@ void fillOutputBranches_v2(SDL::Event* event) // Pt is computed via dphichange and the eta and phi are computed based on anchor hit float dphichange = miniDoubletsInGPU.dphichanges[mdIdx]; + float dphi = miniDoubletsInGPU.dphis[mdIdx]; + float dz = miniDoubletsInGPU.dzs[mdIdx]; float k2Rinv1GeVf = (2.99792458e-3 * 3.8) / 2; float pt = anchor_hit.rt() * k2Rinv1GeVf / sin(dphichange); float eta = anchor_hit.eta(); @@ -1876,6 +1918,12 @@ void fillOutputBranches_v2(SDL::Event* event) ana.tx->pushbackToBranch("md_pt", pt); ana.tx->pushbackToBranch("md_eta", eta); ana.tx->pushbackToBranch("md_phi", phi); + +#ifdef OUTPUT_MD_CUTS + ana.tx->pushbackToBranch("md_dphichange", dphichange); + ana.tx->pushbackToBranch("md_dphi", dphi); + ana.tx->pushbackToBranch("md_dz", dz); +#endif ana.tx->pushbackToBranch("md_anchor_x", anchor_x); ana.tx->pushbackToBranch("md_anchor_y", anchor_y); ana.tx->pushbackToBranch("md_anchor_z", anchor_z); @@ -2016,11 +2064,47 @@ void fillOutputBranches_v2(SDL::Event* event) float pt = SDL::CPU::MathUtil::ptEstimateFromRadius(center.rt()); float eta = hitC.eta(); float phi = hitB.phi(); + + +#ifdef OUTPUT_LS_CUTS + float zHi = segmentsInGPU.zHis[lsIdx]; + float zLo = segmentsInGPU.zLos[lsIdx]; + float rtHi = segmentsInGPU.rtHis[lsIdx]; + float rtLo = segmentsInGPU.rtLos[lsIdx]; + float dAlphaInner = segmentsInGPU.dAlphaInners[lsIdx]; + float dAlphaOuter = segmentsInGPU.dAlphaOuters[lsIdx]; + float dAlphaInnerOuter = segmentsInGPU.dAlphaInnerOuters[lsIdx]; +#endif + float dPhi = segmentsInGPU.dPhis[lsIdx]; + float dPhiMin = segmentsInGPU.dPhiMins[lsIdx]; + float dPhiMax = segmentsInGPU.dPhiMaxs[lsIdx]; + float dPhiChange = segmentsInGPU.dPhiChanges[lsIdx]; + float dPhiChangeMin = segmentsInGPU.dPhiChangeMins[lsIdx]; + float dPhiChangeMax = segmentsInGPU.dPhiChangeMaxs[lsIdx]; // Write out the ntuple ana.tx->pushbackToBranch("ls_pt", pt); ana.tx->pushbackToBranch("ls_eta", eta); ana.tx->pushbackToBranch("ls_phi", phi); + +#ifdef OUTPUT_LS_CUTS + ana.tx->pushbackToBranch("ls_zHis",zHi); + ana.tx->pushbackToBranch("ls_zLos",zLo); + ana.tx->pushbackToBranch("ls_rtHis",rtHi); + ana.tx->pushbackToBranch("ls_rtLos",rtLo); + ana.tx->pushbackToBranch("ls_dPhis",dPhi); + ana.tx->pushbackToBranch("ls_dPhiMins",dPhiMin); + ana.tx->pushbackToBranch("ls_dPhiMaxs",dPhiMax); + ana.tx->pushbackToBranch("ls_dPhiChanges",dPhiChange); + ana.tx->pushbackToBranch("ls_dPhiChangeMins",dPhiChangeMin); + ana.tx->pushbackToBranch("ls_dPhiChangeMaxs",dPhiChangeMax); + ana.tx->pushbackToBranch("ls_dAlphaInners",dAlphaInner); + ana.tx->pushbackToBranch("ls_dAlphaOuters",dAlphaOuter); + ana.tx->pushbackToBranch("ls_dAlphaInnerOuters",dAlphaInnerOuter); + +#endif + + ana.tx->pushbackToBranch("ls_mdIdx0", md_idx_map[mdIdxs[0]]); ana.tx->pushbackToBranch("ls_mdIdx1", md_idx_map[mdIdxs[1]]); @@ -2770,7 +2854,7 @@ void fillOutputBranches_v2(SDL::Event* event) // Fill some branches for this track candidate ana.tx->pushbackToBranch("tc_pt", pt); ana.tx->pushbackToBranch("tc_eta", eta); - ana.tx->pushbackToBranch("tc_phi", phi); +https://uf.tfaforms.net/f/UFIC-ISS-Contact-Us ana.tx->pushbackToBranch("tc_phi", phi); ana.tx->pushbackToBranch("tc_type", type); enum { @@ -2935,4 +3019,4 @@ void fillOutputBranches_v2(SDL::Event* event) // Then clear the branches to default values (e.g. -999, or clear the vectors to empty vectors) ana.tx->clear(); -} +} \ No newline at end of file From d3d32e20a4e30f68244c18e30d1a46d15e5ac6ea Mon Sep 17 00:00:00 2001 From: hoobidoobidoo Date: Mon, 29 Jul 2024 06:41:33 -0400 Subject: [PATCH 2/5] Attempting to fix plotting code after LSTOD cut changes --- code/core/write_sdl_ntuple.cc | 8 ++-- efficiency/src/SDL.cc | 74 +++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 5 deletions(-) diff --git a/code/core/write_sdl_ntuple.cc b/code/core/write_sdl_ntuple.cc index b1fd1de4..49275c60 100644 --- a/code/core/write_sdl_ntuple.cc +++ b/code/core/write_sdl_ntuple.cc @@ -1470,9 +1470,6 @@ void createOutputBranches_v2() ana.tx->createBranch> ("md_dz"); #endif - - - ana.tx->createBranch> ("md_anchor_x"); // anchor hit x ana.tx->createBranch> ("md_anchor_y"); // anchor hit y ana.tx->createBranch> ("md_anchor_z"); // anchor hit z @@ -1499,6 +1496,7 @@ void createOutputBranches_v2() ana.tx->createBranch> ("ls_mdIdx1"); // index to the second MD ana.tx->createBranch> ("ls_isFake"); // 1 if md is fake 0 other if not ana.tx->createBranch> ("ls_simIdx"); // idx of best matched (highest nhit and > 75%) simulated track + #ifdef OUTPUT_LS_CUTS ana.tx->createBranch> ("ls_zLos"); ana.tx->createBranch> ("ls_zHis"); @@ -1513,8 +1511,8 @@ void createOutputBranches_v2() ana.tx->createBranch> ("ls_dAlphaInners"); ana.tx->createBranch> ("ls_dAlphaOuters"); ana.tx->createBranch> ("ls_dAlphaInnerOuters"); - -#endif +#endif + ana.tx->createBranch>> ("ls_simIdxAll"); // list of idx of all matched (> 0%) simulated track ana.tx->createBranch>>("ls_simIdxAllFrac"); // list of idx of all matched (> 0%) simulated track diff --git a/efficiency/src/SDL.cc b/efficiency/src/SDL.cc index 488eea0f..6cc6d177 100644 --- a/efficiency/src/SDL.cc +++ b/efficiency/src/SDL.cc @@ -283,6 +283,20 @@ void SDL::Init(TTree *tree) { md_phi_branch = tree->GetBranch("md_phi"); if (md_phi_branch) { md_phi_branch->SetAddress(&md_phi_); } } + #ifdef OUTPUT_MD_CUTS + if (tree->GetBranch("md_dphi") != 0) { + md_dphi_branch = tree->GetBranch("md_dphi"); + if (md_dphi_branch) { md_dphi_branch->SetAddress(&md_dphi_); } + } + if (tree->GetBranch("md_dphichange") != 0) { + md_dphichange_branch = tree->GetBranch("md_dphichange"); + if (md_dphichange_branch) { md_dphichange_branch->SetAddress(&md_dphichange_); } + } + if (tree->GetBranch("md_dz") != 0) { + md_dz_branch = tree->GetBranch("md_dz"); + if (md_dz_branch) { md_dz_branch->SetAddress(&md_dz_); } + } + md_anchor_x_branch = 0; if (tree->GetBranch("md_anchor_x") != 0) { md_anchor_x_branch = tree->GetBranch("md_anchor_x"); @@ -383,6 +397,66 @@ void SDL::Init(TTree *tree) { ls_simIdx_branch = tree->GetBranch("ls_simIdx"); if (ls_simIdx_branch) { ls_simIdx_branch->SetAddress(&ls_simIdx_); } } + ls_zLos_branch = 0; + if (tree->GetBranch("ls_zLos") != 0) { + ls_zLos_branch = tree->GetBranch("ls_zLos"); + if (ls_zLos_branch) { ls_zLos_branch->SetAddress(&ls_zLos_); } + } + ls_zHis_branch = 0; + if (tree->GetBranch("ls_zHis") != 0) { + ls_zHis_branch = tree->GetBranch("ls_zHis"); + if (ls_zHis_branch) { ls_zHis_branch->SetAddress(&ls_zHis_); } + } + ls_rtLos_branch = 0; + if (tree->GetBranch("ls_rtLos") != 0) { + ls_rtLos_branch = tree->GetBranch("ls_rtLos"); + if (ls_rtLos_branch) { ls_rtLos_branch->SetAddress(&ls_rtLos_); } + } + ls_dPhis_branch = 0; + if (tree->GetBranch("ls_dPhis") != 0) { + ls_dPhis_branch = tree->GetBranch("ls_dPhis"); + if (ls_dPhis_branch) { ls_dPhis_branch->SetAddress(&ls_dPhis_); } + } + ls_dPhiMins_branch = 0; + if (tree->GetBranch("ls_dPhiMins") != 0) { + ls_dPhiMins_branch = tree->GetBranch("ls_dPhiMins"); + if (ls_dPhiMins_branch) { ls_dPhiMins_branch->SetAddress(&ls_dPhiMins_); } + } + ls_dPhiMaxs_branch = 0; + if (tree->GetBranch("ls_dPhiMaxs") != 0) { + ls_dPhiMaxs_branch = tree->GetBranch("ls_dPhiMaxs"); + if (ls_dPhiMaxs_branch) { ls_dPhiMaxs_branch->SetAddress(&ls_dPhiMaxs_); } + } + ls_dPhiChanges_branch = 0; + if (tree->GetBranch("ls_dPhiChanges") != 0) { + ls_dPhiChanges_branch = tree->GetBranch("ls_dPhiChanges"); + if (ls_dPhiChanges_branch) { ls_dPhiChanges_branch->SetAddress(&ls_dPhiChanges_); } + } + ls_dPhiChangeMins_branch = 0; + if (tree->GetBranch("ls_dPhiChangeMins") != 0) { + ls_dPhiChangeMins_branch = tree->GetBranch("ls_dPhiChangeMins"); + if (ls_dPhiChangeMins_branch) { ls_dPhiChangeMins_branch->SetAddress(&ls_dPhiChangeMins_); } + } + ls_dPhiChangeMaxs_branch = 0; + if (tree->GetBranch("ls_dPhiChangeMaxs") != 0) { + ls_dPhiChangeMaxs_branch = tree->GetBranch("ls_dPhiChangeMaxs"); + if (ls_dPhiChangeMaxs_branch) { ls_dPhiChangeMaxs_branch->SetAddress(&ls_dPhiChangeMaxs_); } + } + ls_dAlphaInners_branch = 0; + if (tree->GetBranch("ls_dAlphaInners") != 0) { + ls_dAlphaInners_branch = tree->GetBranch("ls_dAlphaInners"); + if (ls_dAlphaInners_branch) { ls_dAlphaInners_branch->SetAddress(&ls_dAlphaInners_); } + } + ls_dAlphaOuters_branch = 0; + if (tree->GetBranch("ls_dAlphaOuters") != 0) { + ls_dAlphaOuters_branch = tree->GetBranch("ls_dAlphaOuters"); + if (ls_dAlphaOuters_branch) { ls_dAlphaOuters_branch->SetAddress(&ls_dAlphaOuters_); } + } + ls_dAlphaInnerOuters_branch = 0; + if (tree->GetBranch("ls_dAlphaInnerOuters") != 0) { + ls_dAlphaInnerOuters_branch = tree->GetBranch("ls_dAlphaInnerOuters"); + if (ls_dAlphaInnerOuters_branch) { ls_dAlphaInnerOuters_branch->SetAddress(&ls_dAlphaInnerOuters_); } + } ls_simIdxAll_branch = 0; if (tree->GetBranch("ls_simIdxAll") != 0) { ls_simIdxAll_branch = tree->GetBranch("ls_simIdxAll"); From 5b3d3a25ffc950e3b38779f3babd6b03b4e8d93d Mon Sep 17 00:00:00 2001 From: hoobidoobidoo Date: Mon, 29 Jul 2024 08:13:17 -0400 Subject: [PATCH 3/5] SDL.cc finished updating --- efficiency/src/SDL.cc | 266 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 264 insertions(+), 2 deletions(-) diff --git a/efficiency/src/SDL.cc b/efficiency/src/SDL.cc index 6cc6d177..da50bcb5 100644 --- a/efficiency/src/SDL.cc +++ b/efficiency/src/SDL.cc @@ -283,19 +283,24 @@ void SDL::Init(TTree *tree) { md_phi_branch = tree->GetBranch("md_phi"); if (md_phi_branch) { md_phi_branch->SetAddress(&md_phi_); } } - #ifdef OUTPUT_MD_CUTS + +#ifdef OUTPUT_MD_CUTS + md_dphi_branch = 0; if (tree->GetBranch("md_dphi") != 0) { md_dphi_branch = tree->GetBranch("md_dphi"); if (md_dphi_branch) { md_dphi_branch->SetAddress(&md_dphi_); } } + md_dphichange_branch = 0; if (tree->GetBranch("md_dphichange") != 0) { md_dphichange_branch = tree->GetBranch("md_dphichange"); if (md_dphichange_branch) { md_dphichange_branch->SetAddress(&md_dphichange_); } } + md_dz_branch = 0; if (tree->GetBranch("md_dz") != 0) { md_dz_branch = tree->GetBranch("md_dz"); if (md_dz_branch) { md_dz_branch->SetAddress(&md_dz_); } } +#endif md_anchor_x_branch = 0; if (tree->GetBranch("md_anchor_x") != 0) { @@ -397,6 +402,8 @@ void SDL::Init(TTree *tree) { ls_simIdx_branch = tree->GetBranch("ls_simIdx"); if (ls_simIdx_branch) { ls_simIdx_branch->SetAddress(&ls_simIdx_); } } + +#ifdef OUTPUT_LS_CUTS ls_zLos_branch = 0; if (tree->GetBranch("ls_zLos") != 0) { ls_zLos_branch = tree->GetBranch("ls_zLos"); @@ -457,6 +464,8 @@ void SDL::Init(TTree *tree) { ls_dAlphaInnerOuters_branch = tree->GetBranch("ls_dAlphaInnerOuters"); if (ls_dAlphaInnerOuters_branch) { ls_dAlphaInnerOuters_branch->SetAddress(&ls_dAlphaInnerOuters_); } } +#endif + ls_simIdxAll_branch = 0; if (tree->GetBranch("ls_simIdxAll") != 0) { ls_simIdxAll_branch = tree->GetBranch("ls_simIdxAll"); @@ -832,6 +841,11 @@ void SDL::GetEntry(unsigned int idx) { md_pt_isLoaded = false; md_eta_isLoaded = false; md_phi_isLoaded = false; + #ifdef OUTPUT_MD_CUTS + md_dphi_isLoaded = false; + md_dphichange_isLoaded = false; + md_dz_isLoaded = false; + #endif md_anchor_x_isLoaded = false; md_anchor_y_isLoaded = false; md_anchor_z_isLoaded = false; @@ -851,7 +865,23 @@ void SDL::GetEntry(unsigned int idx) { ls_mdIdx0_isLoaded = false; ls_mdIdx1_isLoaded = false; ls_isFake_isLoaded = false; - ls_simIdx_isLoaded = false; + + #ifdef OUTPUT_LS_CUTS + ls_zLos_isLoaded = false; + ls_zHis_isLoaded = false; + ls_rtLos_isLoaded = false; + ls_rtHis_isLoaded = false; + ls_dPhis_isLoaded = false; + ls_dPhiMins_isLoaded = false; + ls_dPhiMaxs_isLoaded = false; + ls_dPhiChanges_isLoaded = false; + ls_dPhiChangeMins_isLoaded = false; + ls_dPhiChangeMaxs_isLoaded = false; + ls_dAlphaInners_isLoaded = false; + ls_dAlphaOuters_isLoaded = false; + ls_dAlphaInnerOuters_isLoaded = false; + #endif + ls_simIdxAll_isLoaded = false; ls_simIdxAllFrac_isLoaded = false; t3_pt_isLoaded = false; @@ -973,6 +1003,13 @@ void SDL::LoadAllBranches() { if (md_pt_branch != 0) md_pt(); if (md_eta_branch != 0) md_eta(); if (md_phi_branch != 0) md_phi(); + + #ifdef OUTPUT_MD_CUTS + if (md_dphi_branch !=0) md_dphi(); + if (md_dphichange_branch !=0) md_dphichange(); + if (md_dz_branch !=0) md_dz(); + #endif + if (md_anchor_x_branch != 0) md_anchor_x(); if (md_anchor_y_branch != 0) md_anchor_y(); if (md_anchor_z_branch != 0) md_anchor_z(); @@ -993,6 +1030,21 @@ void SDL::LoadAllBranches() { if (ls_mdIdx1_branch != 0) ls_mdIdx1(); if (ls_isFake_branch != 0) ls_isFake(); if (ls_simIdx_branch != 0) ls_simIdx(); + #ifdef OUTPUT_LS_CUTS + if (ls_zLos_branch != 0) ls_zLos(); + if (ls_zHis_branch != 0) ls_zHis(); + if (ls_rtLos_branch != 0) ls_rtLos(); + if (ls_rtHis_branch != 0) ls_rtHis(); + if (ls_dPhis_branch != 0) ls_dPhis(); + if (ls_dPhiMins_branch != 0) ls_dPhiMins(); + if (ls_dPhiMaxs_branch != 0) ls_dPhiMaxs(); + if (ls_dPhiChanges_branch != 0) ls_dPhiChanges(); + if (ls_dPhiChangeMins_branch != 0) ls_dPhiChangeMins(); + if (ls_dPhiChangeMaxs_branch != 0) ls_dPhiChangeMaxs(); + if (ls_dAlphaInners_branch != 0) ls_dAlphaInners(); + if (ls_dAlphaOuters_branch != 0) ls_dAlphaOuters(); + if (ls_dAlphaInnerOuters_branch != 0) ls_dAlphaInnerOuters(); + #endif if (ls_simIdxAll_branch != 0) ls_simIdxAll(); if (ls_simIdxAllFrac_branch != 0) ls_simIdxAllFrac(); if (t3_pt_branch != 0) t3_pt(); @@ -1729,6 +1781,48 @@ const vector &SDL::md_phi() { } return *md_phi_; } + +#ifdef OUTPUT_MD_CUTS +const vector &SDL::md_dphi() { + if (not md_dphi_isLoaded) { + if (md_dphi_branch != 0) { + md_dphi_branch->GetEntry(index); + } else { + printf("branch md_dphi_branch does not exist!\n"); + exit(1); + } + md_dphi_isLoaded = true; + } + return *md_dphichange_; +}const vector &SDL::md_dphichange() { + if (not md_dphichange_isLoaded) { + if (md_dphichange_branch != 0) { + md_dphichange_branch->GetEntry(index); + } else { + printf("branch md_dphichange_branch does not exist!\n"); + exit(1); + } + md_dphichange_isLoaded = true; + } + return *md_dz_; +}const vector &SDL::md_dz() { + if (not md_dz_isLoaded) { + if (md_dz_branch != 0) { + md_dz_branch->GetEntry(index); + } else { + printf("branch md_dz_branch does not exist!\n"); + exit(1); + } + md_dz_isLoaded = true; + } + return *md_dz_; +} + +#endif + + + + const vector &SDL::md_anchor_x() { if (not md_anchor_x_isLoaded) { if (md_anchor_x_branch != 0) { @@ -1969,6 +2063,154 @@ const vector &SDL::ls_simIdx() { } return *ls_simIdx_; } + +#ifdef OUTPUT_LS_CUTS +const vector &SDL::ls_zLos() { + if (not ls_zLos_isLoaded) { + if (ls_zLos_branch != 0) { + ls_zLos_branch->GetEntry(index); + } else { + printf("branch ls_zLos_branch does not exist!\n"); + exit(1); + } + ls_zLos_isLoaded = true; + } + return *ls_zLos_; +}const vector &SDL::ls_zHis() { + if (not ls_zHis_isLoaded) { + if (ls_zHis_branch != 0) { + ls_zHis_branch->GetEntry(index); + } else { + printf("branch ls_zHis_branch does not exist!\n"); + exit(1); + } + ls_zHis_isLoaded = true; + } + return *ls_zHis_; +}const vector &SDL::ls_rtLos() { + if (not ls_rtLos_isLoaded) { + if (ls_rtLos_branch != 0) { + ls_rtLos_branch->GetEntry(index); + } else { + printf("branch ls_rtLos_branch does not exist!\n"); + exit(1); + } + ls_rtLos_isLoaded = true; + } + return *ls_rtLos_; +}const vector &SDL::ls_rtHis() { + if (not ls_rtHis_isLoaded) { + if (ls_rtHis_branch != 0) { + ls_rtHis_branch->GetEntry(index); + } else { + printf("branch ls_rtHis_branch does not exist!\n"); + exit(1); + } + ls_rtHis_isLoaded = true; + } + return *ls_rtHis_; +}const vector &SDL::ls_dPhis() { + if (not ls_dPhis_isLoaded) { + if (ls_dPhis_branch != 0) { + ls_dPhis_branch->GetEntry(index); + } else { + printf("branch ls_dPhis_branch does not exist!\n"); + exit(1); + } + ls_dPhis_isLoaded = true; + } + return *ls_dPhis_; +}const vector &SDL::ls_dPhiMins() { + if (not ls_dPhiMins_isLoaded) { + if (ls_dPhiMins_branch != 0) { + ls_dPhiMins_branch->GetEntry(index); + } else { + printf("branch ls_dPhiMins_branch does not exist!\n"); + exit(1); + } + ls_dPhiMins_isLoaded = true; + } + return *ls_dPhiMins_; +}const vector &SDL::ls_dPhiMaxs() { + if (not ls_dPhiMaxs_isLoaded) { + if (ls_dPhiMaxs_branch != 0) { + ls_dPhiMaxs_branch->GetEntry(index); + } else { + printf("branch ls_dPhiMaxs_branch does not exist!\n"); + exit(1); + } + ls_dPhiMaxs_isLoaded = true; + } + return *ls_dPhiMaxs_; +}const vector &SDL::ls_dPhiChanges() { + if (not ls_dPhiChanges_isLoaded) { + if (ls_dPhiChanges_branch != 0) { + ls_dPhiChanges_branch->GetEntry(index); + } else { + printf("branch ls_dPhiChanges_branch does not exist!\n"); + exit(1); + } + ls_dPhiChanges_isLoaded = true; + } + return *ls_dPhiChanges_; +}const vector &SDL::ls_dPhiChangeMins() { + if (not ls_dPhiChangeMins_isLoaded) { + if (ls_dPhiChangeMins_branch != 0) { + ls_dPhiChangeMins_branch->GetEntry(index); + } else { + printf("branch ls_dPhiChangeMins_branch does not exist!\n"); + exit(1); + } + ls_dPhiChangeMins_isLoaded = true; + } + return *ls_dPhiChangeMins_; +}const vector &SDL::ls_dPhiChangeMaxs() { + if (not ls_dPhiChangeMaxs_isLoaded) { + if (ls_dPhiChangeMaxs_branch != 0) { + ls_dPhiChangeMaxs_branch->GetEntry(index); + } else { + printf("branch ls_dPhiChangeMaxs_branch does not exist!\n"); + exit(1); + } + ls_dPhiChangeMaxs_isLoaded = true; + } + return *ls_dPhiChangeMaxs_; +}const vector &SDL::ls_dAlphaInners() { + if (not ls_dAlphaInners_isLoaded) { + if (ls_dAlphaInners_branch != 0) { + ls_dAlphaInners_branch->GetEntry(index); + } else { + printf("branch ls_dAlphaInners_branch does not exist!\n"); + exit(1); + } + ls_dAlphaInners_isLoaded = true; + } + return *ls_dAlphaInners_; +}const vector &SDL::ls_dAlphaOuters() { + if (not ls_dAlphaOuters_isLoaded) { + if (ls_dAlphaOuters_branch != 0) { + ls_dAlphaOuters_branch->GetEntry(index); + } else { + printf("branch ls_dAlphaOuters_branch does not exist!\n"); + exit(1); + } + ls_dAlphaOuters_isLoaded = true; + } + return *ls_dAlphaOuters_; +}const vector &SDL::ls_dAlphaInnerOuters() { + if (not ls_dAlphaInnerOuters_isLoaded) { + if (ls_dAlphaInnerOuters_branch != 0) { + ls_dAlphaInnerOuters_branch->GetEntry(index); + } else { + printf("branch ls_dAlphaInnerOuters_branch does not exist!\n"); + exit(1); + } + ls_dAlphaInnerOuters_isLoaded = true; + } + return *ls_dAlphaInnerOuters_; +} +#endif + const vector > &SDL::ls_simIdxAll() { if (not ls_simIdxAll_isLoaded) { if (ls_simIdxAll_branch != 0) { @@ -2800,6 +3042,11 @@ namespace tas { const vector &md_pt() { return sdl.md_pt(); } const vector &md_eta() { return sdl.md_eta(); } const vector &md_phi() { return sdl.md_phi(); } + #ifdef OUTPUT_MD_CUTS + const vector &md_dphi() { return sdl.md_dphi(); } + const vector &md_dphichange() { return sdl.md_dphichange(); } + const vector &md_dz() { return sdl.md_dz(); } + #endif const vector &md_anchor_x() { return sdl.md_anchor_x(); } const vector &md_anchor_y() { return sdl.md_anchor_y(); } const vector &md_anchor_z() { return sdl.md_anchor_z(); } @@ -2820,6 +3067,21 @@ namespace tas { const vector &ls_mdIdx1() { return sdl.ls_mdIdx1(); } const vector &ls_isFake() { return sdl.ls_isFake(); } const vector &ls_simIdx() { return sdl.ls_simIdx(); } + #ifdef OUTPUT_LS_CUTS + const vector &ls_zLos() { return sdl.ls_zLos(); } + const vector &ls_zHis() { return sdl.ls_zHis(); } + const vector &ls_rtLos() { return sdl.ls_rtLos(); } + const vector &ls_rtHis() { return sdl.ls_rtHis(); } + const vector &ls_dPhis() { return sdl.ls_dPhis(); } + const vector &ls_dPhiMins() { return sdl.ls_dPhiMins(); } + const vector &ls_dPhiMaxs() { return sdl.ls_dPhiMaxs(); } + const vector &ls_dPhiChanges() { return sdl.ls_dPhiChanges(); } + const vector &ls_dPhiChangeMins() { return sdl.ls_dPhiChangeMins(); } + const vector &ls_dPhiChangeMaxs() { return sdl.ls_dPhiChangeMaxs(); } + const vector &ls_dAlphaInners() { return sdl.ls_dAlphaInners(); } + const vector &ls_dAlphaOuters() { return sdl.ls_dAlphaOuters(); } + const vector &ls_dAlphaInnerOuters() { return sdl.ls_dAlphaInnerOuters(); } + #endif const vector > &ls_simIdxAll() { return sdl.ls_simIdxAll(); } const vector > &ls_simIdxAllFrac() { return sdl.ls_simIdxAllFrac(); } const vector &t3_pt() { return sdl.t3_pt(); } From 32c4e373aa365166fdb94c3cc7b70b9fb48dcdca Mon Sep 17 00:00:00 2001 From: hoobidoobidoo Date: Mon, 29 Jul 2024 08:33:40 -0400 Subject: [PATCH 4/5] SDL.h changed --- efficiency/src/SDL.h | 108 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/efficiency/src/SDL.h b/efficiency/src/SDL.h index 2a6f5ed6..be0facac 100644 --- a/efficiency/src/SDL.h +++ b/efficiency/src/SDL.h @@ -188,6 +188,19 @@ class SDL { vector *md_phi_; TBranch *md_phi_branch; bool md_phi_isLoaded; + +#ifdef OUTPUT_MD_CUTS + vector *md_dphi_; + TBranch *md_dphi_branch; + bool md_dphi_isLoaded; + vector *md_dphichange_; + TBranch *md_dphichange_branch; + bool md_dphichange_isLoaded; + vector *md_dz_; + TBranch *md_dz_branch; + bool md_dz_isLoaded; +#endif + vector *md_anchor_x_; TBranch *md_anchor_x_branch; bool md_anchor_x_isLoaded; @@ -248,6 +261,51 @@ class SDL { vector *ls_simIdx_; TBranch *ls_simIdx_branch; bool ls_simIdx_isLoaded; + +#ifdef OUTPUT_LS_CUTS + vector *ls_zLos_; + TBranch *ls_zLos_branch; + bool ls_zLos_isLoaded; + vector *ls_zHis_; + TBranch *ls_zHis_branch; + bool ls_zHis_isLoaded; + vector *ls_rtLos_; + TBranch *ls_rtLos_branch; + bool ls_rtLos_isLoaded; + vector *ls_rtHis_; + TBranch *ls_rtHis_branch; + bool ls_rtHis_isLoaded; + vector *ls_dPhis_; + TBranch *ls_dPhis_branch; + bool ls_dPhis_isLoaded; + vector *ls_dPhiMins_; + TBranch *ls_dPhiMins_branch; + bool ls_dPhiMins_isLoaded; + vector *ls_dPhiMaxs_; + TBranch *ls_dPhiMaxs_branch; + bool ls_dPhiMaxs_isLoaded; + vector *ls_dPhiChanges_; + TBranch *ls_dPhiChanges_branch; + bool ls_dPhiChanges_isLoaded; + vector *ls_dPhiChangeMins_; + TBranch *ls_dPhiChangeMins_branch; + bool ls_dPhiChangeMins_isLoaded; + vector *ls_dPhiChangeMaxs_; + TBranch *ls_dPhiChangeMaxs_branch; + bool ls_dPhiChangeMaxs_isLoaded; + vector *ls_dAlphaInners_; + TBranch *ls_dAlphaInners_branch; + bool ls_dAlphaInners_isLoaded; + vector *ls_dAlphaOuters_; + TBranch *ls_dAlphaOuters_branch; + bool ls_dAlphaOuters_isLoaded; + vector *ls_dAlphaInnerOuters_; + TBranch *ls_dAlphaInnerOuters_branch; + bool ls_dAlphaInnerOuters_isLoaded; +#endif + + + vector > *ls_simIdxAll_; TBranch *ls_simIdxAll_branch; bool ls_simIdxAll_isLoaded; @@ -497,6 +555,13 @@ class SDL { const vector &md_pt(); const vector &md_eta(); const vector &md_phi(); + + #ifdef OUTPUT_MD_CUTS + const vector &md_dphi(); + const vector &md_dphichange(); + const vector &md_dz(); + #endif + const vector &md_anchor_x(); const vector &md_anchor_y(); const vector &md_anchor_z(); @@ -517,6 +582,25 @@ class SDL { const vector &ls_mdIdx1(); const vector &ls_isFake(); const vector &ls_simIdx(); + + #ifdef OUTPUT_LS_CUTS + const vector &ls_zLos(); + const vector &ls_zHis(); + const vector &ls_rtLos(); + const vector &ls_rtHis(); + const vector &ls_dPhis(); + const vector &ls_dPhiMins(); + const vector &ls_dPhiMaxs(); + const vector &ls_dPhiChanges(); + const vector &ls_dPhiChangeMins(); + const vector &ls_dPhiChangeMaxs(); + const vector &ls_dAlphaInners(); + const vector &ls_dAlphaOuters(); + const vector &ls_dAlphaInnerOuters(); + #endif + + + const vector > &ls_simIdxAll(); const vector > &ls_simIdxAllFrac(); const vector &t3_pt(); @@ -645,6 +729,14 @@ namespace tas { const vector &md_pt(); const vector &md_eta(); const vector &md_phi(); + + #ifdef OUTPUT_MD_CUTS + const vector &md_pt(); + const vector &md_eta(); + const vector &md_phi(); + #endif + + const vector &md_anchor_x(); const vector &md_anchor_y(); const vector &md_anchor_z(); @@ -665,6 +757,22 @@ namespace tas { const vector &ls_mdIdx1(); const vector &ls_isFake(); const vector &ls_simIdx(); + #ifdef OUTPUT_LS_CUTS + const vector &ls_zLos(); + const vector &ls_zHis(); + const vector &ls_rtLos(); + const vector &ls_rtHis(); + const vector &ls_dPhis(); + const vector &ls_dPhiMins(); + const vector &ls_dPhiMaxs(); + const vector &ls_dPhiChanges(); + const vector &ls_dPhiChangeMins(); + const vector &ls_dPhiChangeMaxs(); + const vector &ls_dAlphaInners(); + const vector &ls_dAlphaOuters(); + const vector &ls_dAlphaInnerOuters(); + #endif + const vector > &ls_simIdxAll(); const vector > &ls_simIdxAllFrac(); const vector &t3_pt(); From f46b6848d3306b73863cf4dff43d885132770202 Mon Sep 17 00:00:00 2001 From: hoobidoobidoo Date: Sat, 24 Aug 2024 11:32:20 -0400 Subject: [PATCH 5/5] Found write_sdl_ntuple mistake and more directives --- code/core/write_sdl_ntuple.cc | 2 +- efficiency/python/SDL.cc | 338 +++++++++++++++++++++++++++++++++- efficiency/python/SDL.h | 2 + efficiency/src/SDL.h | 2 + efficiency/src/performance.cc | 3 + 5 files changed, 345 insertions(+), 2 deletions(-) diff --git a/code/core/write_sdl_ntuple.cc b/code/core/write_sdl_ntuple.cc index 49275c60..c1a95483 100644 --- a/code/core/write_sdl_ntuple.cc +++ b/code/core/write_sdl_ntuple.cc @@ -2852,7 +2852,7 @@ void fillOutputBranches_v2(SDL::Event* event) // Fill some branches for this track candidate ana.tx->pushbackToBranch("tc_pt", pt); ana.tx->pushbackToBranch("tc_eta", eta); -https://uf.tfaforms.net/f/UFIC-ISS-Contact-Us ana.tx->pushbackToBranch("tc_phi", phi); + ana.tx->pushbackToBranch("tc_phi", phi); ana.tx->pushbackToBranch("tc_type", type); enum { diff --git a/efficiency/python/SDL.cc b/efficiency/python/SDL.cc index 488eea0f..da50bcb5 100644 --- a/efficiency/python/SDL.cc +++ b/efficiency/python/SDL.cc @@ -283,6 +283,25 @@ void SDL::Init(TTree *tree) { md_phi_branch = tree->GetBranch("md_phi"); if (md_phi_branch) { md_phi_branch->SetAddress(&md_phi_); } } + +#ifdef OUTPUT_MD_CUTS + md_dphi_branch = 0; + if (tree->GetBranch("md_dphi") != 0) { + md_dphi_branch = tree->GetBranch("md_dphi"); + if (md_dphi_branch) { md_dphi_branch->SetAddress(&md_dphi_); } + } + md_dphichange_branch = 0; + if (tree->GetBranch("md_dphichange") != 0) { + md_dphichange_branch = tree->GetBranch("md_dphichange"); + if (md_dphichange_branch) { md_dphichange_branch->SetAddress(&md_dphichange_); } + } + md_dz_branch = 0; + if (tree->GetBranch("md_dz") != 0) { + md_dz_branch = tree->GetBranch("md_dz"); + if (md_dz_branch) { md_dz_branch->SetAddress(&md_dz_); } + } +#endif + md_anchor_x_branch = 0; if (tree->GetBranch("md_anchor_x") != 0) { md_anchor_x_branch = tree->GetBranch("md_anchor_x"); @@ -383,6 +402,70 @@ void SDL::Init(TTree *tree) { ls_simIdx_branch = tree->GetBranch("ls_simIdx"); if (ls_simIdx_branch) { ls_simIdx_branch->SetAddress(&ls_simIdx_); } } + +#ifdef OUTPUT_LS_CUTS + ls_zLos_branch = 0; + if (tree->GetBranch("ls_zLos") != 0) { + ls_zLos_branch = tree->GetBranch("ls_zLos"); + if (ls_zLos_branch) { ls_zLos_branch->SetAddress(&ls_zLos_); } + } + ls_zHis_branch = 0; + if (tree->GetBranch("ls_zHis") != 0) { + ls_zHis_branch = tree->GetBranch("ls_zHis"); + if (ls_zHis_branch) { ls_zHis_branch->SetAddress(&ls_zHis_); } + } + ls_rtLos_branch = 0; + if (tree->GetBranch("ls_rtLos") != 0) { + ls_rtLos_branch = tree->GetBranch("ls_rtLos"); + if (ls_rtLos_branch) { ls_rtLos_branch->SetAddress(&ls_rtLos_); } + } + ls_dPhis_branch = 0; + if (tree->GetBranch("ls_dPhis") != 0) { + ls_dPhis_branch = tree->GetBranch("ls_dPhis"); + if (ls_dPhis_branch) { ls_dPhis_branch->SetAddress(&ls_dPhis_); } + } + ls_dPhiMins_branch = 0; + if (tree->GetBranch("ls_dPhiMins") != 0) { + ls_dPhiMins_branch = tree->GetBranch("ls_dPhiMins"); + if (ls_dPhiMins_branch) { ls_dPhiMins_branch->SetAddress(&ls_dPhiMins_); } + } + ls_dPhiMaxs_branch = 0; + if (tree->GetBranch("ls_dPhiMaxs") != 0) { + ls_dPhiMaxs_branch = tree->GetBranch("ls_dPhiMaxs"); + if (ls_dPhiMaxs_branch) { ls_dPhiMaxs_branch->SetAddress(&ls_dPhiMaxs_); } + } + ls_dPhiChanges_branch = 0; + if (tree->GetBranch("ls_dPhiChanges") != 0) { + ls_dPhiChanges_branch = tree->GetBranch("ls_dPhiChanges"); + if (ls_dPhiChanges_branch) { ls_dPhiChanges_branch->SetAddress(&ls_dPhiChanges_); } + } + ls_dPhiChangeMins_branch = 0; + if (tree->GetBranch("ls_dPhiChangeMins") != 0) { + ls_dPhiChangeMins_branch = tree->GetBranch("ls_dPhiChangeMins"); + if (ls_dPhiChangeMins_branch) { ls_dPhiChangeMins_branch->SetAddress(&ls_dPhiChangeMins_); } + } + ls_dPhiChangeMaxs_branch = 0; + if (tree->GetBranch("ls_dPhiChangeMaxs") != 0) { + ls_dPhiChangeMaxs_branch = tree->GetBranch("ls_dPhiChangeMaxs"); + if (ls_dPhiChangeMaxs_branch) { ls_dPhiChangeMaxs_branch->SetAddress(&ls_dPhiChangeMaxs_); } + } + ls_dAlphaInners_branch = 0; + if (tree->GetBranch("ls_dAlphaInners") != 0) { + ls_dAlphaInners_branch = tree->GetBranch("ls_dAlphaInners"); + if (ls_dAlphaInners_branch) { ls_dAlphaInners_branch->SetAddress(&ls_dAlphaInners_); } + } + ls_dAlphaOuters_branch = 0; + if (tree->GetBranch("ls_dAlphaOuters") != 0) { + ls_dAlphaOuters_branch = tree->GetBranch("ls_dAlphaOuters"); + if (ls_dAlphaOuters_branch) { ls_dAlphaOuters_branch->SetAddress(&ls_dAlphaOuters_); } + } + ls_dAlphaInnerOuters_branch = 0; + if (tree->GetBranch("ls_dAlphaInnerOuters") != 0) { + ls_dAlphaInnerOuters_branch = tree->GetBranch("ls_dAlphaInnerOuters"); + if (ls_dAlphaInnerOuters_branch) { ls_dAlphaInnerOuters_branch->SetAddress(&ls_dAlphaInnerOuters_); } + } +#endif + ls_simIdxAll_branch = 0; if (tree->GetBranch("ls_simIdxAll") != 0) { ls_simIdxAll_branch = tree->GetBranch("ls_simIdxAll"); @@ -758,6 +841,11 @@ void SDL::GetEntry(unsigned int idx) { md_pt_isLoaded = false; md_eta_isLoaded = false; md_phi_isLoaded = false; + #ifdef OUTPUT_MD_CUTS + md_dphi_isLoaded = false; + md_dphichange_isLoaded = false; + md_dz_isLoaded = false; + #endif md_anchor_x_isLoaded = false; md_anchor_y_isLoaded = false; md_anchor_z_isLoaded = false; @@ -777,7 +865,23 @@ void SDL::GetEntry(unsigned int idx) { ls_mdIdx0_isLoaded = false; ls_mdIdx1_isLoaded = false; ls_isFake_isLoaded = false; - ls_simIdx_isLoaded = false; + + #ifdef OUTPUT_LS_CUTS + ls_zLos_isLoaded = false; + ls_zHis_isLoaded = false; + ls_rtLos_isLoaded = false; + ls_rtHis_isLoaded = false; + ls_dPhis_isLoaded = false; + ls_dPhiMins_isLoaded = false; + ls_dPhiMaxs_isLoaded = false; + ls_dPhiChanges_isLoaded = false; + ls_dPhiChangeMins_isLoaded = false; + ls_dPhiChangeMaxs_isLoaded = false; + ls_dAlphaInners_isLoaded = false; + ls_dAlphaOuters_isLoaded = false; + ls_dAlphaInnerOuters_isLoaded = false; + #endif + ls_simIdxAll_isLoaded = false; ls_simIdxAllFrac_isLoaded = false; t3_pt_isLoaded = false; @@ -899,6 +1003,13 @@ void SDL::LoadAllBranches() { if (md_pt_branch != 0) md_pt(); if (md_eta_branch != 0) md_eta(); if (md_phi_branch != 0) md_phi(); + + #ifdef OUTPUT_MD_CUTS + if (md_dphi_branch !=0) md_dphi(); + if (md_dphichange_branch !=0) md_dphichange(); + if (md_dz_branch !=0) md_dz(); + #endif + if (md_anchor_x_branch != 0) md_anchor_x(); if (md_anchor_y_branch != 0) md_anchor_y(); if (md_anchor_z_branch != 0) md_anchor_z(); @@ -919,6 +1030,21 @@ void SDL::LoadAllBranches() { if (ls_mdIdx1_branch != 0) ls_mdIdx1(); if (ls_isFake_branch != 0) ls_isFake(); if (ls_simIdx_branch != 0) ls_simIdx(); + #ifdef OUTPUT_LS_CUTS + if (ls_zLos_branch != 0) ls_zLos(); + if (ls_zHis_branch != 0) ls_zHis(); + if (ls_rtLos_branch != 0) ls_rtLos(); + if (ls_rtHis_branch != 0) ls_rtHis(); + if (ls_dPhis_branch != 0) ls_dPhis(); + if (ls_dPhiMins_branch != 0) ls_dPhiMins(); + if (ls_dPhiMaxs_branch != 0) ls_dPhiMaxs(); + if (ls_dPhiChanges_branch != 0) ls_dPhiChanges(); + if (ls_dPhiChangeMins_branch != 0) ls_dPhiChangeMins(); + if (ls_dPhiChangeMaxs_branch != 0) ls_dPhiChangeMaxs(); + if (ls_dAlphaInners_branch != 0) ls_dAlphaInners(); + if (ls_dAlphaOuters_branch != 0) ls_dAlphaOuters(); + if (ls_dAlphaInnerOuters_branch != 0) ls_dAlphaInnerOuters(); + #endif if (ls_simIdxAll_branch != 0) ls_simIdxAll(); if (ls_simIdxAllFrac_branch != 0) ls_simIdxAllFrac(); if (t3_pt_branch != 0) t3_pt(); @@ -1655,6 +1781,48 @@ const vector &SDL::md_phi() { } return *md_phi_; } + +#ifdef OUTPUT_MD_CUTS +const vector &SDL::md_dphi() { + if (not md_dphi_isLoaded) { + if (md_dphi_branch != 0) { + md_dphi_branch->GetEntry(index); + } else { + printf("branch md_dphi_branch does not exist!\n"); + exit(1); + } + md_dphi_isLoaded = true; + } + return *md_dphichange_; +}const vector &SDL::md_dphichange() { + if (not md_dphichange_isLoaded) { + if (md_dphichange_branch != 0) { + md_dphichange_branch->GetEntry(index); + } else { + printf("branch md_dphichange_branch does not exist!\n"); + exit(1); + } + md_dphichange_isLoaded = true; + } + return *md_dz_; +}const vector &SDL::md_dz() { + if (not md_dz_isLoaded) { + if (md_dz_branch != 0) { + md_dz_branch->GetEntry(index); + } else { + printf("branch md_dz_branch does not exist!\n"); + exit(1); + } + md_dz_isLoaded = true; + } + return *md_dz_; +} + +#endif + + + + const vector &SDL::md_anchor_x() { if (not md_anchor_x_isLoaded) { if (md_anchor_x_branch != 0) { @@ -1895,6 +2063,154 @@ const vector &SDL::ls_simIdx() { } return *ls_simIdx_; } + +#ifdef OUTPUT_LS_CUTS +const vector &SDL::ls_zLos() { + if (not ls_zLos_isLoaded) { + if (ls_zLos_branch != 0) { + ls_zLos_branch->GetEntry(index); + } else { + printf("branch ls_zLos_branch does not exist!\n"); + exit(1); + } + ls_zLos_isLoaded = true; + } + return *ls_zLos_; +}const vector &SDL::ls_zHis() { + if (not ls_zHis_isLoaded) { + if (ls_zHis_branch != 0) { + ls_zHis_branch->GetEntry(index); + } else { + printf("branch ls_zHis_branch does not exist!\n"); + exit(1); + } + ls_zHis_isLoaded = true; + } + return *ls_zHis_; +}const vector &SDL::ls_rtLos() { + if (not ls_rtLos_isLoaded) { + if (ls_rtLos_branch != 0) { + ls_rtLos_branch->GetEntry(index); + } else { + printf("branch ls_rtLos_branch does not exist!\n"); + exit(1); + } + ls_rtLos_isLoaded = true; + } + return *ls_rtLos_; +}const vector &SDL::ls_rtHis() { + if (not ls_rtHis_isLoaded) { + if (ls_rtHis_branch != 0) { + ls_rtHis_branch->GetEntry(index); + } else { + printf("branch ls_rtHis_branch does not exist!\n"); + exit(1); + } + ls_rtHis_isLoaded = true; + } + return *ls_rtHis_; +}const vector &SDL::ls_dPhis() { + if (not ls_dPhis_isLoaded) { + if (ls_dPhis_branch != 0) { + ls_dPhis_branch->GetEntry(index); + } else { + printf("branch ls_dPhis_branch does not exist!\n"); + exit(1); + } + ls_dPhis_isLoaded = true; + } + return *ls_dPhis_; +}const vector &SDL::ls_dPhiMins() { + if (not ls_dPhiMins_isLoaded) { + if (ls_dPhiMins_branch != 0) { + ls_dPhiMins_branch->GetEntry(index); + } else { + printf("branch ls_dPhiMins_branch does not exist!\n"); + exit(1); + } + ls_dPhiMins_isLoaded = true; + } + return *ls_dPhiMins_; +}const vector &SDL::ls_dPhiMaxs() { + if (not ls_dPhiMaxs_isLoaded) { + if (ls_dPhiMaxs_branch != 0) { + ls_dPhiMaxs_branch->GetEntry(index); + } else { + printf("branch ls_dPhiMaxs_branch does not exist!\n"); + exit(1); + } + ls_dPhiMaxs_isLoaded = true; + } + return *ls_dPhiMaxs_; +}const vector &SDL::ls_dPhiChanges() { + if (not ls_dPhiChanges_isLoaded) { + if (ls_dPhiChanges_branch != 0) { + ls_dPhiChanges_branch->GetEntry(index); + } else { + printf("branch ls_dPhiChanges_branch does not exist!\n"); + exit(1); + } + ls_dPhiChanges_isLoaded = true; + } + return *ls_dPhiChanges_; +}const vector &SDL::ls_dPhiChangeMins() { + if (not ls_dPhiChangeMins_isLoaded) { + if (ls_dPhiChangeMins_branch != 0) { + ls_dPhiChangeMins_branch->GetEntry(index); + } else { + printf("branch ls_dPhiChangeMins_branch does not exist!\n"); + exit(1); + } + ls_dPhiChangeMins_isLoaded = true; + } + return *ls_dPhiChangeMins_; +}const vector &SDL::ls_dPhiChangeMaxs() { + if (not ls_dPhiChangeMaxs_isLoaded) { + if (ls_dPhiChangeMaxs_branch != 0) { + ls_dPhiChangeMaxs_branch->GetEntry(index); + } else { + printf("branch ls_dPhiChangeMaxs_branch does not exist!\n"); + exit(1); + } + ls_dPhiChangeMaxs_isLoaded = true; + } + return *ls_dPhiChangeMaxs_; +}const vector &SDL::ls_dAlphaInners() { + if (not ls_dAlphaInners_isLoaded) { + if (ls_dAlphaInners_branch != 0) { + ls_dAlphaInners_branch->GetEntry(index); + } else { + printf("branch ls_dAlphaInners_branch does not exist!\n"); + exit(1); + } + ls_dAlphaInners_isLoaded = true; + } + return *ls_dAlphaInners_; +}const vector &SDL::ls_dAlphaOuters() { + if (not ls_dAlphaOuters_isLoaded) { + if (ls_dAlphaOuters_branch != 0) { + ls_dAlphaOuters_branch->GetEntry(index); + } else { + printf("branch ls_dAlphaOuters_branch does not exist!\n"); + exit(1); + } + ls_dAlphaOuters_isLoaded = true; + } + return *ls_dAlphaOuters_; +}const vector &SDL::ls_dAlphaInnerOuters() { + if (not ls_dAlphaInnerOuters_isLoaded) { + if (ls_dAlphaInnerOuters_branch != 0) { + ls_dAlphaInnerOuters_branch->GetEntry(index); + } else { + printf("branch ls_dAlphaInnerOuters_branch does not exist!\n"); + exit(1); + } + ls_dAlphaInnerOuters_isLoaded = true; + } + return *ls_dAlphaInnerOuters_; +} +#endif + const vector > &SDL::ls_simIdxAll() { if (not ls_simIdxAll_isLoaded) { if (ls_simIdxAll_branch != 0) { @@ -2726,6 +3042,11 @@ namespace tas { const vector &md_pt() { return sdl.md_pt(); } const vector &md_eta() { return sdl.md_eta(); } const vector &md_phi() { return sdl.md_phi(); } + #ifdef OUTPUT_MD_CUTS + const vector &md_dphi() { return sdl.md_dphi(); } + const vector &md_dphichange() { return sdl.md_dphichange(); } + const vector &md_dz() { return sdl.md_dz(); } + #endif const vector &md_anchor_x() { return sdl.md_anchor_x(); } const vector &md_anchor_y() { return sdl.md_anchor_y(); } const vector &md_anchor_z() { return sdl.md_anchor_z(); } @@ -2746,6 +3067,21 @@ namespace tas { const vector &ls_mdIdx1() { return sdl.ls_mdIdx1(); } const vector &ls_isFake() { return sdl.ls_isFake(); } const vector &ls_simIdx() { return sdl.ls_simIdx(); } + #ifdef OUTPUT_LS_CUTS + const vector &ls_zLos() { return sdl.ls_zLos(); } + const vector &ls_zHis() { return sdl.ls_zHis(); } + const vector &ls_rtLos() { return sdl.ls_rtLos(); } + const vector &ls_rtHis() { return sdl.ls_rtHis(); } + const vector &ls_dPhis() { return sdl.ls_dPhis(); } + const vector &ls_dPhiMins() { return sdl.ls_dPhiMins(); } + const vector &ls_dPhiMaxs() { return sdl.ls_dPhiMaxs(); } + const vector &ls_dPhiChanges() { return sdl.ls_dPhiChanges(); } + const vector &ls_dPhiChangeMins() { return sdl.ls_dPhiChangeMins(); } + const vector &ls_dPhiChangeMaxs() { return sdl.ls_dPhiChangeMaxs(); } + const vector &ls_dAlphaInners() { return sdl.ls_dAlphaInners(); } + const vector &ls_dAlphaOuters() { return sdl.ls_dAlphaOuters(); } + const vector &ls_dAlphaInnerOuters() { return sdl.ls_dAlphaInnerOuters(); } + #endif const vector > &ls_simIdxAll() { return sdl.ls_simIdxAll(); } const vector > &ls_simIdxAllFrac() { return sdl.ls_simIdxAllFrac(); } const vector &t3_pt() { return sdl.t3_pt(); } diff --git a/efficiency/python/SDL.h b/efficiency/python/SDL.h index 2a6f5ed6..e8bfcb55 100644 --- a/efficiency/python/SDL.h +++ b/efficiency/python/SDL.h @@ -1,6 +1,8 @@ // -*- C++ -*- #ifndef SDL_H #define SDL_H +#define OUTPUT_LS_CUTS +#define OUTPUT_MD_CUTS #include "Math/LorentzVector.h" #include "Math/Point3D.h" #include "TMath.h" diff --git a/efficiency/src/SDL.h b/efficiency/src/SDL.h index be0facac..9c7c6bb0 100644 --- a/efficiency/src/SDL.h +++ b/efficiency/src/SDL.h @@ -1,6 +1,8 @@ // -*- C++ -*- #ifndef SDL_H #define SDL_H +#define OUTPUT_LS_CUTS +#define OUTPUT_MD_CUTS #include "Math/LorentzVector.h" #include "Math/Point3D.h" #include "TMath.h" diff --git a/efficiency/src/performance.cc b/efficiency/src/performance.cc index 91750b11..78e71fe6 100644 --- a/efficiency/src/performance.cc +++ b/efficiency/src/performance.cc @@ -718,7 +718,9 @@ void fillFakeRateSets(std::vector& FRsets) { for (unsigned int itc = 0; itc < FRset.pt().size(); ++itc) { + fillFakeRateSet(itc, FRset); + } } } @@ -726,6 +728,7 @@ void fillFakeRateSets(std::vector& FRsets) //__________________________________________________________________________________________________________________________________________________________________________ void fillFakeRateSet(int itc, RecoTrackSetDefinition& FRset) { + std::cout << "pt variable size" << FRset.pt().size() << std::endl; float pt = FRset.pt().at(itc); float eta = FRset.eta().at(itc); float phi = FRset.phi().at(itc);