Belle II Software  release-08-01-10
ECLNeighbours Class Reference

Class to get the neighbours for a given cell id. More...

#include <ECLNeighbours.h>

Collaboration diagram for ECLNeighbours:

Public Member Functions

 ECLNeighbours (const std::string &neighbourDef, const double par, const bool sorted=false)
 Constructor: Fix number of neighbours ("N") in the seed theta ring, fraction cross ("F"), radius ("R") with par = n or par = fraction (0.1-1.0) or par = radius [cm]. More...
 
 ~ECLNeighbours ()
 Destructor.
 
const std::vector< short int > & getNeighbours (short int cid) const
 Return the neighbours for a given cell ID.
 
short int getCrystalsPerRing (const short int thetaid) const
 return number of crystals in a given theta ring
 

Private Member Functions

void initializeN (const int nneighbours, const bool sorted=false)
 initialize the mask neighbour list.
 
void initializeNC (const int nneighbours)
 initialize the mask neighbour list, remove corners.
 
void initializeNLegacy (const int nneighbours)
 initialize the mask neighbour list, legacy code.
 
void initializeNCLegacy (const int nneighbours, const int corners)
 initialize the mask neighbour list, remove corners, legacy code.
 
void initializeR (const double radius)
 initialize the radius neighbour list.
 
void initializeF (const double fraction)
 initialize the fractional cross neighbour list.
 
short int decreasePhiId (const short int phiid, const short int thetaid, const short int n)
 return the previous phi id.
 
short int increasePhiId (const short int phiid, const short int thetaid, const short int n)
 return the next phi id.
 
std::vector< short int > getPhiIdsInBetween (const short int phiInc, const short int phiDec, const short int theta)
 return a list of phi ids between two phi ids
 
std::vector< short int > getPhiIdsInBetweenC (const short int phiInc, const short int phiDec, const short int theta, const int corners)
 return a list of phi ids between two phi ids minus edges
 
double getDistance (const double alpha, const double R)
 return the chord length between cells
 

Private Attributes

std::vector< std::vector< short int > > m_neighbourMap
 list of list of neighbour cids.
 
std::vector< std::vector< short int > > m_neighbourMapTemp
 temporary list of list of neighbour cids.
 
const short m_crystalsPerRing [69]
 Number of crystals in each theta ring. More...
 

Detailed Description

Class to get the neighbours for a given cell id.

Definition at line 25 of file ECLNeighbours.h.

Constructor & Destructor Documentation

◆ ECLNeighbours()

ECLNeighbours ( const std::string &  neighbourDef,
const double  par,
const bool  sorted = false 
)

Constructor: Fix number of neighbours ("N") in the seed theta ring, fraction cross ("F"), radius ("R") with par = n or par = fraction (0.1-1.0) or par = radius [cm].

The sorted parameter will sort ascending thetaid and clockwise phi for the "N" case.

Definition at line 27 of file ECLNeighbours.cc.

