]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RICH/AliRICHParam.cxx
- Remove double declaration in Digitizer
[u/mrichter/AliRoot.git] / RICH / AliRICHParam.cxx
index 11a8724aebe7e0206e08fd4a12ab730eeab4e580..241f81033be5d42df09f10f8fe662eb21bc83de6 100644 (file)
 #include <TPolyLine3D.h>
 #include <TPolyLine.h>
 #include <TSystem.h>
+#include <TVector2.h>
+#include <TVector3.h>
+#include <TRotation.h>
+
 
 ClassImp(AliRICHParam)
 Bool_t   AliRICHParam::fgIsWireSag            =kTRUE;   //take ware sagita into account?
@@ -336,3 +340,158 @@ Double_t AliRICHParam::Interpolate(Double_t par[4][330], Double_t x, Double_t y,
   Double_t u = (y-bj)/(bj1-bj);
   return (1-u)*gj+u*gj1;
 }//Interpolate
+//__________________________________________________________________________________________________
+TVector3 AliRICHParam::ForwardTracing(TVector3 entranceTrackPoint, TVector3 vectorTrack, Double_t thetaC, Double_t phiC)
+{
+//
+  TVector3 vBad(-999,-999,-999);
+  TVector3 nPlane(0,0,1);
+  Double_t planeZposition = 0.5*Zfreon();
+  TVector3 planePoint(0,0,planeZposition);
+  TVector3 emissionPoint = PlaneIntersect(vectorTrack,entranceTrackPoint,nPlane,planePoint);
+//  emissionPoint.Dump();
+  Double_t thetaout,phiout;
+  AnglesInDRS(vectorTrack.Theta(),vectorTrack.Phi(),thetaC,phiC,thetaout,phiout);
+//  cout << "thetaout "<<thetaout << " phiout " << phiout << endl;
+  TVector3 vectorPhotonInC6F14;  
+  vectorPhotonInC6F14.SetMagThetaPhi(1,thetaout,phiout);
+//  vectorPhotonInC6F14.Dump();
+//  planeZposition=AliRICHParam::C6F14Thickness();
+  planeZposition=Zfreon();
+  planePoint.SetXYZ(0,0,planeZposition);
+  TVector3 entranceToSiO2Point = PlaneIntersect(vectorPhotonInC6F14,emissionPoint,nPlane,planePoint);
+//  entranceToSiO2Point.Dump();
+
+  Double_t photonEn = MeanCkovEnergy();
+  Double_t angleInSiO2 = SnellAngle(RefIdxC6F14(photonEn),RefIdxSiO2(photonEn),vectorPhotonInC6F14.Theta());if(angleInSiO2<0) return vBad;
+  TVector3 vectorPhotonInSiO2;
+  vectorPhotonInSiO2.SetMagThetaPhi(1,angleInSiO2,phiout);
+//  planeZposition+=AliRICHParam::SiO2Thickness();
+  planeZposition+=Zwin();
+  planePoint.SetXYZ(0,0,planeZposition);
+  TVector3 entranceToCH4 = PlaneIntersect(vectorPhotonInSiO2,entranceToSiO2Point,nPlane,planePoint);
+//  entranceToCH4.Dump();
+
+  //  Double_t angleInCH4 = SnellAngle(AliRICHParam::IndOfRefSiO2(6.755),AliRICHParam::IndOfRefCH4,angleInSiO2);
+  Double_t angleInCH4 = SnellAngle(RefIdxSiO2(photonEn),RefIdxCH4(photonEn),vectorPhotonInSiO2.Theta());if(angleInCH4<0) return vBad;
+  TVector3 vectorPhotonInCH4;
+  vectorPhotonInCH4.SetMagThetaPhi(1,angleInCH4,phiout);
+//  planeZposition+=AliRICHParam::GapProx();
+  planeZposition+=Pc2Win();
+  planePoint.SetXYZ(0,0,planeZposition);
+  TVector3 impactToPC = PlaneIntersect(vectorPhotonInCH4,entranceToCH4,nPlane,planePoint);
+//  impactToPC.Dump();
+  return impactToPC;
+}//FowardTracing
+//__________________________________________________________________________________________________
+TVector3 AliRICHParam::PlaneIntersect(TVector3 vstart,TVector3 p0,TVector3 n,TVector3 v0)
+{
+//
+  TVector3 parallel(-999,-999,-999);
+  // vstart = given vector
+  // p0 = origin of the given vector
+  // n = normal to a given plane
+  // v0 = point of the given plane
+//  cout << " n*vstart = " << n*vstart << endl;
+  if(n*vstart==0) return parallel;
+  TVector3 diff=v0-p0;
+  Double_t sint=(n*diff)/(n*vstart);
+  return p0+sint*vstart;
+}//PlaneIntersect
+//__________________________________________________________________________________________________ 
+Double_t AliRICHParam::SnellAngle(Float_t n1, Float_t n2, Float_t theta1)
+{
+// Snell law
+// Compute the Snell angle
+
+  Double_t sinrefractangle;
+  Double_t refractangle;
+
+  sinrefractangle = (n1/n2)*sin(theta1);
+
+  if(sinrefractangle>1.) {
+    //    cout << " PROBLEMS IN SNELL ANGLE !!!!! " << endl;
+    refractangle = -999.;
+    return refractangle;
+  }
+
+  refractangle = asin(sinrefractangle);
+  return refractangle;
+}//SnellAngle
+//__________________________________________________________________________________________________
+void AliRICHParam::AnglesInDRS(Double_t trackTheta,Double_t trackPhi,Double_t thetaCerenkov,Double_t phiCerenkov,Double_t &tout,Double_t &pout)
+{
+// Setup the rotation matrix of the track...
+
+  TRotation mtheta;
+  TRotation mphi;
+  TRotation minv;
+  TRotation mrot;
+  
+  mtheta.RotateY(trackTheta);
+  mphi.RotateZ(trackPhi);
+  
+  mrot = mphi * mtheta;
+    //  minv = mrot.Inverse();
+
+  TVector3 photonInRadiator(1,1,1);
+
+  photonInRadiator.SetTheta(thetaCerenkov);
+  photonInRadiator.SetPhi(phiCerenkov);
+  photonInRadiator = mrot * photonInRadiator;
+  tout=photonInRadiator.Theta();
+  pout=photonInRadiator.Phi();
+}//AnglesInDRS
+//__________________________________________________________________________________________________
+
+//__________________________________________________________________________________________________
+//__________________________________________________________________________________________________
+/*
+void DrawRing()
+{
+
+  //  Float_t xGraph[1000],yGraph[1000];
+
+  Float_t type;
+  Float_t MassOfParticle;
+  Float_t beta;
+  Float_t nfreon;
+
+  Float_t ThetaCerenkov;
+
+  Float_t Xtoentr = GetEntranceX();
+  Float_t Ytoentr = GetEntranceY();
+
+  Float_t pmod = GetTrackMomentum();
+  Float_t TrackTheta = GetTrackTheta();
+  Float_t TrackPhi = GetTrackPhi();
+
+  SetPhotonEnergy(AliRICHParam::MeanCkovEnergy());
+  SetFreonRefractiveIndex();
+
+  SetEmissionPoint(RadiatorWidth/2.);
+
+  ThetaCerenkov = GetThetaCerenkov();
+  FindBetaFromTheta(ThetaCerenkov);
+  nfreon = GetFreonRefractiveIndex();
+  
+  Int_t nPoints = 100;
+
+  Int_t nPointsToDraw = 0;
+  for(Int_t i=0;i<nPoints;i++)
+    {
+      Float_t phpad = 2*TMath::Pi()*i/nPoints;
+      SetThetaPhotonInTRS(thetacer);
+      SetPhiPhotonInTRS(phpad);
+      FindPhotonAnglesInDRS();
+      Float_t Radius = FromEmissionToCathode();
+      if (Radius == 999.) continue;
+      xGraph[nPointsToDraw] = GetXPointOnCathode() + GetShiftX();
+      yGraph[nPointsToDraw] = GetYPointOnCathode() + GetShiftY();
+      nPointsToDraw++;
+    }
+  gra = new TGraph(nPointsToDraw,xGraph,yGraph);
+  gra->Draw("AC"); 
+}
+//__________________________________________________________________________________________________
+*/