LCOV - code coverage report
Current view: top level - TPC/TPCbase - AliTPCROC.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 160 262 61.1 %
Date: 2016-06-14 17:26:59 Functions: 8 15 53.3 %

          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             : /// \class AliTPCROC
      18             : /// \brief Geometry class for a single ROC
      19             : 
      20             : #include "AliTPCROC.h"
      21             : #include "TMath.h"
      22             : 
      23             : /// \cond CLASSIMP
      24          24 : ClassImp(AliTPCROC)
      25             : /// \endcond
      26             : 
      27             : 
      28             : AliTPCROC* AliTPCROC::fgInstance = 0;
      29             : 
      30             : 
      31             : 
      32             : 
      33             : //_ singleton implementation __________________________________________________
      34             : AliTPCROC* AliTPCROC::Instance()
      35             : {
      36             :   /// Singleton implementation
      37             :   /// Returns an instance of this class, it is created if neccessary
      38             : 
      39     7009228 :   if (fgInstance == 0){
      40           6 :     fgInstance = new AliTPCROC();
      41           3 :     fgInstance->Init();
      42           3 :   }
      43     3504614 :   return fgInstance;
      44           0 : }
      45             : 
      46             : 
      47             : 
      48             : 
      49             : void AliTPCROC::Init(){
      50             :   /// initialize static variables
      51             : 
      52           6 :   if (AliTPCROC::fNSectorsAll>0) return;
      53           3 :   fNSectorsAll =72;
      54           3 :   fNSectors[0] =36;
      55           3 :   fNSectors[1] =36;
      56             :   //
      57           3 :   fNRows[0]= 63;
      58           3 :   fNRows[1]= 96;
      59             :   //
      60             :   // number of pads in padrow
      61           3 :   fNPads[0] = new UInt_t[fNRows[0]];
      62           3 :   fNPads[1] = new UInt_t[fNRows[1]];
      63             :   //
      64             :   // padrow index in array
      65             :   //
      66           3 :   fRowPosIndex[0] = new UInt_t[fNRows[0]];
      67           3 :   fRowPosIndex[1] = new UInt_t[fNRows[1]];
      68             :   //
      69             :   // inner sectors
      70             :   //
      71             :   UInt_t index =0;
      72         384 :   for (UInt_t irow=0; irow<fNRows[0];irow++){
      73         564 :     UInt_t npads = (irow==0) ? 68 : 2 *Int_t(Double_t(irow)/3. +33.67);
      74         189 :     fNPads[0][irow] = npads;
      75         189 :     fRowPosIndex[0][irow] = index;
      76         189 :     index+=npads;
      77             :   }
      78           3 :   fNChannels[0] = index;
      79             :   //
      80             :   index =0;
      81           3 :   Double_t k1 = 10.*TMath::Tan(10*TMath::DegToRad())/6.;
      82           3 :   Double_t k2 = 15.*TMath::Tan(10*TMath::DegToRad())/6.;
      83         582 :   for (UInt_t irow=0; irow<fNRows[1];irow++){
      84         576 :     UInt_t npads = (irow<64) ?
      85         480 :       2*Int_t(k1*Double_t(irow)+37.75):
      86          96 :       2*Int_t(k2*Double_t(irow-64)+56.66);
      87         288 :     fNPads[1][irow] = npads;
      88         288 :     fRowPosIndex[1][irow] = index;
      89         288 :     index+=npads;
      90             :   }
      91           3 :   fNChannels[1] = index;
      92           3 :   SetGeometry();
      93           6 : }
      94             : 
      95             : 
      96             : 
      97             : 
      98             : void AliTPCROC::SetGeometry()
      99             : {
     100             :   /// set ROC geometry parameters
     101             : 
     102             :   const  Float_t kInnerRadiusLow = 83.65;
     103             :   const  Float_t kInnerRadiusUp  = 133.3;
     104             :   const  Float_t kOuterRadiusLow = 133.5;
     105             :   const  Float_t kOuterRadiusUp  = 247.7;
     106             :   const  Float_t kInnerFrameSpace = 1.5;
     107             :   const  Float_t kOuterFrameSpace = 1.5;
     108             :   const  Float_t kInnerWireMount = 1.2;
     109             :   const  Float_t kOuterWireMount = 1.4;
     110             :   const  Float_t kZLength =250.;
     111             :   const  UInt_t   kNRowLow = 63;
     112             :   const  UInt_t   kNRowUp1 = 64;
     113             :   const  UInt_t   kNRowUp2 = 32;
     114             :   const  UInt_t   kNRowUp  = 96;
     115             :   const  Float_t kInnerAngle = 20; // 20 degrees
     116             :   const  Float_t kOuterAngle = 20; // 20 degrees
     117             :   //
     118             :   //  pad     parameters
     119             :   //
     120             :   const Float_t  kInnerPadPitchLength = 0.75;
     121             :   const Float_t  kInnerPadPitchWidth = 0.40;
     122             :   const Float_t  kInnerPadLength = 0.75;
     123             :   const Float_t  kInnerPadWidth = 0.40;
     124             :   const Float_t  kOuter1PadPitchLength = 1.0;
     125             :   const Float_t  kOuterPadPitchWidth = 0.6;
     126             :   const Float_t  kOuter1PadLength = 1.0;
     127             :   const Float_t  kOuterPadWidth = 0.6;
     128             :   const Float_t  kOuter2PadPitchLength = 1.5;
     129             :   const Float_t  kOuter2PadLength = 1.5;
     130             : 
     131             :   //
     132             :   //wires default parameters
     133             :   //
     134             : //   const UInt_t    kNInnerWiresPerPad = 3;
     135             : //   const UInt_t    kInnerDummyWire = 2;
     136             : //   const Float_t  kInnerWWPitch = 0.25;
     137             : //   const Float_t  kRInnerFirstWire = 84.475;
     138             : //   const Float_t  kRInnerLastWire = 132.475;
     139             : //   const Float_t  kInnerOffWire = 0.5;
     140             : //   const UInt_t    kNOuter1WiresPerPad = 4;
     141             : //   const UInt_t    kNOuter2WiresPerPad = 6;
     142             : //   const Float_t  kOuterWWPitch = 0.25;
     143             : //   const Float_t  kROuterFirstWire = 134.225;
     144             : //   const Float_t  kROuterLastWire = 246.975;
     145             : //   const UInt_t    kOuterDummyWire = 2;
     146             : //   const Float_t  kOuterOffWire = 0.5;
     147             :   //
     148             :   //set sector parameters
     149             :   //
     150           6 :   fInnerRadiusLow = kInnerRadiusLow;
     151           3 :   fOuterRadiusLow = kOuterRadiusLow;
     152           3 :   fInnerRadiusUp  = kInnerRadiusUp;
     153           3 :   fOuterRadiusUp  = kOuterRadiusUp;
     154           3 :   fInnerFrameSpace = kInnerFrameSpace;
     155           3 :   fOuterFrameSpace = kOuterFrameSpace;
     156           3 :   fInnerWireMount  = kInnerWireMount;
     157           3 :   fOuterWireMount  = kOuterWireMount;
     158           3 :   fZLength         = kZLength;
     159           3 :   fInnerAngle      =  TMath::DegToRad()*kInnerAngle;
     160           3 :   fOuterAngle      =  TMath::DegToRad()*kOuterAngle;
     161             : 
     162           3 :   fNRowLow       = kNRowLow;
     163           3 :   fNRowUp1      = kNRowUp1;
     164           3 :   fNRowUp2       = kNRowUp2;
     165           3 :   fNRowUp        = kNRowUp;
     166             :   //
     167             :   //set pad parameter
     168             :   //
     169           3 :   fInnerPadPitchLength = kInnerPadPitchLength;
     170           3 :   fInnerPadPitchWidth  = kInnerPadPitchWidth;
     171           3 :   fInnerPadLength      = kInnerPadLength;
     172           3 :   fInnerPadWidth       = kInnerPadWidth;
     173           3 :   fOuter1PadPitchLength = kOuter1PadPitchLength;
     174           3 :   fOuter2PadPitchLength = kOuter2PadPitchLength;
     175           3 :   fOuterPadPitchWidth   = kOuterPadPitchWidth;
     176           3 :   fOuter1PadLength      = kOuter1PadLength;
     177           3 :   fOuter2PadLength      = kOuter2PadLength;
     178           3 :   fOuterPadWidth        = kOuterPadWidth;
     179             : 
     180             :   //
     181             :   //set wire parameters
     182             :   //
     183             :   // SetInnerNWires(kNInnerWiresPerPad);
     184             :   //   SetInnerDummyWire(kInnerDummyWire);
     185             :   //   SetInnerOffWire(kInnerOffWire);
     186             :   //   SetOuter1NWires(kNOuter1WiresPerPad);
     187             :   //   SetOuter2NWire(kNOuter2WiresPerPad);
     188             :   //   SetOuterDummyWire(kOuterDummyWire);
     189             :   //   SetOuterOffWire(kOuterOffWire);
     190             :   //   SetInnerWWPitch(kInnerWWPitch);
     191             :   //   SetRInnerFirstWire(kRInnerFirstWire);
     192             :   //   SetRInnerLastWire(kRInnerLastWire);
     193             :   //   SetOuterWWPitch(kOuterWWPitch);
     194             :   //   SetROuterFirstWire(kROuterFirstWire);
     195             :   //   SetROuterLastWire(kROuterLastWire);
     196             : 
     197             :   UInt_t i=0;
     198           3 :   Float_t firstrow = fInnerRadiusLow + 1.575;
     199         384 :   for( i= 0;i<fNRowLow;i++)
     200             :     {
     201         189 :       Float_t x = firstrow + fInnerPadPitchLength*(Float_t)i;
     202         189 :       fPadRowLow[i]=x;
     203         189 :       fYInner[i+1]  = x*TMath::Tan(fInnerAngle/2.)-fInnerWireMount;
     204         189 :       fNPadsLow[i] = GetNPads(0,i) ;     // ROC implement
     205             :     }
     206             :   // cross talk rows
     207           3 :   fYInner[0]=(fPadRowLow[0]-fInnerPadPitchLength)*TMath::Tan(fInnerAngle/2.)-fInnerWireMount;
     208           3 :   fYInner[fNRowLow+1]=(fPadRowLow[fNRowLow-1]+fInnerPadPitchLength)*TMath::Tan(fInnerAngle/2.)-fInnerWireMount;
     209           3 :   firstrow = fOuterRadiusLow + 1.6;
     210         582 :   for(i=0;i<fNRowUp;i++)
     211             :     {
     212         288 :       if(i<fNRowUp1){
     213         192 :         Float_t x = firstrow + fOuter1PadPitchLength*(Float_t)i;
     214         192 :         fPadRowUp[i]=x;
     215         192 :         fYOuter[i+1]= x*TMath::Tan(fOuterAngle/2.)-fOuterWireMount;
     216         192 :         fNPadsUp[i] =  GetNPads(36,i) ;     // ROC implement
     217         192 :         if(i==fNRowUp1-1) {
     218           3 :           fLastWireUp1=fPadRowUp[i] +0.625;
     219           3 :           firstrow = fPadRowUp[i] + 0.5*(fOuter1PadPitchLength+fOuter2PadPitchLength);
     220           3 :         }
     221         192 :       }
     222             :       else
     223             :         {
     224          96 :           Float_t x = firstrow + fOuter2PadPitchLength*(Float_t)(i-64);
     225          96 :           fPadRowUp[i]=x;
     226          96 :           fNPadsUp[i] =  GetNPads(36,i) ;     // ROC implement
     227             :         }
     228         288 :       fYOuter[i+1]  = fPadRowUp[i]*TMath::Tan(fOuterAngle/2.)-fOuterWireMount;
     229             :     }
     230             : 
     231             : 
     232             : 
     233           3 : }
     234             : 
     235             : 
     236             : 
     237             : 
     238             : //_____________________________________________________________________________
     239             : AliTPCROC::AliTPCROC()
     240           3 :           :TObject(),
     241           3 :            fNSectorsAll(0),
     242           3 :            fInnerRadiusLow(0.),
     243           3 :            fInnerRadiusUp(0.),
     244           3 :            fOuterRadiusUp(0.),
     245           3 :            fOuterRadiusLow(0.),
     246           3 :            fInnerFrameSpace(0.),
     247           3 :            fOuterFrameSpace(0.),
     248           3 :            fInnerWireMount(0.),
     249           3 :            fOuterWireMount(0.),
     250           3 :            fZLength(0.),
     251           3 :            fInnerAngle(0.),
     252           3 :            fOuterAngle(0.),
     253           3 :            fNInnerWiresPerPad(0),
     254           3 :            fInnerWWPitch(0.),
     255           3 :            fInnerDummyWire(0),
     256           3 :            fInnerOffWire(0.),
     257           3 :            fRInnerFirstWire(0.),
     258           3 :            fRInnerLastWire(0.),
     259           3 :            fLastWireUp1(0.),
     260           3 :            fNOuter1WiresPerPad(0),
     261           3 :            fNOuter2WiresPerPad(0),
     262           3 :            fOuterWWPitch(0.),
     263           3 :            fOuterDummyWire(0),
     264           3 :            fOuterOffWire(0),
     265           3 :            fROuterFirstWire(0.),
     266           3 :            fROuterLastWire(0),
     267           3 :            fInnerPadPitchLength(0.),
     268           3 :            fInnerPadPitchWidth(0.),
     269           3 :            fInnerPadLength(0.),
     270           3 :            fInnerPadWidth(0.),
     271           3 :            fOuter1PadPitchLength(0.),
     272           3 :            fOuter2PadPitchLength(0),
     273           3 :            fOuterPadPitchWidth(0),
     274           3 :            fOuter1PadLength(0.),
     275           3 :            fOuter2PadLength(0),
     276           3 :            fOuterPadWidth(0),
     277           3 :            fNRowLow(0),
     278           3 :            fNRowUp1(0),
     279           3 :            fNRowUp2(0),
     280           3 :            fNRowUp(0),
     281           3 :            fNtRows(0)
     282          15 : {
     283             :   /// Default constructor
     284             : 
     285          18 :   for (UInt_t i=0;i<2;i++){
     286           6 :     fNSectors[i]  = 0;
     287           6 :     fNRows[i]     = 0;
     288           6 :     fNChannels[i] = 0;
     289           6 :     fNPads[i]     = 0;
     290           6 :     fRowPosIndex[i]= 0;
     291             :   }
     292             : 
     293         606 :   for (UInt_t i=0;i<100;++i){
     294         300 :     fPadRowLow[i]=0.;
     295         300 :     fPadRowUp[i]=0.;
     296         300 :     fNPadsLow[i]=0;
     297         300 :     fNPadsUp[i]=0;
     298         300 :     fYInner[i]=0.;
     299         300 :     fYOuter[i]=0.;
     300             :   }
     301           6 : }
     302             : 
     303             : 
     304             : //_____________________________________________________________________________
     305             : AliTPCROC::AliTPCROC(const AliTPCROC &roc)
     306           0 :           :TObject(roc),
     307           0 :            fNSectorsAll(0),
     308           0 :            fInnerRadiusLow(0.),
     309           0 :            fInnerRadiusUp(0.),
     310           0 :            fOuterRadiusUp(0.),
     311           0 :            fOuterRadiusLow(0.),
     312           0 :            fInnerFrameSpace(0.),
     313           0 :            fOuterFrameSpace(0.),
     314           0 :            fInnerWireMount(0.),
     315           0 :            fOuterWireMount(0.),
     316           0 :            fZLength(0.),
     317           0 :            fInnerAngle(0.),
     318           0 :            fOuterAngle(0.),
     319           0 :            fNInnerWiresPerPad(0),
     320           0 :            fInnerWWPitch(0.),
     321           0 :            fInnerDummyWire(0),
     322           0 :            fInnerOffWire(0.),
     323           0 :            fRInnerFirstWire(0.),
     324           0 :            fRInnerLastWire(0.),
     325           0 :            fLastWireUp1(0.),
     326           0 :            fNOuter1WiresPerPad(0),
     327           0 :            fNOuter2WiresPerPad(0),
     328           0 :            fOuterWWPitch(0.),
     329           0 :            fOuterDummyWire(0),
     330           0 :            fOuterOffWire(0),
     331           0 :            fROuterFirstWire(0.),
     332           0 :            fROuterLastWire(0),
     333           0 :            fInnerPadPitchLength(0.),
     334           0 :            fInnerPadPitchWidth(0.),
     335           0 :            fInnerPadLength(0.),
     336           0 :            fInnerPadWidth(0.),
     337           0 :            fOuter1PadPitchLength(0.),
     338           0 :            fOuter2PadPitchLength(0),
     339           0 :            fOuterPadPitchWidth(0),
     340           0 :            fOuter1PadLength(0.),
     341           0 :            fOuter2PadLength(0),
     342           0 :            fOuterPadWidth(0),
     343           0 :            fNRowLow(0),
     344           0 :            fNRowUp1(0),
     345           0 :            fNRowUp2(0),
     346           0 :            fNRowUp(0),
     347           0 :            fNtRows(0)
     348             : 
     349           0 : {
     350             :   /// AliTPCROC copy constructor
     351             : 
     352           0 :   fNSectorsAll = roc.fNSectorsAll;
     353           0 :   fNSectors[0] = roc.fNSectors[0];
     354           0 :   fNSectors[1] = roc.fNSectors[1];
     355           0 :   fNRows[0]    = roc.fNRows[0];
     356           0 :   fNRows[1]    = roc.fNRows[1];
     357           0 :   fNChannels[0]= roc.fNChannels[0];
     358           0 :   fNChannels[1]= roc.fNChannels[1];
     359             :   //
     360             :   // number of pads in padrow
     361           0 :   fNPads[0] = new UInt_t[fNRows[0]];
     362           0 :   fNPads[1] = new UInt_t[fNRows[1]];
     363             :   //
     364             :   // padrow index in array
     365             :   //
     366           0 :   fRowPosIndex[0] = new UInt_t[fNRows[0]];
     367           0 :   fRowPosIndex[1] = new UInt_t[fNRows[1]];
     368             :   //
     369           0 :   for (UInt_t irow =0; irow<fNRows[0];irow++){
     370           0 :     fNPads[0][irow]       = roc.fNPads[0][irow];
     371           0 :     fRowPosIndex[0][irow] = roc.fRowPosIndex[0][irow];
     372             :   }
     373           0 :   for (UInt_t irow =0; irow<fNRows[1];irow++){
     374           0 :     fNPads[1][irow]       = roc.fNPads[1][irow];
     375           0 :     fRowPosIndex[1][irow] = roc.fRowPosIndex[1][irow];
     376             :   }
     377             : 
     378           0 :   for (UInt_t i=0;i<100;++i){
     379           0 :     fPadRowLow[i]=roc.fPadRowLow[i];
     380           0 :     fPadRowUp[i]=roc.fPadRowUp[i];
     381           0 :     fNPadsLow[i]=roc.fNPadsLow[i];
     382           0 :     fNPadsUp[i]=roc.fNPadsUp[i];
     383           0 :     fYInner[i]=roc.fYInner[i];
     384           0 :     fYOuter[i]=roc.fYOuter[i];
     385             :   }
     386             : 
     387           0 : }
     388             : //____________________________________________________________________________
     389             : AliTPCROC & AliTPCROC::operator =(const AliTPCROC & roc)
     390             : {
     391             :   /// assignment operator - dummy
     392             : 
     393           0 :   if (this == &roc) return (*this);
     394             : 
     395           0 :   fZLength = roc.fZLength;
     396           0 :   return (*this);
     397           0 : }
     398             : //_____________________________________________________________________________
     399             : AliTPCROC::~AliTPCROC()
     400           0 : {
     401             :   /// AliTPCROC destructor
     402             : 
     403           0 :   delete [] fNPads[0];
     404           0 :   delete [] fNPads[1];
     405           0 :   delete [] fRowPosIndex[0];
     406           0 :   delete [] fRowPosIndex[1];
     407           0 :   fgInstance = 0x0;
     408             : 
     409           0 : }
     410             : 
     411             : 
     412             : 
     413             : 
     414             : void AliTPCROC::GetPositionLocal(UInt_t sector, UInt_t row, UInt_t pad, Float_t *pos){
     415             :   /// get position of center of pad - ideal frame used
     416             : 
     417      259792 :   pos[2]=fZLength;
     418      259792 :   if (sector<36){
     419      222096 :    pos[0] = fPadRowLow[row];
     420       92200 :    pos[1] = fInnerPadPitchWidth*(Int_t(pad)+0.5-Int_t(fNPads[0][row])/2);
     421       92200 :   }else{
     422       37696 :     pos[0] = fPadRowUp[row];
     423       37696 :     pos[1] = fOuterPadPitchWidth*(Int_t(pad)+0.5-Int_t(fNPads[1][row])/2);
     424             :   }
     425      129896 :   if ((sector%36)>=18){
     426       62556 :     pos[2] *= -1.;
     427       62556 :     pos[1] *= -1.;
     428       62556 :   }
     429      129896 : }
     430             : 
     431             : 
     432             : void AliTPCROC::GetPositionGlobal(UInt_t sector, UInt_t row, UInt_t pad, Float_t *pos){
     433             :   /// get position of center of pad - ideal frame used
     434             : 
     435      259792 :   GetPositionLocal(sector,row,pad,pos);
     436      129896 :   Double_t alpha = TMath::DegToRad()*(10.+20.*(sector%18));
     437      129896 :   Float_t gx = pos[0]*TMath::Cos(alpha)-pos[1]*TMath::Sin(alpha);
     438      129896 :   Float_t gy = pos[1]*TMath::Cos(alpha)+pos[0]*TMath::Sin(alpha);
     439      129896 :   pos[0] = gx;
     440      129896 :   pos[1] = gy;
     441      129896 : }
     442             : 
     443             : 
     444             : Float_t AliTPCROC::GetIdealPosition(UInt_t sector, UInt_t row, UInt_t pad,  coordType coord){
     445             :   //
     446             :   // return ideal position accoring hardwired geometry in the class
     447             :   //  
     448             : 
     449           0 :   AliTPCROC *roc = AliTPCROC::Instance();
     450           0 :   Float_t pos[3];
     451           0 :   if (coord==kLx){
     452           0 :     roc->GetPositionLocal(sector, row,pad,pos);
     453           0 :     return pos[0];
     454             :   }
     455           0 :   if (coord==kLy){
     456           0 :     roc->GetPositionLocal(sector, row,pad,pos);
     457           0 :     return pos[1];
     458             :   }
     459           0 :   if (coord==kLz){
     460           0 :     roc->GetPositionLocal(sector, row,pad,pos);
     461           0 :     return pos[2];
     462             :   }
     463           0 :   if (coord==kGx){
     464           0 :     roc->GetPositionGlobal(sector, row,pad,pos);
     465           0 :     return pos[0];
     466             :   }
     467           0 :   if (coord==kGy){
     468           0 :     roc->GetPositionGlobal(sector, row,pad,pos);
     469           0 :     return pos[1];
     470             :   }
     471           0 :   if (coord==kGz){
     472           0 :     roc->GetPositionGlobal(sector, row,pad,pos);
     473           0 :     return pos[2];
     474             :   }
     475             : 
     476           0 :   return 0;
     477             :   
     478           0 : }

Generated by: LCOV version 1.11