Belle II Software development
EclNbr Class Reference

EclNbr class. More...

#include <ECLGeometryPar.h>

Public Types

typedef EclIdentifier Identifier
 constants, enums and typedefs
 

Public Member Functions

 EclNbr ()
 Constructors and destructor.
 
 EclNbr (const EclNbr &aNbr)
 Constructor of EclNbr.
 
 EclNbr (const std::vector< Identifier > &aNbrs, const std::vector< Identifier >::size_type aNearSize)
 Constructor of EclNbr.
 
virtual ~EclNbr ()
 destructor
 
const std::vector< Identifier > & nbrs () const
 get crystals nbrs
 
const std::vector< Identifier >::const_iterator nearBegin () const
 get crystals nearBegin
 
const std::vector< Identifier >::const_iterator nearEnd () const
 get crystals nearEnd
 
const std::vector< Identifier >::const_iterator nextBegin () const
 get crystals nextBegin
 
const std::vector< Identifier >::const_iterator nextEnd () const
 get crystals nextEnd
 
std::vector< Identifier >::size_type nearSize () const
 get crystals nearSize
 
std::vector< Identifier >::size_type nextSize () const
 get crystals nextSize
 
EclNbroperator= (const EclNbr &aNbr)
 assignment operator(s)
 
EclNbr getNbr (const Identifier aCellId)
 get crystals nbr
 
void printNbr ()
 print crystals nbrs
 
void Mapping (int cid)
 Mapping theta, phi Id.
 
int GetCellID (int ThetaId, int PhiId)
 Get Cell Id.
 
int GetCellID ()
 Get Cell Id.
 
int GetThetaID ()
 Get Theta Id.
 
int GetPhiID ()
 Get Phi Id.
 

Private Attributes

int mNbr_cellID
 data members
 
int mNbr_thetaID
 The Theta ID information.
 
int mNbr_phiID
 The Phi ID information.
 
std::vector< Identifier > & m_nbrs
 id of m_brs
 
std::vector< Identifier >::size_type m_nearSize
 size of near brs
 

Detailed Description

EclNbr class.

Definition at line 150 of file ECLGeometryPar.h.

Member Typedef Documentation

◆ Identifier

typedef EclIdentifier Identifier

constants, enums and typedefs

Definition at line 155 of file ECLGeometryPar.h.

Constructor & Destructor Documentation

◆ EclNbr() [1/3]

EclNbr ( )

Constructors and destructor.

Definition at line 505 of file ECLGeometryPar.cc.

505 :
506 m_nbrs(*new std::vector< Identifier >)
507{
508 mNbr_cellID = 0;
509 mNbr_thetaID = 0;
510 mNbr_phiID = 0;
511}
int mNbr_thetaID
The Theta ID information.
int mNbr_cellID
data members
int mNbr_phiID
The Phi ID information.
std::vector< Identifier > & m_nbrs
id of m_brs

◆ EclNbr() [2/3]

EclNbr ( const EclNbr & aNbr)

Constructor of EclNbr.

Definition at line 513 of file ECLGeometryPar.cc.

513 :
514 m_nbrs(*new std::vector< Identifier > (aNbr.m_nbrs)),
516{
517 mNbr_cellID = 0;
518 mNbr_thetaID = 0;
519 mNbr_phiID = 0;
520}
std::vector< Identifier >::size_type m_nearSize
size of near brs

◆ EclNbr() [3/3]

EclNbr ( const std::vector< Identifier > & aNbrs,
const std::vector< Identifier >::size_type aNearSize )

Constructor of EclNbr.

Definition at line 522 of file ECLGeometryPar.cc.

525 :
526 m_nbrs(*new std::vector< Identifier > (aNbrs)),
527 m_nearSize(aNearSize)
528{
529 // sort vector separately for near, nxt-near nbrs
530 std::sort(m_nbrs.begin(), m_nbrs.begin() + aNearSize, std::less< Identifier >()) ;
531 std::sort(m_nbrs.begin() + aNearSize, m_nbrs.end(), std::less< Identifier >()) ;
532}

◆ ~EclNbr()

~EclNbr ( )
virtual

destructor

Definition at line 534 of file ECLGeometryPar.cc.

535{
536 delete &m_nbrs ;
537}

Member Function Documentation

◆ GetCellID() [1/2]

int GetCellID ( )
inline

Get Cell Id.

Definition at line 199 of file ECLGeometryPar.h.

199{return mNbr_cellID;};

