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

Class to get position information for a cluster for leakage corrections. More...

#include <ECLLeakagePosition.h>

Collaboration diagram for ECLLeakagePosition:

Public Member Functions

 ECLLeakagePosition ()
 Constructor.
 
 ~ECLLeakagePosition ()
 Destructor.
 
std::vector< int > getLeakagePosition (const int cellIDFromEnergy, const float theta, const float phi, const int nPositions)
 Return postion. More...
 

Private Attributes

DBObjPtr< ECLCrystalCalibm_ECLCrystalThetaEdge
 Required geometry payloads. More...
 
std::vector< float > m_thetaEdge
 lower theta edges from DB object
 
DBObjPtr< ECLCrystalCalibm_ECLCrystalPhiEdge
 lower edges of crystals, phi
 
std::vector< float > m_phiEdge
 lower phi edges from DB object
 
DBObjPtr< ECLCrystalCalibm_ECLCrystalThetaWidth
 width in theta
 
std::vector< float > m_thetaWidth
 crystal theta widths from DB object
 
DBObjPtr< ECLCrystalCalibm_ECLCrystalPhiWidth
 width in phi
 
std::vector< float > m_phiWidth
 crystal phi widths from DB object
 
ECL::ECLNeighboursm_neighbours {nullptr}
 8 nearest neighbours to crystal
 
std::vector< int > m_thetaIDofCrysID
 thetaID of each crystal ID
 
std::vector< int > m_phiIDofCrysID
 phiID of each crystal ID
 
std::vector< int > m_crysBetweenMech
 crystals between phi mechanical structure per thetaID
 
const int m_firstBarrelThetaID = 13
 first barrel thetaID
 
const int m_lastBarrelThetaID = 58
 last barrel thetaID
 

Detailed Description

Class to get position information for a cluster for leakage corrections.

Definition at line 24 of file ECLLeakagePosition.h.

Member Function Documentation

◆ getLeakagePosition()

std::vector< int > getLeakagePosition ( const int  cellIDFromEnergy,
const float  theta,
const float  phi,
const int  nPositions 
)

Return postion.

Elements of returned vector: cellID, thetaID, region, localThetaBin, localPhiBin, phiMech, status region: 0 = forward, 1 = barrel, 2 = backward localPhiBin is from edge with mechanical structure, or else lower edge phiMech: 0 = mechanical structure on phi edge; 1 = no mechanical structure status: 0 = cellID is max energy crystal; 1 = neighbour; 2 = more distant

Definition at line 73 of file ECLLeakagePosition.cc.

