LCOV - code coverage report
Current view: top level - TRD/TRDbase - AliTRDCalibraMode.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 22 174 12.6 %
Date: 2016-06-14 17:26:59 Functions: 3 22 13.6 %

          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             : /* $Id$ */
      17             : 
      18             : /////////////////////////////////////////////////////////////////////////////////
      19             : //                                                                             
      20             : // AliTRDCalibraMode                                                             
      21             : //                                                                             
      22             : // This class is for the modes of the TRD calibration.        
      23             : // The user has to choose with the functions SetNz and SetNrphi
      24             : // the precision of the calibration. 
      25             : // Author:
      26             : //   R. Bailhache (R.Bailhache@gsi.de)
      27             : //                            
      28             : //Begin_Html
      29             : /*
      30             : <br>
      31             : <CENTER>
      32             : <TABLE border=1>
      33             : <TR><TD><center>Nz</center></TD><TD><center> 0 </center></TD><TD><center> 1 </center></TD><TD><center> 2 </center></TD><TD><center> 3 </center></TD><TD><center> 4 </center></TD></TR>
      34             : <TR><TD><CENTER>group of row pads per detector</CENTER></TD><TD><CENTER>1</CENTER></TD><TD><CENTER>2</CENTER></TD><TD><CENTER>4</CENTER></TD><TD><CENTER>6(chamb2)<br> 8(others chambers)</CENTER></TD><TD><CENTER>12 (chamb2)<br> 16 (chamb0)</CENTER></TD></TR>
      35             : <TR><TD><CENTER>row pads per group</CENTER></TD><TD><CENTER>12 (chamb2)<br> 16 (chamb0)</CENTER></TD><TD><CENTER>6 (chamb2)<br> 8 (chamb0)</CENTER></TD><TD><CENTER>3 (chamb2)<br> 4 (chamb0)</CENTER></TD><TD><CENTER>2</CENTER></TD><TD><CENTER>1</CENTER></TD></TR>
      36             : <TR><TD><CENTER>~distance [cm]</CENTER></TD><TD><CENTER>106 (chamb2)<br> 130 (chamb0)</CENTER></TD><TD><CENTER>53 (chamb2)<br> 65 (chamb0)</CENTER></TD><TD><CENTER>26.5 (chamb2)<br> 32.5 (chamb0)</CENTER></TD><TD><CENTER>17 (chamb2)<br> 17 (chamb0)</CENTER></TD><TD><CENTER>9 (chamb2)<br> 9 (chamb0)</CENTER></TD></TR>
      37             : <CAPTION>In the z direction</CAPTION>
      38             : </TABLE>
      39             : </CENTER>
      40             : <CENTER>
      41             : <br>
      42             : <TABLE border=1>
      43             : <TR><TD><center>Nrphi</center></TD><TD><center> 0 </center></TD><TD><center> 1 </center></TD><TD><center> 2 </center></TD><TD><center> 3 </center></TD><TD><center> 4 </center></TD><TD><center> 5 </center></TD><TD><center> 6 </center></TD></TR>
      44             : <TR><TD><CENTER>group of col pads per detector</CENTER></TD><TD><CENTER>1</CENTER></TD><TD><CENTER>2</CENTER></TD><TD><CENTER>4</CENTER></TD><TD><CENTER>8</CENTER></TD><TD><CENTER>16</CENTER></TD><TD><center>36</center></TD><TD><center>144</center></TD></TR>
      45             : <TR><TD><CENTER>col pads per group</CENTER></TD><TD><CENTER>144</CENTER></TD><TD><CENTER>72</CENTER></TD><TD><CENTER>36</CENTER></TD><TD><CENTER>18</CENTER></TD><TD><CENTER>9</CENTER></TD><TD><center>4</center></TD><TD><center>1</center></TD></TR>
      46             : <TR><TD><CENTER>~distance [cm]</CENTER></TD><TD><CENTER>113.4</CENTER></TD><TD><CENTER>56.7</CENTER></TD><TD><CENTER>25.3</CENTER></TD><TD><CENTER>14.3</CENTER></TD><TD><CENTER>7.25</CENTER></TD><TD><center>3.2</center></TD><TD><center>0.8</center></TD></TR>
      47             : <CAPTION>In the rphi direction</CAPTION>
      48             : </TABLE>
      49             : </CENTER>
      50             : <br>
      51             : */
      52             : //End_Html 
      53             : //
      54             : //
      55             : // Moreover two other more general granularities:
      56             : // It can not work with AliTRDCalibraVector
      57             : // 10 corresponds to per supermodule
      58             : // 100 all together
      59             : //                            
      60             : //////////////////////////////////////////////////////////////////////////////////////
      61             : 
      62             : #include "AliLog.h"
      63             : 
      64             : #include "AliTRDCalibraMode.h"
      65             : #include "AliTRDgeometry.h"
      66             : 
      67          48 : ClassImp(AliTRDCalibraMode)
      68             : 
      69             : //______________________________________________________________________________________
      70             : AliTRDCalibraMode::AliTRDCalibraMode()
      71           2 :   :TObject()
      72           2 :   ,fGeo(0)
      73          10 : {
      74             :   //
      75             :   // Default constructor
      76             :   //
      77             : 
      78          16 :   for (Int_t i = 0; i < 3; i++) {
      79           6 :     fNz[i]    = 0;
      80           6 :     fNrphi[i] = 0;
      81             :   }
      82             : 
      83          16 :   for (Int_t k = 0; k < 3; k++) {
      84           6 :     fDetChamb2[k] = 0;
      85           6 :     fDetChamb0[k] = 0;
      86             :   }
      87             : 
      88          16 :   for (Int_t i = 0; i < 3; i++) {
      89           6 :     fRowMin[i]    = -1;
      90           6 :     fRowMax[i]    = -1;
      91           6 :     fColMax[i]    = -1;
      92           6 :     fColMin[i]    = -1;
      93           6 :     fNnZ[i]       = -1;
      94           6 :     fNnRphi[i]    = -1;
      95           6 :     fNfragZ[i]    = -1;
      96           6 :     fNfragRphi[i] = -1;
      97           6 :     fXbins[i]     = -1;
      98             :   }
      99             :   
     100           6 :   fGeo = new AliTRDgeometry();
     101             :  
     102           4 : }
     103             : 
     104             : //______________________________________________________________________________________
     105             : AliTRDCalibraMode::AliTRDCalibraMode(const AliTRDCalibraMode &c)
     106           0 :   :TObject(c)
     107           0 :   ,fGeo(0)
     108           0 : {
     109             :   //
     110             :   // Copy constructor
     111             :   //
     112             : 
     113           0 :   for(Int_t k = 0; k < 3; k++){
     114           0 :     fNz[k]        = c.fNz[k];
     115           0 :     fNrphi[k]     = c.fNrphi[k];
     116           0 :     fNnZ[k]       = c.fNnZ[k];
     117           0 :     fNnRphi[k]    = c.fNnRphi[k];
     118           0 :     fNfragZ[k]    = c.fNfragZ[k];
     119           0 :     fNfragRphi[k] = c.fNfragRphi[k];
     120           0 :     fRowMin[k]    = c.fRowMin[k];
     121           0 :     fRowMax[k]    = c.fRowMax[k];
     122           0 :     fColMin[k]    = c.fColMin[k];
     123           0 :     fColMax[k]    = c.fColMax[k];
     124           0 :     fXbins[k]     = c.fXbins[k];
     125           0 :     fDetChamb0[k] = c.fDetChamb0[k];
     126           0 :     fDetChamb2[k] = c.fDetChamb2[k];
     127             :   }
     128             : 
     129           0 :   if (fGeo) {
     130           0 :     delete fGeo;
     131             :   }
     132           0 :   fGeo = new AliTRDgeometry();
     133             : 
     134           0 : }
     135             : 
     136             : //____________________________________________________________________________________
     137             : AliTRDCalibraMode::~AliTRDCalibraMode()
     138           0 : {
     139             :   //
     140             :   // AliTRDCalibraMode destructor
     141             :   //
     142             : 
     143           0 :   if (fGeo) {
     144           0 :     delete fGeo;
     145             :   }
     146             : 
     147           0 : }
     148             : 
     149             : //_____________________________________________________________________________
     150             : void AliTRDCalibraMode::SetPerSuperModule(Int_t i)
     151             : {
     152             :   //
     153             :   // Set the mode of calibration group per supermodule
     154             :   // 
     155             : 
     156           0 :   fNz[i] = 10;
     157           0 :   fNrphi[i] = 10; 
     158           0 : }
     159             : 
     160             : //_____________________________________________________________________________
     161             : void AliTRDCalibraMode::SetAllTogether(Int_t i)
     162             : {
     163             :   //
     164             :   // Set the mode of calibration group all together
     165             :   // 
     166             : 
     167           0 :   fNz[i] = 100;
     168           0 :   fNrphi[i] = 100; 
     169           0 : }
     170             : 
     171             : //_____________________________________________________________________________
     172             : void AliTRDCalibraMode::SetNz(Int_t i, Short_t Nz)
     173             : {
     174             :   //
     175             :   // Set the mode of calibration group in the z direction for the parameter i
     176             :   // 
     177             : 
     178           0 :   if ((Nz >= 0) && 
     179           0 :       (Nz <  5)) {
     180           0 :     fNz[i] = Nz; 
     181           0 :   }
     182             :   else {
     183           0 :     AliInfo("You have to choose between 0 and 4.");
     184             :   }
     185             : 
     186           0 : }
     187             : 
     188             : //_____________________________________________________________________________
     189             : void AliTRDCalibraMode::SetNrphi(Int_t i, Short_t Nrphi)
     190             : {
     191             :   //
     192             :   // Set the mode of calibration group in the rphi direction for the parameter i
     193             :   //
     194             :  
     195           0 :   if ((Nrphi >= 0) && 
     196           0 :       (Nrphi <  7)) {
     197           0 :     fNrphi[i] = Nrphi; 
     198           0 :   }
     199             :   else {
     200           0 :     AliInfo("You have to choose between 0 and 6 or 10/100.");
     201             :   }
     202             : 
     203           0 : }
     204             : 
     205             : //_______________________________________________________________________________________
     206             : void AliTRDCalibraMode::ModePadCalibration(Int_t iChamb, Int_t i)
     207             : {
     208             :   //
     209             :   // Definition of the calibration mode
     210             :   // from Nz and Nrphi, the number of row and col pads per calibration groups are setted
     211             :   //
     212             : 
     213             : 
     214           0 :   fNnZ[i]    = 0;
     215           0 :   fNnRphi[i] = 0;
     216             :   
     217           0 :   if (((fNz[i] == 0) || (fNz[i] == 10) || (fNz[i] == 100)) && (iChamb == 2)) {
     218           0 :     fNnZ[i] = 12;
     219           0 :   }
     220           0 :   if (((fNz[i] == 0) || (fNz[i] == 10) || (fNz[i] == 100)) && (iChamb != 2)) {
     221           0 :     fNnZ[i] = 16;
     222           0 :   }  
     223           0 :   if ((fNz[i] == 1) && (iChamb == 2)) {
     224           0 :     fNnZ[i] = 6;
     225           0 :   }
     226           0 :   if ((fNz[i] == 1) && (iChamb != 2)) {
     227           0 :     fNnZ[i] = 8;
     228           0 :   }
     229           0 :   if ((fNz[i] == 2) && (iChamb == 2)) {
     230           0 :     fNnZ[i] = 3;
     231           0 :   }
     232           0 :   if ((fNz[i] == 2) && (iChamb != 2)) {
     233           0 :     fNnZ[i] = 4;
     234           0 :   }
     235           0 :   if (fNz[i] == 3) {
     236           0 :     fNnZ[i] = 2;
     237           0 :   }
     238           0 :   if (fNz[i] == 4) {
     239           0 :     fNnZ[i] = 1;
     240           0 :   }
     241             :    
     242           0 :   if ((fNrphi[i] == 0) || (fNrphi[i] == 10) || (fNrphi[i] == 100)) {
     243           0 :     fNnRphi[i] = 144;
     244           0 :   }
     245           0 :   if (fNrphi[i] == 1) {
     246           0 :     fNnRphi[i] = 72;
     247           0 :   } 
     248           0 :   if (fNrphi[i] == 2) {
     249           0 :     fNnRphi[i] = 36;
     250           0 :   } 
     251           0 :   if (fNrphi[i] == 3) {
     252           0 :     fNnRphi[i] = 18;
     253           0 :   } 
     254           0 :   if (fNrphi[i] == 4) {
     255           0 :     fNnRphi[i] = 9;
     256           0 :   } 
     257           0 :   if (fNrphi[i] == 5) {
     258           0 :     fNnRphi[i] = 4;
     259           0 :   } 
     260           0 :   if (fNrphi[i] == 6) {
     261           0 :     fNnRphi[i] = 1;
     262           0 :   } 
     263             : 
     264           0 : }
     265             : 
     266             : //_____________________________________________________________________________________________
     267             : Bool_t AliTRDCalibraMode::ModePadFragmentation(Int_t iLayer,Int_t iStack, Int_t iSect, Int_t i)
     268             : {
     269             :   //
     270             :   // Definition of the calibration mode
     271             :   // From the number of row and col pads per calibration groups the
     272             :   // number of calibration groups are setted
     273             :   //
     274             : 
     275           0 :   fNfragZ[i]    = 0;
     276           0 :   fNfragRphi[i] = 0;
     277             : 
     278             :   // A little geometry:
     279           0 :   Int_t rowMax = fGeo->GetRowMax(iLayer,iStack,iSect);
     280           0 :   Int_t colMax = fGeo->GetColMax(iLayer);
     281             :   
     282             :   // The fragmentation
     283           0 :   if (fNnZ[i]    != 0) {
     284           0 :     fNfragZ[i]    = (Int_t) rowMax / fNnZ[i];
     285           0 :   }
     286             : 
     287           0 :   if (fNnRphi[i] != 0) {
     288           0 :     fNfragRphi[i] = (Int_t) colMax / fNnRphi[i];
     289           0 :   }
     290             : 
     291           0 :   return kTRUE;
     292             : 
     293             : }
     294             : 
     295             : //_____________________________________________________________________________
     296             : void AliTRDCalibraMode::ReconstructionRowPadGroup(Int_t idect, Int_t i)
     297             : {
     298             :   //
     299             :   // For the calibration group idect in a detector calculate the
     300             :   // first and last row pad and col pad.
     301             :   // The pads in the interval will have the same calibrated coefficients
     302             :   //
     303             : 
     304             :   Int_t posc = -1;
     305             :   Int_t posr = -1;
     306           0 :   fRowMin[i] = -1;
     307           0 :   fRowMax[i] = -1;
     308           0 :   fColMin[i] = -1;
     309           0 :   fColMax[i] = -1;
     310             :   
     311           0 :   if (fNfragZ[i]    != 0) {
     312           0 :     posc = (Int_t) idect / fNfragZ[i];
     313           0 :   }
     314           0 :   if (fNfragRphi[i] != 0) {
     315           0 :     posr = (Int_t) idect % fNfragZ[i];
     316           0 :   }
     317           0 :   fRowMin[i] = posr     * fNnZ[i];
     318           0 :   fRowMax[i] = (posr+1) * fNnZ[i];
     319           0 :   fColMin[i] = posc     * fNnRphi[i];
     320           0 :   fColMax[i] = (posc+1) * fNnRphi[i];
     321             : 
     322           0 : }
     323             : 
     324             : //_____________________________________________________________________________
     325             : void AliTRDCalibraMode::CalculXBins(Int_t idect, Int_t i)
     326             : {
     327             :   //
     328             :   // For the detector idect calcul the first Xbins
     329             :   //
     330             : 
     331           0 :   fXbins[i] = 0;
     332           0 :   AliDebug(2, Form("detector: %d", idect));
     333             : 
     334             :   // Total
     335           0 :   if((fNz[i] == 100) && (fNrphi[i] == 100)) {
     336           0 :     fXbins[i] = 0;
     337           0 :     return; 
     338             :   }
     339             : 
     340             :   // In which sector?
     341           0 :   Int_t sector = GetSector(idect);
     342             :  
     343             :  
     344             :   // First per supermodule
     345           0 :   if((fNz[i] == 10) && (fNrphi[i] == 10)) {
     346           0 :     fXbins[i] = sector;
     347           0 :     return;
     348             :   }
     349             :   
     350           0 :   fXbins[i] += sector*(6*fDetChamb2[i]+6*4*fDetChamb0[i]);
     351             : 
     352             :   // In which stack?
     353           0 :   Int_t stack = GetStack(idect);
     354             :   Int_t kc      = 0;
     355           0 :   while (kc < stack) {
     356           0 :     if (kc == 2) {
     357           0 :       fXbins[i] += 6 * fDetChamb2[i];
     358           0 :     }
     359             :     else {
     360           0 :       fXbins[i] += 6 * fDetChamb0[i];
     361             :     }
     362           0 :     kc ++;
     363             :   }
     364             :   
     365             :   // In which layer?
     366           0 :   Int_t layer = GetLayer(idect);
     367           0 :   if (stack == 2) {
     368           0 :     fXbins[i] += layer*fDetChamb2[i];
     369           0 :   }
     370             :   else {
     371           0 :     fXbins[i] += layer*fDetChamb0[i];
     372             :   }
     373             :  
     374           0 : }
     375             : 
     376             : //_____________________________________________________________________________
     377             : void AliTRDCalibraMode::ResetMinMax(Int_t i)
     378             : {
     379             :   //
     380             :   // Reset fRowMin fRowMax fColMin fColMax [i]
     381             :   //
     382             : 
     383           0 :   fRowMin[i] = -1;
     384           0 :   fRowMax[i] = -1;
     385           0 :   fColMin[i] = -1;
     386           0 :   fColMax[i] = -1;
     387             :  
     388           0 : }
     389             : 
     390             : //_____________________________________________________________________________
     391             : void AliTRDCalibraMode::SetDetChamb0(Int_t i)
     392             : {
     393             :   //
     394             :   // Set the number of calibration group per detector != 2
     395             :   //
     396             : 
     397           0 :   fDetChamb0[i] = fNfragZ[i] * fNfragRphi[i];  
     398             :  
     399           0 : }
     400             : 
     401             : //_____________________________________________________________________________
     402             : void AliTRDCalibraMode::SetDetChamb2(Int_t i)
     403             : {
     404             :   //
     405             :   // Set the number of calibration group per detector == 2
     406             :   //
     407             : 
     408           0 :   fDetChamb2[i] = fNfragZ[i] * fNfragRphi[i];  
     409             :  
     410           0 : }
     411             : 
     412             : //_____________________________________________________________________________
     413             : Int_t AliTRDCalibraMode::GetLayer(Int_t d) const
     414             : {
     415             :   //
     416             :   // Reconstruct the plane number from the detector number
     417             :   //
     418             : 
     419           0 :   return ((Int_t) (d % 6));
     420             : 
     421             : }
     422             : 
     423             : //_____________________________________________________________________________
     424             : Int_t AliTRDCalibraMode::GetStack(Int_t d) const
     425             : {
     426             :   //
     427             :   // Reconstruct the stack number from the detector number
     428             :   //
     429             : 
     430             :   const Int_t kNlayer = 6;
     431             : 
     432           0 :   return ((Int_t) (d % 30) / kNlayer);
     433             : 
     434             : }
     435             : 
     436             : //_____________________________________________________________________________
     437             : Int_t AliTRDCalibraMode::GetSector(Int_t d) const
     438             : {
     439             :   //
     440             :   // Reconstruct the sector number from the detector number
     441             :   //
     442             : 
     443             :   Int_t fg = 30;
     444             : 
     445           0 :   return ((Int_t) (d / fg));
     446             : 
     447             : }

Generated by: LCOV version 1.11