CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
SiStripApvSimulationParameters Class Reference

#include <SiStripApvSimulationParameters.h>

Public Types

using layerid = unsigned int
 
using LayerParameters = PhysicsTools::Calibration::HistogramF3D
 

Public Member Functions

void calculateIntegrals ()
 
const LayerParametersgetTEC (layerid wheel) const
 
const LayerParametersgetTIB (layerid layer) const
 
const LayerParametersgetTID (layerid wheel) const
 
const LayerParametersgetTOB (layerid layer) const
 
bool putTEC (layerid wheel, const LayerParameters &params)
 
bool putTEC (layerid wheel, LayerParameters &&params)
 
bool putTIB (layerid layer, const LayerParameters &params)
 
bool putTIB (layerid layer, LayerParameters &&params)
 
bool putTID (layerid wheel, const LayerParameters &params)
 
bool putTID (layerid wheel, LayerParameters &&params)
 
bool putTOB (layerid layer, const LayerParameters &params)
 
bool putTOB (layerid layer, LayerParameters &&params)
 
float sampleTEC (layerid wheel, float r, float pu, CLHEP::HepRandomEngine *engine) const
 
float sampleTIB (layerid layer, float z, float pu, CLHEP::HepRandomEngine *engine) const
 
float sampleTID (layerid wheel, float r, float pu, CLHEP::HepRandomEngine *engine) const
 
float sampleTOB (layerid layer, float z, float pu, CLHEP::HepRandomEngine *engine) const
 
 SiStripApvSimulationParameters (layerid nTIB, layerid nTOB, layerid nTID, layerid nTEC)
 
 SiStripApvSimulationParameters ()
 
 ~SiStripApvSimulationParameters ()
 

Private Member Functions

float sampleBarrel (layerid layerIdx, float z, float pu, CLHEP::HepRandomEngine *engine) const
 
float sampleEndcap (layerid wheelIdx, float r, float pu, CLHEP::HepRandomEngine *engine) const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

std::vector< PhysicsTools::Calibration::HistogramF3Dm_barrelParam
 
std::vector< PhysicsTools::Calibration::HistogramF2Dm_barrelParam_xInt
 
std::vector< PhysicsTools::Calibration::HistogramF3Dm_endcapParam
 
std::vector< PhysicsTools::Calibration::HistogramF2Dm_endcapParam_xInt
 
layerid m_nTEC
 
layerid m_nTIB
 
layerid m_nTID
 
layerid m_nTOB
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Stores a histogram binned in PU, z and baseline voltage, for every barrel layer of the strip tracker

Definition at line 17 of file SiStripApvSimulationParameters.h.

Member Typedef Documentation

◆ layerid

Definition at line 19 of file SiStripApvSimulationParameters.h.

◆ LayerParameters

Definition at line 20 of file SiStripApvSimulationParameters.h.

Constructor & Destructor Documentation

◆ SiStripApvSimulationParameters() [1/2]

SiStripApvSimulationParameters::SiStripApvSimulationParameters ( layerid  nTIB,
layerid  nTOB,
layerid  nTID,
layerid  nTEC 
)
inline

Definition at line 22 of file SiStripApvSimulationParameters.h.

References m_barrelParam, m_barrelParam_xInt, m_endcapParam, m_endcapParam_xInt, m_nTEC, m_nTIB, m_nTID, and m_nTOB.

23  : m_nTIB(nTIB), m_nTOB(nTOB), m_nTID(nTID), m_nTEC(nTEC) {
24  m_barrelParam.resize(m_nTIB + m_nTOB);
26  m_endcapParam.resize(m_nTID + m_nTEC);
28  }
std::vector< PhysicsTools::Calibration::HistogramF2D > m_endcapParam_xInt
std::vector< PhysicsTools::Calibration::HistogramF3D > m_endcapParam
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam
std::vector< PhysicsTools::Calibration::HistogramF2D > m_barrelParam_xInt

