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