Skip to content

Commit f2495d3

Browse files
authored
Merge pull request #48399 from CMSTrackerDPG/updated_cpe_algo_tpl_150X
[15.0.X] Adapt template pixel cpe algo to better handle shortened or broken clusters
2 parents c529340 + 8c368df commit f2495d3

File tree

13 files changed

+207
-21
lines changed

13 files changed

+207
-21
lines changed

CondFormats/SiPixelTransient/interface/SiPixelTemplate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,9 @@ class SiPixelTemplate {
285285
// initialize the rest;
286286
static void postInit(std::vector<SiPixelTemplateStore>& thePixelTemp_);
287287

288+
// Interpolate with y Gaussian Parameter interpolation to be used with goodEdge reconstruction algorithm
288289
// Interpolate input alpha and beta angles to produce a working template for each individual hit.
289-
bool interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx);
290+
bool interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx, bool goodEdgeAlgo = false);
290291

291292
// Interpolate input alpha and beta angles to produce a working template for each individual hit.
292293
bool interpolate(int id, float cotalpha, float cotbeta, float locBz);

CondFormats/SiPixelTransient/src/SiPixelTemplate.cc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
// V10.21 - Address runtime issues in pushfile() for gcc 7.X due to using tempfile as char string + misc. cleanup [Petar]
8383
// V10.22 - Move templateStore to the heap, fix variable name in pushfile() [Petar]
8484
// V10.24 - Add sideload() + associated gymnastics [Petar and Oz]
85+
// V10.25 - Restore y-residual Gaussian parameters [Morris]
8586

