|
|
Go to the documentation of this file.
3 #include "CLHEP/Vector/RotationInterfaces.h"
34 #include "CLHEP/Vector/ThreeVector.h"
46 _commonMuonLevel(
align::invalid),
48 idealInputLabel1(
"MuonGeometryArrangeLabel1"),
49 idealInputLabel2(
"MuonGeometryArrangeLabel2"),
50 idealInputLabel2a(
"MuonGeometryArrangeLabel2a") {
70 _endcap =
cfg.getUntrackedParameter<
int>(
"endcapNumber");
71 _station =
cfg.getUntrackedParameter<
int>(
"stationNumber");
72 _ring =
cfg.getUntrackedParameter<
int>(
"ringNumber");
79 while (!
fin.eof() &&
fin.good()) {
88 unsigned int lastID = 999999999;
93 while (!inFile.eof()) {
97 inFile.ignore(256,
'\n');
98 if (listId != lastID) {
108 _alignTree =
new TTree(
"alignTree",
"alignTree");
157 std::vector<float> xp(
size + 1);
158 std::vector<float> yp(
size + 1);
167 TGraph* grx =
nullptr;
188 float smi =
minI - 1;
189 float sma =
maxI + 1;
210 "Local #delta X vs position",
236 "Local #delta Y vs position",
263 "Local #delta Z vs position",
289 "delphi_vs_position",
290 "#delta #phi vs position",
291 "Gdelphi_vs_position",
292 "#delta #phi in radians",
317 "#delta R vs position",
344 "delRphi_vs_position",
345 "R #delta #phi vs position",
346 "GdelRphi_vs_position",
347 "R #delta #phi in cm",
371 "delalpha_vs_position",
372 "#delta #alpha vs position",
373 "Gdelalpha_vs_position",
374 "#delta #alpha in rad",
398 "delbeta_vs_position",
399 "#delta #beta vs position",
400 "Gdelbeta_vs_position",
401 "#delta #beta in rad",
425 "delgamma_vs_position",
426 "#delta #gamma vs position",
427 "Gdelgamma_vs_position",
428 "#delta #gamma in rad",
452 "delrotX_vs_position",
453 "#delta rotX vs position",
454 "GdelrotX_vs_position",
455 "#delta rotX in rad",
479 "delrotY_vs_position",
480 "#delta rotY vs position",
481 "GdelrotY_vs_position",
482 "#delta rotY in rad",
506 "delrotZ_vs_position",
507 "#delta rotZ vs position",
508 "GdelrotZ_vs_position",
509 "#delta rotZ in rad",
519 float maxR = -9999999.;
530 float smallestVcm = .001;
531 if (maxV < smallestVcm)
534 float lside = 1.1 * maxR;
538 scale = .09 * lside / maxV;
541 int ret = snprintf(scalename, 50,
"#delta #bar{x} length =%f cm", maxV);
545 dxh =
new TH2F(
"vecdrplot", scalename, 80, -lside, lside, 80, -lside, lside);
547 dxh =
new TH2F(
"vecdrplot",
"delta #bar{x} Bad scale", 80, -lside, lside, 80, -lside, lside);
549 dxh->GetXaxis()->SetTitle(
"x in cm");
550 dxh->GetYaxis()->SetTitle(
"y in cm");
551 dxh->SetStats(kFALSE);
560 arrow->SetLineWidth(2);
561 arrow->SetArrowSize(ttemp * .2 * .05 / maxV);
562 arrow->SetLineColor(1);
563 arrow->SetLineStyle(1);
565 dxh->GetListOfFunctions()->Add(static_cast<TObject*>(arrow));
589 if (minV >= maxV || smi >= sma || sizeI <= 1 || xp ==
nullptr || yp ==
nullptr)
592 float diff = maxV - minV;
593 float over = .05 *
diff;
594 double ylo = minV - over;
595 double yhi = maxV + over;
599 dxh =
new TH2F(
name,
title, sizeI + 2, dsmi, dsma, 50, ylo, yhi);
600 dxh->GetXaxis()->SetTitle(
"Position around ring");
601 dxh->GetYaxis()->SetTitle(axis);
602 dxh->SetStats(kFALSE);
604 grx =
new TGraph(
size, xp, yp);
605 grx->SetName(titleg);
606 grx->SetTitle(
title);
607 grx->SetMarkerColor(2);
608 grx->SetMarkerStyle(3);
609 grx->GetXaxis()->SetLimits(dsmi, dsma);
610 grx->GetXaxis()->SetTitle(
"position number");
611 grx->GetYaxis()->SetLimits(ylo, yhi);
612 grx->GetYaxis()->SetTitle(axis);
643 theLevels.push_back(inputGeometry2Copy2->objectIdProvider().stringToId(
level));
664 if (refAli ==
nullptr) {
667 if (curAli ==
nullptr) {
673 const auto& curComp2 = curAliCopy2->
components();
676 int nComp = refComp.size();
677 for (
int i = 0;
i < nComp;
i++) {
686 if (refAli ==
nullptr) {
689 if (curAli ==
nullptr) {
703 if (refComp.size() != curComp.size()) {
712 int nComp = refComp.size();
715 CLHEP::Hep3Vector TotalX, TotalL;
716 TotalX.set(0., 0., 0.);
717 TotalL.set(0., 0., 0.);
719 std::vector<CLHEP::Hep3Vector> Positions;
720 std::vector<CLHEP::Hep3Vector> DelPositions;
722 double xrcenter = 0.;
723 double yrcenter = 0.;
724 double zrcenter = 0.;
725 double xccenter = 0.;
726 double yccenter = 0.;
727 double zccenter = 0.;
732 for (
int ich = 0; ich < nComp; ich++) {
743 originalVectors.push_back(pointsCM);
745 xrcenter += pointsCM.
x();
746 yrcenter += pointsCM.
y();
747 zrcenter += pointsCM.
z();
749 xrcenter = xrcenter / nUsed;
750 yrcenter = yrcenter / nUsed;
751 zrcenter = zrcenter / nUsed;
755 for (
int ich = 0; ich < nComp; ich++) {
766 currentVectors.push_back(pointsCM);
768 xccenter += pointsCM.
x();
769 yccenter += pointsCM.
y();
770 zccenter += pointsCM.
z();
772 xccenter = xccenter / nUsed;
773 yccenter = yccenter / nUsed;
774 zccenter = zccenter / nUsed;
779 int nCompR = currentVectors.size();
780 for (
int ich = 0; ich < nCompR; ich++) {
781 originalRelativeVectors.push_back(originalVectors[ich] - CRef);
782 currentRelativeVectors.push_back(currentVectors[ich] - CCur);
794 for (
int ich = 0; ich < nComp; ich++) {
799 CLHEP::Hep3Vector Rtotal, Wtotal;
800 Rtotal.set(0., 0., 0.);
801 Wtotal.set(0., 0., 0.);
802 for (
int i = 0;
i < 100;
i++) {
808 CLHEP::HepRotation
rot(Wtotal.unit(), Wtotal.mag());
809 CLHEP::HepRotation drot(dW.unit(), dW.mag());
811 Wtotal.set(
rot.axis().x() *
rot.delta(),
rot.axis().y() *
rot.delta(),
rot.axis().z() *
rot.delta());
818 DetId detid(refComp[ich]->
id());
832 TotalX = TotalX / nUsed;
836 change(1) = TotalX.x();
837 change(2) = TotalX.y();
838 change(3) = TotalX.z();
848 for (
int ich = 0; ich < nComp; ich++) {
849 CLHEP::Hep3Vector Rtotal, Wtotal;
850 Rtotal.set(0., 0., 0.);
851 Wtotal.set(0., 0., 0.);
857 for (
int i = 0;
i < 100;
i++) {
863 CLHEP::HepRotation
rot(Wtotal.unit(), Wtotal.mag());
864 CLHEP::HepRotation drot(dW.unit(), dW.mag());
866 Wtotal.set(
rot.axis().x() *
rot.delta(),
rot.axis().y() *
rot.delta(),
rot.axis().z() *
rot.delta());
879 TRtot(1) = Rtotal.x();
880 TRtot(2) = Rtotal.y();
881 TRtot(3) = Rtotal.z();
882 TRtot(4) = Wtotal.x();
883 TRtot(5) = Wtotal.y();
884 TRtot(6) = Wtotal.z();
904 int ringPhiPos = -99;
919 float ttt = -
rot.xz();
950 double xx =
rot.xx();
951 double xy =
rot.xy();
952 double xz =
rot.xz();
953 double yx =
rot.yx();
954 double yy =
rot.yy();
955 double yz =
rot.yz();
956 double zx =
rot.zx();
957 double zy =
rot.zy();
958 double zz =
rot.zz();
959 double detrot = (
zz *
yy - zy *
yz) *
xx + (-
zz * yx + zx *
yz) *
xy + (zy * yx - zx *
yy) *
xz;
961 double ixx = (
zz *
yy - zy *
yz) * detrot;
962 double ixy = (-
zz *
xy + zy *
xz) * detrot;
963 double ixz = (
yz *
xy -
yy *
xz) * detrot;
964 double iyx = (-
zz * yx + zx *
yz) * detrot;
965 double iyy = (
zz *
xx - zx *
xz) * detrot;
966 double iyz = (-
yz *
xx + yx *
xz) * detrot;
967 double izx = (zy * yx - zx *
yy) * detrot;
968 double izy = (-zy *
xx + zx *
xy) * detrot;
969 double izz = (
yy *
xx - yx *
xy) * detrot;
974 protx = atan2(prot.
yz(), prot.
zz());
1085 for (
int i = 0;
i < 9;
i++) {
1088 holdit.
phipos = ringPhiPos;
1102 int size = aliComp.size();
1106 for (
int i = 0;
i <
size;
i++) {
1128 std::cout <<
"JNB " << ali->
id() <<
" " << cscId.endcap() <<
" " << cscId.station() <<
" " << cscId.ring() <<
" "
1158 int size = aliComp.size();
1162 for (
int i = 0;
i <
size;
i++) {
1178 for (
int i = 0;
i < nEntries;
i++) {
ret
prodAgent to be discontinued
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
std::string _inputTreename
void analyze(const edm::Event &, const edm::EventSetup &) override
void compareGeometries(Alignable *refAli, Alignable *curAli, Alignable *curAliCopy2)
MuonAlignment * inputAlign2
std::vector< unsigned int > _weightByIdVector
std::string _inputXMLReference
constexpr Detector det() const
get the detector field from this detid
void moveAlignable(Alignable *ali, AlgebraicVector diff)
Moves the alignable by the AlgebraicVector.
bool readModuleList(unsigned int, unsigned int, const std::vector< unsigned int > &)
Log< level::Info, false > LogInfo
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
align::Scalar length() const
bool checkChosen(Alignable *ali)
MuonAlignment * inputAlign1
MuonAlignment * inputAlign2a
#define DEFINE_FWK_MODULE(type)
CLHEP::HepVector AlgebraicVector
void createPoints(GlobalVectors *Vs, Alignable *ali, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
void fillGapsInSurvey(double shiftErr, double angleErr)
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
std::string _inputFilename2
GlobalVector centerOfMass(const GlobalVectors &theVs)
Find the CM of a set of points.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
void beginJob() override
Read from DB and print survey info.
std::string _detIdFlagFile
Alignable * inputGeometry2
std::string _weightByIdFile
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
std::string _inputXMLCurrent
std::string idealInputLabel2a
Alignable * inputGeometry1
bool isMother(Alignable *ali)
bool passChosen(Alignable *ali)
const DetId & geomDetId() const
std::vector< GlobalVector > GlobalVectors
AlgebraicVector EulerAngles
RotationType diffRot(const GlobalVectors ¤t, const GlobalVectors &nominal)
std::string idealInputLabel1
void makeGraph(int sizeI, float smi, float sma, float minV, float maxV, TH2F *dxh, TGraph *grx, const char *name, const char *title, const char *titleg, const char *axis, const float *xp, const float *yp, int numEntries)
MuonGeometryArrange(const edm::ParameterSet &)
Do nothing. Required by framework.
void compare(Alignable *refAli, Alignable *curAli, Alignable *curAliCopy2)
AlignableMuon * currentMuon
constexpr uint32_t rawId() const
get the raw id
void createROOTGeometry(const edm::EventSetup &iSetup)
align::Scalar width() const
std::vector< MGACollection > _mgacollection
std::string idealInputLabel2
std::string _inputFilename1
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
AlignableMuon * getAlignableMuon()
AlgebraicVector diffAlignables(Alignable *refAli, Alignable *curAli, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
std::vector< align::StructureType > theLevels
const std::vector< std::string > _levelStrings
const PositionType & globalPosition() const
Return the global position of the object.
void fillTree(Alignable *refAli, const AlgebraicVector &diff)
AlignableMuon * referenceMuon
virtual const Alignables & components() const =0
Return vector of all direct components.
std::vector< uint32_t > _detIdFlagVector
Geom::Phi< T > phi() const
const RotationType & globalRotation() const
Return the global orientation of the object.
Alignable * mother() const
Return pointer to container alignable (if any)