◆ GetCellID() [2/2]

int GetCellID ( int ThetaId,
int PhiId )

Get Cell Id.

Definition at line 637 of file ECLGeometryPar.cc.

638{
639 mNbr_cellID = Mapping_t::CellID(ThetaId, PhiId);
640 mNbr_thetaID = ThetaId;
641 mNbr_phiID = PhiId ;
642 return mNbr_cellID;
643}
static int CellID(int ThetaId, int PhiId)
return cell id as a function of theta id and phi id

◆ getNbr()

EclNbr getNbr ( const Identifier aCellId)

get crystals nbr

Definition at line 652 of file ECLGeometryPar.cc.

653{
654 // generate nbr lists. always easier here to work with theta-phi
655
656 const int cellID = aCellId;
657 Mapping(cellID);
658 const int thetaId = GetThetaID();
659 const int phiId = GetPhiID();
660 std::vector< EclNbr::Identifier >::size_type nearSize(0);
661 std::vector< EclNbr::Identifier > vNbr;
662
663 vNbr.reserve(24) ; // except for extreme endcaps, always 24
664
665 int t00 = thetaId;
666 int tm1 = thetaId - 1;
667 int tm2 = thetaId - 2;
668 int tp1 = thetaId + 1;
669 int tp2 = thetaId + 2;
670
671 if (ECLElementNumbers::isBarrel(aCellId + 1)) {
672 // Barrel.
673 //
674 // 12 13 14 15 16 ^ theta
675 // 11 2 3 4 17 |
676 // 10 1 0 5 18 +--> phi X--+ view from inside
677 // 9 8 7 6 19 | (foot pointing e- dir)
678 // 24 23 22 21 20 Z
679 int f00 = phiId;
680 int fm1 = (phiId + 143) % 144;
681 int fp1 = (phiId + 1) % 144;
682 int fm2 = (phiId + 142) % 144;
683 int fp2 = (phiId + 2) % 144;
684
685 vNbr.push_back(GetCellID(t00, fm1));
686 vNbr.push_back(GetCellID(tp1, fm1));
687 vNbr.push_back(GetCellID(tp1, f00));
688 vNbr.push_back(GetCellID(tp1, fp1));
689 vNbr.push_back(GetCellID(t00, fp1));
690 vNbr.push_back(GetCellID(tm1, fp1));
691 vNbr.push_back(GetCellID(tm1, f00));
692 vNbr.push_back(GetCellID(tm1, fm1));
693
694 nearSize = vNbr.size();
695
696 vNbr.push_back(GetCellID(tm1, fm2));
697 vNbr.push_back(GetCellID(t00, fm2));
698 vNbr.push_back(GetCellID(tp1, fm2));
699 vNbr.push_back(GetCellID(tp2, fm2));
700 vNbr.push_back(GetCellID(tp2, fm1));
701 vNbr.push_back(GetCellID(tp2, f00));
702 vNbr.push_back(GetCellID(tp2, fp1));
703 vNbr.push_back(GetCellID(tp2, fp2));
704 vNbr.push_back(GetCellID(tp1, fp2));
705 vNbr.push_back(GetCellID(t00, fp2));
706 vNbr.push_back(GetCellID(tm1, fp2));
707 vNbr.push_back(GetCellID(tm2, fp2));
708 vNbr.push_back(GetCellID(tm2, fp1));
709 vNbr.push_back(GetCellID(tm2, f00));
710 vNbr.push_back(GetCellID(tm2, fm1));
711 vNbr.push_back(GetCellID(tm2, fm2));
712 } else {
713 // Forward or backward.
714 // endcap -- not always 24!
715 int n00 = 1000;
716 int np1 = 1000;
717 int np2 = 1000;
718 int nm1 = 1000;
719 int nm2 = 1000;
720 if (ECLElementNumbers::isForward(aCellId + 1)) {
721 // Forward.
722 const EclIdentifier mPerRingForward[]
723 = { 48, 48, 64, 64, 64, 96, 96, 96, 96, 96, 96, 144, 144, 144, 144 };
724 if (thetaId > 1) nm2 = mPerRingForward[ thetaId - 2 ];
725 if (thetaId > 0) nm1 = mPerRingForward[ thetaId - 1 ];
726 n00 = mPerRingForward[ thetaId ];
727 np1 = mPerRingForward[ thetaId + 1 ];
728 np2 = mPerRingForward[ thetaId + 2 ];
729 } else {
730 // Backward.
731 const EclIdentifier mPerRingBackward[]
732 = { 64, 64, 64, 96, 96, 96, 96, 96, 144, 144, 144, 144 };
733 if (thetaId < 67) np2 = mPerRingBackward[ 66 - thetaId ];
734 if (thetaId < 68) np1 = mPerRingBackward[ 67 - thetaId ];
735 n00 = mPerRingBackward[ 68 - thetaId ];
736 nm1 = mPerRingBackward[ 69 - thetaId ];
737 nm2 = mPerRingBackward[ 70 - thetaId ];
738 }
739 // f-- are phi's, t-- are thetas
740 // all calculations should be integer arith - pcs
741 // f(th,phi)
742 // criterion: center -> next bin
743 int f0000 = phiId;
744 int fp100 = (f0000 * np1 + np1 / 2) / n00;
745 int fp200 = (f0000 * np2 + np2 / 2) / n00;
746 int fm100 = (f0000 * nm1 + nm1 / 2) / n00;
747 int fm200 = (f0000 * nm2 + nm2 / 2) / n00;
748
749 int f00m1 = (f0000 + n00 - 1) % n00; // should be exact
750 int f00m2 = (f0000 + n00 - 2) % n00;
751 int f00p1 = (f0000 + 1) % n00;
752 int f00p2 = (f0000 + 2) % n00;
753
754 int fp1m1 = (fp100 + np1 - 1) % np1;
755 int fp1m2 = (fp100 + np1 - 2) % np1;
756 int fp1p1 = (fp100 + 1) % np1;
757 int fp1p2 = (fp100 + 2) % np1;
758
759 int fm1m1 = (fm100 + nm1 - 1) % nm1;
760 int fm1m2 = (fm100 + nm1 - 2) % nm1;
761 int fm1p1 = (fm100 + 1) % nm1;
762 int fm1p2 = (fm100 + 2) % nm1;
763
764 int fp2m1 = (fp200 + np2 - 1) % np2;
765 int fp2m2 = (fp200 + np2 - 2) % np2;
766 int fp2p1 = (fp200 + 1) % np2;
767 int fp2p2 = (fp200 + 2) % np2;
768
769 int fm2m1 = (fm200 + nm2 - 1) % nm2;
770 int fm2m2 = (fm200 + nm2 - 2) % nm2;
771 int fm2p1 = (fm200 + 1) % nm2;
772 int fm2p2 = (fm200 + 2) % nm2;
773 int delta = n00 / 16;
774// int sector = phiId/delta; // 0..15
775 int nth = phiId % delta;
776
777 switch (thetaId) {
778 case 0:
779 if (nth == 1)
780 fp2p2 = 1000;
781 break;
782 case 1:
783 if (nth == 1) {
784 fp2p2 = 1000;
785 fp1p2 = fp1p1;
786 fp1p1 = 1000;
787 }
788 break;
789 case 2:
790 if ((nth == 0) || (nth == 1)) {
791 fm2p2 = 1000;
792 fm1p2 = fm1p1;
793 fm1p1 = 1000;
794 } else if ((nth == 2) || (nth == 3)) {
795 fm2m2 = 1000;
796 fm1m2 = fm1m1;
797 fm1m1 = 1000;
798 }
799 break;
800 case 3:
801 if ((nth == 0) || (nth == 3)) {
802 fm2p2 = fm2m2 = 1000;
803 } else if (nth == 1) {
804 fm2p2 = 1000;
805 } else if (nth == 2) {
806 fm2m2 = 1000;
807 }
808 break;
809 case 5:
810 if ((nth == 2) || (nth == 5)) {
811 fm2m2 = 1000;
812 fm1m2 = fm1m1;
813 fm1m1 = 1000;
814 } else {
815 fm2p2 = 1000;
816 fm1p2 = fm1p1;
817 fm1p1 = 1000;
818 }
819 break;
820 case 6:
821 fm2p2 = 1000;
822 if ((nth == 0) || (nth == 2) || (nth == 3) || (nth == 5)) {
823 fm2m2 = 1000;
824 }
825 break;
826 case 11:
827 if ((nth == 2) || (nth == 5) || (nth == 8)) {
828 fm2m2 = 1000;
829 fm1m2 = fm1m1;
830 fm1m1 = 1000;
831 } else {
832 fm2p2 = 1000;
833 fm1p2 = fm1p1;
834 fm1p1 = 1000;
835 }
836 break;
837 case 12:
838 fm2p2 = 1000;
839 if ((nth == 0) || (nth == 2) || (nth == 3)
840 || (nth == 5) || (nth == 6) || (nth == 8))
841 fm2m2 = 1000;
842 break;
843 case 65:
844 if ((nth == 2) || (nth == 5)) {
845 fp2m2 = 1000;
846 fp1m2 = fp1m1;
847 fp1m1 = 1000;
848 } else {
849 fp2p2 = 1000;
850 fp1p2 = fp1p1;
851 fp1p1 = 1000;
852 }
853 break;
854 case 64:
855 fp2p2 = 1000;
856 if ((nth == 0) || (nth == 2) || (nth == 3) || (nth == 5))
857 fp2m2 = 1000;
858 break;
859 case 60:
860 if ((nth == 2) || (nth == 5) || (nth == 8)) {
861 fp2m2 = 1000;
862 fp1m2 = fp1m1;
863 fp1m1 = 1000;
864 } else {
865 fp2p2 = 1000;
866 fp1p2 = fp1p1;
867 fp1p1 = 1000;
868 }
869 break;
870 case 59:
871 fp2p2 = 1000;
872 if ((nth == 0) || (nth == 2) || (nth == 3) || (nth == 5)
873 || (nth == 6) || (nth == 8))
874 fp2m2 = 1000;
875 break;
876 }//switch
877
878 // insert near-nbrs
879 vNbr.push_back(GetCellID(t00, f00m1));
880 vNbr.push_back(GetCellID(t00, f00p1));
881 if (nm1 < 999) {
882 vNbr.push_back(GetCellID(tm1, fm100));
883 if (fm1m1 < 999)
884 vNbr.push_back(GetCellID(tm1, fm1m1));
885 if (fm1p1 < 999)
886 vNbr.push_back(GetCellID(tm1, fm1p1));
887 }
888 if (np1 < 999) {
889 vNbr.push_back(GetCellID(tp1, fp100));
890 if (fp1m1 < 999)
891 vNbr.push_back(GetCellID(tp1, fp1m1));
892 if (fp1p1 < 999)
893 vNbr.push_back(GetCellID(tp1, fp1p1));
894 }
895 nearSize = vNbr.size() ;
896
897 // now on to next-near neighbors
898 if (nm2 < 999) {
899 vNbr.push_back(GetCellID(tm2, fm200));
900 if (fm2m1 < 999)
901 vNbr.push_back(GetCellID(tm2, fm2m1));
902 if (fm2p1 < 999)
903 vNbr.push_back(GetCellID(tm2, fm2p1));
904 if (fm2m2 < 999)
905 vNbr.push_back(GetCellID(tm2, fm2m2));
906 if (fm2p2 < 999)
907 vNbr.push_back(GetCellID(tm2, fm2p2));
908 }
909 if (nm1 < 999) {
910 if (fm1m2 < 999)
911 vNbr.push_back(GetCellID(tm1, fm1m2));
912 if (fm1p2 < 999)
913 vNbr.push_back(GetCellID(tm1, fm1p2));
914 }
915 vNbr.push_back(GetCellID(t00, f00m2));
916 vNbr.push_back(GetCellID(t00, f00p2));
917 if (np1 < 999) {
918 if (fp1m2 < 999)
919 vNbr.push_back(GetCellID(tp1, fp1m2));
920 if (fp1p2 < 999)
921 vNbr.push_back(GetCellID(tp1, fp1p2));
922 }
923 if (np2 < 999) {
924 vNbr.push_back(GetCellID(tp2, fp200));
925 if (fp2m1 < 999)
926 vNbr.push_back(GetCellID(tp2, fp2m1));
927 if (fp2p1 < 999)
928 vNbr.push_back(GetCellID(tp2, fp2p1));
929 if (fp2m2 < 999)
930 vNbr.push_back(GetCellID(tp2, fp2m2));
931 if (fp2p2 < 999)
932 vNbr.push_back(GetCellID(tp2, fp2p2));
933 }
934 }
935 return EclNbr(vNbr, nearSize);
936}
int GetPhiID()
Get Phi Id.
EclNbr()
Constructors and destructor.
void Mapping(int cid)
Mapping theta, phi Id.
std::vector< Identifier >::size_type nearSize() const
get crystals nearSize
int GetThetaID()
Get Theta Id.
int GetCellID()
Get Cell Id.
bool isForward(int cellId)
Check whether the crystal is in forward ECL.
bool isBarrel(int cellId)
Check whether the crystal is in barrel ECL.

