Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracker phase2 bricked pixel localreco cmssw 12 1 x #35441

24 changes: 21 additions & 3 deletions CondFormats/SiPixelTransient/interface/SiPixelUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
namespace SiPixelUtils {

float generic_position_formula(int size, //!< Size of this projection.
int Q_f, //!< Charge in the first pixel.
int Q_l, //!< Charge in the last pixel.
int q_f, //!< Charge in the first pixel.
int q_l, //!< Charge in the last pixel.
float upper_edge_first_pix, //!< As the name says.
float lower_edge_last_pix, //!< As the name says.
float lorentz_shift, //!< L-width
Expand All @@ -19,6 +19,24 @@ namespace SiPixelUtils {
float size_cut //!< Use edge when size == cuts
);

}
float generic_position_formula_y_bricked(
int size, //!< Size of this projection.
int q_f, //!< Charge in the first pixel.
int q_l, //!< Charge in the last pixel.
int q_f_b, //!< Charge in pixels that are "dented" compared to the lowest pixel of the cluster.
int q_l_b, //!< Charge in pixels that are "dented" compared to the highest pixel of the cluster.
float upper_edge_first_pix, //!< As the name says.
float lower_edge_last_pix, //!< As the name says.
float lorentz_shift, //!< L-width
float theThickness, //detector thickness
float cot_angle, //!< cot of alpha_ or beta_
float pitch, //!< thePitchX or thePitchY
bool first_is_big, //!< true if the first is big
bool last_is_big, //!< true if the last is big
float eff_charge_cut_low, //!< Use edge if > W_eff (in pix) &&&
float eff_charge_cut_high, //!< Use edge if < W_eff (in pix) &&&
float size_cut //!< Use edge when size == cuts
);
} // namespace SiPixelUtils

