19 double ndep=0, ndep2=0, maxdep=0;
20 double nstr=0, nstr2=0;
21 double ncv=0, nval=0, nval2=0, maxv=0;
23 void dep(
double d) { ncall++; ndep+=
d; ndep2+=d*
d;maxdep=
std::max(d,maxdep);}
24 void str(
double d) { nstr+=
d; nstr2+=d*
d;}
25 void val(
double d) { ncv++; nval+=
d; nval2+=d*
d; maxv=
std::max(d,maxv);}
26 void zero() {
dzero++;}
28 std::cout <<
"deposits " << ncall <<
" " << maxdep <<
" " << ndep/ncall <<
" " <<
std::sqrt(ndep2*ncall -ndep*ndep)/ncall << std::endl;
30 std::cout <<
"strips " << nstr/ndep <<
" " <<
std::sqrt(nstr2*ndep -nstr*nstr)/ndep << std::endl;
31 std::cout <<
"vaules " << ncv <<
" " << maxv <<
" " << nval/ncv <<
" " <<
std::sqrt(nval2*ncv -nval*nval)/ncv << std::endl;
48 const std::string type[Ntypes] = {
"IB1",
"IB2",
"OB1",
"OB2",
"W1a",
"W2a",
"W3a",
"W1b",
"W2b",
"W3b",
"W4",
"W5",
"W6",
"W7"};
49 enum { indexOfIB1=0, indexOfIB2=1, indexOfOB1=2, indexOfOB2=3, indexOfW1a=4, indexOfW1b=7};
52 std::vector<std::vector<float> >
54 std::vector<std::vector<float> > signalCoupling;
55 signalCoupling.reserve(nTypes);
57 for(
int i=0;
i<nTypes; ++
i) {
58 auto dc = conf.
getParameter<std::vector<double> >(
"CouplingConstant"+mode+typeArray[
i]);
59 signalCoupling.emplace_back(dc.begin(),dc.end());
61 return signalCoupling;
79 chargeDeposited(
size_t strip,
size_t Nstrips,
double amplitude,
double chargeSpread,
double chargePosition) {
80 double integralUpToStrip = (strip == 0) ? 0. : (
approx_erf( (strip-chargePosition)/chargeSpread/1.41421356237309515 ) );
81 double integralUpToNext = (strip+1 == Nstrips) ? 1. : (
approx_erf( (strip+1-chargePosition)/chargeSpread/1.41421356237309515 ) );
83 return 0.5 * (integralUpToNext - integralUpToStrip) * amplitude;
91 : signalCoupling(fillSignalCoupling(conf, Ntypes, type)), Nsigma(3.), geVperElectron(g) {
98 std::vector<float>& localAmplitudes,
99 size_t& recordMinAffectedStrip,
100 size_t& recordMaxAffectedStrip,
104 induceVector(collection_points, det, localAmplitudes, recordMinAffectedStrip, recordMaxAffectedStrip, tTopo);
146 std::vector<float>& localAmplitudes,
147 size_t& recordMinAffectedStrip,
148 size_t& recordMaxAffectedStrip,
152 auto const & coupling = signalCoupling[typeOf(det,tTopo)];
154 const int Nstrips = topology.
nstrips();
156 if (Nstrips == 0)
return;
158 const int NP = collection_points.size();
164 for (
int ip=0; ip<NP; ip+=
MaxN) {
169 float chargePosition[
N];
170 float chargeSpread[
N];
176 for (
int i=0;
i!=
N;++
i) {
178 if (0==collection_points[
j].amplitude())
count.zero();
180 chargeSpread[
i]= collection_points[
j].sigma() / topology.
localPitch(collection_points[
j].
position());
185 for (
int i=0;
i!=
N;++
i) {
186 fromStrip[
i] =
std::max( 0,
int(std::floor( chargePosition[
i] -
Nsigma*chargeSpread[
i])) );
187 nStrip[
i] =
std::min( Nstrips,
int(std::ceil( chargePosition[i] +
Nsigma*chargeSpread[i])) ) - fromStrip[
i];
190 for (
int i=0;
i!=
N;++
i) tot += nStrip[
i];
197 for (
int i=0;
i!=
N;++
i) {
199 auto pos =
delta*(float(fromStrip[
i])-chargePosition[
i]);
203 for (
int j=0;
j<=nStrip[
i]; ++
j) {
211 for (
int k=0;
k!=tot; ++
k)
216 for (
int i=0;
i!=
N;++
i) {
217 if (0 == fromStrip[
i]) value[
kk]=0;
219 if (Nstrips == fromStrip[i]+nStrip[i]) value[
kk]=1.f;
225 for (
int k=0;k!=tot-1; ++
k)
226 value[k]-=value[k+1];
229 float charge[Nstrips];
for (
int i=0;
i!=Nstrips; ++
i) charge[
i]=0;
231 for (
int i=0;
i!=
N;++
i){
232 for (
int j=0;
j!=nStrip[
i]; ++
j)
233 charge[fromStrip[
i]+
j]-= amplitude[
i]*value[kk++];
240 int minA=recordMinAffectedStrip, maxA=recordMaxAffectedStrip;
241 int sc = coupling.size();
242 for (
int i=0;
i!=Nstrips; ++
i) {
244 if (0==charge[
i])
continue;
245 auto affectedFromStrip =
std::max( 0, strip - sc + 1);
246 auto affectedUntilStrip =
std::min(Nstrips, strip + sc);
247 for (
auto affectedStrip=affectedFromStrip; affectedStrip < affectedUntilStrip; ++affectedStrip)
248 localAmplitudes[affectedStrip] += charge[i] * coupling[
std::abs(affectedStrip - strip)] ;
250 if( affectedFromStrip < minA ) minA = affectedFromStrip;
251 if( affectedUntilStrip > maxA ) maxA = affectedUntilStrip;
253 recordMinAffectedStrip=minA;
254 recordMaxAffectedStrip=maxA;
263 std::vector<float>& localAmplitudes,
264 size_t& recordMinAffectedStrip,
265 size_t& recordMaxAffectedStrip,
269 auto const & coupling = signalCoupling[typeOf(det,tTopo)];
271 size_t Nstrips = topology.
nstrips();
273 if (!collection_points.empty())
count.dep(collection_points.size());
275 for (
auto signalpoint = collection_points.begin(); signalpoint != collection_points.end(); signalpoint++ ) {
278 double chargePosition = topology.
strip(signalpoint->position());
279 double chargeSpread = signalpoint->sigma() / topology.
localPitch(signalpoint->position());
281 size_t fromStrip = size_t(
std::max( 0,
int(std::floor( chargePosition -
Nsigma*chargeSpread))));
282 size_t untilStrip = size_t(
std::min( Nstrips,
size_t(std::ceil( chargePosition +
Nsigma*chargeSpread) )));
285 for (
size_t strip = fromStrip; strip < untilStrip; strip++) {
287 double chargeDepositedOnStrip = chargeDeposited( strip, Nstrips, signalpoint->amplitude() /
geVperElectron, chargeSpread, chargePosition);
289 size_t affectedFromStrip = size_t(
std::max( 0,
int(strip - coupling.size() + 1)));
290 size_t affectedUntilStrip = size_t(
std::min( Nstrips, strip + coupling.size()) );
291 for (
size_t affectedStrip = affectedFromStrip; affectedStrip < affectedUntilStrip; affectedStrip++) {
292 localAmplitudes.at( affectedStrip ) += chargeDepositedOnStrip * coupling.at(
abs( affectedStrip - strip )) ;
295 if( affectedFromStrip < recordMinAffectedStrip ) recordMinAffectedStrip = affectedFromStrip;
296 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
CaloTopology const * topology(0)
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
virtual float strip(const LocalPoint &) const =0
float approx_erf(float x)
virtual float localPitch(const LocalPoint &) const =0
virtual StripGeomDetType const & specificType() const
Abs< T >::type abs(const T &t)
DetId geographicalId() const
The label of this GeomDet.
const float geVperElectron
static int position[264][3]
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
SubDetector subDetector() 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