|
|
Go to the documentation of this file.
3 #include "CLHEP/Vector/RotationInterfaces.h"
34 #include "CLHEP/Vector/ThreeVector.h"
44 _levelStrings(
cfg.getUntrackedParameter<
std::vector<
std::
string> >(
"levels")),
46 _commonMuonLevel(
align::invalid),
67 _endcap =
cfg.getUntrackedParameter<
int>(
"endcapNumber");
68 _station =
cfg.getUntrackedParameter<
int>(
"stationNumber");
69 _ring =
cfg.getUntrackedParameter<
int>(
"ringNumber");
76 while (!
fin.eof() &&
fin.good()) {
85 unsigned int lastID = 999999999;
90 while (!inFile.eof()) {
94 inFile.ignore(256,
'\n');
95 if (listId != lastID) {
105 _alignTree =
new TTree(
"alignTree",
"alignTree");
154 std::vector<float> xp(
size + 1);
155 std::vector<float> yp(
size + 1);
164 TGraph* grx =
nullptr;
185 float smi =
minI - 1;
186 float sma =
maxI + 1;
207 "Local #delta X vs position",
233 "Local #delta Y vs position",
260 "Local #delta Z vs position",
286 "delphi_vs_position",
287 "#delta #phi vs position",
288 "Gdelphi_vs_position",
289 "#delta #phi in radians",
314 "#delta R vs position",
341 "delRphi_vs_position",
342 "R #delta #phi vs position",
343 "GdelRphi_vs_position",
344 "R #delta #phi in cm",
368 "delalpha_vs_position",
369 "#delta #alpha vs position",
370 "Gdelalpha_vs_position",
371 "#delta #alpha in rad",
395 "delbeta_vs_position",
396 "#delta #beta vs position",
397 "Gdelbeta_vs_position",
398 "#delta #beta in rad",
422 "delgamma_vs_position",
423 "#delta #gamma vs position",
424 "Gdelgamma_vs_position",
425 "#delta #gamma in rad",
449 "delrotX_vs_position",
450 "#delta rotX vs position",
451 "GdelrotX_vs_position",
452 "#delta rotX in rad",
476 "delrotY_vs_position",
477 "#delta rotY vs position",
478 "GdelrotY_vs_position",
479 "#delta rotY in rad",
503 "delrotZ_vs_position",
504 "#delta rotZ vs position",
505 "GdelrotZ_vs_position",
506 "#delta rotZ in rad",
516 float maxR = -9999999.;
527 float smallestVcm = .001;
528 if (maxV < smallestVcm)
531 float lside = 1.1 * maxR;
535 scale = .09 * lside / maxV;
538 int ret = snprintf(scalename, 50,
"#delta #bar{x} length =%f cm", maxV);
542 dxh =
new TH2F(
"vecdrplot", scalename, 80, -lside, lside, 80, -lside, lside);
544 dxh =
new TH2F(
"vecdrplot",
"delta #bar{x} Bad scale", 80, -lside, lside, 80, -lside, lside);
546 dxh->GetXaxis()->SetTitle(
"x in cm");
547 dxh->GetYaxis()->SetTitle(
"y in cm");
548 dxh->SetStats(kFALSE);
557 arrow->SetLineWidth(2);
558 arrow->SetArrowSize(ttemp * .2 * .05 / maxV);
559 arrow->SetLineColor(1);
560 arrow->SetLineStyle(1);
562 dxh->GetListOfFunctions()->Add(static_cast<TObject*>(arrow));
586 if (minV >= maxV || smi >= sma || sizeI <= 1 || xp ==
nullptr || yp ==
nullptr)
589 float diff = maxV - minV;
590 float over = .05 *
diff;
591 double ylo = minV - over;
592 double yhi = maxV + over;
596 dxh =
new TH2F(
name,
title, sizeI + 2, dsmi, dsma, 50, ylo, yhi);
597 dxh->GetXaxis()->SetTitle(
"Position around ring");
598 dxh->GetYaxis()->SetTitle(axis);
599 dxh->SetStats(kFALSE);
601 grx =
new TGraph(
size, xp, yp);
602 grx->SetName(titleg);
603 grx->SetTitle(
title);
604 grx->SetMarkerColor(2);
605 grx->SetMarkerStyle(3);
606 grx->GetXaxis()->SetLimits(dsmi, dsma);
607 grx->GetXaxis()->SetTitle(
"position number");
608 grx->GetYaxis()->SetLimits(ylo, yhi);
609 grx->GetYaxis()->SetTitle(axis);
640 theLevels.push_back(inputGeometry2Copy2->objectIdProvider().stringToId(
level));
661 if (refAli ==
nullptr) {
664 if (curAli ==
nullptr) {
670 const auto& curComp2 = curAliCopy2->
components();
673 int nComp = refComp.size();
674 for (
int i = 0;
i < nComp;
i++) {
683 if (refAli ==
nullptr) {
686 if (curAli ==
nullptr) {
700 if (refComp.size() != curComp.size()) {
709 int nComp = refComp.size();
712 CLHEP::Hep3Vector TotalX, TotalL;
713 TotalX.set(0., 0., 0.);
714 TotalL.set(0., 0., 0.);
716 std::vector<CLHEP::Hep3Vector> Positions;
717 std::vector<CLHEP::Hep3Vector> DelPositions;
719 double xrcenter = 0.;
720 double yrcenter = 0.;
721 double zrcenter = 0.;
722 double xccenter = 0.;
723 double yccenter = 0.;
724 double zccenter = 0.;
729 for (
int ich = 0; ich < nComp; ich++) {
740 originalVectors.push_back(pointsCM);
742 xrcenter += pointsCM.
x();
743 yrcenter += pointsCM.
y();
744 zrcenter += pointsCM.
z();
746 xrcenter = xrcenter / nUsed;
747 yrcenter = yrcenter / nUsed;
748 zrcenter = zrcenter / nUsed;
752 for (
int ich = 0; ich < nComp; ich++) {
763 currentVectors.push_back(pointsCM);
765 xccenter += pointsCM.
x();
766 yccenter += pointsCM.
y();
767 zccenter += pointsCM.
z();
769 xccenter = xccenter / nUsed;
770 yccenter = yccenter / nUsed;
771 zccenter = zccenter / nUsed;
776 int nCompR = currentVectors.size();
777 for (
int ich = 0; ich < nCompR; ich++) {
778 originalRelativeVectors.push_back(originalVectors[ich] - CRef);
779 currentRelativeVectors.push_back(currentVectors[ich] - CCur);
791 for (
int ich = 0; ich < nComp; ich++) {
796 CLHEP::Hep3Vector Rtotal, Wtotal;
797 Rtotal.set(0., 0., 0.);
798 Wtotal.set(0., 0., 0.);
799 for (
int i = 0;
i < 100;
i++) {
805 CLHEP::HepRotation
rot(Wtotal.unit(), Wtotal.mag());
806 CLHEP::HepRotation drot(dW.unit(), dW.mag());
808 Wtotal.set(
rot.axis().x() *
rot.delta(),
rot.axis().y() *
rot.delta(),
rot.axis().z() *
rot.delta());
815 DetId detid(refComp[ich]->
id());
829 TotalX = TotalX / nUsed;
833 change(1) = TotalX.x();
834 change(2) = TotalX.y();
835 change(3) = TotalX.z();
845 for (
int ich = 0; ich < nComp; ich++) {
846 CLHEP::Hep3Vector Rtotal, Wtotal;
847 Rtotal.set(0., 0., 0.);
848 Wtotal.set(0., 0., 0.);
854 for (
int i = 0;
i < 100;
i++) {
860 CLHEP::HepRotation
rot(Wtotal.unit(), Wtotal.mag());
861 CLHEP::HepRotation drot(dW.unit(), dW.mag());
863 Wtotal.set(
rot.axis().x() *
rot.delta(),
rot.axis().y() *
rot.delta(),
rot.axis().z() *
rot.delta());
876 TRtot(1) = Rtotal.x();
877 TRtot(2) = Rtotal.y();
878 TRtot(3) = Rtotal.z();
879 TRtot(4) = Wtotal.x();
880 TRtot(5) = Wtotal.y();
881 TRtot(6) = Wtotal.z();
901 int ringPhiPos = -99;
916 float ttt = -
rot.xz();
947 double xx =
rot.xx();
948 double xy =
rot.xy();
949 double xz =
rot.xz();
950 double yx =
rot.yx();
951 double yy =
rot.yy();
952 double yz =
rot.yz();
953 double zx =
rot.zx();
954 double zy =
rot.zy();
955 double zz =
rot.zz();
956 double detrot = (
zz *
yy - zy *
yz) *
xx + (-
zz * yx + zx *
yz) *
xy + (zy * yx - zx *
yy) *
xz;
958 double ixx = (
zz *
yy - zy *
yz) * detrot;
959 double ixy = (-
zz *
xy + zy *
xz) * detrot;
960 double ixz = (
yz *
xy -
yy *
xz) * detrot;
961 double iyx = (-
zz * yx + zx *
yz) * detrot;
962 double iyy = (
zz *
xx - zx *
xz) * detrot;
963 double iyz = (-
yz *
xx + yx *
xz) * detrot;
964 double izx = (zy * yx - zx *
yy) * detrot;
965 double izy = (-zy *
xx + zx *
xy) * detrot;
966 double izz = (
yy *
xx - yx *
xy) * detrot;
971 protx = atan2(prot.
yz(), prot.
zz());
1082 for (
int i = 0;
i < 9;
i++) {
1085 holdit.
phipos = ringPhiPos;
1099 int size = aliComp.size();
1103 for (
int i = 0;
i <
size;
i++) {
1125 std::cout <<
"JNB " << ali->
id() <<
" " << cscId.endcap() <<
" " << cscId.station() <<
" " << cscId.ring() <<
" "
1155 int size = aliComp.size();
1159 for (
int i = 0;
i <
size;
i++) {
1175 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 > &)
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
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)
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 _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)