LCOV - code coverage report
Current view: top level - PMD/PMDrec - AliPMDUtility.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 63 310 20.3 %
Date: 2016-06-14 17:26:59 Functions: 8 32 25.0 %

          Line data    Source code
       1             : /***************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       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             : //-----------------------------------------------------//
      16             : //                                                     //
      17             : //                                                     //
      18             : //  Date   : August 05 2003                            //
      19             : //                                                     //
      20             : //  Utility code for ALICE-PMD                         //
      21             : //                                                     //
      22             : //-----------------------------------------------------//
      23             : 
      24             : #include "Riostream.h"
      25             : #include "TMath.h"
      26             : #include "TText.h"
      27             : #include "TLine.h"
      28             : 
      29             : #include <stdio.h>
      30             : #include <math.h>
      31             : 
      32             : #include "AliPMDUtility.h"
      33             : 
      34          12 : ClassImp(AliPMDUtility)
      35             : 
      36           2 : AliPMDUtility::AliPMDUtility():
      37           2 :   fPx(0.),
      38           2 :   fPy(0.),
      39           2 :   fPz(0.),
      40           2 :   fTheta(0.),
      41           2 :   fEta(0.),
      42           2 :   fPhi(0.),
      43           2 :   fWriteModule(1)
      44          10 : {
      45             :   // Default constructor
      46          20 :   for (Int_t i = 0; i < 4; i++)
      47             :     {
      48          64 :       for (Int_t j = 0; j < 3; j++)
      49             :         {
      50          24 :           fSecTr[i][j] = 0.;
      51             :         }
      52             :     }
      53             : 
      54           4 : }
      55             : 
      56           0 : AliPMDUtility::AliPMDUtility(Float_t px, Float_t py, Float_t pz):
      57           0 :   fPx(px),
      58           0 :   fPy(py),
      59           0 :   fPz(pz),
      60           0 :   fTheta(0.),
      61           0 :   fEta(0.),
      62           0 :   fPhi(0.),
      63           0 :   fWriteModule(1)
      64           0 : {
      65             :   // Constructor
      66           0 :   for (Int_t i = 0; i < 4; i++)
      67             :     {
      68           0 :       for (Int_t j = 0; j < 3; j++)
      69             :         {
      70           0 :           fSecTr[i][j] = 0.;
      71             :         }
      72             :     }
      73             : 
      74           0 : }
      75             : AliPMDUtility::AliPMDUtility(const AliPMDUtility &pmdutil):
      76           0 :   TObject(pmdutil),
      77           0 :   fPx(pmdutil.fPx),
      78           0 :   fPy(pmdutil.fPy),
      79           0 :   fPz(pmdutil.fPz),
      80           0 :   fTheta(pmdutil.fTheta),
      81           0 :   fEta(pmdutil.fEta),
      82           0 :   fPhi(pmdutil.fPhi),
      83           0 :   fWriteModule(pmdutil.fWriteModule)
      84           0 : {
      85             :   // copy constructor
      86           0 :     for (Int_t i = 0; i < 4; i++)
      87             :     {
      88           0 :       for (Int_t j = 0; j < 3; j++)
      89             :         {
      90           0 :           fSecTr[i][j] = pmdutil.fSecTr[i][j];
      91             :         }
      92             :     }
      93             : 
      94           0 : }
      95             : AliPMDUtility & AliPMDUtility::operator=(const AliPMDUtility &pmdutil)
      96             : {
      97             :   // assignment operator
      98           0 :   if(this != &pmdutil)
      99             :     {
     100           0 :       fPx = pmdutil.fPx;
     101           0 :       fPy = pmdutil.fPy;
     102           0 :       fPz = pmdutil.fPz;
     103           0 :       fTheta = pmdutil.fTheta;
     104           0 :       fEta = pmdutil.fEta;
     105           0 :       fPhi = pmdutil.fPhi;
     106           0 :       fWriteModule = pmdutil.fWriteModule;
     107           0 :       for (Int_t i = 0; i < 4; i++)
     108             :         {
     109           0 :           for (Int_t j = 0; j < 3; j++)
     110             :             {
     111           0 :               fSecTr[i][j] = pmdutil.fSecTr[i][j];
     112             :             }
     113             :         }
     114             : 
     115           0 :     }
     116           0 :   return *this;
     117             : }
     118             : AliPMDUtility::~AliPMDUtility()
     119           8 : {
     120             :   // Default destructor
     121           8 : }
     122             : 
     123             : void AliPMDUtility::RectGeomCellPos(Int_t ism, Int_t xpad, Int_t ypad, Float_t &xpos, Float_t &ypos)
     124             : {
     125             :   // This routine finds the cell eta,phi for the new PMD rectangular 
     126             :   // geometry in ALICE
     127             :   // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
     128             :   // modified by B. K. Nandi for change of coordinate sys
     129             :   //
     130             :   // SMA  ---> Supermodule Type A           ( SM - 0)
     131             :   // SMAR ---> Supermodule Type A ROTATED   ( SM - 1)
     132             :   // SMB  ---> Supermodule Type B           ( SM - 2)
     133             :   // SMBR ---> Supermodule Type B ROTATED   ( SM - 3)
     134             :   //
     135             :   // ism   : Serial module number from 0 to 23 for each plane
     136             : 
     137             :  
     138             :   // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
     139             : 
     140           0 :   double xcorner[24] =
     141             :     {
     142             :       74.8833,  53.0045, 31.1255,    //Type-A
     143             :       74.8833,  53.0045, 31.1255,    //Type-A
     144             :       -74.8833, -53.0044, -31.1255,  //Type-AR
     145             :       -74.8833, -53.0044, -31.1255,  //Type-AR
     146             :       8.9165, -33.7471,            //Type-B
     147             :       8.9165, -33.7471,            //Type-B
     148             :       8.9165, -33.7471,            //Type-B
     149             :       -8.9165, 33.7471,            //Type-BR
     150             :       -8.9165, 33.7471,            //Type-BR
     151             :       -8.9165, 33.7471,            //Type-BR
     152             :     };
     153             : 
     154             :   
     155           0 :   double ycorner[24] =
     156             :     {
     157             :       86.225,  86.225,  86.225,      //Type-A
     158             :       37.075,  37.075,  37.075,      //Type-A
     159             :       -86.225, -86.225, -86.225,     //Type-AR
     160             :       -37.075, -37.075, -37.075,     //Type-AR
     161             :       86.225,  86.225,               //Type-B
     162             :       61.075,  61.075,               //Type-B
     163             :       35.925,  35.925,               //Type-B
     164             :       -86.225, -86.225,              //Type-BR
     165             :       -61.075, -61.075,              //Type-BR
     166             :       -35.925, -35.925               //Type-BR
     167             :     };
     168             : 
     169             :   
     170             :   const Float_t kSqroot3      = 1.73205;  // sqrt(3.);
     171             :   const Float_t kCellRadius   = 0.25;
     172             :   
     173             :   //
     174             :   //Every even row of cells is shifted and placed
     175             :   //in geant so this condition
     176             :   //
     177             :   Float_t cellRadius = 0.25;
     178             :   Float_t shift = 0.0;
     179           0 :   if(xpad%2 == 0)
     180             :     {
     181           0 :       shift = -cellRadius/2.0;
     182           0 :     }
     183             :   else
     184             :     {
     185             :       shift = 0.0;
     186             :     }
     187             : 
     188             : 
     189           0 :   if(ism < 6)
     190             :     {
     191           0 :       ypos = ycorner[ism] - (Float_t) xpad*kCellRadius*2.0 + shift;
     192           0 :       xpos = xcorner[ism] - (Float_t) ypad*kSqroot3*kCellRadius;
     193           0 :     }
     194           0 :   else if(ism >=6 && ism < 12)
     195             :     {
     196           0 :       ypos = ycorner[ism] + (Float_t) xpad*kCellRadius*2.0 + shift;
     197           0 :       xpos = xcorner[ism] + (Float_t) ypad*kSqroot3*kCellRadius;
     198           0 :     }
     199           0 :   else if(ism >= 12 && ism < 18)
     200             :     {
     201           0 :       ypos = ycorner[ism] - (Float_t) xpad*kCellRadius*2.0 + shift;
     202           0 :       xpos = xcorner[ism] - (Float_t) ypad*kSqroot3*kCellRadius;
     203           0 :     }
     204           0 :   else if(ism >= 18 && ism < 24)
     205             :     {
     206           0 :       ypos = ycorner[ism] + (Float_t) xpad*kCellRadius*2.0 + shift;
     207           0 :       xpos = xcorner[ism] + (Float_t) ypad*kSqroot3*kCellRadius;
     208           0 :     }
     209             :   // Apply the alignment here to the x, y values
     210           0 :   if(ism < 6)
     211             :     {
     212           0 :       xpos += fSecTr[0][0];
     213           0 :       ypos += fSecTr[0][1];
     214           0 :     }
     215           0 :   else if(ism >= 6 && ism < 12)
     216             :     {
     217           0 :       xpos += fSecTr[1][0];
     218           0 :       ypos += fSecTr[1][1];
     219           0 :     }
     220           0 :   else if(ism >=12 && ism < 18)
     221             :     {
     222           0 :       xpos += fSecTr[2][0];
     223           0 :       ypos += fSecTr[2][1];
     224           0 :     }
     225           0 :   else if(ism >= 18 && ism < 24)
     226             :     {
     227           0 :       xpos += fSecTr[3][0];
     228           0 :       ypos += fSecTr[3][1];
     229           0 :     }
     230             : 
     231           0 : }
     232             : // ---------------------------------------------------------- 
     233             : void AliPMDUtility::RectGeomCellPos(Int_t ism, Float_t xpad, Float_t ypad, Float_t &xpos, Float_t &ypos)
     234             : {
     235             :   // If the xpad and ypad inputs are float, then 0.5 is added to it
     236             :   // to find the layer which is shifted.
     237             :   // This routine finds the cell eta,phi for the new PMD rectangular 
     238             :   // geometry in ALICE
     239             :   // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
     240             :   // modified by B. K. Nnadi for change of coordinate sys
     241             :   //
     242             :   // SMA  ---> Supermodule Type A           ( SM - 0)
     243             :   // SMAR ---> Supermodule Type A ROTATED   ( SM - 1)
     244             :   // SMB  ---> Supermodule Type B           ( SM - 2)
     245             :   // SMBR ---> Supermodule Type B ROTATED   ( SM - 3)
     246             :   //
     247             :   // ism   : Serial Module number from 0 to 23 for each plane
     248             : 
     249             :   // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
     250             : 
     251           0 :   double xcorner[24] =
     252             :     {
     253             :       74.8833,  53.0045, 31.1255,    //Type-A
     254             :       74.8833,  53.0045, 31.1255,    //Type-A
     255             :       -74.8833, -53.0044, -31.1255,  //Type-AR
     256             :       -74.8833, -53.0044, -31.1255,  //Type-AR
     257             :       8.9165, -33.7471,            //Type-B
     258             :       8.9165, -33.7471,            //Type-B
     259             :       8.9165, -33.7471,            //Type-B
     260             :       -8.9165, 33.7471,            //Type-BR
     261             :       -8.9165, 33.7471,            //Type-BR
     262             :       -8.9165, 33.7471,            //Type-BR
     263             :     };
     264             : 
     265             :   
     266             : 
     267           0 :   double ycorner[24] =
     268             :     {
     269             :       86.225,  86.225,  86.225,      //Type-A
     270             :       37.075,  37.075,  37.075,      //Type-A
     271             :       -86.225, -86.225, -86.225,     //Type-AR
     272             :       -37.075, -37.075, -37.075,     //Type-AR
     273             :       86.225,  86.225,               //Type-B
     274             :       61.075,  61.075,               //Type-B
     275             :       35.925,  35.925,               //Type-B
     276             :       -86.225, -86.225,              //Type-BR
     277             :       -61.075, -61.075,              //Type-BR
     278             :       -35.925, -35.925               //Type-BR
     279             :     };
     280             : 
     281             : 
     282             :   const Float_t kSqroot3    = 1.73205;  // sqrt(3.);
     283             :   const Float_t kCellRadius = 0.25;
     284             :   
     285             :   //
     286             :   //Every even row of cells is shifted and placed
     287             :   //in geant so this condition
     288             :   //
     289             :   Float_t cellRadius = 0.25;
     290             :   Float_t shift = 0.0;
     291           0 :   Int_t iirow = (Int_t) (xpad+0.5);
     292           0 :   if(iirow%2 == 0)
     293             :     {
     294           0 :       shift = -cellRadius/2.0;
     295           0 :     }
     296             :   else
     297             :     {
     298             :       shift = 0.0;
     299             :     }
     300             : 
     301           0 :   if(ism < 6)
     302             :     {
     303           0 :       ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
     304           0 :       xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
     305           0 :     }
     306           0 :   else if(ism >=6 && ism < 12)
     307             :     {
     308           0 :       ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
     309           0 :       xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
     310           0 :     }
     311           0 :   else if(ism >= 12 && ism < 18)
     312             :     {
     313           0 :       ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
     314           0 :       xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
     315           0 :     }
     316           0 :   else if(ism >= 18 && ism < 24)
     317             :     {
     318           0 :       ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
     319           0 :       xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
     320           0 :     }
     321             : 
     322             :   // Apply the alignment here to the x, y values
     323           0 :   if(ism < 6)
     324             :     {
     325           0 :       xpos += fSecTr[0][0];
     326           0 :       ypos += fSecTr[0][1];
     327           0 :     }
     328           0 :   else if(ism >= 6 && ism < 12)
     329             :     {
     330           0 :       xpos += fSecTr[1][0];
     331           0 :       ypos += fSecTr[1][1];
     332           0 :     }
     333           0 :   else if(ism >=12 && ism < 18)
     334             :     {
     335           0 :       xpos += fSecTr[2][0];
     336           0 :       ypos += fSecTr[2][1];
     337           0 :     }
     338           0 :   else if(ism >= 18 && ism < 24)
     339             :     {
     340           0 :       xpos += fSecTr[3][0];
     341           0 :       ypos += fSecTr[3][1];
     342           0 :     }
     343             : 
     344           0 : }
     345             : 
     346             : // -------------------------------------------------------- //
     347             : 
     348             : void AliPMDUtility::RectGeomCellPos(Int_t ism, Float_t xpad,
     349             :                                     Float_t ypad, Float_t &xpos,
     350             :                                     Float_t &ypos, Float_t & zpos)
     351             : {
     352             :   // If the xpad and ypad inputs are float, then 0.5 is added to it
     353             :   // to find the layer which is shifted.
     354             :   // This routine finds the cell eta,phi for the new PMD rectangular 
     355             :   // geometry in ALICE
     356             :   // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
     357             :   // modified by B. K. Nnadi for change of coordinate sys
     358             :   //
     359             :   // SMA  ---> Supermodule Type A           ( SM - 0)
     360             :   // SMAR ---> Supermodule Type A ROTATED   ( SM - 1)
     361             :   // SMB  ---> Supermodule Type B           ( SM - 2)
     362             :   // SMBR ---> Supermodule Type B ROTATED   ( SM - 3)
     363             :   //
     364             :   // ism   : Serial Module number from 0 to 23 for each plane
     365             : 
     366             :   // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
     367             : 
     368         344 :   double xcorner[24] =
     369             :     {
     370             :       74.8833,  53.0045, 31.1255,    //Type-A
     371             :       74.8833,  53.0045, 31.1255,    //Type-A
     372             :       -74.8833, -53.0044, -31.1255,  //Type-AR
     373             :       -74.8833, -53.0044, -31.1255,  //Type-AR
     374             :       8.9165, -33.7471,            //Type-B
     375             :       8.9165, -33.7471,            //Type-B
     376             :       8.9165, -33.7471,            //Type-B
     377             :       -8.9165, 33.7471,            //Type-BR
     378             :       -8.9165, 33.7471,            //Type-BR
     379             :       -8.9165, 33.7471,            //Type-BR
     380             :     };
     381             : 
     382             :   
     383             : 
     384         172 :   double ycorner[24] =
     385             :     {
     386             :       86.225,  86.225,  86.225,      //Type-A
     387             :       37.075,  37.075,  37.075,      //Type-A
     388             :       -86.225, -86.225, -86.225,     //Type-AR
     389             :       -37.075, -37.075, -37.075,     //Type-AR
     390             :       86.225,  86.225,               //Type-B
     391             :       61.075,  61.075,               //Type-B
     392             :       35.925,  35.925,               //Type-B
     393             :       -86.225, -86.225,              //Type-BR
     394             :       -61.075, -61.075,              //Type-BR
     395             :       -35.925, -35.925               //Type-BR
     396             :     };
     397             : 
     398             : 
     399             :   const Float_t kSqroot3    = 1.73205;  // sqrt(3.);
     400             :   const Float_t kCellRadius = 0.25;
     401             :   
     402             :   //
     403             :   //Every even row of cells is shifted and placed
     404             :   //in geant so this condition
     405             :   //
     406             :   Float_t cellRadius = 0.25;
     407             :   Float_t shift = 0.0;
     408         172 :   Int_t iirow = (Int_t) (xpad+0.5);
     409         172 :   if(iirow%2 == 0)
     410             :     {
     411          84 :       shift = -cellRadius/2.0;
     412          84 :     }
     413             :   else
     414             :     {
     415             :       shift = 0.0;
     416             :     }
     417             : 
     418         172 :   if(ism < 6)
     419             :     {
     420         104 :       ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
     421         104 :       xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
     422         104 :     }
     423          68 :   else if(ism >=6 && ism < 12)
     424             :     {
     425          24 :       ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
     426          24 :       xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
     427          24 :     }
     428          44 :   else if(ism >= 12 && ism < 18)
     429             :     {
     430          28 :       ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
     431          28 :       xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
     432          28 :     }
     433          16 :   else if(ism >= 18 && ism < 24)
     434             :     {
     435          16 :       ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
     436          16 :       xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
     437          16 :     }
     438             : 
     439             :   // Apply the alignment here to the x, y, and z values
     440         172 :   if(ism < 6)
     441             :     {
     442         104 :       xpos += fSecTr[0][0];
     443         104 :       ypos += fSecTr[0][1];
     444         104 :       zpos += fSecTr[0][2];
     445         104 :     }
     446          68 :   else if(ism >= 6 && ism < 12)
     447             :     {
     448          24 :       xpos += fSecTr[1][0];
     449          24 :       ypos += fSecTr[1][1];
     450          24 :       zpos += fSecTr[1][2];
     451          24 :     }
     452          44 :   else if(ism >=12 && ism < 18)
     453             :     {
     454          28 :       xpos += fSecTr[2][0];
     455          28 :       ypos += fSecTr[2][1];
     456          28 :       zpos += fSecTr[2][2];
     457          28 :     }
     458          16 :   else if(ism >= 18 && ism < 24)
     459             :     {
     460          16 :       xpos += fSecTr[3][0];
     461          16 :       ypos += fSecTr[3][1];
     462          16 :       zpos += fSecTr[3][2];
     463          16 :     }
     464             : 
     465             : 
     466             : 
     467         172 : }
     468             : // -------------------------------------------------------- //
     469             : 
     470             : void AliPMDUtility::GenerateBoundaryPoints(Int_t ism, Float_t &x1ism, 
     471             :                                            Float_t &y1ism, Float_t &x2ism,
     472             :                                            Float_t &y2ism)
     473             : {
     474             :   // Generate bounding-box.
     475             : 
     476             : 
     477             :     Float_t xism = 0, yism = 0;
     478             :     Float_t dxism = 0., dyism = 0.;
     479             : 
     480             :     const Float_t kRad     = 0.25;
     481             :     const Float_t kSqRoot3 = 1.732050808;
     482             :     const Float_t kDia     = 0.50;
     483             : 
     484             : 
     485             :   const Double_t kXcorner[24] =
     486             :     {
     487             :       74.8833,  53.0045, 31.1255,    //Type-A
     488             :       74.8833,  53.0045, 31.1255,    //Type-A
     489             :       -74.8833, -53.0044, -31.1255,  //Type-AR
     490             :       -74.8833, -53.0044, -31.1255,  //Type-AR
     491             :       8.9165, -33.7471,            //Type-B
     492             :       8.9165, -33.7471,            //Type-B
     493             :       8.9165, -33.7471,            //Type-B
     494             :       -8.9165, 33.7471,            //Type-BR
     495             :       -8.9165, 33.7471,            //Type-BR
     496             :       -8.9165, 33.7471,            //Type-BR
     497             :     };
     498             : 
     499             : 
     500             :   const Double_t kYcorner[24] =
     501             :     {
     502             :       86.225,  86.225,  86.225,      //Type-A
     503             :       37.075,  37.075,  37.075,      //Type-A
     504             :       -86.225, -86.225, -86.225,     //Type-AR
     505             :       -37.075, -37.075, -37.075,     //Type-AR
     506             :       86.225,  86.225,               //Type-B
     507             :       61.075,  61.075,               //Type-B
     508             :       35.925,  35.925,               //Type-B
     509             :       -86.225, -86.225,              //Type-BR
     510             :       -61.075, -61.075,              //Type-BR
     511             :       -35.925, -35.925               //Type-BR
     512             :     };
     513             : 
     514             : 
     515           0 :   if (ism > 23) ism -= 24;
     516             : 
     517             : 
     518           0 :   if (ism < 6)
     519             :     {
     520           0 :       xism  = kXcorner[ism] + kRad;
     521           0 :       yism  = kYcorner[ism] + kRad;
     522             :       dxism = -kRad*kSqRoot3*48.;
     523             :       dyism = -kDia*96. - kRad;
     524           0 :   }
     525           0 :   if (ism >= 6 && ism < 12)
     526             :     {
     527           0 :       xism  = kXcorner[ism] - kRad;
     528           0 :       yism  = kYcorner[ism] - kRad;
     529             :       dxism = kRad*kSqRoot3*48.;
     530             :       dyism = kDia*96. + kRad;
     531           0 :   }
     532           0 :   if (ism >= 12 && ism < 18)
     533             :     {
     534           0 :       xism  = kXcorner[ism] + kRad;
     535           0 :       yism  = kYcorner[ism] + kRad;
     536             :       dxism = -kRad*kSqRoot3*96.;
     537             :       dyism = -kDia*48. - kRad;
     538           0 :   }
     539           0 :   if (ism >= 18 && ism < 24)
     540             :     {
     541           0 :       xism  = kXcorner[ism] - kRad;
     542           0 :       yism  = kYcorner[ism] - kRad;
     543             :       dxism = kRad*kSqRoot3*96.;
     544             :       dyism = kDia*48. + kRad;
     545           0 :   }
     546             : 
     547           0 :   x1ism = xism;
     548           0 :   x2ism = xism + dxism;
     549           0 :   y1ism = yism;
     550           0 :   y2ism = yism + dyism;
     551             : 
     552           0 : }
     553             : // ------------------------------------------------------------------- //
     554             : 
     555             : void AliPMDUtility::DrawPMDModule(Int_t idet)
     556             : {
     557             : 
     558           0 :     Float_t x1ism = 0., x2ism = 0., y1ism = 0., y2ism = 0.;
     559             :     Float_t deltaX = 0., deltaY = 0.;
     560             :     
     561             :     //TH2F *h2 = new TH2F("h2","Y vs. X",200,-100.,100.,200,-100.,100.);
     562             :     //h2->Draw();
     563             : 
     564           0 :     TLine t;
     565           0 :     t.SetLineColor(2);
     566             : 
     567           0 :     TText tt;
     568           0 :     tt.SetTextColor(4);
     569             : 
     570           0 :     Char_t smnumber[10];
     571             : 
     572           0 :     for(Int_t ism=0; ism < 24; ism++)
     573             :     {
     574           0 :         GenerateBoundaryPoints(ism, x1ism, y1ism, x2ism, y2ism);
     575           0 :         deltaX = (x2ism - x1ism)/2.;
     576           0 :         deltaY = (y2ism - y1ism)/2.;
     577           0 :         if (fWriteModule == 1)
     578             :         {
     579           0 :           if(idet == 0)
     580             :             {
     581           0 :               snprintf(smnumber,10,"%d",ism);
     582             :             }
     583           0 :           else if (idet == 1)
     584             :             {
     585           0 :               snprintf(smnumber,10,"%d",24+ism);
     586             :             }
     587           0 :             tt.DrawText(x1ism+deltaX,y1ism+deltaY,smnumber);
     588             :         }
     589           0 :         t.DrawLine(x1ism, y1ism, x1ism, y2ism);
     590           0 :         t.DrawLine(x1ism, y1ism, x2ism, y1ism);
     591           0 :         t.DrawLine(x2ism, y1ism, x2ism, y2ism);
     592           0 :         t.DrawLine(x1ism, y2ism, x2ism, y2ism);
     593             :     }
     594             : 
     595           0 : }
     596             : 
     597             : // ------------------------------------------------------------------- //
     598             : 
     599             : 
     600             : void AliPMDUtility::ApplyVertexCorrection(Float_t vertex[], Float_t xpos,
     601             :                                           Float_t ypos, Float_t zpos)
     602             : {
     603             :   // Not implemented
     604           0 :   fPx = xpos - vertex[0];
     605           0 :   fPy = ypos - vertex[1];
     606           0 :   fPz = zpos - vertex[2];
     607           0 : }
     608             : void AliPMDUtility::ApplyAlignment(Double_t sectr[][3])
     609             : {
     610             :   // Get the alignment stuff here
     611             : 
     612          88 :   for (Int_t isector=0; isector<4; isector++)
     613             :     {
     614         256 :       for(Int_t ixyz=0; ixyz < 3; ixyz++)
     615             :         {
     616          96 :           fSecTr[isector][ixyz] = (Float_t) sectr[isector][ixyz];
     617             :         }
     618             :     }
     619           8 : }
     620             : 
     621             : void AliPMDUtility::SetPxPyPz(Float_t px, Float_t py, Float_t pz)
     622             : {
     623           0 :   fPx = px;
     624           0 :   fPy = py;
     625           0 :   fPz = pz;
     626           0 : }
     627             : 
     628             : void AliPMDUtility::SetXYZ(Float_t xpos, Float_t ypos, Float_t zpos)
     629             : {
     630           0 :   fPx = xpos;
     631           0 :   fPy = ypos;
     632           0 :   fPz = zpos;
     633           0 : }
     634             : void AliPMDUtility::SetWriteModule(Int_t wrmod)
     635             : {
     636           0 :     fWriteModule = wrmod;
     637           0 : }
     638             : void AliPMDUtility::CalculateEta()
     639             : {
     640           0 :   Float_t rpxpy  = TMath::Sqrt(fPx*fPx + fPy*fPy);
     641           0 :   Float_t theta  = TMath::ATan2(rpxpy,fPz);
     642           0 :   Float_t eta    = -TMath::Log(TMath::Tan(0.5*theta));
     643           0 :   fTheta = theta;
     644           0 :   fEta   = eta;
     645           0 : }
     646             : void AliPMDUtility::CalculatePhi()
     647             : {
     648             :   Float_t pybypx = 0., phi = 0., phi1 = 0.;
     649             : 
     650           0 :   if(fPx==0)
     651             :     {
     652           0 :       if(fPy>0) phi = 90.;
     653           0 :       if(fPy<0) phi = 270.;
     654             :     }
     655           0 :   if(fPx != 0)
     656             :     {
     657           0 :       pybypx = fPy/fPx;
     658           0 :       if(pybypx < 0) pybypx = - pybypx;
     659           0 :       phi1 = TMath::ATan(pybypx)*180./3.14159;
     660             : 
     661           0 :       if(fPx > 0 && fPy > 0) phi = phi1;        // 1st Quadrant
     662           0 :       if(fPx < 0 && fPy > 0) phi = 180 - phi1;  // 2nd Quadrant
     663           0 :       if(fPx < 0 && fPy < 0) phi = 180 + phi1;  // 3rd Quadrant
     664           0 :       if(fPx > 0 && fPy < 0) phi = 360 - phi1;  // 4th Quadrant
     665             : 
     666             :     }
     667           0 :   phi = phi*3.14159/180.;
     668             : 
     669           0 :   fPhi = phi;
     670             : 
     671           0 : }
     672             : void AliPMDUtility::CalculateEtaPhi()
     673             : {
     674             :   Float_t pybypx = 0., phi = 0., phi1 = 0.;
     675             : 
     676           0 :   Float_t rpxpy = TMath::Sqrt(fPx*fPx + fPy*fPy);
     677           0 :   Float_t theta = TMath::ATan2(rpxpy,fPz);
     678           0 :   Float_t eta   = -TMath::Log(TMath::Tan(0.5*theta));
     679             :   
     680           0 :   if(fPx == 0)
     681             :     {
     682           0 :       if(fPy>0) phi = 90.;
     683           0 :       if(fPy<0) phi = 270.;
     684             :     }
     685           0 :   if(fPx != 0)
     686             :     {
     687           0 :       pybypx = fPy/fPx;
     688           0 :       if(pybypx < 0) pybypx = - pybypx;
     689           0 :       phi1 = TMath::ATan(pybypx)*180./3.14159;
     690           0 :       if(fPx > 0 && fPy > 0) phi = phi1;        // 1st Quadrant
     691           0 :       if(fPx < 0 && fPy > 0) phi = 180 - phi1;  // 2nd Quadrant
     692           0 :       if(fPx < 0 && fPy < 0) phi = 180 + phi1;  // 3rd Quadrant
     693           0 :       if(fPx > 0 && fPy < 0) phi = 360 - phi1;  // 4th Quadrant
     694             : 
     695             :     }
     696           0 :   phi = phi*3.14159/180.;
     697             : 
     698           0 :   fTheta = theta;
     699           0 :   fEta   = eta;
     700           0 :   fPhi   = phi;
     701           0 : }
     702             : void AliPMDUtility::CalculateXY(Float_t eta, Float_t phi, Float_t zpos)
     703             : {
     704             :   // Not implemented
     705             : 
     706             :   //  eta   = -TMath::Log(TMath::Tan(0.5*theta));
     707             : 
     708             :   Float_t xpos = 0., ypos = 0.;
     709             : 
     710             :   //  Float_t theta = 2.0*TMath::ATan(TMath::Log(-eta));
     711             : 
     712           0 :   fEta = eta;
     713           0 :   fPhi = phi;
     714           0 :   fPx  = xpos;
     715           0 :   fPy  = ypos;
     716           0 :   fPz  = zpos;
     717           0 : }
     718             : 
     719             : void AliPMDUtility::GetEtaIndexXY(Int_t smn, Int_t row, Int_t col, Float_t &xp, Float_t &yp, Double_t &eta, Int_t &etaindex) {
     720             :   // Takes smn, row, col
     721             :   // Calculates x, y, eta and etabin into 10. 
     722             :   // Use only in raw Data.
     723             : 
     724           0 :   Float_t xx = 0., yy = 0.;
     725             :   Int_t xpad = -1, ypad = -1;
     726             :   
     727           0 :   if(smn <12) {
     728             :     xpad = col;
     729             :     ypad = row;
     730           0 :   }
     731           0 :   else if(smn >=12 && smn < 24) {
     732             :     xpad = row;
     733             :     ypad = col;
     734           0 :   }
     735             :  
     736             :  
     737             : 
     738           0 :   RectGeomCellPos(smn,xpad,ypad,xx,yy); 
     739           0 :   xp = xx;
     740           0 :   yp = yy;
     741             : 
     742           0 :   Float_t rpxpy  = TMath::Sqrt(xx*xx + yy*yy);
     743           0 :   Float_t theta  = TMath::ATan2(rpxpy,365.0);
     744           0 :   eta    = -TMath::Log(TMath::Tan(0.5*theta));
     745             : 
     746             :   Int_t etaBin = -1;  
     747             : 
     748           0 :   if( eta > 2.1 && eta < 2.3) etaBin = 0;
     749           0 :   else if( eta > 2.3 && eta < 2.5) etaBin = 1;
     750           0 :   else if( eta > 2.5 && eta < 2.7) etaBin = 2;
     751           0 :   else if( eta > 2.7 && eta < 2.9) etaBin = 3;
     752           0 :   else if( eta > 2.9 && eta < 3.1) etaBin = 4;
     753           0 :   else if( eta > 3.1 && eta < 3.3) etaBin = 5;
     754           0 :   else if( eta > 3.3 && eta < 3.5) etaBin = 6;
     755           0 :   else if( eta > 3.5 && eta < 3.7) etaBin = 7;
     756           0 :   else if( eta > 3.7 && eta < 3.9) etaBin = 8;
     757           0 :   else if( eta > 3.9 && eta < 4.1) etaBin = 9;
     758             :   else etaBin = 13;
     759             : 
     760           0 :   etaindex = etaBin;
     761             : 
     762             : 
     763           0 : }
     764             : 
     765             : //_____________________________________________________
     766             : 
     767             : Float_t AliPMDUtility::GetTheta() const
     768             : {
     769           0 :   return fTheta;
     770             : }
     771             : Float_t AliPMDUtility::GetEta() const
     772             : {
     773           0 :   return fEta;
     774             : }
     775             : Float_t AliPMDUtility::GetPhi() const
     776             : {
     777           0 :   return fPhi;
     778             : }
     779             : Float_t AliPMDUtility::GetX() const
     780             : {
     781           0 :   return fPx;
     782             : }
     783             : Float_t AliPMDUtility::GetY() const
     784             : {
     785           0 :   return fPy;
     786             : }
     787             : Float_t AliPMDUtility::GetZ() const
     788             : {
     789           0 :   return fPz;
     790             : }
     791             : //--------------------------------------------------------------------//

Generated by: LCOV version 1.11