429 {
430
431 int phiStat = -99;
432 int etaStat = -99;
433 std::string chamber_str = "xxx";
434
435 if(crate.substr(0,1) == 'B' && crate.substr(2,2) == "01"){
436 if( (biny-61) > 0){
437 chamber_str = "BOS";
438 etaStat = (biny+1 - 61)/2;
439 phiStat = 2*(biny - 2*etaStat - 61) +4;
440 } else if( (biny-49) > 0){
441 chamber_str = "BOL";
442 etaStat = (biny+1 - 49)/2;
443 phiStat = 2*(biny - 49 - 2*etaStat)+ 3;
444 } else if( (biny-37) > 0){
445 chamber_str = "BMS";
446 etaStat = (biny+1 - 37)/2;
447 phiStat = 2*(biny - 2*etaStat - 37) + 4;
448 } else if ( (biny-25) > 0){
449 chamber_str = "BML";
450 etaStat = (biny+1 - 25)/2;
451 phiStat = 2*(biny - 25 - 2*etaStat) +3;
452 } else if ( (biny-24) > 0){
453 chamber_str = "BME";
454 etaStat = 1;
455 phiStat = 13;
456 } else if ( (biny-12) > 0){
457 chamber_str = "BIS";
458 etaStat = (biny+1 - 12)/2;
459 phiStat = 2*(biny - 2*etaStat - 12) + 4;
460 } else if ( (biny) > 0){
461 chamber_str = "BIL";
462 etaStat = (biny+1)/2;
463 phiStat = 2*(biny - 2*etaStat) + 3;
464 }
465 }else if (crate.substr(0,1) == "B" && crate.substr(2,2) == "02"){
466 if( (biny-60) > 0){
467 chamber_str = "BOS";
468 etaStat = (biny+1 - 60)/2;
469 phiStat = 2*(biny - 2*etaStat - 60) + 8;
470 } else if ( (biny-48) > 0){
471 chamber_str = "BOL";
472 etaStat = (biny+1 - 48)/2;
473 phiStat = 2*(biny - 2*etaStat - 48) + 7;
474 } else if ( (biny-36) > 0){
475 chamber_str = "BMS";
476 etaStat = (biny+1 - 36)/2;
477 phiStat = 2*(biny - 2*etaStat - 36) + 8;
478 } else if ( (biny-24) > 0){
479 chamber_str = "BML";
480 etaStat = (biny+1 - 24)/2;
481 phiStat = 2*(biny - 2*etaStat - 24) + 7;
482 } else if ( (biny-12) > 0){
483 chamber_str = "BIS";
484 etaStat = (biny+1 - 12)/2;
485 phiStat = 2*(biny - 2*etaStat - 12) + 8;
486 } else if ( (biny) > 0){
487 chamber_str = "BIL";
488 etaStat = (biny+1)/2;
489 phiStat = 2*(biny - 2*etaStat) + 7;
490 }
491 } else if(crate.substr(0,1) == "B" && crate.substr(2,2) == "03"){
492 int cOffset = 0;
493 if (crate.substr(1,1) == "C"){ cOffset = 1;}
494 if( (biny-74 + cOffset) > 0) {
495 chamber_str = "BOS";
496 etaStat = (biny - 74 + cOffset);
497 phiStat = 10;
498 } else if ( (biny-62 + cOffset) > 0){
499 chamber_str = "BOL";
500 etaStat = (biny+1 - 62 + cOffset)/2;
501 phiStat = 2*(biny - 2*etaStat - 62 + cOffset) + 11;
502 } else if ( (biny - 57 ) > 0){
503 chamber_str = "BOG";
504 etaStat = 2*(biny - 57) - 2 + 2*cOffset;
505 phiStat = 12;
506 } else if ( (biny-53) > 0){
507 chamber_str = "BOF";
508 etaStat = 2*(biny - 53) - 1;
509 phiStat = 12;
510 } else if( (biny-47) > 0){
511 chamber_str = "BMS";
512 etaStat = biny - 47;
513 phiStat = 10;
514 } else if ( (biny-35) > 0){
515 chamber_str = "BML";
516 etaStat = (biny+1 - 35)/2;
517 phiStat = 2*(biny - 2*etaStat - 35) + 11;
518 } else if ( (biny - 32) > 0){
519 chamber_str = "BMG";
520 etaStat = (biny - 32)*2 ;
521 phiStat = 12;
522 } else if ( (biny - 29) > 0){
523 chamber_str = "BMF";
524 etaStat = biny - 29;
525 phiStat = 12;
526 } else if ( (biny-17) > 0){
527 chamber_str = "BIS";
528 etaStat = (biny+1 - 17)/2;
529 phiStat = 2*(biny - 2*etaStat - 17) + 12;
530 } else if ( (biny-11) > 0){
531 chamber_str = "BIR";
532 etaStat = biny-11;
533 phiStat = 11;
534 } else if ( (biny-6) > 0){
535 chamber_str = "BIM";
536 etaStat = biny-6;
537 phiStat = 11;
538 } else if ( (biny) > 0){
539 chamber_str = "BIL";
540 etaStat = biny;
541 phiStat = 9;
542 }
543 } else if(crate.substr(0,1) == "B" && crate.substr(2,2) == "04"){
544 int cOffset = 0;
545 if (crate.substr(1,1) == "C"){ cOffset = 1;}
546 if( (biny-74 + cOffset) > 0) {
547 chamber_str = "BOS";
548 etaStat = (biny - 74 + cOffset);
549 phiStat = 16;
550 } else if ( (biny-61 + cOffset) > 0){
551 chamber_str = "BOL";
552 etaStat = (biny+1 - 61 + cOffset)/2;
553 phiStat = 2*(biny - 2*etaStat - 61 + cOffset) + 15;
554 } else if ( (biny - 56 ) > 0){
555 chamber_str = "BOG";
556 etaStat = 2*(biny - 56) - 2 + 2*cOffset;
557 phiStat = 14;
558 } else if ( (biny-52) > 0){
559 chamber_str = "BOF";
560 etaStat = 2*(biny - 52) - 1;
561 phiStat = 14;
562 } else if( (biny-46) > 0){
563 chamber_str = "BMS";
564 etaStat = biny - 43;
565 phiStat = 16;
566 } else if ( (biny - 45) > 0){
567 chamber_str = "BML";
568 etaStat = 6;
569 phiStat = 15;
570 } else if ( (biny-35) > 0){
571 chamber_str = "BML";
572 etaStat = (biny+1 - 35)/2;
573 phiStat = 2*(biny - 2*etaStat - 35) + 15;
574 } else if ( (biny - 32) > 0){
575 chamber_str = "BMG";
576 etaStat = (biny - 32)*2;
577 phiStat = 14;
578 } else if ( (biny - 29) > 0){
579 chamber_str = "BMF";
580 etaStat = biny - 29;
581 phiStat = 14;
582 } else if ( (biny-17) > 0){
583 chamber_str = "BIS";
584 etaStat = (biny+1 - 17)/2;
585 phiStat = 2*(biny - 2*etaStat - 17) + 16;
586 } else if ( (biny-11) > 0){
587 chamber_str = "BIR";
588 etaStat = biny-11;
589 phiStat = 15;
590 } else if ( (biny-6) > 0){
591 chamber_str = "BIM";
592 etaStat = biny-6;
593 phiStat = 15;
594 } else if ( (biny) > 0){
595 chamber_str = "BIL";
596 etaStat = biny;
597 phiStat = 13;
598 }
599 } else if(crate.substr(0,1) == "E" && (crate.substr(2,2) == "01" || crate.substr(2,2) == "03") ){
600 int cOffset = 0;
601 if (crate.substr(2,2) == "03"){ cOffset = 8;}
602 if( (biny-61) > 0) {
603 chamber_str = "EOS";
604 etaStat = (biny+1 - 61)/2;
605 phiStat = 2*(biny - 2*etaStat - 61) + 4 + cOffset;
606 } else if ( (biny-49) > 0){
607 chamber_str = "EOL";
608 etaStat = (biny+1 - 49)/2;
609 phiStat = 2*(biny - 2*etaStat - 49) + 3 + cOffset;
610 } else if ( (biny - 39 ) > 0){
611 chamber_str = "EMS";
612 etaStat = (biny+1 - 39)/2;
613 phiStat = 2*(biny - 2*etaStat - 39) + 4 + cOffset;
614 } else if ( (biny-29) > 0){
615 chamber_str = "EML";
616 etaStat = (biny+1 - 29)/2;
617 phiStat = 2*(biny - 2*etaStat - 29) + 3 + cOffset;
618 } else if( (biny-25) > 0){
619 chamber_str = "EIS";
620 etaStat = (biny+1 - 25)/2;
621 phiStat = 2*(biny - 2*etaStat - 25) + 4 + cOffset;
622 } else if ( (biny - 16) > 0){
623 chamber_str = "EIL";
624 etaStat = (biny+1 - 16)/2;
625 phiStat = 2*(biny - 2*etaStat - 16) + 3 + cOffset;
626 } else if ( (biny-12) > 0){
627 chamber_str = "EES";
628 etaStat = (biny+1 - 12)/2;
629 phiStat = 2*(biny - 2*etaStat - 12) + 4 + cOffset;
630 } else if ( (biny - 8) > 0){
631 chamber_str = "EEL";
632 etaStat = (biny+1 - 8)/2;
633 phiStat = 2*(biny - 2*etaStat - 8 ) + 3 + cOffset;
634 } else if ( (biny-4) > 0){
635 chamber_str = "BIS";
636 etaStat = (biny+1 - 4)/2 + 6;
637 phiStat = 2*(biny - 2*(etaStat-6) - 4) + 4 + cOffset;
638 } else if ( (biny) > 0){
639 chamber_str = "BEE";
640 etaStat = (biny+1)/2;
641 phiStat = 2*(biny - 2*etaStat) + 4 + cOffset;
642 }
643 } else if(crate.substr(0,1) == "E" && (crate.substr(2,2) == "02" || crate.substr(2,2) == "04") ){
644 int cOffset = 0; int phiOffset = 0;
645 if (crate.substr(2,2) == "04"){
646 cOffset = 1; phiOffset = 8;
647 }
648 if( (biny-59 - cOffset) > 0) {
649 chamber_str = "EOS";
650 etaStat = (biny+1 - 59 - cOffset)/2;
651 phiStat = 2*(biny - 2*etaStat - 59 - cOffset) + 8 + phiOffset;
652 } else if ( (biny-47 - cOffset) > 0){
653 chamber_str = "EOL";
654 etaStat = (biny+1 - 47 - cOffset)/2;
655 phiStat = 2*(biny - 2*etaStat - 47 - cOffset) + 7 + phiOffset;
656 } else if ( (biny - 37 - cOffset ) > 0){
657 chamber_str = "EMS";
658 etaStat = (biny+1 - 37 - cOffset)/2;
659 phiStat = 2*(biny - 2*etaStat - 37 - cOffset) + 8 + phiOffset;
660 } else if ( (biny-27 - cOffset) > 0){
661 chamber_str = "EML";
662 etaStat = (biny+1 - 27 - cOffset)/2;
663 phiStat = 2*(biny - 2*etaStat - 27 - cOffset) + 7 + phiOffset;
664 } else if( (biny-23 - cOffset) > 0){
665 chamber_str = "EIS";
666 etaStat = (biny+1 - 23 - cOffset)/2;
667 phiStat = 2*(biny - 2*etaStat - 23 - cOffset) + 8 + phiOffset;
668 } else if ( (biny - 15 - cOffset) > 0){
669 chamber_str = "EIL";
670 etaStat = (biny+1 - 15 - cOffset)/2;
671 phiStat = 2*(biny - 2*etaStat - 15 - cOffset) + 7 + phiOffset;
672 } else if ( (biny-11 - cOffset) > 0){
673 chamber_str = "EES";
674 etaStat = (biny+1 - 11 - cOffset)/2;
675 phiStat = 2*(biny - 2*etaStat - 11 - cOffset) + 8 + phiOffset;
676 } else if ( (biny - 8) > 0){
677 chamber_str = "EEL";
678 etaStat = (biny+1 - 8)/2;
679 phiStat = 2*(biny - 2*etaStat - 8 ) + 7 + phiOffset;
680 if(cOffset == 0 && etaStat == 2){phiStat = 7;}
681 } else if ( (biny-4) > 0){
682 chamber_str = "BIS";
683 etaStat = (biny+1 - 4)/2 + 6;
684 phiStat = 2*(biny - 2*(etaStat-6) - 4) + 8 + phiOffset;
685 } else if ( (biny) > 0){
686 chamber_str = "BEE";
687 etaStat = (biny+1)/2;
688 phiStat = 2*(biny - 2*etaStat) + 8 + phiOffset;
689 }
690 }
691 std::string phiStat_str = TString::Format("%i", phiStat).Data();
692 if(phiStat_str.size() == 1) phiStat_str = std::string("0")+phiStat_str;
693 std::string etaStat_c = TString::Format("%i", etaStat).Data();
694 std::string
chamber_name = chamber_str + etaStat_c + crate.substr(1,1) + phiStat_str;
695 if(chamber_str == "BOG" && etaStat == 0){
696 chamber_name = chamber_str + etaStat_c +
"B" + phiStat_str;
697 }
699}