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 ()
 
 SiStripApvSimulationParameters (layerid nTIB, layerid nTOB, layerid nTID, layerid nTEC)
 
 ~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.

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  }

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

◆ 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.

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 }

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

◆ getTEC()

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

Definition at line 49 of file SiStripApvSimulationParameters.h.

49 { return m_endcapParam[m_nTID + wheel - 1]; }

References m_endcapParam, m_nTID, and makeMuonMisalignmentScenario::wheel.

◆ getTIB()

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

Definition at line 46 of file SiStripApvSimulationParameters.h.

46 { return m_barrelParam[layer - 1]; }

References phase1PixelTopology::layer, and m_barrelParam.

◆ getTID()

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

Definition at line 48 of file SiStripApvSimulationParameters.h.

48 { return m_endcapParam[wheel - 1]; }

References m_endcapParam, and makeMuonMisalignmentScenario::wheel.

◆ getTOB()

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

Definition at line 47 of file SiStripApvSimulationParameters.h.

47 { return m_barrelParam[m_nTIB + layer - 1]; }

References phase1PixelTopology::layer, m_barrelParam, and m_nTIB.

◆ 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.

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 }

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

◆ putTIB() [1/2]

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

◆ putTIB() [2/2]

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

Definition at line 56 of file SiStripApvSimulationParameters.cc.

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 }

References phase1PixelTopology::layer, m_barrelParam, m_barrelParam_xInt, m_nTIB, and CalibrationSummaryClient_cfi::params.

◆ 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.

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 }

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

◆ putTOB() [1/2]

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

◆ putTOB() [2/2]

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

Definition at line 68 of file SiStripApvSimulationParameters.cc.

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 }

References phase1PixelTopology::layer, m_barrelParam, m_barrelParam_xInt, m_nTIB, m_nTOB, and CalibrationSummaryClient_cfi::params.

◆ sampleBarrel()

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

Definition at line 104 of file SiStripApvSimulationParameters.cc.

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 }

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

Referenced by sampleTIB(), and sampleTOB().

◆ sampleEndcap()

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

Definition at line 132 of file SiStripApvSimulationParameters.cc.

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 }

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

Referenced by sampleTEC(), and sampleTID().

◆ 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.

51  {
52  return sampleBarrel(layer - 1, z, pu, engine);
53  }

References phase1PixelTopology::layer, muons2muons_cfi::pu, sampleBarrel(), and z.

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

◆ 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.

54  {
55  return sampleBarrel(m_nTIB + layer - 1, z, pu, engine);
56  };

References phase1PixelTopology::layer, m_nTIB, muons2muons_cfi::pu, sampleBarrel(), and z.

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

◆ 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().

SiStripApvSimulationParameters::m_endcapParam_xInt
std::vector< PhysicsTools::Calibration::HistogramF2D > m_endcapParam_xInt
Definition: SiStripApvSimulationParameters.h:69
SiStripApvSimulationParameters::m_nTOB
layerid m_nTOB
Definition: SiStripApvSimulationParameters.h:65
mps_fire.i
i
Definition: mps_fire.py:428
SiStripApvSimulationParameters::m_nTEC
layerid m_nTEC
Definition: SiStripApvSimulationParameters.h:65
SiStripApvSimulationParameters::LayerParameters
PhysicsTools::Calibration::HistogramF3D LayerParameters
Definition: SiStripApvSimulationParameters.h:20
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
SiStripApvSimulationParameters::m_nTIB
layerid m_nTIB
Definition: SiStripApvSimulationParameters.h:65
SiStripApvSimulationParameters::m_barrelParam
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam
Definition: SiStripApvSimulationParameters.h:66
SiStripApvSimulationParameters::putTEC
bool putTEC(layerid wheel, const LayerParameters &params)
Definition: SiStripApvSimulationParameters.h:43
DDAxes::z
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
SiStripApvSimulationParameters::putTIB
bool putTIB(layerid layer, const LayerParameters &params)
Definition: SiStripApvSimulationParameters.h:34
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
SiStripApvSimulationParameters::m_endcapParam
std::vector< PhysicsTools::Calibration::HistogramF3D > m_endcapParam
Definition: SiStripApvSimulationParameters.h:68
SiStripApvSimulationParameters::putTOB
bool putTOB(layerid layer, const LayerParameters &params)
Definition: SiStripApvSimulationParameters.h:37
SiStripApvSimulationParameters::putTID
bool putTID(layerid wheel, const LayerParameters &params)
Definition: SiStripApvSimulationParameters.h:40
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
alignCSCRings.r
r
Definition: alignCSCRings.py:93
SiStripApvSimulationParameters::sampleBarrel
float sampleBarrel(layerid layerIdx, float z, float pu, CLHEP::HepRandomEngine *engine) const
Definition: SiStripApvSimulationParameters.cc:104
heppy_batch.val
val
Definition: heppy_batch.py:351
Exception
Definition: hltDiff.cc:245
SiStripApvSimulationParameters::sampleEndcap
float sampleEndcap(layerid wheelIdx, float r, float pu, CLHEP::HepRandomEngine *engine) const
Definition: SiStripApvSimulationParameters.cc:132
muons2muons_cfi.pu
pu
Definition: muons2muons_cfi.py:31
SiStripApvSimulationParameters::m_nTID
layerid m_nTID
Definition: SiStripApvSimulationParameters.h:65
SiStripApvSimulationParameters::m_barrelParam_xInt
std::vector< PhysicsTools::Calibration::HistogramF2D > m_barrelParam_xInt
Definition: SiStripApvSimulationParameters.h:67