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

Software Design Update for the Phase2 Tracker Digitizer #30582

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions SimTracker/SiPhase2Digitizer/plugins/DigitizerUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ namespace DigitizerUtility {
void set(const float amplitude) { // Used to reset the amplitude
_amp = amplitude;
}
// void setind (const float indamplitude) { // Used to reset the amplitude
// _frac = idamplitude;
// }

private:
float _amp;
Expand Down
46 changes: 4 additions & 42 deletions SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,56 +27,18 @@ PSPDigitizerAlgorithm::PSPDigitizerAlgorithm(const edm::ParameterSet& conf)
<< tMax_ << " pix-inefficiency " << addPixelInefficiency_;
}
PSPDigitizerAlgorithm::~PSPDigitizerAlgorithm() { LogDebug("PSPDigitizerAlgorithm") << "Algorithm deleted"; }
void PSPDigitizerAlgorithm::accumulateSimHits(std::vector<PSimHit>::const_iterator inputBegin,
std::vector<PSimHit>::const_iterator inputEnd,
const size_t inputBeginGlobalIndex,
const uint32_t tofBin,
const Phase2TrackerGeomDetUnit* pixdet,
const GlobalVector& bfield) {
// produce SignalPoint's for all SimHit's in detector
// Loop over hits
uint32_t detId = pixdet->geographicalId().rawId();
size_t simHitGlobalIndex = inputBeginGlobalIndex; // This needs to be stored to create the digi-sim link later

// find the relevant hits
std::vector<PSimHit> matchedSimHits;
std::copy_if(inputBegin, inputEnd, std::back_inserter(matchedSimHits), [detId](auto const& hit) -> bool {
return hit.detUnitId() == detId;
});
// loop over a much reduced set of SimHits
for (auto const& hit : matchedSimHits) {
LogDebug("PSPDigitizerAlgorithm") << hit.particleType() << " " << hit.pabs() << " " << hit.energyLoss() << " "
<< hit.tof() << " " << hit.trackId() << " " << hit.processType() << " "
<< hit.detUnitId() << hit.entryPoint() << " " << hit.exitPoint();

std::vector<DigitizerUtility::EnergyDepositUnit> ionization_points;
std::vector<DigitizerUtility::SignalPoint> collection_points;

double signalScale = 1.0;
// fill collection_points for this SimHit, indpendent of topology
if (select_hit(hit, (pixdet->surface().toGlobal(hit.localPosition()).mag() * c_inv), signalScale)) {
primary_ionization(hit, ionization_points); // fills ionization_points

// transforms ionization_points -> collection_points
drift(hit, pixdet, bfield, ionization_points, collection_points);

// compute induced signal on readout elements and add to _signal
// hit needed only for SimHit<-->Digi link
induce_signal(hit, simHitGlobalIndex, tofBin, pixdet, collection_points);
}
++simHitGlobalIndex;
}
}
//
// -- Select the Hit for Digitization (sigScale will be implemented in future)
//
bool PSPDigitizerAlgorithm::select_hit(const PSimHit& hit, double tCorr, double& sigScale) {
bool PSPDigitizerAlgorithm::select_hit(const PSimHit& hit, double tCorr, double& sigScale) const {
double toa = hit.tof() - tCorr;
return (toa > theTofLowerCut_ && toa < theTofUpperCut_);
}
//
// -- Compare Signal with Threshold
//
bool PSPDigitizerAlgorithm::isAboveThreshold(const DigitizerUtility::SimHitInfo* hitInfo, float charge, float thr) {
bool PSPDigitizerAlgorithm::isAboveThreshold(const DigitizerUtility::SimHitInfo* hitInfo,
float charge,
float thr) const {
return (charge >= thr);
}
12 changes: 2 additions & 10 deletions SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@ class PSPDigitizerAlgorithm : public Phase2TrackerDigitizerAlgorithm {
// initialization that cannot be done in the constructor
void init(const edm::EventSetup& es) override;

// void initializeEvent();
// run the algorithm to digitize a single det
void accumulateSimHits(const std::vector<PSimHit>::const_iterator inputBegin,
const std::vector<PSimHit>::const_iterator inputEnd,
const size_t inputBeginGlobalIndex,
const uint32_t tofBin,
const Phase2TrackerGeomDetUnit* pixdet,
const GlobalVector& bfield) override;
bool select_hit(const PSimHit& hit, double tCorr, double& sigScale) override;
bool isAboveThreshold(const DigitizerUtility::SimHitInfo* hitInfo, float charge, float thr) override;
bool select_hit(const PSimHit& hit, double tCorr, double& sigScale) const override;
bool isAboveThreshold(const DigitizerUtility::SimHitInfo* hitInfo, float charge, float thr) const override;
};
#endif
44 changes: 2 additions & 42 deletions SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,50 +27,10 @@ PSSDigitizerAlgorithm::PSSDigitizerAlgorithm(const edm::ParameterSet& conf)
<< tMax_ << " pix-inefficiency " << addPixelInefficiency_;
}
PSSDigitizerAlgorithm::~PSSDigitizerAlgorithm() { LogDebug("PSSDigitizerAlgorithm") << "Algorithm deleted"; }
void PSSDigitizerAlgorithm::accumulateSimHits(std::vector<PSimHit>::const_iterator inputBegin,
std::vector<PSimHit>::const_iterator inputEnd,
const size_t inputBeginGlobalIndex,
const uint32_t tofBin,
const Phase2TrackerGeomDetUnit* pixdet,
const GlobalVector& bfield) {
// produce SignalPoint's for all SimHit's in detector
// Loop over hits
uint32_t detId = pixdet->geographicalId().rawId();
size_t simHitGlobalIndex = inputBeginGlobalIndex; // This needs to be stored to create the digi-sim link later

// find the relevant hits
std::vector<PSimHit> matchedSimHits;
std::copy_if(inputBegin, inputEnd, std::back_inserter(matchedSimHits), [detId](auto const& hit) -> bool {
return hit.detUnitId() == detId;
});
// loop over a much reduced set of SimHits
for (auto const& hit : matchedSimHits) {
LogDebug("PSSDigitizerAlgorithm") << hit.particleType() << " " << hit.pabs() << " " << hit.energyLoss() << " "
<< hit.tof() << " " << hit.trackId() << " " << hit.processType() << " "
<< hit.detUnitId() << hit.entryPoint() << " " << hit.exitPoint();

std::vector<DigitizerUtility::EnergyDepositUnit> ionization_points;
std::vector<DigitizerUtility::SignalPoint> collection_points;

double signalScale = 1.0;
// fill collection_points for this SimHit, indpendent of topology
if (select_hit(hit, (pixdet->surface().toGlobal(hit.localPosition()).mag() * c_inv), signalScale)) {
primary_ionization(hit, ionization_points); // fills ionization_points

// transforms ionization_points -> collection_points
drift(hit, pixdet, bfield, ionization_points, collection_points);

// compute induced signal on readout elements and add to _signal
// hit needed only for SimHit<-->Digi link
induce_signal(hit, simHitGlobalIndex, tofBin, pixdet, collection_points);
}
++simHitGlobalIndex;
}
}
//
// -- Select the Hit for Digitization (sigScale will be implemented in future)
//
bool PSSDigitizerAlgorithm::select_hit(const PSimHit& hit, double tCorr, double& sigScale) {
bool PSSDigitizerAlgorithm::select_hit(const PSimHit& hit, double tCorr, double& sigScale) const {
double toa = hit.tof() - tCorr;
return (toa > theTofLowerCut_ && toa < theTofUpperCut_);
}
Expand All @@ -79,6 +39,6 @@ bool PSSDigitizerAlgorithm::select_hit(const PSimHit& hit, double tCorr, double&
//
bool PSSDigitizerAlgorithm::isAboveThreshold(const DigitizerUtility::SimHitInfo* const hisInfo,
float charge,
float thr) {
float thr) const {
return (charge >= thr);
}
12 changes: 2 additions & 10 deletions SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@ class PSSDigitizerAlgorithm : public Phase2TrackerDigitizerAlgorithm {
// initialization that cannot be done in the constructor
void init(const edm::EventSetup& es) override;

// void initializeEvent();
// run the algorithm to digitize a single det
void accumulateSimHits(const std::vector<PSimHit>::const_iterator inputBegin,
const std::vector<PSimHit>::const_iterator inputEnd,
const size_t inputBeginGlobalIndex,
const uint32_t tofBin,
const Phase2TrackerGeomDetUnit* pixdet,
const GlobalVector& bfield) override;
bool select_hit(const PSimHit& hit, double tCorr, double& sigScale) override;
bool isAboveThreshold(const DigitizerUtility::SimHitInfo* hitInfo, float charge, float thr) override;
bool select_hit(const PSimHit& hit, double tCorr, double& sigScale) const override;
bool isAboveThreshold(const DigitizerUtility::SimHitInfo* hitInfo, float charge, float thr) const override;
};
#endif
Loading