Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:04

0001 //Namespaces for Phase1 and Phase2
0002 #ifndef DataFormats_EcalDigi_EcalConstants_h
0003 #define DataFormats_EcalDigi_EcalConstants_h
0004 
0005 #include "FWCore/Utilities/interface/HostDeviceConstant.h"
0006 
0007 // constants used to encode difference between corrected cc time and noncorrected cc time
0008 // into a uInt8 value to be stored in the 8 bits set aside for the jitter error ( previously unused )
0009 namespace ecalcctiming {
0010   inline constexpr const float clockToNS = 25.0;          // Convert clock units to ns
0011   inline constexpr const float nonCorrectedSlope = 1.2;   // estimates nonCorreted time from corrected time
0012   inline constexpr const float encodingOffest = 0.32;     // offsets difference in time using clock units
0013   inline constexpr const float encodingValue = 398.4375;  // encodes time difference into 0 - 255 int range
0014 }  // namespace ecalcctiming
0015 
0016 // The HOST_DEVICE_CONSTANTs can not reside in the classes directly, which is
0017 // why they are defined in a namespace and constant pointers to them are used in the classes
0018 namespace ecalph2 {
0019   constexpr unsigned int NGAINS = 2;                     // Number of CATIA gains
0020   HOST_DEVICE_CONSTANT float gains[NGAINS] = {10., 1.};  // CATIA gain values
0021 }  // namespace ecalph2
0022 
0023 namespace ecalph1 {
0024   constexpr unsigned int NGAINS = 4;                             // Number of MGPA gains including a zero gain that
0025                                                                  // could be encoded in the gain id mask
0026   HOST_DEVICE_CONSTANT float gains[NGAINS] = {0., 12., 6., 1.};  // MGPA gain values including a zero gain
0027 }  // namespace ecalph1
0028 
0029 class ecalPh2 {
0030 public:
0031   static constexpr double Samp_Period = 6.25;               // ADC sampling period in ns
0032   static constexpr unsigned int NGAINS = ecalph2::NGAINS;   // Number of CATIA gains
0033   static constexpr const float* gains = ecalph2::gains;     // CATIA gain values
0034   static constexpr unsigned int gainId1 = 1;                // Position of gain 1 in gains array
0035   static constexpr unsigned int gainId10 = 0;               // Position of gain 10 in gains array
0036   static constexpr unsigned int sampleSize = 16;            // Number of samples per event
0037   static constexpr unsigned int NBITS = 12;                 // Number of available bits
0038   static constexpr unsigned int MAXADC = (1 << NBITS) - 1;  // 2^NBITS - 1,  ADC max range
0039   static constexpr unsigned int kEBChannels = 61200;        // Number of channels in the barrel
0040   static constexpr double maxEneEB = 2000.;                 // Max attainable energy in the barrel in GeV
0041                                                             // ~(MAXADC * 10(gain) * 0.05 GeV(LSB at gain 10))
0042   static constexpr unsigned int kNOffsets = 2000;           // Number of time offsets generated for APD pulse shape
0043                                                             // simulation and reused for every kNOffsets^th channel
0044   static constexpr unsigned int kAdcMask = 0xFFF;           // ADC sample mask for unpacking
0045   static constexpr unsigned int kGainIdMask = 0x1;          // Gain id mask for unpacking
0046 };
0047 
0048 class ecalPh1 {
0049 public:
0050   static constexpr double Samp_Period = 25.;               // ADC sampling period in ns
0051   static constexpr unsigned int NGAINS = ecalph1::NGAINS;  // Number of MGPA gains including a zero gain
0052   static constexpr const float* gains = ecalph1::gains;    // MGPA gain values including a zero gain
0053   static constexpr unsigned int sampleSize = 10;           // Number of samples per event
0054   static constexpr unsigned int NBITS = 12;                // Number of available bits
0055   static constexpr unsigned int kNOffsets = 2000;          // Number of time offsets generated for APD pulse shape
0056                                                            // simulation and reused for every kNOffsets^th channel
0057   static constexpr unsigned int kAdcMask = 0xFFF;          // ADC sample mask for unpacking
0058   static constexpr unsigned int kGainIdMask = 0x3;         // Gain id mask for unpacking
0059 };
0060 #endif