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