FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndSdsCalcStripDif Class Reference

Class for calculating strip indices from wafer hits. More...

#include <PndSdsCalcStripDif.h>

Public Member Functions

 PndSdsCalcStripDif ()
 
 PndSdsCalcStripDif (Double_t pitch, Double_t orient, Int_t nrStrips, Int_t nrFeChannels, const TVector2 &firstStripAnchor, Double_t threshold, Double_t noise, Double_t sigma)
 
 PndSdsCalcStripDif (const PndSdsStripDigiPar *digipar, SensorSide side=kTOP)
 
std::vector< PndSdsStripGetStrips (Double_t inx, Double_t iny, Double_t inz, Double_t outx, Double_t outy, Double_t outz, Double_t eLoss)
 
Int_t CalcFEfromStrip (Int_t stripNr) const
 
Int_t CalcChannelfromStrip (Int_t stripNr) const
 
void CalcFeChToStrip (Int_t fe, Int_t channel, Int_t &strip, enum SensorSide &side) const
 
void CalcStripPointOnLine (const Double_t strip, TVector2 &point) const
 
const TVector2 GetStripDirection () const
 
void SetVerboseLevel (Int_t level)
 
std::ostreamoperator<< (std::ostream &out)
 
Double_t ChargeDiffusion (Double_t u, Double_t a, Double_t path, Double_t dir, Double_t Q)
 
void Print () const
 

Private Member Functions

Double_t CalcStripFromPoint (Double_t x, Double_t y)
 
Double_t SmearCharge (Double_t charge)
 
const Double_t ChargeFromEloss (Double_t eloss) const
 

Private Attributes

Double_t fPitch
 
Double_t fOrient
 strip pitch (cm) More...
 
Int_t fNrStrips
 strip orientation angle to x axis More...
 
Int_t fNrFeChannels
 Nr. of strips on active area. More...
 
TVector2 fAnchor
 Nr of Channels per FE. More...
 
Double_t fThreshold
 anchor point on first strip More...
 
Double_t fNoise
 charge threshold More...
 
TVector2 fStripDir
 ENC. More...
 
TVector2 fOrthoDir
 vector perpendicular to strip direction More...
 
TRandom3 * fRNG
 vector orthogonal to strip direction More...
 
Int_t fVerboseLevel
 Random Number Generator. More...
 
Double_t fSigma
 

Detailed Description

Class for calculating strip indices from wafer hits.

Author
HG Zaunick hg.za.nosp@m.unic.nosp@m.k@phy.nosp@m.sik..nosp@m.tu-dr.nosp@m.esde.nosp@m.n.de

Definition at line 32 of file PndSdsCalcStripDif.h.

Constructor & Destructor Documentation

PndSdsCalcStripDif::PndSdsCalcStripDif ( )

Default constructor No reason to use it

Definition at line 17 of file PndSdsCalcStripDif.cxx.

References fAnchor, fNoise, fNrStrips, fOrient, fPitch, fRNG, fThreshold, and fVerboseLevel.

17  {
18  fPitch = 0.;
19  fOrient = 0.;
20  fAnchor = TVector2(0.,0.);
21  fNrStrips = 0;
22  fThreshold = 0.;
23  fNoise = 0.;
24  fVerboseLevel = 0;
25  fRNG = new TRandom3();
26 }
Double_t fThreshold
anchor point on first strip
Double_t fNoise
charge threshold
Int_t fVerboseLevel
Random Number Generator.
TRandom3 * fRNG
vector orthogonal to strip direction
Int_t fNrStrips
strip orientation angle to x axis
Double_t fOrient
strip pitch (cm)
TVector2 fAnchor
Nr of Channels per FE.
PndSdsCalcStripDif::PndSdsCalcStripDif ( Double_t  pitch,
Double_t  orient,
Int_t  nrStrips,
Int_t  nrFeChannels,
const TVector2 &  firstStripAnchor,
Double_t  threshold,
Double_t  noise,
Double_t  sigma 
)

Constructor Create Object with all necessary parameters

Parameters
pitchPitch between Strips (=width of strips)
orientOrientation Angle of Strips in x-y-Plane from x-Axis
nrStripsNumber of Strips in the active area
nrFeChannelsNumber of Channels per Frontend
firstStripAnchorCoordinate in x-y-Plane which belongs to the first Strip (Index 0). Usually this is the readout point of the strip
thresholdCharge-Threshold applied to the signal (electrons)
noiseNoise superimposed to the signal (electrons)

Definition at line 28 of file PndSdsCalcStripDif.cxx.

References cos(), fOrient, fOrthoDir, fRNG, fSigma, fStripDir, fVerboseLevel, sigma, and sin().

