CMS 3D CMS Logo

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

#include <CSCAlignmentCorrections.h>

Public Member Functions

void applyAlignment (AlignableNavigator *alignableNavigator, AlignmentParameterStore *alignmentParameterStore, int mode, bool combineME11)
 
 CSCAlignmentCorrections (std::string fitterName, double oldchi2, double newchi2)
 
void insertCorrection (std::string name, CSCDetId id, double value)
 
void insertMode (const std::vector< double > &coefficient, const std::vector< std::string > &modename, const std::vector< long > &modeid, double error)
 
void insertResidual (std::string i, std::string j, double before, double uncert, double residual, double pull)
 
void plot ()
 
void report (std::ofstream &report)
 
virtual ~CSCAlignmentCorrections ()
 

Protected Attributes

std::vector< double > m_before
 
std::vector< std::vector< double > > m_coefficient
 
std::vector< double > m_error
 
std::string m_fitterName
 
std::vector< std::string > m_i
 
std::vector< CSCDetIdm_id
 
std::vector< std::string > m_j
 
std::vector< std::vector< long > > m_modeid
 
std::vector< std::vector< std::string > > m_modename
 
std::vector< std::string > m_name
 
double m_newchi2
 
double m_oldchi2
 
std::vector< double > m_pull
 
std::vector< double > m_residual
 
std::vector< double > m_uncert
 
std::vector< double > m_value
 
std::vector< TH1F * > th1f_modes
 

Detailed Description

Date
2010/05/12 21:57:51
Revision
1.2
Author
J. Pivarski - Texas A&M University pivar.nosp@m.ski@.nosp@m.physi.nosp@m.cs.t.nosp@m.amu.e.nosp@m.du

Definition at line 23 of file CSCAlignmentCorrections.h.

Constructor & Destructor Documentation

◆ CSCAlignmentCorrections()

CSCAlignmentCorrections::CSCAlignmentCorrections ( std::string  fitterName,
double  oldchi2,
double  newchi2 
)
inline

Definition at line 25 of file CSCAlignmentCorrections.h.

26  : m_fitterName(fitterName), m_oldchi2(oldchi2), m_newchi2(newchi2){};

◆ ~CSCAlignmentCorrections()

virtual CSCAlignmentCorrections::~CSCAlignmentCorrections ( )
inlinevirtual

Definition at line 27 of file CSCAlignmentCorrections.h.

27 {};

Member Function Documentation

◆ applyAlignment()

void CSCAlignmentCorrections::applyAlignment ( AlignableNavigator alignableNavigator,
AlignmentParameterStore alignmentParameterStore,
int  mode,
bool  combineME11 
)

Definition at line 80 of file CSCAlignmentCorrections.cc.

83  {
84  for (unsigned int i = 0; i < m_name.size(); i++) {
85  // CSC sign conventions
86  bool backward =
87  ((m_id[i].endcap() == 1 && m_id[i].station() >= 3) || (m_id[i].endcap() == 2 && m_id[i].station() < 3));
88 
89  // get the alignable (or two alignables if in ME1/1)
90  const DetId id(m_id[i]);
91  Alignable *alignable = alignableNavigator->alignableFromDetId(id).alignable();
92  Alignable *also = nullptr;
93  if (combineME11 && m_id[i].station() == 1 && m_id[i].ring() == 1) {
94  CSCDetId alsoid(m_id[i].endcap(), 1, 4, m_id[i].chamber(), 0);
95  const DetId alsoid2(alsoid);
96  also = alignableNavigator->alignableFromDetId(alsoid2).alignable();
97  }
98 
100  AlgebraicSymMatrix cov(6);
101 
103  params[4] = m_value[i];
104  cov[4][4] = 1e-6;
106  align::GlobalPoint center = alignable->surface().toGlobal(align::LocalPoint(0., 0., 0.));
107  double radius = sqrt(center.x() * center.x() + center.y() * center.y());
108 
109  double phi_correction = m_value[i];
110  params[0] = -radius * sin(phi_correction) * (backward ? -1. : 1.);
111  params[1] = radius * (cos(phi_correction) - 1.);
112  params[5] = phi_correction * (backward ? -1. : 1.);
113 
114  cov[0][0] = 1e-6;
115  cov[1][1] = 1e-6;
116  cov[5][5] = 1e-6;
118  params[5] = m_value[i] * (backward ? -1. : 1.);
119  cov[5][5] = 1e-6;
120  } else
121  assert(false);
122 
123  AlignmentParameters *parnew = alignable->alignmentParameters()->cloneFromSelected(params, cov);
124  alignable->setAlignmentParameters(parnew);
125  alignmentParameterStore->applyParameters(alignable);
126  alignable->alignmentParameters()->setValid(true);
127  if (also != nullptr) {
129  also->setAlignmentParameters(parnew2);
130  alignmentParameterStore->applyParameters(also);
131  also->alignmentParameters()->setValid(true);
132  }
133  }
134 }

