CMS 3D CMS Logo

TrackerGeometryCompare.cc
Go to the documentation of this file.
5 #include "CLHEP/Vector/RotationInterfaces.h"
15 
17 
22 
38 
39 //#include "Alignment/OfflineValidation/interface/ComparisonUtilities.h"
40 //#include "Alignment/CommonAlignment/interface/AlignTools.h"
41 
42 //#include "Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h"
43 #include "TrackerGeometryCompare.h"
44 #include "TFile.h"
45 #include "CLHEP/Vector/ThreeVector.h"
46 
47 // Database
51 //#include "Geometry/Records/interface/PGeometricDetRcd.h"
52 
55 
56 #include <iostream>
57 #include <fstream>
58 #include <sstream>
59 
61  : referenceTracker(nullptr),
62  dummyTracker(nullptr),
63  currentTracker(nullptr),
64  theSurveyIndex(0),
65  theSurveyValues(nullptr),
66  theSurveyErrors(nullptr),
67  _levelStrings(cfg.getUntrackedParameter<std::vector<std::string> >("levels")),
68  _writeToDB(cfg.getUntrackedParameter<bool>("writeToDB")),
69  _commonTrackerLevel(align::invalid),
70  _moduleListFile(nullptr),
71  _moduleList(0),
72  _inputRootFile1(nullptr),
73  _inputRootFile2(nullptr),
74  _inputTree01(nullptr),
75  _inputTree02(nullptr),
76  _inputTree11(nullptr),
77  _inputTree12(nullptr),
78  m_nBins(10000),
79  m_rangeLow(-.1),
80  m_rangeHigh(.1),
81  firstEvent_(true),
82  m_vtkmap(13) {
84 
85  //input is ROOT
86  _inputFilename1 = cfg.getUntrackedParameter<std::string>("inputROOTFile1");
87  _inputFilename2 = cfg.getUntrackedParameter<std::string>("inputROOTFile2");
90 
91  //output file
92  _filename = cfg.getUntrackedParameter<std::string>("outputFile");
93 
94  _weightBy = cfg.getUntrackedParameter<std::string>("weightBy");
95  _setCommonTrackerSystem = cfg.getUntrackedParameter<std::string>("setCommonTrackerSystem");
96  _detIdFlag = cfg.getUntrackedParameter<bool>("detIdFlag");
97  _detIdFlagFile = cfg.getUntrackedParameter<std::string>("detIdFlagFile");
98  _weightById = cfg.getUntrackedParameter<bool>("weightById");
99  _weightByIdFile = cfg.getUntrackedParameter<std::string>("weightByIdFile");
100 
101  // if want to use, make id cut list
102  if (_detIdFlag) {
103  std::ifstream fin;
104  fin.open(_detIdFlagFile.c_str());
105 
106  while (!fin.eof() && fin.good()) {
107  uint32_t id;
108  fin >> id;
109  _detIdFlagVector.push_back(id);
110  }
111  fin.close();
112  }
113 
114  // turn weightByIdFile into weightByIdVector
115  if (_weightById) {
116  std::ifstream inFile;
117  inFile.open(_weightByIdFile.c_str());
118  int ctr = 0;
119  while (!inFile.eof()) {
120  ctr++;
121  unsigned int listId;
122  inFile >> listId;
123  inFile.ignore(256, '\n');
124 
125  _weightByIdVector.push_back(listId);
126  }
127  inFile.close();
128  }
129 
130  //root configuration
131  _theFile = new TFile(_filename.c_str(), "RECREATE");
132  _alignTree = new TTree("alignTree",
133  "alignTree"); //,"id:level:mid:mlevel:sublevel:x:y:z:r:phi:a:b:c:dx:dy:dz:dr:dphi:da:db:dc");
134  _alignTree->Branch("id", &_id, "id/I");
135  _alignTree->Branch("badModuleQuality", &_badModuleQuality, "badModuleQuality/I");
136  _alignTree->Branch("inModuleList", &_inModuleList, "inModuleList/I");
137  _alignTree->Branch("level", &_level, "level/I");
138  _alignTree->Branch("mid", &_mid, "mid/I");
139  _alignTree->Branch("mlevel", &_mlevel, "mlevel/I");
140  _alignTree->Branch("sublevel", &_sublevel, "sublevel/I");
141  _alignTree->Branch("x", &_xVal, "x/F");
142  _alignTree->Branch("y", &_yVal, "y/F");
143  _alignTree->Branch("z", &_zVal, "z/F");
144  _alignTree->Branch("r", &_rVal, "r/F");
145  _alignTree->Branch("phi", &_phiVal, "phi/F");
146  _alignTree->Branch("eta", &_etaVal, "eta/F");
147  _alignTree->Branch("alpha", &_alphaVal, "alpha/F");
148  _alignTree->Branch("beta", &_betaVal, "beta/F");
149  _alignTree->Branch("gamma", &_gammaVal, "gamma/F");
150  _alignTree->Branch("dx", &_dxVal, "dx/F");
151  _alignTree->Branch("dy", &_dyVal, "dy/F");
152  _alignTree->Branch("dz", &_dzVal, "dz/F");
153  _alignTree->Branch("dr", &_drVal, "dr/F");
154  _alignTree->Branch("dphi", &_dphiVal, "dphi/F");
155  _alignTree->Branch("dalpha", &_dalphaVal, "dalpha/F");
156  _alignTree->Branch("dbeta", &_dbetaVal, "dbeta/F");
157  _alignTree->Branch("dgamma", &_dgammaVal, "dgamma/F");
158  _alignTree->Branch("du", &_duVal, "du/F");
159  _alignTree->Branch("dv", &_dvVal, "dv/F");
160  _alignTree->Branch("dw", &_dwVal, "dw/F");
161  _alignTree->Branch("da", &_daVal, "da/F");
162  _alignTree->Branch("db", &_dbVal, "db/F");
163  _alignTree->Branch("dg", &_dgVal, "dg/F");
164  _alignTree->Branch("useDetId", &_useDetId, "useDetId/I");
165  _alignTree->Branch("detDim", &_detDim, "detDim/I");
166  _alignTree->Branch("surW", &_surWidth, "surW/F");
167  _alignTree->Branch("surL", &_surLength, "surL/F");
168  _alignTree->Branch("surRot", &_surRot, "surRot[9]/D");
169  _alignTree->Branch("identifiers", &_identifiers, "identifiers[6]/I");
170  _alignTree->Branch("type", &_type, "type/I");
171  _alignTree->Branch("surfDeform", &_surfDeform, "surfDeform[13]/D");
172 
173  for (std::vector<TrackerMap>::iterator it = m_vtkmap.begin(); it != m_vtkmap.end(); ++it) {
174  it->setPalette(1);
175  it->addPixel(true);
176  }
177 
179  TFileDirectory subDir_All = fs->mkdir("AllSubdetectors");
180  TFileDirectory subDir_PXB = fs->mkdir("PixelBarrel");
181  TFileDirectory subDir_PXF = fs->mkdir("PixelEndcap");
182  for (int ii = 0; ii < 13; ++ii) {
183  std::stringstream histname0;
184  histname0 << "SurfDeform_Par_" << ii;
185  m_h1[histname0.str()] =
186  subDir_All.make<TH1D>((histname0.str()).c_str(), (histname0.str()).c_str(), m_nBins, m_rangeLow, m_rangeHigh);
187 
188  std::stringstream histname1;
189  histname1 << "SurfDeform_PixelBarrel_Par_" << ii;
190  m_h1[histname1.str()] =
191  subDir_PXB.make<TH1D>((histname1.str()).c_str(), (histname1.str()).c_str(), m_nBins, m_rangeLow, m_rangeHigh);
192 
193  std::stringstream histname2;
194  histname2 << "SurfDeform_PixelEndcap_Par_" << ii;
195  m_h1[histname2.str()] =
196  subDir_PXF.make<TH1D>((histname2.str()).c_str(), (histname2.str()).c_str(), m_nBins, m_rangeLow, m_rangeHigh);
197  }
198 }
199 
201 
203  int iname(0);
204  for (std::vector<TrackerMap>::iterator it = m_vtkmap.begin(); it != m_vtkmap.end(); ++it) {
205  std::stringstream mapname;
206  mapname << "TkMap_SurfDeform" << iname << ".png";
207  it->save(true, 0, 0, mapname.str());
208  mapname.str(std::string());
209  mapname.clear();
210  mapname << "TkMap_SurfDeform" << iname << ".pdf";
211  it->save(true, 0, 0, mapname.str());
212  ++iname;
213  }
214 
215  _theFile->cd();
216  _alignTree->Write();
217  _theFile->Close();
218 }
219 
221  if (firstEvent_) {
222  //Retrieve tracker topology from geometry
223  edm::ESHandle<TrackerTopology> tTopoHandle;
224  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
225  const TrackerTopology* const tTopo = tTopoHandle.product();
226 
227  //upload the ROOT geometries
228  createROOTGeometry(iSetup);
229 
230  //setting the levels being used in the geometry comparator
231  edm::LogInfo("TrackerGeometryCompare") << "levels: " << _levelStrings.size();
232  for (const auto& level : _levelStrings) {
234  edm::LogInfo("TrackerGeometryCompare") << "level: " << level;
235  edm::LogInfo("TrackerGeometryCompare")
236  << "structure type: " << currentTracker->objectIdProvider().stringToId(level);
237  }
238 
239  //set common tracker system first
240  // if setting the tracker common system
241  if (_setCommonTrackerSystem != "NONE") {
243  }
244 
245  //compare the goemetries
248 
249  //write out ntuple
250  //might be better to do within output module
251 
252  if (_writeToDB) {
253  Alignments* myAlignments = currentTracker->alignments();
254  AlignmentErrorsExtended* myAlignmentErrorsExtended = currentTracker->alignmentErrors();
255 
256  // 2. Store alignment[Error]s to DB
258  // Call service
259  if (!poolDbService.isAvailable()) // Die if not available
260  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
261 
262  poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), "TrackerAlignmentRcd");
263  poolDbService->writeOne<AlignmentErrorsExtended>(
264  &(*myAlignmentErrorsExtended), poolDbService->beginOfTime(), "TrackerAlignmentErrorExtendedRcd");
265  }
266 
267  firstEvent_ = false;
268  }
269 }
270 
272  int inputRawId1, inputRawId2;
273  double inputX1, inputY1, inputZ1, inputX2, inputY2, inputZ2;
274  double inputAlpha1, inputBeta1, inputGamma1, inputAlpha2, inputBeta2, inputGamma2;
275 
276  //Retrieve tracker topology from geometry
277  edm::ESHandle<TrackerTopology> tTopoHandle;
278  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
279  const TrackerTopology* const tTopo = tTopoHandle.product();
280 
281  // Fill module IDs from file into a list
283  if (_moduleListFile.is_open()) {
285  while (!_moduleListFile.eof()) {
286  std::getline(_moduleListFile, line);
287  _moduleList.push_back(std::atoi(line.c_str()));
288  }
289  } else {
290  edm::LogInfo("TrackerGeometryCompare") << "Error: Module list not found! Please verify that given list exists!";
291  }
292 
293  //declare alignments
294  Alignments* alignments1 = new Alignments();
295  AlignmentErrorsExtended* alignmentErrors1 = new AlignmentErrorsExtended();
296  if (_inputFilename1 != "IDEAL") {
297  _inputRootFile1 = new TFile(_inputFilename1.c_str());
298  TTree* _inputTree01 = (TTree*)_inputRootFile1->Get(_inputTreenameAlign.c_str());
299  _inputTree01->SetBranchAddress("rawid", &inputRawId1);
300  _inputTree01->SetBranchAddress("x", &inputX1);
301  _inputTree01->SetBranchAddress("y", &inputY1);
302  _inputTree01->SetBranchAddress("z", &inputZ1);
303  _inputTree01->SetBranchAddress("alpha", &inputAlpha1);
304  _inputTree01->SetBranchAddress("beta", &inputBeta1);
305  _inputTree01->SetBranchAddress("gamma", &inputGamma1);
306 
307  int nEntries1 = _inputTree01->GetEntries();
308  //fill alignments
309  for (int i = 0; i < nEntries1; ++i) {
310  _inputTree01->GetEntry(i);
311  CLHEP::Hep3Vector translation1(inputX1, inputY1, inputZ1);
312  CLHEP::HepEulerAngles eulerangles1(inputAlpha1, inputBeta1, inputGamma1);
313  uint32_t detid1 = inputRawId1;
314  AlignTransform transform1(translation1, eulerangles1, detid1);
315  alignments1->m_align.push_back(transform1);
316 
317  //dummy errors
318  CLHEP::HepSymMatrix clhepSymMatrix(3, 0);
319  AlignTransformErrorExtended transformError(clhepSymMatrix, detid1);
320  alignmentErrors1->m_alignError.push_back(transformError);
321  }
322 
323  // to get the right order, sort by rawId
324  std::sort(alignments1->m_align.begin(), alignments1->m_align.end());
325  std::sort(alignmentErrors1->m_alignError.begin(), alignmentErrors1->m_alignError.end());
326  }
327  //------------------
328  Alignments* alignments2 = new Alignments();
329  AlignmentErrorsExtended* alignmentErrors2 = new AlignmentErrorsExtended();
330  if (_inputFilename2 != "IDEAL") {
331  _inputRootFile2 = new TFile(_inputFilename2.c_str());
332  TTree* _inputTree02 = (TTree*)_inputRootFile2->Get(_inputTreenameAlign.c_str());
333  _inputTree02->SetBranchAddress("rawid", &inputRawId2);
334  _inputTree02->SetBranchAddress("x", &inputX2);
335  _inputTree02->SetBranchAddress("y", &inputY2);
336  _inputTree02->SetBranchAddress("z", &inputZ2);
337  _inputTree02->SetBranchAddress("alpha", &inputAlpha2);
338  _inputTree02->SetBranchAddress("beta", &inputBeta2);
339  _inputTree02->SetBranchAddress("gamma", &inputGamma2);
340 
341  int nEntries2 = _inputTree02->GetEntries();
342  //fill alignments
343  for (int i = 0; i < nEntries2; ++i) {
344  _inputTree02->GetEntry(i);
345  CLHEP::Hep3Vector translation2(inputX2, inputY2, inputZ2);
346  CLHEP::HepEulerAngles eulerangles2(inputAlpha2, inputBeta2, inputGamma2);
347  uint32_t detid2 = inputRawId2;
348  AlignTransform transform2(translation2, eulerangles2, detid2);
349  alignments2->m_align.push_back(transform2);
350 
351  //dummy errors
352  CLHEP::HepSymMatrix clhepSymMatrix(3, 0);
353  AlignTransformErrorExtended transformError(clhepSymMatrix, detid2);
354  alignmentErrors2->m_alignError.push_back(transformError);
355  }
356 
357  // to get the right order, sort by rawId
358  std::sort(alignments2->m_align.begin(), alignments2->m_align.end());
359  std::sort(alignmentErrors2->m_alignError.begin(), alignmentErrors2->m_alignError.end());
360  }
361 
362  //accessing the initial geometry
364  iSetup.get<IdealGeometryRecord>().get(cpv);
365  edm::ESHandle<GeometricDet> theGeometricDet;
366  iSetup.get<IdealGeometryRecord>().get(theGeometricDet);
368  iSetup.get<PTrackerParametersRcd>().get(ptp);
369  TrackerGeomBuilderFromGeometricDet trackerBuilder;
370 
371  //reference tracker
372  TrackerGeometry* theRefTracker = trackerBuilder.build(&*theGeometricDet, *ptp, tTopo);
373  if (_inputFilename1 != "IDEAL") {
374  GeometryAligner aligner1;
376  &(*theRefTracker), &(*alignments1), &(*alignmentErrors1), AlignTransform());
377  }
378  referenceTracker = new AlignableTracker(&(*theRefTracker), tTopo);
379  //referenceTracker->setSurfaceDeformation(surfDef1, true) ;
380 
381  int inputRawid1;
382  int inputRawid2;
383  int inputDtype1, inputDtype2;
384  std::vector<double> inputDpar1;
385  std::vector<double> inputDpar2;
386  std::vector<double>* p_inputDpar1 = &inputDpar1;
387  std::vector<double>* p_inputDpar2 = &inputDpar2;
388 
389  const auto& comp1 = referenceTracker->deepComponents();
390 
391  SurfaceDeformation* surfDef1;
392  if (_inputFilename1 != "IDEAL") {
393  TTree* _inputTree11 = (TTree*)_inputRootFile1->Get(_inputTreenameDeform.c_str());
394  _inputTree11->SetBranchAddress("irawid", &inputRawid1);
395  _inputTree11->SetBranchAddress("dtype", &inputDtype1);
396  _inputTree11->SetBranchAddress("dpar", &p_inputDpar1);
397 
398  unsigned int nEntries11 = _inputTree11->GetEntries();
399  edm::LogInfo("TrackerGeometryCompare") << " nentries11 = " << nEntries11;
400  for (unsigned int iEntry = 0; iEntry < nEntries11; ++iEntry) {
401  _inputTree11->GetEntry(iEntry);
402 
403  surfDef1 = SurfaceDeformationFactory::create(inputDtype1, inputDpar1);
404 
405  if (int(comp1[iEntry]->id()) == inputRawid1) {
406  comp1[iEntry]->setSurfaceDeformation(surfDef1, true);
407  }
408  }
409  }
410 
411  //currernt tracker
412  TrackerGeometry* theCurTracker = trackerBuilder.build(&*theGeometricDet, *ptp, tTopo);
413  if (_inputFilename2 != "IDEAL") {
414  GeometryAligner aligner2;
416  &(*theCurTracker), &(*alignments2), &(*alignmentErrors2), AlignTransform());
417  }
418  currentTracker = new AlignableTracker(&(*theCurTracker), tTopo);
419 
420  const auto& comp2 = currentTracker->deepComponents();
421 
422  SurfaceDeformation* surfDef2;
423  if (_inputFilename2 != "IDEAL") {
424  TTree* _inputTree12 = (TTree*)_inputRootFile2->Get(_inputTreenameDeform.c_str());
425  _inputTree12->SetBranchAddress("irawid", &inputRawid2);
426  _inputTree12->SetBranchAddress("dtype", &inputDtype2);
427  _inputTree12->SetBranchAddress("dpar", &p_inputDpar2);
428 
429  unsigned int nEntries12 = _inputTree12->GetEntries();
430  edm::LogInfo("TrackerGeometryCompare") << " nentries12 = " << nEntries12;
431  for (unsigned int iEntry = 0; iEntry < nEntries12; ++iEntry) {
432  _inputTree12->GetEntry(iEntry);
433 
434  surfDef2 = SurfaceDeformationFactory::create(inputDtype2, inputDpar2);
435 
436  if (int(comp2[iEntry]->id()) == inputRawid2) {
437  comp2[iEntry]->setSurfaceDeformation(surfDef2, true);
438  }
439  }
440  }
441 
442  delete alignments1;
443  delete alignmentErrors1;
444  delete alignments2;
445  delete alignmentErrors2;
446 }
447 
448 void TrackerGeometryCompare::compareSurfaceDeformations(TTree* refTree, TTree* curTree) {
449  if (_inputFilename1 != "IDEAL" && _inputFilename2 != "IDEAL") {
450  int inputRawid1;
451  int inputRawid2;
452  int inputSubdetid1, inputSubdetid2;
453  int inputDtype1, inputDtype2;
454  std::vector<double> inputDpar1;
455  std::vector<double> inputDpar2;
456  std::vector<double>* p_inputDpar1 = &inputDpar1;
457  std::vector<double>* p_inputDpar2 = &inputDpar2;
458 
459  TTree* refTree = (TTree*)_inputRootFile1->Get(_inputTreenameDeform.c_str());
460  refTree->SetBranchAddress("irawid", &inputRawid1);
461  refTree->SetBranchAddress("subdetid", &inputSubdetid1);
462  refTree->SetBranchAddress("dtype", &inputDtype1);
463  refTree->SetBranchAddress("dpar", &p_inputDpar1);
464 
465  TTree* curTree = (TTree*)_inputRootFile2->Get(_inputTreenameDeform.c_str());
466  curTree->SetBranchAddress("irawid", &inputRawid2);
467  curTree->SetBranchAddress("subdetid", &inputSubdetid2);
468  curTree->SetBranchAddress("dtype", &inputDtype2);
469  curTree->SetBranchAddress("dpar", &p_inputDpar2);
470 
471  unsigned int nEntries11 = refTree->GetEntries();
472  unsigned int nEntries12 = curTree->GetEntries();
473 
474  if (nEntries11 != nEntries12) {
475  edm::LogError("TrackerGeometryCompare") << " Surface deformation parameters in two geometries differ!\n";
476  return;
477  }
478 
479  for (unsigned int iEntry = 0; iEntry < nEntries12; ++iEntry) {
480  refTree->GetEntry(iEntry);
481  curTree->GetEntry(iEntry);
482  for (int ii = 0; ii < 13; ++ii) {
483  _surfDeform[ii] = -1.0;
484  }
485  for (int npar = 0; npar < int(inputDpar2.size()); ++npar) {
486  if (inputRawid1 == inputRawid2) {
487  _surfDeform[npar] = inputDpar2.at(npar) - inputDpar1.at(npar);
488  std::stringstream histname0;
489  histname0 << "SurfDeform_Par_" << npar;
490  if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins))
491  m_h1[histname0.str()]->Fill(_surfDeform[npar]);
492  if (inputSubdetid1 == 1 && inputSubdetid2 == 1) {
493  std::stringstream histname1;
494  histname1 << "SurfDeform_PixelBarrel_Par_" << npar;
495  if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins))
496  m_h1[histname1.str()]->Fill(_surfDeform[npar]);
497  }
498  if (inputSubdetid1 == 2 && inputSubdetid2 == 2) {
499  std::stringstream histname2;
500  histname2 << "SurfDeform_PixelEndcap_Par_" << npar;
501  if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins))
502  m_h1[histname2.str()]->Fill(_surfDeform[npar]);
503  }
504  (m_vtkmap.at(npar)).fill_current_val(inputRawid1, _surfDeform[npar]);
505  }
506  }
507  }
508 
509  } else if (_inputFilename1 == "IDEAL" && _inputFilename2 != "IDEAL") {
510  int inputRawid2;
511  int inputSubdetid2;
512  int inputDtype2;
513  std::vector<double> inputDpar2;
514  std::vector<double>* p_inputDpar2 = &inputDpar2;
515 
516  TTree* curTree = (TTree*)_inputRootFile2->Get(_inputTreenameDeform.c_str());
517  curTree->SetBranchAddress("irawid", &inputRawid2);
518  curTree->SetBranchAddress("subdetid", &inputSubdetid2);
519  curTree->SetBranchAddress("dtype", &inputDtype2);
520  curTree->SetBranchAddress("dpar", &p_inputDpar2);
521 
522  unsigned int nEntries12 = curTree->GetEntries();
523 
524  for (unsigned int iEntry = 0; iEntry < nEntries12; ++iEntry) {
525  curTree->GetEntry(iEntry);
526  for (int ii = 0; ii < 12; ++ii) {
527  _surfDeform[ii] = -1.0;
528  }
529  for (int npar = 0; npar < int(inputDpar2.size()); ++npar) {
530  _surfDeform[npar] = inputDpar2.at(npar);
531  std::stringstream histname0;
532  histname0 << "SurfDeform_Par_" << npar;
533  if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins))
534  m_h1[histname0.str()]->Fill(_surfDeform[npar]);
535  if (inputSubdetid2 == 1) {
536  std::stringstream histname1;
537  histname1 << "SurfDeform_PixelBarrel_Par_" << npar;
538  if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins))
539  m_h1[histname1.str()]->Fill(_surfDeform[npar]);
540  }
541  if (inputSubdetid2 == 2) {
542  std::stringstream histname2;
543  histname2 << "SurfDeform_PixelEndcap_Par_" << npar;
544  if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins))
545  m_h1[histname2.str()]->Fill(_surfDeform[npar]);
546  }
547  (m_vtkmap.at(npar)).fill_current_val(inputRawid2, _surfDeform[npar]);
548  }
549  }
550 
551  } else if (_inputFilename1 != "IDEAL" && _inputFilename2 == "IDEAL") {
552  int inputRawid1;
553  int inputSubdetid1;
554  int inputDtype1;
555  std::vector<double> inputDpar1;
556  std::vector<double>* p_inputDpar1 = &inputDpar1;
557 
558  TTree* refTree = (TTree*)_inputRootFile1->Get(_inputTreenameDeform.c_str());
559  refTree->SetBranchAddress("irawid", &inputRawid1);
560  refTree->SetBranchAddress("subdetid", &inputSubdetid1);
561  refTree->SetBranchAddress("dtype", &inputDtype1);
562  refTree->SetBranchAddress("dpar", &p_inputDpar1);
563 
564  unsigned int nEntries11 = refTree->GetEntries();
565 
566  for (unsigned int iEntry = 0; iEntry < nEntries11; ++iEntry) {
567  refTree->GetEntry(iEntry);
568  for (int ii = 0; ii < 12; ++ii) {
569  _surfDeform[ii] = -1.0;
570  }
571  for (int npar = 0; npar < int(inputDpar1.size()); ++npar) {
572  _surfDeform[npar] = -inputDpar1.at(npar);
573  std::stringstream histname0;
574  histname0 << "SurfDeform_Par_" << npar;
575  if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins))
576  m_h1[histname0.str()]->Fill(_surfDeform[npar]);
577  if (inputSubdetid1 == 1) {
578  std::stringstream histname1;
579  histname1 << "SurfDeform_PixelBarrel_Par_" << npar;
580  if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins))
581  m_h1[histname1.str()]->Fill(_surfDeform[npar]);
582  }
583  if (inputSubdetid1 == 2) {
584  std::stringstream histname2;
585  histname2 << "SurfDeform_PixelEndcap_Par_" << npar;
586  if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins))
587  m_h1[histname2.str()]->Fill(_surfDeform[npar]);
588  }
589  (m_vtkmap.at(npar)).fill_current_val(inputRawid1, _surfDeform[npar]);
590  }
591  }
592 
593  } else if (_inputFilename1 == "IDEAL" && _inputFilename2 == "IDEAL") {
594  edm::LogInfo("TrackerGeometryCompare") << ">>>> Comparing IDEAL with IDEAL: nothing to do! <<<<\n";
595  }
596 
597  return;
598 }
599 
601  Alignable* curAli,
602  const TrackerTopology* tTopo,
603  const edm::EventSetup& iSetup) {
604  using namespace align;
605 
606  const auto& refComp = refAli->components();
607  const auto& curComp = curAli->components();
608 
609  unsigned int nComp = refComp.size();
610  //only perform for designate levels
611  bool useLevel = false;
612  for (unsigned int i = 0; i < m_theLevels.size(); ++i) {
613  if (refAli->alignableObjectId() == m_theLevels[i])
614  useLevel = true;
615  }
616 
617  //another added level for difference between det and detunit
618  //if ((refAli->alignableObjectId()==2)&&(nComp == 1)) useLevel = false;
619 
620  //coordinate matching, etc etc
621  if (useLevel) {
622  DetId detid(refAli->id());
623 
624  CLHEP::Hep3Vector Rtotal, Wtotal, lRtotal, lWtotal;
625  Rtotal.set(0., 0., 0.);
626  Wtotal.set(0., 0., 0.);
627  lRtotal.set(0., 0., 0.);
628  lWtotal.set(0., 0., 0.);
629 
630  bool converged = false;
631 
633 
634  for (int i = 0; i < 100; i++) {
635  // Get differences between alignments for rotations and translations
636  // both local and global
638 
639  // 'diffAlignables' returns 'refAli - curAli' for translations and 'curAli - refAli' for rotations.
640  // The plan is to unify this at some point, but a simple change of the sign for one of them was postponed
641  // to do some further checks to understand the rotations better
642  //Updated July 2018: as requested the sign in the translations has been changed to match the one in rotations. A test was done to change the diffAlignables function and solve the issue there, but proved quite time consuming. To unify the sign convention in the least amount of time the choice was made to change the sign here.
643  CLHEP::Hep3Vector dR(-diff[0], -diff[1], -diff[2]);
644  CLHEP::Hep3Vector dW(diff[3], diff[4], diff[5]);
645  CLHEP::Hep3Vector dRLocal(-diff[6], -diff[7], -diff[8]);
646  CLHEP::Hep3Vector dWLocal(diff[9], diff[10], diff[11]);
647 
648  // Translations
649  Rtotal += dR;
650  lRtotal += dRLocal;
651 
652  //Rotations
653  CLHEP::HepRotation rot(Wtotal.unit(), Wtotal.mag());
654  CLHEP::HepRotation drot(dW.unit(), dW.mag());
655  rot *= drot;
656  Wtotal.set(rot.axis().x() * rot.delta(), rot.axis().y() * rot.delta(), rot.axis().z() * rot.delta());
657 
658  CLHEP::HepRotation rotLocal(lWtotal.unit(), lWtotal.mag());
659  CLHEP::HepRotation drotLocal(dWLocal.unit(), dWLocal.mag());
660  rotLocal *= drotLocal;
661  lWtotal.set(rotLocal.axis().x() * rotLocal.delta(),
662  rotLocal.axis().y() * rotLocal.delta(),
663  rotLocal.axis().z() * rotLocal.delta());
664 
665  // Move current alignable by shift and check if difference
666  // is smaller than tolerance value
667  // if true, break the loop
668  align::moveAlignable(curAli, diff);
669  float tolerance = 1e-7;
671  align::GlobalVector checkR(check[0], check[1], check[2]);
672  align::GlobalVector checkW(check[3], check[4], check[5]);
673  if ((checkR.mag() < tolerance) && (checkW.mag() < tolerance)) {
674  converged = true;
675  break;
676  }
677  }
678 
679  // give an exception if difference has not fallen below tolerance level
680  // i.e. method has not converged
681  if (!converged) {
682  edm::LogInfo("TrackerGeometryCompare")
683  << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId()
684  << ", rawId: " << refAli->geomDetId().rawId() << ", subdetId: " << detid.subdetId() << "): " << diff << check;
685  throw cms::Exception("Tolerance in TrackerGeometryCompare exceeded");
686  }
687 
688  AlgebraicVector TRtot(12);
689  // global
690  TRtot(1) = Rtotal.x();
691  TRtot(2) = Rtotal.y();
692  TRtot(3) = Rtotal.z();
693  TRtot(4) = Wtotal.x();
694  TRtot(5) = Wtotal.y();
695  TRtot(6) = Wtotal.z();
696  // local
697  TRtot(7) = lRtotal.x();
698  TRtot(8) = lRtotal.y();
699  TRtot(9) = lRtotal.z();
700  TRtot(10) = lWtotal.x();
701  TRtot(11) = lWtotal.y();
702  TRtot(12) = lWtotal.z();
703 
704  fillTree(refAli, TRtot, tTopo, iSetup);
705  }
706 
707  // another added level for difference between det and detunit
708  for (unsigned int i = 0; i < nComp; ++i)
709  compareGeometries(refComp[i], curComp[i], tTopo, iSetup);
710 }
711 
713  edm::LogInfo("TrackerGeometryCompare") << "Setting Common Tracker System....";
714 
715  // DM_534??AlignableObjectId dummy;
716  // DM_534??_commonTrackerLevel = dummy.nameToType(_setCommonTrackerSystem);
718 
720 
721  align::EulerAngles dOmega(3);
722  dOmega[0] = _TrackerCommonR.x();
723  dOmega[1] = _TrackerCommonR.y();
724  dOmega[2] = _TrackerCommonR.z();
727 
728  edm::LogInfo("TrackerGeometryCompare") << "what we get from overlaying the pixels..." << theR << ", " << rot;
729 
730  //transform to the Tracker System
732  align::GlobalVector cmDiff(
733  trackerCM.x() - _TrackerCommonCM.x(), trackerCM.y() - _TrackerCommonCM.y(), trackerCM.z() - _TrackerCommonCM.z());
734 
735  edm::LogInfo("TrackerGeometryCompare") << "Pixel CM: " << _TrackerCommonCM << ", tracker CM: " << trackerCM;
736 
737  //adjust translational difference factoring in different rotational CM
738  //needed because rotateInGlobalFrame is about CM of alignable, not Tracker
739  const align::GlobalVector::BasicVectorType& lpvgf = cmDiff.basicVector();
740  align::GlobalVector moveV(rot.multiplyInverse(lpvgf) - lpvgf);
741  align::GlobalVector theRprime(theR + moveV);
742 
743  AlgebraicVector TrackerCommonTR(6);
744  TrackerCommonTR(1) = theRprime.x();
745  TrackerCommonTR(2) = theRprime.y();
746  TrackerCommonTR(3) = theRprime.z();
747  TrackerCommonTR(4) = _TrackerCommonR.x();
748  TrackerCommonTR(5) = _TrackerCommonR.y();
749  TrackerCommonTR(6) = _TrackerCommonR.z();
750 
751  edm::LogInfo("TrackerGeometryCompare") << "and after the transformation: " << TrackerCommonTR;
752 
753  align::moveAlignable(currentTracker, TrackerCommonTR);
754 }
755 
757  const auto& refComp = refAli->components();
758  const auto& curComp = curAli->components();
759 
760  unsigned int nComp = refComp.size();
761  //only perform for designate levels
762  bool useLevel = false;
763  if (refAli->alignableObjectId() == _commonTrackerLevel)
764  useLevel = true;
765 
766  //useLevel = false;
767  if (useLevel) {
768  CLHEP::Hep3Vector Rtotal, Wtotal;
769  Rtotal.set(0., 0., 0.);
770  Wtotal.set(0., 0., 0.);
771 
773  CLHEP::Hep3Vector dR(diff[0], diff[1], diff[2]);
774  Rtotal += dR;
775  CLHEP::Hep3Vector dW(diff[3], diff[4], diff[5]);
776  CLHEP::HepRotation rot(Wtotal.unit(), Wtotal.mag());
777  CLHEP::HepRotation drot(dW.unit(), dW.mag());
778  rot *= drot;
779  Wtotal.set(rot.axis().x() * rot.delta(), rot.axis().y() * rot.delta(), rot.axis().z() * rot.delta());
780  /*
781  //std::cout << "a";
782  //if (refAli->alignableObjectId() == 1) std::cout << "DIFF: " << diff << std::endl;
783  align::moveAlignable(curAli, diff);
784  float tolerance = 1e-7;
785  AlgebraicVector check = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector);
786  align::GlobalVector checkR(check[0],check[1],check[2]);
787  align::GlobalVector checkW(check[3],check[4],check[5]);
788  DetId detid(refAli->id());
789  if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){
790  edm::LogInfo("TrackerGeometryCompare") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId()
791  << ", rawId: " << refAli->geomDetId().rawId()
792  << ", subdetId: "<< detid.subdetId() << "): " << diff;
793  }
794  else{
795  break;
796  }
797  }
798  */
799 
800  //_TrackerCommonT.set(Rtotal.x(), Rtotal.y(), Rtotal.z());
801  _TrackerCommonT = align::GlobalVector(Rtotal.x(), Rtotal.y(), Rtotal.z());
802  _TrackerCommonR = align::GlobalVector(Wtotal.x(), Wtotal.y(), Wtotal.z());
803  _TrackerCommonCM = curAli->globalPosition();
804  //_TrackerCommonTR(1) = Rtotal.x(); _TrackerCommonTR(2) = Rtotal.y(); _TrackerCommonTR(3) = Rtotal.z();
805  //_TrackerCommonTR(4) = Wtotal.x(); _TrackerCommonTR(5) = Wtotal.y(); _TrackerCommonTR(6) = Wtotal.z();
806 
807  } else {
808  for (unsigned int i = 0; i < nComp; ++i)
809  diffCommonTrackerSystem(refComp[i], curComp[i]);
810  }
811 }
812 
814  const AlgebraicVector& diff,
815  const TrackerTopology* tTopo,
816  const edm::EventSetup& iSetup) {
817  //Get bad modules
818  edm::ESHandle<SiPixelQuality> SiPixelModules;
819  iSetup.get<SiPixelQualityRcd>().get(SiPixelModules);
820  edm::ESHandle<SiStripQuality> SiStripModules;
821  iSetup.get<SiStripQualityRcd>().get(SiStripModules);
822 
823  _id = refAli->id();
824 
825  _badModuleQuality = 0;
826  //check if module has a bad quality tag
827  if (SiPixelModules->IsModuleBad(_id)) {
828  _badModuleQuality = 1;
829  }
830  if (SiStripModules->IsModuleBad(_id)) {
831  _badModuleQuality = 1;
832  }
833 
834  //check if module is in a given list of bad/untouched etc. modules
835  _inModuleList = 0;
836  for (unsigned int i = 0; i < _moduleList.size(); i++) {
837  if (_moduleList[i] == _id) {
838  _inModuleList = 1;
839  break;
840  }
841  }
842 
843  _level = refAli->alignableObjectId();
844  //need if ali has no mother
845  if (refAli->mother()) {
846  _mid = refAli->mother()->geomDetId().rawId();
847  _mlevel = refAli->mother()->alignableObjectId();
848  } else {
849  _mid = -1;
850  _mlevel = -1;
851  }
852  DetId detid(_id);
853  _sublevel = detid.subdetId();
854  fillIdentifiers(_sublevel, _id, tTopo);
855  _xVal = refAli->globalPosition().x();
856  _yVal = refAli->globalPosition().y();
857  _zVal = refAli->globalPosition().z();
859  _rVal = vec.perp();
860  _phiVal = vec.phi();
861  _etaVal = vec.eta();
863  align::EulerAngles eulerAngles = align::toAngles(rot);
864  _alphaVal = eulerAngles[0];
865  _betaVal = eulerAngles[1];
866  _gammaVal = eulerAngles[2];
867  // global
868  _dxVal = diff[0];
869  _dyVal = diff[1];
870  _dzVal = diff[2];
871  // local
872  _duVal = diff[6];
873  _dvVal = diff[7];
874  _dwVal = diff[8];
875  //...TODO...
877  //getting dR and dPhi
880  _drVal = vCur.perp() - vRef.perp();
881  _dphiVal = vCur.phi() - vRef.phi();
882  // global
883  _dalphaVal = diff[3];
884  _dbetaVal = diff[4];
885  _dgammaVal = diff[5];
886  // local
887  _daVal = diff[9];
888  _dbVal = diff[10];
889  _dgVal = diff[11];
890 
891  //detIdFlag
892  if (refAli->alignableObjectId() == align::AlignableDetUnit) {
893  if (_detIdFlag) {
894  if ((passIdCut(refAli->id())) || (passIdCut(refAli->mother()->id()))) {
895  _useDetId = 1;
896  } else {
897  _useDetId = 0;
898  }
899  }
900  }
901  // det module dimension
902  if (refAli->alignableObjectId() == align::AlignableDetUnit) {
903  if (refAli->mother()->alignableObjectId() != align::AlignableDet)
904  _detDim = 1;
905  else if (refAli->mother()->alignableObjectId() == align::AlignableDet)
906  _detDim = 2;
907  } else
908  _detDim = 0;
909 
910  _surWidth = refAli->surface().width();
911  _surLength = refAli->surface().length();
912  align::RotationType rt = refAli->globalRotation();
913  _surRot[0] = rt.xx();
914  _surRot[1] = rt.xy();
915  _surRot[2] = rt.xz();
916  _surRot[3] = rt.yx();
917  _surRot[4] = rt.yy();
918  _surRot[5] = rt.yz();
919  _surRot[6] = rt.zx();
920  _surRot[7] = rt.zy();
921  _surRot[8] = rt.zz();
922 
923  //Fill
924  _alignTree->Fill();
925 }
926 
928  Alignments* alignVals,
929  AlignmentErrorsExtended* alignErrors) {
930  //getting the right alignables for the alignment record
931  auto detPB = ali->pixelHalfBarrelGeomDets();
932  auto detPEC = ali->pixelEndcapGeomDets();
933  auto detTIB = ali->innerBarrelGeomDets();
934  auto detTID = ali->TIDGeomDets();
935  auto detTOB = ali->outerBarrelGeomDets();
936  auto detTEC = ali->endcapGeomDets();
937 
938  align::Alignables allGeomDets;
939  std::copy(detPB.begin(), detPB.end(), std::back_inserter(allGeomDets));
940  std::copy(detPEC.begin(), detPEC.end(), std::back_inserter(allGeomDets));
941  std::copy(detTIB.begin(), detTIB.end(), std::back_inserter(allGeomDets));
942  std::copy(detTID.begin(), detTID.end(), std::back_inserter(allGeomDets));
943  std::copy(detTOB.begin(), detTOB.end(), std::back_inserter(allGeomDets));
944  std::copy(detTEC.begin(), detTEC.end(), std::back_inserter(allGeomDets));
945 
946  align::Alignables rcdAlis;
947  for (const auto& i : allGeomDets) {
948  if (i->components().size() == 1) {
949  rcdAlis.push_back(i);
950  } else if (i->components().size() > 1) {
951  rcdAlis.push_back(i);
952  const auto& comp = i->components();
953  for (const auto& j : comp)
954  rcdAlis.push_back(j);
955  }
956  }
957 
958  //turning them into alignments
959  for (const auto& k : rcdAlis) {
960  const SurveyDet* surveyInfo = k->survey();
961  const align::PositionType& pos(surveyInfo->position());
962  align::RotationType rot(surveyInfo->rotation());
963  CLHEP::Hep3Vector clhepVector(pos.x(), pos.y(), pos.z());
964  CLHEP::HepRotation clhepRotation(
965  CLHEP::HepRep3x3(rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz()));
966  AlignTransform transform(clhepVector, clhepRotation, k->id());
967  AlignTransformErrorExtended transformError(CLHEP::HepSymMatrix(3, 1), k->id());
968  alignVals->m_align.push_back(transform);
969  alignErrors->m_alignError.push_back(transformError);
970  }
971 
972  // to get the right order, sort by rawId
973  std::sort(alignVals->m_align.begin(), alignVals->m_align.end());
974  std::sort(alignErrors->m_alignError.begin(), alignErrors->m_alignError.end());
975 }
976 
978  const auto& comp = ali->components();
979 
980  unsigned int nComp = comp.size();
981 
982  for (unsigned int i = 0; i < nComp; ++i)
983  addSurveyInfo(comp[i]);
984 
986 
987  if (ali->geomDetId().rawId() != error.rawId() || ali->alignableObjectId() != error.structureType()) {
988  throw cms::Exception("DatabaseError") << "Error reading survey info from DB. Mismatched id!";
989  }
990 
991  const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[theSurveyIndex].translation();
992  const CLHEP::HepRotation& rot = theSurveyValues->m_align[theSurveyIndex].rotation();
993 
994  AlignableSurface surf(
995  align::PositionType(pos.x(), pos.y(), pos.z()),
996  align::RotationType(rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz()));
997 
998  surf.setWidth(ali->surface().width());
999  surf.setLength(ali->surface().length());
1000 
1001  ali->setSurvey(new SurveyDet(surf, error.matrix()));
1002 
1003  ++theSurveyIndex;
1004 }
1005 
1007  bool pass = false;
1008  int nEntries = _detIdFlagVector.size();
1009 
1010  for (int i = 0; i < nEntries; i++) {
1011  if (_detIdFlagVector[i] == id)
1012  pass = true;
1013  }
1014 
1015  return pass;
1016 }
1017 
1018 void TrackerGeometryCompare::fillIdentifiers(int subdetlevel, int rawid, const TrackerTopology* tTopo) {
1019  switch (subdetlevel) {
1020  case 1: {
1021  _identifiers[0] = tTopo->pxbModule(rawid);
1022  _identifiers[1] = tTopo->pxbLadder(rawid);
1023  _identifiers[2] = tTopo->pxbLayer(rawid);
1024  _identifiers[3] = 999;
1025  _identifiers[4] = 999;
1026  _identifiers[5] = 999;
1027  break;
1028  }
1029  case 2: {
1030  _identifiers[0] = tTopo->pxfModule(rawid);
1031  _identifiers[1] = tTopo->pxfPanel(rawid);
1032  _identifiers[2] = tTopo->pxfBlade(rawid);
1033  _identifiers[3] = tTopo->pxfDisk(rawid);
1034  _identifiers[4] = tTopo->pxfSide(rawid);
1035  _identifiers[5] = 999;
1036  break;
1037  }
1038  case 3: {
1039  _identifiers[0] = tTopo->tibModule(rawid);
1040  _identifiers[1] = tTopo->tibStringInfo(rawid)[0];
1041  _identifiers[2] = tTopo->tibStringInfo(rawid)[1];
1042  _identifiers[3] = tTopo->tibStringInfo(rawid)[2];
1043  _identifiers[4] = tTopo->tibLayer(rawid);
1044  _identifiers[5] = 999;
1045  break;
1046  }
1047  case 4: {
1048  _identifiers[0] = tTopo->tidModuleInfo(rawid)[0];
1049  _identifiers[1] = tTopo->tidModuleInfo(rawid)[1];
1050  _identifiers[2] = tTopo->tidRing(rawid);
1051  _identifiers[3] = tTopo->tidWheel(rawid);
1052  _identifiers[4] = tTopo->tidSide(rawid);
1053  _identifiers[5] = 999;
1054  break;
1055  }
1056  case 5: {
1057  _identifiers[0] = tTopo->tobModule(rawid);
1058  _identifiers[1] = tTopo->tobRodInfo(rawid)[0];
1059  _identifiers[2] = tTopo->tobRodInfo(rawid)[1];
1060  _identifiers[3] = tTopo->tobLayer(rawid);
1061  _identifiers[4] = 999;
1062  _identifiers[5] = 999;
1063  break;
1064  }
1065  case 6: {
1066  _identifiers[0] = tTopo->tecModule(rawid);
1067  _identifiers[1] = tTopo->tecRing(rawid);
1068  _identifiers[2] = tTopo->tecPetalInfo(rawid)[0];
1069  _identifiers[3] = tTopo->tecPetalInfo(rawid)[1];
1070  _identifiers[4] = tTopo->tecWheel(rawid);
1071  _identifiers[5] = tTopo->tecSide(rawid);
1072  break;
1073  }
1074  default: {
1075  edm::LogInfo("TrackerGeometryCompare") << "Error: bad subdetid!!";
1076  break;
1077  }
1078  }
1079 }
1080 
T xx() const
align::Scalar width() const
align::StructureType stringToId(const char *) const
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
T getUntrackedParameter(std::string const &, T const &) const
Alignables & pixelHalfBarrelGeomDets()
Return pixel barrel GeomDets.
align::GlobalVector _TrackerCommonR
T perp() const
Definition: PV3DBase.h:69
unsigned int tibLayer(const DetId &id) const
unsigned int tidRing(const DetId &id) const
Vector3DBase< Scalar, GlobalTag > GlobalVector
Definition: Definitions.h:31
void compareGeometries(Alignable *refAli, Alignable *curAli, const TrackerTopology *tTopo, const edm::EventSetup &iSetup)
Class to update a given geometry with a set of alignments.
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
std::vector< align::StructureType > m_theLevels
const double tolerance
unsigned int pxfDisk(const DetId &id) const
ErrorMatrix matrix() const
Definition: SurveyError.h:63
const Alignments * theSurveyValues
unsigned int tecRing(const DetId &id) const
ring id
void addSurveyInfo(Alignable *ali)
#define nullptr
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
unsigned int pxbLadder(const DetId &id) const
align::GlobalVector _TrackerCommonT
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
T y() const
Definition: PV3DBase.h:60
T yx() const
AlgebraicVector diffAlignables(Alignable *refAli, Alignable *curAli, const std::string &weightBy, bool weightById, const std::vector< unsigned int > &weightByIdVector)
Definition: AlignTools.cc:10
void diffCommonTrackerSystem(Alignable *refAli, Alignable *curAli)
unsigned int tidWheel(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
std::vector< TrackerMap > m_vtkmap
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
void setWidth(align::Scalar width)
virtual const Alignables & components() const =0
Return vector of all direct components.
uint8_t structureType() const
Definition: SurveyError.h:59
std::vector< unsigned int > tibStringInfo(const DetId &id) const
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
const align::RotationType & rotation() const
Definition: SurveyDet.h:60
void setLength(align::Scalar length)
T zx() const
T xy() const
const align::PositionType & position() const
Definition: SurveyDet.h:58
T zz() const
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
T mag() const
Definition: PV3DBase.h:64
unsigned int tidSide(const DetId &id) const
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
std::vector< unsigned int > tobRodInfo(const DetId &id) const
Alignables & innerBarrelGeomDets()
Return inner barrel GeomDets.
T z() const
Definition: PV3DBase.h:61
Alignables & TIDGeomDets()
Return TID GeomDets.
std::vector< uint32_t > _detIdFlagVector
T Abs(T a)
Definition: MathUtil.h:49
bool isAvailable() const
Definition: Service.h:40
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
T zy() const
std::vector< int > _moduleList
bool IsModuleBad(const uint32_t &detid) const
align::ID rawId() const
Definition: SurveyError.h:61
void beginJob() override
Read from DB and print survey info.
void analyze(const edm::Event &, const edm::EventSetup &) override
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
TrackerGeometryCompare(const edm::ParameterSet &)
Do nothing. Required by framework.
T * make(const Args &...args) const
make new ROOT object
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:8
align::StructureType _commonTrackerLevel
T yy() const
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker&#39;s geometry.
bool IsModuleBad(const uint32_t &detid) const
Alignables & endcapGeomDets()
Return endcap GeomDets.
align::PositionType _TrackerCommonCM
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
unsigned int tibModule(const DetId &id) const
Alignables & pixelEndcapGeomDets()
Return pixel endcap GeomDets.
unsigned int pxfModule(const DetId &id) const
void fillTree(Alignable *refAli, const AlgebraicVector &diff, const TrackerTopology *tTopo, const edm::EventSetup &iSetup)
ii
Definition: cuy.py:590
unsigned int pxbLayer(const DetId &id) const
unsigned int tecModule(const DetId &id) const
Definition: DetId.h:17
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
CLHEP::HepVector AlgebraicVector
AlgebraicVector EulerAngles
Definition: Definitions.h:34
align::Scalar length() const
Alignables & outerBarrelGeomDets()
Return outer barrel GeomDets.
AlignableTracker * currentTracker
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
void surveyToTracker(AlignableTracker *ali, Alignments *alignVals, AlignmentErrorsExtended *alignErrors)
std::vector< AlignTransformErrorExtended > m_alignError
const std::vector< std::string > _levelStrings
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
std::vector< unsigned int > _weightByIdVector
void fillIdentifiers(int subdetlevel, int rawid, const TrackerTopology *tTopo)
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
unsigned int tobModule(const DetId &id) const
T eta() const
Definition: PV3DBase.h:73
AlignableTracker * referenceTracker
Alignments * alignments() const override
Return alignments, sorted by DetId.
void createROOTGeometry(const edm::EventSetup &iSetup)
T xz() const
AlignmentErrorsExtended * alignmentErrors() const override
Return alignment errors, sorted by DetId.
T get() const
Definition: EventSetup.h:73
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:34
unsigned int pxfSide(const DetId &id) const
const SurveyErrors * theSurveyErrors
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
std::vector< SurveyError > m_surveyErrors
Definition: SurveyErrors.h:22
T x() const
Definition: PV3DBase.h:59
unsigned int tecWheel(const DetId &id) const
void moveAlignable(Alignable *ali, AlgebraicVector diff)
Moves the alignable by the AlgebraicVector.
Definition: AlignTools.cc:84
T const * product() const
Definition: ESHandle.h:86
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
SurfaceDeformation * create(int type, const std::vector< double > &params)
T yz() const
const DetId & geomDetId() const
Definition: Alignable.h:177
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
std::map< std::string, TH1D * > m_h1
unsigned int tobLayer(const DetId &id) const
void compareSurfaceDeformations(TTree *_inputTree11, TTree *_inputTree12)
unsigned int tecSide(const DetId &id) const
unsigned transform(const HcalDetId &id, unsigned transformCode)