32 : fPitch(pitch), fOrient(orient),
34 fAnchor(firstStripAnchor),
36 {
39  fVerboseLevel = 0;
40  fRNG = new TRandom3();
41  fSigma = sigma;
42  //Print();
43 }
Double_t fThreshold
anchor point on first strip
Double_t fNoise
charge threshold
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t sigma[nsteps]
Definition: dedx_bands.C:65
int nrStrips
Definition: anaLmdDigi.C:76
Int_t fVerboseLevel
Random Number Generator.
TRandom3 * fRNG
vector orthogonal to strip direction
int nrFeChannels
Definition: anaLmdDigi.C:75
Int_t fNrFeChannels
Nr. of strips on active area.
double threshold
Int_t fNrStrips
strip orientation angle to x axis
Double_t fOrient
strip pitch (cm)
TVector2 fAnchor
Nr of Channels per FE.
double orient
double noise
TVector2 fOrthoDir
vector perpendicular to strip direction
PndSdsCalcStripDif::PndSdsCalcStripDif ( const PndSdsStripDigiPar digipar,
SensorSide  side = kTOP 
)

Definition at line 45 of file PndSdsCalcStripDif.cxx.

References cos(), fAnchor, fNoise, fNrFeChannels, fNrStrips, fOrient, fOrthoDir, fPitch, fRNG, fStripDir, fThreshold, fVerboseLevel, PndSdsStripDigiPar::GetBotAnchor(), PndSdsStripDigiPar::GetBotPitch(), PndSdsStripDigiPar::GetNoise(), PndSdsStripDigiPar::GetNrBotFE(), PndSdsStripDigiPar::GetNrFECh(), PndSdsStripDigiPar::GetNrTopFE(), PndSdsStripDigiPar::GetOrient(), PndSdsStripDigiPar::GetSkew(), PndSdsStripDigiPar::GetThreshold(), PndSdsStripDigiPar::GetTopAnchor(), PndSdsStripDigiPar::GetTopPitch(), kBOTTOM, kTOP, Print(), and sin().

46 {
47  if(side == kTOP)
48  {
49  fPitch = digipar->GetTopPitch();
50  fOrient = digipar->GetOrient();
51  fAnchor = digipar->GetTopAnchor();
52  fNrStrips = digipar->GetNrTopFE()*digipar->GetNrFECh();
53  }
54  else if(side == kBOTTOM)
55  {
56  fPitch = digipar->GetBotPitch();
57  fOrient = digipar->GetOrient() + digipar->GetSkew();
58  fAnchor = digipar->GetBotAnchor();
59  fNrStrips = digipar->GetNrBotFE()*digipar->GetNrFECh();
60  }
61  fNrFeChannels = digipar->GetNrFECh();
62  fThreshold = digipar->GetThreshold();
63  fNoise = digipar->GetNoise();
64 
67  fVerboseLevel = 0;
68  fRNG = new TRandom3();
69  if (fVerboseLevel > 0) Print();
70 }
Double_t fThreshold
anchor point on first strip
Double_t fNoise
charge threshold
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
TVector2 GetBotAnchor() const
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t GetNoise() const
Double_t GetThreshold() const
Int_t fVerboseLevel
Random Number Generator.
Double_t GetOrient() const
TRandom3 * fRNG
vector orthogonal to strip direction
Double_t GetSkew() const
Int_t fNrFeChannels
Nr. of strips on active area.
Int_t fNrStrips
strip orientation angle to x axis
Int_t GetNrFECh() const
Double_t GetBotPitch() const
Double_t fOrient
strip pitch (cm)
TVector2 fAnchor
Nr of Channels per FE.
Int_t GetNrTopFE() const
Int_t GetNrBotFE() const
TVector2 GetTopAnchor() const
Double_t GetTopPitch() const
TVector2 fOrthoDir
vector perpendicular to strip direction

Member Function Documentation

Int_t PndSdsCalcStripDif::CalcChannelfromStrip ( Int_t  stripNr) const

Calculate Channel index (on Frontend) from strip-index

Parameters
stripNrstrip index
Returns
channel on frontend

Definition at line 438 of file PndSdsCalcStripDif.cxx.

References fNrFeChannels.

Referenced by PndSdsStripHitProducerDif::Exec().

438 { return (stripNr%fNrFeChannels); }
Int_t fNrFeChannels
Nr. of strips on active area.
void PndSdsCalcStripDif::CalcFeChToStrip ( Int_t  fe,
Int_t  channel,
Int_t &  strip,
enum SensorSide side 
) const

Calculate global strip index from Frontend number and -channel

Parameters
fefrontend number
channelfrontend channel
stripglobal strip index
side

Definition at line 440 of file PndSdsCalcStripDif.cxx.

References fNrFeChannels, fNrStrips, kBOTTOM, and kTOP.

441 {
442  //Caution! The top side s always the reference side!
443  Int_t nr = fe * fNrFeChannels + channel;
444  if (nr < fNrStrips) {
445  side = kTOP;
446  } else {
447  nr -= fNrStrips;
448  side = kBOTTOM;
449  }
450  strip = nr;
451 }
Int_t fNrFeChannels
Nr. of strips on active area.
Int_t fNrStrips
strip orientation angle to x axis
int fe
Definition: anaLmdDigi.C:67
Int_t PndSdsCalcStripDif::CalcFEfromStrip ( Int_t  stripNr) const

