diff --git a/Detector/DetSegmentation/DetSegmentation/GridDriftChamber.h b/Detector/DetSegmentation/DetSegmentation/GridDriftChamber.h
index d6fcd5dffaa115de4883f358ee1ce4cf9ea27910..38e236c0d19d8b4419184510036b9db7e873e261 100644
--- a/Detector/DetSegmentation/DetSegmentation/GridDriftChamber.h
+++ b/Detector/DetSegmentation/DetSegmentation/GridDriftChamber.h
@@ -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;
diff --git a/Detector/DetSegmentation/src/GridDriftChamber.cpp b/Detector/DetSegmentation/src/GridDriftChamber.cpp
index 4063a5ee229b86e67dc8664e5c50d345ebf085a6..b65edb2d3564a2f269526d946b67f8eb3d7f099d 100644
--- a/Detector/DetSegmentation/src/GridDriftChamber.cpp
+++ b/Detector/DetSegmentation/src/GridDriftChamber.cpp
@@ -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;