◆ GetPhiID()

int GetPhiID ( )
inline

Get Phi Id.

Definition at line 203 of file ECLGeometryPar.h.

203{return mNbr_phiID;};

◆ GetThetaID()

int GetThetaID ( )
inline

Get Theta Id.

Definition at line 201 of file ECLGeometryPar.h.

201{return mNbr_thetaID;};

◆ Mapping()

void Mapping ( int cid)

Mapping theta, phi Id.

Definition at line 645 of file ECLGeometryPar.cc.

646{
647 mNbr_cellID = cid;
649}
static void Mapping(int id, int &ThetaId, int &PhiId)
Retrieving theta and phi id of crystal.

◆ nbrs()

const std::vector< EclNbr::Identifier > & nbrs ( ) const

get crystals nbrs

Definition at line 595 of file ECLGeometryPar.cc.

596{
597 return m_nbrs ;
598}

◆ nearBegin()

const std::vector< EclNbr::Identifier >::const_iterator nearBegin ( ) const

get crystals nearBegin

Definition at line 601 of file ECLGeometryPar.cc.

602{
603 return m_nbrs.begin() ;
604}

◆ nearEnd()

const std::vector< EclNbr::Identifier >::const_iterator nearEnd ( ) const

get crystals nearEnd

Definition at line 607 of file ECLGeometryPar.cc.

