CMS 3D CMS Logo

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

#include <AlignPCLThresholdsHG.h>

Inheritance diagram for AlignPCLThresholdsHG:
AlignPCLThresholds

Public Types

enum  FloatParamIndex {
  FRACTION_CUT_X = 0, FRACTION_CUT_Y = 1, FRACTION_CUT_Z = 2, FRACTION_CUT_TX = 3,
  FRACTION_CUT_TY = 4, FRACTION_CUT_TZ = 5, FSIZE = 6
}
 
enum  IntParamIndex { ISIZE = 0 }
 
typedef std::unordered_map< std::string, std::vector< float > > param_map
 
enum  StringParamIndex { SSIZE = 0 }
 
- Public Types inherited from AlignPCLThresholds
enum  coordType {
  X, Y, Z, theta_X,
  theta_Y, theta_Z, extra_DOF, endOfTypes
}
 
typedef std::map< std::string, AlignPCLThresholdthreshold_map
 

Public Member Functions

 AlignPCLThresholdsHG ()
 
const param_mapgetFloatMap () const
 
const std::vector< float > & getFloatVec (const std::string &AlignableId) const
 
float getFractionCut (const std::string &AlignableId, const coordType &type) const
 
std::array< float, 6 > getFractionCut (const std::string &AlignableId) const
 
const bool hasFloatMap (const std::string &AlignableId) const
 
const int payloadVersion () const
 
void printAll () const
 
void setFloatMap (const param_map &floatMap)
 
void setFractionCut (const std::string &AlignableId, const coordType &type, const float &cut)
 
 ~AlignPCLThresholdsHG () override=default
 
- Public Member Functions inherited from AlignPCLThresholds
 AlignPCLThresholds ()
 
std::vector< std::string > getAlignableList () const
 
AlignPCLThreshold getAlignPCLThreshold (const std::string &AlignableId) const
 
AlignPCLThresholdgetAlignPCLThreshold (const std::string &AlignableId)
 
float getCut (const std::string &AlignableId, const coordType &type) const
 
std::array< float, 6 > getCut (const std::string &AlignableId) const
 
std::array< float, 4 > getExtraDOFCutsForAlignable (const std::string &AlignableId, const unsigned int i) const
 
std::string getExtraDOFLabelForAlignable (const std::string &AlignableId, const unsigned int i) const
 
float getMaxErrorCut (const std::string &AlignableId, const coordType &type) const
 
std::array< float, 6 > getMaxErrorCut (const std::string &AlignableId) const
 
float getMaxMoveCut (const std::string &AlignableId, const coordType &type) const
 
std::array< float, 6 > getMaxMoveCut (const std::string &AlignableId) const
 
const int & getNrecords () const
 
float getSigCut (const std::string &AlignableId, const coordType &type) const
 
std::array< float, 6 > getSigCut (const std::string &AlignableId) const
 
const threshold_mapgetThreshold_Map () const
 
void printAll () const
 
void setAlignPCLThreshold (const std::string &AlignableId, const AlignPCLThreshold &Threshold)
 
void setAlignPCLThresholds (const int &Nrecords, const threshold_map &Thresholds)
 
void setNRecords (const int &Nrecords)
 
double size () const
 
virtual ~AlignPCLThresholds ()
 

Private Member Functions

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

Private Attributes

param_map floatMap_
 
std::unordered_map< std::string, std::vector< int > > intMap_
 
std::unordered_map< std::string, std::vector< std::string > > stringMap_
 

Friends

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

Additional Inherited Members

- Protected Attributes inherited from AlignPCLThresholds
int m_nrecords
 
threshold_map m_thresholds
 

Detailed Description

Definition at line 11 of file AlignPCLThresholdsHG.h.

Member Typedef Documentation

◆ param_map

typedef std::unordered_map<std::string, std::vector<float> > AlignPCLThresholdsHG::param_map

Definition at line 13 of file AlignPCLThresholdsHG.h.

Member Enumeration Documentation

◆ FloatParamIndex

◆ IntParamIndex

Enumerator
ISIZE 

Definition at line 26 of file AlignPCLThresholdsHG.h.

◆ StringParamIndex

Enumerator
SSIZE 

Definition at line 27 of file AlignPCLThresholdsHG.h.

Constructor & Destructor Documentation

◆ AlignPCLThresholdsHG()

