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

Added shift

parent c8403f5a
No related branches found
No related tags found
No related merge requests found
......@@ -59,7 +59,7 @@
<readouts>
<readout name="DriftChamberHitsCollection">
<segmentation type="GridDriftChamber" cell_size="10*mm" offset_phi="0." epsilon0="Epsilon" detector_length="SDT_length" identifier_phi="cellID" />
<segmentation type="GridDriftChamber" cell_size="10*mm" epsilon0="Epsilon" detector_length="SDT_length" identifier_phi="cellID" />
<id>system:8,chamber:1,layer:8,cellID:16</id>
</readout>
......
......@@ -119,7 +119,7 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector,
double layer_Phi = 2*M_PI / ncell_layer;
if(layer_id %2 ==0){ offset = 0.; }
else { offset = 0.;}//0.5 * layer_Phi; }
else { offset = 0.5 * layer_Phi; }
DCHseg->setGeomParams(layer_id, layer_Phi, rmid, epsilon, offset);
DCHseg->setWiresInLayer(layer_id, numWire);
......
......@@ -48,20 +48,18 @@ public:
double phi(const CellID& cID) const;
inline double cell_Size() const { return m_cellSize; }
inline double offset_phi() const { return m_offsetPhi; }
inline double epsilon0() const { return m_epsilon0; }
inline double detectorLength() const { return m_detectorLength; }
inline const std::string& fieldNamePhi() const { return m_phiID; }
// Setters
inline double phiFromXY(const Vector3D& aposition) const {
double beta = std::atan2(aposition.Y, aposition.X) ;
if( beta < 0 ) { beta = beta + 2 * M_PI; }
return beta;
double hit_phi = std::atan2(aposition.Y, aposition.X) ;
if( hit_phi < 0 ) { hit_phi += 2 * M_PI; }
return hit_phi;
}
inline void setGeomParams(int layer, double layerphi, double R, double eps, double offset) {
// layer_params[layer] = {layerphi,R,eps};
layer_params.insert(std::pair<int,LAYER>(layer,LAYER(layerphi,R,eps,offset)));
}
......@@ -71,13 +69,10 @@ public:
updateParams(layer);
for (int i = 0; i<numWires; ++i) {
// if(layer % 2 == 0) { phi0 = 0.; }
// else { phi0 = 0.5 * _currentLayerphi; }
double phi0 = m_offset;
auto phi_start = _currentLayerphi * (i + 0.5) + phi0;
if(phi_start > 2 * M_PI) { phi_start = phi_start - 2 * M_PI; }
auto phi_end = phi_start;// + _currentLayerphi;
auto phi_start = _currentLayerphi * i + phi0;
auto phi_end = phi_start + _currentLayerphi;
TVector3 Wstart = returnWirePosition(phi_start, 1);
TVector3 Wend = returnWirePosition(phi_end, -1);
......@@ -131,7 +126,6 @@ protected:
std::map<int, std::vector<std::pair<TVector3, TVector3> >> m_wiresPositions; // < layer, vec<WireMidpoint, WireDirection> >
double m_cellSize;
double m_offsetPhi;
double m_epsilon0;
double m_detectorLength;
std::string m_phiID;
......
......@@ -11,7 +11,6 @@ GridDriftChamber::GridDriftChamber(const std::string& cellEncoding) : Segmentati
_description = "Drift chamber segmentation in the global coordinates";
registerParameter("cell_size", "cell size", m_cellSize, 0., SegmentationParameter::LengthUnit);
registerParameter("offset_phi", "offset in phi", m_offsetPhi, 0., SegmentationParameter::LengthUnit, true);
registerParameter("detector_length", "Length of the wire", m_detectorLength, 1., SegmentationParameter::LengthUnit);
registerIdentifier("identifier_phi", "Cell ID identifier for phi", m_phiID, "cellID");
}
......@@ -22,7 +21,6 @@ GridDriftChamber::GridDriftChamber(const BitFieldCoder* decoder) : Segmentation(
_description = "Drift chamber segmentation in the global coordinates";
registerParameter("cell_size", "cell size", m_cellSize, 1., SegmentationParameter::LengthUnit);
registerParameter("offset_phi", "offset in phi", m_offsetPhi, 0., SegmentationParameter::LengthUnit, true);
registerParameter("epsilon0", "epsilon", m_epsilon0, 0., SegmentationParameter::AngleUnit, true);
registerParameter("detector_length", "Length of the wire", m_detectorLength, 1., SegmentationParameter::LengthUnit);
registerIdentifier("identifier_phi", "Cell ID identifier for phi", m_phiID, "cellID");
......@@ -46,37 +44,32 @@ CellID GridDriftChamber::cellID(const Vector3D& /*localPosition*/, const Vector3
double posy = globalPosition.Y;
double offsetphi= m_offset;
int _lphi;
// if(layerID % 2 == 0) {
// offsetphi = 0.;
// _lphi = (int) (phi_hit / _currentLayerphi);
// }
// else {
// offsetphi = _currentLayerphi / 2.;
if(phi_hit >= offsetphi) {
_lphi = (int) ((phi_hit - offsetphi)/ _currentLayerphi);
}
else {
_lphi = (int) ((phi_hit - offsetphi + 2 * M_PI)/ _currentLayerphi);
}
// }
if(phi_hit >= offsetphi) {
_lphi = (int) ((phi_hit - offsetphi)/ _currentLayerphi);
}
else {
_lphi = (int) ((phi_hit - offsetphi + 2 * M_PI)/ _currentLayerphi);
}
int lphi = _lphi;
_decoder->set(cID, m_phiID, lphi);
//std::cout << "#######################################: "
// << " offset : " << m_offset
// << " offsetphi: " << offsetphi
// << " layerID: " << layerID
// << " r: " << _currentRadius
// << " layerphi: " << _currentLayerphi
// << std::endl;
std::cout << "#######################################: "
<< " offset : " << m_offset
<< " offsetphi: " << offsetphi
<< " layerID: " << layerID
<< " r: " << _currentRadius
<< " layerphi: " << _currentLayerphi
<< std::endl;
return cID;
}
double GridDriftChamber::phi(const CellID& cID) const {
CellID phiValue = _decoder->get(cID, m_phiID);
return (_currentLayerphi * 0.5) + binToPosition(phiValue, _currentLayerphi, m_offsetPhi);
return binToPosition(phiValue, _currentLayerphi, m_offset);
}
double GridDriftChamber::distanceTrackWire(const CellID& cID, const TVector3& hit_start/*,
......
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