CMS 3D CMS Logo

Namespaces | Classes | Typedefs | Functions | Variables
mtd_digitizer Namespace Reference

Namespaces

 MTDHelpers
 

Classes

struct  MTDCellId
 
struct  MTDCellInfo
 
class  MTDDigitizer
 

Typedefs

typedef float MTDSimData_t
 
typedef std::array< MTDSimData_t, nSamplesMTDSimHitData
 
typedef std::unordered_map< MTDCellId, MTDCellInfoMTDSimHitDataAccumulator
 

Functions

void loadSimHitAccumulator (MTDSimHitDataAccumulator &simData, const PMTDSimAccumulator &simAccumulator, const float minCharge, const float maxCharge)
 
void saveSimHitAccumulator (PMTDSimAccumulator &simResult, const MTDSimHitDataAccumulator &simData, const float minCharge, const float maxCharge)
 

Variables

constexpr int kInTimeBX = 9
 
constexpr int kNumberOfBX = 15
 
constexpr size_t nSamples = 15
 
constexpr float PREMIX_MAX_TOF = 25.0f
 

Typedef Documentation

◆ MTDSimData_t

Definition at line 13 of file MTDDigitizerTypes.h.

◆ MTDSimHitData

Definition at line 15 of file MTDDigitizerTypes.h.

◆ MTDSimHitDataAccumulator

Definition at line 39 of file MTDDigitizerTypes.h.

Function Documentation

◆ loadSimHitAccumulator()

void mtd_digitizer::loadSimHitAccumulator ( MTDSimHitDataAccumulator simData,
const PMTDSimAccumulator simAccumulator,
const float  minCharge,
const float  maxCharge 
)
inline

Definition at line 93 of file MTDDigitizer.h.

96  {
97  const float minPackChargeLog = minCharge > 0.f ? std::log(minCharge) : -2;
98  const float maxPackChargeLog = std::log(maxCharge);
99  constexpr uint16_t base = PMTDSimAccumulator::Data::dataMask;
100 
101  for (const auto& detIdIndexHitInfo : simAccumulator) {
102  auto foo = simData.emplace(
103  MTDCellId(detIdIndexHitInfo.detId(), detIdIndexHitInfo.row(), detIdIndexHitInfo.column()), MTDCellInfo());
104  auto simIt = foo.first;
105  auto& hit_info = simIt->second.hit_info;
106 
107  size_t iEn = detIdIndexHitInfo.energyIndex();
108  size_t iSample = detIdIndexHitInfo.sampleIndex();
109 
111  throw cms::Exception("MTDDigitixer::loadSimHitAccumulator")
112  << "Index out of range: iEn = " << iEn << " iSample = " << iSample << std::endl;
113 
114  float value;
115  if (iEn == 1 || iEn == 3) {
116  value = static_cast<float>(detIdIndexHitInfo.data()) / base * PREMIX_MAX_TOF;
117  } else {
118  value = logintpack::unpack16log(detIdIndexHitInfo.data(), minPackChargeLog, maxPackChargeLog, base);
119  }
120 
121  if (iEn == 0 || iEn == 2) {
122  hit_info[iEn][iSample] += value;
123  } else if (hit_info[iEn][iSample] == 0 || value < hit_info[iEn][iSample]) {
124  // For iEn==1 the digitizers just set the TOF of the first SimHit
125  hit_info[iEn][iSample] = value;
126  }
127  }
128  }

References newFWLiteAna::base, PMTDSimAccumulator::Data::dataMask, PMTDSimAccumulator::Data::energyMask, Exception, dqm-mbProfile::log, PREMIX_MAX_TOF, PMTDSimAccumulator::Data::sampleMask, logintpack::unpack16log(), and relativeConstraints::value.

Referenced by mtd_digitizer::MTDDigitizer< Traits >::accumulate().

◆ saveSimHitAccumulator()

void mtd_digitizer::saveSimHitAccumulator ( PMTDSimAccumulator simResult,
const MTDSimHitDataAccumulator simData,
const float  minCharge,
const float  maxCharge 
)
inline

Definition at line 57 of file MTDDigitizer.h.

60  {
61  constexpr auto nEnergies = std::tuple_size<decltype(MTDCellInfo().hit_info)>::value;
62  static_assert(nEnergies == PMTDSimAccumulator::Data::energyMask + 1,
63  "PMTDSimAccumulator bit pattern needs to be updated");
65  "PMTDSimAccumulator bit pattern needs to be updated");
66 
67  const float minPackChargeLog = minCharge > 0.f ? std::log(minCharge) : -2;
68  const float maxPackChargeLog = std::log(maxCharge);
69  constexpr uint16_t base = PMTDSimAccumulator::Data::dataMask;
70 
71  simResult.reserve(simData.size());
72  // mimicking the digitization
73  for (const auto& elem : simData) {
74  // store only non-zero
75  for (size_t iEn = 0; iEn < nEnergies; ++iEn) {
76  const auto& samples = elem.second.hit_info[iEn];
77  for (size_t iSample = 0; iSample < nSamples; ++iSample) {
78  if (samples[iSample] > minCharge) {
79  unsigned short packed;
80  if (iEn == 1 || iEn == 3) {
81  // assuming linear range for tof of 0..25
82  packed = samples[iSample] / PREMIX_MAX_TOF * base;
83  } else {
84  packed = logintpack::pack16log(samples[iSample], minPackChargeLog, maxPackChargeLog, base);
85  }
86  simResult.emplace_back(elem.first.detid_, elem.first.row_, elem.first.column_, iEn, iSample, packed);
87  }
88  }
89  }
90  }
91  }

References newFWLiteAna::base, PMTDSimAccumulator::Data::dataMask, PMTDSimAccumulator::emplace_back(), PMTDSimAccumulator::Data::energyMask, dqm-mbProfile::log, nSamples, logintpack::pack16log(), PREMIX_MAX_TOF, PMTDSimAccumulator::reserve(), PMTDSimAccumulator::Data::sampleMask, EgammaValidation_cff::samples, and relativeConstraints::value.

Referenced by mtd_digitizer::MTDDigitizer< Traits >::finalizeEvent().

Variable Documentation

◆ kInTimeBX

constexpr int mtd_digitizer::kInTimeBX = 9
constexpr

Definition at line 42 of file MTDDigitizerTypes.h.

Referenced by BTLDeviceSim::getHitsResponse(), and BTLElectronicsSim::run().

◆ kNumberOfBX

constexpr int mtd_digitizer::kNumberOfBX = 15
constexpr

Definition at line 41 of file MTDDigitizerTypes.h.

Referenced by BTLDeviceSim::getHitsResponse().

◆ nSamples

constexpr size_t mtd_digitizer::nSamples = 15
constexpr

Definition at line 11 of file MTDDigitizerTypes.h.

Referenced by saveSimHitAccumulator().

◆ PREMIX_MAX_TOF

constexpr float mtd_digitizer::PREMIX_MAX_TOF = 25.0f
constexpr

Definition at line 24 of file MTDDigitizerTypes.h.

Referenced by loadSimHitAccumulator(), and saveSimHitAccumulator().

logintpack::pack16log
int16_t pack16log(double x, double lmin, double lmax, uint16_t base=32768)
Definition: liblogintpack.h:27
PresampleTask_cfi.nSamples
nSamples
Definition: PresampleTask_cfi.py:7
EgammaValidation_cff.samples
samples
Definition: EgammaValidation_cff.py:19
PMTDSimAccumulator::reserve
void reserve(size_t size)
Definition: PMTDSimAccumulator.h:52
logintpack::unpack16log
double unpack16log(int16_t i, double lmin, double lmax, uint16_t base=32768)
Definition: liblogintpack.h:62
mtd_digitizer::PREMIX_MAX_TOF
constexpr float PREMIX_MAX_TOF
Definition: MTDDigitizerTypes.h:24
value
Definition: value.py:1
PMTDSimAccumulator::Data::dataMask
constexpr static unsigned dataMask
Definition: PMTDSimAccumulator.h:35
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:246
PMTDSimAccumulator::Data::energyMask
constexpr static unsigned energyMask
Definition: PMTDSimAccumulator.h:33
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
PMTDSimAccumulator::emplace_back
void emplace_back(unsigned int detId, unsigned char row, unsigned char column, unsigned short energyIndex, unsigned short sampleIndex, unsigned short data)
Definition: PMTDSimAccumulator.h:69
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92
PMTDSimAccumulator::Data::sampleMask
constexpr static unsigned sampleMask
Definition: PMTDSimAccumulator.h:34