#endif
85 changes: 74 additions & 11 deletions CondFormats/SiPixelTransient/src/SiPixelUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ namespace SiPixelUtils {
float eff_charge_cut_high, //!< Use edge if < w_eff &&&
float size_cut //!< Use edge when size == cuts
) {
//cout<<" in PixelCPEGeneric:generic_position_formula - "<<endl; //dk

float geom_center = 0.5f * (upper_edge_first_pix + lower_edge_last_pix);

//--- The case of only one pixel in this projection is separate. Note that
Expand All @@ -47,8 +45,6 @@ namespace SiPixelUtils {
float w_pred = theThickness * cot_angle // geometric correction (in cm)
- lorentz_shift; // (in cm) &&& check fpix!

//cout << " in PixelCPEGeneric:generic_position_formula - " << w_inner << " " << w_pred << endl; // dk

//--- Total length of the two edge pixels (first+last)
float sum_of_edge = 2.0f;
if (first_is_big)
Expand All @@ -60,7 +56,7 @@ namespace SiPixelUtils {
float w_eff = std::abs(w_pred) - w_inner;

//--- If the observed charge width is inconsistent with the expectations
//--- based on the track, do *not* use w_pred-W_innner. Instead, replace
//--- based on the track, do *not* use w_pred-w_innner. Instead, replace
//--- it with an *average* effective charge width, which is the average
//--- length of the edge pixels.
//
Expand All @@ -71,17 +67,84 @@ namespace SiPixelUtils {
}

//--- Finally, compute the position in this projection
float qdiff = q_l - q_f;
float qsum = q_l + q_f;
float q_diff = q_l - q_f;
float q_sum = q_l + q_f;

//--- Temporary fix for clusters with both first and last pixel with charge = 0
if (qsum == 0)
qsum = 1.0f;
if (q_sum == 0)
q_sum = 1.0f;

//float hit_pos = geom_center + 0.5f*(qdiff/qsum) * w_eff + half_lorentz_shift;
float hit_pos = geom_center + 0.5f * (qdiff / qsum) * w_eff;
float hit_pos = geom_center + 0.5f * (q_diff / q_sum) * w_eff;

return hit_pos;
}

float generic_position_formula_y_bricked(
int size, //!< Size of this projection.
int q_f, //!< Charge in the first pixel.
int q_l, //!< Charge in the last pixel.
int q_f_b, //!< Charge in pixels that are "dented" compared to the lowest pixel of the cluster.
int q_l_b, //!< Charge in pixels that are "dented" compared to the highest pixel of the cluster.
float upper_edge_first_pix, //!< As the name says.
float lower_edge_last_pix, //!< As the name says.
float lorentz_shift, //!< L-shift at half thickness
float theThickness, //detector thickness
float cot_angle, //!< cot of alpha_ or beta_
float pitch, //!< thePitchX or thePitchY
bool first_is_big, //!< true if the first is big
bool last_is_big, //!< true if the last is big
float eff_charge_cut_low, //!< Use edge if > w_eff &&&
float eff_charge_cut_high, //!< Use edge if < w_eff &&&
float size_cut //!< Use edge when size == cuts
) {
float geom_center = 0.5f * (upper_edge_first_pix + lower_edge_last_pix);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float geom_center = 0.5f * (upper_edge_first_pix + lower_edge_last_pix);
const auto geom_center = 0.5f * (upper_edge_first_pix + lower_edge_last_pix);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


//--- The case of only one pixel in this projection is separate. Note that
//--- here first_pix == last_pix, so the average of the two is still the
//--- center of the pixel.

//--- Width of the clusters minus the edge (first and last) pixels.
//--- In the note, they are denoted x_F and x_L (and y_F and y_L)
float w_inner = lower_edge_last_pix - upper_edge_first_pix; // in cm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float w_inner = lower_edge_last_pix - upper_edge_first_pix; // in cm
const auto w_inner = lower_edge_last_pix - upper_edge_first_pix; // in cm

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


//--- Predicted charge width from geometry
float w_pred = theThickness * cot_angle // geometric correction (in cm)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float w_pred = theThickness * cot_angle // geometric correction (in cm)
const auto w_pred = theThickness * cot_angle // geometric correction (in cm)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

- lorentz_shift; // (in cm) &&& check fpix!

//--- Total length of the two edge pixels (first+last)
float sum_of_edge = 2.0f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float sum_of_edge = 2.0f;
auto sum_of_edge = 2.0f;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

if (first_is_big)
sum_of_edge += 1.0f;
if (last_is_big)
sum_of_edge += 1.0f;

//--- The `effective' charge width -- particle's path in first and last pixels only
float w_eff = std::abs(w_pred) - std::abs(w_inner);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float w_eff = std::abs(w_pred) - std::abs(w_inner);
auto w_eff = std::abs(w_pred) - std::abs(w_inner);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


//--- If the observed charge width is inconsistent with the expectations
//--- based on the track, do *not* use w_pred-w_innner. Instead, replace
//--- it with an *average* effective charge width, which is the average
//--- length of the edge pixels.
//
// bool usedEdgeAlgo = false;
//Modified cut to make use of the w_eff in the bricked geometry
if (size >= size_cut) {
w_eff = pitch * 0.5f * sum_of_edge; // ave. length of edge pixels (first+last) (cm)
// usedEdgeAlgo = true;
}

//--- Finally, compute the position in this projection
float q_diff = q_l - q_f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float q_diff = q_l - q_f;
const auto q_diff = q_l - q_f;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

float q_sum = q_l + q_f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float q_sum = q_l + q_f;
auto q_sum = q_l + q_f;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

float q_b_corr = q_l_b + q_f_b;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float q_b_corr = q_l_b + q_f_b;
const auto q_b_corr = q_l_b + q_f_b;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


//--- Temporary fix for clusters with both first and last pixel with charge = 0
if (q_sum == 0)
q_sum = 1.0f;

float hit_pos =
geom_center + 0.5f * (q_diff / q_sum) * w_eff + 0.5f * (q_b_corr / q_sum) * w_eff; //bricked correction

return hit_pos;
}
} // namespace SiPixelUtils
7 changes: 7 additions & 0 deletions Configuration/Eras/python/Era_Phase2C11I13T27M9_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import FWCore.ParameterSet.Config as cms

from Configuration.Eras.Era_Phase2C11I13_cff import Phase2C11I13
from Configuration.Eras.Modifier_phase2_brickedPixels_cff import phase2_brickedPixels
from Configuration.Eras.Modifier_phase2_GE0_cff import phase2_GE0

Phase2C11I13T27M9 = cms.ModifierChain(Phase2C11I13, phase2_brickedPixels, phase2_GE0)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import FWCore.ParameterSet.Config as cms

phase2_brickedPixels = cms.Modifier()
2 changes: 1 addition & 1 deletion Configuration/Geometry/python/dict2026Geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
'from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *',
'trackerGeometry.applyAlignment = cms.bool(False)',
],
"era" : "phase2_tracker, phase2_3DPixels, trackingPhase2PU140",
"era" : "phase2_tracker, phase2_brickedPixels, trackingPhase2PU140",
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1351,11 +1351,11 @@ def condition(self, fragment, stepList, key, hasHarvest):
'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal'],
},
'2026D87' : {
'Geom' : 'Extended2026D87', # N.B.: Geometry with 3D pixels in the Inner Tracker L1.
'Geom' : 'Extended2026D87', # N.B.: Geometry with bricked pixels in the Inner Tracker (+others)
'HLTmenu': '@fake2',
'GT' : 'auto:phase2_realistic_T27',
'Era' : 'Phase2C11I13T25M9', # customized for 3D pixels and Muon M9
'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger'],
'Era' : 'Phase2C11I13T27M9', # customized for bricked pixels and Muon M9
'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal'],
},
}