AlignPCLThresholdsHG::AlignPCLThresholdsHG ( )
inline

Definition at line 14 of file AlignPCLThresholdsHG.h.

14 {}

◆ ~AlignPCLThresholdsHG()

AlignPCLThresholdsHG::~AlignPCLThresholdsHG ( )
overridedefault

Member Function Documentation

◆ getFloatMap()

const param_map& AlignPCLThresholdsHG::getFloatMap ( ) const
inline

Definition at line 32 of file AlignPCLThresholdsHG.h.

References floatMap_.

32 { return floatMap_; }

◆ getFloatVec()

const std::vector< float > & AlignPCLThresholdsHG::getFloatVec ( const std::string &  AlignableId) const

Definition at line 32 of file AlignPCLThresholdsHG.cc.

References Exception, and floatMap_.

Referenced by getFractionCut().

32  {
33  const auto &it = floatMap_.find(AlignableId);
34 
35  if (it != floatMap_.end()) {
36  return it->second;
37  } else {
38  throw cms::Exception("AlignPCLThresholdsHG") << "No float vector defined for Alignable id " << AlignableId << "\n";
39  }
40 }

◆ getFractionCut() [1/2]

float AlignPCLThresholdsHG::getFractionCut ( const std::string &  AlignableId,
const coordType type 
) const

Definition at line 80 of file AlignPCLThresholdsHG.cc.

References Exception, FRACTION_CUT_TX, FRACTION_CUT_TY, FRACTION_CUT_TZ, FRACTION_CUT_X, FRACTION_CUT_Y, FRACTION_CUT_Z, getFloatVec(), AlignPCLThresholdsHGImpl::getParam(), AlignPCLThresholds::theta_X, AlignPCLThresholds::theta_Y, AlignPCLThresholds::theta_Z, AlignPCLThresholds::X, AlignPCLThresholds::Y, and AlignPCLThresholds::Z.

Referenced by printAll().

80  {
81  const std::vector<float> vec = getFloatVec(AlignableId);
82  switch (type) {
83  case X:
85  case Y:
87  case Z:
89  case theta_X:
91  case theta_Y:
93  case theta_Z:
95  default:
96  throw cms::Exception("AlignPCLThresholdsHG")
97  << "Requested fraction threshold for undefined coordinate" << type << "\n";
98  }
99 }
const std::vector< float > & getFloatVec(const std::string &AlignableId) const
const T & getParam(const std::vector< T > &params, size_t index)

◆ getFractionCut() [2/2]

std::array< float, 6 > AlignPCLThresholdsHG::getFractionCut ( const std::string &  AlignableId) const

◆ hasFloatMap()

const bool AlignPCLThresholdsHG::hasFloatMap ( const std::string &  AlignableId) const

Definition at line 102 of file AlignPCLThresholdsHG.cc.

References floatMap_.

102  {
103  const auto &it = floatMap_.find(AlignableId);
104  return (it != floatMap_.end());
105 }

◆ payloadVersion()

const int AlignPCLThresholdsHG::payloadVersion ( ) const

Definition at line 108 of file AlignPCLThresholdsHG.cc.

References Exception, FSIZE, ISIZE, and SSIZE.

108  {
109  switch (FSIZE + ISIZE + SSIZE) {
110  case 6:
111  return 1;
112  default:
113  throw cms::Exception("AlignPCLThresholdsHG")
114  << "Payload version with parameter size equal to " << FSIZE + ISIZE + SSIZE << " is not defined.\n";
115  }
116 }

◆ printAll()

void AlignPCLThresholdsHG::printAll ( ) const

Definition at line 119 of file AlignPCLThresholdsHG.cc.

References floatMap_, AlignPCLThresholds::getExtraDOFCutsForAlignable(), AlignPCLThresholds::getExtraDOFLabelForAlignable(), getFractionCut(), AlignPCLThresholds::getNrecords(), dqmiolumiharvest::j, AlignPCLThresholds::m_thresholds, MillePedeFileConverter_cfg::out, contentValuesCheck::ss, AlignPCLThresholds::theta_X, AlignPCLThresholds::theta_Y, AlignPCLThresholds::theta_Z, AlignPCLThresholds::X, AlignPCLThresholds::Y, and AlignPCLThresholds::Z.

