1 /**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 ///////////////////////////////////////////////////////////////////
17 // A straight line is coded as a point (3 Double_t) and //
18 // 3 direction cosines //
20 ///////////////////////////////////////////////////////////////////
21 #include <Riostream.h>
24 #include <TObjArray.h>
26 #include <TClonesArray.h>
27 #include "AliITSStrLine.h"
29 ClassImp(AliITSStrLine)
31 //________________________________________________________
32 AliITSStrLine::AliITSStrLine() {
33 // Default constructor
34 for(Int_t i=0;i<3;i++) {
42 //________________________________________________________
43 AliITSStrLine::AliITSStrLine(Double_t *point, Double_t *cd) {
44 // Standard constructor
46 for(Int_t i=0;i<3;i++)norm+=cd[i]*cd[i];
48 norm = TMath::Sqrt(norm);
49 for(Int_t i=0;i<3;i++) cd[i]/=norm;
52 Error("AliITSStrLine","Null direction cosines!!!");
60 //________________________________________________________
61 AliITSStrLine::~AliITSStrLine() {
65 //________________________________________________________
66 void AliITSStrLine::PrintStatus() const {
67 // Print current status
68 cout <<"=======================================================\n";
69 cout <<"Direction cosines: ";
70 for(Int_t i=0;i<3;i++)cout <<fCd[i]<<"; ";
72 cout <<"Known point: ";
73 for(Int_t i=0;i<3;i++)cout <<fP0[i]<<"; ";
75 cout <<"Current value for the parameter: "<<fTpar<<endl;
76 cout <<" Debug flag: "<<fDebug<<endl;
79 //________________________________________________________
80 Int_t AliITSStrLine::Crossrphi(AliITSStrLine *line){
81 // Cross 2 lines in the X-Y plane
88 Double_t c=p2[0]-fP0[0];
91 Double_t f=p2[1]-fP0[1];
92 Double_t deno = a*e-b*d;
95 fTpar = (c*e-b*f)/deno;
103 //________________________________________________________
104 Int_t AliITSStrLine::Cross(AliITSStrLine *line, Double_t *point){
105 // Looks for the crossing point estimated starting from the
113 for(i=0;i<3;i++)k1+=(fP0[i]-p2[i])*fCd[i];
115 for(i=0;i<3;i++)k2+=(fP0[i]-p2[i])*cd2[i];
117 for(i=0;i<3;i++)a11+=fCd[i]*cd2[i];
120 for(i=0;i<3;i++)a21+=cd2[i]*cd2[i];
122 for(i=0;i<3;i++)a12-=fCd[i]*fCd[i];
123 Double_t deno = a11*a22-a21*a12;
124 if(deno == 0.) return -1;
125 fTpar = (a11*k2-a21*k1) / deno;
126 Double_t par2 = (k1*a22-k2*a12) / deno;
130 GetCurrentPoint(point1);
131 line->GetCurrentPoint(point2);
132 for(i=0;i<3;i++)point[i]=(point1[i]+point2[i])/2.;
135 //________________________________________________________
136 void AliITSStrLine::GetCurrentPoint(Double_t *point){
137 // Fills the array point with the current value on the line
138 for(Int_t i=0;i<3;i++)point[i]=fP0[i]+fCd[i]*fTpar;