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 Digitizer framework update for BrickedPixel #35173

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 19 additions & 6 deletions SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h"
#include "SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h"
#include "SimTracker/SiPhase2Digitizer/plugins/Pixel3DDigitizerAlgorithm.h"
#include "SimTracker/SiPhase2Digitizer/plugins/PixelBrickedDigitizerAlgorithm.h"
#include "SimTracker/SiPhase2Digitizer/plugins/DigitizerUtility.h"

#include "FWCore/Framework/interface/EDProducer.h"
Expand Down Expand Up @@ -91,6 +92,7 @@ namespace cms {
}
// creating algorithm objects and pushing them into the map
algomap_[AlgorithmType::InnerPixel] = std::make_unique<PixelDigitizerAlgorithm>(iConfig, iC);
algomap_[AlgorithmType::InnerPixelBricked] = std::make_unique<PixelBrickedDigitizerAlgorithm>(iConfig, iC);
algomap_[AlgorithmType::InnerPixel3D] = std::make_unique<Pixel3DDigitizerAlgorithm>(iConfig, iC);
algomap_[AlgorithmType::PixelinPS] = std::make_unique<PSPDigitizerAlgorithm>(iConfig, iC);
algomap_[AlgorithmType::StripinPS] = std::make_unique<PSSDigitizerAlgorithm>(iConfig, iC);
Expand Down Expand Up @@ -234,6 +236,9 @@ namespace cms {
moduleTypeCache_.emplace(detId_raw, mType);
}