Calculate Frontend number from strip-index

Parameters
stripNrstrip index
Returns
Frontend number

Definition at line 436 of file PndSdsCalcStripDif.cxx.

References fNrFeChannels.

Referenced by PndSdsStripHitProducerDif::Exec().

436 { return (stripNr/fNrFeChannels); }
Int_t fNrFeChannels
Nr. of strips on active area.
Double_t PndSdsCalcStripDif::CalcStripFromPoint ( Double_t  x,
Double_t  y 
)
private

Calculate continuous strip-number parameter from given Point in local system

Parameters
xx-coordinate
yy-coordinate
Returns
strip-parameter nu

Definition at line 425 of file PndSdsCalcStripDif.cxx.

References fAnchor, fOrthoDir, and fPitch.

Referenced by GetStrips().

426 {
427  // fOrthoDir is already set to magnitude == 1., makes it cheaper here.
428  return ((x-fAnchor.X())*fOrthoDir.X() + (y-fAnchor.Y())*fOrthoDir.Y())/fPitch;
429 }
Double_t x
TVector2 fAnchor
Nr of Channels per FE.
Double_t y
TVector2 fOrthoDir
vector perpendicular to strip direction
void PndSdsCalcStripDif::CalcStripPointOnLine ( const Double_t  strip,
TVector2 &  point 
) const

Definition at line 431 of file PndSdsCalcStripDif.cxx.

References fAnchor, fOrthoDir, and fPitch.

432 {
433  point = fPitch*(strip+0.5)*fOrthoDir + fAnchor;
434 }
TClonesArray * point
Definition: anaLmdDigi.C:29
TVector2 fAnchor
Nr of Channels per FE.
TVector2 fOrthoDir
vector perpendicular to strip direction
Double_t PndSdsCalcStripDif::ChargeDiffusion ( Double_t  u,
Double_t  a,
Double_t  path,
Double_t  dir,
Double_t  Q 
)

Definition at line 457 of file PndSdsCalcStripDif.cxx.

References Double_t, fSigma, n, and sqrt().

Referenced by GetStrips().

458 { Int_t N = 10;
459  //Int_t n = 0;
460  Double_t Npath = path/N;
461  Double_t NQ = Q/N;
462  Double_t Delta; //the area of Gaussian from (-infinite,u)
463  Double_t dQ=0; //the Q in the given range
464  //define sigma of charge diffusion as a function of sensor thickness
465  // suppose the function is linear the sigma woulde be decreased with the thickness
466  // if the sigma = 8um when thickness is 300um, then the sigma = 4um for thickness = 150um
467  // the sigma shall be changed in the cycle calculation.
468  // Double_t sigma = fSigma
469  // cout<<endl;
470  // cout<<"the parameters for charge diffusion are: u, a, path, dir, Q "<< u<<","<<a<<","<<path<<","<<dir<<","<<Q<<endl;
471 
472  if(path==0.)
473  {
474  // Delta = 0.5 *(1+TMath::Erf((u-a)/fSigma*std::sqrt(2.)));
475  Delta = 0.5 *(1+TMath::Erf((u-a)/fSigma*std::sqrt(2.)));
476  dQ = NQ*Delta;
477  // cout<<"when path ==0 ,the dQ = "<<dQ<<endl;
478  }
479  else {
480  if(dir>0.)
481  {
482  for(Double_t da =a,n = 0; n<N; n++)
483  { //da = a;
484  da +=Npath;
485  // Delta = 0.5*(1+TMath::Erf((u-da)/(fSigma*std::sqrt(2.))));
486  //here the sigma square is linear as thickness
487  Delta = 0.5 *(1+TMath::Erf((u-a)/(std::sqrt(((N-n)/N))*(fSigma/std::sqrt(2.))*std::sqrt(2.))));//fSigma is from para list and for 300um sensor,so
488  dQ +=NQ * Delta;
489  // cout<<"when dir = 1 the delta = "<<Delta<<endl;
490  // cout<<"when dir = 1 the dQ = "<<dQ<<endl;
491  }
492  } // cout<<"when dir = 1 the dQ = "<<dQ<<endl;
493 
494  if(dir<0)
495  {
496  for(Double_t da=a-path,n=0;n<N; n++)
497  {
498  da+=Npath;
499  // Delta = 0.5*(1+TMath::Erf((u-da)/(fSigma*std::sqrt(2.))));
500  Delta = 0.5*(1+TMath::Erf((u-da)/(std::sqrt(((N-n)/N))*(fSigma/std::sqrt(2.))*std::sqrt(2.))));
501  dQ +=NQ * Delta;
502  // cout<<"when dir = -1 the delta = "<<Delta<<endl;
503  // cout<<"when dir = -1 the dQ = "<<dQ<<endl;
504  }
505  // cout<<"when dir = -1 the dQ = "<<dQ<<endl;
506  }//dir<<0
507 
508  }//path>0
509  return dQ;
510 }
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
int n
Int_t a
Definition: anaLmdDigi.C:126
Double_t
const Double_t PndSdsCalcStripDif::ChargeFromEloss ( Double_t  eloss) const
inlineprivate

