LCOV - code coverage report
Current view: top level - TRD/TRDbase - AliTRDCalOnlineGainTableROC.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6 76 7.9 %
Date: 2016-06-14 17:26:59 Functions: 3 15 20.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             : #include <AliTRDfeeParam.h>
      17             : #include "AliTRDCalOnlineGainTableROC.h"
      18             : #include "AliTRDCalOnlineGainTable.h"
      19             : 
      20             : //////////////////////////////////////////////////////////////////////////////////////////////
      21             : //
      22             : // Data structure to store gaintables of the online calibration in the OCDB
      23             : // consisting of three classes:
      24             : // AliTRDCalOnlineGainTable 
      25             : // AliTRDCalOnlineGainTableROC 
      26             : // AliTRDCalOnlineGainTableMCM
      27             : //
      28             : // AliTRDCalOnlineGainTable is the main class from which all stored data can be accessed.
      29             : // The two sub-classes AliTRDCalOnlineGainTableROC and AliTRDCalOnlineGainTableMCM
      30             : // contain the gaintables on ROC level and on the MCM level respectively.
      31             : //
      32             : // The online calibration is used to compensate gain deviations on the pad level.
      33             : // For the offline reconstruction the online calibration has to be undone. 
      34             : // The corresponding gain correction factor that was used by the online gain filter can be accessed 
      35             : // via the functions AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t det, Int_t row, Int_t col) 
      36             : // and AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t sector, Int_t stack, Int_t layer, Int_t row, Int_t col).
      37             : //
      38             : // AliTRDCalOnlineGainTableROC is a class to allocate MCM Gain Tables 
      39             : // and to access all stored calibration values from the ROC level by indicating row and col
      40             : //
      41             : //////////////////////////////////////////////////////////////////////////////////////////////
      42             : 
      43          48 : ClassImp(AliTRDCalOnlineGainTableROC);
      44             : 
      45             : //_____________________________________________________________________________
      46             : AliTRDCalOnlineGainTableROC::AliTRDCalOnlineGainTableROC()
      47        7508 :   :TObject()
      48       37540 : {
      49             :   //
      50             :   // constructor
      51             :   //
      52             : 
      53     1937064 :   for (int i=0; i<128; i++) {
      54      961024 :     fMCMGainTables[i] = 0;
      55             :   }
      56       15016 : }
      57             : 
      58             : //_____________________________________________________________________________
      59             : AliTRDCalOnlineGainTableROC::AliTRDCalOnlineGainTableROC(const AliTRDCalOnlineGainTableROC& other)
      60           0 :   :TObject(other)
      61           0 : {
      62             :   //
      63             :   // copy constructor
      64             :   //
      65             : 
      66           0 :   for (int i=0; i<128; i++) {
      67           0 :     if (other.GetGainTableMCM(i)) {
      68           0 :       fMCMGainTables[i] = new AliTRDCalOnlineGainTableMCM( *(other.GetGainTableMCM(i)) );
      69           0 :     } else {
      70           0 :       fMCMGainTables[i] = 0;
      71             :     }
      72             :   }
      73             : 
      74           0 : }
      75             : 
      76             : //_____________________________________________________________________________
      77             : AliTRDCalOnlineGainTableROC& AliTRDCalOnlineGainTableROC::operator=(const AliTRDCalOnlineGainTableROC& other)
      78             : {
      79             :   //
      80             :   // assignment operator
      81             :   //
      82             : 
      83           0 :   for (int i=0; i<128; i++) {
      84             : 
      85           0 :     if (fMCMGainTables[i]) {
      86           0 :       delete fMCMGainTables[i];
      87             :     }
      88             : 
      89           0 :     if (other.GetGainTableMCM(i)) {
      90           0 :       fMCMGainTables[i] = new AliTRDCalOnlineGainTableMCM( *(other.GetGainTableMCM(i)) );
      91           0 :     } else {
      92           0 :       fMCMGainTables[i] = 0;
      93             :     }
      94             :   }
      95             : 
      96           0 :   return *this;
      97             : 
      98           0 : }
      99             : 
     100             : //_____________________________________________________________________________
     101             : AliTRDCalOnlineGainTableROC::~AliTRDCalOnlineGainTableROC()
     102           0 : {
     103             :   //
     104             :   // destructor
     105             :   //
     106             : 
     107           0 :   for (int i=0; i<128; i++) {
     108           0 :     if (fMCMGainTables[i]) {
     109           0 :       delete fMCMGainTables[i];
     110             :     }
     111             :   }
     112             : 
     113           0 : }
     114             : 
     115             : //_____________________________________________________________________________
     116             : Float_t AliTRDCalOnlineGainTableROC::GetGainCorrectionFactor(Int_t row, Int_t col)
     117             : {
     118             :   //
     119             :   // chooses ROB/MCM/channel from row/col
     120             :   // returns the Gain Correction Factor of the given channel
     121             :   //
     122             : 
     123           0 :   AliTRDfeeParam * para = AliTRDfeeParam::Instance(); 
     124             : 
     125           0 :   Int_t rob = para->GetROBfromPad(row,col);
     126           0 :   Int_t mcm = para->GetMCMfromPad(row,col);
     127           0 :   Int_t channel =19-(col%18);
     128             : 
     129           0 :   AliTRDCalOnlineGainTableMCM* gtbl=GetGainTableMCM(rob,mcm);
     130             : 
     131           0 :   if (gtbl) {
     132           0 :     return gtbl->GetGainCorrectionFactor(channel);
     133             :   } else {
     134           0 :     return AliTRDCalOnlineGainTable::UnDef;
     135             :   }
     136             : 
     137           0 : }
     138             : 
     139             : //_____________________________________________________________________________
     140             : Short_t AliTRDCalOnlineGainTableROC::GetAdcdac(Int_t row, Int_t col)
     141             : {
     142             :   //
     143             :   // chooses ROB/MCM/channel from row/col
     144             :   // returns the ADC's reference voltage of the given MCM
     145             :   //
     146             : 
     147           0 :   AliTRDfeeParam * para = AliTRDfeeParam::Instance(); 
     148             : 
     149           0 :   Int_t rob = para->GetROBfromPad(row,col);
     150           0 :   Int_t mcm = para->GetMCMfromPad(row,col);
     151             : 
     152           0 :   AliTRDCalOnlineGainTableMCM* gtbl=GetGainTableMCM(rob,mcm);
     153             : 
     154           0 :   if (gtbl) {
     155           0 :     return gtbl->GetAdcdac();
     156             :   } else {
     157           0 :     return -999;
     158             :   }
     159             : 
     160           0 : }
     161             : 
     162             : //_____________________________________________________________________________
     163             : Float_t AliTRDCalOnlineGainTableROC::GetMCMGain(Int_t row, Int_t col)
     164             : {
     165             :   //
     166             :   // chooses ROB/MCM/channel from row/col
     167             :   // returns the Gain Factor which would lead to a Correction Factor of 1.0 within the given MCM
     168             :   //
     169             : 
     170           0 :   AliTRDfeeParam * para = AliTRDfeeParam::Instance(); 
     171             : 
     172           0 :   Int_t rob = para->GetROBfromPad(row,col);
     173           0 :   Int_t mcm = para->GetMCMfromPad(row,col);
     174             : 
     175           0 :   AliTRDCalOnlineGainTableMCM* gtbl=GetGainTableMCM(rob,mcm);
     176             : 
     177           0 :   if (gtbl) {
     178           0 :     return gtbl->GetMCMGain();
     179             :   } else {
     180           0 :     return AliTRDCalOnlineGainTable::UnDef;
     181             :   }
     182             : 
     183           0 : }
     184             : 
     185             : //_____________________________________________________________________________
     186             : Short_t AliTRDCalOnlineGainTableROC::GetFGAN(Int_t row, Int_t col)
     187             : {
     188             :   //
     189             :   // chooses ROB/MCM/channel from row/col
     190             :   // returns the Gain Correction Filter Factor of the given channel
     191             :   //
     192             : 
     193           0 :   AliTRDfeeParam * para = AliTRDfeeParam::Instance(); 
     194             : 
     195           0 :   Int_t rob = para->GetROBfromPad(row,col);
     196           0 :   Int_t mcm = para->GetMCMfromPad(row,col);
     197           0 :   Int_t channel =19-(col%18);
     198             : 
     199           0 :   AliTRDCalOnlineGainTableMCM* gtbl=GetGainTableMCM(rob,mcm);
     200             : 
     201           0 :   if (gtbl) {
     202           0 :     return gtbl->GetFGAN(channel);
     203             :   } else {
     204           0 :     return -999;
     205             :   }
     206             : 
     207           0 : }
     208             : 
     209             : //_____________________________________________________________________________
     210             : Short_t AliTRDCalOnlineGainTableROC::GetFGFN(Int_t row, Int_t col)
     211             : {
     212             :   //
     213             :   // chooses ROB/MCM/channel from row/col
     214             :   // returns the Gain Correction Filter Additive of the given channel
     215             :   //
     216             : 
     217           0 :   AliTRDfeeParam * para = AliTRDfeeParam::Instance(); 
     218             : 
     219           0 :   Int_t rob = para->GetROBfromPad(row,col);
     220           0 :   Int_t mcm = para->GetMCMfromPad(row,col);
     221           0 :   Int_t channel =19-(col%18);
     222             : 
     223           0 :   AliTRDCalOnlineGainTableMCM* gtbl=GetGainTableMCM(rob,mcm);
     224             : 
     225           0 :   if (gtbl) {
     226           0 :     return gtbl->GetFGFN(channel);
     227             :   } else {
     228           0 :     return -999;
     229             :   }
     230             : 
     231           0 : }  
     232             : 
     233             : //_____________________________________________________________________________
     234             : void AliTRDCalOnlineGainTableROC::AllocateGainTableMCM(Int_t rob, Int_t mcm)
     235             : {
     236             :   //
     237             :   // allocates a Gain Table for the given MCM
     238             :   //
     239             : 
     240           0 :   Int_t index = rob*16 + mcm;
     241             : 
     242           0 :   if (fMCMGainTables[index]) {
     243           0 :     delete fMCMGainTables[index];
     244             :   }
     245             : 
     246           0 :   fMCMGainTables[index] = new AliTRDCalOnlineGainTableMCM;
     247           0 : }
     248             : 

Generated by: LCOV version 1.11