ROOT logo
#ifndef ALIEMCALGEOPARAMS_H
#define ALIEMCALGEOPARAMS_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

//////////////////////////////////////////////////////////
// class for holding various parameters; 
//
// Author: David Silvermyr (ORNL)
//
//////////////////////////////////////////////////////////

class AliEMCALGeoParams
{
public:

  // general geometry info
  static const int fgkEMCALModules     = 22;   // number of modules, 12 for EMCal + 8 for DCAL
  static const int fgkEMCALRows        = 24;   // number of rows per module for EMCAL
  static const int fgkEMCALCols        = 48;   // number of columns per module for EMCAL

  static const int fgkEMCALLEDRefs     = 24;   // number of LEDs (reference/monitors) per module for EMCAL; one per StripModule
  static const int fgkEMCALTempSensors = 8;    // number Temperature sensors per module for EMCAL

  Int_t GetStripModule(Int_t iSM, Int_t iCol) const
    // Strip 0 is the one closest to the FEE crates; different for A (iColumn/2) and C sides
    { return ( (iSM%2==0) ? iCol/2 : AliEMCALGeoParams::fgkEMCALLEDRefs - 1 - iCol/2 ); }

  // also a few readout related variables:
  static const int fgkLastAltroDDL     = 43;   // 0..23 (i.e. 24) for EMCAL; 24..39 (i.e. 16) allocated for DCAL
  static const int fgkSampleMax        = 1023; // highest possible sample value (10-bit = 0x3ff)
  static const int fgkOverflowCut      = 950;  // saturation starts around here; also exist as private constant in AliEMCALRawUtils, should probably be replaced
  static const int fgkSampleMin        = 0;    // lowest possible sample value 

  // TRU numbers
  static const int fgkEMCALTRUsPerSM   = 3;    // number of TRU's in a SuperModule
  static const int fgkEMCAL2x2PerTRU   = 96;   // number of 2x2's in a TRU
  static const int fgkEMCALTRURows     = 4;    // number of TRU rows
  static const int fgkEMCALTRUCols     = 24;   // number of TRY cols

  //STU numbers
  static const int fgkEMCALSTUCols     = 48;   // STU columns
  static const int fgkEMCALSTURows     = 64;   // STU rows
  
  // RAW/AliCaloAltroMapping provides the correspondence information between
  // an electronics HWAddress (Branch<<1 | FEC<<7 | ALTRO<<4 | Channel) 
  // for the RCUs and which tower (Column and Row) that corresponds to. 
  // For the cases when one doesn't have a Raw stream to decode the HW address
  // into the other FEE indices, we provide the needed simple methods here 
  // with arguments (within an RCU)
  Int_t GetHWAddress(Int_t iBranch, Int_t iFEC, Int_t iALTRO, Int_t iChannel) const
  { return ( (iBranch<<11) | (iFEC<<7) | (iALTRO<<4) | iChannel ); } // 
  // and for converting back to the individual indices
  Int_t GetBranch(Int_t iHW)  const { return ( (iHW>>11) & 0x1 ) ; } // 
  Int_t GetFEC(Int_t iHW)     const { return ( (iHW>>7) & 0xf )  ; } // 
  Int_t GetAltro(Int_t iHW)   const { return ( (iHW>>4) & 0x7 )  ; } // 
  Int_t GetChannel(Int_t iHW) const { return ( iHW & 0xf )       ; } // 

  // We can also encode a very similar CSP address
  Int_t GetCSPAddress(Int_t iBranch, Int_t iFEC, Int_t iCSP) const
  { return ( (iBranch<<11) | (iFEC<<7) | iCSP ); }; // 
  // and for converting back to the individual indices
  // Branch and FEC methods would just be the same as above
  Int_t GetCSPFromAddress(Int_t i) const { return ( i & 0x1f )   ; } // 

  /* // Below is some placeholder info that can later be added
     // in AliEMCALGeometry, together with the Get methods just above 

  // But which CSP (0..31) corresponds to which ALTRO and Channel is not 
  // given anywhere (CSPs are used for APD biases etc).
  // So, we add a conversion method for that here also.
  // The order that the CSPs appear in the data is a bit funky so I include
  // a mapping array instead of some complicated function
  static const int fgkNCSP = 32;
  static const int fgkCspOrder[32] =
    { // just from ALTRO mapping of chips/channels to CSP
      11,  27,  10,  26,  24,   8,  25,   9, // ALTRO 0
      3,  19,   2,  18,  16,   0,  17,   1, // ALTRO 2
      4,  20,   5,  21,  23,   7,  22,   6, // ALTRO 3
      12,  28,  13,  29,  31,  15,  30,  14 // ALTRO 4
    };
  // This method is not used for reconstruction or so, but just for cross-
  // checks with the DCS for the APD biases. 
  int GetCSP(int iALTRO, int iChannel) const 
  { 
    int id = iChannel/2; // 2 channels per tower (low and high gain)
    int ichip = iALTRO;
    if (ichip>=2) { ichip--; } // there is no ALTRO 1; (0,2,3,4 -> 0,1,2,3)
    id += ichip*8; // 8 CSPs per ALTRO
    //return fgkCspOrder[id];
    return id;
  }

  */
  
};

#endif
 AliEMCALGeoParams.h:1
 AliEMCALGeoParams.h:2
 AliEMCALGeoParams.h:3
 AliEMCALGeoParams.h:4
 AliEMCALGeoParams.h:5
 AliEMCALGeoParams.h:6
 AliEMCALGeoParams.h:7
 AliEMCALGeoParams.h:8
 AliEMCALGeoParams.h:9
 AliEMCALGeoParams.h:10
 AliEMCALGeoParams.h:11
 AliEMCALGeoParams.h:12
 AliEMCALGeoParams.h:13
 AliEMCALGeoParams.h:14
 AliEMCALGeoParams.h:15
 AliEMCALGeoParams.h:16
 AliEMCALGeoParams.h:17
 AliEMCALGeoParams.h:18
 AliEMCALGeoParams.h:19
 AliEMCALGeoParams.h:20
 AliEMCALGeoParams.h:21
 AliEMCALGeoParams.h:22
 AliEMCALGeoParams.h:23
 AliEMCALGeoParams.h:24
 AliEMCALGeoParams.h:25
 AliEMCALGeoParams.h:26
 AliEMCALGeoParams.h:27
 AliEMCALGeoParams.h:28
 AliEMCALGeoParams.h:29
 AliEMCALGeoParams.h:30
 AliEMCALGeoParams.h:31
 AliEMCALGeoParams.h:32
 AliEMCALGeoParams.h:33
 AliEMCALGeoParams.h:34
 AliEMCALGeoParams.h:35
 AliEMCALGeoParams.h:36
 AliEMCALGeoParams.h:37
 AliEMCALGeoParams.h:38
 AliEMCALGeoParams.h:39
 AliEMCALGeoParams.h:40
 AliEMCALGeoParams.h:41
 AliEMCALGeoParams.h:42
 AliEMCALGeoParams.h:43
 AliEMCALGeoParams.h:44
 AliEMCALGeoParams.h:45
 AliEMCALGeoParams.h:46
 AliEMCALGeoParams.h:47
 AliEMCALGeoParams.h:48
 AliEMCALGeoParams.h:49
 AliEMCALGeoParams.h:50
 AliEMCALGeoParams.h:51
 AliEMCALGeoParams.h:52
 AliEMCALGeoParams.h:53
 AliEMCALGeoParams.h:54
 AliEMCALGeoParams.h:55
 AliEMCALGeoParams.h:56
 AliEMCALGeoParams.h:57
 AliEMCALGeoParams.h:58
 AliEMCALGeoParams.h:59
 AliEMCALGeoParams.h:60
 AliEMCALGeoParams.h:61
 AliEMCALGeoParams.h:62
 AliEMCALGeoParams.h:63
 AliEMCALGeoParams.h:64
 AliEMCALGeoParams.h:65
 AliEMCALGeoParams.h:66
 AliEMCALGeoParams.h:67
 AliEMCALGeoParams.h:68
 AliEMCALGeoParams.h:69
 AliEMCALGeoParams.h:70
 AliEMCALGeoParams.h:71
 AliEMCALGeoParams.h:72
 AliEMCALGeoParams.h:73
 AliEMCALGeoParams.h:74
 AliEMCALGeoParams.h:75
 AliEMCALGeoParams.h:76
 AliEMCALGeoParams.h:77
 AliEMCALGeoParams.h:78
 AliEMCALGeoParams.h:79
 AliEMCALGeoParams.h:80
 AliEMCALGeoParams.h:81
 AliEMCALGeoParams.h:82
 AliEMCALGeoParams.h:83
 AliEMCALGeoParams.h:84
 AliEMCALGeoParams.h:85
 AliEMCALGeoParams.h:86
 AliEMCALGeoParams.h:87
 AliEMCALGeoParams.h:88
 AliEMCALGeoParams.h:89
 AliEMCALGeoParams.h:90
 AliEMCALGeoParams.h:91
 AliEMCALGeoParams.h:92
 AliEMCALGeoParams.h:93
 AliEMCALGeoParams.h:94
 AliEMCALGeoParams.h:95
 AliEMCALGeoParams.h:96
 AliEMCALGeoParams.h:97
 AliEMCALGeoParams.h:98