Expand Down
5 changes: 3 additions & 2 deletions Configuration/StandardSequences/python/Eras.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def __init__(self):
'Phase2C11I13T22M9',
'Phase2C11I13T23M9',
'Phase2C11I13T25M9',
'Phase2C11I13T26M9'
'Phase2C11I13T26M9',
'Phase2C11I13T27M9'
]

internalUseMods = ['run2_common', 'run2_25ns_specific',
Expand All @@ -68,7 +69,7 @@ def __init__(self):
'phase2_hgcal', 'phase2_timing', 'phase2_hfnose', 'phase2_hgcalV10', 'phase2_hgcalV11', 'phase2_hgcalV12',
'phase2_timing_layer', 'phase2_etlV4', 'phase2_hcal', 'phase2_ecal','phase2_ecal_devel',
'phase2_trigger',
'phase2_squarePixels', 'phase2_3DPixels',
'phase2_squarePixels', 'phase2_3DPixels', 'phase2_brickedPixels',
'trackingLowPU', 'trackingPhase1', 'ctpps', 'ctpps_2016', 'ctpps_2017', 'ctpps_2018', 'ctpps_2021', 'trackingPhase2PU140','highBetaStar_2018',
'tracker_apv_vfp30_2016', 'pf_badHcalMitigationOff', 'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17', 'run2_nanoAOD_92X',
'run2_nanoAOD_94XMiniAODv1', 'run2_nanoAOD_94XMiniAODv2', 'run2_nanoAOD_94X2016',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ bool PixelThresholdClusterizer::setup(const PixelGeomDetUnit* pixDet) {
theNumOfCols = ncols;

if (nrows > theBuffer.rows() || ncols > theBuffer.columns()) { // change only when a larger is needed
//if( nrows != theNumOfRows || ncols != theNumOfCols ) {
//cout << " PixelThresholdClusterizer: pixel buffer redefined to "
// << nrows << " * " << ncols << endl;
if (nrows != theNumOfRows || ncols != theNumOfCols)
edm::LogWarning("setup()") << "pixel buffer redefined to" << nrows << " * " << ncols;
//theNumOfRows = nrows; // Set new sizes
//theNumOfCols = ncols;
// Resize the buffer
Expand Down Expand Up @@ -132,7 +131,8 @@ void PixelThresholdClusterizer::clusterizeDetUnitT(const T& input,
typename T::const_iterator end = input.end();

// Do not bother for empty detectors
//if (begin == end) cout << " PixelThresholdClusterizer::clusterizeDetUnit - No digis to clusterize";
if (begin == end)
edm::LogWarning("clusterizeDetUnit()") << "No digis to clusterize";

// Set up the clusterization on this DetId.
if (!setup(pixDet))
Expand All @@ -152,7 +152,7 @@ void PixelThresholdClusterizer::clusterizeDetUnitT(const T& input,

assert(output.empty());
// Loop over all seeds. TO DO: wouldn't using iterators be faster?
// edm::LogError("PixelThresholdClusterizer") << "Starting clusterizing" << endl;
// LogError("PixelThresholdClusterizer") << "Starting clusterizing";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this actually be removed, or converted to LogDebug?

Copy link
Author

@franzglessgen franzglessgen Oct 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it!

for (unsigned int i = 0; i < theSeeds.size(); i++) {
// Gavril : The charge of seeds that were already inlcuded in clusters is set to 1 electron
// so we don't want to call "make_cluster" for these cases
Expand All @@ -163,7 +163,7 @@ void PixelThresholdClusterizer::clusterizeDetUnitT(const T& input,
// Check if the cluster is above threshold
// (TO DO: one is signed, other unsigned, gcc warns...)
if (cluster.charge() >= clusterThreshold) {
// std::cout << "putting in this cluster " << i << " " << cluster.charge() << " " << cluster.pixelADC().size() << endl;
// LogDebug("clusterizeDetUnit():") << "putting in this cluster" << i << cluster.charge() << cluster.pixelADC().size();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this actually be removed? Or uncommented?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it

// sort by row (x)
output.push_back(std::move(cluster));
std::push_heap(output.begin(), output.end(), [](SiPixelCluster const& cl1, SiPixelCluster const& cl2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

#include <vector>

class dso_hidden PixelThresholdClusterizer final : public PixelClusterizerBase {
class dso_hidden PixelThresholdClusterizer : public PixelClusterizerBase {
public:
PixelThresholdClusterizer(edm::ParameterSet const& conf);
~PixelThresholdClusterizer() override;
Expand All @@ -77,7 +77,7 @@ class dso_hidden PixelThresholdClusterizer final : public PixelClusterizerBase {

static void fillPSetDescription(edm::ParameterSetDescription& desc);

private:
protected:
template <typename T>
void clusterizeDetUnitT(const T& input,
const PixelGeomDetUnit* pixDet,
Expand Down
Loading