17 double ndep=0, ndep2=0, maxdep=0;
18 double nstr=0, nstr2=0;
19 double ncv=0, nval=0, nval2=0, maxv=0;
21 void dep(
double d) { ncall++; ndep+=d; ndep2+=d*d;maxdep=
std::max(d,maxdep);}
22 void str(
double d) { nstr+=d; nstr2+=d*d;}
23 void val(
double d) { ncv++; nval+=d; nval2+=d*d; maxv=
std::max(d,maxv);}
27 std::cout <<
"deposits " << ncall <<
" " << maxdep <<
" " << ndep/ncall <<
" " <<
std::sqrt(ndep2*ncall -ndep*ndep)/ncall << std::endl;
29 std::cout <<
"strips " << nstr/ndep <<
" " <<
std::sqrt(nstr2*ndep -nstr*nstr)/ndep << std::endl;
30 std::cout <<
"vaules " << ncv <<
" " << maxv <<
" " << nval/ncv <<
" " <<
std::sqrt(nval2*ncv -nval*nval)/ncv << std::endl;
42 const std::string type[Ntypes] = {
"IB1",
"IB2",
"OB1",
"OB2",
"W1a",
"W2a",
"W3a",
"W1b",
"W2b",
"W3b",
"W4",
"W5",
"W6",
"W7"};
43 enum { indexOfIB1=0, indexOfIB2=1, indexOfOB1=2, indexOfOB2=3, indexOfW1a=4, indexOfW1b=7};
46 std::vector<std::vector<float> >
48 std::vector<std::vector<float> > signalCoupling;
49 signalCoupling.reserve(nTypes);
51 for(
int i=0;
i<nTypes; ++
i) {
52 auto dc = conf.
getParameter<std::vector<double> >(
"CouplingConstant"+mode+typeArray[
i]);
53 signalCoupling.emplace_back(dc.begin(),dc.end());
55 return signalCoupling;
73 chargeDeposited(
size_t strip,
size_t Nstrips,
double amplitude,
double chargeSpread,
double chargePosition) {
74 double integralUpToStrip = (strip == 0) ? 0. : (
approx_erf( (strip-chargePosition)/chargeSpread/1.41421356237309515 ) );
75 double integralUpToNext = (strip+1 == Nstrips) ? 1. : (
approx_erf( (strip+1-chargePosition)/chargeSpread/1.41421356237309515 ) );
77 return 0.5 * (integralUpToNext - integralUpToStrip) * amplitude;
85 : signalCoupling(fillSignalCoupling(conf, Ntypes, type)), Nsigma(3.), geVperElectron(g) {
92 std::vector<float>& localAmplitudes,
93 size_t& recordMinAffectedStrip,
94 size_t& recordMaxAffectedStrip,
98 induceVector(collection_points, det, localAmplitudes, recordMinAffectedStrip, recordMaxAffectedStrip, tTopo);
140 std::vector<float>& localAmplitudes,
141 size_t& recordMinAffectedStrip,
142 size_t& recordMaxAffectedStrip,
146 auto const & coupling = signalCoupling[typeOf(det,tTopo)];
148 const int Nstrips = topology.
nstrips();
151 const int NP = collection_points.size();
157 for (
int ip=0; ip<NP; ip+=MaxN) {
162 float chargePosition[
N];
163 float chargeSpread[
N];
169 for (
int i=0;
i!=
N;++
i) {
171 if (0==collection_points[
j].amplitude())
count.zero();
173 chargeSpread[
i]= collection_points[
j].sigma() / topology.
localPitch(collection_points[
j].
position());
178 for (
int i=0;
i!=
N;++
i) {
179 fromStrip[
i] =
std::max( 0,
int(std::floor( chargePosition[
i] -
Nsigma*chargeSpread[
i])) );
180 nStrip[
i] =
std::min( Nstrips,
int(std::ceil( chargePosition[i] +
Nsigma*chargeSpread[i])) ) - fromStrip[
i];
183 for (
int i=0;
i!=
N;++
i) tot += nStrip[
i];
190 for (
int i=0;
i!=
N;++
i) {
192 auto pos =
delta*(float(fromStrip[
i])-chargePosition[
i]);
193 for (
int j=0;
j<=nStrip[
i]; ++
j)
199 for (
int k=0;
k!=tot; ++
k)
204 for (
int i=0;
i!=
N;++
i) {
205 if (0 == fromStrip[
i]) value[kk]=0;
207 if (Nstrips == fromStrip[i]+nStrip[i]) value[kk]=1.f;
213 for (
int k=0;k!=tot-1; ++
k)
214 value[k]-=value[k+1];
217 float charge[Nstrips];
for (
int i=0;
i!=Nstrips; ++
i) charge[
i]=0;
219 for (
int i=0;
i!=
N;++
i){
220 for (
int j=0;
j!=nStrip[
i]; ++
j)
221 charge[fromStrip[
i]+
j]-= amplitude[
i]*value[kk++];
228 int minA=recordMinAffectedStrip, maxA=recordMaxAffectedStrip;
229 int sc = coupling.size();
230 for (
int i=0;
i!=Nstrips; ++
i) {
232 if (0==charge[
i])
continue;
233 auto affectedFromStrip =
std::max( 0, strip - sc + 1);
234 auto affectedUntilStrip =
std::min(Nstrips, strip + sc);
235 for (
auto affectedStrip=affectedFromStrip; affectedStrip < affectedUntilStrip; ++affectedStrip)
236 localAmplitudes[affectedStrip] += charge[i] * coupling[
std::abs(affectedStrip - strip)] ;
238 if( affectedFromStrip < minA ) minA = affectedFromStrip;
239 if( affectedUntilStrip > maxA ) maxA = affectedUntilStrip;
241 recordMinAffectedStrip=minA;
242 recordMaxAffectedStrip=maxA;
251 std::vector<float>& localAmplitudes,
252 size_t& recordMinAffectedStrip,
253 size_t& recordMaxAffectedStrip,
257 auto const & coupling = signalCoupling[typeOf(det,tTopo)];
259 size_t Nstrips = topology.
nstrips();
261 if (!collection_points.empty())
count.dep(collection_points.size());
263 for (
auto signalpoint = collection_points.begin(); signalpoint != collection_points.end(); signalpoint++ ) {
266 double chargePosition = topology.
strip(signalpoint->position());
267 double chargeSpread = signalpoint->sigma() / topology.
localPitch(signalpoint->position());
269 size_t fromStrip = size_t(
std::max( 0,
int(std::floor( chargePosition -
Nsigma*chargeSpread))));
270 size_t untilStrip = size_t(
std::min( Nstrips,
size_t(std::ceil( chargePosition +
Nsigma*chargeSpread) )));
273 for (
size_t strip = fromStrip; strip < untilStrip; strip++) {
275 double chargeDepositedOnStrip = chargeDeposited( strip, Nstrips, signalpoint->amplitude() /
geVperElectron, chargeSpread, chargePosition);
277 size_t affectedFromStrip = size_t(
std::max( 0,
int(strip - coupling.size() + 1)));
278 size_t affectedUntilStrip = size_t(
std::min( Nstrips, strip + coupling.size()) );
279 for (
size_t affectedStrip = affectedFromStrip; affectedStrip < affectedUntilStrip; affectedStrip++) {
280 localAmplitudes.at( affectedStrip ) += chargeDepositedOnStrip * coupling.at(
abs( affectedStrip - strip )) ;
283 if( affectedFromStrip < recordMinAffectedStrip ) recordMinAffectedStrip = affectedFromStrip;
284 if( affectedUntilStrip > recordMaxAffectedStrip ) recordMaxAffectedStrip = affectedUntilStrip;
T getParameter(std::string const &) const
virtual int nstrips() const =0
unsigned int tibLayer(const DetId &id) const
unsigned int tidRing(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
std::vector< SignalPoint > collection_type
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
int dzero(double a, double b, double &x0, double &rv, double eps, int mxf, F func)
Private version of the exponential integral.
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
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
static int position[TOTALCHAMBERS][3]
virtual float strip(const LocalPoint &) const =0
float approx_erf(float x)
virtual float localPitch(const LocalPoint &) const =0
const T & max(const T &a, const T &b)
DetId geographicalId() const
The label of this GeomDet.
virtual StripGeomDetType & specificType() const
const float geVperElectron
SiTrivialInduceChargeOnStrips(const edm::ParameterSet &conf, double g)
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
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