]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALCalibData.cxx
correct name for the mapping file
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibData.cxx
index 7c2fcecbd0307289e5924b81c7c68584133d308d..401fa56c3ea86912d4f6836908cadc5776bdcd61 100644 (file)
 
 /* $Id$ */
 
+//_________________________________________________________________________
+///*-- Author: Yves Schutz (SUBATECH)
+//           : Aleksei Pavlinov (WSU); Jun 30, 2006 - ALICE numbering scheme
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
 // class for EMCAL calibration                                               //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
+#include <TMath.h>
+
 #include "AliEMCALCalibData.h"
 
 ClassImp(AliEMCALCalibData)
@@ -52,13 +57,13 @@ AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) :
   SetTitle(calibda.GetName());
   Reset();
 
-  Int_t nSMod = 12;
-  Int_t nCol  = 48;
-  Int_t nRow  = 24;
-  Int_t nRow2 = 12; //Modules 11 and 12 are half modules
+  Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
+  Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
+  Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
+  Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows;    //12 - Modules 11 and 12 are half modules
 
   for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
-    if(supermodule > 10)
+    if(supermodule >= 10)
       nRow = nRow2;
     for(Int_t column=0; column<nCol; column++) {
       for(Int_t row=0; row<nRow; row++) {
@@ -80,13 +85,13 @@ AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibd
   SetTitle(calibda.GetName());
   Reset();
 
-  Int_t nSMod = 12;
-  Int_t nCol  = 48;
-  Int_t nRow  = 24;
-  Int_t nRow2 = 12; //Modules 11 and 12 are half modules
+  Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
+  Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
+  Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
+  Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2;  //12 - Modules 11 and 12 are half modules
 
   for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
-    if(supermodule > 10)
+    if(supermodule >= 10)
       nRow = nRow2;
     for(Int_t column=0; column<nCol; column++) {
       for(Int_t row=0; row<nRow; row++) {
@@ -110,8 +115,22 @@ AliEMCALCalibData::~AliEMCALCalibData()
 void AliEMCALCalibData::Reset()
 {
   // Set all pedestals to 0 and all ADC channels widths to 1
-  memset(fADCchannel ,1,12*48*24*sizeof(Float_t));
-  memset(fADCpedestal,0,12*48*24*sizeof(Float_t));
+  //memset(fADCchannel ,1,12*48*24*sizeof(Float_t));
+  //memset(fADCpedestal,0,12*48*24*sizeof(Float_t));
+       Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
+       Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
+       Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
+       Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2;  //12 - Modules 11 and 12 are half modules
+       for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
+                if(supermodule >= 10)
+                       nRow = nRow2;
+                for (Int_t column=0; column<nCol; column++){
+                               for (Int_t row=0; row<nRow; row++){
+                                         fADCpedestal[supermodule][column][row]=0.;
+                                         fADCchannel [supermodule][column][row]=1.;
+                               }
+               }
+       } 
 }
 
 //________________________________________________________________
@@ -119,14 +138,14 @@ void  AliEMCALCalibData::Print(Option_t *option) const
 {
   // Print tables of pedestals and ADC channels widths
 
-  Int_t nSMod = 12;
-  Int_t nCol  = 48;
-  Int_t nRow  = 24;
-  Int_t nRow2 = 12; //Modules 11 and 12 are half modules
+  Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
+  Int_t nCol  = AliEMCALGeoParams::fgkEMCALCols;    //48
+  Int_t nRow  = AliEMCALGeoParams::fgkEMCALRows;    //24
+  Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2;  //12 - Modules 11 and 12 are half modules
   if (strstr(option,"ped")) {
     printf("\n ----    Pedestal values ----\n\n");
     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
-      if(supermodule > 10)
+      if(supermodule >= 10)
        nRow = nRow2;
       printf("============== Supermodule %d\n",supermodule+1);
       for (Int_t column=0; column<nCol; column++){
@@ -142,7 +161,7 @@ void  AliEMCALCalibData::Print(Option_t *option) const
   if (strstr(option,"gain")) {
     printf("\n ----    ADC channel values      ----\n\n");
     for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
-      if(supermodule > 10) 
+      if(supermodule >= 10) 
        nRow = nRow2;
       printf("============== Supermodule %d\n",supermodule+1);
       for (Int_t column=0; column<nCol; column++){
@@ -159,29 +178,30 @@ void  AliEMCALCalibData::Print(Option_t *option) const
 Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
 {
   // Set ADC channel witdth values
-  //supermodule, column,raw should follow the internal EMCAL convention:
-  //supermodule 1:12, column 1:48, row 1:24
+  // All indexes start from 0!
+  // Supermodule, column,raw should follow the ALICE convention:
+  // supermodule 0:11, column 0:47, row 0:23
 
-  return fADCchannel[supermodule-1][column-1][row-1];
+  return fADCchannel[supermodule][column][row];
 }
 
 //________________________________________________________________
 Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
 {
   // Get ADC pedestal values
- return fADCpedestal[supermodule-1][column-1][row-1];
+ return fADCpedestal[supermodule][column][row];
 }
 
 //________________________________________________________________
 void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
 { 
   // Set ADC channel width values
-  fADCchannel[supermodule-1][column-1][row-1] = value;
+  fADCchannel[supermodule][column][row] = value;
 }
 
 //________________________________________________________________
 void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
 {
   // Set ADC pedestal values
-  fADCpedestal[supermodule-1][column-1][row-1] = value;
+  fADCpedestal[supermodule][column][row] = value;
 }