3 #include "Randomize.hh" 20 double x = xyz.x()/mm;
21 double y = xyz.y()/mm;
22 double z = xyz.z()/mm;
25 int Nel = (int) (1e6*Edep/w_i);
28 vector<double> strip_id;
33 for(
int iel=0;iel<Nel;iel++)
35 int num_region = (int) (layer+1)/2 - 1;
47 double z_d = (double) (G4RandGauss::shoot(z,sigma));
59 double phi = atan2(y,x);
62 double phi_d = phi + ((G4RandGauss::shoot(0,sigma))/cos(bmtc.
ThetaL) - Delta_rad*tan(bmtc.
ThetaL))/bmtc.
CRZRADIUS[num_region];
69 for(
int istrip=0;istrip< (int) (strip_id.size()/2);istrip++)
71 if(strip_id[2*istrip]==strip)
73 strip_id[2*istrip+1] = strip_id[2*istrip+1]+1./((double) Nel);
78 strip_id.push_back(strip);
79 strip_id.push_back(1./((
double) Nel));
84 strip_id.push_back(-1);
85 strip_id.push_back(1);
91 strip_id.push_back(-1);
92 strip_id.push_back(1);
109 int num_region = (int) (layer+1)/2 - 1;
123 int num_region = (int) (layer+1)/2 - 1;
137 int num_region = (int) (layer+1)/2 - 1;
138 int num_detector =
isInSector( layer, angle, bmtc) - 1;
148 if(angle>=0 && angle<=angle_f)
154 strip_calc = (int)(round(strip_calc) );
155 int strip_num = (int) floor(strip_calc);
157 int value = strip_num + 1;
159 if(value < 1 || value > bmtc.
CRZNSTRIPS[num_region])
173 int num_region = (int) (layer+1)/2 - 1;
175 int ClosestStrip =-1;
177 int len = bmtc.
CRCGROUP[num_region].size();
178 double Z_lowBound[len];
179 double Z_uppBound[len];
183 double z = trk_z - zi;
185 Z_lowBound[0] = bmtc.
CRCWIDTH[num_region][0]/2.;
186 Z_uppBound[0] = Z_lowBound[0]
188 NStrips[0] = bmtc.
CRCGROUP[num_region][0];
189 for(
int i =1; i< len; i++)
191 Z_lowBound[i] = Z_uppBound[i-1] + bmtc.
CRCWIDTH[num_region][i-1]/2. + bmtc.
CRCSPACING[num_region] + bmtc.
CRCWIDTH[num_region][i]/2.;
192 Z_uppBound[i] = Z_lowBound[i] + (bmtc.
CRCGROUP[num_region][i]-1)*(bmtc.
CRCWIDTH[num_region][i] + bmtc.
CRCSPACING[num_region]);
194 NStrips[i] = NStrips[i-1] + bmtc.
CRCGROUP[num_region][i];
196 if(z>=Z_lowBound[i] && z<=Z_uppBound[i]) {
198 ClosestStrip = 1 + (int) (round(((z-Z_lowBound[strip_group])/(bmtc.
CRCWIDTH[num_region][strip_group] + bmtc.
CRCSPACING[num_region]))))+NStrips[i-1];
216 int num_strip = strip - 1;
217 int num_region = (int) (layer+1)/2 - 1;
221 int limit = bmtc.
CRCGROUP[num_region][group];
225 for (
int j=1;j<num_strip+1;j++)
227 zc += bmtc.
CRCWIDTH[num_region][group]/2.;
231 limit += bmtc.
CRCGROUP[num_region][group];
251 int num_strip = strip - 1;
252 int num_region = (int) (layer+1)/2 - 1;
254 double angle = bmtc.
CRZEDGE1[num_region][num_detector] + (bmtc.
CRZXPOS[num_region]+(bmtc.
CRZWIDTH[num_region]/2.
256 if (angle>2*pi) angle-=2*pi;
263 double pdf_gaussian = (1./(sigma*sqrt(2*pi)))* exp( -0.5*((z-z0)/sigma)*((z-z0)/sigma) );
287 int num_region = (int) (layer+1)/2 - 1;
291 double angle_pr = angle + 2*pi;
295 int num_detector = -1;
297 for(
int i = 0; i<3; i++) {
302 if( (angle>=angle_i && angle<=angle_f) || (angle_pr>=angle_i && angle_pr<=angle_f) )
305 return num_detector + 1;
double CRCRADIUS[NREGIONS]
double CRCSPACING[NREGIONS]
double CRCLENGTH[NREGIONS]
vector< vector< int > > CRCGROUP
double CRCEDGE1[NREGIONS][NREGIONS]
double CRZWIDTH[NREGIONS]
double getEnergyFraction(double z0, double z, double sigma)
double CRZRADIUS[NREGIONS]
double CRZEDGE1[NREGIONS][NREGIONS]
vector< double > FindStrip(int layer, int sector, G4ThreeVector xyz, double Edep, bmtConstants bmtc)
int getCStrip(int layer, double trk_z, bmtConstants bmtc)
int getZStrip(int layer, double angle, bmtConstants bmtc)
double getSigmaAzimuth(int layer, double x, double y, bmtConstants bmtc)
double CRCStrip_GetZ(int layer, int strip, bmtConstants bmtc)
int getDetectorIndex(int sector)
int isInSector(int layer, double angle, bmtConstants bmtc)
vector< vector< double > > CRCWIDTH
double getSigmaLongit(int layer, double x, double y, bmtConstants bmtc)
double CRCOFFSET[NREGIONS]
double CRZLENGTH[NREGIONS]
double CRZStrip_GetPhi(int sector, int layer, int strip, bmtConstants bmtc)
double CRZSPACING[NREGIONS]
double CRZOFFSET[NREGIONS]