References AlignableDetOrUnitPtr::alignable(), AlignableNavigator::alignableFromDetId(), Alignable::alignmentParameters(), AlignmentParameterStore::applyParameters(), cms::cuda::assert(), relativeConstraints::chamber, AlignmentParameters::cloneFromSelected(), align_cfg::combineME11, funct::cos(), MillePedeFileConverter_cfg::e, makeMuonMisalignmentScenario::endcap, mps_fire::i, triggerObjects_cff::id, CSCPairResidualsConstraint::kModePhiPos, CSCPairResidualsConstraint::kModePhiy, CSCPairResidualsConstraint::kModePhiz, m_id, m_name, m_value, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, CalibrationSummaryClient_cfi::params, CosmicsPD_Skims::radius, relativeConstraints::ring, Alignable::setAlignmentParameters(), AlignmentParameters::setValid(), funct::sin(), mathSSE::sqrt(), relativeConstraints::station, Alignable::surface(), AlignableSurface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

◆ insertCorrection()

void CSCAlignmentCorrections::insertCorrection ( std::string  name,
CSCDetId  id,
double  value 
)
inline

Definition at line 29 of file CSCAlignmentCorrections.h.

29  {
30  m_name.push_back(name);
31  m_id.push_back(id);
32  m_value.push_back(value);
33  };

References m_id, m_name, m_value, and Skims_PA_cff::name.

◆ insertMode()

void CSCAlignmentCorrections::insertMode ( const std::vector< double > &  coefficient,
const std::vector< std::string > &  modename,
const std::vector< long > &  modeid,
double  error 
)
inline

Definition at line 35 of file CSCAlignmentCorrections.h.

38  {
39  m_coefficient.push_back(coefficient);
40  m_modename.push_back(modename);
41  m_modeid.push_back(modeid);
42  m_error.push_back(error);
43  };

References relativeConstraints::error, m_coefficient, m_error, m_modeid, and m_modename.

◆ insertResidual()

void CSCAlignmentCorrections::insertResidual ( std::string  i,
std::string  j,
double  before,
double  uncert,
double  residual,
double  pull 
)
inline

Definition at line 45 of file CSCAlignmentCorrections.h.

45  {
46  m_i.push_back(i);
47  m_j.push_back(j);
48  m_before.push_back(before);
49  m_uncert.push_back(uncert);
50  m_residual.push_back(residual);
51  m_pull.push_back(pull);
52  };

References mps_fire::i, dqmiolumiharvest::j, m_before, m_i, m_j, m_pull, m_residual, and m_uncert.

◆ plot()

void CSCAlignmentCorrections::plot ( )

Definition at line 7 of file CSCAlignmentCorrections.cc.

