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

Definition at line 19 of file SiStripApvSimulationParameters.h.

Definition at line 20 of file SiStripApvSimulationParameters.h.

Constructor & Destructor Documentation

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  }
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::SiStripApvSimulationParameters ( )
inline

Definition at line 29 of file SiStripApvSimulationParameters.h.

29 {}
SiStripApvSimulationParameters::~SiStripApvSimulationParameters ( )
inline

Definition at line 30 of file SiStripApvSimulationParameters.h.

30 {}

Member Function Documentation

void SiStripApvSimulationParameters::calculateIntegrals ( )

Definition at line 40 of file SiStripApvSimulationParameters.cc.

References mps_fire::i.

40  {
41  if (m_barrelParam.size() != m_barrelParam_xInt.size()) {
42  m_barrelParam_xInt.resize(m_barrelParam.size());
43  for (unsigned int i{0}; i != m_barrelParam.size(); ++i) {
44  m_barrelParam_xInt[i] = calculateXInt(m_barrelParam[i]);
45  }
46  }
47  if (m_endcapParam.size() != m_endcapParam_xInt.size()) {
48  m_endcapParam_xInt.resize(m_endcapParam.size());
49  for (unsigned int i{0}; i != m_endcapParam.size(); ++i) {
50  m_endcapParam_xInt[i] = calculateXInt(m_endcapParam[i]);
51  }
52  }
53 }
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
const LayerParameters& SiStripApvSimulationParameters::getTEC ( layerid  wheel) const
inline
const LayerParameters& SiStripApvSimulationParameters::getTIB ( layerid  layer) const
inline

Definition at line 46 of file SiStripApvSimulationParameters.h.

46 { return m_barrelParam[layer - 1]; }
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam
const LayerParameters& SiStripApvSimulationParameters::getTID ( layerid  wheel) const
inline

Definition at line 48 of file SiStripApvSimulationParameters.h.

48 { return m_endcapParam[wheel - 1]; }
std::vector< PhysicsTools::Calibration::HistogramF3D > m_endcapParam
const LayerParameters& SiStripApvSimulationParameters::getTOB ( layerid  layer) const
inline

Definition at line 47 of file SiStripApvSimulationParameters.h.

47 { return m_barrelParam[m_nTIB + layer - 1]; }
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam
bool SiStripApvSimulationParameters::putTEC ( layerid  wheel,
const LayerParameters params 
)
inline

Definition at line 43 of file SiStripApvSimulationParameters.h.

References putTEC().

Referenced by putTEC().

43 { return putTEC(wheel, LayerParameters(params)); }
PhysicsTools::Calibration::HistogramF3D LayerParameters
bool putTEC(layerid wheel, const LayerParameters &params)
bool SiStripApvSimulationParameters::putTEC ( SiStripApvSimulationParameters::layerid  wheel,
SiStripApvSimulationParameters::LayerParameters &&  params 
)

Definition at line 91 of file SiStripApvSimulationParameters.cc.

92  {
93  if ((wheel > m_nTEC) || (wheel < 1)) {
94  edm::LogError("SiStripApvSimulationParameters")
95  << "[" << __PRETTY_FUNCTION__ << "] wheel index " << wheel << " out of range [1," << m_nTEC << ")";
96  return false;
97  }
98  m_endcapParam[m_nTID + wheel - 1] = params;
99  m_endcapParam_xInt[m_nTID + wheel - 1] = calculateXInt(params);
100  return true;
101 }
std::vector< PhysicsTools::Calibration::HistogramF2D > m_endcapParam_xInt
std::vector< PhysicsTools::Calibration::HistogramF3D > m_endcapParam
bool SiStripApvSimulationParameters::putTIB ( layerid  layer,
const LayerParameters params 
)
inline

Definition at line 34 of file SiStripApvSimulationParameters.h.

References putTIB().

Referenced by putTIB().

34 { return putTIB(layer, LayerParameters(params)); }
bool putTIB(layerid layer, const LayerParameters &params)
PhysicsTools::Calibration::HistogramF3D LayerParameters
bool SiStripApvSimulationParameters::putTIB ( SiStripApvSimulationParameters::layerid  layer,
SiStripApvSimulationParameters::LayerParameters &&  params 
)

Definition at line 55 of file SiStripApvSimulationParameters.cc.

56  {
57  if ((layer > m_nTIB) || (layer < 1)) {
58  edm::LogError("SiStripApvSimulationParameters")
59  << "[" << __PRETTY_FUNCTION__ << "] layer index " << layer << " out of range [1," << m_nTIB << "]";
60  return false;
61  }
62  m_barrelParam[layer - 1] = params;
63  m_barrelParam_xInt[layer - 1] = calculateXInt(params);
64  return true;
65 }
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam
std::vector< PhysicsTools::Calibration::HistogramF2D > m_barrelParam_xInt
bool SiStripApvSimulationParameters::putTID ( layerid  wheel,
const LayerParameters params 
)
inline

Definition at line 40 of file SiStripApvSimulationParameters.h.

References putTID(), and makeMuonMisalignmentScenario::wheel.

Referenced by putTID().

40 { return putTID(wheel, LayerParameters(params)); }
bool putTID(layerid wheel, const LayerParameters &params)
PhysicsTools::Calibration::HistogramF3D LayerParameters
bool SiStripApvSimulationParameters::putTID ( SiStripApvSimulationParameters::layerid  wheel,
SiStripApvSimulationParameters::LayerParameters &&  params 
)

Definition at line 79 of file SiStripApvSimulationParameters.cc.

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

Definition at line 37 of file SiStripApvSimulationParameters.h.

References putTOB().

Referenced by putTOB().

37 { return putTOB(layer, LayerParameters(params)); }
PhysicsTools::Calibration::HistogramF3D LayerParameters
bool putTOB(layerid layer, const LayerParameters &params)
bool SiStripApvSimulationParameters::putTOB ( SiStripApvSimulationParameters::layerid  layer,
SiStripApvSimulationParameters::LayerParameters &&  params 
)

Definition at line 67 of file SiStripApvSimulationParameters.cc.

68  {
69  if ((layer > m_nTOB) || (layer < 1)) {
70  edm::LogError("SiStripApvSimulationParameters") << "[" << __PRETTY_FUNCTION__ << "] layer index " << layer
71  << " out of range [1," << m_nTOB << ")";
72  return false;
73  }
74  m_barrelParam[m_nTIB + layer - 1] = params;
75  m_barrelParam_xInt[m_nTIB + layer - 1] = calculateXInt(params);
76  return true;
77 }
std::vector< PhysicsTools::Calibration::HistogramF3D > m_barrelParam
std::vector< PhysicsTools::Calibration::HistogramF2D > m_barrelParam_xInt
float SiStripApvSimulationParameters::sampleBarrel ( layerid  layerIdx,
float  z,
float  pu,
CLHEP::HepRandomEngine *  engine 
) const
private

Definition at line 103 of file SiStripApvSimulationParameters.cc.

References Exception, mps_fire::i, and heppy_batch::val.

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

Definition at line 131 of file SiStripApvSimulationParameters.cc.

References Exception, mps_fire::i, and heppy_batch::val.

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

Definition at line 60 of file SiStripApvSimulationParameters.h.

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

60  {
61  return sampleEndcap(m_nTID + wheel - 1, r, pu, engine);
62  }
float sampleEndcap(layerid wheelIdx, float r, float pu, CLHEP::HepRandomEngine *engine) const
float SiStripApvSimulationParameters::sampleTIB ( layerid  layer,
float  z,
float  pu,
CLHEP::HepRandomEngine *  engine 
) const
inline

Definition at line 51 of file SiStripApvSimulationParameters.h.

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

51  {
52  return sampleBarrel(layer - 1, z, pu, engine);
53  }
float sampleBarrel(layerid layerIdx, float z, float pu, CLHEP::HepRandomEngine *engine) const
float SiStripApvSimulationParameters::sampleTID ( layerid  wheel,
float  r,
float  pu,
CLHEP::HepRandomEngine *  engine 
) const
inline

Definition at line 57 of file SiStripApvSimulationParameters.h.

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

57  {
58  return sampleEndcap(wheel - 1, r, pu, engine);
59  }
float sampleEndcap(layerid wheelIdx, float r, float pu, CLHEP::HepRandomEngine *engine) const
float SiStripApvSimulationParameters::sampleTOB ( layerid  layer,
float  z,
float  pu,
CLHEP::HepRandomEngine *  engine 
) const
inline

Definition at line 54 of file SiStripApvSimulationParameters.h.

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

54  {
55  return sampleBarrel(m_nTIB + layer - 1, z, pu, engine);
56  };
float sampleBarrel(layerid layerIdx, float z, float pu, CLHEP::HepRandomEngine *engine) const
template<class Archive >
void SiStripApvSimulationParameters::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 74 of file SiStripApvSimulationParameters.h.

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

Definition at line 74 of file SiStripApvSimulationParameters.h.

Member Data Documentation

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

Definition at line 66 of file SiStripApvSimulationParameters.h.

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

Definition at line 67 of file SiStripApvSimulationParameters.h.

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

Definition at line 68 of file SiStripApvSimulationParameters.h.

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

Definition at line 69 of file SiStripApvSimulationParameters.h.

layerid SiStripApvSimulationParameters::m_nTEC
private

Definition at line 65 of file SiStripApvSimulationParameters.h.

layerid SiStripApvSimulationParameters::m_nTIB
private

Definition at line 65 of file SiStripApvSimulationParameters.h.

layerid SiStripApvSimulationParameters::m_nTID
private

Definition at line 65 of file SiStripApvSimulationParameters.h.

layerid SiStripApvSimulationParameters::m_nTOB
private

Definition at line 65 of file SiStripApvSimulationParameters.h.