File indexing completed on 2024-04-06 11:56:01
0001
0002
0003
0004
0005
0006
0007
0008 #include "Alignment/CocoaModel/interface/EntryLengthAffCentre.h"
0009 #include "Alignment/CocoaModel/interface/OpticalObject.h"
0010 #include "Alignment/CocoaUtilities/interface/ALIUtils.h"
0011
0012
0013 EntryLengthAffCentre::EntryLengthAffCentre(const ALIstring& type) : EntryLength(type) {}
0014
0015
0016 void EntryLengthAffCentre::FillName(const ALIstring& name) {
0017 ALIstring nn = "Centre ";
0018 nn += name;
0019 setName(nn);
0020 }
0021
0022
0023
0024
0025 void EntryLengthAffCentre::displace(ALIdouble disp) {
0026 if (ALIUtils::debug >= 9)
0027 std::cout << "EntryLengthAffCentre::Displace" << disp << std::endl;
0028 ALIint namelength = name().length() - 1;
0029 XYZcoor axisNo = XCoor;
0030 if (name_[namelength] == 'X') {
0031 axisNo = XCoor;
0032 } else if (name_[namelength] == 'Y') {
0033 axisNo = YCoor;
0034 } else if (name_[namelength] == 'Z') {
0035 axisNo = ZCoor;
0036 }
0037 OptOCurrent()->displaceCentreGlob(axisNo, disp);
0038 }
0039
0040
0041 void EntryLengthAffCentre::displaceOriginal(ALIdouble disp) {
0042 if (ALIUtils::debug >= 9)
0043 std::cout << "EntryLengthAffCentre::DisplaceOriginal" << disp << std::endl;
0044 ALIint namelength = name().length() - 1;
0045 if (name_[namelength] == 'X') {
0046 OptOCurrent()->displaceCentreGlobOriginal(XCoor, disp);
0047 } else if (name_[namelength] == 'Y') {
0048 OptOCurrent()->displaceCentreGlobOriginal(YCoor, disp);
0049 } else if (name_[namelength] == 'Z') {
0050 OptOCurrent()->displaceCentreGlobOriginal(ZCoor, disp);
0051 }
0052 }
0053
0054
0055 void EntryLengthAffCentre::displaceOriginalOriginal(ALIdouble disp) {
0056 if (ALIUtils::debug >= 9)
0057 std::cout << "EntryLengthAffCentre::DisplaceOriginalOriginal" << disp << std::endl;
0058 ALIint namelength = name().length() - 1;
0059 if (name_[namelength] == 'X') {
0060 OptOCurrent()->displaceCentreGlobOriginalOriginal(XCoor, disp);
0061 } else if (name_[namelength] == 'Y') {
0062 OptOCurrent()->displaceCentreGlobOriginalOriginal(YCoor, disp);
0063 } else if (name_[namelength] == 'Z') {
0064 OptOCurrent()->displaceCentreGlobOriginalOriginal(ZCoor, disp);
0065 }
0066 }
0067
0068
0069 ALIdouble EntryLengthAffCentre::valueInGlobalReferenceFrame() const {
0070 ALIdouble a = 2.;
0071
0072 return a;
0073 }
0074
0075
0076 ALIdouble EntryLengthAffCentre::valueDisplaced() const {
0077 ALIdouble vdisp = 0.;
0078
0079 CLHEP::Hep3Vector cdisp = OptOCurrent()->centreGlob() - OptOCurrent()->centreGlobOriginal();
0080 CLHEP::HepRotation rmParentInv = inverseOf(OptOCurrent()->parent()->rmGlob());
0081 cdisp = rmParentInv * cdisp;
0082
0083 if (name() == "centre_X") {
0084 return cdisp.x();
0085 } else if (name() == "centre_Y") {
0086 return cdisp.y();
0087
0088 } else if (name() == "centre_Z") {
0089 return cdisp.z();
0090 }
0091
0092 if (ALIUtils::debug >= 5)
0093 std::cout << name() << " in OptO " << OptOCurrent()->name() << " valueDisplaced: " << vdisp << std::endl;
0094
0095 return 0.;
0096 }