17 using namespace sipixelobjects;
20 if (use_ineff_from_db_)
21 theSiPixelGainCalibrationService_->setESObjects(es);
23 if (use_deadmodule_DB_)
24 siPixelBadModule_ = &es.
getData(siPixelBadModuleToken_);
26 if (use_LorentzAngle_DB_)
27 siPixelLorentzAngle_ = &es.
getData(siPixelLorentzAngleToken_);
30 fedCablingMap_ = &es.
getData(fedCablingMapToken_);
31 geom_ = &es.
getData(geomToken_);
36 conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm"),
38 odd_row_interchannelCoupling_next_row_(conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
39 .getParameter<double>(
"Odd_row_interchannelCoupling_next_row")),
40 even_row_interchannelCoupling_next_row_(conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
41 .getParameter<double>(
"Even_row_interchannelCoupling_next_row")),
42 odd_column_interchannelCoupling_next_column_(
43 conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
44 .getParameter<double>(
"Odd_column_interchannelCoupling_next_column")),
45 even_column_interchannelCoupling_next_column_(
46 conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
47 .getParameter<double>(
"Even_column_interchannelCoupling_next_column")),
48 apply_timewalk_(conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm").getParameter<bool>(
"ApplyTimewalk")),
58 LogDebug(
"PixelDigitizerAlgorithm") <<
"Algorithm constructed "
59 <<
"Configuration parameters:"
60 <<
"Threshold/Gain = "
64 <<
" The delta cut-off is set to " <<
tMax_ <<
" pix-inefficiency "
72 double time = hit.
tof() - tCorr;
88 const float pitch_first = 0.0025;
89 const float pitch_second = 0.0100;
92 const double pitch_tolerance(0.0005);
94 if (
std::abs(topol->
pitch().first - pitch_first) > pitch_tolerance ||
95 std::abs(topol->
pitch().second - pitch_second) > pitch_tolerance)
102 int numRows = topol->
nrows();
105 for (
auto&
s : theSignal) {
106 float signalInElectrons =
s.second.ampl();
112 float signalInElectrons_odd_column_Xtalk_next_column =
114 float signalInElectrons_even_column_Xtalk_next_column =
118 s.second.set(signalInElectrons - signalInElectrons_odd_row_Xtalk_next_row -
119 signalInElectrons_even_row_Xtalk_next_row - signalInElectrons_odd_column_Xtalk_next_column -
120 signalInElectrons_even_column_Xtalk_next_column);
122 if (hitChan.first != 0) {
123 auto XtalkPrev = std::make_pair(hitChan.first - 1, hitChan.second);
126 if (hitChan.first % 2 == 1)
127 signalNew.emplace(chanXtalkPrev,
130 signalNew.emplace(chanXtalkPrev,
133 if (hitChan.first < numRows - 1) {
134 auto XtalkNext = std::make_pair(hitChan.first + 1, hitChan.second);
137 if (hitChan.first % 2 == 1)
138 signalNew.emplace(chanXtalkNext,
141 signalNew.emplace(chanXtalkNext,
145 if (hitChan.second != 0) {
146 auto XtalkPrev = std::make_pair(hitChan.first, hitChan.second - 1);
149 if (hitChan.second % 2 == 1)
150 signalNew.emplace(chanXtalkPrev,
153 signalNew.emplace(chanXtalkPrev,
156 if (hitChan.second < numColumns - 1) {
157 auto XtalkNext = std::make_pair(hitChan.first, hitChan.second + 1);
160 if (hitChan.second % 2 == 1)
161 signalNew.emplace(chanXtalkNext,
164 signalNew.emplace(chanXtalkNext,
168 for (
auto const&
l : signalNew) {
170 auto iter = theSignal.find(chan);
171 if (iter != theSignal.end()) {
172 iter->second +=
l.second.ampl();
180 : x_(pset.getParameter<std::
vector<double>>(
"charge")), y_(pset.getParameter<std::
vector<double>>(
"delay")) {
181 if (
x_.size() !=
y_.size())
183 <<
"Timewalk model error: the number of charge values does not match the number of delay values!";
188 if (it == x_.begin())
194 double x_low = *(--it);
195 double p = (x - x_low) / (x_high - x_low);
196 return p * y_[
index] + (1 -
p) * y_[index - 1];
200 threshold_values = pset.
getParameter<std::vector<double>>(
"ThresholdValues");
201 const auto& curve_psetvec = pset.
getParameter<std::vector<edm::ParameterSet>>(
"Curves");
202 if (threshold_values.size() != curve_psetvec.size())
204 <<
"Timewalk model error: the number of threshold values does not match the number of curves.";
205 for (
const auto& curve_pset : curve_psetvec)
206 curves.emplace_back(curve_pset);
210 auto index = find_closest_index(threshold_values, q_threshold);
211 return curves[
index](q_in);
215 double value)
const {
217 if (it == vec.begin())
219 else if (it == vec.end())
220 return vec.size() - 1;
223 auto it_lower = --it;
224 auto closest = (value - *it_lower > *it_upper -
value) ? it_upper : it_lower;
237 float corrected_time = hitInfo->
time();
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > siPixelBadModuleToken_
float tof() const
deprecated name for timeOfFlight()
const float theElectronPerADC_
void init(const edm::EventSetup &es) override
static std::pair< int, int > channelToPixel(int ch)
virtual int ncolumns() const =0
tuple chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
constexpr uint32_t rawId() const
get the raw id
virtual int nrows() const =0
double even_row_interchannelCoupling_next_row_
const float theThresholdInE_Endcap_
const TimewalkModel timewalk_model_
const bool use_LorentzAngle_DB_
static int pixelToChannel(int row, int col)
bool getData(T &iHolder) const
const bool use_deadmodule_DB_
void add_cross_talk(const Phase2TrackerGeomDetUnit *pixdet) override
bool isAboveThreshold(const DigitizerUtility::SimHitInfo *hitInfo, float charge, float thr) const override
static PackedDigiType pixelToChannel(unsigned int row, unsigned int col)
TimewalkCurve(const edm::ParameterSet &pset)
const bool addPixelInefficiency_
double even_column_interchannelCoupling_next_column_
Abs< T >::type abs(const T &t)
const float theThresholdInE_Barrel_
DetId geographicalId() const
The label of this GeomDet.
std::map< int, DigitizerUtility::Amplitude, std::less< int > > signal_map_type
bool select_hit(const PSimHit &hit, double tCorr, double &sigScale) const override
const float theTofLowerCut_
TimewalkModel(const edm::ParameterSet &pset)
std::size_t find_closest_index(const std::vector< double > &vec, double value) const
double operator()(double q_in, double q_threshold) const
PixelDigitizerAlgorithm(const edm::ParameterSet &conf, edm::ConsumesCollector iC)
double odd_column_interchannelCoupling_next_column_
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
T getParameter(std::string const &) const
double odd_row_interchannelCoupling_next_row_
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
const int theAdcFullScale_
edm::ESGetToken< SiPixelLorentzAngle, SiPixelLorentzAngleSimRcd > siPixelLorentzAngleToken_
virtual std::pair< float, float > pitch() const =0
double operator()(double x) const
const float theTofUpperCut_
~PixelDigitizerAlgorithm() override