Definition at line 139 of file PndSdsCalcStripDif.h.

Referenced by GetStrips().

139 {return eloss/(3.61e-9);}
double eloss
Definition: anaLmdSim.C:34
const TVector2 PndSdsCalcStripDif::GetStripDirection ( ) const
inline

Get Strip Direction (strip orientation angle)

Definition at line 102 of file PndSdsCalcStripDif.h.

References fStripDir.

102 {return fStripDir;}
std::vector< PndSdsStrip > PndSdsCalcStripDif::GetStrips ( Double_t  inx,
Double_t  iny,
Double_t  inz,
Double_t  outx,
Double_t  outy,
Double_t  outz,
Double_t  eLoss 
)

Get List of hit channels from given Wafer hit.

Parameters
inxx-coordinate of entry point
inyy-coordinate of entry point
inzz-coordinate of entry point
outxx-coordinate of exit point
outyy-coordinate of exit point
outzz-coordinate of exit point
eLossEnergy Loss inside the detector element (GeV)
Returns
List of fired strips

the path portion on the first and last strip

Definition at line 74 of file PndSdsCalcStripDif.cxx.

References CalcStripFromPoint(), ChargeDiffusion(), ChargeFromEloss(), Double_t, fabs(), fNrStrips, fPitch, fThreshold, fVerboseLevel, PndSdsStrip::GetIndex(), i, n, out, genfit::tools::QR(), and SmearCharge().

Referenced by PndSdsStripHitProducerDif::Exec().

