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
Update of Phase2Digitizer package #16884
Merged
cmsbuild
merged 2 commits into
cms-sw:CMSSW_9_0_X
from
suchandradutta:Phase2Digitizer_90X_061216
Dec 9, 2016
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -584,7 +584,8 @@ void Phase2TrackerDigitizerAlgorithm::induce_signal(const PSimHit& hit, | |
// Fill the global map with all hit pixels from this event | ||
for (auto const & hit_s : hit_signal) { | ||
int chan = hit_s.first; | ||
theSignal[chan] += (makeDigiSimLinks_ ? DigitizerUtility::Amplitude( hit_s.second, &hit, hitIndex, tofBin, hit_s.second) : DigitizerUtility::Amplitude( hit_s.second, hit_s.second) ) ; | ||
theSignal[chan] += (makeDigiSimLinks_ ? DigitizerUtility::Amplitude( hit_s.second, &hit, hitIndex, tofBin, hit_s.second) | ||
: DigitizerUtility::Amplitude( hit_s.second, hit_s.second) ) ; | ||
} | ||
} | ||
// ====================================================================== | ||
|
@@ -636,10 +637,11 @@ void Phase2TrackerDigitizerAlgorithm::add_noise(const Phase2TrackerGeomDetUnit* | |
for (auto const & l : signalNew) { | ||
int chan = l.first; | ||
auto iter = theSignal.find(chan); | ||
if (iter != theSignal.end()) | ||
if (iter != theSignal.end()) { | ||
theSignal[chan] += l.second.ampl(); | ||
else | ||
theSignal.insert(std::pair<int,DigitizerUtility::Amplitude>(chan, DigitizerUtility::Amplitude(l.second.ampl(),-1.0))); | ||
} else { | ||
theSignal.insert(std::pair<int,DigitizerUtility::Amplitude>(chan, DigitizerUtility::Amplitude(l.second.ampl(), -1.0))); | ||
} | ||
} | ||
} | ||
if (!addNoisyPixels) // Option to skip noise in non-hit pixels | ||
|
@@ -909,7 +911,7 @@ void Phase2TrackerDigitizerAlgorithm::digitize(const Phase2TrackerGeomDetUnit* p | |
auto it = _signal.find(detID); | ||
if (it == _signal.end()) return; | ||
|
||
const signal_map_type& theSignal = _signal[detID]; // ** please check detID exists!!! | ||
const signal_map_type& theSignal = _signal[detID]; | ||
|
||
|
||
unsigned int Sub_detid = DetId(detID).subdetId(); | ||
|
@@ -927,9 +929,8 @@ void Phase2TrackerDigitizerAlgorithm::digitize(const Phase2TrackerGeomDetUnit* p | |
theHIPThresholdInE = theHIPThresholdInE_Endcap; | ||
} | ||
|
||
|
||
if (addNoise) add_noise(pixdet, theThresholdInE/theNoiseInElectrons); // generate noise | ||
|
||
// Do only if needed | ||
if (AddPixelInefficiency && theSignal.size() > 0) { | ||
if (use_ineff_from_db_) | ||
|
@@ -944,27 +945,23 @@ void Phase2TrackerDigitizerAlgorithm::digitize(const Phase2TrackerGeomDetUnit* p | |
module_killing_conf(detID); | ||
} | ||
|
||
// DDigitize if the signal is greater than threshold | ||
// Digitize if the signal is greater than threshold | ||
for (auto const & s : theSignal) { | ||
DigitizerUtility::Amplitude sig_data = s.second; | ||
float signalInElectrons = sig_data.ampl(); | ||
int adc; | ||
if (signalInElectrons >= theThresholdInE) { // check threshold | ||
|
||
if (doDigitalReadout) adc = theAdcFullScale; | ||
else adc = std::min( int(signalInElectrons / theElectronPerADC), theAdcFullScale ); | ||
|
||
DigitizerUtility::DigiSimInfo info; | ||
info.sig_tot = adc; | ||
info.ot_bit = ( signalInElectrons > theHIPThresholdInE ? true : false); | ||
if (makeDigiSimLinks_ && sig_data.hitInfo() != 0) { | ||
info.hit_counter = sig_data.hitIndex(); | ||
info.tof_bin = sig_data.tofBin(); | ||
info.event_id = sig_data.eventId(); | ||
for (unsigned int j = 0; j != sig_data.trackIds().size(); ++j) { | ||
unsigned int tkid = sig_data.trackIds()[j]; | ||
float charge_frac = sig_data.individualampl()[j]/adc; | ||
info.track_map.insert({tkid, charge_frac}); | ||
if (makeDigiSimLinks_ ) { | ||
int j = 0; | ||
for (auto l : sig_data.simInfoList()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the typical length of this loop? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mostly a couple of elements |
||
j++; | ||
float charge_frac = l.first/signalInElectrons; | ||
if (l.first > -5.0) info.simInfoList.push_back({charge_frac,l.second}); | ||
} | ||
} | ||
digi_map.insert({s.first, info}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @suchandradutta - you could simply combine all three of these constructors via some default values to the arguments. That would make this cleaner