CMS 3D CMS Logo

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