CMS 3D CMS Logo

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