CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Friends
LHCOpticalFunctionsSet Class Reference

Set of optical functions corresponding to one scoring plane along LHC. More...

#include <LHCOpticalFunctionsSet.h>

Inheritance diagram for LHCOpticalFunctionsSet:
LHCInterpolatedOpticalFunctionsSet

Public Types

enum  {
  evx, eLx, e14, exd,
  evpx, eLpx, e24, expd,
  e32, evy, eLy, eyd,
  e42, evpy, eLpy, eypd,
  nFunctions
}
 indices for m_fcn_values and m_splines data members More...
 

Public Member Functions

const std::vector< std::vector
< double > > & 
getFcnValues () const
 
double getScoringPlaneZ () const
 returns the position of the scoring plane (LHC/TOTEM convention) More...
 
const std::vector< double > & getXiValues () const
 
 LHCOpticalFunctionsSet ()=default
 
 LHCOpticalFunctionsSet (const std::string &fileName, const std::string &directoryName, double z)
 fills m_*_values fields from a ROOT file More...
 
 ~LHCOpticalFunctionsSet ()=default
 

Protected Attributes

std::vector< std::vector
< double > > 
m_fcn_values
 length unit cm More...
 
std::vector< double > m_xi_values
 
double m_z
 position of the scoring plane, in LHC/TOTEM convention, cm More...
 

Private Member Functions

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

Friends

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

Detailed Description

Set of optical functions corresponding to one scoring plane along LHC.

Definition at line 13 of file LHCOpticalFunctionsSet.h.

Member Enumeration Documentation

anonymous enum

Constructor & Destructor Documentation

LHCOpticalFunctionsSet::LHCOpticalFunctionsSet ( )
default
LHCOpticalFunctionsSet::LHCOpticalFunctionsSet ( const std::string &  fileName,
const std::string &  directoryName,
double  z 
)

fills m_*_values fields from a ROOT file

Definition at line 12 of file LHCOpticalFunctionsSet.cc.

References e14, e24, e32, e42, eLpx, eLpy, eLx, eLy, evpx, evpy, evx, evy, Exception, exd, expd, eyd, eypd, cuy::graphs, m_fcn_values, m_xi_values, nFunctions, pi, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

13  : m_z(z) {
14  TFile *f_in = TFile::Open(fileName.c_str());
15  if (f_in == nullptr)
16  throw cms::Exception("LHCOpticalFunctionsSet") << "Cannot open file " << fileName << ".";
17 
18  std::vector<TGraph *> graphs(nFunctions);
19  for (unsigned int fi = 0; fi < nFunctions; ++fi) {
21  if (fi == evx)
22  tag = "v_x";
23  else if (fi == eLx)
24  tag = "L_x";
25  else if (fi == e14)
26  tag = "E_14";
27  else if (fi == exd)
28  tag = "x_D";
29  else if (fi == evpx)
30  tag = "vp_x";
31  else if (fi == eLpx)
32  tag = "Lp_x";
33  else if (fi == e24)
34  tag = "E_24";
35  else if (fi == expd)
36  tag = "xp_D";
37  else if (fi == e32)
38  tag = "E_32";
39  else if (fi == evy)
40  tag = "v_y";
41  else if (fi == eLy)
42  tag = "L_y";
43  else if (fi == eyd)
44  tag = "y_D";
45  else if (fi == e42)
46  tag = "E_42";
47  else if (fi == evpy)
48  tag = "vp_y";
49  else if (fi == eLpy)
50  tag = "Lp_y";
51  else if (fi == eypd)
52  tag = "yp_D";
53  else
54  throw cms::Exception("LHCOpticalFunctionsSet") << "Invalid tag for optical functions: \"" << fi << "\"";
55 
56  std::string objPath = directoryName + "/g_" + tag + "_vs_xi";
57  auto gr_obj = dynamic_cast<TGraph *>(f_in->Get(objPath.c_str()));
58  if (!gr_obj)
59  throw cms::Exception("LHCOpticalFunctionsSet")
60  << "Cannot load object " << objPath << " from file " << fileName << ".";
61 
62  graphs[fi] = gr_obj;
63  }
64 
65  const unsigned int num_xi_vals = graphs[0]->GetN();
66  m_xi_values.resize(num_xi_vals);
67 
68  m_fcn_values.resize(nFunctions);
69 
70  for (unsigned int fi = 0; fi < nFunctions; ++fi)
71  m_fcn_values[fi].resize(num_xi_vals);
72 
73  for (unsigned int pi = 0; pi < num_xi_vals; ++pi) {
74  const double xi = graphs[0]->GetX()[pi];
75  m_xi_values[pi] = xi;
76 
77  for (unsigned int fi = 0; fi < m_fcn_values.size(); ++fi)
78  m_fcn_values[fi][pi] = graphs[fi]->Eval(xi);
79  }
80 
81  delete f_in;
82 }
list graphs
Definition: cuy.py:961
const Double_t pi
std::vector< double > m_xi_values
std::vector< std::vector< double > > m_fcn_values
length unit cm
double m_z
position of the scoring plane, in LHC/TOTEM convention, cm
LHCOpticalFunctionsSet::~LHCOpticalFunctionsSet ( )
default

Member Function Documentation

const std::vector<std::vector<double> >& LHCOpticalFunctionsSet::getFcnValues ( ) const
inline

Definition at line 29 of file LHCOpticalFunctionsSet.h.

References m_fcn_values.

Referenced by ProtonReconstructionAlgorithm::init(), and CTPPSProtonReconstructionEfficiencyEstimatorData::ArmData::UpdateOptics().

29 { return m_fcn_values; }
std::vector< std::vector< double > > m_fcn_values
length unit cm
double LHCOpticalFunctionsSet::getScoringPlaneZ ( ) const
inline

returns the position of the scoring plane (LHC/TOTEM convention)

Definition at line 26 of file LHCOpticalFunctionsSet.h.

References m_z.

26 { return m_z; }
double m_z
position of the scoring plane, in LHC/TOTEM convention, cm
const std::vector<double>& LHCOpticalFunctionsSet::getXiValues ( ) const
inline
template<class Archive >
void LHCOpticalFunctionsSet::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 38 of file LHCOpticalFunctionsSet.h.

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

Definition at line 38 of file LHCOpticalFunctionsSet.h.

Member Data Documentation

std::vector<std::vector<double> > LHCOpticalFunctionsSet::m_fcn_values
protected
std::vector<double> LHCOpticalFunctionsSet::m_xi_values
protected
double LHCOpticalFunctionsSet::m_z
protected

position of the scoring plane, in LHC/TOTEM convention, cm

Definition at line 33 of file LHCOpticalFunctionsSet.h.

Referenced by getScoringPlaneZ(), and CTPPSInterpolatedOpticalFunctionsESSource::produce().