CMS 3D CMS Logo

HIPAlignmentAlgorithm.cc
Go to the documentation of this file.
1 #include <fstream>
2 #include <unordered_map>
3 
4 #include "TFile.h"
5 #include "TTree.h"
6 #include "TList.h"
7 #include "TRandom.h"
8 #include "TMath.h"
9 
15 
18 
35 
41 
43 
44 // Constructor ----------------------------------------------------------------
47  verbose(cfg.getParameter<bool>("verbosity")),
48  theMonitorConfig(cfg),
49  doTrackHitMonitoring(theMonitorConfig.fillTrackMonitoring || theMonitorConfig.fillTrackHitMonitoring),
50  defaultAlignableSpecs((Alignable*)nullptr),
51  surveyResiduals_(cfg.getUntrackedParameter<std::vector<std::string>>("surveyResiduals")),
52  theTrackHitMonitorIORootFile(nullptr),
53  theTrackMonitorTree(nullptr),
54  theHitMonitorTree(nullptr),
55  theAlignablesMonitorIORootFile(nullptr),
56  theAlignablesMonitorTree(nullptr),
57  theSurveyIORootFile(nullptr),
58  theSurveyTree(nullptr) {
59  // parse parameters
60  outpath = cfg.getParameter<std::string>("outpath");
61  outfile2 = cfg.getParameter<std::string>("outfile2");
62  struefile = cfg.getParameter<std::string>("trueFile");
63  smisalignedfile = cfg.getParameter<std::string>("misalignedFile");
64  salignedfile = cfg.getParameter<std::string>("alignedFile");
65  siterationfile = cfg.getParameter<std::string>("iterationFile");
66  suvarfilecore = cfg.getParameter<std::string>("uvarFile");
68  sparameterfile = cfg.getParameter<std::string>("parameterFile");
69  ssurveyfile = cfg.getParameter<std::string>("surveyFile");
70 
71  outfile2 = outpath + outfile2; //Alignablewise tree
79 
80  // parameters for APE
81  theApplyAPE = cfg.getParameter<bool>("applyAPE");
82  theAPEParameterSet = cfg.getParameter<std::vector<edm::ParameterSet>>("apeParam");
83 
84  themultiIOV = cfg.getParameter<bool>("multiIOV");
85  theIOVrangeSet = cfg.getParameter<std::vector<unsigned>>("IOVrange");
86 
87  defaultAlignableSpecs.minNHits = cfg.getParameter<int>("minimumNumberOfHits");
88  ;
89  defaultAlignableSpecs.minRelParError = cfg.getParameter<double>("minRelParameterError");
90  defaultAlignableSpecs.maxRelParError = cfg.getParameter<double>("maxRelParameterError");
91  defaultAlignableSpecs.maxHitPull = cfg.getParameter<double>("maxAllowedHitPull");
92  theApplyCutsPerComponent = cfg.getParameter<bool>("applyCutsPerComponent");
93  theCutsPerComponent = cfg.getParameter<std::vector<edm::ParameterSet>>("cutsPerComponent");
94 
95  // for collector mode (parallel processing)
96  isCollector = cfg.getParameter<bool>("collectorActive");
97  theCollectorNJobs = cfg.getParameter<int>("collectorNJobs");
98  theCollectorPath = cfg.getParameter<std::string>("collectorPath");
99 
100  if (isCollector)
101  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::HIPAlignmentAlgorithm"
102  << "Collector mode";
103 
104  trackPs = cfg.getParameter<bool>("UsePreSelection");
105  theDataGroup = cfg.getParameter<int>("DataGroup");
106  trackWt = cfg.getParameter<bool>("UseReweighting");
107  Scale = cfg.getParameter<double>("Weight");
108  uniEta = trackWt && cfg.getParameter<bool>("UniformEta");
109  uniEtaFormula = cfg.getParameter<std::string>("UniformEtaFormula");
110  if (uniEtaFormula.empty()) {
111  edm::LogWarning("Alignment") << "@SUB=HIPAlignmentAlgorithm::HIPAlignmentAlgorithm"
112  << "Uniform eta formula is empty! Resetting to 1.";
113  uniEtaFormula = "1";
114  }
115  theEtaFormula = std::make_unique<TFormula>(uniEtaFormula.c_str());
116  rewgtPerAli = trackWt && cfg.getParameter<bool>("ReweightPerAlignable");
117  IsCollision = cfg.getParameter<bool>("isCollision");
118  SetScanDet = cfg.getParameter<std::vector<double>>("setScanDet");
119  col_cut = cfg.getParameter<double>("CLAngleCut");
120  cos_cut = cfg.getParameter<double>("CSAngleCut");
121 
122  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::HIPAlignmentAlgorithm"
123  << "Constructed";
124 }
125 
126 // Call at beginning of job ---------------------------------------------------
130  AlignableExtras* extras,
131  AlignmentParameterStore* store) {
132  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::initialize"
133  << "Initializing...";
134 
135  alignableObjectId_ = std::make_unique<AlignableObjectId>(AlignableObjectId::commonObjectIdProvider(tracker, muon));
136 
137  for (const auto& level : surveyResiduals_)
138  theLevels.push_back(alignableObjectId_->stringToId(level));
139 
140  edm::ESHandle<Alignments> globalPositionRcd;
141 
142  const edm::ValidityInterval& validity = setup.get<TrackerAlignmentRcd>().validityInterval();
143  const edm::IOVSyncValue first1 = validity.first();
144  unsigned int firstrun = first1.eventID().run();
145  if (themultiIOV) {
146  if (theIOVrangeSet.size() != 1) {
147  bool findMatchIOV = false;
148  for (unsigned int iovl = 0; iovl < theIOVrangeSet.size(); iovl++) {
149  if (firstrun == theIOVrangeSet.at(iovl)) {
150  std::string iovapp = std::to_string(firstrun);
151  iovapp.append(".root");
152  iovapp.insert(0, "_");
153  salignedfile.replace(salignedfile.end() - 5, salignedfile.end(), iovapp);
154  siterationfile.replace(siterationfile.end() - 5, siterationfile.end(), iovapp);
155  //sparameterfile.replace(sparameterfile.end()-5, sparameterfile.end(),iovapp);
156  if (isCollector) {
157  outfile2.replace(outfile2.end() - 5, outfile2.end(), iovapp);
158  ssurveyfile.replace(ssurveyfile.end() - 5, ssurveyfile.end(), iovapp);
159  suvarfile.replace(suvarfile.end() - 5, suvarfile.end(), iovapp);
160  }
161 
162  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::initialize"
163  << "Found the IOV file matching IOV first run " << firstrun;
164  findMatchIOV = true;
165  break;
166  }
167  }
168  if (!findMatchIOV)
169  edm::LogError("Alignment") << "@SUB=HIPAlignmentAlgorithm::initialize"
170  << "Didn't find the IOV file matching IOV first run " << firstrun
171  << " from the validity interval";
172  } else {
173  std::string iovapp = std::to_string(theIOVrangeSet.at(0));
174  iovapp.append(".root");
175  iovapp.insert(0, "_");
176  salignedfile.replace(salignedfile.end() - 5, salignedfile.end(), iovapp);
177  siterationfile.replace(siterationfile.end() - 5, siterationfile.end(), iovapp);
178  }
179  }
180 
181  // accessor Det->AlignableDet
182  theAlignableDetAccessor = std::make_unique<AlignableNavigator>(extras, tracker, muon);
183  if (extras != nullptr)
184  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::initialize"
185  << "AlignableNavigator initialized with AlignableExtras";
186 
187  // set alignmentParameterStore
189 
190  // get alignables
192 
193  // Config flags that specify different detectors
194  {
195  AlignmentParameterSelector selector(tracker, muon, extras);
196 
197  // APE parameters, clear if necessary
198  theAPEParameters.clear();
199  if (theApplyAPE) {
200  for (std::vector<edm::ParameterSet>::const_iterator setiter = theAPEParameterSet.begin();
201  setiter != theAPEParameterSet.end();
202  ++setiter) {
203  align::Alignables alignables;
204 
205  selector.clear();
206  edm::ParameterSet selectorPSet = setiter->getParameter<edm::ParameterSet>("Selector");
207  std::vector<std::string> alignParams = selectorPSet.getParameter<std::vector<std::string>>("alignParams");
208  if (alignParams.size() == 1 && alignParams[0] == std::string("selected"))
209  alignables = theAlignables;
210  else {
211  selector.addSelections(selectorPSet);
212  alignables = selector.selectedAlignables();
213  }
214 
215  std::vector<double> apeSPar = setiter->getParameter<std::vector<double>>("apeSPar");
216  std::vector<double> apeRPar = setiter->getParameter<std::vector<double>>("apeRPar");
217  std::string function = setiter->getParameter<std::string>("function");
218 
219  if (apeSPar.size() != 3 || apeRPar.size() != 3)
220  throw cms::Exception("BadConfig") << "apeSPar and apeRPar must have 3 values each" << std::endl;
221 
222  for (std::vector<double>::const_iterator i = apeRPar.begin(); i != apeRPar.end(); ++i)
223  apeSPar.push_back(*i);
224 
225  if (function == std::string("linear"))
226  apeSPar.push_back(0); // c.f. note in calcAPE
227  else if (function == std::string("exponential"))
228  apeSPar.push_back(1); // c.f. note in calcAPE
229  else if (function == std::string("step"))
230  apeSPar.push_back(2); // c.f. note in calcAPE
231  else
232  throw cms::Exception("BadConfig")
233  << "APE function must be \"linear\", \"exponential\", or \"step\"." << std::endl;
234 
235  theAPEParameters.push_back(std::make_pair(alignables, apeSPar));
236  }
237  }
238 
239  // Relative error per component instead of overall relative error
240  theAlignableSpecifics.clear();
242  for (std::vector<edm::ParameterSet>::const_iterator setiter = theCutsPerComponent.begin();
243  setiter != theCutsPerComponent.end();
244  ++setiter) {
245  align::Alignables alignables;
246 
247  selector.clear();
248  edm::ParameterSet selectorPSet = setiter->getParameter<edm::ParameterSet>("Selector");
249  std::vector<std::string> alignParams = selectorPSet.getParameter<std::vector<std::string>>("alignParams");
250  if (alignParams.size() == 1 && alignParams[0] == std::string("selected"))
251  alignables = theAlignables;
252  else {
253  selector.addSelections(selectorPSet);
254  alignables = selector.selectedAlignables();
255  }
256 
257  double minRelParError = setiter->getParameter<double>("minRelParError");
258  double maxRelParError = setiter->getParameter<double>("maxRelParError");
259  int minNHits = setiter->getParameter<int>("minNHits");
260  double maxHitPull = setiter->getParameter<double>("maxHitPull");
261  bool applyPixelProbCut = setiter->getParameter<bool>("applyPixelProbCut");
262  bool usePixelProbXYOrProbQ = setiter->getParameter<bool>("usePixelProbXYOrProbQ");
263  double minPixelProbXY = setiter->getParameter<double>("minPixelProbXY");
264  double maxPixelProbXY = setiter->getParameter<double>("maxPixelProbXY");
265  double minPixelProbQ = setiter->getParameter<double>("minPixelProbQ");
266  double maxPixelProbQ = setiter->getParameter<double>("maxPixelProbQ");
267  for (auto& ali : alignables) {
268  HIPAlignableSpecificParameters alispecs(ali);
269  alispecs.minRelParError = minRelParError;
270  alispecs.maxRelParError = maxRelParError;
271  alispecs.minNHits = minNHits;
272  alispecs.maxHitPull = maxHitPull;
273 
274  alispecs.applyPixelProbCut = applyPixelProbCut;
275  alispecs.usePixelProbXYOrProbQ = usePixelProbXYOrProbQ;
276  alispecs.minPixelProbXY = minPixelProbXY;
277  alispecs.maxPixelProbXY = maxPixelProbXY;
278  alispecs.minPixelProbQ = minPixelProbQ;
279  alispecs.maxPixelProbQ = maxPixelProbQ;
280 
281  theAlignableSpecifics.push_back(alispecs);
282  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::initialize"
283  << "Alignment specifics acquired for detector " << alispecs.id() << " / "
284  << alispecs.objId() << ":\n"
285  << " - minRelParError = " << alispecs.minRelParError << "\n"
286  << " - maxRelParError = " << alispecs.maxRelParError << "\n"
287  << " - minNHits = " << alispecs.minNHits << "\n"
288  << " - maxHitPull = " << alispecs.maxHitPull << "\n"
289  << " - applyPixelProbCut = " << alispecs.applyPixelProbCut << "\n"
290  << " - usePixelProbXYOrProbQ = " << alispecs.usePixelProbXYOrProbQ << "\n"
291  << " - minPixelProbXY = " << alispecs.minPixelProbXY << "\n"
292  << " - maxPixelProbXY = " << alispecs.maxPixelProbXY << "\n"
293  << " - minPixelProbQ = " << alispecs.minPixelProbQ << "\n"
294  << " - maxPixelProbQ = " << alispecs.maxPixelProbQ;
295  }
296  }
297  }
298  }
299 }
300 
301 // Call at new loop -------------------------------------------------------------
303  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::startNewLoop"
304  << "Begin";
305 
306  // iterate over all alignables and attach user variables
307  for (const auto& it : theAlignables) {
308  AlignmentParameters* ap = it->alignmentParameters();
309  int npar = ap->numSelected();
310  HIPUserVariables* userpar = new HIPUserVariables(npar);
311  ap->setUserVariables(userpar);
312  }
313 
314  // try to read in alignment parameters from a previous iteration
315  AlignablePositions theAlignablePositionsFromFile =
317  int numAlignablesFromFile = theAlignablePositionsFromFile.size();
318  if (numAlignablesFromFile == 0) { // file not there: first iteration
319  // set iteration number to 1 when needed
320  if (isCollector)
321  theIteration = 0;
322  else
323  theIteration = 1;
324  edm::LogWarning("Alignment") << "@SUB=HIPAlignmentAlgorithm::startNewLoop"
325  << "IO alignables file not found for iteration " << theIteration;
326  } else { // there have been previous iterations
327  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::startNewLoop"
328  << "Alignables Read " << numAlignablesFromFile;
329 
330  // get iteration number from file
332  // Where is the target for this?
334 
335  // increase iteration
336  if (ioerr == 0) {
337  theIteration++;
338  edm::LogWarning("Alignment") << "@SUB=HIPAlignmentAlgorithm::startNewLoop"
339  << "Iteration increased by one and is now " << theIteration;
340  }
341 
342  // now apply psotions of file from prev iteration
343  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::startNewLoop"
344  << "Apply positions from file ...";
346  }
347 
348  edm::LogWarning("Alignment") << "@SUB=HIPAlignmentAlgorithm::startNewLoop"
349  << "Current Iteration number: " << theIteration;
350 
351  // book root trees
352  bookRoot();
353 
354  // set alignment position error
356 
357  // run collector job if we are in parallel mode
358  if (isCollector)
359  collector();
360 
361  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::startNewLoop"
362  << "End";
363 }
364 
365 // Call at end of job ---------------------------------------------------------
367  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm] Terminating";
368 
369  // calculating survey residuals
370  if (!theLevels.empty()) {
371  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm] Using survey constraint";
372 
373  unsigned int nAlignable = theAlignables.size();
374  edm::ESHandle<TrackerTopology> tTopoHandle;
375  iSetup.get<IdealGeometryRecord>().get(tTopoHandle);
376  const TrackerTopology* const tTopo = tTopoHandle.product();
377  for (unsigned int i = 0; i < nAlignable; ++i) {
378  const Alignable* ali = theAlignables[i];
380  HIPUserVariables* uservar = dynamic_cast<HIPUserVariables*>(ap->userVariables());
381  int nhit = uservar->nhit;
382 
383  // get position
384  std::pair<int, int> tl = theAlignmentParameterStore->typeAndLayer(ali, tTopo);
385  int tmp_Type = tl.first;
386  int tmp_Layer = tl.second;
387  GlobalPoint pos = ali->surface().position();
388  float tmpz = pos.z();
389  if (nhit < 1500 ||
390  (tmp_Type == 5 && tmp_Layer == 4 && fabs(tmpz) > 90)) { // FIXME: Needs revision for hardcoded consts
391  for (unsigned int l = 0; l < theLevels.size(); ++l) {
392  SurveyResidual res(*ali, theLevels[l], true);
393 
394  if (res.valid()) {
395  AlgebraicSymMatrix invCov = res.inverseCovariance();
396 
397  // variable for tree
398  AlgebraicVector sensResid = res.sensorResidual();
399  m3_Id = ali->id();
400  m3_ObjId = theLevels[l];
401  m3_par[0] = sensResid[0];
402  m3_par[1] = sensResid[1];
403  m3_par[2] = sensResid[2];
404  m3_par[3] = sensResid[3];
405  m3_par[4] = sensResid[4];
406  m3_par[5] = sensResid[5];
407 
408  uservar->jtvj += invCov;
409  uservar->jtve += invCov * sensResid;
410 
411  if (theSurveyTree != nullptr)
412  theSurveyTree->Fill();
413  }
414  }
415  }
416  }
417  }
418 
419  // write user variables
421  // don't store userVariable in main, to save time
422  if (!isCollector)
424 
425  // now calculate alignment corrections...
426  int ialigned = 0;
427  // iterate over alignment parameters
428  for (const auto& ali : theAlignables) {
429  AlignmentParameters* par = ali->alignmentParameters();
430 
431  if (SetScanDet.at(0) != 0) {
432  edm::LogWarning("Alignment") << "********Starting Scan*********";
433  edm::LogWarning("Alignment") << "det ID=" << SetScanDet.at(0) << ", starting position=" << SetScanDet.at(1)
434  << ", step=" << SetScanDet.at(2) << ", currentDet = " << ali->id();
435  }
436 
437  if ((SetScanDet.at(0) != 0) && (SetScanDet.at(0) != 1) && (ali->id() != SetScanDet.at(0)))
438  continue;
439 
440  bool test = calcParameters(ali, SetScanDet.at(0), SetScanDet.at(1), SetScanDet.at(2));
441  if (test) {
442  if (dynamic_cast<AlignableDetUnit*>(ali) != nullptr) {
443  std::vector<std::pair<int, SurfaceDeformation*>> pairs;
444  ali->surfaceDeformationIdPairs(pairs);
445  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::terminate"
446  << "The alignable contains " << pairs.size() << " surface deformations";
447  } else
448  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::terminate"
449  << "The alignable cannot contain surface deformations";
450 
452  // set these parameters 'valid'
453  ali->alignmentParameters()->setValid(true);
454  // increase counter
455  ialigned++;
456  } else
457  par->setValid(false);
458  }
459  //end looping over alignables
460 
461  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::terminate] Aligned units: " << ialigned;
462 
463  // fill alignable wise root tree
464  fillAlignablesMonitor(iSetup);
465 
466  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm] Writing aligned parameters to file: " << theAlignables.size()
467  << ", for Iteration " << theIteration;
468 
469  // write user variables
470  if (isCollector)
472 
473  // write new absolute positions to disk
475 
476  // write alignment parameters to disk
477  //theIO.writeAlignmentParameters(theAlignables,
478  // sparameterfile.c_str(),theIteration,false,ioerr);
479 
480  // write iteration number to file
482 
483  // write out trees and close root file
484  // Survey tree
485  if (theSurveyIORootFile != nullptr) {
486  theSurveyIORootFile->cd();
487  if (theSurveyTree != nullptr)
488  theSurveyTree->Write();
489  delete theSurveyTree;
490  theSurveyTree = nullptr;
491  theSurveyIORootFile->Close();
492  }
493  // Alignable-wise tree is only filled once at iteration 1
494  if (theAlignablesMonitorIORootFile != nullptr) {
496  if (theAlignablesMonitorTree != nullptr)
497  theAlignablesMonitorTree->Write();
499  theAlignablesMonitorTree = nullptr;
501  }
502  // Eventwise and hitwise monitoring trees
503  if (theTrackHitMonitorIORootFile != nullptr) {
505  if (theTrackMonitorTree != nullptr) {
506  theTrackMonitorTree->Write();
507  delete theTrackMonitorTree;
508  theTrackMonitorTree = nullptr;
509  }
510  if (theHitMonitorTree != nullptr) {
511  theHitMonitorTree->Write();
512  delete theHitMonitorTree;
513  theHitMonitorTree = nullptr;
514  }
516  }
517 }
518 
520  const Alignable* ali,
521  const HIPAlignableSpecificParameters* alispecifics,
522  const TrajectoryStateOnSurface& tsos,
524  double hitwt) {
525  static const unsigned int hitDim = 1;
526  if (hitwt == 0.)
527  return false;
528 
529  // get trajectory impact point
530  LocalPoint alvec = tsos.localPosition();
531  AlgebraicVector pos(hitDim);
532  pos[0] = alvec.x();
533 
534  // get impact point covariance
535  AlgebraicSymMatrix ipcovmat(hitDim);
536  ipcovmat[0][0] = tsos.localError().positionError().xx();
537 
538  // get hit local position and covariance
539  AlgebraicVector coor(hitDim);
540  coor[0] = hit->localPosition().x();
541 
542  AlgebraicSymMatrix covmat(hitDim);
543  covmat[0][0] = hit->localPositionError().xx();
544 
545  // add hit and impact point covariance matrices
546  covmat = covmat + ipcovmat;
547 
548  // calculate the x pull of this hit
549  double xpull = 0.;
550  if (covmat[0][0] != 0.)
551  xpull = (pos[0] - coor[0]) / sqrt(fabs(covmat[0][0]));
552 
553  // get Alignment Parameters
555  HIPUserVariables* uservar = dynamic_cast<HIPUserVariables*>(params->userVariables());
556  uservar->datatype = theDataGroup;
557  // get derivatives
558  AlgebraicMatrix derivs2D = params->selectedDerivatives(tsos, alidet);
559  // calculate user parameters
560  int npar = derivs2D.num_row();
561  AlgebraicMatrix derivs(npar, hitDim, 0); // This is jT
562 
563  for (int ipar = 0; ipar < npar; ipar++) {
564  for (unsigned int idim = 0; idim < hitDim; idim++) {
565  derivs[ipar][idim] = derivs2D[ipar][idim];
566  }
567  }
568 
569  // invert covariance matrix
570  int ierr;
571  covmat.invert(ierr);
572  if (ierr != 0) {
573  edm::LogError("Alignment") << "@SUB=HIPAlignmentAlgorithm::processHit1D"
574  << "Cov. matrix inversion failed!";
575  return false;
576  }
577 
578  double maxHitPullThreshold =
580  bool useThisHit = (maxHitPullThreshold < 0.);
581  useThisHit |= (fabs(xpull) < maxHitPullThreshold);
582  if (!useThisHit) {
583  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::processHit2D"
584  << "Hit pull (x) " << xpull << " fails the cut " << maxHitPullThreshold;
585  return false;
586  }
587 
588  AlgebraicMatrix covtmp(covmat);
589  AlgebraicMatrix jtvjtmp(derivs * covtmp * derivs.T());
590  AlgebraicSymMatrix thisjtvj(npar);
591  AlgebraicVector thisjtve(npar);
592  thisjtvj.assign(jtvjtmp);
593  thisjtve = derivs * covmat * (pos - coor);
594 
595  AlgebraicVector hitresidual(hitDim);
596  hitresidual[0] = (pos[0] - coor[0]);
597 
598  AlgebraicMatrix hitresidualT;
599  hitresidualT = hitresidual.T();
600 
601  uservar->jtvj += hitwt * thisjtvj;
602  uservar->jtve += hitwt * thisjtve;
603  uservar->nhit++;
604 
605  //for alignable chi squared
606  float thischi2;
607  thischi2 = hitwt * (hitresidualT * covmat * hitresidual)[0];
608 
609  if (verbose && (thischi2 / static_cast<float>(uservar->nhit)) > 10.)
610  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::processHit1D] Added to Chi2 the number " << thischi2
611  << " having " << uservar->nhit << " ndof"
612  << ", X-resid " << hitresidual[0] << ", Cov^-1 matr (covmat):"
613  << " [0][0] = " << covmat[0][0];
614 
615  uservar->alichi2 += thischi2;
616  uservar->alindof += hitDim;
617 
618  return true;
619 }
620 
622  const Alignable* ali,
623  const HIPAlignableSpecificParameters* alispecifics,
624  const TrajectoryStateOnSurface& tsos,
626  double hitwt) {
627  static const unsigned int hitDim = 2;
628  if (hitwt == 0.)
629  return false;
630 
631  // get trajectory impact point
632  LocalPoint alvec = tsos.localPosition();
633  AlgebraicVector pos(hitDim);
634  pos[0] = alvec.x();
635  pos[1] = alvec.y();
636 
637  // get impact point covariance
638  AlgebraicSymMatrix ipcovmat(hitDim);
639  ipcovmat[0][0] = tsos.localError().positionError().xx();
640  ipcovmat[1][1] = tsos.localError().positionError().yy();
641  ipcovmat[0][1] = tsos.localError().positionError().xy();
642 
643  // get hit local position and covariance
644  AlgebraicVector coor(hitDim);
645  coor[0] = hit->localPosition().x();
646  coor[1] = hit->localPosition().y();
647 
648  AlgebraicSymMatrix covmat(hitDim);
649  covmat[0][0] = hit->localPositionError().xx();
650  covmat[1][1] = hit->localPositionError().yy();
651  covmat[0][1] = hit->localPositionError().xy();
652 
653  // add hit and impact point covariance matrices
654  covmat = covmat + ipcovmat;
655 
656  // calculate the x pull and y pull of this hit
657  double xpull = 0.;
658  double ypull = 0.;
659  if (covmat[0][0] != 0.)
660  xpull = (pos[0] - coor[0]) / sqrt(fabs(covmat[0][0]));
661  if (covmat[1][1] != 0.)
662  ypull = (pos[1] - coor[1]) / sqrt(fabs(covmat[1][1]));
663 
664  // get Alignment Parameters
666  HIPUserVariables* uservar = dynamic_cast<HIPUserVariables*>(params->userVariables());
667  uservar->datatype = theDataGroup;
668  // get derivatives
669  AlgebraicMatrix derivs2D = params->selectedDerivatives(tsos, alidet);
670  // calculate user parameters
671  int npar = derivs2D.num_row();
672  AlgebraicMatrix derivs(npar, hitDim, 0); // This is jT
673 
674  for (int ipar = 0; ipar < npar; ipar++) {
675  for (unsigned int idim = 0; idim < hitDim; idim++) {
676  derivs[ipar][idim] = derivs2D[ipar][idim];
677  }
678  }
679 
680  // invert covariance matrix
681  int ierr;
682  covmat.invert(ierr);
683  if (ierr != 0) {
684  edm::LogError("Alignment") << "@SUB=HIPAlignmentAlgorithm::processHit2D"
685  << "Cov. matrix inversion failed!";
686  return false;
687  }
688 
689  double maxHitPullThreshold =
691  bool useThisHit = (maxHitPullThreshold < 0.);
692  useThisHit |= (fabs(xpull) < maxHitPullThreshold && fabs(ypull) < maxHitPullThreshold);
693  if (!useThisHit) {
694  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::processHit2D"
695  << "Hit pull (x,y) " << xpull << " , " << ypull << " fails the cut "
696  << maxHitPullThreshold;
697  return false;
698  }
699 
700  AlgebraicMatrix covtmp(covmat);
701  AlgebraicMatrix jtvjtmp(derivs * covtmp * derivs.T());
702  AlgebraicSymMatrix thisjtvj(npar);
703  AlgebraicVector thisjtve(npar);
704  thisjtvj.assign(jtvjtmp);
705  thisjtve = derivs * covmat * (pos - coor);
706 
707  AlgebraicVector hitresidual(hitDim);
708  hitresidual[0] = (pos[0] - coor[0]);
709  hitresidual[1] = (pos[1] - coor[1]);
710 
711  AlgebraicMatrix hitresidualT;
712  hitresidualT = hitresidual.T();
713 
714  uservar->jtvj += hitwt * thisjtvj;
715  uservar->jtve += hitwt * thisjtve;
716  uservar->nhit++;
717 
718  //for alignable chi squared
719  float thischi2;
720  thischi2 = hitwt * (hitresidualT * covmat * hitresidual)[0];
721 
722  if (verbose && (thischi2 / static_cast<float>(uservar->nhit)) > 10.)
723  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::processHit2D] Added to Chi2 the number " << thischi2
724  << " having " << uservar->nhit << " ndof"
725  << ", X-resid " << hitresidual[0] << ", Y-resid " << hitresidual[1]
726  << ", Cov^-1 matr (covmat):"
727  << " [0][0] = " << covmat[0][0] << " [0][1] = " << covmat[0][1]
728  << " [1][0] = " << covmat[1][0] << " [1][1] = " << covmat[1][1];
729 
730  uservar->alichi2 += thischi2;
731  uservar->alindof += hitDim;
732 
733  return true;
734 }
735 
736 // Run the algorithm on trajectories and tracks -------------------------------
738  if (isCollector)
739  return;
740 
741  TrajectoryStateCombiner tsoscomb;
742 
744 
745  // loop over tracks
746  const ConstTrajTrackPairCollection& tracks = eventInfo.trajTrackPairs();
747  for (ConstTrajTrackPairCollection::const_iterator it = tracks.begin(); it != tracks.end(); ++it) {
748  const Trajectory* traj = (*it).first;
749  const reco::Track* track = (*it).second;
750 
751  float pt = track->pt();
752  float eta = track->eta();
753  float phi = track->phi();
754  float p = track->p();
755  float chi2n = track->normalizedChi2();
756  int nhit = track->numberOfValidHits();
757  float d0 = track->d0();
758  float dz = track->dz();
759 
760  int nhpxb = track->hitPattern().numberOfValidPixelBarrelHits();
761  int nhpxf = track->hitPattern().numberOfValidPixelEndcapHits();
762  int nhtib = track->hitPattern().numberOfValidStripTIBHits();
763  int nhtob = track->hitPattern().numberOfValidStripTOBHits();
764  int nhtid = track->hitPattern().numberOfValidStripTIDHits();
765  int nhtec = track->hitPattern().numberOfValidStripTECHits();
766 
767  if (verbose)
768  edm::LogInfo("Alignment") << "New track pt,eta,phi,chi2n,hits: " << pt << "," << eta << "," << phi << "," << chi2n
769  << "," << nhit;
770 
771  double ihitwt = 1;
772  double trkwt = 1;
773  if (trackWt) {
774  trkwt = Scale;
775  // Reweight by the specified eta distribution
776  if (uniEta)
777  trkwt *= theEtaFormula->Eval(fabs(eta));
778  }
779  if (trackPs) {
780  double r = gRandom->Rndm();
781  if (trkwt < r)
782  continue;
783  } else if (trackWt)
784  ihitwt = trkwt;
785 
786  // fill track parameters in root tree
787  {
788  theMonitorConfig.trackmonitorvars.m_Nhits.push_back(nhit);
794  theMonitorConfig.trackmonitorvars.m_nhPXB.push_back(nhpxb);
795  theMonitorConfig.trackmonitorvars.m_nhPXF.push_back(nhpxf);
796  theMonitorConfig.trackmonitorvars.m_nhTIB.push_back(nhtib);
797  theMonitorConfig.trackmonitorvars.m_nhTOB.push_back(nhtob);
798  theMonitorConfig.trackmonitorvars.m_nhTID.push_back(nhtid);
799  theMonitorConfig.trackmonitorvars.m_nhTEC.push_back(nhtec);
802  theMonitorConfig.trackmonitorvars.m_wt.push_back(ihitwt);
803  }
804 
805  std::vector<const TransientTrackingRecHit*> hitvec;
806  std::vector<TrajectoryStateOnSurface> tsosvec;
807 
808  // loop over measurements
809  std::vector<TrajectoryMeasurement> measurements = traj->measurements();
810  for (std::vector<TrajectoryMeasurement>::iterator im = measurements.begin(); im != measurements.end(); ++im) {
811  TrajectoryMeasurement meas = *im;
812 
813  // const TransientTrackingRecHit* ttrhit = &(*meas.recHit());
814  // const TrackingRecHit *hit = ttrhit->hit();
815  const TransientTrackingRecHit* hit = &(*meas.recHit());
816 
817  if (hit->isValid() && theAlignableDetAccessor->detAndSubdetInMap(hit->geographicalId())) {
818  // this is the updated state (including the current hit)
819  // TrajectoryStateOnSurface tsos=meas.updatedState();
820  // combine fwd and bwd predicted state to get state
821  // which excludes current hit
822 
824  if (eventInfo.clusterValueMap()) {
825  // check from the PrescalingMap if the hit was taken.
826  // If not skip to the next TM
827  // bool hitTaken=false;
828  AlignmentClusterFlag myflag;
829 
830  int subDet = hit->geographicalId().subdetId();
831  //take the actual RecHit out of the Transient one
832  const TrackingRecHit* rechit = hit->hit();
833  if (subDet > 2) { // AM: if possible use enum instead of hard-coded value
834  const std::type_info& type = typeid(*rechit);
835 
836  if (type == typeid(SiStripRecHit1D)) {
837  const SiStripRecHit1D* stripHit1D = dynamic_cast<const SiStripRecHit1D*>(rechit);
838  if (stripHit1D) {
839  SiStripRecHit1D::ClusterRef stripclust(stripHit1D->cluster());
840  // myflag=PrescMap[stripclust];
841  myflag = (*eventInfo.clusterValueMap())[stripclust];
842  } else
843  edm::LogError("HIPAlignmentAlgorithm")
844  << "ERROR in <HIPAlignmentAlgorithm::run>: Dynamic cast of Strip RecHit failed! "
845  << "TypeId of the RecHit: " << className(*hit);
846  } //end if type = SiStripRecHit1D
847  else if (type == typeid(SiStripRecHit2D)) {
848  const SiStripRecHit2D* stripHit2D = dynamic_cast<const SiStripRecHit2D*>(rechit);
849  if (stripHit2D) {
850  SiStripRecHit2D::ClusterRef stripclust(stripHit2D->cluster());
851  // myflag=PrescMap[stripclust];
852  myflag = (*eventInfo.clusterValueMap())[stripclust];
853  } else
854  edm::LogError("HIPAlignmentAlgorithm")
855  << "ERROR in <HIPAlignmentAlgorithm::run>: Dynamic cast of Strip RecHit failed! "
856  << "TypeId of the TTRH: " << className(*hit);
857  } //end if type == SiStripRecHit2D
858  } //end if hit from strips
859  else {
860  const SiPixelRecHit* pixelhit = dynamic_cast<const SiPixelRecHit*>(rechit);
861  if (pixelhit) {
862  SiPixelClusterRefNew pixelclust(pixelhit->cluster());
863  // myflag=PrescMap[pixelclust];
864  myflag = (*eventInfo.clusterValueMap())[pixelclust];
865  } else
866  edm::LogError("HIPAlignmentAlgorithm")
867  << "ERROR in <HIPAlignmentAlgorithm::run>: Dynamic cast of Pixel RecHit failed! "
868  << "TypeId of the TTRH: " << className(*hit);
869  } //end 'else' it is a pixel hit
870  if (!myflag.isTaken())
871  continue;
872  } //end if Prescaled Hits
874 
876 
877  if (tsos.isValid()) {
878  hitvec.push_back(hit);
879  tsosvec.push_back(tsos);
880  }
881 
882  } //hit valid
883  }
884 
885  // transform RecHit vector to AlignableDet vector
886  std::vector<AlignableDetOrUnitPtr> alidetvec = theAlignableDetAccessor->alignablesFromHits(hitvec);
887 
888  // get concatenated alignment parameters for list of alignables
890 
891  std::vector<TrajectoryStateOnSurface>::const_iterator itsos = tsosvec.begin();
892  std::vector<const TransientTrackingRecHit*>::const_iterator ihit = hitvec.begin();
893 
894  // loop over vectors(hit,tsos)
895  while (itsos != tsosvec.end()) {
896  // get AlignableDet for this hit
897  const GeomDet* det = (*ihit)->det();
898  // int subDet= (*ihit)->geographicalId().subdetId();
899  uint32_t nhitDim = (*ihit)->dimension();
900 
901  AlignableDetOrUnitPtr alidet = theAlignableDetAccessor->alignableFromGeomDet(det);
902 
903  // get relevant Alignable
904  Alignable* ali = aap.alignableFromAlignableDet(alidet);
905 
906  if (ali != nullptr) {
907  const HIPAlignableSpecificParameters* alispecifics = findAlignableSpecs(ali);
908  const TrajectoryStateOnSurface& tsos = *itsos;
909 
910  // LocalVector v = tsos.localDirection();
911  // double proj_z = v.dot(LocalVector(0,0,1));
912 
913  //In fact, sin_theta=Abs(mom_z)
914  double mom_x = tsos.localDirection().x();
915  double mom_y = tsos.localDirection().y();
916  double mom_z = tsos.localDirection().z();
917  double sin_theta = TMath::Abs(mom_z) / sqrt(pow(mom_x, 2) + pow(mom_y, 2) + pow(mom_z, 2));
918  double angle = TMath::ASin(sin_theta);
919  double alihitwt = ihitwt;
920 
921  //Make cut on hit impact angle, reduce collision hits perpendicular to modules
922  if (IsCollision) {
923  if (angle > col_cut)
924  alihitwt = 0;
925  } else {
926  if (angle < cos_cut)
927  alihitwt = 0;
928  }
929 
930  // Fill hit monitor variables
934 
935  // Check pixel XY and Q probabilities
936  if ((*ihit)->hit() != nullptr) {
937  const SiPixelRecHit* pixhit = dynamic_cast<const SiPixelRecHit*>((*ihit)->hit());
938  if (pixhit != nullptr) {
941  // Prob X, Y are deprecated
945  if (alispecifics->applyPixelProbCut) {
946  bool probXYgood = (theMonitorConfig.hitmonitorvars.m_probXY >= alispecifics->minPixelProbXY &&
948  bool probQgood = (theMonitorConfig.hitmonitorvars.m_probQ >= alispecifics->minPixelProbQ &&
950  bool probXYQgood;
951  if (alispecifics->usePixelProbXYOrProbQ)
952  probXYQgood = (probXYgood || probQgood);
953  else
954  probXYQgood = (probXYgood && probQgood);
955  if (!probXYQgood)
956  alihitwt = 0;
957  }
958  }
959  }
960  }
961 
963  bool hitProcessed = false;
964  switch (nhitDim) {
965  case 1:
966  hitProcessed = processHit1D(alidet, ali, alispecifics, tsos, *ihit, alihitwt);
967  break;
968  case 2:
969  hitProcessed = processHit2D(alidet, ali, alispecifics, tsos, *ihit, alihitwt);
970  break;
971  default:
972  edm::LogError("HIPAlignmentAlgorithm")
973  << "ERROR in <HIPAlignmentAlgorithm::run>: Number of hit dimensions = " << nhitDim
974  << " is not supported!" << std::endl;
975  break;
976  }
979  }
980 
981  itsos++;
982  ihit++;
983  }
984  } // end of track loop
985 
986  // fill eventwise root tree (with prescale defined in pset)
989 }
990 
991 // ----------------------------------------------------------------------------
993  int result;
994 
995  std::ifstream inIterFile(filename.c_str(), std::ios::in);
996  if (!inIterFile) {
997  edm::LogError("Alignment") << "[HIPAlignmentAlgorithm::readIterationFile] ERROR! "
998  << "Unable to open Iteration file";
999  result = -1;
1000  } else {
1001  inIterFile >> result;
1002  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::readIterationFile] "
1003  << "Read last iteration number from file: " << result;
1004  }
1005  inIterFile.close();
1006 
1007  return result;
1008 }
1009 
1010 // ----------------------------------------------------------------------------
1012  std::ofstream outIterFile((filename.c_str()), std::ios::out);
1013  if (!outIterFile)
1014  edm::LogError("Alignment") << "[HIPAlignmentAlgorithm::writeIterationFile] ERROR: Unable to write Iteration file";
1015  else {
1016  outIterFile << iter;
1017  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::writeIterationFile] writing iteration number to file: "
1018  << iter;
1019  }
1020  outIterFile.close();
1021 }
1022 
1023 // ----------------------------------------------------------------------------
1024 // set alignment position error
1026  // Check if user wants to override APE
1027  if (!theApplyAPE) {
1028  edm::LogInfo("Alignment") << "[HIPAlignmentAlgorithm::setAlignmentPositionError] No APE applied";
1029  return; // NO APE APPLIED
1030  }
1031 
1032  edm::LogInfo("Alignment") << "[HIPAlignmentAlgorithm::setAlignmentPositionError] Apply APE!";
1033 
1034  double apeSPar[3], apeRPar[3];
1035  for (const auto& alipars : theAPEParameters) {
1036  const auto& alignables = alipars.first;
1037  const auto& pars = alipars.second;
1038 
1039  apeSPar[0] = pars[0];
1040  apeSPar[1] = pars[1];
1041  apeSPar[2] = pars[2];
1042  apeRPar[0] = pars[3];
1043  apeRPar[1] = pars[4];
1044  apeRPar[2] = pars[5];
1045 
1046  int function = pars[6];
1047 
1048  // Printout for debug
1049  printf("APE: %u alignables\n", (unsigned int)alignables.size());
1050  for (int i = 0; i < 21; ++i) {
1051  double apelinstest = calcAPE(apeSPar, i, 0);
1052  double apeexpstest = calcAPE(apeSPar, i, 1);
1053  double apestepstest = calcAPE(apeSPar, i, 2);
1054  double apelinrtest = calcAPE(apeRPar, i, 0);
1055  double apeexprtest = calcAPE(apeRPar, i, 1);
1056  double apesteprtest = calcAPE(apeRPar, i, 2);
1057  printf("APE: iter slin sexp sstep rlin rexp rstep: %5d %12.5f %12.5f %12.5f %12.5f %12.5f %12.5f \n",
1058  i,
1059  apelinstest,
1060  apeexpstest,
1061  apestepstest,
1062  apelinrtest,
1063  apeexprtest,
1064  apesteprtest);
1065  }
1066 
1067  // set APE
1068  double apeshift = calcAPE(apeSPar, theIteration, function);
1069  double aperot = calcAPE(apeRPar, theIteration, function);
1070  theAlignmentParameterStore->setAlignmentPositionError(alignables, apeshift, aperot);
1071  }
1072 }
1073 
1074 // ----------------------------------------------------------------------------
1075 // calculate APE
1076 double HIPAlignmentAlgorithm::calcAPE(double* par, int iter, int function) {
1077  double diter = (double)iter;
1078  if (function == 0)
1079  return std::max(par[1], par[0] + ((par[1] - par[0]) / par[2]) * diter);
1080  else if (function == 1)
1081  return std::max(0., par[0] * (exp(-pow(diter, par[1]) / par[2])));
1082  else if (function == 2) {
1083  int ipar2 = (int)par[2];
1084  int step = iter / ipar2;
1085  double dstep = (double)step;
1086  return std::max(0., par[0] - par[1] * dstep);
1087  } else
1088  assert(false); // should have been caught in the constructor
1089 }
1090 
1091 // ----------------------------------------------------------------------------
1092 // book root trees
1094  // create ROOT files
1096  theTrackHitMonitorIORootFile = TFile::Open(theMonitorConfig.outfile.c_str(), "update");
1098  // book event-wise ROOT Tree
1100  TString tname = Form("T1_%i", theIteration);
1101  theTrackMonitorTree = new TTree(tname, "Eventwise tree");
1102  //theTrackMonitorTree->Branch("Run", &m_Run, "Run/I");
1103  //theTrackMonitorTree->Branch("Event", &m_Event, "Event/I");
1104  theTrackMonitorTree->Branch("DataType", &m_datatype);
1107  }
1108  // book hit-wise ROOT Tree
1110  TString tname_hit = Form("T1_hit_%i", theIteration);
1111  theHitMonitorTree = new TTree(tname_hit, "Hitwise tree");
1112  theHitMonitorTree->Branch("DataType", &m_datatype);
1115  }
1116  }
1117 
1118  // book alignable-wise ROOT Tree
1119  if (isCollector) {
1120  TString tname = Form("T2_%i", theIteration);
1121  theAlignablesMonitorIORootFile = TFile::Open(outfile2.c_str(), "update");
1123  theAlignablesMonitorTree = new TTree(tname, "Alignablewise tree");
1124  theAlignablesMonitorTree->Branch("Id", &m2_Id, "Id/i");
1125  theAlignablesMonitorTree->Branch("ObjId", &m2_ObjId, "ObjId/I");
1126  theAlignablesMonitorTree->Branch("Nhit", &m2_Nhit);
1127  theAlignablesMonitorTree->Branch("DataType", &m2_datatype);
1128  theAlignablesMonitorTree->Branch("Type", &m2_Type);
1129  theAlignablesMonitorTree->Branch("Layer", &m2_Layer);
1130  theAlignablesMonitorTree->Branch("Xpos", &m2_Xpos);
1131  theAlignablesMonitorTree->Branch("Ypos", &m2_Ypos);
1132  theAlignablesMonitorTree->Branch("Zpos", &m2_Zpos);
1133  theAlignablesMonitorTree->Branch("DeformationsType", &m2_dtype, "DeformationsType/I");
1134  theAlignablesMonitorTree->Branch("NumDeformations", &m2_nsurfdef);
1135  theAlignablesMonitorTree->Branch("Deformations", &m2_surfDef);
1136  }
1137 
1138  // book survey-wise ROOT Tree only if survey is enabled
1139  if (!theLevels.empty()) {
1140  TString tname = Form("T3_%i", theIteration);
1141  theSurveyIORootFile = TFile::Open(ssurveyfile.c_str(), "update");
1142  theSurveyIORootFile->cd();
1143  theSurveyTree = new TTree(tname, "Survey Tree");
1144  theSurveyTree->Branch("Id", &m3_Id, "Id/i");
1145  theSurveyTree->Branch("ObjId", &m3_ObjId, "ObjId/I");
1146  theSurveyTree->Branch("Par", &m3_par, "Par[6]/F");
1147  edm::LogInfo("Alignment") << "[HIPAlignmentAlgorithm::bookRoot] Survey trees booked.";
1148  }
1149  edm::LogInfo("Alignment") << "[HIPAlignmentAlgorithm::bookRoot] Root trees booked.";
1150 }
1151 
1152 // ----------------------------------------------------------------------------
1153 // fill alignable-wise root tree
1155  if (theAlignablesMonitorIORootFile == (TFile*)nullptr)
1156  return;
1157  using std::setw;
1159 
1160  int naligned = 0;
1161 
1162  //Retrieve tracker topology from geometry
1163  edm::ESHandle<TrackerTopology> tTopoHandle;
1164  // iSetup.get<IdealGeometryRecord>().get(tTopoHandle);
1165  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
1166 
1167  const TrackerTopology* const tTopo = tTopoHandle.product();
1168 
1169  for (const auto& ali : theAlignables) {
1170  AlignmentParameters* dap = ali->alignmentParameters();
1171 
1172  // consider only those parameters classified as 'valid'
1173  if (dap->isValid()) {
1174  // get number of hits from user variable
1175  HIPUserVariables* uservar = dynamic_cast<HIPUserVariables*>(dap->userVariables());
1176  m2_Nhit = uservar->nhit;
1177  m2_datatype = uservar->datatype;
1178 
1179  // get type/layer
1180  std::pair<int, int> tl = theAlignmentParameterStore->typeAndLayer(ali, tTopo);
1181  m2_Type = tl.first;
1182  m2_Layer = tl.second;
1183 
1184  // get identifier (as for IO)
1185  m2_Id = ali->id();
1186  m2_ObjId = ali->alignableObjectId();
1187 
1188  // get position
1189  GlobalPoint pos = ali->surface().position();
1190  m2_Xpos = pos.x();
1191  m2_Ypos = pos.y();
1192  m2_Zpos = pos.z();
1193 
1194  m2_surfDef.clear();
1195  {
1196  std::vector<std::pair<int, SurfaceDeformation*>> dali_id_pairs;
1197  SurfaceDeformation* dali_obj = nullptr;
1199  std::vector<double> dali;
1200  if (1 == ali->surfaceDeformationIdPairs(dali_id_pairs)) {
1201  dali_obj = dali_id_pairs[0].second;
1202  dali = dali_obj->parameters();
1204  }
1205  for (auto& dit : dali)
1206  m2_surfDef.push_back((float)dit);
1207  m2_dtype = dtype;
1208  m2_nsurfdef = m2_surfDef.size();
1209  }
1210 
1211  if (verbose) {
1212  AlgebraicVector pars = dap->parameters();
1213  edm::LogVerbatim("Alignment") << "------------------------------------------------------------------------\n"
1214  << " ALIGNABLE: " << setw(6) << naligned << '\n'
1215  << "hits: " << setw(4) << m2_Nhit << " type: " << setw(4) << m2_Type
1216  << " layer: " << setw(4) << m2_Layer << " id: " << setw(4) << m2_Id
1217  << " objId: " << setw(4) << m2_ObjId << '\n'
1218  << std::fixed << std::setprecision(5) << "x,y,z: " << setw(12) << m2_Xpos
1219  << setw(12) << m2_Ypos << setw(12) << m2_Zpos
1220  << "\nDeformations type, nDeformations: " << setw(12) << m2_dtype << setw(12)
1221  << m2_nsurfdef << '\n'
1222  << "params: " << setw(12) << pars[0] << setw(12) << pars[1] << setw(12) << pars[2]
1223  << setw(12) << pars[3] << setw(12) << pars[4] << setw(12) << pars[5];
1224  }
1225 
1226  naligned++;
1227  if (theAlignablesMonitorTree != nullptr)
1228  theAlignablesMonitorTree->Fill();
1229  }
1230  }
1231 }
1232 
1233 // ----------------------------------------------------------------------------
1234 bool HIPAlignmentAlgorithm::calcParameters(Alignable* ali, int setDet, double start, double step) {
1235  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::calcParameters"
1236  << "Begin: Processing detector " << ali->id();
1237 
1238  // Alignment parameters
1240  const HIPAlignableSpecificParameters* alispecifics = findAlignableSpecs(ali);
1241  // access user variables
1242  HIPUserVariables* uservar = dynamic_cast<HIPUserVariables*>(par->userVariables());
1243  int nhit = uservar->nhit;
1244  // The following variable is needed for the extended 1D/2D hit fix using
1245  // matrix shrinkage and expansion
1246  // int hitdim = uservar->hitdim;
1247 
1248  // Test nhits
1249  int minHitThreshold = (!theApplyCutsPerComponent ? defaultAlignableSpecs.minNHits : alispecifics->minNHits);
1250  if (!isCollector)
1251  minHitThreshold = 1;
1252  if (setDet == 0 && nhit < minHitThreshold) {
1253  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::calcParameters"
1254  << "Skipping detector " << ali->id() << " because number of hits = " << nhit
1255  << " <= " << minHitThreshold;
1256  par->setValid(false);
1257  return false;
1258  }
1259 
1260  AlgebraicSymMatrix jtvj = uservar->jtvj;
1261  AlgebraicVector jtve = uservar->jtve;
1262 
1263  // these are the alignment corrections+covariance (for selected params)
1264  int npar = jtve.num_row();
1265  AlgebraicVector params(npar);
1266  AlgebraicVector paramerr(npar);
1267  AlgebraicSymMatrix cov(npar);
1268 
1269  // errors of parameters
1270  if (isCollector) {
1271  if (setDet == 0) {
1272  int ierr;
1273  AlgebraicSymMatrix jtvjinv = jtvj.inverse(ierr);
1274  if (ierr != 0) {
1275  edm::LogError("Alignment") << "@SUB=HIPAlignmentAlgorithm::calcParameters"
1276  << "Matrix inversion failed!";
1277  return false;
1278  }
1279  params = -(jtvjinv * jtve);
1280  cov = jtvjinv;
1281 
1282  double minRelErrThreshold =
1284  double maxRelErrThreshold =
1286  for (int i = 0; i < npar; i++) {
1287  double relerr = 0;
1288  if (fabs(cov[i][i]) > 0.)
1289  paramerr[i] = sqrt(fabs(cov[i][i]));
1290  else
1291  paramerr[i] = params[i];
1292  if (params[i] != 0.)
1293  relerr = fabs(paramerr[i] / params[i]);
1294  if ((maxRelErrThreshold >= 0. && relerr > maxRelErrThreshold) || relerr < minRelErrThreshold) {
1295  edm::LogWarning("Alignment") << "@SUB=HIPAlignmentAlgorithm::calcParameters"
1296  << "RelError = " << relerr << " > " << maxRelErrThreshold << " or < "
1297  << minRelErrThreshold << ". Setting param = paramerr = 0 for component " << i;
1298  params[i] = 0;
1299  paramerr[i] = 0;
1300  }
1301  }
1302  } else {
1303  if (params.num_row() != 1) {
1304  edm::LogError("Alignment") << "@SUB=HIPAlignmentAlgorithm::calcParameters"
1305  << "For scanning, please only turn on one parameter! check common_cff_py.txt";
1306  return false;
1307  }
1308  if (theIteration == 1)
1309  params[0] = start;
1310  else
1311  params[0] = step;
1312  edm::LogWarning("Alignment") << "@SUB=HIPAlignmentAlgorithm::calcParameters"
1313  << "Parameters = " << params;
1314  }
1315  }
1316 
1317  uservar->alipar = params;
1318  uservar->alierr = paramerr;
1319 
1320  AlignmentParameters* parnew = par->cloneFromSelected(params, cov);
1321  ali->setAlignmentParameters(parnew);
1322  parnew->setValid(true);
1323 
1324  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::calcParameters"
1325  << "End: Processing detector " << ali->id();
1326 
1327  return true;
1328 }
1329 
1330 //-----------------------------------------------------------------------------
1332  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::collector"
1333  << "Called for iteration " << theIteration;
1334 
1335  std::vector<std::string> monitorFileList;
1336  HIPUserVariablesIORoot HIPIO;
1337 
1338  typedef int pawt_t;
1339  std::unordered_map<Alignable*, std::unordered_map<int, pawt_t>> ali_datatypecountpair_map;
1340  if (rewgtPerAli) {
1341  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::collector"
1342  << "Per-alignable reweighting is turned on. Iterating over the parallel jobs to sum "
1343  "number of hits per alignable for each data type.";
1344  // Counting step for per-alignable reweighting
1345  for (int ijob = 1; ijob <= theCollectorNJobs; ijob++) {
1346  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::collector"
1347  << "Pre-reading uservar for job " << ijob;
1348 
1349  std::string str = std::to_string(ijob);
1350  std::string uvfile = theCollectorPath + "/job" + str + "/" + suvarfilecore;
1351 
1352  std::vector<AlignmentUserVariables*> uvarvec =
1353  HIPIO.readHIPUserVariables(theAlignables, uvfile.c_str(), theIteration, ioerr);
1354  if (uvarvec.size() != theAlignables.size())
1355  edm::LogWarning("Alignment") << "@SUB=HIPAlignmentAlgorithm::collector"
1356  << "Number of alignables = " << theAlignables.size()
1357  << " is not the same as number of user variables = " << uvarvec.size()
1358  << ". A mismatch might occur!";
1359  if (ioerr != 0) {
1360  edm::LogError("Alignment") << "@SUB=HIPAlignmentAlgorithm::collector"
1361  << "Could not read user variable files for job " << ijob << " in iteration "
1362  << theIteration;
1363  continue;
1364  }
1365  std::vector<AlignmentUserVariables*>::const_iterator iuvar =
1366  uvarvec.begin(); // This vector should have 1-to-1 correspondence with the alignables vector
1367  for (const auto& ali : theAlignables) {
1368  // No need for the user variables already attached to the alignables
1369  // Just count from what you read.
1370  HIPUserVariables* uvar = dynamic_cast<HIPUserVariables*>(*iuvar);
1371  if (uvar != nullptr) {
1372  int alijobdtype = uvar->datatype;
1373  pawt_t alijobnhits = uvar->nhit;
1374  if (ali_datatypecountpair_map.find(ali) == ali_datatypecountpair_map.end()) { // This is a new alignable
1375  std::unordered_map<int, pawt_t> newmap;
1376  ali_datatypecountpair_map[ali] = newmap;
1377  ali_datatypecountpair_map[ali][alijobdtype] = alijobnhits;
1378  } else { // Alignable already exists in the map
1379  std::unordered_map<int, pawt_t>& theMap = ali_datatypecountpair_map[ali];
1380  if (theMap.find(alijobdtype) == theMap.end())
1381  theMap[alijobdtype] = alijobnhits;
1382  else
1383  theMap[alijobdtype] += alijobnhits;
1384  }
1385  delete uvar; // Delete new user variables as they are added
1386  }
1387  iuvar++;
1388  } // End loop over alignables
1389  } // End loop over subjobs
1390  }
1391 
1392  for (int ijob = 1; ijob <= theCollectorNJobs; ijob++) {
1393  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::collector"
1394  << "Reading uservar for job " << ijob;
1395 
1396  std::string str = std::to_string(ijob);
1397  std::string uvfile = theCollectorPath + "/job" + str + "/" + suvarfilecore;
1398 
1399  std::vector<AlignmentUserVariables*> uvarvec =
1400  HIPIO.readHIPUserVariables(theAlignables, uvfile.c_str(), theIteration, ioerr);
1401  if (uvarvec.size() != theAlignables.size())
1402  edm::LogWarning("Alignment") << "@SUB=HIPAlignmentAlgorithm::collector"
1403  << "Number of alignables = " << theAlignables.size()
1404  << " is not the same as number of user variables = " << uvarvec.size()
1405  << ". A mismatch might occur!";
1406 
1407  if (ioerr != 0) {
1408  edm::LogError("Alignment") << "@SUB=HIPAlignmentAlgorithm::collector"
1409  << "Could not read user variable files for job " << ijob << " in iteration "
1410  << theIteration;
1411  continue;
1412  }
1413 
1414  // add
1415  std::vector<AlignmentUserVariables*> uvarvecadd;
1416  std::vector<AlignmentUserVariables*>::const_iterator iuvarnew = uvarvec.begin();
1417  for (const auto& ali : theAlignables) {
1418  AlignmentParameters* ap = ali->alignmentParameters();
1419 
1420  HIPUserVariables* uvarold = dynamic_cast<HIPUserVariables*>(ap->userVariables());
1421  HIPUserVariables* uvarnew = dynamic_cast<HIPUserVariables*>(*iuvarnew);
1422 
1423  HIPUserVariables* uvar = uvarold->clone();
1424  uvar->datatype =
1425  theDataGroup; // Set the data type of alignable to that specified for the collector job (-2 by default)
1426 
1427  if (uvarnew != nullptr) {
1428  double peraliwgt = 1;
1429  if (rewgtPerAli) {
1430  int alijobdtype = uvarnew->datatype;
1431  if (ali_datatypecountpair_map.find(ali) != ali_datatypecountpair_map.end() &&
1432  ali_datatypecountpair_map[ali].find(alijobdtype) != ali_datatypecountpair_map[ali].end()) {
1433  peraliwgt = ali_datatypecountpair_map[ali][alijobdtype];
1434  unsigned int nNonZeroTypes = 0;
1435  pawt_t sumwgts = 0;
1436  for (auto it = ali_datatypecountpair_map[ali].cbegin(); it != ali_datatypecountpair_map[ali].cend(); ++it) {
1437  sumwgts += it->second;
1438  if (it->second != pawt_t(0))
1439  nNonZeroTypes++;
1440  }
1441  edm::LogInfo("Alignment") << "@SUB=HIPAlignmentAlgorithm::collector"
1442  << "Reweighting detector " << ali->id() << " / " << ali->alignableObjectId()
1443  << " for data type " << alijobdtype << " by " << sumwgts << "/" << peraliwgt
1444  << "/" << nNonZeroTypes;
1445  peraliwgt = ((nNonZeroTypes == 0 || peraliwgt == double(0))
1446  ? double(1)
1447  : double((double(sumwgts)) / peraliwgt / (double(nNonZeroTypes))));
1448  } else if (ali_datatypecountpair_map.find(ali) != ali_datatypecountpair_map.end())
1449  edm::LogError("Alignment") << "@SUB=HIPAlignmentAlgorithm::collector"
1450  << "Could not find data type " << alijobdtype << " for detector " << ali->id()
1451  << " / " << ali->alignableObjectId();
1452  else
1453  edm::LogError("Alignment") << "@SUB=HIPAlignmentAlgorithm::collector"
1454  << "Could not find detector " << ali->id() << " / " << ali->alignableObjectId()
1455  << " in the map ali_datatypecountpair_map";
1456  }
1457 
1458  uvar->nhit = (uvarold->nhit) + (uvarnew->nhit);
1459  uvar->jtvj = (uvarold->jtvj) + peraliwgt * (uvarnew->jtvj);
1460  uvar->jtve = (uvarold->jtve) + peraliwgt * (uvarnew->jtve);
1461  uvar->alichi2 = (uvarold->alichi2) + peraliwgt * (uvarnew->alichi2);
1462  uvar->alindof = (uvarold->alindof) + (uvarnew->alindof);
1463 
1464  delete uvarnew; // Delete new user variables as they are added
1465  }
1466 
1467  uvarvecadd.push_back(uvar);
1468  iuvarnew++;
1469  }
1470 
1472 
1473  // fill Eventwise Tree
1474  if (doTrackHitMonitoring) {
1475  uvfile = theCollectorPath + "/job" + str + "/" + theMonitorConfig.outfilecore;
1476  monitorFileList.push_back(uvfile);
1477  }
1478  } // end loop on jobs
1479 
1480  // Collect monitor (eventwise and hitwise) trees
1482  collectMonitorTrees(monitorFileList);
1483 }
1484 
1485 //------------------------------------------------------------------------------------
1486 void HIPAlignmentAlgorithm::collectMonitorTrees(const std::vector<std::string>& filenames) {
1487  if (!doTrackHitMonitoring)
1488  return;
1489  if (!isCollector)
1490  throw cms::Exception("LogicError") << "[HIPAlignmentAlgorithm::collectMonitorTrees] Called in non-collector mode."
1491  << std::endl;
1492 
1493  TString theTrackMonitorTreeName = Form("T1_%i", theIteration);
1494  TString theHitMonitorTreeName = Form("T1_hit_%i", theIteration);
1495 
1496  std::vector<TFile*> finputlist;
1497  TList* eventtrees = new TList;
1498  TList* hittrees = new TList;
1499  for (std::string const& filename : filenames) {
1500  TFile* finput = TFile::Open(filename.c_str(), "read");
1501  if (finput != nullptr) {
1502  TTree* tmptree;
1504  tmptree = nullptr;
1505  tmptree = (TTree*)finput->Get(theTrackMonitorTreeName);
1506  if (tmptree != nullptr)
1507  eventtrees->Add(tmptree);
1508  }
1510  tmptree = nullptr;
1511  tmptree = (TTree*)finput->Get(theHitMonitorTreeName);
1512  if (tmptree != nullptr)
1513  hittrees->Add((TTree*)finput->Get(theHitMonitorTreeName));
1514  }
1515  finputlist.push_back(finput);
1516  }
1517  }
1518 
1519  if (theTrackHitMonitorIORootFile != nullptr) { // This should never happen
1520  edm::LogError("Alignment") << "@SUB=HIPAlignmentAlgorithm::collectMonitorTrees"
1521  << "Monitor file is already open while it is not supposed to be!";
1522  delete theTrackMonitorTree;
1523  theTrackMonitorTree = nullptr;
1524  delete theHitMonitorTree;
1525  theHitMonitorTree = nullptr;
1527  }
1528  theTrackHitMonitorIORootFile = TFile::Open(theMonitorConfig.outfile.c_str(), "update");
1530  if (eventtrees->GetSize() > 0)
1531  theTrackMonitorTree = TTree::MergeTrees(eventtrees);
1532  if (hittrees->GetSize() > 0)
1533  theHitMonitorTree = TTree::MergeTrees(hittrees);
1534  // Leave it to HIPAlignmentAlgorithm::terminate to write the trees and close theTrackHitMonitorIORootFile
1535 
1536  delete hittrees;
1537  delete eventtrees;
1538  for (TFile*& finput : finputlist)
1539  finput->Close();
1540 
1541  // Rename the trees to standard names
1542  if (theTrackMonitorTree != nullptr)
1543  theTrackMonitorTree->SetName(theTrackMonitorTreeName);
1544  if (theHitMonitorTree != nullptr)
1545  theHitMonitorTree->SetName(theHitMonitorTreeName);
1546 }
1547 
1548 //-----------------------------------------------------------------------------------
1550  if (ali != nullptr) {
1551  for (std::vector<HIPAlignableSpecificParameters>::iterator it = theAlignableSpecifics.begin();
1552  it != theAlignableSpecifics.end();
1553  it++) {
1554  if (it->matchAlignable(ali))
1555  return &(*it);
1556  }
1557  edm::LogInfo("Alignment") << "[HIPAlignmentAlgorithm::findAlignableSpecs] Alignment object with id " << ali->id()
1558  << " / " << ali->alignableObjectId() << " could not be found. Returning default.";
1559  }
1560  return &defaultAlignableSpecs;
1561 }
personalPlayback.level
level
Definition: personalPlayback.py:22
HIPHitMonitorVariables::m_probQ
float m_probQ
Definition: HIPMonitorConfig.h:87
TrajectoryStateCombiner.h
HIPAlignmentAlgorithm::writeIterationFile
void writeIterationFile(std::string filename, int iter)
Definition: HIPAlignmentAlgorithm.cc:1011
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
HIPTrackMonitorVariables::fill
void fill() override
Definition: HIPMonitorConfig.cc:74
AlignmentIORoot::writeAlignableAbsolutePositions
void writeAlignableAbsolutePositions(const align::Alignables &alivec, const char *filename, int iter, bool validCheck, int &ierr) override
write Alignable current absolute positions
Definition: AlignmentIORoot.cc:145
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
GlobalPositionRcd.h
SiStripRecHit2D::cluster
ClusterRef cluster() const
Definition: SiStripRecHit2D.h:22
HIPAlignmentAlgorithm::theMonitorConfig
HIPMonitorConfig theMonitorConfig
Definition: HIPAlignmentAlgorithm.h:98
HIPAlignmentAlgorithm::theCollectorNJobs
int theCollectorNJobs
Definition: HIPAlignmentAlgorithm.h:124
electrons_cff.bool
bool
Definition: electrons_cff.py:366
HIPAlignmentAlgorithm::fillAlignablesMonitor
void fillAlignablesMonitor(const edm::EventSetup &setup)
Definition: HIPAlignmentAlgorithm.cc:1154
mps_fire.i
i
Definition: mps_fire.py:428
start
Definition: start.py:1
AlignmentAlgorithmBase::ConstTrajTrackPairCollection
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
Definition: AlignmentAlgorithmBase.h:67
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
HIPAlignmentAlgorithm::theTrackHitMonitorIORootFile
TFile * theTrackHitMonitorIORootFile
Definition: HIPAlignmentAlgorithm.h:138
HIPAlignmentAlgorithm::theApplyCutsPerComponent
bool theApplyCutsPerComponent
Definition: HIPAlignmentAlgorithm.h:118
HIPAlignmentAlgorithm::alignableObjectId_
std::unique_ptr< AlignableObjectId > alignableObjectId_
Definition: HIPAlignmentAlgorithm.h:84
ESTransientHandle.h
MessageLogger.h
AlignableDetUnit.h
HIPMonitorConfig::outfile
std::string outfile
Definition: HIPMonitorConfig.h:127
chi2n
Definition: HIMultiTrackSelector.h:45
HIPUserVariablesIORoot::writeHIPUserVariables
void writeHIPUserVariables(const Alignables &alivec, const char *filename, int iter, bool validCheck, int &ierr)
Definition: HIPUserVariablesIORoot.cc:184
HIPAlignmentAlgorithm::smisalignedfile
std::string smisalignedfile
Definition: HIPAlignmentAlgorithm.h:102
Alignable::setAlignmentParameters
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:123
GeomDet
Definition: GeomDet.h:27
HIPAlignmentAlgorithm::ssurveyfile
std::string ssurveyfile
Definition: HIPAlignmentAlgorithm.h:102
HIPAlignmentAlgorithm::theEtaFormula
std::unique_ptr< TFormula > theEtaFormula
Definition: HIPAlignmentAlgorithm.h:132
HIPUserVariables::clone
HIPUserVariables * clone(void) const override
Definition: HIPUserVariables.h:41
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
AlignmentParameterStore::alignables
const align::Alignables & alignables(void) const
get all alignables
Definition: AlignmentParameterStore.h:47
ESHandle.h
LocalTrajectoryError::positionError
LocalError positionError() const
Definition: LocalTrajectoryError.h:81
step
step
Definition: StallMonitor.cc:94
HIPAlignmentAlgorithm::HIPAlignmentAlgorithm
HIPAlignmentAlgorithm(const edm::ParameterSet &cfg)
Constructor.
Definition: HIPAlignmentAlgorithm.cc:45
LocalError::xy
float xy() const
Definition: LocalError.h:23
AlignmentParameterStore::selectParameters
CompositeAlignmentParameters selectParameters(const std::vector< AlignableDet * > &alignabledets) const
Definition: AlignmentParameterStore.cc:65
HIPTrackMonitorVariables::m_Phi
std::vector< float > m_Phi
Definition: HIPMonitorConfig.h:29
muon
Definition: MuonCocktails.h:17
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
HIPHitMonitorVariables::fill
void fill() override
Definition: HIPMonitorConfig.cc:117
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
AlignmentParameterSelector.h
HIPAlignableSpecificParameters::minPixelProbQ
double minPixelProbQ
Definition: HIPAlignableSpecificParameters.h:23
HIPAlignmentAlgorithm::theAlignablesMonitorTree
TTree * theAlignablesMonitorTree
Definition: HIPAlignmentAlgorithm.h:142
HIPMonitorConfig::fillTrackHitMonitoring
const bool fillTrackHitMonitoring
Definition: HIPMonitorConfig.h:123
TrackerTopology
Definition: TrackerTopology.h:16
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HIPAlignmentAlgorithm::bookRoot
void bookRoot(void)
Definition: HIPAlignmentAlgorithm.cc:1093
HIPHitMonitorVariables::m_hitwt
float m_hitwt
Definition: HIPMonitorConfig.h:87
ValidityInterval.h
HIPAlignmentAlgorithm::uniEta
bool uniEta
Definition: HIPAlignmentAlgorithm.h:127
Alignable
Definition: Alignable.h:27
pos
Definition: PixelAliasList.h:18
HIPAlignableSpecificParameters::maxRelParError
double maxRelParError
Definition: HIPAlignableSpecificParameters.h:16
HIPAlignmentAlgorithm::IsCollision
bool IsCollision
Definition: HIPAlignmentAlgorithm.h:127
CompositeAlignmentParameters
Definition: CompositeAlignmentParameters.h:27
AlignmentParameterStore::attachUserVariables
void attachUserVariables(const align::Alignables &alivec, const std::vector< AlignmentUserVariables * > &uvarvec, int &ierr)
Attach User Variables to given alignables.
Definition: AlignmentParameterStore.cc:629
edm::ValidityInterval
Definition: ValidityInterval.h:28
AlignableExtras.h
HIPAlignmentAlgorithm::m2_Id
align::ID m2_Id
Definition: HIPAlignmentAlgorithm.h:150
AlignableObjectId::commonObjectIdProvider
static AlignableObjectId commonObjectIdProvider(const AlignableObjectId &, const AlignableObjectId &)
Definition: AlignableObjectId.cc:335
cms::cuda::assert
assert(be >=bs)
AlignmentParameters::userVariables
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
Definition: AlignmentParameters.cc:101
HIPAlignmentAlgorithm::theCutsPerComponent
std::vector< edm::ParameterSet > theCutsPerComponent
Definition: HIPAlignmentAlgorithm.h:119
HIPAlignmentAlgorithm::processHit2D
bool processHit2D(const AlignableDetOrUnitPtr &alidet, const Alignable *ali, const HIPAlignableSpecificParameters *alispecifics, const TrajectoryStateOnSurface &tsos, const TrackingRecHit *hit, double hitwt)
Definition: HIPAlignmentAlgorithm.cc:621
edm::ValidityInterval::first
const IOVSyncValue & first() const
Definition: ValidityInterval.h:37
HIPAlignmentAlgorithm::m2_datatype
int m2_datatype
Definition: HIPAlignmentAlgorithm.h:153
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
TrackerAlignmentRcd
Definition: TrackerAlignmentRcd.h:6
HIPAlignmentAlgorithm::theAPEParameters
std::vector< std::pair< align::Alignables, std::vector< double > > > theAPEParameters
Definition: HIPAlignmentAlgorithm.h:110
AlignmentParameterStore::setAlignmentPositionError
void setAlignmentPositionError(const align::Alignables &alivec, double valshift, double valrot)
Set Alignment position error.
Definition: AlignmentParameterStore.cc:646
HIPAlignmentAlgorithm::SetScanDet
std::vector< double > SetScanDet
Definition: HIPAlignmentAlgorithm.h:130
HIPAlignmentAlgorithm::m2_Layer
int m2_Layer
Definition: HIPAlignmentAlgorithm.h:152
HIPAlignmentAlgorithm::m2_dtype
SurfaceDeformationFactory::Type m2_dtype
Definition: HIPAlignmentAlgorithm.h:155
HIPAlignmentAlgorithm::outpath
std::string outpath
Definition: HIPAlignmentAlgorithm.h:101
HIPAlignmentAlgorithm::m_datatype
int m_datatype
Definition: HIPAlignmentAlgorithm.h:147
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
AlignmentParameterStore::applyAlignableAbsolutePositions
void applyAlignableAbsolutePositions(const align::Alignables &alis, const AlignablePositions &newpos, int &ierr)
apply absolute positions to alignables
Definition: AlignmentParameterStore.cc:373
HIPTrackMonitorVariables::m_nhTEC
std::vector< int > m_nhTEC
Definition: HIPMonitorConfig.h:30
SurfaceDeformation::type
virtual int type() const =0
specific type, i.e. SurfaceDeformationFactory::Type
HIPAlignmentAlgorithm::theLevels
std::vector< align::StructureType > theLevels
Definition: HIPAlignmentAlgorithm.h:135
HIPAlignmentAlgorithm::theTrackMonitorTree
TTree * theTrackMonitorTree
Definition: HIPAlignmentAlgorithm.h:139
AlignableDetOrUnitPtr
Definition: AlignableDetOrUnitPtr.h:30
SurfaceDeformation
Definition: SurfaceDeformation.h:18
HIPAlignableSpecificParameters::minPixelProbXY
double minPixelProbXY
Definition: HIPAlignableSpecificParameters.h:21
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
FastTrackerRecHitCombiner_cfi.minNHits
minNHits
Definition: FastTrackerRecHitCombiner_cfi.py:7
AlignmentParameters::isValid
bool isValid(void) const
Get validity flag.
Definition: AlignmentParameters.cc:134
AlignmentAlgorithmBase
Definition: AlignmentAlgorithmBase.h:59
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
AlignmentParameterSelector::selectedAlignables
const align::Alignables & selectedAlignables() const
vector of alignables selected so far
Definition: AlignmentParameterSelector.h:37
AlignmentParameters
Definition: AlignmentParameters.h:35
HIPTrackMonitorVariables::m_nhTOB
std::vector< int > m_nhTOB
Definition: HIPMonitorConfig.h:30
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
HIPAlignmentAlgorithm::calcAPE
double calcAPE(double *par, int iter, int function)
Definition: HIPAlignmentAlgorithm.cc:1076
HIPTrackMonitorVariables::m_wt
std::vector< float > m_wt
Definition: HIPMonitorConfig.h:29
HIPAlignmentAlgorithm::theApplyAPE
bool theApplyAPE
Definition: HIPAlignmentAlgorithm.h:108
edm::Ref
Definition: AssociativeIterator.h:58
HIPAlignmentAlgorithm::readIterationFile
int readIterationFile(std::string filename)
Definition: HIPAlignmentAlgorithm.cc:992
HIPAlignableSpecificParameters::objId
align::StructureType objId() const
Definition: HIPAlignableSpecificParameters.cc:38
HIPTrackMonitorVariables::bookBranches
void bookBranches() override
Definition: HIPMonitorConfig.cc:41
SiPixelRecHit::hasFilledProb
bool hasFilledProb() const
Definition: SiPixelRecHit.h:104
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
HIPTrackMonitorVariables::m_Chi2n
std::vector< float > m_Chi2n
Definition: HIPMonitorConfig.h:29
HIPMonitorConfig::checkNhits
bool checkNhits()
Definition: HIPMonitorConfig.cc:35
AlignmentParameters.h
SiPixelRecHit::probabilityQ
float probabilityQ() const
Definition: SiPixelRecHit.h:87
ALCARECOPromptCalibProdSiPixelAli0T_cff.alignParams
alignParams
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:82
HIPAlignmentAlgorithm::sparameterfile
std::string sparameterfile
Definition: HIPAlignmentAlgorithm.h:101
HIPAlignmentAlgorithm::m2_nsurfdef
unsigned int m2_nsurfdef
Definition: HIPAlignmentAlgorithm.h:156
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrackerTopology.h
pixelClusterTagInfos_cfi.pixelhit
pixelhit
Definition: pixelClusterTagInfos_cfi.py:6
test
Definition: SmallWORMDict.h:13
HIPAlignmentAlgorithm::uniEtaFormula
std::string uniEtaFormula
Definition: HIPAlignmentAlgorithm.h:128
HIPAlignmentAlgorithm::m2_Type
int m2_Type
Definition: HIPAlignmentAlgorithm.h:152
TrackerTopologyRcd.h
Track.h
AlignmentIORoot::readAlignableAbsolutePositions
AlignablePositions readAlignableAbsolutePositions(const align::Alignables &alivec, const char *filename, int iter, int &ierr) override
read Alignable current absolute positions
Definition: AlignmentIORoot.cc:170
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
HIPAlignmentAlgorithm::outfile2
std::string outfile2
Definition: HIPAlignmentAlgorithm.h:101
Abs
T Abs(T a)
Definition: MathUtil.h:49
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
TrajectoryMeasurement::backwardPredictedState
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
Definition: TrajectoryMeasurement.h:179
SurfaceDeformation::parameters
virtual std::vector< double > parameters() const =0
parameters - interpretation left to the concrete implementation
HIPAlignmentAlgorithm::theAlignableSpecifics
std::vector< HIPAlignableSpecificParameters > theAlignableSpecifics
Definition: HIPAlignmentAlgorithm.h:120
LocalError.h
LocalError::xx
float xx() const
Definition: LocalError.h:22
TrajectoryStateOnSurface::localDirection
LocalVector localDirection() const
Definition: TrajectoryStateOnSurface.h:76
AlignmentParameterStore::applyParameters
void applyParameters(void)
Obsolete: Use AlignableNavigator::alignableDetFromDetId and alignableFromAlignableDet.
Definition: AlignmentParameterStore.cc:255
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
HIPAlignmentAlgorithm::theAlignablesMonitorIORootFile
TFile * theAlignablesMonitorIORootFile
Definition: HIPAlignmentAlgorithm.h:141
SiPixelRecHit::probabilityXY
float probabilityXY() const
Definition: SiPixelRecHit.h:86
PVValHelper::eta
Definition: PVValidationHelpers.h:70
HIPHitMonitorVariables::m_detId
align::ID m_detId
Definition: HIPMonitorConfig.h:89
HIPAlignableSpecificParameters::maxPixelProbXY
double maxPixelProbXY
Definition: HIPAlignableSpecificParameters.h:22
AlignmentParameterStore::typeAndLayer
std::pair< int, int > typeAndLayer(const Alignable *ali, const TrackerTopology *tTopo) const
Obtain type and layer from Alignable.
Definition: AlignmentParameterStore.cc:368
HIPAlignmentAlgorithm::findAlignableSpecs
HIPAlignableSpecificParameters * findAlignableSpecs(const Alignable *ali)
Definition: HIPAlignmentAlgorithm.cc:1549
TrajectoryMeasurement::forwardPredictedState
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
Definition: TrajectoryMeasurement.h:177
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HIPTrackMonitorVariables::m_P
std::vector< float > m_P
Definition: HIPMonitorConfig.h:29
HIPAlignmentAlgorithm::initialize
void initialize(const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras, AlignmentParameterStore *store) override
Call at beginning of job.
Definition: HIPAlignmentAlgorithm.cc:127
HIPAlignmentAlgorithm::m2_Xpos
float m2_Xpos
Definition: HIPAlignmentAlgorithm.h:154
HIPAlignmentAlgorithm::suvarfile
std::string suvarfile
Definition: HIPAlignmentAlgorithm.h:101
reco::Track
Definition: Track.h:27
Run.h
str
#define str(s)
Definition: TestProcessor.cc:52
edm::ESHandle< Alignments >
AlignableTracker
Definition: AlignableTracker.h:17
HIPAlignableSpecificParameters::minNHits
int minNHits
Definition: HIPAlignableSpecificParameters.h:17
HIPAlignmentAlgorithm::m2_ObjId
align::StructureType m2_ObjId
Definition: HIPAlignmentAlgorithm.h:151
AlignmentParameterSelector::clear
void clear()
remove all selected Alignables and geometrical restrictions
Definition: AlignmentParameterSelector.cc:41
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
HIPAlignmentAlgorithm::rewgtPerAli
bool rewgtPerAli
Definition: HIPAlignmentAlgorithm.h:127
verbose
static constexpr int verbose
Definition: HLTExoticaSubAnalysis.cc:25
HIPAlignmentAlgorithm::theAlignables
align::Alignables theAlignables
Definition: HIPAlignmentAlgorithm.h:86
SiPixelRecHit::rawQualityWord
SiPixelRecHitQuality::QualWordType rawQualityWord() const
Definition: SiPixelRecHit.h:78
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
AlignableExtras
Definition: AlignableExtras.h:19
AlignmentClusterFlag::isTaken
bool isTaken() const
Definition: AlignmentClusterFlag.cc:14
Point3DBase< float, GlobalTag >
HIPAlignmentAlgorithm::collector
void collector(void)
Definition: HIPAlignmentAlgorithm.cc:1331
HIPAlignmentAlgorithm::ioerr
int ioerr
Definition: HIPAlignmentAlgorithm.h:90
HIPMonitorConfig::hitmonitorvars
HIPHitMonitorVariables hitmonitorvars
Definition: HIPMonitorConfig.h:125
HIPHitMonitorVariables::m_hasHitProb
bool m_hasHitProb
Definition: HIPMonitorConfig.h:86
HIPUserVariables::alipar
AlgebraicVector alipar
Definition: HIPUserVariables.h:13
AlignmentParameterStore.h
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
HIPAlignmentAlgorithm::isCollector
bool isCollector
Definition: HIPAlignmentAlgorithm.h:123
HIPTrackMonitorVariables::m_dz
std::vector< float > m_dz
Definition: HIPMonitorConfig.h:29
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HIPAlignmentAlgorithm::startNewLoop
void startNewLoop(void) override
Called at start of new loop.
Definition: HIPAlignmentAlgorithm.cc:302
HIPUserVariablesIORoot
Definition: HIPUserVariablesIORoot.h:10
HIPUserVariables::alindof
int alindof
Definition: HIPUserVariables.h:10
HIPAlignmentAlgorithm::surveyResiduals_
const std::vector< std::string > surveyResiduals_
Definition: HIPAlignmentAlgorithm.h:134
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
HIPUserVariables::nhit
int nhit
Definition: HIPUserVariables.h:11
HIPTrackMonitorVariables::m_Pt
std::vector< float > m_Pt
Definition: HIPMonitorConfig.h:29
HIPUserVariables.h
HIPAlignableSpecificParameters::maxPixelProbQ
double maxPixelProbQ
Definition: HIPAlignableSpecificParameters.h:24
SurveyResidual.h
TrajectoryStateCombiner
Definition: TrajectoryStateCombiner.h:13
AlignmentAlgorithmBase::terminate
virtual void terminate()
Called at end of job (must be implemented in derived class)
Definition: AlignmentAlgorithmBase.h:157
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
edm::IOVSyncValue::eventID
const EventID & eventID() const
Definition: IOVSyncValue.h:40
edm::ParameterSet
Definition: ParameterSet.h:47
HIPUserVariablesIORoot::readHIPUserVariables
std::vector< AlignmentUserVariables * > readHIPUserVariables(const Alignables &alivec, const char *filename, int iter, int &ierr)
Definition: HIPUserVariablesIORoot.cc:207
HIPAlignmentAlgorithm::processHit1D
bool processHit1D(const AlignableDetOrUnitPtr &alidet, const Alignable *ali, const HIPAlignableSpecificParameters *alispecifics, const TrajectoryStateOnSurface &tsos, const TrackingRecHit *hit, double hitwt)
Definition: HIPAlignmentAlgorithm.cc:519
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
HIPHitMonitorVariables::m_angle
float m_angle
Definition: HIPMonitorConfig.h:87
HIPUserVariables::datatype
int datatype
Definition: HIPUserVariables.h:12
HIPAlignmentAlgorithm::m2_surfDef
std::vector< float > m2_surfDef
Definition: HIPAlignmentAlgorithm.h:157
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
AlignableMuon.h
HIPAlignmentAlgorithm::theAlignableDetAccessor
std::unique_ptr< AlignableNavigator > theAlignableDetAccessor
Definition: HIPAlignmentAlgorithm.h:87
SurfaceDeformationFactory::Type
Type
Definition: SurfaceDeformationFactory.h:17
HIPTrackMonitorVariables::m_nhTIB
std::vector< int > m_nhTIB
Definition: HIPMonitorConfig.h:30
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
HIPUserVariables::alichi2
double alichi2
Definition: HIPUserVariables.h:9
HIPAlignmentAlgorithm.h
Alignable::id
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
Definition: Alignable.h:180
recoMuon::in
Definition: RecoMuonEnumerators.h:6
runTauDisplay.dtype
dtype
Definition: runTauDisplay.py:121
HIPAlignmentAlgorithm::theIteration
int theIteration
Definition: HIPAlignmentAlgorithm.h:91
HIPTrackMonitorVariables::m_nhPXF
std::vector< int > m_nhPXF
Definition: HIPMonitorConfig.h:30
HIPTrackMonitorVariables::m_d0
std::vector< float > m_d0
Definition: HIPMonitorConfig.h:29
AlignableMuon
Constructor of the full muon geometry.
Definition: AlignableMuon.h:38
HIPAlignmentAlgorithm::m2_Ypos
float m2_Ypos
Definition: HIPAlignmentAlgorithm.h:154
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
HIPAlignmentAlgorithm::theIO
AlignmentIORoot theIO
Definition: HIPAlignmentAlgorithm.h:89
HIPMonitorVariables::setTree
void setTree(TTree *tree_)
Definition: HIPMonitorConfig.h:18
createfilelist.int
int
Definition: createfilelist.py:10
CompositeAlignmentParameters::alignableFromAlignableDet
Alignable * alignableFromAlignableDet(const AlignableDetOrUnitPtr &adet) const
Get relevant Alignable from AlignableDet.
Definition: CompositeAlignmentParameters.cc:208
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
HIPAlignmentAlgorithm::trackPs
bool trackPs
Definition: HIPAlignmentAlgorithm.h:127
writedatasetfile.firstrun
firstrun
Definition: writedatasetfile.py:27
SiStripRecHit1D::cluster
ClusterRef cluster() const
Definition: SiStripRecHit1D.h:18
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
IdealGeometryRecord.h
TrackerAlignmentRcd.h
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
HIPAlignmentAlgorithm::theIOVrangeSet
std::vector< unsigned > theIOVrangeSet
Definition: HIPAlignmentAlgorithm.h:105
SiStripRecHit1D
Definition: SiStripRecHit1D.h:8
HIPAlignmentAlgorithm::themultiIOV
bool themultiIOV
Definition: HIPAlignmentAlgorithm.h:104
tname
std::string tname(const std::string &tableName, const std::string &schemaVersion)
Definition: CredentialStore.cc:150
get
#define get
res
Definition: Electron.h:6
HIPAlignmentAlgorithm::calcParameters
bool calcParameters(Alignable *ali, int setDet, double start, double step)
Definition: HIPAlignmentAlgorithm.cc:1234
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
HIPAlignmentAlgorithm::theHitMonitorTree
TTree * theHitMonitorTree
Definition: HIPAlignmentAlgorithm.h:140
looper.cfg
cfg
Definition: looper.py:297
TrackingRecHit
Definition: TrackingRecHit.h:21
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HIPAlignmentAlgorithm::verbose
const bool verbose
Definition: HIPAlignmentAlgorithm.h:96
HIPTrackMonitorVariables::m_nhTID
std::vector< int > m_nhTID
Definition: HIPMonitorConfig.h:30
HIPAlignmentAlgorithm::struefile
std::string struefile
Definition: HIPAlignmentAlgorithm.h:102
HIPAlignableSpecificParameters::id
align::ID id() const
Definition: HIPAlignableSpecificParameters.cc:32
TrajectoryMeasurement::recHit
ConstRecHitPointer const & recHit() const
Definition: TrajectoryMeasurement.h:190
DDAxes::phi
dumpTauVariables_cfi.eventInfo
eventInfo
add run, event number and lumi section
Definition: dumpTauVariables_cfi.py:12
HIPUserVariables::jtvj
AlgebraicSymMatrix jtvj
Definition: HIPUserVariables.h:7
Trajectory.h
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
HIPAlignmentAlgorithm::defaultAlignableSpecs
HIPAlignableSpecificParameters defaultAlignableSpecs
Definition: HIPAlignmentAlgorithm.h:116
HIPAlignmentAlgorithm::doTrackHitMonitoring
const bool doTrackHitMonitoring
Definition: HIPAlignmentAlgorithm.h:99
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
HIPAlignmentAlgorithm::theDataGroup
int theDataGroup
Definition: HIPAlignmentAlgorithm.h:126
HIPAlignmentAlgorithm::col_cut
double col_cut
Definition: HIPAlignmentAlgorithm.h:129
HIPAlignmentAlgorithm::theCollectorPath
std::string theCollectorPath
Definition: HIPAlignmentAlgorithm.h:125
HIPAlignmentAlgorithm::siterationfile
std::string siterationfile
Definition: HIPAlignmentAlgorithm.h:102
std
Definition: JetResolutionObject.h:76
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
SurveyResidual
Definition: SurveyResidual.h:22
AlignmentParameterSelector::addSelections
unsigned int addSelections(const edm::ParameterSet &pSet)
Definition: AlignmentParameterSelector.cc:67
AlignmentParameters::setValid
void setValid(bool v)
Set validity flag.
Definition: AlignmentParameters.cc:137
AlignmentParameterStore
Definition: AlignmentParameterStore.h:23
PVValHelper::dz
Definition: PVValidationHelpers.h:51
HIPAlignmentAlgorithm::theAlignmentParameterStore
AlignmentParameterStore * theAlignmentParameterStore
Definition: HIPAlignmentAlgorithm.h:85
Trajectory
Definition: Trajectory.h:38
HIPAlignableSpecificParameters
Definition: HIPAlignableSpecificParameters.h:7
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
AlignmentParameters::cloneFromSelected
virtual AlignmentParameters * cloneFromSelected(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
HIPAlignableSpecificParameters::usePixelProbXYOrProbQ
bool usePixelProbXYOrProbQ
Definition: HIPAlignableSpecificParameters.h:20
Exception
Definition: hltDiff.cc:245
TrajectoryStateCombiner::combine
TSOS combine(const TSOS &pTsos1, const TSOS &pTsos2) const
Definition: TrajectoryStateCombiner.cc:6
AlignmentParameters::numSelected
int numSelected(void) const
Get number of selected parameters.
Definition: AlignmentParameters.cc:51
Alignable.h
HIPAlignmentAlgorithm::trackWt
bool trackWt
Definition: HIPAlignmentAlgorithm.h:127
HIPTrackMonitorVariables::m_Nhits
std::vector< int > m_Nhits
Definition: HIPMonitorConfig.h:30
HIPAlignmentAlgorithm::m3_par
float m3_par[6]
Definition: HIPAlignmentAlgorithm.h:162
HIPUserVariables::alierr
AlgebraicVector alierr
Definition: HIPUserVariables.h:14
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HIPHitMonitorVariables::m_sinTheta
float m_sinTheta
Definition: HIPMonitorConfig.h:87
HIPAlignableSpecificParameters::maxHitPull
double maxHitPull
Definition: HIPAlignableSpecificParameters.h:18
SurfaceDeformationFactory::kNoDeformations
Definition: SurfaceDeformationFactory.h:21
className
std::string className(const T &t)
Definition: ClassName.h:31
HIPAlignmentAlgorithm::m2_Zpos
float m2_Zpos
Definition: HIPAlignmentAlgorithm.h:154
HIPMonitorConfig::outfilecore
const std::string outfilecore
Definition: HIPMonitorConfig.h:115
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
HIPAlignmentAlgorithm::salignedfile
std::string salignedfile
Definition: HIPAlignmentAlgorithm.h:102
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
HIPAlignmentAlgorithm::theSurveyTree
TTree * theSurveyTree
Definition: HIPAlignmentAlgorithm.h:144
mps_fire.result
result
Definition: mps_fire.py:311
AlignableTracker.h
HIPAlignmentAlgorithm::suvarfilecore
std::string suvarfilecore
Definition: HIPAlignmentAlgorithm.h:101
cms::Exception
Definition: Exception.h:70
HIPAlignmentAlgorithm::cos_cut
double cos_cut
Definition: HIPAlignmentAlgorithm.h:129
HIPMonitorConfig::checkNevents
bool checkNevents()
Definition: HIPMonitorConfig.cc:30
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
command_line.start
start
Definition: command_line.py:167
ParameterSet.h
HIPMonitorConfig::trackmonitorvars
HIPTrackMonitorVariables trackmonitorvars
Definition: HIPMonitorConfig.h:121
HIPAlignmentAlgorithm::m3_Id
align::ID m3_Id
Definition: HIPAlignmentAlgorithm.h:160
HIPMonitorConfig::fillTrackMonitoring
const bool fillTrackMonitoring
Definition: HIPMonitorConfig.h:119
HIPAlignmentAlgorithm::setAlignmentPositionError
void setAlignmentPositionError(void)
Definition: HIPAlignmentAlgorithm.cc:1025
HIPTrackMonitorVariables::m_Eta
std::vector< float > m_Eta
Definition: HIPMonitorConfig.h:29
HIPAlignmentAlgorithm::theSurveyIORootFile
TFile * theSurveyIORootFile
Definition: HIPAlignmentAlgorithm.h:143
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
AlignablePositions
std::vector< AlignableAbsData > AlignablePositions
Definition: AlignableData.h:47
AlignmentParameters::parameters
const AlgebraicVector & parameters(void) const
Get alignment parameters.
Definition: AlignmentParameters.cc:64
HIPUserVariables::jtve
AlgebraicVector jtve
Definition: HIPUserVariables.h:8
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
d0
static constexpr float d0
Definition: L1EGammaCrystalsEmulatorProducer.cc:85
edm::Log
Definition: MessageLogger.h:70
TrajectoryMeasurement
Definition: TrajectoryMeasurement.h:25
Alignable::alignmentParameters
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58
HIPAlignmentAlgorithm::run
void run(const edm::EventSetup &setup, const EventInfo &eventInfo) override
Run the algorithm.
Definition: HIPAlignmentAlgorithm.cc:737
LocalError::yy
float yy() const
Definition: LocalError.h:24
AlignmentClusterFlag
Definition: AlignmentClusterFlag.h:15
HIPAlignmentAlgorithm::collectMonitorTrees
void collectMonitorTrees(const std::vector< std::string > &filenames)
Definition: HIPAlignmentAlgorithm.cc:1486
AlignmentParameterSelector
Definition: AlignmentParameterSelector.h:26
HIPAlignableSpecificParameters::minRelParError
double minRelParError
Definition: HIPAlignableSpecificParameters.h:15
HIPTrackMonitorVariables::m_nhPXB
std::vector< int > m_nhPXB
Definition: HIPMonitorConfig.h:30
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
hit
Definition: SiStripHitEffFromCalibTree.cc:88
HIPHitMonitorVariables::m_rawQualityWord
unsigned int m_rawQualityWord
Definition: HIPMonitorConfig.h:88
HIPUserVariablesIORoot.h
HIPAlignableSpecificParameters::applyPixelProbCut
bool applyPixelProbCut
Definition: HIPAlignableSpecificParameters.h:19
HIPUserVariables
Definition: HIPUserVariables.h:4
AlignmentParameters::setUserVariables
void setUserVariables(AlignmentUserVariables *auv)
Set pointer to user variables.
Definition: AlignmentParameters.cc:94
HIPAlignmentAlgorithm::m2_Nhit
int m2_Nhit
Definition: HIPAlignmentAlgorithm.h:152
HIPHitMonitorVariables::m_probXY
float m_probXY
Definition: HIPMonitorConfig.h:87
AlignmentAlgorithmBase::EventInfo
define event information passed to algorithms
Definition: AlignmentAlgorithmBase.h:72
HIPAlignmentAlgorithm::theAPEParameterSet
std::vector< edm::ParameterSet > theAPEParameterSet
Definition: HIPAlignmentAlgorithm.h:109
HIPAlignmentAlgorithm::m3_ObjId
align::StructureType m3_ObjId
Definition: HIPAlignmentAlgorithm.h:161
HIPAlignmentAlgorithm::Scale
double Scale
Definition: HIPAlignmentAlgorithm.h:129
HIPHitMonitorVariables::bookBranches
void bookBranches() override
Definition: HIPMonitorConfig.cc:62