75 {
76 
77  //..Start by checking if the crystal with the most energy is the correct one
78  int crysID = cellIDFromEnergy - 1;
79  int iStatus = -1;
80 
81  //..theta and phi need to be within the crystal
82  float dTheta = theta - m_thetaEdge[crysID];
83  float dPhi = phi - m_phiEdge[crysID];
84  if (dPhi > TMath::Pi()) {dPhi -= 2.*TMath::Pi();}
85  if (dPhi < -TMath::Pi()) {dPhi += 2.*TMath::Pi();}
86  if (dTheta >= 0 and dTheta <= m_thetaWidth[crysID] and dPhi >= 0 and dPhi <= m_phiWidth[crysID]) {
87  iStatus = 0;
88  }
89 
90  //..Theta and phi are not located in the maximum energy crystal. Check the
91  // eight nearest neighbours.
92  if (iStatus == -1) {
93 
94  //..Nearest neighbours (plus the central crystal)
95  for (const auto& tempCellID : m_neighbours->getNeighbours(cellIDFromEnergy)) {
96  int tempCrysID = tempCellID - 1;
97  dTheta = theta - m_thetaEdge[tempCrysID];
98  dPhi = phi - m_phiEdge[tempCrysID];
99  if (dPhi > TMath::Pi()) {dPhi -= 2.*TMath::Pi();}
100  if (dPhi < -TMath::Pi()) {dPhi += 2.*TMath::Pi();}
101 
102  //..This one is correct
103  if (dTheta >= 0 and dTheta <= m_thetaWidth[tempCrysID] and dPhi >= 0 and dPhi <= m_phiWidth[tempCrysID]) {
104  iStatus = 1;
105  crysID = tempCrysID;
106  break;
107  }
108  }
109  }
110 
111  //..Need to do this one by brute force
112  if (iStatus == -1) {
113 
114  //..Start at the last crystal and work backwards
115  for (int crys = 8735; crys >= 0; crys--) {
116  dTheta = theta - m_thetaEdge[crys];
117  dPhi = phi - m_phiEdge[crys];
118  if (dPhi > TMath::Pi()) {dPhi -= 2.*TMath::Pi();}
119  if (dPhi < -TMath::Pi()) {dPhi += 2.*TMath::Pi();}
120  if (dPhi >= 0 and dPhi <= m_phiWidth[crys] and dTheta >= 0) {
121  iStatus = 2;
122  crysID = crys;
123  break;
124  }
125  }
126  }
127 
128  //..Above should cover all cases, but set sensible values if we missed something
129  if (iStatus == -1) {
130  iStatus = 3;
131  crysID = cellIDFromEnergy - 1;
132  dTheta = 0.5;
133  dPhi = 0.5;
134  }
135 
136  //..Return values
137  int cellID = crysID + 1;
138  int thetaID = m_thetaIDofCrysID[crysID];
139  int iRegion = 0;
140  if (thetaID >= m_firstBarrelThetaID and thetaID <= m_lastBarrelThetaID) {iRegion = 1;}
141  if (thetaID > m_lastBarrelThetaID) {iRegion = 2;}
142 
143  //..Mechanical structure is on lower edge of phiID 0, and every 2 (barrel) or n (endcap)
144  // crystals thereafter
145  int iPhiMech = m_phiIDofCrysID[crysID] % m_crysBetweenMech[thetaID];
146  bool reversePhi;
147 
148  //..Mechanical structure on lower edge
149  if ((iPhiMech == 0 and iRegion != 1) or (iPhiMech == m_crysBetweenMech[thetaID] - 1 and iRegion == 1)) {
150  iPhiMech = 0;
151  reversePhi = false;
152 
153  //..Mechanical structure on upper edge
154  } else if ((iPhiMech == m_crysBetweenMech[thetaID] - 1 and iRegion != 1) or (iPhiMech == 0 and iRegion == 1)) {
155  iPhiMech = 0;
156  reversePhi = true;
157 
158  //..No mechanical structure adjacent
159  } else {
160  iPhiMech = 1;
161  reversePhi = false;
162  }
163 
164  //..Divide crystal into nPositions in width, starting from lower edge
165  int iLocalTheta = (int)(nPositions * dTheta / m_thetaWidth[crysID]);
166  if (iLocalTheta < 0) {iLocalTheta = 0;}
167  if (iLocalTheta >= nPositions) {iLocalTheta = nPositions - 1;}
168 
169  int iLocalPhi = (int)(nPositions * dPhi / m_phiWidth[crysID]);
170  if (iLocalPhi < 0) {iLocalPhi = 0;}
171  if (iLocalPhi >= nPositions) {iLocalPhi = nPositions - 1;}
172 
173  //..iLocalPhi is measured from edge with mechanical structure, if present,
174  // so reverse order of iLocalPhi if mech structure is on the upper edge
175  if (reversePhi) {iLocalPhi = nPositions - iLocalPhi - 1;}
176 
177  //..Return as a std::vector
178  std::vector<int> position;
179  position.push_back(cellID);
180  position.push_back(thetaID);
181  position.push_back(iRegion);
182  position.push_back(iLocalTheta);
183  position.push_back(iLocalPhi);
184  position.push_back(iPhiMech);
185  position.push_back(iStatus);
186  return position;
187 }
std::vector< int > m_crysBetweenMech
crystals between phi mechanical structure per thetaID
ECL::ECLNeighbours * m_neighbours
8 nearest neighbours to crystal
std::vector< int > m_thetaIDofCrysID
thetaID of each crystal ID
std::vector< float > m_thetaEdge
lower theta edges from DB object
std::vector< int > m_phiIDofCrysID
phiID of each crystal ID
std::vector< float > m_thetaWidth
crystal theta widths from DB object
std::vector< float > m_phiWidth
crystal phi widths from DB object
const int m_firstBarrelThetaID
first barrel thetaID
std::vector< float > m_phiEdge
lower phi edges from DB object
const int m_lastBarrelThetaID
last barrel thetaID
const std::vector< short int > & getNeighbours(short int cid) const
Return the neighbours for a given cell ID.

Member Data Documentation

◆ m_ECLCrystalThetaEdge

DBObjPtr<ECLCrystalCalib> m_ECLCrystalThetaEdge
private

Required geometry payloads.

lower edges of crystals, theta

Definition at line 45 of file ECLLeakagePosition.h.


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