7  {
8  edm::Service<TFileService> tFileService;
9 
10  for (unsigned int i = 0; i < m_coefficient.size(); i++) {
11  std::string modifiedName = m_fitterName;
12  if (modifiedName[0] == 'M' && modifiedName[1] == 'E') {
13  if (modifiedName[2] == '-')
14  modifiedName[2] = 'm';
15  else if (modifiedName[2] == '+')
16  modifiedName[2] = 'p';
17  if (modifiedName[4] == '/')
18  modifiedName[4] = '_';
19  if (modifiedName[6] == '/')
20  modifiedName[6] = '_';
21  } else if (modifiedName[0] == 'Y' && modifiedName[1] == 'E') {
22  if (modifiedName[2] == '-')
23  modifiedName[2] = 'm';
24  else if (modifiedName[2] == '+')
25  modifiedName[2] = 'p';
26  }
27 
28  std::stringstream histname, histtitle;
29  histname << modifiedName << "_mode_" << i;
30  histtitle << m_error[i];
31 
32  TH1F *hist = tFileService->make<TH1F>(
33  histname.str().c_str(), histtitle.str().c_str(), m_coefficient[i].size(), 0.5, m_coefficient[i].size() + 0.5);
34 
35  bool showed_full_name = false;
36  for (unsigned int j = 0; j < m_coefficient[i].size(); j++) {
37  hist->SetBinContent(j + 1, m_coefficient[i][j]);
38 
39  if (m_modeid[i][j] == -1 || !showed_full_name) {
40  hist->GetXaxis()->SetBinLabel(j + 1, m_modename[i][j].c_str());
41  } else {
42  std::stringstream shortname;
43  shortname << m_modename[i][j][7] << m_modename[i][j][8];
44  hist->GetXaxis()->SetBinLabel(j + 1, shortname.str().c_str());
45  }
46  if (m_modeid[i][j] != -1)
47  showed_full_name = true;
48  }
49 
50  th1f_modes.push_back(hist);
51  }
52 }

References compare::hist, mps_fire::i, dqmiolumiharvest::j, m_coefficient, m_error, m_fitterName, m_modeid, m_modename, TFileService::make(), AlCaHLTBitMon_QueryRunRegistry::string, and th1f_modes.

◆ report()

void CSCAlignmentCorrections::report ( std::ofstream &  report)

Definition at line 54 of file CSCAlignmentCorrections.cc.

54  {
55  report << "cscReports.append(CSCFitterReport(\"" << m_fitterName << "\", " << m_oldchi2 << ", " << m_newchi2 << "))"
56  << std::endl;
57 
58  for (unsigned int i = 0; i < m_name.size(); i++) {
59  report << "cscReports[-1].addChamberCorrection(\"" << m_name[i] << "\", " << m_id[i].rawId() << ", " << m_value[i]
60  << ")" << std::endl;
61  }
62 
63  for (unsigned int i = 0; i < m_coefficient.size(); i++) {
64  report << "cscReports[-1].addErrorMode(" << m_error[i] << ")" << std::endl;
65 
66  for (unsigned int j = 0; j < m_coefficient[i].size(); j++) {
67  report << "cscReports[-1].addErrorModeTerm(\"" << m_modename[i][j] << "\", " << m_modeid[i][j] << ", "
68  << m_coefficient[i][j] << ")" << std::endl;
69  }
70  }
71 
72  for (unsigned int i = 0; i < m_i.size(); i++) {
73  report << "cscReports[-1].addCSCConstraintResidual(\"" << m_i[i] << "\", \"" << m_j[i] << "\", " << m_before[i]
74  << ", " << m_uncert[i] << ", " << m_residual[i] << ", " << m_pull[i] << ")" << std::endl;
75  }
76 
77  report << std::endl;
78 }

References mps_fire::i, dqmiolumiharvest::j, m_before, m_coefficient, m_error, m_fitterName, m_i, m_id, m_j, m_modeid, m_modename, m_name, m_newchi2, m_oldchi2, m_pull, m_residual, m_uncert, and m_value.

Member Data Documentation

◆ m_before

std::vector<double> CSCAlignmentCorrections::m_before
protected

