26 if (use_ineff_from_db_)
27 theSiPixelGainCalibrationService_->setESObjects(es);
29 if (use_deadmodule_DB_)
32 if (use_LorentzAngle_DB_)
42 conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")),
43 odd_row_interchannelCoupling_next_row_(conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
44 .getParameter<double>(
"Odd_row_interchannelCoupling_next_row")),
45 even_row_interchannelCoupling_next_row_(conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
46 .getParameter<double>(
"Even_row_interchannelCoupling_next_row")),
47 odd_column_interchannelCoupling_next_column_(
48 conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
49 .getParameter<double>(
"Odd_column_interchannelCoupling_next_column")),
50 even_column_interchannelCoupling_next_column_(
51 conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
52 .getParameter<double>(
"Even_column_interchannelCoupling_next_column")),
53 apply_timewalk_(conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm").getParameter<
bool>(
"ApplyTimewalk")),
57 LogDebug(
"PixelDigitizerAlgorithm") <<
"Algorithm constructed "
58 <<
"Configuration parameters:"
59 <<
"Threshold/Gain = "
63 <<
" The delta cut-off is set to " <<
tMax_ <<
" pix-inefficiency "
68 std::vector<PSimHit>::const_iterator inputEnd,
69 const size_t inputBeginGlobalIndex,
70 const uint32_t tofBin,
76 size_t simHitGlobalIndex = inputBeginGlobalIndex;
79 std::vector<PSimHit> matchedSimHits;
80 std::copy_if(inputBegin, inputEnd, std::back_inserter(matchedSimHits), [detId](
auto const&
hit) ->
bool {
81 return hit.detUnitId() == detId;
84 for (
auto const&
hit : matchedSimHits) {
85 LogDebug(
"PixelDigitizerAlgorithm") <<
hit.particleType() <<
" " <<
hit.pabs() <<
" " <<
hit.energyLoss() <<
" "
86 <<
hit.tof() <<
" " <<
hit.trackId() <<
" " <<
hit.processType() <<
" "
87 <<
hit.detUnitId() <<
hit.entryPoint() <<
" " <<
hit.exitPoint();
89 std::vector<DigitizerUtility::EnergyDepositUnit> ionization_points;
90 std::vector<DigitizerUtility::SignalPoint> collection_points;
92 double signalScale = 1.0;
98 drift(
hit, pixdet, bfield, ionization_points, collection_points);
111 double time =
hit.tof() - tCorr;
127 const float pitch_first = 0.0025;
128 const float pitch_second = 0.0100;
131 const double pitch_tolerance(0.0005);
133 if (
std::abs(topol->
pitch().first - pitch_first) > pitch_tolerance ||
134 std::abs(topol->
pitch().second - pitch_second) > pitch_tolerance)
141 int numRows = topol->
nrows();
144 for (
auto&
s : theSignal) {
145 float signalInElectrons =
s.second.ampl();
151 float signalInElectrons_odd_column_Xtalk_next_column =
153 float signalInElectrons_even_column_Xtalk_next_column =
157 s.second.set(signalInElectrons - signalInElectrons_odd_row_Xtalk_next_row -
158 signalInElectrons_even_row_Xtalk_next_row - signalInElectrons_odd_column_Xtalk_next_column -
159 signalInElectrons_even_column_Xtalk_next_column);
161 if (hitChan.first != 0) {
162 auto XtalkPrev = std::make_pair(hitChan.first - 1, hitChan.second);
165 if (hitChan.first % 2 == 1)
166 signalNew.emplace(chanXtalkPrev,
169 signalNew.emplace(chanXtalkPrev,
172 if (hitChan.first < numRows - 1) {
173 auto XtalkNext = std::make_pair(hitChan.first + 1, hitChan.second);
176 if (hitChan.first % 2 == 1)
177 signalNew.emplace(chanXtalkNext,
180 signalNew.emplace(chanXtalkNext,
184 if (hitChan.second != 0) {
185 auto XtalkPrev = std::make_pair(hitChan.first, hitChan.second - 1);
188 if (hitChan.second % 2 == 1)
189 signalNew.emplace(chanXtalkPrev,
192 signalNew.emplace(chanXtalkPrev,
195 if (hitChan.second < numColumns - 1) {
196 auto XtalkNext = std::make_pair(hitChan.first, hitChan.second + 1);
199 if (hitChan.second % 2 == 1)
200 signalNew.emplace(chanXtalkNext,
203 signalNew.emplace(chanXtalkNext,
207 for (
auto const&
l : signalNew) {
209 auto iter = theSignal.find(
chan);
210 if (iter != theSignal.end()) {
211 iter->second +=
l.second.ampl();
219 : x_(
pset.getParameter<
std::vector<double>>(
"charge")), y_(
pset.getParameter<
std::vector<double>>(
"delay")) {
220 if (
x_.size() !=
y_.size())
222 <<
"Timewalk model error: the number of charge values does not match the number of delay values!";
227 if (it == x_.begin())
233 double x_low = *(--it);
234 double p = (
x - x_low) / (x_high - x_low);
239 threshold_values =
pset.getParameter<std::vector<double>>(
"ThresholdValues");
240 const auto& curve_psetvec =
pset.getParameter<std::vector<edm::ParameterSet>>(
"Curves");
241 if (threshold_values.size() != curve_psetvec.size())
243 <<
"Timewalk model error: the number of threshold values does not match the number of curves.";
244 for (
const auto& curve_pset : curve_psetvec)
245 curves.emplace_back(curve_pset);
249 auto index = find_closest_index(threshold_values, q_threshold);
250 return curves[
index](q_in);
254 double value)
const {
256 if (it == vec.begin())
258 else if (it == vec.end())
259 return vec.size() - 1;
262 auto it_lower = --it;
263 auto closest = (
value - *it_lower > *it_upper -
value) ? it_upper : it_lower;
274 float corrected_time = hitInfo->
time();