77 {
78  if (fVerboseLevel > 2) std::cout<<"-I- PndSdsCalcStrip::GetStrips "<<std::endl;
79 
80  // 2d-Projection of trajectory
81  TVector2 in(inx,iny);
82  TVector2 out(outx,outy);
83  TVector2 path=out-in;
84 
85  if (fVerboseLevel > 2){
86  std::cout<<" InPoint: ("<<in.X()<<","<<in.Y()<<")"<<std::endl;
87  std::cout<<" OutPoint: ("<<out.X()<<","<<out.Y()<<")"<<std::endl;
88  }
89 
90  std::vector<PndSdsStrip> strips;
91  //Double_t smearedQ;
92 
93  if (path.Mod()<1E-18) {
94  std::cout<<"-W- PndSdsCalcStrip::GetStrips : No Trajectory inside Sensor! (out-in).Mod() = "<<path.Mod()<<std::endl;
95  return strips;
96  }
97 
98  if (fVerboseLevel > 1) std::cout<<" pathlength: "<<path.Mod()<<std::endl;
99 
100  Double_t nuIn = CalcStripFromPoint(inx,iny);
101  Double_t nuOut = CalcStripFromPoint(outx,outy);
102 
103  if (fVerboseLevel > 2) std::cout<<" nuIn = "<<nuIn<<" ; nuOut = "<<nuOut<<std::endl;
104 
105 
106  Double_t Q = ChargeFromEloss(eLoss);//*1E9/3.61; // 3.6 eV/Electron in Silicon
107  if (fVerboseLevel > 1) std::cout<<" integral charge = "<<Q<<std::endl;
108 
109  // did we hit the active area ?
110  // if ( (nuIn<0.5 && nuOut<0.5) || (((nuIn+0.5) > Double_t(fNrStrips-1)) && ((nuOut+0.5) > Double_t(fNrStrips-1)))){
111  if ( (nuIn<0. && nuOut<0.) || ((nuIn > Double_t(fNrStrips)) && (nuOut > Double_t(fNrStrips))) )
112  {
113  if (fVerboseLevel > 1) std::cout<<"-W- PndSdsCalcStrip::GetStrips: Hit outside active area."<<std::endl;
114  return strips;
115  }
116 
117  // is the In-Point inside active area ?
118  // only charge fraction inside active area taken
119  if (nuIn<0.){
120  Q *= (nuOut)/(nuOut-nuIn);
121  nuIn = 0.;
122  } else if (nuIn > (Double_t(fNrStrips))){
123  Q *= ((Double_t)fNrStrips-nuOut)/(-nuOut+nuIn);
124  nuIn = Double_t(fNrStrips);
125  }
126 
127  // is the Out-Point inside active area ?
128  if (nuOut<0.){
129  Q *= (nuIn)/(-nuOut+nuIn);
130  nuOut = 0.;
131  } else if (nuOut > (Double_t(fNrStrips))){
132  Q *= ((Double_t)fNrStrips-nuIn)/(nuOut-nuIn);
133  nuOut = Double_t(fNrStrips);
134  }
135 
136  //path direction
137  Double_t dir = (nuIn<nuOut)? 1 : -1;
138 
139  //Strip number for FE channel
140  Int_t inStrip = Int_t(nuIn);
141  Int_t outStrip = Int_t(nuOut);
142 
144  Double_t Path1 = (nuIn-inStrip) * fPitch;
145  Double_t Path2 = (nuOut-outStrip) * fPitch;
146  Double_t pathO = std::fabs(nuOut-nuIn) * fPitch;
147 
148  // only one strip hit ?
149  if (inStrip == outStrip){
150  // this strip collected the entire charge
151  // smearedQ = SmearCharge(Q);
152  //if (smearedQ >= fThreshold)
153  // strips.push_back(PndSdsStrip(Int_t(nuOut),smearedQ));
154 
155  //--------------------------Tsito Digi with diffusion------------------------------------------------
156  //Double_t path_real = path.Mod();
157  Int_t index = inStrip;
158 
159  Double_t charge1, charge2, dQ, dQR, dQL, QL, QR, QM;
160  Int_t id;
161  Double_t q_head,q_tail;
162  //charge diffusion according to the gaussian smearing
163  //between the 3 strips of index-1, index, and index+1
164 
165  QL = ChargeDiffusion(0,Path1,pathO,dir,Q);//the diffusion charge from -infinite to index
166  QR = Q - ChargeDiffusion(fPitch,Path1,pathO,dir,Q);//the diffusion charge from index to infinite
167  QM = Q - QR -QL;// the charge left on the strip index
168 
169  if (fVerboseLevel > 1)
170  std::cout<<"the QL,QR,QM are: "<<QL<<","<<QR<<","<<QM<<std::endl;
171 
172  //noise smearing for the QL,QR and QM
173  dQR = SmearCharge(QR);
174  dQL = SmearCharge(QL);
175 
176  //is it only 1 strip involved
177  if(dQL<fThreshold && dQR<fThreshold){
178  dQ = SmearCharge(QM);
179  if(dQ>fThreshold)
180  strips.push_back(PndSdsStrip(index,dQ));
181 
182  }else{
183  Int_t i=0;
184  Int_t j=1;
185 
186  if(QL>=fThreshold){
187  //charge distribution at the head of the track
188  charge1 = ChargeDiffusion((i-1)*fPitch,Path1,pathO,dir,Q);//charge distribution from -infinite to strip of index-1
189  if (fVerboseLevel > 1)
190  std::cout<<"if QL>fThrehold, the charge on the strip(i-1)*fPitch is :"<<charge1<<",path1= "<<Path1<<std::endl;
191  charge2 = ChargeDiffusion(i*fPitch,Path1,pathO,dir,Q);
192  if (fVerboseLevel > 1)
193  std::cout<<"if QL>fThrehold, the charge on the strip(i)*fPitch is :"<<charge2<<std::endl;
194  q_head = charge2 - charge1;
195  id = index + i-1;
196  dQ = SmearCharge(q_head);
197  if(dQ>fThreshold)
198  strips.push_back(PndSdsStrip(id,dQ));
199  }
200 
201  if(QR>=fThreshold){
202  //charge distribution at the head of the track
203  charge1 = ChargeDiffusion(j*fPitch,Path1,pathO,dir,Q);//charge distribution from -infinite to strip of index-1
204  if (fVerboseLevel > 1)
205  std::cout<<"if dQR>fThrehold, the charge on the strip(j)*fPitch is :"<<charge1<<std::endl;
206  charge2 = ChargeDiffusion((j+1)*fPitch,Path1,pathO,dir,Q);
207  if (fVerboseLevel > 1)
208  std::cout<<"if dQR>fThrehold, the charge on the strip(j+1)*fPitch is :"<<charge2<<std::endl;
209  q_tail = charge2 - charge1;
210  id = index + j;
211  dQ = SmearCharge(q_tail);
212  if(dQ>fThreshold)
213  strips.push_back(PndSdsStrip(id,dQ));
214  }
215 
216  //the charge left on the center strip
217  Double_t restQ = ChargeDiffusion(fPitch,Path1,pathO,dir,Q) - ChargeDiffusion(0,Path1,pathO,dir,Q);
218  restQ = SmearCharge(restQ);
219 
220  if(restQ>fThreshold)//added on Sep.17,2009
221  strips.push_back(PndSdsStrip(index,restQ));
222  if (fVerboseLevel > 1)
223  std::cout<<"the rest Q on the middle strip is :"<<restQ<<std::endl;
224  }
225 
226  //-----------------------End Tsito Digi with diffusion-------------------------------------------------
227 
228  if (fVerboseLevel > 1) std::cout<<" -> "<<strips.size()<<" strips hit."<<std::endl;
229  } else {
230  Double_t dQ=Q/std::fabs(nuOut-nuIn);
231  //Double_t dPath=path.Mod()/std::fabs(nuOut-nuIn);
232  //Double_t dir = (nuOut>nuIn) ? 1. : -1.;
233  Int_t nrHits = 0;
234  // calculate portion of track in first strip
235  Int_t nextIn = Int_t(nuIn + 0.5+0.5*dir);
236  Double_t Q1 = dQ*std::fabs(nextIn-nuIn);
237  if (fVerboseLevel > 2){
238  std::cout<<" part of first strip : "<<nextIn-nuIn<<std::endl ;
239  std::cout<<" charge : "<<Q1<<std::endl ;
240  std::cout<<" next strip : "<<nextIn<<std::endl ;
241  }
242  //smearedQ = SmearCharge(Q1);
243  if (Q1 >= fThreshold) strips.push_back(PndSdsStrip(Int_t(nuIn),Q1));
244  nrHits++;
245  Q -= Q1;
246 
247  // calculate portion of track in last strip
248  Int_t prevOut = Int_t(nuOut + 0.5-0.5*dir);
249  Double_t Q2 = dQ*std::fabs(nuOut-prevOut);
250  if (fVerboseLevel > 2){
251  std::cout<<" part of last strip : "<<(nuOut-prevOut)<<std::endl ;
252  std::cout<<" charge : "<<Q2<<std::endl ;
253  std::cout<<" end of previous strip : "<<prevOut<<std::endl ;
254  }
255  //smearedQ = SmearCharge(Q2);
256  if (Q2 >= fThreshold) strips.push_back(PndSdsStrip(Int_t(nuOut),Q2));
257  nrHits++;
258  Q -= Q2;
259 
260 
261  // Distribute the charge among the intermediate strips
262  nextIn = Int_t(nextIn - 0.5 + 0.5*dir);
263  prevOut = Int_t(prevOut - 0.5 + 0.5*dir);
264  if (fVerboseLevel > 2) {
265  std::cout<<" dir="<<Int_t(dir)<<std::endl;
266  std::cout<<" begin="<<nextIn<<" end="<<prevOut<<std::endl;
267  }
268 
269  for (Int_t n = nextIn ; n != prevOut; n += Int_t(dir) )
270  {
271  if (fVerboseLevel > 2) std::cout<<" n = "<<n<<std::endl;
272  //smearedQ = SmearCharge(dQ);
273  if (dQ >= fThreshold) strips.push_back(PndSdsStrip(n,dQ));
274  nrHits++;
275  Q -= dQ;
276  }
277 
278 
279 
280  //--------------------------Tsito Digi with diffusion-------------------------------------------------
281 
282  if(strips.size()<1)
283  return strips;
284 
285  //for the strips
286  Double_t head_Path; //, tail_Path;
287  std::vector<PndSdsStrip> strip_head;
288  std::vector<PndSdsStrip> strip_tail;
289  std::vector<PndSdsStrip> strip_middle;
290  PndSdsStrip str_head;
291  PndSdsStrip str_tail;
292  std::vector<PndSdsStrip> str_middle;
293  Int_t size = strips.size();
294  Double_t total_Q = ChargeFromEloss(eLoss);
295 
296  if(inStrip<outStrip){
297  str_head = strips[0];
298  //if(!str_head)cout<<"str_head is available"<<endl;
299  str_tail = strips[size-1];
300  head_Path = Path1;
301  //tail_Path = Path2+(size-1)*fPitch;
302  // cout<<"when inStrip!=outStrip, the head Path is "<<head_Path<<endl;
303  for(Int_t i = 1; i<size-1;i++)
304  str_middle.push_back(strips[i]);
305 
306  dir=-1;
307 
308  }
309  else{
310  str_tail = strips[0];
311  //if(!str_tail)cout<<"str_tail is available, inStrip<outStrip"<<endl;
312  str_head = strips[size-1];
313  head_Path = Path2;
314  //tail_Path = Path1+(size-1)*fPitch;
315  // cout<<"when inStrip>outStrip, the head Path is "<<head_Path<<endl;
316  // cout<<"the dir and size is "<<dir<<","<<size<<endl;
317  for(Int_t i = size-2; i>0;i--)
318  str_middle.push_back(strips[i]);
319 
320  dir=1;
321 
322  }
323 
324  strips.erase(strips.begin(),strips.begin()+size);
325 
326  //strips initialization
327  Int_t index_head = str_head.GetIndex();
328  //Double_t path_head = str_head.GetPath();
329 
330  Int_t index_tail = str_tail.GetIndex();
331  //Double_t path_tail = str_tail.GetPath();
332 
333  //for the left strip of the head strip
334  Double_t charge1, charge2;
335  Int_t id;
336  //Double_t ipath;
337  //Double_t q_head,q_tail;
338  Double_t dq_head = ChargeDiffusion(0,head_Path,path.Mod(),dir,total_Q);//the diffusion charge from -infinite to index
339  // cout<<"the dir is "<<dir<<endl;
340  Double_t dq_tail = total_Q - ChargeDiffusion(size*fPitch,head_Path,path.Mod(),dir,total_Q);//the diffusion charge from index+size to infinite
341  // cout<<"the dq between -infinite to 0.01 is"<<ChargeDiffusion(size*fPitch,head_Path,path,dir,total_Q)<<endl;
342  Double_t q_head = ChargeDiffusion(fPitch,head_Path,path.Mod(),dir,total_Q) - dq_head;// the charge left on the strip index
343  // cout<<"the dq between -infinite to 0.005 is"<<ChargeDiffusion(fPitch,head_Path,path,dir,total_Q)<<endl;
344  Double_t q_tail = ChargeDiffusion(size*fPitch,head_Path,path.Mod(),dir,total_Q)
345  -ChargeDiffusion((size-1)*fPitch,head_Path,path.Mod(),dir,total_Q);
346  // cout<<"the dir is "<<dir<<endl;
347  if (fVerboseLevel > 2)
348  std::cout<<"the dq_head,dq_tail,q_head,q_tail are :"<<dq_head<<","<<dq_tail<<","<<q_head<<","<<q_tail<<std::endl;
349 
350  Double_t dQ_head = SmearCharge(dq_head);
351  Double_t dQ_tail = SmearCharge(dq_tail);
352  Double_t Q_head = SmearCharge(q_head);
353  Double_t Q_tail = SmearCharge(q_tail);
354 
355  if(dQ_head>fThreshold) {
356  id = index_head-1;
357  strip_head.push_back(PndSdsStrip(id,dQ_head));
358  }
359  if(Q_head>fThreshold) {
360  id = index_head;
361  strip_head.push_back(PndSdsStrip(id,Q_head));
362  }
363  strips.insert(strips.begin(),strip_head.begin(),strip_head.end());
364 
365  if(dQ_tail>fThreshold) {
366  id = index_tail+1;
367  strip_tail.push_back(PndSdsStrip(id,dQ_tail));
368  }
369  if(Q_tail>fThreshold) {
370  id = index_tail;
371  strip_head.push_back(PndSdsStrip(id,Q_tail));
372  }
373 
374  strips.insert(strips.end(),strip_tail.begin(),strip_tail.end());
375 
376  //for the strips between the head and the tail
377  //condition for middle strips
378  nextIn = Int_t(nuIn+0.5+0.5*dir);
379  prevOut = Int_t(nuOut+0.5-0.5*dir);
380 
381  nextIn=Int_t(nextIn-0.5+0.5*dir);
382  prevOut=Int_t(prevOut-0.5+0.5*dir);
383  if(nextIn != prevOut){
384  for(Int_t i= 1;i< size-1;i++){
385  charge1 = ChargeDiffusion(i*fPitch,head_Path,path.Mod(),dir,total_Q);
386  charge2 = ChargeDiffusion((i+1)*fPitch,head_Path,path.Mod(),dir,total_Q);
387  dQ = charge2 - charge1;
388  //std::vector<PndSdsStrip>::iterator iter_ii=strip_middle.begin();
389  if(dir==-1)
390  id = i;
391  else
392  id = size-1-i;
393  //id = iter_ii->GetIndex();
394  //ipath = iter_ii->GetPath();
395  Double_t tmpCharge = SmearCharge(dQ);
396  if(tmpCharge>fThreshold) strip_middle.push_back(PndSdsStrip(id,tmpCharge));
397  //iter_ii++;
398  }//loop for all strips between head and tail
399  strips.insert(strips.begin()+strip_head.size(),strip_middle.begin(),strip_middle.begin()+strip_middle.size());
400 
401  /*for(Int_t i=0; i<strip_head.size(); i++)
402  strips.push_back(strip_head[i]);
403  for(Int_t i=0; i<strip_middle.size(); i++)
404  strips.push_back(strip_middle.[i]);
405  for(Int_t i=0; i<strip_tail.size(); i++)
406  strips.push_back(strip_tail[i]);*/
407  }//if strips fired exceed 3
408 
409  //-----------------------End Tsito Digi with diffusion-------------------------------------------------
410 
411  if (fVerboseLevel > 2) if (fabs(Q)>1.) std::cout<<" charge Q = "<<Q<<" not detected!"<<std::endl;
412  if (fVerboseLevel > 1) std::cout<<" -> "<<strips.size()<<" strips hit."<<std::endl;
413  }
414 
415  return strips;
416 }
Double_t fThreshold
anchor point on first strip
Int_t i
Definition: run_full.C:25
void QR(TMatrixD &A)
Replaces A with an upper right matrix connected to A by an orthongonal transformation. I.e., it computes R from a QR decomposition of A = QR, replacing A.
int n
Double_t ChargeDiffusion(Double_t u, Double_t a, Double_t path, Double_t dir, Double_t Q)
Class representing strips on wafer-scale.
Definition: PndSdsStrip.h:15
Int_t fVerboseLevel
Random Number Generator.
const Double_t ChargeFromEloss(Double_t eloss) const
Double_t
Double_t CalcStripFromPoint(Double_t x, Double_t y)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TFile * out
Definition: reco_muo.C:20
Int_t fNrStrips
strip orientation angle to x axis
Int_t GetIndex() const
Definition: PndSdsStrip.h:31
Double_t SmearCharge(Double_t charge)
std::ostream& PndSdsCalcStripDif::operator<< ( std::ostream out)
void PndSdsCalcStripDif::Print ( ) const

