CMS 3D CMS Logo

MuonGeometryArrange.cc
Go to the documentation of this file.
3 #include "CLHEP/Vector/RotationInterfaces.h"
4 
9 
11 
15 // The following looks generic enough to use
23 
26 
27 #include "MuonGeometryArrange.h"
28 #include "TFile.h"
29 #include "TLatex.h"
30 #include "TArrow.h"
31 #include "TGraph.h"
32 #include "TH1F.h"
33 #include "TH2F.h"
34 #include "CLHEP/Vector/ThreeVector.h"
35 
36 // Database
38 
39 #include <iostream>
40 #include <fstream>
41 
43  : theSurveyIndex(0),
44  _levelStrings(cfg.getUntrackedParameter<std::vector<std::string> >("levels")),
45  _writeToDB(false),
46  _commonMuonLevel(align::invalid),
47  firstEvent_(true),
48  idealInputLabel1("MuonGeometryArrangeLabel1"),
49  idealInputLabel2("MuonGeometryArrangeLabel2"),
50  idealInputLabel2a("MuonGeometryArrangeLabel2a") {
51  referenceMuon = nullptr;
52  currentMuon = nullptr;
53  // Input is XML
54  _inputXMLCurrent = cfg.getUntrackedParameter<std::string>("inputXMLCurrent");
55  _inputXMLReference = cfg.getUntrackedParameter<std::string>("inputXMLReference");
56 
57  //input is ROOT
58  _inputFilename1 = cfg.getUntrackedParameter<std::string>("inputROOTFile1");
59  _inputFilename2 = cfg.getUntrackedParameter<std::string>("inputROOTFile2");
60  _inputTreename = cfg.getUntrackedParameter<std::string>("treeName");
61 
62  //output file
63  _filename = cfg.getUntrackedParameter<std::string>("outputFile");
64 
65  _weightBy = cfg.getUntrackedParameter<std::string>("weightBy");
66  _detIdFlag = cfg.getUntrackedParameter<bool>("detIdFlag");
67  _detIdFlagFile = cfg.getUntrackedParameter<std::string>("detIdFlagFile");
68  _weightById = cfg.getUntrackedParameter<bool>("weightById");
69  _weightByIdFile = cfg.getUntrackedParameter<std::string>("weightByIdFile");
70  _endcap = cfg.getUntrackedParameter<int>("endcapNumber");
71  _station = cfg.getUntrackedParameter<int>("stationNumber");
72  _ring = cfg.getUntrackedParameter<int>("ringNumber");
73 
74  // if want to use, make id cut list
75  if (_detIdFlag) {
76  std::ifstream fin;
77  fin.open(_detIdFlagFile.c_str());
78 
79  while (!fin.eof() && fin.good()) {
80  uint32_t id;
81  fin >> id;
82  _detIdFlagVector.push_back(id);
83  }
84  fin.close();
85  }
86 
87  // turn weightByIdFile into weightByIdVector
88  unsigned int lastID = 999999999;
89  if (_weightById) {
90  std::ifstream inFile;
91  inFile.open(_weightByIdFile.c_str());
92  int ctr = 0;
93  while (!inFile.eof()) {
94  ctr++;
95  unsigned int listId;
96  inFile >> listId;
97  inFile.ignore(256, '\n');
98  if (listId != lastID) {
99  _weightByIdVector.push_back(listId);
100  }
101  lastID = listId;
102  }
103  inFile.close();
104  }
105 
106  //root configuration
107  _theFile = new TFile(_filename.c_str(), "RECREATE");
108  _alignTree = new TTree("alignTree", "alignTree");
109  _alignTree->Branch("id", &_id, "id/I");
110  _alignTree->Branch("level", &_level, "level/I");
111  _alignTree->Branch("mid", &_mid, "mid/I");
112  _alignTree->Branch("mlevel", &_mlevel, "mlevel/I");
113  _alignTree->Branch("sublevel", &_sublevel, "sublevel/I");
114  _alignTree->Branch("x", &_xVal, "x/F");
115  _alignTree->Branch("y", &_yVal, "y/F");
116  _alignTree->Branch("z", &_zVal, "z/F");
117  _alignTree->Branch("r", &_rVal, "r/F");
118  _alignTree->Branch("phi", &_phiVal, "phi/F");
119  _alignTree->Branch("eta", &_etaVal, "eta/F");
120  _alignTree->Branch("alpha", &_alphaVal, "alpha/F");
121  _alignTree->Branch("beta", &_betaVal, "beta/F");
122  _alignTree->Branch("gamma", &_gammaVal, "gamma/F");
123  _alignTree->Branch("dx", &_dxVal, "dx/F");
124  _alignTree->Branch("dy", &_dyVal, "dy/F");
125  _alignTree->Branch("dz", &_dzVal, "dz/F");
126  _alignTree->Branch("dr", &_drVal, "dr/F");
127  _alignTree->Branch("dphi", &_dphiVal, "dphi/F");
128  _alignTree->Branch("dalpha", &_dalphaVal, "dalpha/F");
129  _alignTree->Branch("dbeta", &_dbetaVal, "dbeta/F");
130  _alignTree->Branch("dgamma", &_dgammaVal, "dgamma/F");
131  _alignTree->Branch("ldx", &_ldxVal, "ldx/F");
132  _alignTree->Branch("ldy", &_ldyVal, "ldy/F");
133  _alignTree->Branch("ldz", &_ldzVal, "ldz/F");
134  _alignTree->Branch("ldr", &_ldrVal, "ldr/F");
135  _alignTree->Branch("ldphi", &_ldphiVal, "ldphi/F");
136  _alignTree->Branch("useDetId", &_useDetId, "useDetId/I");
137  _alignTree->Branch("detDim", &_detDim, "detDim/I");
138  _alignTree->Branch("rotx", &_rotxVal, "rotx/F");
139  _alignTree->Branch("roty", &_rotyVal, "roty/F");
140  _alignTree->Branch("rotz", &_rotzVal, "rotz/F");
141  _alignTree->Branch("drotx", &_drotxVal, "drotx/F");
142  _alignTree->Branch("droty", &_drotyVal, "droty/F");
143  _alignTree->Branch("drotz", &_drotzVal, "drotz/F");
144  _alignTree->Branch("surW", &_surWidth, "surW/F");
145  _alignTree->Branch("surL", &_surLength, "surL/F");
146  _alignTree->Branch("surRot", &_surRot, "surRot[9]/D");
147 
148  _mgacollection.clear();
149 }
152  // Unpack the list and create ntuples here.
153 
154  int size = _mgacollection.size();
155  if (size <= 0)
156  return; // nothing to do here.
157  std::vector<float> xp(size + 1);
158  std::vector<float> yp(size + 1);
159  int i;
160  float minV, maxV;
161  int minI, maxI;
162 
163  minV = 99999999.;
164  maxV = -minV;
165  minI = 9999999;
166  maxI = -minI;
167  TGraph* grx = nullptr;
168  TH2F* dxh = nullptr;
169 
170  // for position plots:
171  for (i = 0; i < size; i++) {
172  if (_mgacollection[i].phipos < minI)
173  minI = _mgacollection[i].phipos;
174  if (_mgacollection[i].phipos > maxI)
175  maxI = _mgacollection[i].phipos;
176  xp[i] = _mgacollection[i].phipos;
177  }
178  if (minI >= maxI)
179  return; // can't do anything?
180  xp[size] = xp[size - 1] + 1; // wraparound point
181 
182  if (1 < minI)
183  minI = 1;
184  if (size > maxI)
185  maxI = size;
186  maxI++; // allow for wraparound to show neighbors
187  int sizeI = maxI + 1 - minI;
188  float smi = minI - 1;
189  float sma = maxI + 1;
190 
191  // Dx plot
192 
193  for (i = 0; i < size; i++) {
194  if (_mgacollection[i].ldx < minV)
195  minV = _mgacollection[i].ldx;
196  if (_mgacollection[i].ldx > maxV)
197  maxV = _mgacollection[i].ldx;
198  yp[i] = _mgacollection[i].ldx;
199  }
200  yp[size] = yp[0]; // wraparound point
201 
202  makeGraph(sizeI,
203  smi,
204  sma,
205  minV,
206  maxV,
207  dxh,
208  grx,
209  "delX_vs_position",
210  "Local #delta X vs position",
211  "GdelX_vs_position",
212  "#delta x in cm",
213  xp.data(),
214  yp.data(),
215  size);
216  // Dy plot
217  minV = 99999999.;
218  maxV = -minV;
219  for (i = 0; i < size; i++) {
220  if (_mgacollection[i].ldy < minV)
221  minV = _mgacollection[i].ldy;
222  if (_mgacollection[i].ldy > maxV)
223  maxV = _mgacollection[i].ldy;
224  yp[i] = _mgacollection[i].ldy;
225  }
226  yp[size] = yp[0]; // wraparound point
227 
228  makeGraph(sizeI,
229  smi,
230  sma,
231  minV,
232  maxV,
233  dxh,
234  grx,
235  "delY_vs_position",
236  "Local #delta Y vs position",
237  "GdelY_vs_position",
238  "#delta y in cm",
239  xp.data(),
240  yp.data(),
241  size);
242 
243  // Dz plot
244  minV = 99999999.;
245  maxV = -minV;
246  for (i = 0; i < size; i++) {
247  if (_mgacollection[i].dz < minV)
248  minV = _mgacollection[i].dz;
249  if (_mgacollection[i].dz > maxV)
250  maxV = _mgacollection[i].dz;
251  yp[i] = _mgacollection[i].dz;
252  }
253  yp[size] = yp[0]; // wraparound point
254 
255  makeGraph(sizeI,
256  smi,
257  sma,
258  minV,
259  maxV,
260  dxh,
261  grx,
262  "delZ_vs_position",
263  "Local #delta Z vs position",
264  "GdelZ_vs_position",
265  "#delta z in cm",
266  xp.data(),
267  yp.data(),
268  size);
269 
270  // Dphi plot
271  minV = 99999999.;
272  maxV = -minV;
273  for (i = 0; i < size; i++) {
274  if (_mgacollection[i].dphi < minV)
275  minV = _mgacollection[i].dphi;
276  if (_mgacollection[i].dphi > maxV)
277  maxV = _mgacollection[i].dphi;
278  yp[i] = _mgacollection[i].dphi;
279  }
280  yp[size] = yp[0]; // wraparound point
281 
282  makeGraph(sizeI,
283  smi,
284  sma,
285  minV,
286  maxV,
287  dxh,
288  grx,
289  "delphi_vs_position",
290  "#delta #phi vs position",
291  "Gdelphi_vs_position",
292  "#delta #phi in radians",
293  xp.data(),
294  yp.data(),
295  size);
296 
297  // Dr plot
298  minV = 99999999.;
299  maxV = -minV;
300  for (i = 0; i < size; i++) {
301  if (_mgacollection[i].dr < minV)
302  minV = _mgacollection[i].dr;
303  if (_mgacollection[i].dr > maxV)
304  maxV = _mgacollection[i].dr;
305  yp[i] = _mgacollection[i].dr;
306  }
307  yp[size] = yp[0]; // wraparound point
308 
309  makeGraph(sizeI,
310  smi,
311  sma,
312  minV,
313  maxV,
314  dxh,
315  grx,
316  "delR_vs_position",
317  "#delta R vs position",
318  "GdelR_vs_position",
319  "#delta R in cm",
320  xp.data(),
321  yp.data(),
322  size);
323 
324  // Drphi plot
325  minV = 99999999.;
326  maxV = -minV;
327  for (i = 0; i < size; i++) {
328  float ttemp = _mgacollection[i].r * _mgacollection[i].dphi;
329  if (ttemp < minV)
330  minV = ttemp;
331  if (ttemp > maxV)
332  maxV = ttemp;
333  yp[i] = ttemp;
334  }
335  yp[size] = yp[0]; // wraparound point
336 
337  makeGraph(sizeI,
338  smi,
339  sma,
340  minV,
341  maxV,
342  dxh,
343  grx,
344  "delRphi_vs_position",
345  "R #delta #phi vs position",
346  "GdelRphi_vs_position",
347  "R #delta #phi in cm",
348  xp.data(),
349  yp.data(),
350  size);
351 
352  // Dalpha plot
353  minV = 99999999.;
354  maxV = -minV;
355  for (i = 0; i < size; i++) {
356  if (_mgacollection[i].dalpha < minV)
357  minV = _mgacollection[i].dalpha;
358  if (_mgacollection[i].dalpha > maxV)
359  maxV = _mgacollection[i].dalpha;
360  yp[i] = _mgacollection[i].dalpha;
361  }
362  yp[size] = yp[0]; // wraparound point
363 
364  makeGraph(sizeI,
365  smi,
366  sma,
367  minV,
368  maxV,
369  dxh,
370  grx,
371  "delalpha_vs_position",
372  "#delta #alpha vs position",
373  "Gdelalpha_vs_position",
374  "#delta #alpha in rad",
375  xp.data(),
376  yp.data(),
377  size);
378 
379  // Dbeta plot
380  minV = 99999999.;
381  maxV = -minV;
382  for (i = 0; i < size; i++) {
383  if (_mgacollection[i].dbeta < minV)
384  minV = _mgacollection[i].dbeta;
385  if (_mgacollection[i].dbeta > maxV)
386  maxV = _mgacollection[i].dbeta;
387  yp[i] = _mgacollection[i].dbeta;
388  }
389  yp[size] = yp[0]; // wraparound point
390 
391  makeGraph(sizeI,
392  smi,
393  sma,
394  minV,
395  maxV,
396  dxh,
397  grx,
398  "delbeta_vs_position",
399  "#delta #beta vs position",
400  "Gdelbeta_vs_position",
401  "#delta #beta in rad",
402  xp.data(),
403  yp.data(),
404  size);
405 
406  // Dgamma plot
407  minV = 99999999.;
408  maxV = -minV;
409  for (i = 0; i < size; i++) {
410  if (_mgacollection[i].dgamma < minV)
411  minV = _mgacollection[i].dgamma;
412  if (_mgacollection[i].dgamma > maxV)
413  maxV = _mgacollection[i].dgamma;
414  yp[i] = _mgacollection[i].dgamma;
415  }
416  yp[size] = yp[0]; // wraparound point
417 
418  makeGraph(sizeI,
419  smi,
420  sma,
421  minV,
422  maxV,
423  dxh,
424  grx,
425  "delgamma_vs_position",
426  "#delta #gamma vs position",
427  "Gdelgamma_vs_position",
428  "#delta #gamma in rad",
429  xp.data(),
430  yp.data(),
431  size);
432 
433  // Drotx plot
434  minV = 99999999.;
435  maxV = -minV;
436  for (i = 0; i < size; i++) {
437  if (_mgacollection[i].drotx < minV)
438  minV = _mgacollection[i].drotx;
439  if (_mgacollection[i].drotx > maxV)
440  maxV = _mgacollection[i].drotx;
441  yp[i] = _mgacollection[i].drotx;
442  }
443  yp[size] = yp[0]; // wraparound point
444 
445  makeGraph(sizeI,
446  smi,
447  sma,
448  minV,
449  maxV,
450  dxh,
451  grx,
452  "delrotX_vs_position",
453  "#delta rotX vs position",
454  "GdelrotX_vs_position",
455  "#delta rotX in rad",
456  xp.data(),
457  yp.data(),
458  size);
459 
460  // Droty plot
461  minV = 99999999.;
462  maxV = -minV;
463  for (i = 0; i < size; i++) {
464  if (_mgacollection[i].droty < minV)
465  minV = _mgacollection[i].droty;
466  if (_mgacollection[i].droty > maxV)
467  maxV = _mgacollection[i].droty;
468  yp[i] = _mgacollection[i].droty;
469  }
470  yp[size] = yp[0]; // wraparound point
471 
472  makeGraph(sizeI,
473  smi,
474  sma,
475  minV,
476  maxV,
477  dxh,
478  grx,
479  "delrotY_vs_position",
480  "#delta rotY vs position",
481  "GdelrotY_vs_position",
482  "#delta rotY in rad",
483  xp.data(),
484  yp.data(),
485  size);
486 
487  // Drotz plot
488  minV = 99999999.;
489  maxV = -minV;
490  for (i = 0; i < size; i++) {
491  if (_mgacollection[i].drotz < minV)
492  minV = _mgacollection[i].drotz;
493  if (_mgacollection[i].drotz > maxV)
494  maxV = _mgacollection[i].drotz;
495  yp[i] = _mgacollection[i].drotz;
496  }
497  yp[size] = yp[0]; // wraparound point
498 
499  makeGraph(sizeI,
500  smi,
501  sma,
502  minV,
503  maxV,
504  dxh,
505  grx,
506  "delrotZ_vs_position",
507  "#delta rotZ vs position",
508  "GdelrotZ_vs_position",
509  "#delta rotZ in rad",
510  xp.data(),
511  yp.data(),
512  size);
513 
514  // Vector plots
515  // First find the maximum length of sqrt(dx*dx+dy*dy): we'll have to
516  // scale these for visibility
517  maxV = -99999999.;
518  float ttemp, rtemp;
519  float maxR = -9999999.;
520  for (i = 0; i < size; i++) {
523  if (ttemp > maxV)
524  maxV = ttemp;
525  if (rtemp > maxR)
526  maxR = rtemp;
527  }
528 
529  // Don't try to scale rediculously small values
530  float smallestVcm = .001; // 10 microns
531  if (maxV < smallestVcm)
532  maxV = smallestVcm;
533  float scale = 0.;
534  float lside = 1.1 * maxR;
535  if (lside <= 0)
536  lside = 100.;
537  if (maxV > 0) {
538  scale = .09 * lside / maxV;
539  } // units of pad length!
540  char scalename[50];
541  int ret = snprintf(scalename, 50, "#delta #bar{x} length =%f cm", maxV);
542  // If ret<=0 we don't want to print the scale!
543 
544  if (ret > 0) {
545  dxh = new TH2F("vecdrplot", scalename, 80, -lside, lside, 80, -lside, lside);
546  } else {
547  dxh = new TH2F("vecdrplot", "delta #bar{x} Bad scale", 80, -lside, lside, 80, -lside, lside);
548  }
549  dxh->GetXaxis()->SetTitle("x in cm");
550  dxh->GetYaxis()->SetTitle("y in cm");
551  dxh->SetStats(kFALSE);
552  dxh->Draw();
553  TArrow* arrow;
554  for (i = 0; i < size; i++) {
556  // ttemp=ttemp*scale;
557  float nx = _mgacollection[i].x + scale * _mgacollection[i].dx;
558  float ny = _mgacollection[i].y + scale * _mgacollection[i].dy;
559  arrow = new TArrow(_mgacollection[i].x, _mgacollection[i].y, nx, ny); // ttemp*.3*.05, "->");
560  arrow->SetLineWidth(2);
561  arrow->SetArrowSize(ttemp * .2 * .05 / maxV);
562  arrow->SetLineColor(1);
563  arrow->SetLineStyle(1);
564  arrow->Paint();
565  dxh->GetListOfFunctions()->Add(static_cast<TObject*>(arrow));
566  // arrow->Draw();
567  // arrow->Write();
568  }
569  dxh->Write();
570 
571  _theFile->Write();
572  _theFile->Close();
573 }
576  float smi,
577  float sma,
578  float minV,
579  float maxV,
580  TH2F* dxh,
581  TGraph* grx,
582  const char* name,
583  const char* title,
584  const char* titleg,
585  const char* axis,
586  const float* xp,
587  const float* yp,
588  int size) {
589  if (minV >= maxV || smi >= sma || sizeI <= 1 || xp == nullptr || yp == nullptr)
590  return;
591  // out of bounds, bail
592  float diff = maxV - minV;
593  float over = .05 * diff;
594  double ylo = minV - over;
595  double yhi = maxV + over;
596  double dsmi, dsma;
597  dsmi = smi;
598  dsma = sma;
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);
603  dxh->Draw();
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);
613  grx->Draw("A*");
614  grx->Write();
615  return;
616 }
619 
624  if (firstEvent_) {
625  // My stuff
627  inputAlign1 = new MuonAlignment(iSetup, inputMethod1);
630  inputAlign2 = new MuonAlignment(iSetup, inputMethod2);
633  inputAlign2a = new MuonAlignment(iSetup, inputMethod2a);
635 
636  inputGeometry1 = static_cast<Alignable*>(inputAlign1->getAlignableMuon());
637  inputGeometry2 = static_cast<Alignable*>(inputAlign2->getAlignableMuon());
638  auto inputGeometry2Copy2 = inputAlign2a->getAlignableMuon();
639 
640  //setting the levels being used in the geometry comparator
641  edm::LogInfo("MuonGeometryArrange") << "levels: " << _levelStrings.size();
642  for (const auto& level : _levelStrings) {
643  theLevels.push_back(inputGeometry2Copy2->objectIdProvider().stringToId(level));
644  edm::LogInfo("MuonGeometryArrange") << "level: " << level;
645  }
646 
647  //compare the goemetries
648  compare(inputGeometry1, inputGeometry2, inputGeometry2Copy2);
649 
650  //write out ntuple
651  //might be better to do within output module
652  _theFile->cd();
653  _alignTree->Write();
654  endHist();
655  // _theFile->Close();
656 
657  firstEvent_ = false;
658  }
659 }
660 
662 void MuonGeometryArrange::compare(Alignable* refAli, Alignable* curAli, Alignable* curAliCopy2) {
663  // First sanity
664  if (refAli == nullptr) {
665  return;
666  }
667  if (curAli == nullptr) {
668  return;
669  }
670 
671  const auto& refComp = refAli->components();
672  const auto& curComp = curAli->components();
673  const auto& curComp2 = curAliCopy2->components();
674  compareGeometries(refAli, curAli, curAliCopy2);
675 
676  int nComp = refComp.size();
677  for (int i = 0; i < nComp; i++) {
678  compare(refComp[i], curComp[i], curComp2[i]);
679  }
680  return;
681 }
682 
685  // First sanity
686  if (refAli == nullptr) {
687  return;
688  }
689  if (curAli == nullptr) {
690  return;
691  }
692  // Is this the Ring we want to align? If so it will contain the
693  // chambers specified in the configuration file
694  if (!isMother(refAli))
695  return; // Not the desired alignable object
696  // But... There are granddaughters involved--and I don't want to monkey with
697  // the layers of the chambers. So, if the mother of this is also an approved
698  // mother, bail.
699  if (isMother(refAli->mother()))
700  return;
701  const auto& refComp = refAli->components();
702  const auto& curComp = curCopy->components();
703  if (refComp.size() != curComp.size()) {
704  return;
705  }
706  // GlobalVectors is a vector of GlobalVector which is a 3D vector
707  align::GlobalVectors originalVectors;
708  align::GlobalVectors currentVectors;
709  align::GlobalVectors originalRelativeVectors;
710  align::GlobalVectors currentRelativeVectors;
711 
712  int nComp = refComp.size();
713  int nUsed = 0;
714  // Use the total displacements here:
715  CLHEP::Hep3Vector TotalX, TotalL;
716  TotalX.set(0., 0., 0.);
717  TotalL.set(0., 0., 0.);
718  // CLHEP::Hep3Vector* Rsubtotal, Wsubtotal, DRsubtotal, DWsubtotal;
719  std::vector<CLHEP::Hep3Vector> Positions;
720  std::vector<CLHEP::Hep3Vector> DelPositions;
721 
722  double xrcenter = 0.;
723  double yrcenter = 0.;
724  double zrcenter = 0.;
725  double xccenter = 0.;
726  double yccenter = 0.;
727  double zccenter = 0.;
728 
729  bool useIt;
730  // Create the "center" for the reference alignment chambers, and
731  // load a vector of their centers
732  for (int ich = 0; ich < nComp; ich++) {
733  useIt = true;
734  if (_weightById) {
735  if (!align::readModuleList(curComp[ich]->id(), curComp[ich]->id(), _weightByIdVector))
736  useIt = false;
737  }
738  if (!useIt)
739  continue;
740  align::GlobalVectors curVs;
742  align::GlobalVector pointsCM = align::centerOfMass(curVs);
743  originalVectors.push_back(pointsCM);
744  nUsed++;
745  xrcenter += pointsCM.x();
746  yrcenter += pointsCM.y();
747  zrcenter += pointsCM.z();
748  }
749  xrcenter = xrcenter / nUsed;
750  yrcenter = yrcenter / nUsed;
751  zrcenter = zrcenter / nUsed;
752 
753  // Create the "center" for the current alignment chambers, and
754  // load a vector of their centers
755  for (int ich = 0; ich < nComp; ich++) {
756  useIt = true;
757  if (_weightById) {
758  if (!align::readModuleList(curComp[ich]->id(), curComp[ich]->id(), _weightByIdVector))
759  useIt = false;
760  }
761  if (!useIt)
762  continue;
763  align::GlobalVectors curVs;
765  align::GlobalVector pointsCM = align::centerOfMass(curVs);
766  currentVectors.push_back(pointsCM);
767 
768  xccenter += pointsCM.x();
769  yccenter += pointsCM.y();
770  zccenter += pointsCM.z();
771  }
772  xccenter = xccenter / nUsed;
773  yccenter = yccenter / nUsed;
774  zccenter = zccenter / nUsed;
775 
776  // OK, now load the <very approximate> vectors from the ring "centers"
777  align::GlobalVector CCur(xccenter, yccenter, zccenter);
778  align::GlobalVector CRef(xrcenter, yrcenter, zrcenter);
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);
783  }
784 
785  // All right. Now let the hacking begin.
786  // First out of the gate let's try using the raw values and see what
787  // diffRot does for us.
788 
789  align::RotationType rtype3 = align::diffRot(currentRelativeVectors, originalRelativeVectors);
790 
792  angles = align::toAngles(rtype3);
793 
794  for (int ich = 0; ich < nComp; ich++) {
795  if (_weightById) {
796  if (!align::readModuleList(curComp[ich]->id(), curComp[ich]->id(), _weightByIdVector))
797  continue;
798  }
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++) {
804  align::diffAlignables(refComp[ich], curComp[ich], _weightBy, _weightById, _weightByIdVector);
805  CLHEP::Hep3Vector dR(diff[0], diff[1], diff[2]);
806  Rtotal += dR;
807  CLHEP::Hep3Vector dW(diff[3], diff[4], diff[5]);
808  CLHEP::HepRotation rot(Wtotal.unit(), Wtotal.mag());
809  CLHEP::HepRotation drot(dW.unit(), dW.mag());
810  rot *= drot;
811  Wtotal.set(rot.axis().x() * rot.delta(), rot.axis().y() * rot.delta(), rot.axis().z() * rot.delta());
812  align::moveAlignable(curComp[ich], diff);
813  float tolerance = 1e-7;
815  align::diffAlignables(refComp[ich], curComp[ich], _weightBy, _weightById, _weightByIdVector);
816  align::GlobalVector checkR(check[0], check[1], check[2]);
817  align::GlobalVector checkW(check[3], check[4], check[5]);
818  DetId detid(refComp[ich]->id());
819  if ((checkR.mag() > tolerance) || (checkW.mag() > tolerance)) {
820  // edm::LogInfo("CompareGeoms") << "Tolerance Exceeded!(alObjId: "
821  // << refAli->alignableObjectId()
822  // << ", rawId: " << refComp[ich]->geomDetId().rawId()
823  // << ", subdetId: "<< detid.subdetId() << "): " << diff;
824  } else {
825  TotalX += Rtotal;
826  break;
827  } // end of else
828  } // end of for on int i
829  } // end of for on ich
830 
831  // At this point we should have a total displacement and total L
832  TotalX = TotalX / nUsed;
833 
834  // Now start again!
835  AlgebraicVector change(6);
836  change(1) = TotalX.x();
837  change(2) = TotalX.y();
838  change(3) = TotalX.z();
839 
840  change(4) = angles[0];
841  change(5) = angles[1];
842  change(6) = angles[2];
843  align::moveAlignable(curAli, change); // move as a chunk
844 
845  // Now get the components again. They should be in new locations
846  const auto& curComp2 = curAli->components();
847 
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.);
852  if (_weightById) {
853  if (!align::readModuleList(curComp[ich]->id(), curComp[ich]->id(), _weightByIdVector))
854  continue;
855  }
856 
857  for (int i = 0; i < 100; i++) {
859  align::diffAlignables(refComp[ich], curComp2[ich], _weightBy, _weightById, _weightByIdVector);
860  CLHEP::Hep3Vector dR(diff[0], diff[1], diff[2]);
861  Rtotal += dR;
862  CLHEP::Hep3Vector dW(diff[3], diff[4], diff[5]);
863  CLHEP::HepRotation rot(Wtotal.unit(), Wtotal.mag());
864  CLHEP::HepRotation drot(dW.unit(), dW.mag());
865  rot *= drot;
866  Wtotal.set(rot.axis().x() * rot.delta(), rot.axis().y() * rot.delta(), rot.axis().z() * rot.delta());
867  align::moveAlignable(curComp2[ich], diff);
868  float tolerance = 1e-7;
870  align::diffAlignables(refComp[ich], curComp2[ich], _weightBy, _weightById, _weightByIdVector);
871  align::GlobalVector checkR(check[0], check[1], check[2]);
872  align::GlobalVector checkW(check[3], check[4], check[5]);
873  if ((checkR.mag() > tolerance) || (checkW.mag() > tolerance)) {
874  } else {
875  break;
876  }
877  } // end of for on int i
878  AlgebraicVector TRtot(6);
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();
885  fillTree(refComp[ich], TRtot);
886  } // end of for on ich
887 }
888 
890 
892  _id = refAli->id();
893  _level = refAli->alignableObjectId();
894  //need if ali has no mother
895  if (refAli->mother()) {
896  _mid = refAli->mother()->geomDetId().rawId();
897  _mlevel = refAli->mother()->alignableObjectId();
898  } else {
899  _mid = -1;
900  _mlevel = -1;
901  }
902  DetId detid(_id);
903  _sublevel = detid.subdetId();
904  int ringPhiPos = -99;
905  if (detid.det() == DetId::Muon && detid.subdetId() == MuonSubdetId::CSC) {
906  CSCDetId cscId(refAli->geomDetId());
907  ringPhiPos = cscId.chamber();
908  }
909  _xVal = refAli->globalPosition().x();
910  _yVal = refAli->globalPosition().y();
911  _zVal = refAli->globalPosition().z();
913  _rVal = vec.perp();
914  _phiVal = vec.phi();
915  _etaVal = vec.eta();
917  align::EulerAngles eulerAngles = align::toAngles(rot);
918  _rotxVal = atan2(rot.yz(), rot.zz());
919  float ttt = -rot.xz();
920  if (ttt > 1.)
921  ttt = 1.;
922  if (ttt < -1.)
923  ttt = -1.;
924  _rotyVal = asin(ttt);
925  _rotzVal = atan2(rot.xy(), rot.xx());
926  _alphaVal = eulerAngles[0];
927  _betaVal = eulerAngles[1];
928  _gammaVal = eulerAngles[2];
929  _dxVal = diff[0];
930  _dyVal = diff[1];
931  _dzVal = diff[2];
932  //getting dR and dPhi
935  _drVal = vCur.perp() - vRef.perp();
936  _dphiVal = vCur.phi() - vRef.phi();
937 
938  _dalphaVal = diff[3];
939  _dbetaVal = diff[4];
940  _dgammaVal = diff[5];
941  _drotxVal = -999.;
942  _drotyVal = -999.;
943  _drotzVal = -999.;
944 
945  align::EulerAngles deuler(3);
946  deuler(1) = _dalphaVal;
947  deuler(2) = _dbetaVal;
948  deuler(3) = _dgammaVal;
949  align::RotationType drot = align::toMatrix(deuler);
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;
960  detrot = 1 / detrot;
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;
970  align::RotationType invrot(ixx, ixy, ixz, iyx, iyy, iyz, izx, izy, izz);
971  align::RotationType prot = rot * drot * invrot;
972  // align::RotationType prot = rot*drot;
973  float protx; //, proty, protz;
974  protx = atan2(prot.yz(), prot.zz());
975  _drotxVal = protx; //_rotxVal-protx; //atan2(drot.yz(), drot.zz());
976  ttt = -prot.xz();
977  if (ttt > 1.)
978  ttt = 1.;
979  if (ttt < -1.)
980  ttt = -1.;
981  _drotyVal = asin(ttt); // -_rotyVal;
982  _drotzVal = atan2(prot.xy(), prot.xx()); // - _rotzVal;
983  // Above does not account for 2Pi wraparounds!
984  // Prior knowledge: these are supposed to be small rotations. Therefore:
985  if (_drotxVal > 3.141592656)
986  _drotxVal = -6.2831853072 + _drotxVal;
987  if (_drotxVal < -3.141592656)
988  _drotxVal = 6.2831853072 + _drotxVal;
989  if (_drotyVal > 3.141592656)
990  _drotyVal = -6.2831853072 + _drotyVal;
991  if (_drotyVal < -3.141592656)
992  _drotyVal = 6.2831853072 + _drotyVal;
993  if (_drotzVal > 3.141592656)
994  _drotzVal = -6.2831853072 + _drotzVal;
995  if (_drotzVal < -3.141592656)
996  _drotzVal = 6.2831853072 + _drotzVal;
997 
998  _ldxVal = -999.;
999  _ldyVal = -999.;
1000  _ldxVal = -999.;
1001  _ldrVal = -999.;
1002  _ldphiVal = -999; // set fake
1003 
1004  // if(refAli->alignableObjectId() == align::AlignableDetUnit){
1006  align::LocalVector pointL = refAli->surface().toLocal(dV);
1007  //align::LocalVector pointL = (refAli->mother())->surface().toLocal(dV);
1008  _ldxVal = pointL.x();
1009  _ldyVal = pointL.y();
1010  _ldzVal = pointL.z();
1011  _ldphiVal = pointL.phi();
1012  _ldrVal = pointL.perp();
1013  // }
1014  //detIdFlag
1015  if (refAli->alignableObjectId() == align::AlignableDetUnit) {
1016  if (_detIdFlag) {
1017  if ((passIdCut(refAli->id())) || (passIdCut(refAli->mother()->id()))) {
1018  _useDetId = 1;
1019  } else {
1020  _useDetId = 0;
1021  }
1022  }
1023  }
1024  // det module dimension
1025  if (refAli->alignableObjectId() == align::AlignableDetUnit) {
1026  if (refAli->mother()->alignableObjectId() != align::AlignableDet) {
1027  _detDim = 1;
1028  } else if (refAli->mother()->alignableObjectId() == align::AlignableDet) {
1029  _detDim = 2;
1030  }
1031  } else
1032  _detDim = 0;
1033 
1034  _surWidth = refAli->surface().width();
1035  _surLength = refAli->surface().length();
1037  _surRot[0] = rt.xx();
1038  _surRot[1] = rt.xy();
1039  _surRot[2] = rt.xz();
1040  _surRot[3] = rt.yx();
1041  _surRot[4] = rt.yy();
1042  _surRot[5] = rt.yz();
1043  _surRot[6] = rt.zx();
1044  _surRot[7] = rt.zy();
1045  _surRot[8] = rt.zz();
1046 
1047  MGACollection holdit;
1048  holdit.id = _id;
1049  holdit.level = _level;
1050  holdit.mid = _mid;
1051  holdit.mlevel = _mlevel;
1052  holdit.sublevel = _sublevel;
1053  holdit.x = _xVal;
1054  holdit.y = _yVal;
1055  holdit.z = _zVal;
1056  holdit.r = _rVal;
1057  holdit.phi = _phiVal;
1058  holdit.eta = _etaVal;
1059  holdit.alpha = _alphaVal;
1060  holdit.beta = _betaVal;
1061  holdit.gamma = _gammaVal;
1062  holdit.dx = _dxVal;
1063  holdit.dy = _dyVal;
1064  holdit.dz = _dzVal;
1065  holdit.dr = _drVal;
1066  holdit.dphi = _dphiVal;
1067  holdit.dalpha = _dalphaVal;
1068  holdit.dbeta = _dbetaVal;
1069  holdit.dgamma = _dgammaVal;
1070  holdit.useDetId = _useDetId;
1071  holdit.detDim = _detDim;
1072  holdit.surW = _surWidth;
1073  holdit.surL = _surLength;
1074  holdit.ldx = _ldxVal;
1075  holdit.ldy = _ldyVal;
1076  holdit.ldz = _ldzVal;
1077  holdit.ldr = _ldrVal;
1078  holdit.ldphi = _ldphiVal;
1079  holdit.rotx = _rotxVal;
1080  holdit.roty = _rotyVal;
1081  holdit.rotz = _rotzVal;
1082  holdit.drotx = _drotxVal;
1083  holdit.droty = _drotyVal;
1084  holdit.drotz = _drotzVal;
1085  for (int i = 0; i < 9; i++) {
1086  holdit.surRot[i] = _surRot[i];
1087  }
1088  holdit.phipos = ringPhiPos;
1089  _mgacollection.push_back(holdit);
1090 
1091  //Fill
1092  _alignTree->Fill();
1093 }
1094 
1097  // Is this the mother ring?
1098  if (ali == nullptr)
1099  return false; // elementary sanity
1100  const auto& aliComp = ali->components();
1101 
1102  int size = aliComp.size();
1103  if (size <= 0)
1104  return false; // no subcomponents
1105 
1106  for (int i = 0; i < size; i++) {
1107  if (checkChosen(aliComp[i]))
1108  return true; // A ring has CSC chambers
1109  } // as subcomponents
1110  return false; // 1'st layer of subcomponents weren't CSC chambers
1111 }
1113 
1115  // Check whether the item passed satisfies the criteria given.
1116  if (ali == nullptr)
1117  return false; // elementary sanity
1118  // Is this in the CSC section? If not, bail. Later may extend.
1119  if (ali->geomDetId().det() != DetId::Muon || ali->geomDetId().subdetId() != MuonSubdetId::CSC)
1120  return false;
1121  // If it is a CSC alignable, then check that the station, etc are
1122  // those requested.
1123  // One might think of aligning more than a single ring at a time,
1124  // by using a vector of ring numbers. I don't see the sense in
1125  // trying to align more than one station at a time for comparison.
1126  CSCDetId cscId(ali->geomDetId());
1127 #ifdef jnbdebug
1128  std::cout << "JNB " << ali->id() << " " << cscId.endcap() << " " << cscId.station() << " " << cscId.ring() << " "
1129  << cscId.chamber() << " " << _endcap << " " << _station << " " << _ring << "\n"
1130  << std::flush;
1131 #endif
1132  if (cscId.endcap() == _endcap && cscId.station() == _station && cscId.ring() == _ring) {
1133  return true;
1134  }
1135  return false;
1136 }
1138 
1140  // Check to see if this contains CSC components of the appropriate ring
1141  // Ring will contain N Alignables which represent chambers, each of which
1142  // in turn contains M planes. For our purposes we don't care about the
1143  // planes.
1144  // Hmm. Interesting question: Do I want to try to fit the chamber as
1145  // such, or use the geometry?
1146  // I want to fit the chamber, so I'll try to use its presence as the marker.
1147  // What specifically identifies a chamber as a chamber, and not as a layer?
1148  // The fact that it has layers as sub components, or the fact that it is
1149  // the first item with a non-zero ID breakdown? Pick the latter.
1150  //
1151  if (ali == nullptr)
1152  return false;
1153  if (checkChosen(ali))
1154  return true; // If this is one of the desired
1155  // CSC chambers, accept it
1156  const auto& aliComp = ali->components();
1157 
1158  int size = aliComp.size();
1159  if (size <= 0)
1160  return false; // no subcomponents
1161 
1162  for (int i = 0; i < size; i++) {
1163  if (checkChosen(aliComp[i]))
1164  return true; // A ring has CSC chambers
1165  } // as subcomponents
1166  return false; // 1'st layer of subcomponents weren't CSC chambers
1167 }
1170  bool pass = false;
1171  DetId detid(id);
1172  // if(detid.det()==DetId::Muon && detid.subdetId()== MuonSubdetId::CSC){
1173  // CSCDetId cscId(refAli->geomDetId());
1174  // if(cscId.layer()!=1) return false; // ONLY FIRST LAYER!
1175  // }
1176  int nEntries = _detIdFlagVector.size();
1177 
1178  for (int i = 0; i < nEntries; i++) {
1179  if (_detIdFlagVector[i] == id)
1180  pass = true;
1181  }
1182 
1183  return pass;
1184 }
1185 
Vector3DBase< Scalar, GlobalTag >
MuonGeometryArrange::_dzVal
float _dzVal
Definition: MuonGeometryArrange.h:163
personalPlayback.level
level
Definition: personalPlayback.py:22
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
AlignmentErrorsExtended.h
align::toAngles
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:8
change_name.diff
diff
Definition: change_name.py:13
TkRotation< Scalar >
DDAxes::y
MuonSubdetId::CSC
static constexpr int CSC
Definition: MuonSubdetId.h:12
GlobalPositionRcd.h
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
MuonGeometryArrange::_useDetId
int _useDetId
Definition: MuonGeometryArrange.h:161
MuonGeometryArrange::_inputTreename
std::string _inputTreename
Definition: MuonGeometryArrange.h:102
geometryCSVtoXML.yz
yz
Definition: geometryCSVtoXML.py:19
MessageLogger.h
MuonGeometryArrange::MGACollection::mid
int mid
Definition: MuonGeometryArrange.h:127
MuonGeometryArrange::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: MuonGeometryArrange.cc:623
align
Definition: AlignableIndexer.h:30
funct::false
false
Definition: Factorize.h:29
MuonGeometryArrange::MGACollection::sublevel
int sublevel
Definition: MuonGeometryArrange.h:129
MuonGeometryArrange::compareGeometries
void compareGeometries(Alignable *refAli, Alignable *curAli, Alignable *curAliCopy2)
Definition: MuonGeometryArrange.cc:684
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
MuonGeometryArrange::MGACollection::dz
float dz
Definition: MuonGeometryArrange.h:133
ESHandle.h
MuonGeometryArrange::MGACollection::beta
float beta
Definition: MuonGeometryArrange.h:132
MuonGeometryArrange::inputAlign2
MuonAlignment * inputAlign2
Definition: MuonGeometryArrange.h:151
MuonGeometryArrange::MGACollection::dr
float dr
Definition: MuonGeometryArrange.h:134
MuonGeometryArrange::_weightByIdVector
std::vector< unsigned int > _weightByIdVector
Definition: MuonGeometryArrange.h:110
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
MuonGeometryArrange::MGACollection::surL
float surL
Definition: MuonGeometryArrange.h:141
MuonGeometryArrange::_ldxVal
float _ldxVal
Definition: MuonGeometryArrange.h:164
MuonGeometryArrange::_inputXMLReference
std::string _inputXMLReference
Definition: MuonGeometryArrange.h:149
MuonGeometryArrange::MGACollection::drotz
float drotz
Definition: MuonGeometryArrange.h:140
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
MuonGeometryArrange::MGACollection::x
float x
Definition: MuonGeometryArrange.h:130
Alignable
Definition: Alignable.h:27
gather_cfg.cout
cout
Definition: gather_cfg.py:144
hcal_runs.rt
rt
Definition: hcal_runs.py:76
MuonGeometryArrange::_filename
std::string _filename
Definition: MuonGeometryArrange.h:122
MuonGeometryArrange::MGACollection::ldx
float ldx
Definition: MuonGeometryArrange.h:136
MuonGeometryArrange::MGACollection::mlevel
int mlevel
Definition: MuonGeometryArrange.h:128
Alignments.h
align::moveAlignable
void moveAlignable(Alignable *ali, AlgebraicVector diff)
Moves the alignable by the AlgebraicVector.
Definition: AlignTools.cc:84
align::readModuleList
bool readModuleList(unsigned int, unsigned int, const std::vector< unsigned int > &)
Definition: AlignTools.cc:152
MuonGeometryArrange::_surRot
double _surRot[9]
Definition: MuonGeometryArrange.h:169
DetectorGlobalPosition.h
MuonGeometryArrange::MGACollection::y
float y
Definition: MuonGeometryArrange.h:130
MuonAlignmentInputXML
Definition: MuonAlignmentInputXML.h:33
MuonGeometryArrange::MGACollection::roty
float roty
Definition: MuonGeometryArrange.h:139
MuonGeometryArrange::_theFile
TFile * _theFile
Definition: MuonGeometryArrange.h:154
findQualityFiles.maxI
int maxI
Definition: findQualityFiles.py:182
MuonGeometryArrange::MGACollection::ldr
float ldr
Definition: MuonGeometryArrange.h:137
DDAxes::x
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
AlignableSurface::toLocal
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
Definition: AlignableSurface.cc:35
MuonGeometryArrange::_rVal
float _rVal
Definition: MuonGeometryArrange.h:162
MuonGeometryArrange::MGACollection::dy
float dy
Definition: MuonGeometryArrange.h:133
AlignableSurface::length
align::Scalar length() const
Definition: AlignableSurface.h:32
iyy
int iyy[18][41][3]
Definition: EcalDAQHandler.cc:317
MuonGeometryArrange::MGACollection::dx
float dx
Definition: MuonGeometryArrange.h:133
MuonGeometryArrange::_zVal
float _zVal
Definition: MuonGeometryArrange.h:162
MuonGeometryArrange::checkChosen
bool checkChosen(Alignable *ali)
Definition: MuonGeometryArrange.cc:1114
MuonGeometryArrange::MGACollection::dalpha
float dalpha
Definition: MuonGeometryArrange.h:135
CSCDetId.h
MuonGeometryArrange.h
MuonGeometryArrange::_xVal
float _xVal
Definition: MuonGeometryArrange.h:162
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
MuonGeometryArrange::_betaVal
float _betaVal
Definition: MuonGeometryArrange.h:162
MuonGeometryArrange::_surWidth
float _surWidth
Definition: MuonGeometryArrange.h:168
DetId
Definition: DetId.h:17
MuonAlignment
Definition: MuonAlignment.h:21
MuonGeometryArrange::MGACollection::surRot
double surRot[9]
Definition: MuonGeometryArrange.h:142
MuonGeometryArrange::_rotxVal
float _rotxVal
Definition: MuonGeometryArrange.h:166
MuonGeometryArrange::_drotxVal
float _drotxVal
Definition: MuonGeometryArrange.h:167
MuonGeometryArrange::passIdCut
bool passIdCut(uint32_t)
Definition: MuonGeometryArrange.cc:1169
MakerMacros.h
MuonGeometryArrange::MGACollection::level
int level
Definition: MuonGeometryArrange.h:126
RPCNoise_example.check
check
Definition: RPCNoise_example.py:71
MuonGeometryArrange::_mlevel
int _mlevel
Definition: MuonGeometryArrange.h:161
MuonGeometryArrange::inputAlign1
MuonAlignment * inputAlign1
Definition: MuonGeometryArrange.h:150
MuonGeometryArrange::inputAlign2a
MuonAlignment * inputAlign2a
Definition: MuonGeometryArrange.h:152
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MuonGeometryArrange::MGACollection::rotz
float rotz
Definition: MuonGeometryArrange.h:139
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
align::createPoints
void createPoints(GlobalVectors *Vs, Alignable *ali, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
Definition: AlignTools.cc:96
groupFilesInBlocks.fin
fin
Definition: groupFilesInBlocks.py:94
MuonGeometryArrange::MGACollection::ldphi
float ldphi
Definition: MuonGeometryArrange.h:137
MuonAlignment::fillGapsInSurvey
void fillGapsInSurvey(double shiftErr, double angleErr)
Definition: MuonAlignment.cc:178
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
TkRotation::xz
T xz() const
Definition: extTkRotation.h:253
Service.h
MuonGeometryArrange::MGACollection::phi
float phi
Definition: MuonGeometryArrange.h:131
MuonGeometryArrange::_dxVal
float _dxVal
Definition: MuonGeometryArrange.h:163
MuonGeometryArrange::_dyVal
float _dyVal
Definition: MuonGeometryArrange.h:163
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
MuonGeometryArrange::MGACollection
Definition: MuonGeometryArrange.h:124
MuonGeometryArrange::MGACollection::droty
float droty
Definition: MuonGeometryArrange.h:140
MuonGeometryArrange::_inputFilename2
std::string _inputFilename2
Definition: MuonGeometryArrange.h:101
MuonGeometryArrange::MGACollection::useDetId
int useDetId
Definition: MuonGeometryArrange.h:138
MuonGeometryArrange::MGACollection::dbeta
float dbeta
Definition: MuonGeometryArrange.h:135
align::centerOfMass
GlobalVector centerOfMass(const GlobalVectors &theVs)
Find the CM of a set of points.
Definition: Utilities.cc:174
MuonGeometryArrange::_dphiVal
float _dphiVal
Definition: MuonGeometryArrange.h:163
MuonGeometryArrange::MGACollection::dphi
float dphi
Definition: MuonGeometryArrange.h:134
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
MuonGeometryArrange::_surLength
float _surLength
Definition: MuonGeometryArrange.h:168
geometryCSVtoXML.xy
xy
Definition: geometryCSVtoXML.py:19
MuonGeometryArrange::MGACollection::dgamma
float dgamma
Definition: MuonGeometryArrange.h:135
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
MuonGeometryArrange::beginJob
void beginJob() override
Read from DB and print survey info.
Definition: MuonGeometryArrange.cc:618
MuonGeometryArrange::_ldphiVal
float _ldphiVal
Definition: MuonGeometryArrange.h:165
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonGeometryArrange::_detIdFlagFile
std::string _detIdFlagFile
Definition: MuonGeometryArrange.h:107
MuonGeometryArrange::inputGeometry2
Alignable * inputGeometry2
Definition: MuonGeometryArrange.h:92
funct::true
true
Definition: Factorize.h:173
align::AlignableDetUnit
Definition: StructureType.h:19
MuonGeometryArrange::MGACollection::gamma
float gamma
Definition: MuonGeometryArrange.h:132
edm::ParameterSet
Definition: ParameterSet.h:47
MuonAlignment.h
TkRotation::xx
T xx() const
Definition: extTkRotation.h:251
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
dqmiodatasetharvest.ctr
ctr
Definition: dqmiodatasetharvest.py:191
findQualityFiles.minI
int minI
Definition: findQualityFiles.py:181
MuonGeometryArrange::MGACollection::id
int id
Definition: MuonGeometryArrange.h:125
MuonGeometryArrange::_ring
int _ring
Definition: MuonGeometryArrange.h:113
AlignableMuon.h
MuonGeometryArrange::_weightByIdFile
std::string _weightByIdFile
Definition: MuonGeometryArrange.h:109
MuonGeometryArrange::_drotzVal
float _drotzVal
Definition: MuonGeometryArrange.h:167
Alignable::id
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
Definition: Alignable.h:180
geometryCSVtoXML.xz
xz
Definition: geometryCSVtoXML.py:19
CSCDetId
Definition: CSCDetId.h:26
MuonGeometryArrange::_rotyVal
float _rotyVal
Definition: MuonGeometryArrange.h:166
MuonGeometryArrange::_inputXMLCurrent
std::string _inputXMLCurrent
Definition: MuonGeometryArrange.h:148
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
MuonGeometryArrange::idealInputLabel2a
std::string idealInputLabel2a
Definition: MuonGeometryArrange.h:173
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
MuonGeometryArrange::inputGeometry1
Alignable * inputGeometry1
Definition: MuonGeometryArrange.h:91
MuonGeometryArrange::MGACollection::r
float r
Definition: MuonGeometryArrange.h:131
MuonGeometryArrange::MGACollection::ldy
float ldy
Definition: MuonGeometryArrange.h:136
MuonGeometryArrange::isMother
bool isMother(Alignable *ali)
Definition: MuonGeometryArrange.cc:1096
MuonGeometryArrange::passChosen
bool passChosen(Alignable *ali)
Definition: MuonGeometryArrange.cc:1139
tolerance
const double tolerance
Definition: HGCalGeomParameters.cc:29
MuonGeometryArrange::_gammaVal
float _gammaVal
Definition: MuonGeometryArrange.h:162
Alignable::geomDetId
const DetId & geomDetId() const
Definition: Alignable.h:177
MuonGeometryArrange::_level
int _level
Definition: MuonGeometryArrange.h:161
TkRotation::xy
T xy() const
Definition: extTkRotation.h:252
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
MuonGeometryArrange::_dgammaVal
float _dgammaVal
Definition: MuonGeometryArrange.h:164
MuonGeometryArrange::_phiVal
float _phiVal
Definition: MuonGeometryArrange.h:162
Utilities.h
IdealGeometryRecord.h
PVValHelper::dy
Definition: PVValidationHelpers.h:50
CSCDetId::chamber
int chamber() const
Definition: CSCDetId.h:62
MuonGeometryArrange::MGACollection::rotx
float rotx
Definition: MuonGeometryArrange.h:139
edm::EventSetup
Definition: EventSetup.h:58
TkRotation::zz
T zz() const
Definition: extTkRotation.h:259
align::GlobalVectors
std::vector< GlobalVector > GlobalVectors
Definition: Utilities.h:28
GeometricDet.h
MuonGeometryArrange::MGACollection::phipos
int phipos
Definition: MuonGeometryArrange.h:143
align::EulerAngles
AlgebraicVector EulerAngles
Definition: Definitions.h:34
align::diffRot
RotationType diffRot(const GlobalVectors &current, const GlobalVectors &nominal)
Definition: Utilities.cc:68
MuonGeometryArrange::MGACollection::alpha
float alpha
Definition: MuonGeometryArrange.h:132
MuonGeometryArrange::_detDim
int _detDim
Definition: MuonGeometryArrange.h:161
MuonGeometryArrange::_endcap
int _endcap
Definition: MuonGeometryArrange.h:111
MuonGeometryArrange::_dbetaVal
float _dbetaVal
Definition: MuonGeometryArrange.h:164
looper.cfg
cfg
Definition: looper.py:297
MuonGeometryArrange::_etaVal
float _etaVal
Definition: MuonGeometryArrange.h:162
MuonGeometryArrange::_weightBy
std::string _weightBy
Definition: MuonGeometryArrange.h:104
MuonGeometryArrange::_drVal
float _drVal
Definition: MuonGeometryArrange.h:163
TkRotation::yz
T yz() const
Definition: extTkRotation.h:256
AlignableObjectId.h
align::AlignableDet
Definition: StructureType.h:20
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
MuonGeometryArrange::idealInputLabel1
std::string idealInputLabel1
Definition: MuonGeometryArrange.h:173
MuonAlignmentInputXML.h
MuonGeometryArrange::makeGraph
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)
Definition: MuonGeometryArrange.cc:575
MuonGeometryArrange::MuonGeometryArrange
MuonGeometryArrange(const edm::ParameterSet &)
Do nothing. Required by framework.
Definition: MuonGeometryArrange.cc:42
MuonGeometryArrange::compare
void compare(Alignable *refAli, Alignable *curAli, Alignable *curAliCopy2)
Definition: MuonGeometryArrange.cc:662
MuonGeometryArrange::_ldrVal
float _ldrVal
Definition: MuonGeometryArrange.h:165
MuonGeometryArrange::currentMuon
AlignableMuon * currentMuon
Definition: MuonGeometryArrange.h:90
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
particleFlowDisplacedVertex_cfi.angles
angles
Definition: particleFlowDisplacedVertex_cfi.py:84
MuonGeometryArrange::createROOTGeometry
void createROOTGeometry(const edm::EventSetup &iSetup)
Definition: MuonGeometryArrange.cc:621
MuonGeometryArrange::_station
int _station
Definition: MuonGeometryArrange.h:112
MuonGeometryArrange::_ldyVal
float _ldyVal
Definition: MuonGeometryArrange.h:164
MuonGeometryArrange::_weightById
bool _weightById
Definition: MuonGeometryArrange.h:108
ixx
int ixx[18][41][3]
Definition: EcalDAQHandler.cc:226
DetId.h
PVValHelper::dz
Definition: PVValidationHelpers.h:51
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
AlignableSurface::width
align::Scalar width() const
Definition: AlignableSurface.h:30
MuonGeometryArrange::MGACollection::ldz
float ldz
Definition: MuonGeometryArrange.h:136
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
MuonGeometryArrange::_mgacollection
std::vector< MGACollection > _mgacollection
Definition: MuonGeometryArrange.h:146
MuonGeometryArrange::_detIdFlag
bool _detIdFlag
Definition: MuonGeometryArrange.h:106
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
MuonGeometryArrange::idealInputLabel2
std::string idealInputLabel2
Definition: MuonGeometryArrange.h:173
Alignable.h
MuonGeometryArrange::_alignTree
TTree * _alignTree
Definition: MuonGeometryArrange.h:155
MuonGeometryArrange::_alphaVal
float _alphaVal
Definition: MuonGeometryArrange.h:162
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
MuonGeometryArrange::MGACollection::surW
float surW
Definition: MuonGeometryArrange.h:141
MuonGeometryArrange::_mid
int _mid
Definition: MuonGeometryArrange.h:161
MuonGeometryArrange::_inputFilename1
std::string _inputFilename1
Definition: MuonGeometryArrange.h:100
MuonGeometryArrange::_sublevel
int _sublevel
Definition: MuonGeometryArrange.h:161
align::toMatrix
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:34
MuonAlignment::getAlignableMuon
AlignableMuon * getAlignableMuon()
Definition: MuonAlignment.h:32
MuonGeometryArrange::endHist
void endHist()
Definition: MuonGeometryArrange.cc:151
MuonGeometryArrange::_ldzVal
float _ldzVal
Definition: MuonGeometryArrange.h:164
align::diffAlignables
AlgebraicVector diffAlignables(Alignable *refAli, Alignable *curAli, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
Definition: AlignTools.cc:10
MuonGeometryArrange::MGACollection::z
float z
Definition: MuonGeometryArrange.h:130
DetId::Muon
Definition: DetId.h:26
MuonGeometryArrange::theLevels
std::vector< align::StructureType > theLevels
Definition: MuonGeometryArrange.h:55
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
SurveyDet.h
MuonGeometryArrange::MGACollection::detDim
int detDim
Definition: MuonGeometryArrange.h:138
MuonGeometryArrange::_levelStrings
const std::vector< std::string > _levelStrings
Definition: MuonGeometryArrange.h:99
Alignable::globalPosition
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
MuonGeometryArrange::fillTree
void fillTree(Alignable *refAli, const AlgebraicVector &diff)
Definition: MuonGeometryArrange.cc:891
edm::Event
Definition: Event.h:73
MuonGeometryArrange::referenceMuon
AlignableMuon * referenceMuon
Definition: MuonGeometryArrange.h:88
MuonGeometryArrange::_drotyVal
float _drotyVal
Definition: MuonGeometryArrange.h:167
MuonGeometryArrange
Definition: MuonGeometryArrange.h:38
Alignable::components
virtual const Alignables & components() const =0
Return vector of all direct components.
MuonGeometryArrange::_yVal
float _yVal
Definition: MuonGeometryArrange.h:162
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
MuonGeometryArrange::_detIdFlagVector
std::vector< uint32_t > _detIdFlagVector
Definition: MuonGeometryArrange.h:115
PVValHelper::dx
Definition: PVValidationHelpers.h:49
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
MuonGeometryArrange::_dalphaVal
float _dalphaVal
Definition: MuonGeometryArrange.h:163
Alignable::globalRotation
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138
MuonGeometryArrange::_id
int _id
Definition: MuonGeometryArrange.h:161
MuonGeometryArrange::MGACollection::drotx
float drotx
Definition: MuonGeometryArrange.h:140
MuonGeometryArrange::firstEvent_
bool firstEvent_
Definition: MuonGeometryArrange.h:171
MuonGeometryArrange::MGACollection::eta
float eta
Definition: MuonGeometryArrange.h:131
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MuonGeometryArrange::_rotzVal
float _rotzVal
Definition: MuonGeometryArrange.h:166
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
Alignable::mother
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91