test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LASBarrelAlignmentParameterSet.cc
Go to the documentation of this file.
1 
3 
4 
5 
10 
11  Init();
12 
13 }
14 
15 
16 
17 
18 
23 
24  // could use a single vector<vector<vector<pair<> > > >
25  // but better split it in 6 parts
26  for( int i = 0; i < 2; ++i ) { // twice; once for each endface
27  tecPlusParameters.push_back ( std::vector<std::pair<double,double> >( 3 ) );
28  tecMinusParameters.push_back( std::vector<std::pair<double,double> >( 3 ) );
29  tibPlusParameters.push_back ( std::vector<std::pair<double,double> >( 3 ) );
30  tibMinusParameters.push_back( std::vector<std::pair<double,double> >( 3 ) );
31  tobPlusParameters.push_back ( std::vector<std::pair<double,double> >( 3 ) );
32  tobMinusParameters.push_back( std::vector<std::pair<double,double> >( 3 ) );
33  }
34 
35  // the beam parameters (8 beams * 2 pars) are stored in one single container
36  for( int i = 0; i < 8; ++i ) {
37  beamParameters.push_back( std::vector<std::pair<double,double> >( 2 ) );
38  }
39 
40 }
41 
42 
43 
44 
45 
53 std::pair<double,double>& LASBarrelAlignmentParameterSet::GetParameter( int aSubdetector, int aDisk, int aParameter ) {
54 
55  if( aSubdetector < 0 || aSubdetector > 5 ) {
56  throw cms::Exception( "Laser Alignment" ) << " [LASBarrelAlignmentParameterSet::GetParameter] ERROR ** Illegal subdetector index: " << aSubdetector << "." << std::endl;
57  }
58 
59  if( aDisk < 0 || aDisk > 1 ) {
60  throw cms::Exception( "Laser Alignment" ) << " [LASBarrelAlignmentParameterSet::GetParameter] ERROR ** Illegal endface index: " << aDisk << "." << std::endl;
61  }
62 
63  if( aParameter < 0 || aParameter > 2 ) {
64  throw cms::Exception( "Laser Alignment" ) << " [LASBarrelAlignmentParameterSet::GetParameter] ERROR ** Illegal parameter index: " << aParameter << "." << std::endl;
65  }
66 
67 
68  // would use a switch here, but this creates problems..
69  if( aSubdetector == 0 ) return tecPlusParameters.at( aDisk ).at( aParameter );
70  else if( aSubdetector == 1 ) return tecMinusParameters.at( aDisk ).at( aParameter );
71  else if( aSubdetector == 2 ) return tibPlusParameters.at( aDisk ).at( aParameter );
72  else if( aSubdetector == 3 ) return tibMinusParameters.at( aDisk ).at( aParameter );
73  else if( aSubdetector == 4 ) return tobPlusParameters.at( aDisk ).at( aParameter );
74  else return tobMinusParameters.at( aDisk ).at( aParameter );
75 
76 
77 }
78 
79 
80 
81 
82 
87 std::pair<double,double>& LASBarrelAlignmentParameterSet::GetBeamParameter( int aBeam, int aParameter ) {
88 
89  if( aBeam < 0 || aBeam > 7 ) {
90  throw cms::Exception( "Laser Alignment" ) << " [LASBarrelAlignmentParameterSet::GetBeamParameter] ERROR ** Illegal beam index: " << aBeam << "." << std::endl;
91  }
92 
93  if( aParameter < 0 || aParameter > 1 ) {
94  throw cms::Exception( "Laser Alignment" ) << " [LASBarrelAlignmentParameterSet::GetBeamParameter] ERROR ** Illegal beam parameter index: " << aParameter << "." << std::endl;
95  }
96 
97  return beamParameters.at( aBeam ).at( aParameter );
98 
99 }
100 
101 
102 
103 
104 
109 
110  std::cout << std::endl << " [LASBarrelAlignmentParameterSet::Print] -- Parameter list [rad/mm]: " << std::endl;
111 
112  const std::string subdetNames[6] = { " TEC+ ", " TEC- ", " TIB+ ", " TIB- ", " TOB+ ", " TOB- " };
113 
114  std::cout << " Detector parameters: " << std::endl;
115  std::cout << " --------------------" << std::endl;
116  std::cout << " Values: PHI1 X1 Y1 PHI2 X2 Y2 " << std::endl;
117  for( int subdet = 0; subdet < 6; ++subdet ) {
118  std::cout <<subdetNames[subdet];
119  for( int par = 0; par < 3; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetParameter( subdet, 0, par ).first;
120  for( int par = 0; par < 3; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetParameter( subdet, 1, par ).first;
121  std::cout << std::endl;
122  }
123 
124  std::cout << " Errors: PHI1 X1 Y1 PHI2 X2 Y2 " << std::endl;
125  for( int subdet = 0; subdet < 6; ++subdet ) {
126  std::cout <<subdetNames[subdet];
127  for( int par = 0; par < 3; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetParameter( subdet, 0, par ).second;
128  for( int par = 0; par < 3; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetParameter( subdet, 1, par ).second;
129  std::cout << std::endl;
130  }
131 
132  std::cout << std::endl;
133  std::cout << " Beam parameters: " << std::endl;
134  std::cout << " ----------------" << std::endl;
135  std::cout << " Values: PHI1 PHI2" << std::endl;
136  for( int beam = 0; beam < 8; ++beam ) {
137  std::cout << " beam " << beam;
138  for( int par = 0; par < 2; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetBeamParameter( beam, par ).first;
139  std::cout << std::endl;
140  }
141 
142  std::cout << " Errors: PHI1 PHI2" << std::endl;
143  for( int beam = 0; beam < 8; ++beam ) {
144  std::cout << " beam " << beam;
145  for( int par = 0; par < 2; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetBeamParameter( beam, par ).second;
146  std::cout << std::endl;
147  }
148 
149  std::cout << " [LASBarrelAlignmentParameterSet::Print] -- End parameter list." << std::endl;
150 
151 }
std::pair< double, double > & GetParameter(int aSubdetector, int aDisk, int aParameter)
int i
Definition: DBlmapReader.cc:9
std::vector< std::vector< std::pair< double, double > > > tecPlusParameters
std::vector< std::vector< std::pair< double, double > > > tobPlusParameters
std::vector< std::vector< std::pair< double, double > > > tobMinusParameters
std::vector< std::vector< std::pair< double, double > > > tibMinusParameters
std::pair< double, double > & GetBeamParameter(int aBeam, int aParameter)
std::vector< std::vector< std::pair< double, double > > > beamParameters
std::vector< std::vector< std::pair< double, double > > > tecMinusParameters
std::vector< std::vector< std::pair< double, double > > > tibPlusParameters
tuple cout
Definition: gather_cfg.py:121