20 double ndep = 0, ndep2 = 0, maxdep = 0;
21 double nstr = 0, nstr2 = 0;
22 double ncv = 0, nval = 0, nval2 = 0, maxv = 0;
42 std::cout <<
"deposits " << ncall <<
" " << maxdep <<
" " << ndep / ncall <<
" " 43 <<
std::sqrt(ndep2 * ncall - ndep * ndep) / ncall << std::endl;
45 std::cout <<
"strips " << nstr / ndep <<
" " <<
std::sqrt(nstr2 * ndep - nstr * nstr) / ndep << std::endl;
46 std::cout <<
"vaules " << ncv <<
" " << maxv <<
" " << nval / ncv <<
" " 47 <<
std::sqrt(nval2 * ncv - nval * nval) / ncv << std::endl;
52 void dep(
double)
const {}
53 void str(
double)
const {}
54 void val(
double)
const {}
63 constexpr
int Ntypes = 14;
66 "IB1",
"IB2",
"OB1",
"OB2",
"W1a",
"W2a",
"W3a",
"W1b",
"W2b",
"W3b",
"W4",
"W5",
"W6",
"W7"};
67 enum { indexOfIB1 = 0, indexOfIB2 = 1, indexOfOB1 = 2, indexOfOB2 = 3, indexOfW1a = 4, indexOfW1b = 7 };
69 inline std::vector<std::vector<float> > fillSignalCoupling(
const edm::ParameterSet& conf,
72 std::vector<std::vector<float> > signalCoupling;
73 signalCoupling.reserve(nTypes);
75 for (
int i = 0;
i < nTypes; ++
i) {
77 if (typeArray[
i].
find(
'W') != std::string::npos &&
mode ==
"Dec")
79 else if (typeArray[
i].
find(
'B') != std::string::npos &&
mode ==
"Dec")
83 signalCoupling.emplace_back(dc.begin(), dc.end());
85 return signalCoupling;
92 return (tTopo->
tibLayer(
id) < 3) ? indexOfIB1 : indexOfIB2;
95 return (tTopo->
tobLayer(
id) > 4) ? indexOfOB1 : indexOfOB2;
98 return indexOfW1a - 1 + tTopo->
tidRing(
id);
101 return indexOfW1b - 1 + tTopo->
tecRing(
id);
108 inline double chargeDeposited(
109 size_t strip,
size_t Nstrips,
double amplitude,
double chargeSpread,
double chargePosition) {
110 double integralUpToStrip =
111 (
strip == 0) ? 0. : (
approx_erf((
strip - chargePosition) / chargeSpread / 1.41421356237309515));
112 double integralUpToNext =
113 (
strip + 1 == Nstrips) ? 1. : (
approx_erf((
strip + 1 - chargePosition) / chargeSpread / 1.41421356237309515));
115 return 0.5 * (integralUpToNext - integralUpToStrip) *
amplitude;
121 : signalCoupling(fillSignalCoupling(conf, Ntypes,
type)), Nsigma(3.), geVperElectron(
g) {}
125 std::vector<float>& localAmplitudes,
126 size_t& recordMinAffectedStrip,
127 size_t& recordMaxAffectedStrip,
129 induceVector(collection_points, det, localAmplitudes, recordMinAffectedStrip, recordMaxAffectedStrip, tTopo);
168 std::vector<float>& localAmplitudes,
169 size_t& recordMinAffectedStrip,
170 size_t& recordMaxAffectedStrip,
174 const int Nstrips = topology.
nstrips();
179 const int NP = collection_points.size();
183 constexpr
int MaxN = 512;
186 for (
int ip = 0; ip < NP; ip +=
MaxN) {
191 float chargePosition[
N];
192 float chargeSpread[
N];
198 for (
int i = 0;
i !=
N; ++
i) {
203 chargeSpread[
i] = collection_points[
j].sigma() / topology.
localPitch(collection_points[
j].
position());
208 for (
int i = 0;
i !=
N; ++
i) {
209 fromStrip[
i] =
std::max(0,
int(std::floor(chargePosition[
i] -
Nsigma * chargeSpread[
i])));
213 for (
int i = 0;
i !=
N; ++
i)
221 for (
int i = 0;
i !=
N; ++
i) {
227 for (
int j = 0;
j <= nStrip[
i]; ++
j) {
235 for (
int k = 0;
k !=
tot; ++
k)
240 for (
int i = 0;
i !=
N; ++
i) {
241 if (0 == fromStrip[
i])
244 if (Nstrips == fromStrip[
i] + nStrip[
i])
251 for (
int k = 0;
k !=
tot - 1; ++
k)
255 for (
int i = 0;
i != Nstrips; ++
i)
258 for (
int i = 0;
i !=
N; ++
i) {
259 for (
int j = 0;
j != nStrip[
i]; ++
j)
266 int minA = recordMinAffectedStrip, maxA = recordMaxAffectedStrip;
267 int sc = coupling.size();
268 for (
int i = 0;
i != Nstrips; ++
i) {
274 for (
auto affectedStrip = affectedFromStrip; affectedStrip < affectedUntilStrip; ++affectedStrip)
277 if (affectedFromStrip < minA)
278 minA = affectedFromStrip;
279 if (affectedUntilStrip > maxA)
280 maxA = affectedUntilStrip;
282 recordMinAffectedStrip = minA;
283 recordMaxAffectedStrip = maxA;
289 std::vector<float>& localAmplitudes,
290 size_t& recordMinAffectedStrip,
291 size_t& recordMaxAffectedStrip,
295 size_t Nstrips = topology.
nstrips();
297 if (!collection_points.empty())
298 count.dep(collection_points.size());
300 for (
auto signalpoint = collection_points.begin(); signalpoint != collection_points.end(); signalpoint++) {
302 double chargePosition = topology.
strip(signalpoint->position());
303 double chargeSpread = signalpoint->sigma() / topology.
localPitch(signalpoint->position());
305 size_t fromStrip = size_t(
std::max(0,
int(std::floor(chargePosition -
Nsigma * chargeSpread))));
310 double chargeDepositedOnStrip =
311 chargeDeposited(
strip, Nstrips, signalpoint->amplitude() /
geVperElectron, chargeSpread, chargePosition);
313 size_t affectedFromStrip = size_t(
std::max(0,
int(
strip - coupling.size() + 1)));
314 size_t affectedUntilStrip = size_t(
std::min(Nstrips,
strip + coupling.size()));
315 for (
size_t affectedStrip = affectedFromStrip; affectedStrip < affectedUntilStrip; affectedStrip++) {
316 localAmplitudes.at(affectedStrip) +=
317 chargeDepositedOnStrip * coupling.at((
size_t)
std::abs((
int)affectedStrip - (
int)
strip));
320 if (affectedFromStrip < recordMinAffectedStrip)
321 recordMinAffectedStrip = affectedFromStrip;
322 if (affectedUntilStrip > recordMaxAffectedStrip)
323 recordMaxAffectedStrip = affectedUntilStrip;
constexpr int32_t ceil(float num)
virtual int nstrips() const =0
T getParameter(std::string const &) const
unsigned int tobLayer(const DetId &id) const
void induceOriginal(const SiChargeCollectionDrifter::collection_type &collection_points, const StripGeomDetUnit &det, std::vector< float > &localAmplitudes, size_t &recordMinAffectedStrip, size_t &recordMaxAffectedStrip, const TrackerTopology *tTopo) const
SubDetector subDetector() const
const std::vector< std::vector< float > > signalCoupling
std::vector< SignalPoint > collection_type
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int dzero(double a, double b, double &x0, double &rv, double eps, int mxf, F func)
Private version of the exponential integral.
unsigned int tecRing(const DetId &id) const
ring id
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
virtual float strip(const LocalPoint &) const =0
virtual float localPitch(const LocalPoint &) const =0
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Abs< T >::type abs(const T &t)
virtual StripGeomDetType const & specificType() const
DetId geographicalId() const
The label of this GeomDet.
void induce(const SiChargeCollectionDrifter::collection_type &collection_points, const StripGeomDetUnit &det, std::vector< float > &localAmplitudes, size_t &recordMinAffectedStrip, size_t &recordMaxAffectedStrip, const TrackerTopology *tTopo) const override
const float geVperElectron
constexpr float approx_erf(float x)
static int position[264][3]
unsigned int tidRing(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
void induceVector(const SiChargeCollectionDrifter::collection_type &collection_points, const StripGeomDetUnit &det, std::vector< float > &localAmplitudes, size_t &recordMinAffectedStrip, size_t &recordMaxAffectedStrip, const TrackerTopology *tTopo) const
SiTrivialInduceChargeOnStrips(const edm::ParameterSet &conf, double g)