#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 (std::vector< double > coefficient, std::vector< std::string > modename, 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< CSCDetId > | m_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 |
CSCAlignmentCorrections::CSCAlignmentCorrections | ( | std::string | fitterName, |
double | oldchi2, | ||
double | newchi2 | ||
) | [inline] |
Definition at line 25 of file CSCAlignmentCorrections.h.
: m_fitterName(fitterName), m_oldchi2(oldchi2), m_newchi2(newchi2) {};
virtual CSCAlignmentCorrections::~CSCAlignmentCorrections | ( | ) | [inline, virtual] |
Definition at line 26 of file CSCAlignmentCorrections.h.
{};
void CSCAlignmentCorrections::applyAlignment | ( | AlignableNavigator * | alignableNavigator, |
AlignmentParameterStore * | alignmentParameterStore, | ||
int | mode, | ||
bool | combineME11 | ||
) |
Definition at line 70 of file CSCAlignmentCorrections.cc.
References AlignableDetOrUnitPtr::alignable(), AlignableNavigator::alignableFromDetId(), Alignable::alignmentParameters(), AlignmentParameterStore::applyParameters(), AlignmentParameters::cloneFromSelected(), funct::cos(), alignCSCRings::e, Reference_intrackfit_cff::endcap, i, CSCPairResidualsConstraint::kModePhiPos, CSCPairResidualsConstraint::kModePhiy, CSCPairResidualsConstraint::kModePhiz, m_id, m_name, m_value, NULL, 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().
{ for (unsigned int i = 0; i < m_name.size(); i++) { // CSC sign conventions bool backward = ((m_id[i].endcap() == 1 && m_id[i].station() >= 3) || (m_id[i].endcap() == 2 && m_id[i].station() < 3)); // get the alignable (or two alignables if in ME1/1) const DetId id(m_id[i]); Alignable *alignable = alignableNavigator->alignableFromDetId(id).alignable(); Alignable *also = NULL; if (combineME11 && m_id[i].station() == 1 && m_id[i].ring() == 1) { CSCDetId alsoid(m_id[i].endcap(), 1, 4, m_id[i].chamber(), 0); const DetId alsoid2(alsoid); also = alignableNavigator->alignableFromDetId(alsoid2).alignable(); } AlgebraicVector params(6); AlgebraicSymMatrix cov(6); if (mode == CSCPairResidualsConstraint::kModePhiy) { params[4] = m_value[i]; cov[4][4] = 1e-6; } else if (mode == CSCPairResidualsConstraint::kModePhiPos) { align::GlobalPoint center = alignable->surface().toGlobal(align::LocalPoint(0., 0., 0.)); double radius = sqrt(center.x()*center.x() + center.y()*center.y()); double phi_correction = m_value[i]; params[0] = -radius * sin(phi_correction) * (backward ? -1. : 1.); params[1] = radius * (cos(phi_correction) - 1.); params[5] = phi_correction * (backward ? -1. : 1.); cov[0][0] = 1e-6; cov[1][1] = 1e-6; cov[5][5] = 1e-6; } else if (mode == CSCPairResidualsConstraint::kModePhiz) { params[5] = m_value[i] * (backward ? -1. : 1.); cov[5][5] = 1e-6; } else assert(false); AlignmentParameters *parnew = alignable->alignmentParameters()->cloneFromSelected(params, cov); alignable->setAlignmentParameters(parnew); alignmentParameterStore->applyParameters(alignable); alignable->alignmentParameters()->setValid(true); if (also != NULL) { AlignmentParameters *parnew2 = also->alignmentParameters()->cloneFromSelected(params, cov); also->setAlignmentParameters(parnew2); alignmentParameterStore->applyParameters(also); also->alignmentParameters()->setValid(true); } } }
void CSCAlignmentCorrections::insertCorrection | ( | std::string | name, |
CSCDetId | id, | ||
double | value | ||
) | [inline] |
void CSCAlignmentCorrections::insertMode | ( | std::vector< double > | coefficient, |
std::vector< std::string > | modename, | ||
std::vector< long > | modeid, | ||
double | error | ||
) | [inline] |
Definition at line 34 of file CSCAlignmentCorrections.h.
References m_coefficient, m_error, m_modeid, and m_modename.
Referenced by CSCChamberFitter::fit().
{ m_coefficient.push_back(coefficient); m_modename.push_back(modename); m_modeid.push_back(modeid); m_error.push_back(error); };
void CSCAlignmentCorrections::insertResidual | ( | std::string | i, |
std::string | j, | ||
double | before, | ||
double | uncert, | ||
double | residual, | ||
double | pull | ||
) | [inline] |
Definition at line 41 of file CSCAlignmentCorrections.h.
References m_before, m_i, m_j, m_pull, m_residual, and m_uncert.
Referenced by CSCChamberFitter::fit().
void CSCAlignmentCorrections::plot | ( | ) |
Definition at line 7 of file CSCAlignmentCorrections.cc.
References estimatePileup::hist, i, j, m_coefficient, m_error, m_fitterName, m_modeid, m_modename, AlCaHLTBitMon_QueryRunRegistry::string, and th1f_modes.
{ edm::Service<TFileService> tFileService; for (unsigned int i = 0; i < m_coefficient.size(); i++) { std::string modifiedName = m_fitterName; if (modifiedName[0] == 'M' && modifiedName[1] == 'E') { if (modifiedName[2] == '-') modifiedName[2] = 'm'; else if (modifiedName[2] == '+') modifiedName[2] = 'p'; if (modifiedName[4] == '/') modifiedName[4] = '_'; if (modifiedName[6] == '/') modifiedName[6] = '_'; } else if (modifiedName[0] == 'Y' && modifiedName[1] == 'E') { if (modifiedName[2] == '-') modifiedName[2] = 'm'; else if (modifiedName[2] == '+') modifiedName[2] = 'p'; } std::stringstream histname, histtitle; histname << modifiedName << "_mode_" << i; histtitle << m_error[i]; TH1F *hist = tFileService->make<TH1F>(histname.str().c_str(), histtitle.str().c_str(), m_coefficient[i].size(), 0.5, m_coefficient[i].size() + 0.5); bool showed_full_name = false; for (unsigned int j = 0; j < m_coefficient[i].size(); j++) { hist->SetBinContent(j+1, m_coefficient[i][j]); if (m_modeid[i][j] == -1 || !showed_full_name) { hist->GetXaxis()->SetBinLabel(j+1, m_modename[i][j].c_str()); } else { std::stringstream shortname; shortname << m_modename[i][j][7] << m_modename[i][j][8]; hist->GetXaxis()->SetBinLabel(j+1, shortname.str().c_str()); } if (m_modeid[i][j] != -1) showed_full_name = true; } th1f_modes.push_back(hist); } }
void CSCAlignmentCorrections::report | ( | std::ofstream & | report | ) |
Definition at line 48 of file CSCAlignmentCorrections.cc.
References i, 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.
{ report << "cscReports.append(CSCFitterReport(\"" << m_fitterName << "\", " << m_oldchi2 << ", " << m_newchi2 << "))" << std::endl; for (unsigned int i = 0; i < m_name.size(); i++) { report << "cscReports[-1].addChamberCorrection(\"" << m_name[i] << "\", " << m_id[i].rawId() << ", " << m_value[i] << ")" << std::endl; } for (unsigned int i = 0; i < m_coefficient.size(); i++) { report << "cscReports[-1].addErrorMode(" << m_error[i] << ")" << std::endl; for (unsigned int j = 0; j < m_coefficient[i].size(); j++) { report << "cscReports[-1].addErrorModeTerm(\"" << m_modename[i][j] << "\", " << m_modeid[i][j] << ", " << m_coefficient[i][j] << ")" << std::endl; } } for (unsigned int i = 0; i < m_i.size(); i++) { report << "cscReports[-1].addCSCConstraintResidual(\"" << m_i[i] << "\", \"" << m_j[i] << "\", " << m_before[i] << ", " << m_uncert[i] << ", " << m_residual[i] << ", " << m_pull[i] << ")" << std::endl; } report << std::endl; }
std::vector<double> CSCAlignmentCorrections::m_before [protected] |
Definition at line 72 of file CSCAlignmentCorrections.h.
Referenced by insertResidual(), and report().
std::vector<std::vector<double> > CSCAlignmentCorrections::m_coefficient [protected] |
Definition at line 64 of file CSCAlignmentCorrections.h.
Referenced by insertMode(), plot(), and report().
std::vector<double> CSCAlignmentCorrections::m_error [protected] |
Definition at line 67 of file CSCAlignmentCorrections.h.
Referenced by insertMode(), plot(), and report().
std::string CSCAlignmentCorrections::m_fitterName [protected] |
Definition at line 55 of file CSCAlignmentCorrections.h.
std::vector<std::string> CSCAlignmentCorrections::m_i [protected] |
Definition at line 70 of file CSCAlignmentCorrections.h.
Referenced by insertResidual(), and report().
std::vector<CSCDetId> CSCAlignmentCorrections::m_id [protected] |
Definition at line 60 of file CSCAlignmentCorrections.h.
Referenced by applyAlignment(), insertCorrection(), and report().
std::vector<std::string> CSCAlignmentCorrections::m_j [protected] |
Definition at line 71 of file CSCAlignmentCorrections.h.
Referenced by insertResidual(), and report().
std::vector<std::vector<long> > CSCAlignmentCorrections::m_modeid [protected] |
Definition at line 66 of file CSCAlignmentCorrections.h.
Referenced by insertMode(), plot(), and report().
std::vector<std::vector<std::string> > CSCAlignmentCorrections::m_modename [protected] |
Definition at line 65 of file CSCAlignmentCorrections.h.
Referenced by insertMode(), plot(), and report().
std::vector<std::string> CSCAlignmentCorrections::m_name [protected] |
Definition at line 59 of file CSCAlignmentCorrections.h.
Referenced by applyAlignment(), insertCorrection(), and report().
double CSCAlignmentCorrections::m_newchi2 [protected] |
Definition at line 56 of file CSCAlignmentCorrections.h.
Referenced by report().
double CSCAlignmentCorrections::m_oldchi2 [protected] |
Definition at line 56 of file CSCAlignmentCorrections.h.
Referenced by report().
std::vector<double> CSCAlignmentCorrections::m_pull [protected] |
Definition at line 75 of file CSCAlignmentCorrections.h.
Referenced by insertResidual(), and report().
std::vector<double> CSCAlignmentCorrections::m_residual [protected] |
Definition at line 74 of file CSCAlignmentCorrections.h.
Referenced by insertResidual(), and report().
std::vector<double> CSCAlignmentCorrections::m_uncert [protected] |
Definition at line 73 of file CSCAlignmentCorrections.h.
Referenced by insertResidual(), and report().
std::vector<double> CSCAlignmentCorrections::m_value [protected] |
Definition at line 61 of file CSCAlignmentCorrections.h.
Referenced by applyAlignment(), insertCorrection(), and report().
std::vector<TH1F*> CSCAlignmentCorrections::th1f_modes [protected] |
Definition at line 77 of file CSCAlignmentCorrections.h.
Referenced by plot().