auto detUnit = detectorUnits_.find(detId_raw);
const Phase2TrackerGeomDetUnit* pixdet = dynamic_cast<const Phase2TrackerGeomDetUnit*>(detUnit->second);
const Phase2TrackerTopology* topol = &pixdet->specificTopology();
AlgorithmType algotype = AlgorithmType::Unknown;
switch (mType) {
case TrackerGeometry::ModuleType::Ph1PXB:
Expand All @@ -243,10 +248,16 @@ namespace cms {
algotype = AlgorithmType::InnerPixel;
break;
case TrackerGeometry::ModuleType::Ph2PXB:
algotype = AlgorithmType::InnerPixel;
if (topol->isBricked())
algotype = AlgorithmType::InnerPixelBricked;
else
algotype = AlgorithmType::InnerPixel;
break;
case TrackerGeometry::ModuleType::Ph2PXF:
algotype = AlgorithmType::InnerPixel;
if (topol->isBricked())
algotype = AlgorithmType::InnerPixelBricked;
else
algotype = AlgorithmType::InnerPixel;
break;
case TrackerGeometry::ModuleType::Ph2PXB3D:
algotype = AlgorithmType::InnerPixel3D;
Expand Down Expand Up @@ -282,9 +293,10 @@ namespace cms {
continue;

// Decide if we want analog readout for Outer Tracker.
if (!ot_analog && (algotype != AlgorithmType::InnerPixel && algotype != AlgorithmType::InnerPixel3D)) {
if (!ot_analog && algotype != AlgorithmType::InnerPixel && algotype != AlgorithmType::InnerPixel3D &&
algotype != AlgorithmType::InnerPixelBricked)
continue;
}

std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
fiter->second->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u), digi_map, tTopo_);

Expand Down Expand Up @@ -345,9 +357,10 @@ namespace cms {
auto algotype = getAlgoType(rawId);

auto fiter = algomap_.find(algotype);
if (fiter == algomap_.end() || algotype == AlgorithmType::InnerPixel || algotype == AlgorithmType::InnerPixel3D) {
if (fiter == algomap_.end() || algotype == AlgorithmType::InnerPixel || algotype == AlgorithmType::InnerPixel3D ||
algotype == AlgorithmType::InnerPixelBricked)
continue;
}

std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
fiter->second->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u), digi_map, tTopo_);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace cms {
using vstring = std::vector<std::string>;

// constants of different algorithm types
enum class AlgorithmType { InnerPixel, InnerPixel3D, PixelinPS, StripinPS, TwoStrip, Unknown };
enum class AlgorithmType { InnerPixel, InnerPixelBricked, InnerPixel3D, PixelinPS, StripinPS, TwoStrip, Unknown };
AlgorithmType getAlgoType(uint32_t idet);

void accumulatePixelHits(edm::Handle<std::vector<PSimHit> >, size_t globalSimHitIndex, const uint32_t tofBin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,14 @@
using namespace edm;
using namespace sipixelobjects;

namespace {
namespace Ph2TkDigiAlgo {
Copy link
Contributor

Choose a reason for hiding this comment

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

"For namespaces use lower case" (see 2.7 in http://cms-sw.github.io/cms_coding_rules.html)

// Mass in MeV
constexpr double m_pion = 139.571;
constexpr double m_kaon = 493.677;
constexpr double m_electron = 0.511;
constexpr double m_muon = 105.658;
constexpr double m_proton = 938.272;
float calcQ(float x);
} // namespace
namespace {
float calcQ(float x) {
constexpr float p1 = 12.5f;
constexpr float p2 = 0.2733f;
constexpr float p3 = 0.147f;

auto xx = std::min(0.5f * x * x, p1);
return 0.5f * (1.f - std::copysign(std::sqrt(1.f - unsafe_expf<4>(-xx * (1.f + p2 / (1.f + p3 * xx)))), x));
}
} // namespace
} // namespace Ph2TkDigiAlgo
Phase2TrackerDigitizerAlgorithm::Phase2TrackerDigitizerAlgorithm(const edm::ParameterSet& conf_common,
const edm::ParameterSet& conf_specific,
edm::ConsumesCollector iC)
Expand Down Expand Up @@ -279,17 +268,17 @@ std::vector<DigitizerUtility::EnergyDepositUnit> Phase2TrackerDigitizerAlgorithm
//==============================================================================
std::vector<float> Phase2TrackerDigitizerAlgorithm::fluctuateEloss(
int pid, float particleMomentum, float eloss, float length, int NumberOfSegs) const {
double particleMass = ::m_pion; // Mass in MeV, assume pion
double particleMass = Ph2TkDigiAlgo::m_pion; // Mass in MeV, assume pion
pid = std::abs(pid);
if (pid != 211) { // Mass in MeV
if (pid == 11)
particleMass = ::m_electron;
particleMass = Ph2TkDigiAlgo::m_electron;
else if (pid == 13)
particleMass = ::m_muon;
particleMass = Ph2TkDigiAlgo::m_muon;
else if (pid == 321)
particleMass = ::m_kaon;
particleMass = Ph2TkDigiAlgo::m_kaon;
else if (pid == 2212)
particleMass = ::m_proton;
particleMass = Ph2TkDigiAlgo::m_proton;
}
// What is the track segment length.
float segmentLength = length / NumberOfSegs;
Expand Down Expand Up @@ -513,7 +502,7 @@ void Phase2TrackerDigitizerAlgorithm::induce_signal(
} else {
mp = MeasurementPoint(ix, 0.0);
xLB = topol->localPosition(mp).x();
LowerBound = 1 - ::calcQ((xLB - CloudCenterX) / SigmaX);
LowerBound = 1 - calcQ((xLB - CloudCenterX) / SigmaX);
}

float xUB, UpperBound;
Expand All @@ -522,7 +511,7 @@ void Phase2TrackerDigitizerAlgorithm::induce_signal(
} else {
mp = MeasurementPoint(ix + 1, 0.0);
xUB = topol->localPosition(mp).x();
UpperBound = 1. - ::calcQ((xUB - CloudCenterX) / SigmaX);
UpperBound = 1. - calcQ((xUB - CloudCenterX) / SigmaX);
}
float TotalIntegrationRange = UpperBound - LowerBound; // get strip
x.emplace(ix, TotalIntegrationRange); // save strip integral
Expand All @@ -537,7 +526,7 @@ void Phase2TrackerDigitizerAlgorithm::induce_signal(
} else {
mp = MeasurementPoint(0.0, iy);
yLB = topol->localPosition(mp).y();
LowerBound = 1. - ::calcQ((yLB - CloudCenterY) / SigmaY);
LowerBound = 1. - calcQ((yLB - CloudCenterY) / SigmaY);
}

float yUB, UpperBound;
Expand All @@ -546,7 +535,7 @@ void Phase2TrackerDigitizerAlgorithm::induce_signal(
} else {
mp = MeasurementPoint(0.0, iy + 1);
yUB = topol->localPosition(mp).y();
UpperBound = 1. - ::calcQ((yUB - CloudCenterY) / SigmaY);
UpperBound = 1. - calcQ((yUB - CloudCenterY) / SigmaY);
}

float TotalIntegrationRange = UpperBound - LowerBound;
Expand Down Expand Up @@ -1041,3 +1030,11 @@ int Phase2TrackerDigitizerAlgorithm::convertSignalToAdc(uint32_t detID, float si
}
return signal_in_adc;
}
float Phase2TrackerDigitizerAlgorithm::calcQ(float x) {
constexpr float p1 = 12.5f;
constexpr float p2 = 0.2733f;
constexpr float p3 = 0.147f;

auto xx = std::min(0.5f * x * x, p1);
return 0.5f * (1.f - std::copysign(std::sqrt(1.f - unsafe_expf<4>(-xx * (1.f + p2 / (1.f + p3 * xx)))), x));
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class Phase2TrackerDigitizerAlgorithm {
const Phase2TrackerGeomDetUnit* pixdet); // remove dead modules uisng the list in the DB

const SubdetEfficiencies subdetEfficiencies_;
float calcQ(float x);

// For random numbers
std::unique_ptr<CLHEP::RandGaussQ> gaussDistribution_;
Expand Down