Definition at line 512 of file PndSdsCalcStripDif.cxx.

References fAnchor, fNrFeChannels, fNrStrips, fOrient, fPitch, fStripDir, and Pi.

Referenced by PndSdsCalcStripDif().

513 {
514  std::cout<<"-I- PndSdsCalcStrip Info :"<<std::endl;
515  std::cout<<" pitch = "<<fPitch*10000.<<" um"<<std::endl;
516  std::cout<<" orientation angle = "<<fOrient/TMath::Pi()*180.<<" deg"<<std::endl;
517  std::cout<<" nr of strips = "<<fNrStrips<<std::endl;
518  std::cout<<" nr of channels per FE = "<<fNrFeChannels<<std::endl;
519  std::cout<<" nr of frontends = "<<fNrStrips/fNrFeChannels<<std::endl;
520  std::cout<<" anchor point = ("<<fAnchor.X()<<","<<fAnchor.Y()<<")"<<std::endl;
521  std::cout<<" strip-direction vector = ("<<fStripDir.X()<<","<<fStripDir.Y()<<")"<<std::endl;
522 }
Int_t fNrFeChannels
Nr. of strips on active area.
Int_t fNrStrips
strip orientation angle to x axis
Double_t fOrient
strip pitch (cm)
TVector2 fAnchor
Nr of Channels per FE.
Double_t Pi
void PndSdsCalcStripDif::SetVerboseLevel ( Int_t  level)
inline