◆ SiStripApvSimulationParameters() [2/2]

SiStripApvSimulationParameters::SiStripApvSimulationParameters ( )
inline

Definition at line 29 of file SiStripApvSimulationParameters.h.

29 {}

◆ ~SiStripApvSimulationParameters()

SiStripApvSimulationParameters::~SiStripApvSimulationParameters ( )
inline

Definition at line 30 of file SiStripApvSimulationParameters.h.

30 {}

Member Function Documentation

◆ calculateIntegrals()

void SiStripApvSimulationParameters::calculateIntegrals ( )

Definition at line 41 of file SiStripApvSimulationParameters.cc.

References mps_fire::i, m_barrelParam, m_barrelParam_xInt, m_endcapParam, and m_endcapParam_xInt.

41  {
42  if (m_barrelParam.size() != m_barrelParam_xInt.size()) {
43  m_barrelParam_xInt.resize(m_barrelParam.size());
44  for (unsigned int i{0}; i != m_barrelParam.size(); ++i) {
45  m_barrelParam_xInt[i] = calculateXInt(m_barrelParam[i]);
46  }
47  }
48  if (m_endcapParam.size() != m_endcapParam_xInt.size()) {
49  m_endcapParam_xInt.resize(m_endcapParam.size());
50  for (unsigned int i{0}; i != m_endcapParam.size(); ++i) {
51  m_endcapParam_xInt[i] = calculateXInt(m_endcapParam[i]);
52  }
53  }
54 }
std::vector< PhysicsTools::Calibration::HistogramF2D > m_endcapParam_xInt
std::vector< PhysicsTools::Calibration::HistogramF3D > m_endcapParam
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam
std::vector< PhysicsTools::Calibration::HistogramF2D > m_barrelParam_xInt

◆ getTEC()

const LayerParameters& SiStripApvSimulationParameters::getTEC ( layerid  wheel) const
inline

◆ getTIB()

const LayerParameters& SiStripApvSimulationParameters::getTIB ( layerid  layer) const
inline

Definition at line 46 of file SiStripApvSimulationParameters.h.

References pixelTopology::layer, and m_barrelParam.

46 { return m_barrelParam[layer - 1]; }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam

◆ getTID()

const LayerParameters& SiStripApvSimulationParameters::getTID ( layerid  wheel) const
inline

Definition at line 48 of file SiStripApvSimulationParameters.h.

References m_endcapParam, and makeMuonMisalignmentScenario::wheel.

48 { return m_endcapParam[wheel - 1]; }
std::vector< PhysicsTools::Calibration::HistogramF3D > m_endcapParam

◆ getTOB()

const LayerParameters& SiStripApvSimulationParameters::getTOB ( layerid  layer) const
inline

Definition at line 47 of file SiStripApvSimulationParameters.h.

References pixelTopology::layer, m_barrelParam, and m_nTIB.

47 { return m_barrelParam[m_nTIB + layer - 1]; }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam

◆ putTEC() [1/2]

bool SiStripApvSimulationParameters::putTEC ( layerid  wheel,
const LayerParameters params 
)
inline

◆ putTEC() [2/2]

bool SiStripApvSimulationParameters::putTEC ( SiStripApvSimulationParameters::layerid  wheel,
SiStripApvSimulationParameters::LayerParameters &&  params 
)

Definition at line 92 of file SiStripApvSimulationParameters.cc.

References m_endcapParam, m_endcapParam_xInt, m_nTEC, m_nTID, submitPVValidationJobs::params, and makeMuonMisalignmentScenario::wheel.

93  {
94  if ((wheel > m_nTEC) || (wheel < 1)) {
95  edm::LogError("SiStripApvSimulationParameters")
96  << "[" << __PRETTY_FUNCTION__ << "] wheel index " << wheel << " out of range [1," << m_nTEC << ")";
97  return false;
98  }
100  m_endcapParam_xInt[m_nTID + wheel - 1] = calculateXInt(params);
101  return true;
102 }
Log< level::Error, false > LogError
std::vector< PhysicsTools::Calibration::HistogramF2D > m_endcapParam_xInt
std::vector< PhysicsTools::Calibration::HistogramF3D > m_endcapParam

◆ putTIB() [1/2]

bool SiStripApvSimulationParameters::putTIB ( layerid  layer,
const LayerParameters params 
)
inline

Definition at line 34 of file SiStripApvSimulationParameters.h.

References pixelTopology::layer, submitPVValidationJobs::params, and putTIB().

Referenced by putTIB().

34 { return putTIB(layer, LayerParameters(params)); }
bool putTIB(layerid layer, const LayerParameters &params)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
PhysicsTools::Calibration::HistogramF3D LayerParameters

◆ putTIB() [2/2]

bool SiStripApvSimulationParameters::putTIB ( SiStripApvSimulationParameters::layerid  layer,
SiStripApvSimulationParameters::LayerParameters &&  params 
)

Definition at line 56 of file SiStripApvSimulationParameters.cc.

References pixelTopology::layer, m_barrelParam, m_barrelParam_xInt, m_nTIB, and submitPVValidationJobs::params.

57  {
58  if ((layer > m_nTIB) || (layer < 1)) {
59  edm::LogError("SiStripApvSimulationParameters")
60  << "[" << __PRETTY_FUNCTION__ << "] layer index " << layer << " out of range [1," << m_nTIB << "]";
61  return false;
62  }
63  m_barrelParam[layer - 1] = params;
64  m_barrelParam_xInt[layer - 1] = calculateXInt(params);
65  return true;
66 }
Log< level::Error, false > LogError
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam
std::vector< PhysicsTools::Calibration::HistogramF2D > m_barrelParam_xInt

◆ putTID() [1/2]

bool SiStripApvSimulationParameters::putTID ( layerid  wheel,
const LayerParameters params 
)
inline

◆ putTID() [2/2]

bool SiStripApvSimulationParameters::putTID ( SiStripApvSimulationParameters::layerid  wheel,
SiStripApvSimulationParameters::LayerParameters &&  params 
)

Definition at line 80 of file SiStripApvSimulationParameters.cc.

References m_endcapParam, m_endcapParam_xInt, m_nTID, submitPVValidationJobs::params, and makeMuonMisalignmentScenario::wheel.

81  {
82  if ((wheel > m_nTID) || (wheel < 1)) {
83  edm::LogError("SiStripApvSimulationParameters")
84  << "[" << __PRETTY_FUNCTION__ << "] wheel index " << wheel << " out of range [1," << m_nTID << "]";
85  return false;
86  }
87  m_endcapParam[wheel - 1] = params;
88  m_endcapParam_xInt[wheel - 1] = calculateXInt(params);
89  return true;
90 }
Log< level::Error, false > LogError
std::vector< PhysicsTools::Calibration::HistogramF2D > m_endcapParam_xInt
std::vector< PhysicsTools::Calibration::HistogramF3D > m_endcapParam

◆ putTOB() [1/2]

bool SiStripApvSimulationParameters::putTOB ( layerid  layer,
const LayerParameters params 
)
inline

Definition at line 37 of file SiStripApvSimulationParameters.h.

References pixelTopology::layer, submitPVValidationJobs::params, and putTOB().

Referenced by putTOB().

37 { return putTOB(layer, LayerParameters(params)); }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
PhysicsTools::Calibration::HistogramF3D LayerParameters
bool putTOB(layerid layer, const LayerParameters &params)

◆ putTOB() [2/2]

bool SiStripApvSimulationParameters::putTOB ( SiStripApvSimulationParameters::layerid  layer,
SiStripApvSimulationParameters::LayerParameters &&  params 
)

Definition at line 68 of file SiStripApvSimulationParameters.cc.

References pixelTopology::layer, m_barrelParam, m_barrelParam_xInt, m_nTIB, m_nTOB, and submitPVValidationJobs::params.

69  {
70  if ((layer > m_nTOB) || (layer < 1)) {
71  edm::LogError("SiStripApvSimulationParameters")
72  << "[" << __PRETTY_FUNCTION__ << "] layer index " << layer << " out of range [1," << m_nTOB << ")";
73  return false;
74  }
76  m_barrelParam_xInt[m_nTIB + layer - 1] = calculateXInt(params);
77  return true;
78 }
Log< level::Error, false > LogError
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam
std::vector< PhysicsTools::Calibration::HistogramF2D > m_barrelParam_xInt

◆ sampleBarrel()

float SiStripApvSimulationParameters::sampleBarrel ( layerid  layerIdx,
float  z,
float  pu,
CLHEP::HepRandomEngine *  engine 
) const
private

Definition at line 104 of file SiStripApvSimulationParameters.cc.

References Exception, mps_fire::i, m_barrelParam, m_barrelParam_xInt, displacedMuons_cfi::pu, heppy_batch::val, and z.

Referenced by sampleTIB(), and sampleTOB().

107  {
108  if (m_barrelParam.size() != m_barrelParam_xInt.size()) {
109  throw cms::Exception("LogicError") << "x-integrals of 3D histograms have not been calculated";
110  }
111  const auto layerParam = m_barrelParam[layerIdx];
112  const int ip = layerParam.findBinY(pu);
113  const int iz = layerParam.findBinZ(z);
114  const float norm = m_barrelParam_xInt[layerIdx].binContent(ip, iz);
115  const auto val = CLHEP::RandFlat::shoot(engine) * norm;
116  if (val < layerParam.binContent(0, ip, iz)) { // underflow
117  return layerParam.rangeX().min;
118  } else if (norm - val < layerParam.binContent(layerParam.numberOfBinsX() + 1, ip, iz)) { // overflow
119  return layerParam.rangeX().max;
120  } else { // loop over bins, return center of our bin
121  float sum = layerParam.binContent(0, ip, iz);
122  for (int i{1}; i != layerParam.numberOfBinsX() + 1; ++i) {
123  sum += layerParam.binContent(i, ip, iz);
124  if (sum > val) {
125  return xBinPos(layerParam, i, (sum - val) / layerParam.binContent(i, ip, iz));
126  }
127  }
128  }
129  throw cms::Exception("LogicError") << "Problem drawing a random number from the distribution";
130 }
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam
std::vector< PhysicsTools::Calibration::HistogramF2D > m_barrelParam_xInt

◆ sampleEndcap()

float SiStripApvSimulationParameters::sampleEndcap ( layerid  wheelIdx,
float  r,
float  pu,
CLHEP::HepRandomEngine *  engine 
) const
private

Definition at line 132 of file SiStripApvSimulationParameters.cc.

References Exception, mps_fire::i, m_endcapParam, m_endcapParam_xInt, displacedMuons_cfi::pu, alignCSCRings::r, and heppy_batch::val.

Referenced by sampleTEC(), and sampleTID().

135  {
136  if (m_endcapParam.size() != m_endcapParam_xInt.size()) {
137  throw cms::Exception("LogicError") << "x-integrals of 3D histograms have not been calculated";
138  }
139  const auto layerParam = m_endcapParam[wheelIdx];
140  const int ip = layerParam.findBinY(pu);
141  const int ir = layerParam.findBinZ(r);
142  const float norm = m_endcapParam_xInt[wheelIdx].binContent(ip, ir);
143  const auto val = CLHEP::RandFlat::shoot(engine) * norm;
144  if (val < layerParam.binContent(0, ip, ir)) { // underflow
145  return layerParam.rangeX().min;
146  } else if (norm - val < layerParam.binContent(layerParam.numberOfBinsX() + 1, ip, ir)) { // overflow
147  return layerParam.rangeX().max;
148  } else { // loop over bins, return center of our bin
149  float sum = layerParam.binContent(0, ip, ir);
150  for (int i{1}; i != layerParam.numberOfBinsX() + 1; ++i) {
151  sum += layerParam.binContent(i, ip, ir);
152  if (sum > val) {
153  return xBinPos(layerParam, i, (sum - val) / layerParam.binContent(i, ip, ir));
154  }
155  }
156  }
157  throw cms::Exception("LogicError") << "Problem drawing a random number from the distribution";
158 }
std::vector< PhysicsTools::Calibration::HistogramF2D > m_endcapParam_xInt
std::vector< PhysicsTools::Calibration::HistogramF3D > m_endcapParam

◆ sampleTEC()

float SiStripApvSimulationParameters::sampleTEC ( layerid  wheel,
float  r,
float  pu,
CLHEP::HepRandomEngine *  engine 
) const
inline

◆ sampleTIB()

float SiStripApvSimulationParameters::sampleTIB ( layerid  layer,
float  z,
float  pu,
CLHEP::HepRandomEngine *  engine 
) const
inline

Definition at line 51 of file SiStripApvSimulationParameters.h.

References pixelTopology::layer, displacedMuons_cfi::pu, sampleBarrel(), and z.

Referenced by SiStripDigitizerAlgorithm::digitize(), and PreMixingSiStripWorker::put().

51  {
52  return sampleBarrel(layer - 1, z, pu, engine);
53  }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
float sampleBarrel(layerid layerIdx, float z, float pu, CLHEP::HepRandomEngine *engine) const

◆ sampleTID()

float SiStripApvSimulationParameters::sampleTID ( layerid  wheel,
float  r,
float  pu,
CLHEP::HepRandomEngine *  engine 
) const
inline

◆ sampleTOB()

float SiStripApvSimulationParameters::sampleTOB ( layerid  layer,
float  z,
float  pu,
CLHEP::HepRandomEngine *  engine 
) const
inline

Definition at line 54 of file SiStripApvSimulationParameters.h.

References pixelTopology::layer, m_nTIB, displacedMuons_cfi::pu, sampleBarrel(), and z.

Referenced by SiStripDigitizerAlgorithm::digitize(), and PreMixingSiStripWorker::put().

54  {
55  return sampleBarrel(m_nTIB + layer - 1, z, pu, engine);
56  };
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
float sampleBarrel(layerid layerIdx, float z, float pu, CLHEP::HepRandomEngine *engine) const

◆ serialize()

template<class Archive >
void SiStripApvSimulationParameters::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 74 of file SiStripApvSimulationParameters.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 74 of file SiStripApvSimulationParameters.h.

Member Data Documentation

◆ m_barrelParam

std::vector<PhysicsTools::Calibration::HistogramF3D> SiStripApvSimulationParameters::m_barrelParam
private

◆ m_barrelParam_xInt

std::vector<PhysicsTools::Calibration::HistogramF2D> SiStripApvSimulationParameters::m_barrelParam_xInt
private

◆ m_endcapParam

std::vector<PhysicsTools::Calibration::HistogramF3D> SiStripApvSimulationParameters::m_endcapParam
private

◆ m_endcapParam_xInt

std::vector<PhysicsTools::Calibration::HistogramF2D> SiStripApvSimulationParameters::m_endcapParam_xInt
private

◆ m_nTEC

layerid SiStripApvSimulationParameters::m_nTEC
private

Definition at line 65 of file SiStripApvSimulationParameters.h.

Referenced by putTEC(), and SiStripApvSimulationParameters().

◆ m_nTIB

layerid SiStripApvSimulationParameters::m_nTIB
private

◆ m_nTID

layerid SiStripApvSimulationParameters::m_nTID
private

◆ m_nTOB

layerid SiStripApvSimulationParameters::m_nTOB
private

Definition at line 65 of file SiStripApvSimulationParameters.h.

Referenced by putTOB(), and SiStripApvSimulationParameters().