608{
609 return m_nbrs.begin() + m_nearSize ;
610}

◆ nearSize()

std::vector< EclNbr::Identifier >::size_type nearSize ( ) const

get crystals nearSize

Definition at line 625 of file ECLGeometryPar.cc.

626{
627 return m_nearSize ;
628}

◆ nextBegin()

const std::vector< EclNbr::Identifier >::const_iterator nextBegin ( ) const

get crystals nextBegin

Definition at line 613 of file ECLGeometryPar.cc.

614{
615 return m_nbrs.begin() + m_nearSize ;
616}

◆ nextEnd()

const std::vector< EclNbr::Identifier >::const_iterator nextEnd ( ) const

get crystals nextEnd

Definition at line 619 of file ECLGeometryPar.cc.

620{
621 return m_nbrs.end() ;
622}

◆ nextSize()

std::vector< EclNbr::Identifier >::size_type nextSize ( ) const

get crystals nextSize

Definition at line 631 of file ECLGeometryPar.cc.

632{
633 return (m_nbrs.size() - m_nearSize) ;
634}

◆ operator=()

EclNbr & operator= ( const EclNbr & aNbr)

assignment operator(s)

Definition at line 573 of file ECLGeometryPar.cc.

574{
575 if (this != &aNbr) {
578 mNbr_phiID = aNbr.mNbr_phiID;
579
580 m_nbrs = aNbr.m_nbrs ;
581 m_nearSize = aNbr.m_nearSize ;
582 }
583 return *this ;
584}

