Skip to content
Snippets Groups Projects
Commit 6c172b3f authored by myliu@ihep.ac.cn's avatar myliu@ihep.ac.cn
Browse files

Add function cellposition()

parent 83f055df
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,7 @@ public:
virtual CellID cellID(const Vector3D& aLocalPosition, const Vector3D& aGlobalPosition,
const VolumeID& aVolumeID) const;
virtual double distanceTrackWire(const CellID& cID, const TVector3& hit_start, const TVector3& hit_end) const;
virtual void cellposition(const CellID& cID, TVector3& Wstart, TVector3& Wend) const;
// double phi(const CellID& cID) const;
inline double cell_Size() const { return m_cellSize; }
......@@ -86,13 +87,13 @@ public:
inline auto returnAllWires() const { return m_wiresPositions; }
inline TVector3 returnWirePosition(double angle, int sign) const {
TVector3 w(0, 0, 0);
w.SetX(_currentRadius * std::cos(angle));
w.SetY(_currentRadius * std::sin(angle));
w.SetZ(sign * m_detectorLength / 2.0);
return w;
}
// inline TVector3 returnWirePosition(double angle, int sign) const {
// TVector3 w(0, 0, 0);
// w.SetX(_currentRadius * std::cos(angle));
// w.SetY(_currentRadius * std::sin(angle));
// w.SetZ(sign * m_detectorLength / 2.0);
// return w;
// }
void updateParams(int layer) const{
auto it_end = layer_params.cend();
......@@ -115,10 +116,10 @@ public:
m_offset = offset;
}
inline double returnAlpha() const {
double alpha = 2 * std::asin(m_detectorLength * std::tan(m_epsilon0)/(2 * _currentRadius));
return alpha;
}
// inline double returnAlpha() const {
// double alpha = 2 * std::asin(m_detectorLength * std::tan(m_epsilon0)/(2 * _currentRadius));
// return alpha;
// }
protected:
......@@ -126,6 +127,19 @@ protected:
std::map<int,LAYER> layer_params; // <layer, {layerphi, R, eps, offset}>
std::map<int, std::vector<std::pair<TVector3, TVector3> >> m_wiresPositions; // < layer, vec<WireMidpoint, WireDirection> >
inline TVector3 returnWirePosition(double angle, int sign) const {
TVector3 w(0, 0, 0);
w.SetX(_currentRadius * std::cos(angle));
w.SetY(_currentRadius * std::sin(angle));
w.SetZ(sign * m_detectorLength / 2.0);
return w;
}
inline double returnAlpha() const {
double alpha = 2 * std::asin(m_detectorLength * std::tan(m_epsilon0)/(2 * _currentRadius));
return alpha;
}
double m_cellSize;
double m_epsilon0;
double m_detectorLength;
......
......@@ -72,8 +72,8 @@ double GridDriftChamber::phi(const CellID& cID) const {
return binToPosition(phiValue, _currentLayerphi, m_offset);
}
double GridDriftChamber::distanceTrackWire(const CellID& cID, const TVector3& hit_start,
const TVector3& hit_end) const {
void GridDriftChamber::cellposition(const CellID& cID, TVector3& Wstart,
TVector3& Wend) const {
auto layerIndex = _decoder->get(cID, "layer");
updateParams(layerIndex);
......@@ -81,8 +81,26 @@ double GridDriftChamber::distanceTrackWire(const CellID& cID, const TVector3& hi
double phi_start = phi(cID);
double phi_end = phi_start + returnAlpha();
TVector3 Wstart = returnWirePosition(phi_start, -1); // The default centimeter unit in DD4hep
TVector3 Wend = returnWirePosition(phi_end, 1); // The default centimeter unit in DD4hep
Wstart = returnWirePosition(phi_start, -1);
Wend = returnWirePosition(phi_end, 1);
}
double GridDriftChamber::distanceTrackWire(const CellID& cID, const TVector3& hit_start,
const TVector3& hit_end) const {
// auto layerIndex = _decoder->get(cID, "layer");
// updateParams(layerIndex);
//
// double phi_start = phi(cID);
// double phi_end = phi_start + returnAlpha();
// TVector3 Wstart = returnWirePosition(phi_start, -1); // The default centimeter unit in DD4hep
// TVector3 Wend = returnWirePosition(phi_end, 1); // The default centimeter unit in DD4hep
TVector3 Wstart = {0,0,0};
TVector3 Wend = {0,0,0};
cellposition(cID,Wstart,Wend);
TVector3 a = hit_end - hit_start;
TVector3 b = Wend - Wstart;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment