bug fix on Anasen class
This commit is contained in:
parent
f695990e9d
commit
9e33074b61
|
@ -28,8 +28,10 @@ private:
|
|||
const double CathodeRadius = 38 ; // mm
|
||||
const double PCLength = 100; //mm
|
||||
|
||||
std::vector<TVector3> AnodeN; // the anode wire direction vector in space
|
||||
std::vector<TVector3> CathodeN; // the cathode wire direction vector in space
|
||||
std::vector<TVector3> P1; // the anode wire position vector in space
|
||||
std::vector<TVector3> P2; // the anode wire position vector in space
|
||||
std::vector<TVector3> Q1; // the cathode wire position vector in space
|
||||
std::vector<TVector3> Q2; // the cathode wire position vector in space
|
||||
|
||||
void CalWireDirection();
|
||||
|
||||
|
@ -52,26 +54,33 @@ inline Anasen::Anasen(){
|
|||
|
||||
inline void Anasen::CalWireDirection(){
|
||||
|
||||
TVector3 P1; // anode
|
||||
TVector3 P2;
|
||||
TVector3 Q1; // cathode
|
||||
TVector3 Q2;
|
||||
TVector3 p1; // anode
|
||||
TVector3 p2;
|
||||
TVector3 q1; // cathode
|
||||
TVector3 q2;
|
||||
for(int i = 0; i < nWire; i++ ){
|
||||
P1.SetXYZ( AnodeRadius * TMath::Cos( TMath::TwoPi() * i / nWire ),
|
||||
|
||||
// Anode rotate right-hand
|
||||
|
||||
p1.SetXYZ( AnodeRadius * TMath::Cos( TMath::TwoPi() * i / nWire ),
|
||||
AnodeRadius * TMath::Sin( TMath::TwoPi() * i / nWire ),
|
||||
-PCLength/2);
|
||||
P2.SetXYZ( AnodeRadius * TMath::Cos( TMath::TwoPi() * (i + wireShift) / nWire ),
|
||||
p2.SetXYZ( AnodeRadius * TMath::Cos( TMath::TwoPi() * (i + wireShift) / nWire ),
|
||||
AnodeRadius * TMath::Sin( TMath::TwoPi() * (i + wireShift) / nWire ),
|
||||
PCLength/2);
|
||||
AnodeN.push_back((P2 - P1).Unit());
|
||||
P1.push_back(p1);
|
||||
P2.push_back(p2);
|
||||
|
||||
Q1.SetXYZ( CathodeRadius * TMath::Cos( TMath::TwoPi() * i / nWire ),
|
||||
// Cathod rotate left-hand
|
||||
|
||||
p1.SetXYZ( CathodeRadius * TMath::Cos( TMath::TwoPi() * i / nWire ),
|
||||
CathodeRadius * TMath::Sin( TMath::TwoPi() * i / nWire ),
|
||||
-PCLength/2);
|
||||
Q2.SetXYZ( CathodeRadius * TMath::Cos( TMath::TwoPi() * (i - wireShift) / nWire ),
|
||||
p2.SetXYZ( CathodeRadius * TMath::Cos( TMath::TwoPi() * (i - wireShift) / nWire ),
|
||||
CathodeRadius * TMath::Sin( TMath::TwoPi() * (i - wireShift) / nWire ),
|
||||
PCLength/2);
|
||||
CathodeN.push_back((Q2 - Q1).Unit());
|
||||
Q1.push_back(p1);
|
||||
Q2.push_back(p2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -80,11 +89,14 @@ inline void Anasen::CalTrack(TVector3 sx3Pos, int anodeID, int cathodeID){
|
|||
|
||||
trackPos = sx3Pos;
|
||||
|
||||
TVector3 n1 = AnodeN[anodeID].Cross(sx3Pos);
|
||||
TVector3 n2 = CathodeN[cathodeID].Cross(sx3Pos);
|
||||
TVector3 n1 = (P2[anodeID] - P1[anodeID]).Cross((sx3Pos - P1[anodeID]));
|
||||
TVector3 n2 = (Q2[anodeID] - Q1[anodeID]).Cross((sx3Pos - Q1[anodeID]));
|
||||
|
||||
// if the handiness of anode and cathode revered, it should be n2 cross n1
|
||||
trackVec = (n1.Cross(n2)).Unit();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user