28 {
29  // resize the vector
30  std::vector<short int> fakeneighbours;
31  fakeneighbours.push_back(0); // insert one fake to avoid the "0" entry
32  m_neighbourMap.push_back(fakeneighbours);
33 
34  int parToInt = int(par);
35 
36  // fixed number of neighbours:
37  if (neighbourDef == "N") {
38  B2DEBUG(150, "ECLNeighbours::ECLNeighbours: initialize " << neighbourDef << ", n x n: " << parToInt * 2 + 1 << " x " << parToInt * 2
39  + 1);
40  if ((parToInt >= 0) and (parToInt < 11)) initializeN(parToInt, sorted);
41  else B2FATAL("ECLNeighbours::ECLNeighbours: " << LogVar("parameter", parToInt) << "Invalid parameter (must be between 0 and 10)!");
42  } else if (neighbourDef == "NC") {
43  B2DEBUG(150, "ECLNeighbours::ECLNeighbours: initialize " << neighbourDef << ", n x n (minus corners): " << parToInt * 2 + 1 << " x "
44  <<
45  parToInt * 2 + 1);
46  if ((parToInt >= 0) and (parToInt < 11)) initializeNC(parToInt);
47  else B2FATAL("ECLNeighbours::ECLNeighbours: " << LogVar("parameter", parToInt) << "Invalid parameter (must be between 0 and 10)!");
48  } else if (neighbourDef == "NLegacy") {
49  B2DEBUG(150, "ECLNeighbours::ECLNeighbours: initialize " << neighbourDef << ", n x n: " << parToInt * 2 + 1 << " x " << parToInt * 2
50  + 1);
51  if ((parToInt >= 0) and (parToInt < 11)) initializeNLegacy(parToInt);
52  else B2FATAL("ECLNeighbours::ECLNeighbours: " << LogVar("parameter", parToInt) << "Invalid parameter (must be between 0 and 10)!");
53  } else if (neighbourDef == "NCLegacy") {
54  B2DEBUG(150, "ECLNeighbours::ECLNeighbours: initialize " << neighbourDef << ", n x n (minus corners): " << parToInt * 2 + 1 << " x "
55  <<
56  parToInt * 2 + 1);
57  if ((parToInt >= 0) and (parToInt < 11)) initializeNCLegacy(parToInt, 1);
58  else B2FATAL("ECLNeighbours::ECLNeighbours: " << LogVar("parameter", parToInt) << "Invalid parameter (must be between 0 and 10)!");
59  }
60  // or neighbours depend on the distance:
61  else if (neighbourDef == "R") {
62  B2DEBUG(150, "ECLNeighbours::ECLNeighbours: initialize " << neighbourDef << ", radius: " << par << " cm");
63  if ((par > 0.0) and (par < 30.0 * Belle2::Unit::cm)) initializeR(par);
64  else B2FATAL("ECLNeighbours::ECLNeighbours: " << par << " is an invalid parameter (must be between 0 cm and 30 cm)!");
65  }
66  // or neighbours that form a cross, user defined coverage of up to 100% in neighbouring ring:
67  else if (neighbourDef == "F") {
68  double parChecked = par;
69  if (parChecked > 1.0) parChecked = 1.0;
70  else if (parChecked < 0.1) parChecked = 0.1;
71  B2DEBUG(150, "ECLNeighbours::ECLNeighbours: initialize " << neighbourDef << ", fraction: " << parChecked);
72  initializeF(parChecked);
73  }
74  // or wrong type:
75  else {
76  B2FATAL("ECLNeighbours::ECLNeighbours (constructor via std::string): Invalid option: " << neighbourDef <<
77  " (valid: N(n), NC(n), NLegacy(n), NCLegacy(n), R ( with R<30 cm), F (with 0.1<f<1)");
78  }
79 
80 }
void initializeNCLegacy(const int nneighbours, const int corners)
initialize the mask neighbour list, remove corners, legacy code.
void initializeF(const double fraction)
initialize the fractional cross neighbour list.
void initializeR(const double radius)
initialize the radius neighbour list.
std::vector< std::vector< short int > > m_neighbourMap
list of list of neighbour cids.
Definition: ECLNeighbours.h:43
void initializeNC(const int nneighbours)
initialize the mask neighbour list, remove corners.
void initializeN(const int nneighbours, const bool sorted=false)
initialize the mask neighbour list.
void initializeNLegacy(const int nneighbours)
initialize the mask neighbour list, legacy code.
static const double cm
Standard units with the value = 1.
Definition: Unit.h:47
Class to store variables with their name which were sent to the logging service.

Member Data Documentation

◆ m_crystalsPerRing

const short m_crystalsPerRing[69]
private
Initial value:
= {
48, 48, 64, 64, 64, 96, 96, 96, 96, 96, 96, 144, 144,
144, 144, 144, 144, 144, 144, 144,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
144, 144, 144, 144, 144, 144, 144, 144, 144,
144, 144, 96, 96, 96, 96, 96, 64, 64, 64
}

Number of crystals in each theta ring.

Definition at line 49 of file ECLNeighbours.h.


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