8687
// Created by Morris Swartz on 10/27/06.
8788
//
@@ -1324,15 +1325,18 @@ void SiPixelTemplate::postInit(std::vector<SiPixelTemplateStore>& thePixelTemp_)
13241325
//! \param locBx - (input) the sign of this quantity is used to determine whether to flip cot(alpha/beta)<0 quantities from cot(alpha/beta)>0 (FPix only)
13251326
//! for Phase 1 FPix IP-related tracks, locBx/locBz > 0 for cot(alpha) > 0 and locBx/locBz < 0 for cot(alpha) < 0
13261327
//! for Phase 1 FPix IP-related tracks, locBx > 0 for cot(beta) > 0 and locBx < 0 for cot(beta) < 0
1328+
//! \param goodEdgeAlgo - (input) Flag to turn on the y Gaussian Parameter interpolation to be used with goodEdge reconstruction algorithm
13271329
// ************************************************************************************************************
1328-
bool SiPixelTemplate::interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx) {
1330+
bool SiPixelTemplate::interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx, bool goodEdgeAlgo) {
13291331
// Interpolate for a new set of track angles
13301332

1333+
#ifndef SI_PIXEL_TEMPLATE_STANDALONE
13311334
//check for nan's
13321335
if (!edm::isFinite(cotalpha) || !edm::isFinite(cotbeta)) {
13331336
success_ = false;
13341337
return success_;
13351338
}
1339+
#endif
13361340

13371341
// Local variables
13381342
int i, j;
@@ -1553,16 +1557,19 @@ bool SiPixelTemplate::interpolate(int id, float cotalpha, float cotbeta, float l
15531557
}
15541558

15551559
for (i = 0; i < 4; ++i) {
1556-
yavg_[i] = (1.f - yratio_) * thePixelTemp_[index_id_].enty[ilow].yavg[i] +
1557-
yratio_ * thePixelTemp_[index_id_].enty[ihigh].yavg[i];
1558-
if (flip_y_) {
1559-
yavg_[i] = -yavg_[i];
1560-
}
15611560
yavg_[i] = (1.f - yratio_) * enty0_->yavg[i] + yratio_ * enty1_->yavg[i];
15621561
if (flip_y_) {
15631562
yavg_[i] = -yavg_[i];
15641563
}
15651564
yrms_[i] = (1.f - yratio_) * enty0_->yrms[i] + yratio_ * enty1_->yrms[i];
1565+
1566+
if (goodEdgeAlgo) { // restore y Gaussian Parameter interpolation
1567+
ygx0_[i] = (1.f - yratio_) * enty0_->ygx0[i] + yratio_ * enty1_->ygx0[i];
1568+
if (flip_y_) {
1569+
ygx0_[i] = -ygx0_[i];
1570+
}
1571+
ygsig_[i] = (1.f - yratio_) * enty0_->ygsig[i] + yratio_ * enty1_->ygsig[i];
1572+
} //if(goodEdgeAlgo)
15661573
chi2yavg_[i] = (1.f - yratio_) * enty0_->chi2yavg[i] + yratio_ * enty1_->chi2yavg[i];
15671574
chi2ymin_[i] = (1.f - yratio_) * enty0_->chi2ymin[i] + yratio_ * enty1_->chi2ymin[i];
15681575
chi2xavg[i] = (1.f - yratio_) * enty0_->chi2xavg[i] + yratio_ * enty1_->chi2xavg[i];
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
# This modifier enables the good edge algorithm in pixel hit reconstruction that handles broken/truncated pixel cluster caused by radiation damage
4+
siPixelGoodEdgeAlgo = cms.Modifier()

Configuration/PyReleaseValidation/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,4 @@ The offsets currently in use are:
108108
* 0.113: Activate OuterTracker inefficiency (PS-p: bias rails inefficiency; PS-s and SS: 5% bad strips)
109109
* 0.114: Activate OuterTracker inefficiency (PS-p: bias rails inefficiency; PS-s and SS: 10% bad strips)
110110
* 0.141: Activate emulation of the signal shape of the InnerTracker FE chip (CROC)
111+
* 0.186: Run-3 goodEdgeAlgo CPE

Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,32 @@ def condition(self, fragment, stepList, key, hasHarvest):
614614
offset = 0.18,
615615
)
616616

617+
# pixel GoodEdgeAlgo CPE workflows
618+
class UpgradeWorkflow_siPixelGoodEdgeAlgo(UpgradeWorkflow):
619+
def setup_(self, step, stepName, stepDict, k, properties):
620+
if 'Reco' in step:
621+
stepDict[stepName][k] = merge([{'--procModifiers': 'siPixelGoodEdgeAlgo'}, stepDict[step][k]])
622+
def condition(self, fragment, stepList, key, hasHarvest):
623+
result = (fragment=="QCD_Pt_1800_2400_14" or fragment=="TTbar_14TeV" ) and any(y in key for y in ['2025'])
624+
return result
625+
upgradeWFs['siPixelGoodEdgeAlgo'] = UpgradeWorkflow_siPixelGoodEdgeAlgo(
626+
steps = [
627+
'Reco',
628+
'RecoFakeHLT',
629+
'RecoGlobal',
630+
'RecoNano',
631+
'RecoNanoFakeHLT',
632+
],
633+
PU = [
634+
'Reco',
635+
'RecoFakeHLT',
636+
'RecoGlobal',
637+
'RecoNano',
638+
'RecoNanoFakeHLT',
639+
],
640+
suffix = '_siPixelGoodEdgeAlgo',
641+
offset = 0.186,
642+
)
617643

618644
#Workflow to enable displacedRegionalStep tracking iteration
619645
class UpgradeWorkflow_displacedRegional(UpgradeWorkflowTracking):

RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepair.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class PixelCPEClusterRepair : public PixelCPEBase {
102102
std::vector<SiPixelTemplateStore2D> thePixelTemp2D_;
103103

104104
int speed_;
105+
bool goodEdgeAlgo_;
105106

106107
bool UseClusterSplitter_;
107108

RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateReco.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class PixelCPETemplateReco : public PixelCPEBase {
7979
const std::vector<SiPixelTemplateStore> *thePixelTemp_;
8080

8181
int speed_;
82+
bool goodEdgeAlgo_;
8283

8384
bool UseClusterSplitter_;
8485

RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,26 @@ namespace SiPixelTemplateReco {
9999
std::vector<std::pair<int, int> >& zeropix,
100100
float& probQ,
101101
int& nypix,
102-
int& nxpix);
102+
int& nxpix,
103+
bool goodEdgeAlgo);
104+
105+
int PixelTempReco1D(int id,
106+
float cotalpha,
107+
float cotbeta,
108+
float locBz,
109+
float locBx,
110+
ClusMatrix& cluster,
111+
SiPixelTemplate& templ,
112+
float& yrec,
113+
float& sigmay,
114+
float& proby,
115+
float& xrec,
116+
float& sigmax,
117+
float& probx,
118+
int& qbin,
119+
int speed,
120+
float& probQ,
121+
bool goodEdgeAlgo);
103122

104123
int PixelTempReco1D(int id,
105124
float cotalpha,

RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@
66
ComponentName = "PixelCPEClusterRepairWithoutProbQ",
77
speed = 0
88
)
9+
10+
# Enable the good edge algorithm in pixel hit reconstruction that handles broken/truncated pixel cluster caused by radiation damage
11+
from Configuration.ProcessModifiers.siPixelGoodEdgeAlgo_cff import siPixelGoodEdgeAlgo
12+
siPixelGoodEdgeAlgo.toModify(templates2, GoodEdgeAlgo = True)
13+
siPixelGoodEdgeAlgo.toModify(templates2_speed0, GoodEdgeAlgo = True)

RecoLocalTracker/SiPixelRecHits/python/PixelCPETemplateReco_cfi.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
from RecoLocalTracker.SiPixelRecHits._templates_default_cfi import _templates_default
44
templates = _templates_default.clone()
55

6+
# Enable the good edge algorithm in pixel hit reconstruction that handles broken/truncated pixel cluster caused by radiation damage
7+
from Configuration.ProcessModifiers.siPixelGoodEdgeAlgo_cff import siPixelGoodEdgeAlgo
8+
siPixelGoodEdgeAlgo.toModify(templates, GoodEdgeAlgo = True)

RecoLocalTracker/SiPixelRecHits/src/PixelCPEClusterRepair.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ PixelCPEClusterRepair::PixelCPEClusterRepair(edm::ParameterSet const& conf,
7575
}
7676

7777
speed_ = conf.getParameter<int>("speed");
78+
goodEdgeAlgo_ = conf.getParameter<bool>("GoodEdgeAlgo");
7879
LogDebug("PixelCPEClusterRepair::PixelCPEClusterRepair:") << "Template speed = " << speed_ << "\n";
80+
LogDebug("PixelCPEClusterRepair::PixelCPEClusterRepair:") << "GoodEdgeAlgo = " << goodEdgeAlgo_ << "\n";
7981

8082
// this returns the magnetic field value in kgauss (1T = 10 kgauss)
8183
int theMagField = mag->nominalValue();
@@ -355,7 +357,8 @@ void PixelCPEClusterRepair::callTempReco1D(DetParam const& theDetParam,
355357
zeropix,
356358
theClusterParam.probabilityQ_,
357359
nypix,
358-
nxpix);
360+
nxpix,
361+
goodEdgeAlgo_);
359362
// ******************************************************************
360363

361364
//--- Check exit status
@@ -549,7 +552,8 @@ void PixelCPEClusterRepair::checkRecommend2D(DetParam const& theDetParam,
549552
}
550553
// The 1d pixel template
551554
SiPixelTemplate templ(*thePixelTemp_);
552-
if (!templ.interpolate(ID, theClusterParam.cotalpha, theClusterParam.cotbeta, theDetParam.bz, theDetParam.bx)) {
555+
if (!templ.interpolate(
556+
ID, theClusterParam.cotalpha, theClusterParam.cotbeta, theDetParam.bz, theDetParam.bx, goodEdgeAlgo_)) {
553557
//error setting up template, return false
554558
theClusterParam.recommended2D_ = false;
555559
return;
@@ -718,6 +722,7 @@ void PixelCPEClusterRepair::fillPSetDescription(edm::ParameterSetDescription& de
718722
desc.add<int>("forwardTemplateID", 0);
719723
desc.add<int>("directoryWithTemplates", 0);
720724
desc.add<int>("speed", -2);
725+
desc.add<bool>("GoodEdgeAlgo", false);
721726
desc.add<bool>("UseClusterSplitter", false);
722727
desc.add<double>("MaxSizeMismatchInY", 0.3);
723728
desc.add<double>("MinChargeRatio", 0.8);

RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ PixelCPETemplateReco::PixelCPETemplateReco(edm::ParameterSet const& conf,
8181
<< " not loaded correctly from text file. Reconstruction will fail.\n\n";
8282
}
8383

84+
goodEdgeAlgo_ = conf.getParameter<bool>("GoodEdgeAlgo");
8485
speed_ = conf.getParameter<int>("speed");
8586
LogDebug("PixelCPETemplateReco::PixelCPETemplateReco:") << "Template speed = " << speed_ << "\n";
8687

@@ -249,7 +250,8 @@ LocalPoint PixelCPETemplateReco::localPosition(DetParam const& theDetParam, Clus
249250
theClusterParam.templProbX_,
250251
theClusterParam.templQbin_,
251252
speed_,
252-
theClusterParam.templProbQ_);
253+
theClusterParam.templProbQ_,
254+
goodEdgeAlgo_);
253255

254256
// ******************************************************************
255257

@@ -529,4 +531,5 @@ void PixelCPETemplateReco::fillPSetDescription(edm::ParameterSetDescription& des
529531
desc.add<int>("directoryWithTemplates", 0);
530532
desc.add<int>("speed", -2);
531533
desc.add<bool>("UseClusterSplitter", false);
534+
desc.add<bool>("GoodEdgeAlgo", false);
532535
}

0 commit comments

Comments
 (0)