25 if (use_ineff_from_db_)
26 theSiPixelGainCalibrationService_->setESObjects(es);
28 if (use_deadmodule_DB_)
29 siPixelBadModule_ = &es.
getData(siPixelBadModuleToken_);
31 if (use_LorentzAngle_DB_)
32 siPixelLorentzAngle_ = &es.
getData(siPixelLorentzAngleToken_);
34 geom_ = &es.
getData(geomToken_);
35 if (useChargeReweighting_) {
36 theSiPixelChargeReweightingAlgorithm_->init(es);
42 conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm"),
44 odd_row_interchannelCoupling_next_row_(conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
45 .getParameter<double>(
"Odd_row_interchannelCoupling_next_row")),
46 even_row_interchannelCoupling_next_row_(conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
47 .getParameter<double>(
"Even_row_interchannelCoupling_next_row")),
48 odd_column_interchannelCoupling_next_column_(
49 conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
50 .getParameter<double>(
"Odd_column_interchannelCoupling_next_column")),
51 even_column_interchannelCoupling_next_column_(
52 conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm")
53 .getParameter<double>(
"Even_column_interchannelCoupling_next_column")),
54 apply_timewalk_(conf.getParameter<
ParameterSet>(
"PixelDigitizerAlgorithm").getParameter<
bool>(
"ApplyTimewalk")),
63 LogDebug(
"PixelDigitizerAlgorithm") <<
"Algorithm constructed " 64 <<
"Configuration parameters:" 65 <<
"Threshold/Gain = " 69 <<
" The delta cut-off is set to " <<
tMax_ <<
" pix-inefficiency " 80 double toa =
hit.tof() - tCorr;
96 const float pitch_first = 0.0025;
97 const float pitch_second = 0.0100;
100 const double pitch_tolerance(0.0005);
102 if (
std::abs(topol->
pitch().first - pitch_first) > pitch_tolerance ||
103 std::abs(topol->
pitch().second - pitch_second) > pitch_tolerance)
110 int numRows = topol->
nrows();
113 for (
auto&
s : theSignal) {
114 float signalInElectrons =
s.second.ampl();
120 float signalInElectrons_odd_column_Xtalk_next_column =
122 float signalInElectrons_even_column_Xtalk_next_column =
126 s.second.set(signalInElectrons - signalInElectrons_odd_row_Xtalk_next_row -
127 signalInElectrons_even_row_Xtalk_next_row - signalInElectrons_odd_column_Xtalk_next_column -
128 signalInElectrons_even_column_Xtalk_next_column);
130 if (hitChan.first != 0) {
131 auto XtalkPrev = std::make_pair(hitChan.first - 1, hitChan.second);
134 if (hitChan.first % 2 == 1)
135 signalNew.emplace(chanXtalkPrev,
138 signalNew.emplace(chanXtalkPrev,
141 if (hitChan.first < numRows - 1) {
142 auto XtalkNext = std::make_pair(hitChan.first + 1, hitChan.second);
145 if (hitChan.first % 2 == 1)
146 signalNew.emplace(chanXtalkNext,
149 signalNew.emplace(chanXtalkNext,
153 if (hitChan.second != 0) {
154 auto XtalkPrev = std::make_pair(hitChan.first, hitChan.second - 1);
157 if (hitChan.second % 2 == 1)
166 if (hitChan.second < numColumns - 1) {
167 auto XtalkNext = std::make_pair(hitChan.first, hitChan.second + 1);
170 if (hitChan.second % 2 == 1)
180 for (
auto const&
l : signalNew) {
182 auto iter = theSignal.find(
chan);
183 if (iter != theSignal.end()) {
184 iter->second +=
l.second.ampl();
193 if (
x_.size() !=
y_.size())
195 <<
"Timewalk model error: the number of charge values does not match the number of delay values!";
200 if (
it == x_.begin())
206 double x_low = *(--
it);
207 double p = (
x - x_low) / (x_high - x_low);
212 threshold_values =
pset.getParameter<std::vector<double>>(
"ThresholdValues");
213 const auto& curve_psetvec =
pset.getParameter<std::vector<edm::ParameterSet>>(
"Curves");
214 if (threshold_values.size() != curve_psetvec.size())
216 <<
"Timewalk model error: the number of threshold values does not match the number of curves.";
217 for (
const auto& curve_pset : curve_psetvec)
218 curves.emplace_back(curve_pset);
222 auto index = find_closest_index(threshold_values, q_threshold);
223 return curves[
index](q_in);
227 double value)
const {
229 if (
it == vec.begin())
231 else if (
it == vec.end())
232 return vec.size() - 1;
235 auto it_lower = --
it;
249 float corrected_time = hitInfo->
time();
259 throw cms::Exception(
"PixelDigitizerAlgorithm") <<
"Trying to kill modules from the pixel digitizer." 260 <<
" This method is not yet implemented!";
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > siPixelBadModuleToken_
const float theElectronPerADC_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void init(const edm::EventSetup &es) override
static std::pair< int, int > channelToPixel(int ch)
virtual int ncolumns() const =0
int closest(std::vector< int > const &vec, int value)
void module_killing_DB(const Phase2TrackerGeomDetUnit *pixdet) override
virtual int nrows() const =0
double even_row_interchannelCoupling_next_row_
const float theThresholdInE_Endcap_
std::map< int, digitizerUtility::Ph2Amplitude, std::less< int > > signal_map_type
const TimewalkModel timewalk_model_
const bool use_LorentzAngle_DB_
static int pixelToChannel(int row, int col)
const bool use_deadmodule_DB_
void add_cross_talk(const Phase2TrackerGeomDetUnit *pixdet) override
double operator()(double q_in, double q_threshold) const
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.
bool select_hit(const PSimHit &hit, double tCorr, double &sigScale) const override
const float theTofLowerCut_
TimewalkModel(const edm::ParameterSet &pset)
PixelDigitizerAlgorithm(const edm::ParameterSet &conf, edm::ConsumesCollector iC)
constexpr uint32_t rawId() const
get the raw id
double odd_column_interchannelCoupling_next_column_
double odd_row_interchannelCoupling_next_row_
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
bool isAboveThreshold(const digitizerUtility::SimHitInfo *hitInfo, float charge, float thr) const override
std::size_t find_closest_index(const std::vector< double > &vec, double value) const
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
const int theAdcFullScale_
edm::ESGetToken< SiPixelLorentzAngle, SiPixelLorentzAngleSimRcd > siPixelLorentzAngleToken_
virtual std::pair< float, float > pitch() const =0
const float theTofUpperCut_
~PixelDigitizerAlgorithm() override
double operator()(double x) const