Definition at line 79 of file CSCAlignmentCorrections.h.

Referenced by insertResidual(), and report().

◆ m_coefficient

std::vector<std::vector<double> > CSCAlignmentCorrections::m_coefficient
protected

Definition at line 71 of file CSCAlignmentCorrections.h.

Referenced by insertMode(), plot(), and report().

◆ m_error

std::vector<double> CSCAlignmentCorrections::m_error
protected

Definition at line 74 of file CSCAlignmentCorrections.h.

Referenced by insertMode(), plot(), and report().

◆ m_fitterName

std::string CSCAlignmentCorrections::m_fitterName
protected

Definition at line 62 of file CSCAlignmentCorrections.h.

Referenced by plot(), and report().

◆ m_i

std::vector<std::string> CSCAlignmentCorrections::m_i
protected

Definition at line 77 of file CSCAlignmentCorrections.h.

Referenced by insertResidual(), and report().

◆ m_id

std::vector<CSCDetId> CSCAlignmentCorrections::m_id
protected

Definition at line 67 of file CSCAlignmentCorrections.h.

Referenced by applyAlignment(), insertCorrection(), and report().

◆ m_j

std::vector<std::string> CSCAlignmentCorrections::m_j
protected

Definition at line 78 of file CSCAlignmentCorrections.h.

Referenced by insertResidual(), and report().

◆ m_modeid

std::vector<std::vector<long> > CSCAlignmentCorrections::m_modeid
protected

Definition at line 73 of file CSCAlignmentCorrections.h.

Referenced by insertMode(), plot(), and report().

◆ m_modename

std::vector<std::vector<std::string> > CSCAlignmentCorrections::m_modename
protected

Definition at line 72 of file CSCAlignmentCorrections.h.

Referenced by insertMode(), plot(), and report().

◆ m_name

std::vector<std::string> CSCAlignmentCorrections::m_name
protected

Definition at line 66 of file CSCAlignmentCorrections.h.

Referenced by applyAlignment(), insertCorrection(), and report().

◆ m_newchi2

double CSCAlignmentCorrections::m_newchi2
protected

Definition at line 63 of file CSCAlignmentCorrections.h.

Referenced by report().

◆ m_oldchi2

double CSCAlignmentCorrections::m_oldchi2
protected

Definition at line 63 of file CSCAlignmentCorrections.h.

Referenced by report().

◆ m_pull

std::vector<double> CSCAlignmentCorrections::m_pull
protected

Definition at line 82 of file CSCAlignmentCorrections.h.

Referenced by insertResidual(), and report().

◆ m_residual

std::vector<double> CSCAlignmentCorrections::m_residual
protected

Definition at line 81 of file CSCAlignmentCorrections.h.

Referenced by insertResidual(), and report().

◆ m_uncert

std::vector<double> CSCAlignmentCorrections::m_uncert
protected

Definition at line 80 of file CSCAlignmentCorrections.h.

Referenced by insertResidual(), and report().

◆ m_value

std::vector<double> CSCAlignmentCorrections::m_value
protected

Definition at line 68 of file CSCAlignmentCorrections.h.

Referenced by applyAlignment(), insertCorrection(), and report().

◆ th1f_modes

std::vector<TH1F*> CSCAlignmentCorrections::th1f_modes
protected

Definition at line 84 of file CSCAlignmentCorrections.h.

Referenced by plot().

