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 504 of file ECLGeometryPar.cc.

504 :
505 m_nbrs(*new std::vector< Identifier >)
506{
507 mNbr_cellID = 0;
508 mNbr_thetaID = 0;
509 mNbr_phiID = 0;
510}
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 512 of file ECLGeometryPar.cc.

512 :
513 m_nbrs(*new std::vector< Identifier > (aNbr.m_nbrs)),
515{
516 mNbr_cellID = 0;
517 mNbr_thetaID = 0;
518 mNbr_phiID = 0;
519}
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 521 of file ECLGeometryPar.cc.

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

◆ ~EclNbr()

~EclNbr ( )
virtual

destructor

Definition at line 533 of file ECLGeometryPar.cc.

534{
535 delete &m_nbrs ;
536}

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 636 of file ECLGeometryPar.cc.

637{
638 mNbr_cellID = Mapping_t::CellID(ThetaId, PhiId);
639 mNbr_thetaID = ThetaId;
640 mNbr_phiID = PhiId ;
641 return mNbr_cellID;
642}
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 651 of file ECLGeometryPar.cc.

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

645{
646 mNbr_cellID = cid;
648}
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 594 of file ECLGeometryPar.cc.

595{
596 return m_nbrs ;
597}

◆ nearBegin()

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

get crystals nearBegin

Definition at line 600 of file ECLGeometryPar.cc.

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

◆ nearEnd()

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

get crystals nearEnd

Definition at line 606 of file ECLGeometryPar.cc.

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

◆ nearSize()

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

get crystals nearSize

Definition at line 624 of file ECLGeometryPar.cc.

625{
626 return m_nearSize ;
627}

◆ nextBegin()

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

get crystals nextBegin

Definition at line 612 of file ECLGeometryPar.cc.

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

◆ nextEnd()

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

get crystals nextEnd

Definition at line 618 of file ECLGeometryPar.cc.

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

◆ nextSize()

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

get crystals nextSize

Definition at line 630 of file ECLGeometryPar.cc.

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

◆ operator=()

EclNbr & operator= ( const EclNbr aNbr)

assignment operator(s)

Definition at line 572 of file ECLGeometryPar.cc.

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

◆ printNbr()

void printNbr ( )

print crystals nbrs

Definition at line 554 of file ECLGeometryPar.cc.

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

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: