new L2G and G2L
authorkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Sep 2003 13:44:40 +0000 (13:44 +0000)
committerkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Sep 2003 13:44:40 +0000 (13:44 +0000)
RICH/AliRICHChamber.cxx
RICH/AliRICHChamber.h

index 0d7d30a..181cee7 100644 (file)
@@ -13,8 +13,6 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id$ */
-
 #include "AliRICHChamber.h"
 #include "AliRICHConst.h" //for r2d
 #include "AliRICHParam.h"
@@ -38,8 +36,6 @@ AliRICHChamber::AliRICHChamber()
     fGeometry = 0;
     fReconstruction = 0;
     fTresh = 0;
-    frMin = 0.1;
-    frMax = 140;
     for(Int_t i=0; i<50; ++i) fIndexMap[i] = 0;
 }
 //______________________________________________________________________________
@@ -51,7 +47,7 @@ AliRICHChamber::AliRICHChamber(Int_t iModuleN,AliRICHParam *pParam)
   SetCenter(0,pParam->Offset()-pParam->GapThickness()/2,0);//put to up position   
   switch(iModuleN){
     case 1:
-      RotateX(-pParam->AngleYZ());  //ÐÏÒÑÄÏË ×ÁÖÅÎ, ÐÏ×ÏÒÏÔ ÎÅ ËÏÍÕÔÁÔÉ×ÅΠ   
+      RotateX(-pParam->AngleYZ());   
       RotateZ(-pParam->AngleXY());      
       fName="RICHc1";fTitle="RICH chamber 1";
       break;      
@@ -90,20 +86,20 @@ AliRICHChamber::AliRICHChamber(Int_t iModuleN,AliRICHParam *pParam)
 }
 //______________________________________________________________________________
 
-void AliRICHChamber::LocaltoGlobal(Float_t pos[3],Float_t Globalpos[3])
+void AliRICHChamber::LocaltoGlobal(Float_t local[3],Float_t global[3])
 {//Local coordinates to global coordinates transformation
 
     Double_t *pMatrix;
     pMatrix =  fpRotMatrix->GetMatrix();
-    Globalpos[0]=pos[0]*pMatrix[0]+pos[1]*pMatrix[3]+pos[2]*pMatrix[6];
-    Globalpos[1]=pos[0]*pMatrix[1]+pos[1]*pMatrix[4]+pos[2]*pMatrix[7];
-    Globalpos[2]=pos[0]*pMatrix[2]+pos[1]*pMatrix[5]+pos[2]*pMatrix[8];
-    Globalpos[0]+=fX;
-    Globalpos[1]+=fY;
-    Globalpos[2]+=fZ;
+    global[0]=local[0]*pMatrix[0]+local[1]*pMatrix[3]+local[2]*pMatrix[6];
+    global[1]=local[0]*pMatrix[1]+local[1]*pMatrix[4]+local[2]*pMatrix[7];
+    global[2]=local[0]*pMatrix[2]+local[1]*pMatrix[5]+local[2]*pMatrix[8];
+    global[0]+=fX;
+    global[1]+=fY;
+    global[2]+=fZ;
 }
 
-void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3])
+void AliRICHChamber::GlobaltoLocal(Float_t global[3],Float_t local[3])
 {// Global coordinates to local coordinates transformation
     TMatrix matrixCopy(3,3);
     Double_t *pMatrixOrig = fpRotMatrix->GetMatrix();
@@ -113,20 +109,19 @@ void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3])
          matrixCopy(j,i)=pMatrixOrig[j+3*i];
       }
     matrixCopy.Invert();
-    Localpos[0] = pos[0] - fX;
-    Localpos[1] = pos[1] - fY;
-    Localpos[2] = pos[2] - fZ;
-    Localpos[0]=Localpos[0]*matrixCopy(0,0)+Localpos[1]*matrixCopy(0,1)+Localpos[2]*matrixCopy(0,2);
-    Localpos[1]=Localpos[0]*matrixCopy(1,0)+Localpos[1]*matrixCopy(1,1)+Localpos[2]*matrixCopy(1,2);
-    Localpos[2]=Localpos[0]*matrixCopy(2,0)+Localpos[1]*matrixCopy(2,1)+Localpos[2]*matrixCopy(2,2);
+    local[0] = global[0] - fX;
+    local[1] = global[1] - fY;
+    local[2] = global[2] - fZ;
+    local[0]=local[0]*matrixCopy(0,0)+local[1]*matrixCopy(0,1)+local[2]*matrixCopy(0,2);
+    local[1]=local[0]*matrixCopy(1,0)+local[1]*matrixCopy(1,1)+local[2]*matrixCopy(1,2);
+    local[2]=local[0]*matrixCopy(2,0)+local[1]*matrixCopy(2,1)+local[2]*matrixCopy(2,2);
 } 
 
 void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
                                    Int_t& iNpads,Float_t cluster[5][500],ResponseType res) 
 {//Generates pad hits (simulated cluster) using the segmentation and the response model
-    
-  Float_t local[3];
-  Float_t global[3];
+
+  Float_t local[3],global[3];
 // Width of the integration area
   Float_t dx=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadX());
   Float_t dy=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadY());
@@ -139,8 +134,8 @@ void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
 
   LocaltoGlobal(local,global);
 
-  Int_t nFp=0;
-    
+
+
 //To calculate wire sag, the origin of y-position must be the middle of the photcathode
   AliRICHSegmentationV0* segmentation = (AliRICHSegmentationV0*) GetSegmentationModel();
   Float_t newy;
@@ -148,22 +143,22 @@ void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
     newy = yhit - segmentation->GetPadPlaneLength()/2;
   else
     newy = yhit + segmentation->GetPadPlaneLength()/2;
-    
+
   if(res==kMip){
     qtot = fResponse->IntPH(eloss, newy);
-    nFp  = fResponse->FeedBackPhotons(global,qtot);
-  }else if(res==kCerenkov){
+    fResponse->FeedBackPhotons(global,qtot);
+  }else if(res==kPhoton){
     qtot = fResponse->IntPH(newy);
-    nFp  = fResponse->FeedBackPhotons(global,qtot);
+    fResponse->FeedBackPhotons(global,qtot);
   }
 
     // Loop Over Pads
-    
+
   Float_t qcheck=0, qp=0;
-    
+
   iNpads=0;
-  for(fSegmentation->FirstPad(xhit, yhit, 0, dx, dy); 
-      fSegmentation->MorePads(); 
+  for(fSegmentation->FirstPad(xhit, yhit, 0, dx, dy);
+      fSegmentation->MorePads();
       fSegmentation->NextPad()) {
     qp= fResponse->IntXY(fSegmentation);
     qp= TMath::Abs(qp);
@@ -173,13 +168,13 @@ void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
       cluster[1][iNpads]=fSegmentation->Ix();
       cluster[2][iNpads]=fSegmentation->Iy();
       cluster[3][iNpads]=fSegmentation->ISector();
-      iNpads++;        
+      iNpads++;
     }
   }//pad loop
 }//void AliRICHChamber::DisIntegration(...
-//______________________________________________________________________________
+//__________________________________________________________________________________________________
 void AliRICHChamber::GenerateTresholds()
-{//Generates random treshold charges for all pads 
+{//Generates random treshold charges for all pads
   Int_t nx = fSegmentation->Npx();
   Int_t ny = fSegmentation->Npy();
 
@@ -191,10 +186,11 @@ void AliRICHChamber::GenerateTresholds()
     }
   }      
 }//void AliRICHChamber::GenerateTresholds()
-//______________________________________________________________________________
+//__________________________________________________________________________________________________
 void AliRICHChamber::Print(Option_t *) const
 {
-  Info(fName.Data(),"r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f\n %5.2f,%5.2f %5.2f,%5.2f %5.2f,%5.2f",
-                     Rho(), Theta()*r2d,Phi()*r2d ,   X(),    Y(),    Z(),
+  printf("%s r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f  %6.2f,%6.2f %6.2f,%6.2f %6.2f,%6.2f\n",fName.Data(),
+                     Rho(), ThetaD(),PhiD(),   X(),    Y(),    Z(),
                      ThetaXd(),PhiXd(),ThetaYd(),PhiYd(),ThetaZd(),PhiZd());
 }//void AliRICHChamber::Print(Option_t *option)const
+//__________________________________________________________________________________________________
index efef966..5ff6454 100644 (file)
@@ -4,8 +4,6 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-/* $Id$ */
-
 #include <TRotMatrix.h>
 #include <TVector3.h>
 #include <TMath.h>
@@ -19,7 +17,7 @@
 
 class AliRICHClusterFinder;
 
-typedef enum {kMip, kCerenkov} ResponseType;
+typedef enum {kMip, kPhoton} ResponseType;
 class AliRICHParam;
 
 class AliRICHChamber : public TNamed
@@ -34,63 +32,14 @@ public:
            AliRICHChamber(Int_t iModuleN,AliRICHParam *pParam);
            AliRICHChamber(const AliRICHChamber &chamber):TNamed(chamber) {;}
   virtual ~AliRICHChamber()                                              {;}
-  AliRICHChamber& operator=(const AliRICHChamber&)                       {return *this;}
-  void LocaltoGlobal(Float_t pos[3],Float_t Localpos[3]);//Transformation from local to global coordinates, chamber-dependant
-  void GlobaltoLocal(Float_t pos[3],Float_t localpos[3]);//Transformation from Global to local coordinates, chamber-dependant 
-  void GenerateTresholds();                              //Generate pad dependent tresholds
-  void DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit, Int_t&x, Float_t newclust[6][500], ResponseType res);// Cluster formation method
-  void    Init(Int_t id)           {fSegmentation->Init(id);} // Recalculates all the values after some of them have been changed
-  void    SetGid(Int_t id)         {fGid=id;}           // Set and get GEANT id  
-  Int_t   GetGid()            const{return fGid;}       // Get GEANT id  
-  void SetRInner(Float_t rmin)     {frMin=rmin;}        // Set inner radius of sensitive volume   
-  Float_t RInner()            const{return frMin;}      // Return inner radius of sensitive volume 
-  void SetROuter(Float_t rmax)     {frMax=rmax;}        // Set outer radius of sensitive volum  
-  Float_t ROuter()            const{return frMax;}      // Return outer radius of sensitive volum  
-  void    SetZPOS(Float_t p1)      {fzPos=p1;}
-  Float_t ZPosition()         const{return fzPos;}
-  void              SetGeometryModel(AliRICHGeometry* pRICHGeometry)            {fGeometry=pRICHGeometry;}        
-  AliRICHGeometry*  GetGeometryModel()                                     const{return fGeometry;}
-  void              SetResponseModel(AliRICHResponse* pRICHResponse)            {fResponse=pRICHResponse;}
-  AliRICHResponse*  GetResponseModel()                                     const{return fResponse;}
-  void              SetSegmentationModel(AliSegmentation* pRICHSegmentation)    {fSegmentation=pRICHSegmentation;}
-  AliSegmentation*  GetSegmentationModel()                                 const{return fSegmentation;}
-  void                  SetReconstructionModel(AliRICHClusterFinder *pRICHReconstruction)    {fReconstruction=pRICHReconstruction;}
-  AliRICHClusterFinder* &GetReconstructionModel()                                            {return fReconstruction;}
-  void   SigGenInit(Float_t x, Float_t y, Float_t z)   {fSegmentation->SigGenInit(x, y, z) ;}
-  Int_t  SigGenCond(Float_t x, Float_t y, Float_t z)   {return fSegmentation->SigGenCond(x, y, z);}
-  Int_t  Sector(Float_t x, Float_t y)                  {return fSegmentation->Sector((Int_t)x, (Int_t)y);} // Returns number of sector containing (x,y) position    
-  void   SetPadSize(Float_t p1, Float_t p2)            {fSegmentation->SetPadSize(p1,p2);}
-  Float_t IntPH(Float_t eloss, Float_t yhit)                        {return fResponse->IntPH(eloss,yhit);}
-  Float_t IntPH(Float_t yhit)                                       {return fResponse->IntPH(yhit);}
-  void  SetSigmaIntegration(Float_t p)                             {fResponse->SetSigmaIntegration(p);}
-  void  SetChargeSlope(Float_t p)                                  {fResponse->SetChargeSlope(p);}
-  void  SetChargeSpread(Float_t p1, Float_t p2)                    {fResponse->SetChargeSpread(p1,p2);}
-  void  SetMaxAdc(Float_t p)                                       {fResponse->SetMaxAdc(p);}
-  void  SetSqrtKx3(Float_t p)                                      {fResponse->SetSqrtKx3(p);}
-  void  SetKx2(Float_t p)                                          {fResponse->SetKx2(p);}
-  void  SetKx4(Float_t p)                                          {fResponse->SetKx4(p);}
-  void  SetSqrtKy3(Float_t p)                                      {fResponse->SetSqrtKy3(p);}
-  void  SetKy2(Float_t p)                                          {fResponse->SetKy2(p);}
-  void  SetKy4(Float_t p)                                          {fResponse->SetKy4(p);}    
-  void  SetPitch(Float_t p)                                        {fResponse->SetPitch(p);}
-  void  SetWireSag(Int_t p)                                        {fResponse->SetWireSag(p);}
-  void  SetVoltage(Int_t p)                                        {fResponse->SetVoltage(p);}       
-  void  SetGapThickness(Float_t thickness)                         {fGeometry->SetGapThickness(thickness);} 
-  void  SetProximityGapThickness(Float_t thickness)                {fGeometry->SetProximityGapThickness(thickness);}
-  void  SetQuartzLength(Float_t length)                            {fGeometry->SetQuartzLength(length);}
-  void  SetQuartzWidth(Float_t width)                              {fGeometry->SetQuartzWidth(width);}
-  void  SetQuartzThickness(Float_t thickness)                      {fGeometry->SetQuartzThickness(thickness);}
-  void  SetOuterFreonLength(Float_t length)                        {fGeometry->SetOuterFreonLength(length);}
-  void  SetOuterFreonWidth(Float_t width)                          {fGeometry->SetOuterFreonWidth(width);}
-  void  SetInnerFreonLength(Float_t length)                        {fGeometry->SetInnerFreonLength(length);}
-  void  SetInnerFreonWidth(Float_t width)                          {fGeometry->SetInnerFreonWidth(width);}
-  void  SetFreonThickness(Float_t thickness)                       {fGeometry->SetFreonThickness(thickness);}
+           AliRICHChamber& operator=(const AliRICHChamber&)              {return *this;}
+  
   TRotMatrix* RotMatrix()          const{return fpRotMatrix;}
   const char* RotMatrixName()      const{return "rot"+fName;}
   TRotation   Rot()                     {return fRot;}
   Double_t    Rho()                const{return fCenterV3.Mag();} 
-  Double_t    Theta()              const{return fCenterV3.Theta();}    
-  Double_t    Phi()                const{return fCenterV3.Phi();}    
+  Double_t    ThetaD()             const{return fCenterV3.Theta()*r2d;}    
+  Double_t    PhiD()               const{return fCenterV3.Phi()*r2d;}    
   Double_t    ThetaXd()            const{return fRot.ThetaX()*r2d;}    
   Double_t    PhiXd()              const{return fRot.PhiX()*r2d;}    
   Double_t    ThetaYd()            const{return fRot.ThetaY()*r2d;}    
@@ -103,27 +52,44 @@ public:
   Double_t    X()                  const{return fCenterV3.X();}  
   Double_t    Y()                  const{return fCenterV3.Y();}   
   Double_t    Z()                  const{return fCenterV3.Z();}
+  TVector3    L2G(TVector3 v3)                      const{v3.Transform(fRot.Inverse());v3+=fCenterV3;return v3;}
+  TVector3    L2G(Double_t x,Double_t y,Double_t z) const{TVector3 v3(x,y,z);return L2G(v3);}
+  TVector3    G2L(TVector3 v3)     const{v3-=fCenterV3;  v3.Transform(fRot);return v3;}
+  TVector3    G2L(Double_t x,Double_t y,Double_t z) const{TVector3 v3(x,y,z);return G2L(v3);}
+//  TLorentzVector L2G(TLorentzVector v4)  const{v4.Transform(fRot.Inverse());v4+=fCenterV3;return v4;}???
+  void        Print(Option_t *sOption)const;//virtual      
+   
+  void LocaltoGlobal(Float_t pos[3],Float_t Localpos[3]);//Transformation from local to global coordinates, chamber-dependant
+  void GlobaltoLocal(Float_t pos[3],Float_t localpos[3]);//Transformation from Global to local coordinates, chamber-dependant 
+  void GenerateTresholds();                              //Generate pad dependent tresholds
+  void DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit, Int_t&x, Float_t newclust[6][500], ResponseType res);// Cluster formation method
+  void    Init(Int_t id)           {fSegmentation->Init(id);} // Recalculates all the values after some of them have been changed
+  void              SetGeometryModel(AliRICHGeometry* pRICHGeometry)            {fGeometry=pRICHGeometry;}        
+  AliRICHGeometry*  GetGeometryModel()                                     const{return fGeometry;}
+  void              SetResponseModel(AliRICHResponse* pRICHResponse)            {fResponse=pRICHResponse;}
+  AliRICHResponse*  GetResponseModel()                                     const{return fResponse;}
+  void              SetSegmentationModel(AliSegmentation* pRICHSegmentation)    {fSegmentation=pRICHSegmentation;}
+  AliSegmentation*  GetSegmentationModel()                                 const{return fSegmentation;}
+  void                  SetReconstructionModel(AliRICHClusterFinder *pRICHReconstruction)    {fReconstruction=pRICHReconstruction;}
+  AliRICHClusterFinder* &GetReconstructionModel()                                            {return fReconstruction;}
+  void   SigGenInit(Float_t x, Float_t y, Float_t z)   {fSegmentation->SigGenInit(x, y, z) ;}
+  Int_t  SigGenCond(Float_t x, Float_t y, Float_t z)   {return fSegmentation->SigGenCond(x, y, z);}
+  Int_t  Sector(Float_t x, Float_t y)                  {return fSegmentation->Sector((Int_t)x, (Int_t)y);} // Returns number of sector containing (x,y) position    
+  void   SetPadSize(Float_t p1, Float_t p2)            {fSegmentation->SetPadSize(p1,p2);}
   Double_t    GetX()               const{return fX;}
   Double_t    GetY()               const{return fY;}
   Double_t    GetZ()               const{return fZ;}    
-  Double_t    GetOffset()          const{return TMath::Sqrt(fX*fX+fY*fY+fZ*fZ);}    
   inline void SetCenter(Double_t x,Double_t y,Double_t z);
   TRotMatrix *GetRotMatrix()       const{return fpRotMatrix;}
   void        SetChamberTransform(Float_t x,Float_t y,Float_t z,TRotMatrix *pRotMatrix) {fX=x; fY=y; fZ=z; fpRotMatrix=pRotMatrix;}
   
-  virtual void Print(Option_t *sOption)const;      
 protected:
-  Float_t frMin;                                         // Minimum Chamber size
-  Float_t frMax;                                         // Maximum Chamber size 
-  Int_t   fGid;                                          // Id tag 
-  Float_t fzPos;                                         // z-position of this chamber
-
   Float_t fX,fY,fZ;                                      // Position of the center of the chamber in MRS (cm)
 
-  AliSegmentation               *fSegmentation;          // ??????????Segmentation model for each chamber
-  AliRICHResponse               *fResponse;              // ??????????Response model for each chamber
-  AliRICHGeometry               *fGeometry;              // ??????????Geometry model for each chamber
-  AliRICHClusterFinder          *fReconstruction;        // ??????????Reconstruction model for each chamber
+  AliSegmentation               *fSegmentation;          //???Segmentation model for each chamber
+  AliRICHResponse               *fResponse;              //???Response model for each chamber
+  AliRICHGeometry               *fGeometry;              //???Geometry model for each chamber
+  AliRICHClusterFinder          *fReconstruction;        //???Reconstruction model for each chamber
    
   TVector3      fCenterV3;        //chamber center position in MRS (cm)
   TRotation     fRot;             //chamber rotation in MRS