From 3164f716c21d1cb80d6ebcd868eb20f625fad6a9 Mon Sep 17 00:00:00 2001 From: YonsiG Date: Tue, 21 May 2024 09:20:52 -0700 Subject: [PATCH 1/5] fit pT5 cut bug --- SDL/PixelTriplet.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SDL/PixelTriplet.h b/SDL/PixelTriplet.h index bd048f9c..9dfa219c 100644 --- a/SDL/PixelTriplet.h +++ b/SDL/PixelTriplet.h @@ -2559,7 +2559,12 @@ namespace SDL { rzChiSquared = computePT5RZChiSquared(acc, modulesInGPU, lowerModuleIndices, rtPix, zPix, rts, zs); - if (/*pixelRadius*/ 0 < 5.0f * kR1GeVf) { // FIXME: pixelRadius is not defined yet + //get the appropriate radii and centers + centerX = segmentsInGPU.circleCenterX[pixelSegmentArrayIndex]; + centerY = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; + pixelRadius = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; + + if (pixelRadius < 5.0f * kR1GeVf) { // FIXME: pixelRadius is not defined yet pass = pass and passPT5RZChiSquaredCuts(modulesInGPU, lowerModuleIndex1, lowerModuleIndex2, @@ -2583,11 +2588,6 @@ namespace SDL { mdsInGPU.anchorY[fourthMDIndex], mdsInGPU.anchorY[fifthMDIndex]}; - //get the appropriate radii and centers - centerX = segmentsInGPU.circleCenterX[pixelSegmentArrayIndex]; - centerY = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; - pixelRadius = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; - float T5CenterX = quintupletsInGPU.regressionG[quintupletIndex]; float T5CenterY = quintupletsInGPU.regressionF[quintupletIndex]; quintupletRadius = quintupletsInGPU.regressionRadius[quintupletIndex]; From f73eef7d0b558d8d4a51df80bd5cc7f40abafeb4 Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Tue, 21 May 2024 12:48:03 -0400 Subject: [PATCH 2/5] add occ branches back --- code/core/write_sdl_ntuple.cc | 87 +++++++++++++++++++++++++++++++++++ code/core/write_sdl_ntuple.h | 1 + 2 files changed, 88 insertions(+) diff --git a/code/core/write_sdl_ntuple.cc b/code/core/write_sdl_ntuple.cc index 327a5995..bc343a4c 100644 --- a/code/core/write_sdl_ntuple.cc +++ b/code/core/write_sdl_ntuple.cc @@ -136,6 +136,23 @@ void createOptionalOutputBranches() ana.tx->createBranch>("t5_rzChiSquared"); ana.tx->createBranch>("t5_nonAnchorChiSquared"); + // Occupancy branches + ana.tx->createBranch>("module_layers"); + ana.tx->createBranch>("module_subdets"); + ana.tx->createBranch>("module_rings"); + ana.tx->createBranch>("module_rods"); + ana.tx->createBranch>("module_modules"); + ana.tx->createBranch>("module_isTilted"); + ana.tx->createBranch>("module_eta"); + ana.tx->createBranch>("module_r"); + ana.tx->createBranch>("md_occupancies"); + ana.tx->createBranch>("sg_occupancies"); + ana.tx->createBranch>("t3_occupancies"); + ana.tx->createBranch("tc_occupancies"); + ana.tx->createBranch>("t5_occupancies"); + ana.tx->createBranch("pT3_occupancies"); + ana.tx->createBranch("pT5_occupancies"); + #endif } @@ -297,10 +314,80 @@ void setOptionalOutputBranches(SDL::Event* event) setPixelQuintupletOutputBranches(event); setQuintupletOutputBranches(event); setPixelTripletOutputBranches(event); + setOccupancyBranches(event); #endif } +//________________________________________________________________________________________________________________________________ +void setOccupancyBranches(SDL::Event* event) +{ + SDL::trackCandidates& trackCandidatesInGPU = (*event->getTrackCandidates()); + SDL::triplets& tripletsInGPU = (*event->getTriplets()); + SDL::segments& segmentsInGPU = (*event->getSegments()); + SDL::miniDoublets& mdsInGPU = (*event->getMiniDoublets()); + //SDL::hits& hitsInGPU = (*event->getHits()); + SDL::modules& modulesInGPU = (*event->getModules()); + SDL::quintuplets& quintupletsInGPU = (*event->getQuintuplets()); + SDL::pixelQuintuplets& pixelQuintupletsInGPU = (*event->getPixelQuintuplets()); + SDL::pixelTriplets& pixelTripletsInGPU = (*event->getPixelTriplets()); + //get the occupancies from these dudes + std::vector moduleLayer; + std::vector moduleSubdet; + std::vector moduleRing; + std::vector moduleRod; + std::vector moduleModule; + std::vector moduleEta; + std::vector moduleR; + std::vector moduleIsTilted; + std::vector trackCandidateOccupancy; + std::vector tripletOccupancy; + std::vector segmentOccupancy; + std::vector mdOccupancy; + std::vector quintupletOccupancy; + + bool isTilted; + + for(unsigned int idx = 0; idx <= *(modulesInGPU.nLowerModules); idx++) + { + //layer = 0, subdet = 0 => pixel module + //module, md and segment - need some gymnastics + unsigned int lowerIdx = idx;//modulesInGPU.lowerModuleIndices[idx]; + moduleLayer.push_back(modulesInGPU.layers[lowerIdx]); + moduleSubdet.push_back(modulesInGPU.subdets[lowerIdx]); + moduleRing.push_back(modulesInGPU.rings[lowerIdx]); + moduleRod.push_back(modulesInGPU.rods[lowerIdx]); + moduleEta.push_back(modulesInGPU.eta[lowerIdx]); + moduleR.push_back(modulesInGPU.r[lowerIdx]); + isTilted = (modulesInGPU.subdets[lowerIdx] == 5 and modulesInGPU.sides[lowerIdx] != 3); + moduleIsTilted.push_back(isTilted); + moduleModule.push_back(modulesInGPU.modules[lowerIdx]); + segmentOccupancy.push_back(segmentsInGPU.totOccupancySegments[lowerIdx]); + mdOccupancy.push_back(mdsInGPU.totOccupancyMDs[lowerIdx]); + + if(idx < *(modulesInGPU.nLowerModules)) + { + quintupletOccupancy.push_back(quintupletsInGPU.totOccupancyQuintuplets[idx]); + tripletOccupancy.push_back(tripletsInGPU.totOccupancyTriplets[idx]); + } + } + ana.tx->setBranch>("module_layers",moduleLayer); + ana.tx->setBranch>("module_subdets",moduleSubdet); + ana.tx->setBranch>("module_rings",moduleRing); + ana.tx->setBranch>("module_rods",moduleRod); + ana.tx->setBranch>("module_modules",moduleModule); + ana.tx->setBranch>("module_isTilted",moduleIsTilted); + ana.tx->setBranch>("module_eta",moduleEta); + ana.tx->setBranch>("module_r",moduleR); + ana.tx->setBranch>("md_occupancies",mdOccupancy); + ana.tx->setBranch>("sg_occupancies",segmentOccupancy); + ana.tx->setBranch>("t3_occupancies",tripletOccupancy); + ana.tx->setBranch("tc_occupancies",*(trackCandidatesInGPU.nTrackCandidates)); + ana.tx->setBranch("pT3_occupancies", *(pixelTripletsInGPU.totOccupancyPixelTriplets)); + ana.tx->setBranch>("t5_occupancies", quintupletOccupancy); + ana.tx->setBranch("pT5_occupancies", *(pixelQuintupletsInGPU.totOccupancyPixelQuintuplets)); +} + //________________________________________________________________________________________________________________________________ void setPixelQuintupletOutputBranches(SDL::Event* event) { diff --git a/code/core/write_sdl_ntuple.h b/code/core/write_sdl_ntuple.h index 8a3a4207..5b77e1b4 100644 --- a/code/core/write_sdl_ntuple.h +++ b/code/core/write_sdl_ntuple.h @@ -20,6 +20,7 @@ void createGnnNtupleBranches(); void fillOutputBranches(SDL::Event* event); void setOutputBranches(SDL::Event* event); void setOptionalOutputBranches(SDL::Event* event); +void setOccupancyBranches(SDL::Event* event); void setPixelQuintupletOutputBranches(SDL::Event* event); void setQuintupletOutputBranches(SDL::Event* event); void setPixelTripletOutputBranches(SDL::Event *event); From 7749db72290cbf6bcc0fcb0b620e71cc90da5b78 Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Tue, 21 May 2024 15:49:53 -0400 Subject: [PATCH 3/5] small cleanup --- code/core/write_sdl_ntuple.cc | 52 +++++++++++++++-------------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/code/core/write_sdl_ntuple.cc b/code/core/write_sdl_ntuple.cc index bc343a4c..a2739a34 100644 --- a/code/core/write_sdl_ntuple.cc +++ b/code/core/write_sdl_ntuple.cc @@ -322,16 +322,15 @@ void setOptionalOutputBranches(SDL::Event* event) //________________________________________________________________________________________________________________________________ void setOccupancyBranches(SDL::Event* event) { - SDL::trackCandidates& trackCandidatesInGPU = (*event->getTrackCandidates()); - SDL::triplets& tripletsInGPU = (*event->getTriplets()); - SDL::segments& segmentsInGPU = (*event->getSegments()); - SDL::miniDoublets& mdsInGPU = (*event->getMiniDoublets()); - //SDL::hits& hitsInGPU = (*event->getHits()); SDL::modules& modulesInGPU = (*event->getModules()); + SDL::miniDoublets& mdsInGPU = (*event->getMiniDoublets()); + SDL::segments& segmentsInGPU = (*event->getSegments()); + SDL::triplets& tripletsInGPU = (*event->getTriplets()); SDL::quintuplets& quintupletsInGPU = (*event->getQuintuplets()); SDL::pixelQuintuplets& pixelQuintupletsInGPU = (*event->getPixelQuintuplets()); SDL::pixelTriplets& pixelTripletsInGPU = (*event->getPixelTriplets()); - //get the occupancies from these dudes + SDL::trackCandidates& trackCandidatesInGPU = (*event->getTrackCandidates()); + std::vector moduleLayer; std::vector moduleSubdet; std::vector moduleRing; @@ -346,43 +345,36 @@ void setOccupancyBranches(SDL::Event* event) std::vector mdOccupancy; std::vector quintupletOccupancy; - bool isTilted; - - for(unsigned int idx = 0; idx <= *(modulesInGPU.nLowerModules); idx++) + for(unsigned int lowerIdx = 0; lowerIdx <= *(modulesInGPU.nLowerModules); lowerIdx++) { //layer = 0, subdet = 0 => pixel module - //module, md and segment - need some gymnastics - unsigned int lowerIdx = idx;//modulesInGPU.lowerModuleIndices[idx]; moduleLayer.push_back(modulesInGPU.layers[lowerIdx]); moduleSubdet.push_back(modulesInGPU.subdets[lowerIdx]); moduleRing.push_back(modulesInGPU.rings[lowerIdx]); moduleRod.push_back(modulesInGPU.rods[lowerIdx]); moduleEta.push_back(modulesInGPU.eta[lowerIdx]); moduleR.push_back(modulesInGPU.r[lowerIdx]); - isTilted = (modulesInGPU.subdets[lowerIdx] == 5 and modulesInGPU.sides[lowerIdx] != 3); + bool isTilted = (modulesInGPU.subdets[lowerIdx] == 5 and modulesInGPU.sides[lowerIdx] != 3); moduleIsTilted.push_back(isTilted); moduleModule.push_back(modulesInGPU.modules[lowerIdx]); segmentOccupancy.push_back(segmentsInGPU.totOccupancySegments[lowerIdx]); mdOccupancy.push_back(mdsInGPU.totOccupancyMDs[lowerIdx]); - - if(idx < *(modulesInGPU.nLowerModules)) - { - quintupletOccupancy.push_back(quintupletsInGPU.totOccupancyQuintuplets[idx]); - tripletOccupancy.push_back(tripletsInGPU.totOccupancyTriplets[idx]); - } + quintupletOccupancy.push_back(quintupletsInGPU.totOccupancyQuintuplets[lowerIdx]); + tripletOccupancy.push_back(tripletsInGPU.totOccupancyTriplets[lowerIdx]); } - ana.tx->setBranch>("module_layers",moduleLayer); - ana.tx->setBranch>("module_subdets",moduleSubdet); - ana.tx->setBranch>("module_rings",moduleRing); - ana.tx->setBranch>("module_rods",moduleRod); - ana.tx->setBranch>("module_modules",moduleModule); - ana.tx->setBranch>("module_isTilted",moduleIsTilted); - ana.tx->setBranch>("module_eta",moduleEta); - ana.tx->setBranch>("module_r",moduleR); - ana.tx->setBranch>("md_occupancies",mdOccupancy); - ana.tx->setBranch>("sg_occupancies",segmentOccupancy); - ana.tx->setBranch>("t3_occupancies",tripletOccupancy); - ana.tx->setBranch("tc_occupancies",*(trackCandidatesInGPU.nTrackCandidates)); + + ana.tx->setBranch>("module_layers", moduleLayer); + ana.tx->setBranch>("module_subdets", moduleSubdet); + ana.tx->setBranch>("module_rings", moduleRing); + ana.tx->setBranch>("module_rods", moduleRod); + ana.tx->setBranch>("module_modules", moduleModule); + ana.tx->setBranch>("module_isTilted", moduleIsTilted); + ana.tx->setBranch>("module_eta", moduleEta); + ana.tx->setBranch>("module_r", moduleR); + ana.tx->setBranch>("md_occupancies", mdOccupancy); + ana.tx->setBranch>("sg_occupancies", segmentOccupancy); + ana.tx->setBranch>("t3_occupancies", tripletOccupancy); + ana.tx->setBranch("tc_occupancies", *(trackCandidatesInGPU.nTrackCandidates)); ana.tx->setBranch("pT3_occupancies", *(pixelTripletsInGPU.totOccupancyPixelTriplets)); ana.tx->setBranch>("t5_occupancies", quintupletOccupancy); ana.tx->setBranch("pT5_occupancies", *(pixelQuintupletsInGPU.totOccupancyPixelQuintuplets)); From f2dfe2175b0bca5bd24a4b33840933f3b8611537 Mon Sep 17 00:00:00 2001 From: YonsiG Date: Wed, 22 May 2024 07:37:23 -0700 Subject: [PATCH 4/5] only calculate r-z chi2 for <5GeV tracks --- SDL/PixelTriplet.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SDL/PixelTriplet.h b/SDL/PixelTriplet.h index 9dfa219c..99162649 100644 --- a/SDL/PixelTriplet.h +++ b/SDL/PixelTriplet.h @@ -2557,14 +2557,15 @@ namespace SDL { mdsInGPU.anchorRt[fourthMDIndex], mdsInGPU.anchorRt[fifthMDIndex]}; - rzChiSquared = computePT5RZChiSquared(acc, modulesInGPU, lowerModuleIndices, rtPix, zPix, rts, zs); + rzChiSquared = 0; //get the appropriate radii and centers centerX = segmentsInGPU.circleCenterX[pixelSegmentArrayIndex]; centerY = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; pixelRadius = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; - if (pixelRadius < 5.0f * kR1GeVf) { // FIXME: pixelRadius is not defined yet + if (pixelRadius < 5.0f * kR1GeVf) { //only apply r-z chi2 cuts for <5GeV tracks + rzChiSquared = computePT5RZChiSquared(acc, modulesInGPU, lowerModuleIndices, rtPix, zPix, rts, zs); pass = pass and passPT5RZChiSquaredCuts(modulesInGPU, lowerModuleIndex1, lowerModuleIndex2, From 5794ed10a133345cdfaadc5008bb973644b66993 Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Tue, 28 May 2024 17:00:56 -0400 Subject: [PATCH 5/5] add if statement back, fixed --- code/core/write_sdl_ntuple.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/core/write_sdl_ntuple.cc b/code/core/write_sdl_ntuple.cc index a2739a34..4a135dc7 100644 --- a/code/core/write_sdl_ntuple.cc +++ b/code/core/write_sdl_ntuple.cc @@ -359,8 +359,12 @@ void setOccupancyBranches(SDL::Event* event) moduleModule.push_back(modulesInGPU.modules[lowerIdx]); segmentOccupancy.push_back(segmentsInGPU.totOccupancySegments[lowerIdx]); mdOccupancy.push_back(mdsInGPU.totOccupancyMDs[lowerIdx]); - quintupletOccupancy.push_back(quintupletsInGPU.totOccupancyQuintuplets[lowerIdx]); - tripletOccupancy.push_back(tripletsInGPU.totOccupancyTriplets[lowerIdx]); + + if(lowerIdx < *(modulesInGPU.nLowerModules)) + { + quintupletOccupancy.push_back(quintupletsInGPU.totOccupancyQuintuplets[lowerIdx]); + tripletOccupancy.push_back(tripletsInGPU.totOccupancyTriplets[lowerIdx]); + } } ana.tx->setBranch>("module_layers", moduleLayer);