Definition at line 104 of file PndSdsCalcStripDif.h.

References fVerboseLevel.

Referenced by PndSdsStripHitProducerDif::Init().

104 { fVerboseLevel = level;}
Int_t fVerboseLevel
Random Number Generator.
Double_t PndSdsCalcStripDif::SmearCharge ( Double_t  charge)
private

Apply gaussian distributed noise to given charge

Parameters
chargeEquivalent Noise Charge
Returns
Smeared Charge

Definition at line 418 of file PndSdsCalcStripDif.cxx.

References Double_t, fNoise, fRNG, and fVerboseLevel.

Referenced by GetStrips().

419 {
420  Double_t smeared = fRNG->Gaus(charge,fNoise);
421  if (fVerboseLevel > 3) std::cout<<" charge = "<<charge<<", smeared = "<<smeared<<std::endl;
422  return smeared;
423 }
Double_t fNoise
charge threshold
Int_t fVerboseLevel
Random Number Generator.
TRandom3 * fRNG
vector orthogonal to strip direction
Double_t

Member Data Documentation

TVector2 PndSdsCalcStripDif::fAnchor
private

Nr of Channels per FE.

Definition at line 116 of file PndSdsCalcStripDif.h.

Referenced by CalcStripFromPoint(), CalcStripPointOnLine(), PndSdsCalcStripDif(), and Print().