◆ printNbr()

void printNbr ( )

print crystals nbrs

Definition at line 555 of file ECLGeometryPar.cc.

556{
557 unsigned short Nri(0) ;
558 cout << "(";
559 for (std::vector< EclNbr::Identifier >::const_iterator
560 iNbr(m_nbrs.begin()) ;
561 iNbr != m_nbrs.end() ; ++iNbr) {
562 ++Nri;
563 if (iNbr != m_nbrs.begin() && Nri != m_nearSize + 1) cout << "," ;
564 if (Nri == m_nearSize + 1) cout << "|" ;
565 cout << std::setw(4) << (*iNbr) ;
566 }
567 cout << ")" << endl;
568}

Member Data Documentation

◆ m_nbrs

std::vector< Identifier >& m_nbrs
private

id of m_brs

Definition at line 221 of file ECLGeometryPar.h.

◆ m_nearSize

std::vector<Identifier>::size_type m_nearSize
private

size of near brs

Definition at line 222 of file ECLGeometryPar.h.

◆ mNbr_cellID

int mNbr_cellID
private

data members

The Cell ID information

Definition at line 218 of file ECLGeometryPar.h.

◆ mNbr_phiID

int mNbr_phiID
private

The Phi ID information.

Definition at line 220 of file ECLGeometryPar.h.

◆ mNbr_thetaID

int mNbr_thetaID
private

The Theta ID information.

Definition at line 219 of file ECLGeometryPar.h.


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