LCOV - code coverage report
Current view: top level - EMCAL/EMCALbase - AliEMCALCalibData.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 47 108 43.5 %
Date: 2016-06-14 17:26:59 Functions: 14 22 63.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             : #include "AliEMCALCalibData.h"
      17             : 
      18             : /// \cond CLASSIMP
      19          42 : ClassImp(AliEMCALCalibData) ;
      20             : /// \endcond
      21             : 
      22             : ///
      23             : /// Default constructor
      24             : //____________________________________
      25             : AliEMCALCalibData::AliEMCALCalibData() : 
      26           6 : TNamed(), fADCchannelRef(0)
      27          15 : {
      28           3 :   Reset();
      29           6 : }
      30             : 
      31             : ///
      32             : /// Constructor
      33             : //____________________________________________________
      34             : AliEMCALCalibData::AliEMCALCalibData(const char* name) : 
      35           0 : TNamed(name,name),fADCchannelRef(0)
      36           0 : {
      37           0 :   Reset();
      38           0 : }
      39             : 
      40             : ///
      41             : /// Copy constructor
      42             : //____________________________________________________________________
      43             : AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) :
      44           0 : TNamed(calibda), fADCchannelRef(calibda.fADCchannelRef)
      45           0 : {
      46           0 :   SetName (calibda.GetName());
      47           0 :   SetTitle(calibda.GetName());
      48           0 :   Reset();
      49             :   
      50             :   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
      51             :   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
      52             :   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
      53             :   
      54           0 :   for(Int_t supermodule = 0; supermodule < nSMod; supermodule++)
      55             :   {    
      56             :     // Init all SM equally, even the channels known to not exist.
      57             :     
      58           0 :     for(Int_t column = 0; column<nCol; column++)
      59             :     {
      60           0 :       for(Int_t row = 0; row<nRow; row++)
      61             :       {
      62           0 :         SetADCchannel      (supermodule,column,row, calibda.GetADCchannel      (supermodule,column,row));
      63           0 :         SetADCchannelOnline(supermodule,column,row, calibda.GetADCchannelOnline(supermodule,column,row));
      64           0 :         SetADCchannelDecal (supermodule,column,row, calibda.GetADCchannelDecal (supermodule,column,row));
      65           0 :         SetADCpedestal     (supermodule,column,row, calibda.GetADCpedestal     (supermodule,column,row));
      66           0 :         SetTimeChannelDecal(supermodule,column,row, calibda.GetTimeChannelDecal(supermodule,column,row));
      67           0 :         for(Int_t bc = 0; bc < 4; bc++)
      68           0 :           SetTimeChannel(supermodule,column,row,bc,calibda.GetTimeChannel(supermodule,column,row,bc));
      69             :       } // col
      70             :     } // row
      71             :   } // SM
      72           0 : }
      73             : 
      74             : ///
      75             : /// Assignment operator
      76             : //________________________________________________________________________________
      77             : AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
      78             : {
      79           0 :   SetName (calibda.GetName());
      80           0 :   SetTitle(calibda.GetName());
      81           0 :   Reset();
      82             :   
      83           0 :   fADCchannelRef = calibda.GetADCchannelRef() ;
      84             :   
      85             :   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
      86             :   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
      87             :   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
      88             :   
      89           0 :   for(Int_t supermodule = 0; supermodule < nSMod; supermodule++)
      90             :   {
      91             :     // Init all SM equally, even the channels known to not exist.
      92             :     
      93           0 :     for(Int_t column = 0; column<nCol; column++)
      94             :     {
      95           0 :       for(Int_t row = 0; row<nRow; row++)
      96             :       {
      97           0 :         SetADCchannel      (supermodule,column,row, calibda.GetADCchannel      (supermodule,column,row));
      98           0 :         SetADCchannelOnline(supermodule,column,row, calibda.GetADCchannelOnline(supermodule,column,row));
      99           0 :         SetADCchannelDecal (supermodule,column,row, calibda.GetADCchannelDecal (supermodule,column,row));
     100           0 :         SetADCpedestal     (supermodule,column,row, calibda.GetADCpedestal     (supermodule,column,row));
     101           0 :         SetTimeChannelDecal(supermodule,column,row, calibda.GetTimeChannelDecal(supermodule,column,row));
     102           0 :         for(Int_t bc = 0; bc < 4; bc++)
     103           0 :           SetTimeChannel(supermodule,column,row,bc,calibda.GetTimeChannel(supermodule,column,row,bc));
     104             :       } // col
     105             :     } // row
     106             :   } // col
     107             :   
     108           0 :   return *this;
     109             : }
     110             : 
     111             : ///
     112             : /// Set all pedestals to 0 and all ADC channels widths to 1
     113             : //_____________________________
     114             : void AliEMCALCalibData::Reset()
     115             : {  
     116           6 :   fADCchannelRef = 0.0162;      
     117             :   
     118             :   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; 
     119             :   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
     120             :   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
     121             : 
     122         138 :    for (Int_t supermodule=0; supermodule<nSMod; supermodule++)
     123             :   {
     124             :     //Init all SM equally, even the channels known to not exist.
     125             : 
     126        6468 :     for (Int_t column=0; column < nCol; column++)
     127             :     {
     128      158400 :       for (Int_t row = 0; row < nRow; row++)
     129             :       {
     130       76032 :         SetADCchannel      (supermodule,column,row, fADCchannelRef);
     131       76032 :         SetADCchannelOnline(supermodule,column,row, fADCchannelRef);
     132       76032 :         SetADCchannelDecal (supermodule,column,row, 1);
     133       76032 :         SetADCpedestal     (supermodule,column,row, 0);
     134       76032 :         SetTimeChannelDecal(supermodule,column,row, 0);
     135      760320 :         for(Int_t bc = 0; bc < 4; bc++)
     136      304128 :           SetTimeChannel(supermodule,column,row, bc, 0);
     137             : 
     138             :       }
     139             :     }
     140             :   }     
     141           3 : }
     142             : 
     143             : ///
     144             : /// Print tables of pedestals and ADC channels widths
     145             : /// options are: "gain", "ped", "online", "decal", "time", "timdecal", "all"
     146             : //____________________________________________________
     147             : void  AliEMCALCalibData::Print(Option_t *option) const
     148             : {  
     149             :   Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules;
     150             :   Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
     151             :   Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
     152             :   
     153           0 :   for (Int_t supermodule = 0; supermodule < nSMod; supermodule++)
     154             :   {
     155             :     //Init all SM equally, even the channels known to not exist.
     156             : 
     157           0 :     printf("============== Supermodule %d\n",supermodule+1);
     158           0 :     for (Int_t column = 0; column < nCol; column++)
     159             :     {
     160           0 :       for (Int_t row = 0; row < nRow; row++)
     161             :       {
     162           0 :         printf("[col %d,row %d] ",column, row);
     163           0 :         if (strstr(option,"gain") || strstr(option,"all"))
     164           0 :           printf("calib=%2.4f ",GetADCchannel(supermodule,column,row));
     165             :         
     166           0 :         if (strstr(option,"online") || strstr(option,"all"))
     167           0 :           printf("calib0=%2.4f ", GetADCchannelOnline(supermodule,column,row));
     168             :         
     169           0 :         if (strstr(option,"decal") || strstr(option,"all"))
     170           0 :           printf("calibDecal=%2.4f ",GetADCchannelDecal(supermodule,column,row));
     171             :         
     172           0 :         if (strstr(option,"ped") || strstr(option,"all"))
     173           0 :           printf("ped=%2.4f ", GetADCpedestal(supermodule,column,row));
     174             :         
     175           0 :         if (strstr(option,"time") || strstr(option,"all"))
     176           0 :           printf("time::bc0 =%2.4f, bc1=%2.4f, bc2=%2.4f, bc3=%2.4f ",
     177           0 :                  GetTimeChannel(supermodule,column,row,0), GetTimeChannel(supermodule,column,row,1), GetTimeChannel(supermodule,column,row,2), GetTimeChannel(supermodule,column,row,3));
     178             :         
     179           0 :         if (strstr(option,"timdecal") || strstr(option,"all"))
     180           0 :           printf("timeDecal=%2.4f ", GetTimeChannelDecal(supermodule,column,row));
     181             :         
     182           0 :          if (strstr(option,"all") || (row%4==3) ) printf("\n");
     183             :       }
     184             :     }
     185             :   }
     186           0 : }
     187             : 
     188             : ///
     189             : /// Set ADC channel witdth values
     190             : /// All indexes start from 0!
     191             : /// Supermodule, column,raw should follow the ALICE convention:
     192             : /// supermodule 0:11, column 0:47, row 0:23
     193             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     194             : //________________________________________________________________________________________
     195             : Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
     196             : {  
     197      191938 :   if(supermodule < 12) return fADCchannel    [supermodule]   [column][row];
     198       21512 :   else                 return fADCchannelDCAL[supermodule-12][column][row];
     199       71150 : }
     200             : 
     201             : ///
     202             : /// Set ADC channel witdth values, first online calibration parameter
     203             : /// All indexes start from 0!
     204             : /// Supermodule, column,raw should follow the ALICE convention:
     205             : /// supermodule 0:11, column 0:47, row 0:23
     206             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     207             : //______________________________________________________________________________________________
     208             : Float_t AliEMCALCalibData::GetADCchannelOnline(Int_t supermodule, Int_t column, Int_t row) const
     209             : {  
     210         798 :   if(supermodule < 12) return fADCchannelOnline    [supermodule]   [column][row];
     211           6 :   else                 return fADCchannelOnlineDCAL[supermodule-12][column][row];
     212         268 : }
     213             : 
     214             : ///
     215             : /// Set ADC channel decalibration witdth values
     216             : /// All indexes start from 0!
     217             : /// Supermodule, column,raw should follow the ALICE convention:
     218             : /// supermodule 0:11, column 0:47, row 0:23
     219             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     220             : //_____________________________________________________________________________________________
     221             : Float_t AliEMCALCalibData::GetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row) const
     222             : {
     223      190464 :   if(supermodule < 12) return fADCchannelDecal    [supermodule]   [column][row];
     224       21504 :   else                 return fADCchannelDecalDCAL[supermodule-12][column][row];
     225       70656 : }
     226             : 
     227             : ///
     228             : /// Get ADC pedestal values
     229             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     230             : //_________________________________________________________________________________________
     231             : Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
     232             : {  
     233      191140 :   if(supermodule < 12) return fADCpedestal    [supermodule]   [column][row];
     234       21506 :   else                 return fADCpedestalDCAL[supermodule-12][column][row];
     235       70882 : }
     236             : 
     237             : ///
     238             : /// Set ADC channel width values
     239             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     240             : //______________________________________________________________________________________________
     241             : void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
     242             : {   
     243      193536 :   if(supermodule < 12) fADCchannel    [supermodule]   [column][row] = value;
     244       34560 :   else                 fADCchannelDCAL[supermodule-12][column][row] = value;
     245       76032 : }
     246             : 
     247             : ///
     248             : /// Set ADC channel online width values
     249             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     250             : //____________________________________________________________________________________________________
     251             : void AliEMCALCalibData::SetADCchannelOnline(Int_t supermodule, Int_t column, Int_t row, Float_t value)
     252             : {  
     253      193536 :   if(supermodule < 12) fADCchannelOnline    [supermodule]   [column][row] = value;
     254       34560 :   else                 fADCchannelOnlineDCAL[supermodule-12][column][row] = value;
     255       76032 : }
     256             : 
     257             : ///
     258             : /// Set ADC channel width values, decalibration
     259             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     260             : //___________________________________________________________________________________________________
     261             : void AliEMCALCalibData::SetADCchannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
     262             : { 
     263      193536 :   if(supermodule < 12) fADCchannelDecal    [supermodule]   [column][row] = value;
     264       34560 :   else                 fADCchannelDecalDCAL[supermodule-12][column][row] = value;
     265       76032 : }
     266             : 
     267             : ///
     268             : /// Set ADC pedestal values
     269             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     270             : //_______________________________________________________________________________________________
     271             : void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
     272             : {  
     273      193536 :   if(supermodule < 12) fADCpedestal    [supermodule]   [column][row] = value;
     274       34560 :   else                 fADCpedestalDCAL[supermodule-12][column][row] = value;
     275       76032 : }
     276             : 
     277             : //*** Do not use the following methods use instead AliEMCALCalibTime:
     278             : 
     279             : ///
     280             : /// Set channel time values
     281             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     282             : //___________________________________________________________________________________________________
     283             : Float_t AliEMCALCalibData::GetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc) const
     284             : {  
     285           0 :   if(supermodule < 12) return fTimeChannel    [supermodule]   [column][row][bc];
     286           0 :   else                 return fTimeChannelDCAL[supermodule-12][column][row][bc];
     287           0 : }
     288             : 
     289             : ///
     290             : /// Set channel time decalibrated values
     291             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     292             : //______________________________________________________________________________________________
     293             : Float_t AliEMCALCalibData::GetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row) const
     294             : {
     295           0 :   if(supermodule < 12) return fTimeChannelDecal    [supermodule]   [column][row];
     296           0 :   else                 return fTimeChannelDecalDCAL[supermodule-12][column][row];
     297           0 : }
     298             : 
     299             : ///
     300             : /// Set time per channel and bunch crossing values
     301             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     302             : //_________________________________________________________________________________________________________
     303             : void AliEMCALCalibData::SetTimeChannel(Int_t supermodule, Int_t column, Int_t row, Int_t bc, Float_t value)
     304             : {  
     305      774144 :   if(supermodule < 12) fTimeChannel    [supermodule]   [column][row][bc] = value;
     306      138240 :   else                 fTimeChannelDCAL[supermodule-12][column][row][bc] = value;
     307      304128 : }
     308             : 
     309             : ///
     310             : /// Set decalibrated time per channel values
     311             : /// DCal has its own array, starting from SM 12, index 0, same col-row size
     312             : //____________________________________________________________________________________________________
     313             : void AliEMCALCalibData::SetTimeChannelDecal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
     314             : {
     315      193536 :   if(supermodule < 12) fTimeChannelDecal    [supermodule]   [column][row] = value;
     316       34560 :   else                 fTimeChannelDecalDCAL[supermodule-12][column][row] = value;
     317       76032 : }
     318             : 
     319             : 
     320             : 

Generated by: LCOV version 1.11