AlignableDetOrUnitPtr::alignable
Alignable * alignable()
Definition: AlignableDetOrUnitPtr.h:72
CSCAlignmentCorrections::m_newchi2
double m_newchi2
Definition: CSCAlignmentCorrections.h:63
mps_fire.i
i
Definition: mps_fire.py:428
Alignable::setAlignmentParameters
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:123
CSCAlignmentCorrections::report
void report(std::ofstream &report)
Definition: CSCAlignmentCorrections.cc:54
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
relativeConstraints.station
station
Definition: relativeConstraints.py:67
Alignable
Definition: Alignable.h:27
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
CSCAlignmentCorrections::m_modename
std::vector< std::vector< std::string > > m_modename
Definition: CSCAlignmentCorrections.h:72
cms::cuda::assert
assert(be >=bs)
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
relativeConstraints.error
error
Definition: relativeConstraints.py:53
AlignmentParameters
Definition: AlignmentParameters.h:35
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DetId
Definition: DetId.h:17
align_cfg.combineME11
tuple combineME11
Definition: align_cfg.py:32
CSCAlignmentCorrections::m_i
std::vector< std::string > m_i
Definition: CSCAlignmentCorrections.h:77
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
compare.hist
hist
Definition: compare.py:376
AlignmentParameterStore::applyParameters
void applyParameters(void)
Obsolete: Use AlignableNavigator::alignableDetFromDetId and alignableFromAlignableDet.
Definition: AlignmentParameterStore.cc:255
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CSCAlignmentCorrections::m_modeid
std::vector< std::vector< long > > m_modeid
Definition: CSCAlignmentCorrections.h:73
CSCAlignmentCorrections::m_before
std::vector< double > m_before
Definition: CSCAlignmentCorrections.h:79
AlignableSurface::toGlobal
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
Definition: AlignableSurface.cc:15
CSCPairResidualsConstraint::kModePhiy
Definition: CSCPairResidualsConstraint.h:50
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
Point3DBase< Scalar, GlobalTag >
CSCAlignmentCorrections::m_coefficient
std::vector< std::vector< double > > m_coefficient
Definition: CSCAlignmentCorrections.h:71
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CSCPairResidualsConstraint::kModePhiz
Definition: CSCPairResidualsConstraint.h:50
CSCDetId
Definition: CSCDetId.h:26
CSCAlignmentCorrections::m_pull
std::vector< double > m_pull
Definition: CSCAlignmentCorrections.h:82
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
edm::Service< TFileService >
CSCPairResidualsConstraint::kModePhiPos
Definition: CSCPairResidualsConstraint.h:50
value
Definition: value.py:1
CSCAlignmentCorrections::th1f_modes
std::vector< TH1F * > th1f_modes
Definition: CSCAlignmentCorrections.h:84
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
CSCAlignmentCorrections::m_fitterName
std::string m_fitterName
Definition: CSCAlignmentCorrections.h:62
CSCAlignmentCorrections::m_j
std::vector< std::string > m_j
Definition: CSCAlignmentCorrections.h:78
AlignmentParameters::setValid
void setValid(bool v)
Set validity flag.
Definition: AlignmentParameters.cc:137
CSCAlignmentCorrections::m_oldchi2
double m_oldchi2
Definition: CSCAlignmentCorrections.h:63
AlignableNavigator::alignableFromDetId
AlignableDetOrUnitPtr alignableFromDetId(const DetId &detid)
Returns AlignableDetOrUnitPtr corresponding to given DetId.
Definition: AlignableNavigator.cc:91
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
AlignmentParameters::cloneFromSelected
virtual AlignmentParameters * cloneFromSelected(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
CSCAlignmentCorrections::m_uncert
std::vector< double > m_uncert
Definition: CSCAlignmentCorrections.h:80
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
CSCAlignmentCorrections::m_residual
std::vector< double > m_residual
Definition: CSCAlignmentCorrections.h:81
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CSCAlignmentCorrections::m_error
std::vector< double > m_error
Definition: CSCAlignmentCorrections.h:74
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
Alignable::alignmentParameters
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58
CSCAlignmentCorrections::m_id
std::vector< CSCDetId > m_id
Definition: CSCAlignmentCorrections.h:67
CSCAlignmentCorrections::m_value
std::vector< double > m_value
Definition: CSCAlignmentCorrections.h:68
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
CSCAlignmentCorrections::m_name
std::vector< std::string > m_name
Definition: CSCAlignmentCorrections.h:66
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37