119  {
120  edm::LogVerbatim out("AlignPCLThresholdsHG");
121 
122  out << "AlignPCLThresholdsHG::printAll()\n";
123  out << "============================================================================================================="
124  "======\n";
125  out << "N records cut: " << this->getNrecords() << "\n";
126  for (auto it = m_thresholds.begin(); it != m_thresholds.end(); ++it) {
127  out << "==========================================================================================================="
128  "========\n";
129 
130  std::stringstream ss;
131 
132  ss << "key : " << it->first << " \n"
133  << "- Xcut : " << std::setw(4) << (it->second).getXcut() << std::setw(5) << " um"
134  << "| sigXcut : " << std::setw(4) << (it->second).getSigXcut() << std::setw(1) << " "
135  << "| maxMoveXcut : " << std::setw(4) << (it->second).getMaxMoveXcut() << std::setw(5) << " um"
136  << "| ErrorXcut : " << std::setw(4) << (it->second).getErrorXcut() << std::setw(5) << " um";
137 
138  if (floatMap_.find(it->first) != floatMap_.end()) {
139  ss << "| X_fractionCut : " << std::setw(4) << getFractionCut(it->first, X) << std::setw(5) << "\n";
140  } else {
141  ss << "\n";
142  }
143 
144  ss << "- thetaXcut : " << std::setw(4) << (it->second).getThetaXcut() << std::setw(5) << " urad"
145  << "| sigThetaXcut : " << std::setw(4) << (it->second).getSigThetaXcut() << std::setw(1) << " "
146  << "| maxMoveThetaXcut : " << std::setw(4) << (it->second).getMaxMoveThetaXcut() << std::setw(5) << " urad"
147  << "| ErrorThetaXcut : " << std::setw(4) << (it->second).getErrorThetaXcut() << std::setw(5) << " urad";
148 
149  if (floatMap_.find(it->first) != floatMap_.end()) {
150  ss << "| thetaX_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_X) << std::setw(5) << "\n";
151  } else {
152  ss << "\n";
153  }
154 
155  ss << "- Ycut : " << std::setw(4) << (it->second).getYcut() << std::setw(5) << " um"
156  << "| sigYcut : " << std::setw(4) << (it->second).getSigXcut() << std::setw(1) << " "
157  << "| maxMoveYcut : " << std::setw(4) << (it->second).getMaxMoveYcut() << std::setw(5) << " um"
158  << "| ErrorYcut : " << std::setw(4) << (it->second).getErrorYcut() << std::setw(5) << " um";
159 
160  if (floatMap_.find(it->first) != floatMap_.end()) {
161  ss << "| Y_fractionCut : " << std::setw(4) << getFractionCut(it->first, Y) << std::setw(5) << "\n";
162  } else {
163  ss << "\n";
164  }
165 
166  ss << "- thetaYcut : " << std::setw(4) << (it->second).getThetaYcut() << std::setw(5) << " urad"
167  << "| sigThetaYcut : " << std::setw(4) << (it->second).getSigThetaYcut() << std::setw(1) << " "
168  << "| maxMoveThetaYcut : " << std::setw(4) << (it->second).getMaxMoveThetaYcut() << std::setw(5) << " urad"
169  << "| ErrorThetaYcut : " << std::setw(4) << (it->second).getErrorThetaYcut() << std::setw(5) << " urad";
170 
171  if (floatMap_.find(it->first) != floatMap_.end()) {
172  ss << "| thetaY_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_Y) << std::setw(5) << "\n";
173  } else {
174  ss << "\n";
175  }
176 
177  ss << "- Zcut : " << std::setw(4) << (it->second).getZcut() << std::setw(5) << " um"
178  << "| sigZcut : " << std::setw(4) << (it->second).getSigZcut() << std::setw(1) << " "
179  << "| maxMoveZcut : " << std::setw(4) << (it->second).getMaxMoveZcut() << std::setw(5) << " um"
180  << "| ErrorZcut : " << std::setw(4) << (it->second).getErrorZcut() << std::setw(5) << " um";
181 
182  if (floatMap_.find(it->first) != floatMap_.end()) {
183  ss << "| Z_fractionCut : " << std::setw(4) << getFractionCut(it->first, Z) << std::setw(5) << "\n";
184  } else {
185  ss << "\n";
186  }
187 
188  ss << "- thetaZcut : " << std::setw(4) << (it->second).getThetaZcut() << std::setw(5) << " urad"
189  << "| sigThetaZcut : " << std::setw(4) << (it->second).getSigThetaZcut() << std::setw(1) << " "
190  << "| maxMoveThetaZcut : " << std::setw(4) << (it->second).getMaxMoveThetaZcut() << std::setw(5) << " urad"
191  << "| ErrorThetaZcut : " << std::setw(4) << (it->second).getErrorThetaZcut() << std::setw(5) << " urad";
192 
193  if (floatMap_.find(it->first) != floatMap_.end()) {
194  ss << "| thetaZ_fractionCut : " << std::setw(4) << getFractionCut(it->first, theta_Z) << std::setw(5) << "\n";
195  } else {
196  ss << "\n";
197  }
198 
199  out << ss.str() << std::endl;
200 
201  if ((it->second).hasExtraDOF()) {
202  for (unsigned int j = 0; j < (it->second).extraDOFSize(); j++) {
203  std::array<float, 4> extraDOFCuts = getExtraDOFCutsForAlignable(it->first, j);
204 
205  out << "Extra DOF " << j << " with label: " << getExtraDOFLabelForAlignable(it->first, j);
206  out << "- cut : " << std::setw(4) << extraDOFCuts.at(0) << std::setw(5) << " "
207  << "| sigCut : " << std::setw(4) << extraDOFCuts.at(1) << std::setw(1) << " "
208  << "| maxMoveCut : " << std::setw(4) << extraDOFCuts.at(2) << std::setw(5) << " "
209  << "| maxErrorCut : " << std::setw(4) << extraDOFCuts.at(3) << std::setw(5) << " ";
210  }
211  }
212  }
213 }
std::string getExtraDOFLabelForAlignable(const std::string &AlignableId, const unsigned int i) const
const int & getNrecords() const
std::array< float, 4 > getExtraDOFCutsForAlignable(const std::string &AlignableId, const unsigned int i) const
threshold_map m_thresholds
float getFractionCut(const std::string &AlignableId, const coordType &type) const

◆ serialize()

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

◆ setFloatMap()

void AlignPCLThresholdsHG::setFloatMap ( const param_map floatMap)

Definition at line 27 of file AlignPCLThresholdsHG.cc.

References floatMap_.

27  {
28  floatMap_ = floatMap;
29 }

◆ setFractionCut()

void AlignPCLThresholdsHG::setFractionCut ( const std::string &  AlignableId,
const coordType type,
const float &  cut 
)

Definition at line 43 of file AlignPCLThresholdsHG.cc.

References PA_MinBiasSkim_cff::cut, Exception, floatMap_, FRACTION_CUT_TX, FRACTION_CUT_TY, FRACTION_CUT_TZ, FRACTION_CUT_X, FRACTION_CUT_Y, FRACTION_CUT_Z, FSIZE, AlignPCLThresholdsHGImpl::setParam(), AlignPCLThresholds::theta_X, AlignPCLThresholds::theta_Y, AlignPCLThresholds::theta_Z, AlignPCLThresholds::X, AlignPCLThresholds::Y, and AlignPCLThresholds::Z.

Referenced by AlignPCLThresholdsWriter< T >::storeHGthresholds().

43  {
44  // Set entry in map if not yet available
45  const auto &it = floatMap_.find(AlignableId);
46  if (it == floatMap_.end())
47  floatMap_[AlignableId] = std::vector<float>(FSIZE, -1.);
48 
49  switch (type) {
50  case X:
52  case Y:
54  case Z:
56  case theta_X:
58  case theta_Y:
60  case theta_Z:
62  default:
63  throw cms::Exception("AlignPCLThresholdsHG")
64  << "Requested setting fraction threshold for undefined coordinate" << type << "\n";
65  }
66 }
void setParam(std::vector< T > &params, size_t index, const T &value)

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 52 of file AlignPCLThresholdsHG.h.

◆ cond::serialization::access

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

Definition at line 52 of file AlignPCLThresholdsHG.h.

Member Data Documentation

◆ floatMap_

param_map AlignPCLThresholdsHG::floatMap_
private

◆ intMap_

std::unordered_map<std::string, std::vector<int> > AlignPCLThresholdsHG::intMap_
private

Definition at line 49 of file AlignPCLThresholdsHG.h.

◆ stringMap_

std::unordered_map<std::string, std::vector<std::string> > AlignPCLThresholdsHG::stringMap_
private

Definition at line 50 of file AlignPCLThresholdsHG.h.