338{
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357 G4double totalThickness=fTyvekThickness+fAlThickness+fMylarThickness;
358 G4double
delta=0.,angle1=0.*deg,angle2=0.*deg;
359 G4double oop;
360
361 G4double rminprojected=BSCRmin*
cos(BSCAngleRotat);
362 rminprojected=BSCRmin;
363
364
365 G4int i;
366 for(i=0;i<BSCNbTheta;i++)
367 {
368 G4double CryLength;
369 if(i==BSCNbTheta-1)
370 {
371 CryLength=BSCCryLength1;
372 } else {
373 CryLength=BSCCryLength;
374 }
375 zHalfLength[BSCNbTheta+i]=totalThickness/2.;
376 yHalfLength1[BSCNbTheta+i]=yHalfLength1[i];
377 yHalfLength2[BSCNbTheta+i]=yHalfLength1[i]
378 +(yHalfLength2[i]-yHalfLength1[i])*totalThickness/CryLength;
379 xHalfLength1[BSCNbTheta+i]=xHalfLength1[i];
380 xHalfLength2[BSCNbTheta+i]=xHalfLength2[i];
381 xHalfLength1[BSCNbTheta*2+i]=xHalfLength3[BSCNbTheta+i]=
382 xHalfLength1[i]*(CryLength-totalThickness)/CryLength
383 +xHalfLength3[i]*totalThickness/CryLength;
384 xHalfLength2[BSCNbTheta*4+i]=xHalfLength4[BSCNbTheta+i]=
385 xHalfLength2[i]*(CryLength-totalThickness)/CryLength
386 +xHalfLength4[i]*totalThickness/CryLength;
387
388 zHalfLength[BSCNbTheta*5+i]=zHalfLength[BSCNbTheta*4+i]=
389 zHalfLength[BSCNbTheta*3+i]=zHalfLength[BSCNbTheta*2+i]=
390 zHalfLength[i]-totalThickness/2.;
391
392 yHalfLength2[BSCNbTheta*2+i]=yHalfLength1[BSCNbTheta*2+i]=
393 totalThickness/
cos(thetaPosition[i+1]-thetaPosition[i])/2.;
394 xHalfLength3[BSCNbTheta*2+i]=xHalfLength3[i];
395 xHalfLength4[BSCNbTheta*2+i]=xHalfLength3[i]
396 +(xHalfLength4[i]-xHalfLength3[i])*yHalfLength2[BSCNbTheta*2+i]
397 /yHalfLength2[i];
398 xHalfLength2[BSCNbTheta*2+i]=xHalfLength3[BSCNbTheta+i]
399 +(xHalfLength4[BSCNbTheta+i]-xHalfLength3[BSCNbTheta+i])
400 *yHalfLength1[BSCNbTheta*2+i]/yHalfLength2[BSCNbTheta*1+i];
401
402 yHalfLength2[BSCNbTheta*4+i]=yHalfLength1[BSCNbTheta*4+i]=
403 totalThickness/2.;
404 xHalfLength4[BSCNbTheta*4+i]=xHalfLength4[i];
405 xHalfLength3[BSCNbTheta*4+i]=xHalfLength4[i]
406 -(xHalfLength4[i]-xHalfLength3[i])*yHalfLength2[BSCNbTheta*4+i]
407 /yHalfLength2[i];
408 xHalfLength1[BSCNbTheta*4+i]=xHalfLength4[BSCNbTheta+i]
409 -(xHalfLength4[BSCNbTheta+i]-xHalfLength3[BSCNbTheta+i])
410 *yHalfLength1[BSCNbTheta*4+i]/yHalfLength2[BSCNbTheta*1+i];
411
412 delta=totalThickness/2.+yHalfLength1[BSCNbTheta*2+i];
413 angle1=atan(yHalfLength2[i]/(xHalfLength4[i]-xHalfLength3[i]));
414 angle2=atan(2.*(xHalfLength4[i]-xHalfLength2[i])*
sin(angle1)
415 /CryLength);
416
417 yHalfLength1[BSCNbTheta*5+i]=yHalfLength1[BSCNbTheta*3+i]=
418 yHalfLength1[i]-
delta;
419 yHalfLength2[BSCNbTheta*5+i]=yHalfLength2[BSCNbTheta*3+i]=
420 yHalfLength2[i]-
delta;
421 xHalfLength4[BSCNbTheta*3+i]=xHalfLength3[BSCNbTheta*3+i]=
422 xHalfLength2[BSCNbTheta*3+i]=xHalfLength1[BSCNbTheta*3+i]=
423 totalThickness/
cos(angle2)/
sin(angle1)/2.;
424 xHalfLength4[BSCNbTheta*5+i]=xHalfLength3[BSCNbTheta*5+i]=
425 xHalfLength2[BSCNbTheta*5+i]=xHalfLength1[BSCNbTheta*5+i]=
426 totalThickness/2.;
427
428 zHalfLength[i]=zHalfLength[i]-totalThickness/2.;
429 yHalfLength1[i]=yHalfLength1[i]-
delta;
430 yHalfLength2[i]=yHalfLength2[i]-
delta;
431 delta=totalThickness*(1.+1./
cos(angle2)/
sin(angle1))/2.;
432 xHalfLength1[i]=xHalfLength1[i]-
delta;
433 xHalfLength2[i]=xHalfLength2[i]-
delta;
434 xHalfLength3[i]=xHalfLength3[i]-
delta;
435 xHalfLength4[i]=xHalfLength4[i]-
delta;
436
437 oop=sqrt((yHalfLength2[i]-yHalfLength1[i])*(yHalfLength2[i]
438 -yHalfLength1[i])
439 +(xHalfLength3[i]+xHalfLength4[i]-xHalfLength1[i]
440 -xHalfLength2[i])*(xHalfLength3[i]+xHalfLength4[i]
441 -xHalfLength1[i]-xHalfLength2[i])/4);
442 thetaAxis[i]=atan(oop/CryLength);
443
444 phiAxis[i] =180.*deg+atan((yHalfLength2[i]-yHalfLength1[i])
445 /(xHalfLength3[i]+xHalfLength4[i]
446 -xHalfLength1[i]-xHalfLength2[i])*2.);
447
448 oop=sqrt((yHalfLength2[BSCNbTheta+i]-yHalfLength1[BSCNbTheta+i])
449 *(yHalfLength2[BSCNbTheta+i]-yHalfLength1[BSCNbTheta+i])
450 +(xHalfLength3[BSCNbTheta+i]+xHalfLength4[BSCNbTheta+i]
451 -xHalfLength1[BSCNbTheta+i]-xHalfLength2[BSCNbTheta+i])
452 *(xHalfLength3[BSCNbTheta+i]+xHalfLength4[BSCNbTheta+i]
453 -xHalfLength1[BSCNbTheta+i]-xHalfLength2[BSCNbTheta+i])/4);
454 thetaAxis[BSCNbTheta+i]=atan(oop/totalThickness);
455 phiAxis [BSCNbTheta+i]=
456 -atan((yHalfLength2[BSCNbTheta+i]-yHalfLength1[BSCNbTheta+i])
457 /(xHalfLength3[BSCNbTheta+i]+xHalfLength4[BSCNbTheta+i]
458 -xHalfLength1[BSCNbTheta+i]-xHalfLength2[BSCNbTheta+i])*2.);
459
460 oop=sqrt((yHalfLength2[i]-yHalfLength1[i])*(yHalfLength2[i]
461 -yHalfLength1[i])*4
462 +(xHalfLength3[BSCNbTheta*2+i]+xHalfLength4[BSCNbTheta*2+i]
463 -xHalfLength1[BSCNbTheta*2+i]-xHalfLength2[BSCNbTheta*2+i])
464 *(xHalfLength3[BSCNbTheta*2+i]+xHalfLength4[BSCNbTheta*2+i]
465 -xHalfLength1[BSCNbTheta*2+i]-xHalfLength2[BSCNbTheta*2+i])
466 /4);
467 thetaAxis[BSCNbTheta*2+i]=atan(oop/(zHalfLength[BSCNbTheta*2+i]*2));
468 phiAxis [BSCNbTheta*2+i]=
469 -atan((yHalfLength2[i]-yHalfLength1[i])
470 /(xHalfLength3[BSCNbTheta*2+i]+xHalfLength4[BSCNbTheta*2+i]
471 -xHalfLength1[BSCNbTheta*2+i]-xHalfLength2[BSCNbTheta*2+i])*4);
472
473 oop=sqrt((yHalfLength2[i]-yHalfLength1[i])*(yHalfLength2[i]
474 -yHalfLength1[i])*4
475 +(xHalfLength4[i]-xHalfLength2[i])
476 *(xHalfLength4[i]-xHalfLength2[i])*4);
477 thetaAxis[BSCNbTheta*3+i]=atan(oop/(zHalfLength[BSCNbTheta*3+i]*2));
478 phiAxis [BSCNbTheta*3+i]=-atan((yHalfLength2[i]-yHalfLength1[i])
479 /(xHalfLength4[i]-xHalfLength2[i]));
480
481 thetaAxis[BSCNbTheta*4+i]=
482 atan((xHalfLength4[BSCNbTheta*4+i]+xHalfLength3[BSCNbTheta*4+i]
483 -xHalfLength2[BSCNbTheta*4+i]-xHalfLength1[BSCNbTheta*4+i])/2.
484 /(zHalfLength[BSCNbTheta*4+i]*2));
485 phiAxis [BSCNbTheta*4+i]=0;
486
487 thetaAxis[BSCNbTheta*5+i]=atan((xHalfLength3[BSCNbTheta*5+i]
488 -xHalfLength1[BSCNbTheta*5+i])
489 /(zHalfLength[BSCNbTheta*5+i]*2));
490 phiAxis [BSCNbTheta*5+i]=-90.*deg;
491
492 tanAlpha2[BSCNbTheta+i]=tanAlpha1[BSCNbTheta+i]=tanAlpha1[i]=
493 -(xHalfLength2[i]-xHalfLength1[i])/yHalfLength1[i]/2.;
494 tanAlpha1[BSCNbTheta*2+i]=(xHalfLength2[BSCNbTheta*2+i]
495 -xHalfLength1[BSCNbTheta*2+i])
496 /yHalfLength1[BSCNbTheta*2+i]/2.;
497 tanAlpha1[BSCNbTheta*3+i]=tanAlpha1[i]*2.;
498 tanAlpha1[BSCNbTheta*4+i]=(xHalfLength2[BSCNbTheta*4+i]
499 -xHalfLength1[BSCNbTheta*4+i])
500 /yHalfLength1[BSCNbTheta*4+i]/2.;
501 tanAlpha1[BSCNbTheta*5+i]=(xHalfLength2[BSCNbTheta*5+i]
502 -xHalfLength1[BSCNbTheta*5+i])
503 /yHalfLength1[BSCNbTheta*5+i]/2.;
504
505 tanAlpha2[i]=-(xHalfLength4[i]-xHalfLength3[i])/yHalfLength2[i]/2.;
506
507 tanAlpha2[BSCNbTheta*2+i]=(xHalfLength4[BSCNbTheta*2+i]
508 -xHalfLength3[BSCNbTheta*2+i])
509 /yHalfLength2[BSCNbTheta*2+i]/2.;
510 tanAlpha2[BSCNbTheta*3+i]=tanAlpha2[i]*2.;
511 tanAlpha2[BSCNbTheta*4+i]=(xHalfLength4[BSCNbTheta*4+i]
512 -xHalfLength3[BSCNbTheta*4+i])
513 /yHalfLength2[BSCNbTheta*4+i]/2.;
514 tanAlpha2[BSCNbTheta*5+i]=(xHalfLength4[BSCNbTheta*5+i]
515 -xHalfLength3[BSCNbTheta*5+i])
516 /yHalfLength2[BSCNbTheta*5+i]/2.;
517
518 zPosition[BSCNbTheta*5+i]=zPosition[BSCNbTheta*3+i]=zPosition[i]=
519 zPosition[i]+totalThickness/2.*
cos(thetaPosition[i])
520 -yHalfLength1[BSCNbTheta*2+i]*
sin(thetaPosition[i]);
521 zPosition[i]=totalThickness/2.;
522 xPosition[BSCNbTheta*5+i]=xPosition[BSCNbTheta*3+i]=xPosition[i]=
523 xPosition[i]+totalThickness/2.*
sin(thetaPosition[i])
524 +totalThickness*(1./
cos(thetaPosition[i+1]-thetaPosition[i])-1)/2.
525 *
cos(thetaPosition[i]);
526 xPosition[i]=totalThickness*(1.-1./
cos(angle2)/
sin(angle1))/2.;
527
528 yPosition[i]=yPosition[i]
529 +totalThickness*(1.-1./
cos(angle2)/
sin(angle1))/2.;
530 yPosition[i]=yHalfLength1[BSCNbTheta*2+i]-totalThickness/2.;
531 yPosition[BSCNbTheta*3+i]=yPosition[i]*2.+xHalfLength1[BSCNbTheta*3+i];
532 yPosition[BSCNbTheta*5+i]=xHalfLength1[BSCNbTheta*5+i];
533
534 xPosition[BSCNbTheta+i]=BSCPhiRmin
535 +zHalfLength[BSCNbTheta+i]*
sin(thetaPosition[i])
536 +(3.*yHalfLength1[BSCNbTheta+i]-yHalfLength2[BSCNbTheta+i])/2.
537 *
cos(thetaPosition[i]);
538 yPosition[BSCNbTheta+i]=(xHalfLength1[BSCNbTheta+i]
539 +xHalfLength3[BSCNbTheta+i]
540 +xHalfLength2[BSCNbTheta+i]
541 +xHalfLength4[BSCNbTheta+i])/4.;
542 zPosition[BSCNbTheta+i]=BSCPosition1+rminprojected/
tan(thetaPosition[i])
543 +(2.*yHalfLength1[BSCNbTheta+i]/
tan(thetaPosition[i])
544 +zHalfLength[BSCNbTheta+i])*
cos(thetaPosition[i])
545 +(yHalfLength1[BSCNbTheta+i]+yHalfLength2[BSCNbTheta+i])/2.
546 *
sin(thetaPosition[i]);
547
548 xPosition[BSCNbTheta*2+i]=xPosition[i]
549 +((yHalfLength1[i]+yHalfLength2[i])/2.+yHalfLength1[BSCNbTheta*2+i])
550 *
cos(thetaPosition[i]);
551 zPosition[BSCNbTheta*2+i]=zPosition[i]
552 -((yHalfLength1[i]+yHalfLength2[i])/2.+yHalfLength1[BSCNbTheta*2+i])
553 *
sin(thetaPosition[i]);
554 yPosition[BSCNbTheta*2+i]=(xHalfLength1[BSCNbTheta*2+i]
555 +xHalfLength3[BSCNbTheta*2+i]
556 +xHalfLength2[BSCNbTheta*2+i]
557 +xHalfLength4[BSCNbTheta*2+i])/4.;
558
559 xPosition[BSCNbTheta*4+i]=xPosition[i]
560 -((yHalfLength1[i]+yHalfLength2[i])/2.+yHalfLength1[BSCNbTheta*4+i])
561 *
cos(thetaPosition[i]);
562 zPosition[BSCNbTheta*4+i]=zPosition[i]
563 -((yHalfLength1[i]+yHalfLength2[i])/2.+yHalfLength1[BSCNbTheta*4+i])
564 *
sin(thetaPosition[i]);
565 yPosition[BSCNbTheta*4+i]=(xHalfLength1[BSCNbTheta*4+i]
566 +xHalfLength3[BSCNbTheta*4+i]
567 +xHalfLength2[BSCNbTheta*4+i]
568 +xHalfLength4[BSCNbTheta*4+i])/4.;
569
570 }
571
572 if(verboseLevel>1)
573 for(i=0;i<BSCNbTheta*6;i++)
574 {
575 G4cout << "The sizes of the " << i+1 << " crystal are:" << G4endl
576 << "zHalfLength =" << zHalfLength[i]/cm << "(cm)," << G4endl
577 << "thetaAxis =" << thetaAxis[i]/deg << "(deg),"<< G4endl
578 << "phiAxis =" << phiAxis[i]/deg << "(deg),"<< G4endl
579 << "yHalfLength1=" << yHalfLength1[i]/cm << "(cm)," << G4endl
580 << "xHalfLength1=" << xHalfLength1[i]/cm << "(cm)," << G4endl
581 << "xHalfLength2=" << xHalfLength2[i]/cm << "(cm)," << G4endl
582 << "tanAlpha1 =" << tanAlpha1[i] << G4endl
583 << "yHalfLength2=" << yHalfLength2[i]/cm << "(cm)," << G4endl
584 << "xHalfLength3=" << xHalfLength3[i]/cm << "(cm)," << G4endl
585 << "xHalfLength4=" << xHalfLength4[i]/cm << "(cm)," << G4endl
586 << "tanAlpha2 =" << tanAlpha2[i] << "." << G4endl
587 << "The position of the " << i+1 << " crystal is:" << G4endl
588 << "(" << xPosition[i]/cm << ","
589 << yPosition[i]/cm << ","
590 << zPosition[i]/cm << ")cm" << G4endl;
591 }
592
593}