Double_t PndSdsCalcStripDif::fNoise
private

charge threshold

Definition at line 118 of file PndSdsCalcStripDif.h.

Referenced by PndSdsCalcStripDif(), and SmearCharge().

Int_t PndSdsCalcStripDif::fNrFeChannels
private

Nr. of strips on active area.

Definition at line 115 of file PndSdsCalcStripDif.h.

Referenced by CalcChannelfromStrip(), CalcFeChToStrip(), CalcFEfromStrip(), PndSdsCalcStripDif(), and Print().

Int_t PndSdsCalcStripDif::fNrStrips
private

strip orientation angle to x axis

Definition at line 114 of file PndSdsCalcStripDif.h.

Referenced by CalcFeChToStrip(), GetStrips(), PndSdsCalcStripDif(), and Print().

Double_t PndSdsCalcStripDif::fOrient
private

strip pitch (cm)

Definition at line 113 of file PndSdsCalcStripDif.h.

Referenced by PndSdsCalcStripDif(), and Print().

TVector2 PndSdsCalcStripDif::fOrthoDir
private

vector perpendicular to strip direction

Definition at line 120 of file PndSdsCalcStripDif.h.

Referenced by CalcStripFromPoint(), CalcStripPointOnLine(), and PndSdsCalcStripDif().

Double_t PndSdsCalcStripDif::fPitch
private
TRandom3* PndSdsCalcStripDif::fRNG
private

vector orthogonal to strip direction

Definition at line 121 of file PndSdsCalcStripDif.h.

Referenced by PndSdsCalcStripDif(), and SmearCharge().

Double_t PndSdsCalcStripDif::fSigma
private

Definition at line 123 of file PndSdsCalcStripDif.h.

Referenced by ChargeDiffusion(), and PndSdsCalcStripDif().

TVector2 PndSdsCalcStripDif::fStripDir
private

ENC.

Definition at line 119 of file PndSdsCalcStripDif.h.

Referenced by GetStripDirection(), PndSdsCalcStripDif(), and Print().

Double_t PndSdsCalcStripDif::fThreshold
private

anchor point on first strip

Definition at line 117 of file PndSdsCalcStripDif.h.

Referenced by GetStrips(), and PndSdsCalcStripDif().

Int_t PndSdsCalcStripDif::fVerboseLevel
private

Random Number Generator.

Definition at line 122 of file PndSdsCalcStripDif.h.

Referenced by GetStrips(), PndSdsCalcStripDif(), SetVerboseLevel(), and SmearCharge().


The documentation for this class was generated from the following files: