CMS 3D CMS Logo

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, GlobalPosition_Frontier_DevDB_cff::tag, and hybridSuperClusters_cfi::xi.

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

References m_fcn_values.

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

30 { 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 27 of file LHCOpticalFunctionsSet.h.

References m_z.

27 { 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 39 of file LHCOpticalFunctionsSet.h.

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

Definition at line 39 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 34 of file LHCOpticalFunctionsSet.h.

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