8 double phiMin,
double dX_strip,
double dV,
9 double w,
double zmin,
double L,
10 int NXStrip,
int NVStrip,
double Xpitch,
double XstripWidth,
double Vpitch,
double VstripWidth,
double stereoAngle,
11 double midROfGap,
double outROfGap){
26 m_XstripWidth = XstripWidth;
28 m_VstripWidth = VstripWidth;
33 m_StereoAngle = stereoAngle / 180.*CLHEP::pi;
34 m_k = stereoAngle/fabs(stereoAngle);
35 m_MidRGap = midROfGap;
36 m_OutRGap = outROfGap;
41 while(m_Phimin<-
M_PI) m_Phimin+=2*
M_PI;
42 while(m_Phimin>
M_PI) m_Phimin-=2*
M_PI;
44 m_Xmin = m_Phimin*m_Rmid;
48 m_Phimin_strip = dX_strip/m_Rmid;
51 m_Xmin_strip = m_Phimin_strip*m_Rmid;
52 m_Xmax_strip = m_Xmin_strip+NXStrip*m_XPitch;
53 m_Phimax_strip = m_Xmax_strip/m_Rmid;
62 m_Vtot = NXStrip*m_XPitch*
cos(m_StereoAngle)+m_L*fabs(
sin(m_StereoAngle));
63 dV=(m_Vtot-NVStrip*m_VPitch)/2.0;
65 m_Vmax = m_Vmin_strip+NVStrip*m_VPitch;
68 cout<<
" dX = "<<dX_strip<<endl;
291 vector<int>& vecXID, vector<int>& vecVID)
const {
293 bool printDebug =
false;
297 if( (z[0]<m_Zmin && z[1]<m_Zmin) || (z[0]>(m_Zmin+m_L) && z[1]>(m_Zmin+m_L)) )
return;
300 double phimin=-CLHEP::pi;
303 if(fabs(phi[1]-phi[0])>CLHEP::pi){
305 for(
int i=0; i<2; i++)
if(phi[i]<0.0) phi[i]+=CLHEP::twopi;
315 if(printDebug) cout<<
"phimin="<<phimin<<
", phi[0,1]="<<phi[0]<<
","<<phi[1]<<
", z[0,1]="<<z[0]<<
","<<z[1]<<endl;
316 for(
int i=0; i<2; i++){
318 double phiTmp=(phi[1]-phi[0])/(z[1]-z[0])*(m_Zmin-z[0])+phi[0];
322 if(z[i]>(m_Zmin+m_L)){
323 double phiTmp=(phi[1]-phi[0])/(z[1]-z[0])*(m_Zmin+m_L-z[0])+phi[0];
328 double phiActiveMin=m_Phimin+m_Phimin_strip+10e-10;
329 double phiActiveMax=m_Phimin+m_Phimax_strip-10e-10;
330 if(printDebug) cout<<
"phimin="<<phimin<<
", phiActiveMin="<<phiActiveMin<<
", phiActiveMax="<<phiActiveMax<<
", phi[0,1]="<<phi[0]<<
","<<phi[1]<<
", z[0,1]="<<z[0]<<
","<<z[1]<<endl;
331 while(phiActiveMax>=CLHEP::twopi) phiActiveMax-=CLHEP::twopi;
332 while(phiActiveMin>=CLHEP::twopi) phiActiveMin-=CLHEP::twopi;
333 while(phiActiveMax<0 ) phiActiveMax+=CLHEP::twopi;
334 while(phiActiveMin<0 ) phiActiveMin+=CLHEP::twopi;
335 if(phimin==-CLHEP::pi)
341 while(phiActiveMin>CLHEP::pi) phiActiveMin-=CLHEP::twopi;
342 while(phiActiveMax>CLHEP::pi) phiActiveMax-=CLHEP::twopi;
344 if(printDebug) cout<<
"phimin="<<phimin<<
", phiActiveMin="<<phiActiveMin<<
", phiActiveMax="<<phiActiveMax<<
", phi[0,1]="<<phi[0]<<
","<<phi[1]<<
", z[0,1]="<<z[0]<<
","<<z[1]<<endl;
347 if(phiActiveMin<=phi[0])
349 if(phiActiveMax<=phiActiveMin) iCase=1;
350 else if(phiActiveMax<=phi[0]) iCase=2;
351 else if(phiActiveMax<=phi[1]) iCase=3;
354 else if(phiActiveMin<=phi[1])
356 if(phiActiveMax<=phi[0]) iCase=5;
357 else if(phiActiveMax<=phiActiveMin) iCase=6;
358 else if(phiActiveMax<=phi[1]) iCase=7;
363 if(phiActiveMax<=phi[0]) iCase=9;
364 else if(phiActiveMax<=phi[1]) iCase=10;
365 else if(phiActiveMax<=phiActiveMin) iCase=11;
368 if(printDebug) cout<<
"iCase = "<<iCase<<endl;
371 zBoundary[0]=z[0]+(z[1]-z[0])/(phi[1]-phi[0])*(phiActiveMin-phi[0]);
372 zBoundary[1]=z[0]+(z[1]-z[0])/(phi[1]-phi[0])*(phiActiveMax-phi[0]);
401 cout<<
"Error in CgemGeoReadoutPlane::getFiredStripID: iCase = "<<iCase<<endl;
404 if(printDebug) cout<<
"phimin="<<phimin<<
", phiActiveMin="<<phiActiveMin<<
", phiActiveMax="<<phiActiveMax<<
", phi[0,1]="<<phi[0]<<
","<<phi[1]<<
", z[0,1]="<<z[0]<<
","<<z[1]<<endl;
406 G4ThreeVector pos_1,pos_2;
407 pos_1.setRhoPhiZ(m_Rmid,phi[0],z[0]);
408 pos_2.setRhoPhiZ(m_Rmid,phi[1],z[1]);
409 int XID_min(-9),XID_max(-9);
410 int VID_min(-9),VID_max(-9);
413 if( iCase!=6 && VID_max<VID_min ) {
419 cout<<
"on the sheet: phi "<<phi[0]<<
" to "<<phi[1]<<
", z "<<z[0]<<
" to "<<z[1]<<endl;
420 cout<<
" XID "<<XID_min<<
" to "<<XID_max<<
", VID "<<VID_min<<
" to "<<VID_max<<endl;
425 for(
int i=0; i<=
abs(XID_min-XID_max);i++) vecXID.push_back(XID_min+i);
426 for(
int i=0; i<=
abs(VID_min-VID_max);i++) vecVID.push_back(VID_min+i);
430 pos_1.setRhoPhiZ(m_Rmid,phiActiveMax,zBoundary[1]);
431 pos_2.setRhoPhiZ(m_Rmid,phiActiveMin,zBoundary[0]);
432 int XID_1(-9),XID_2(-9);
433 int VID_1(-9),VID_2(-9);
436 for(
int i=0; i<=
abs(XID_min-XID_1);i++) vecXID.push_back(XID_min+i);
437 for(
int i=0; i<=
abs(XID_max-XID_2);i++) vecXID.push_back(XID_2+i);
438 int VID_0=min(VID_1,VID_min);
439 for(
int i=0; i<=
abs(VID_min-VID_1);i++) vecVID.push_back(VID_0+i);
440 VID_0=min(VID_2,VID_max);
441 for(
int i=0; i<=
abs(VID_max-VID_2);i++) vecVID.push_back(VID_0+i);
CgemGeoReadoutPlane(int iLayer, int iSheet, double rx, double rv, double phi_min, double dX_strip, double dV, double w, double zmin, double L, int NXStrip, int NVStrip, double Xpitch, double XstripWidth, double Vpitch, double VstripWidth, double stereoAngle, double midROfGap, double outROfGap)