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