CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
MillePedeAlignmentAlgorithm Class Reference

#include <MillePedeAlignmentAlgorithm.h>

Inheritance diagram for MillePedeAlignmentAlgorithm:
AlignmentAlgorithmBase

Public Member Functions

bool addCalibrations (const std::vector< IntegratedCalibrationBase * > &iCals) override
 Pass integrated calibrations to Millepede (they are not owned by Millepede!) More...
 
void beginLuminosityBlock (const edm::EventSetup &) override
 called at begin of luminosity block (resets Mille binary in mille mode) More...
 
void beginRun (const edm::Run &run, const edm::EventSetup &setup, bool changed) override
 called at begin of run More...
 
void endLuminosityBlock (const edm::EventSetup &) override
 called at end of luminosity block More...
 
void endRun (const EndRunInfo &runInfo, const edm::EventSetup &setup) override
 called at end of run - order of arguments like in EDProducer etc. More...
 
virtual void endRun (const EventInfo &, const EndRunInfo &, const edm::EventSetup &)
 Run on run products, e.g. TkLAS. More...
 
void initialize (const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras, AlignmentParameterStore *store) override
 Called at beginning of job. More...
 
 MillePedeAlignmentAlgorithm (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 Constructor. More...
 
bool processesEvents () override
 Returns whether MP should process events in the current configuration. More...
 
void run (const edm::EventSetup &setup, const EventInfo &eventInfo) override
 Run the algorithm on trajectories and tracks. More...
 
bool setParametersForRunRange (const RunRange &runrange) override
 
bool storeAlignments () override
 Returns whether MP produced results to be stored. More...
 
virtual bool storeThresholds (const int &nRecords, const AlignPCLThresholds::threshold_map &thresholdMap)
 
bool supportsCalibrations () override
 Returns whether MP supports calibrations. More...
 
void terminate () override
 Called at end of job. More...
 
void terminate (const edm::EventSetup &iSetup) override
 Called at end of job. More...
 
 ~MillePedeAlignmentAlgorithm () override
 Destructor. More...
 
- Public Member Functions inherited from AlignmentAlgorithmBase
virtual bool addCalibrations (const Calibrations &)
 
bool addCalibrations (const CalibrationsOwner &cals)
 
 AlignmentAlgorithmBase (const edm::ParameterSet &, const edm::ConsumesCollector &)
 Constructor. More...
 
virtual void startNewLoop ()
 
virtual ~AlignmentAlgorithmBase ()
 Destructor. More...
 

Private Types

enum  EModeBit { myMilleBit = 1 << 0, myPedeRunBit = 1 << 1, myPedeSteerBit = 1 << 2, myPedeReadBit = 1 << 3 }
 
enum  MeasurementDirection { kLocalX = 0, kLocalY }
 

Private Member Functions

int addGlobalData (const edm::EventSetup &setup, const EventInfo &eventInfo, const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iHit, gbl::GblPoint &gblPoint)
 
unsigned int addHitCount (const std::vector< AlignmentParameters * > &parVec, const std::vector< bool > &validHitVecY) const
 
bool addHits (const align::Alignables &alis, const std::vector< AlignmentUserVariables * > &mpVars) const
 
bool addHitStatistics (int fromLoop, const std::string &outFile, const std::vector< std::string > &inFiles) const
 
void addLasBeam (const EventInfo &eventInfo, const TkFittedLasBeam &lasBeam, const std::vector< TrajectoryStateOnSurface > &tsoses)
 
void addLaserData (const EventInfo &eventInfo, const TkFittedLasBeamCollection &tkLasBeams, const TsosVectorCollection &tkLasBeamTsoses)
 
int addMeasurementData (const edm::EventSetup &setup, const EventInfo &eventInfo, const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iHit, AlignmentParameters *&params)
 
void addPxbSurvey (const edm::ParameterSet &pxbSurveyCfg)
 add measurement data from PXB survey More...
 
std::pair< unsigned int, unsigned int > addReferenceTrajectory (const edm::EventSetup &setup, const EventInfo &eventInfo, const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr)
 fill mille for a trajectory, returning number of x/y hits ([0,0] if 'bad' trajectory) More...
 
template<typename CovarianceMatrix , typename ResidualMatrix , typename LocalDerivativeMatrix >
void addRefTrackData2D (const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, Eigen::MatrixBase< CovarianceMatrix > &aHitCovarianceM, Eigen::MatrixBase< ResidualMatrix > &aHitResidualsM, Eigen::MatrixBase< LocalDerivativeMatrix > &aLocalDerivativesM)
 adds data from reference trajectory from a specific Hit More...
 
template<typename CovarianceMatrix , typename ResidualMatrix , typename LocalDerivativeMatrix >
void addRefTrackVirtualMeas1D (const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iVirtualMeas, Eigen::MatrixBase< CovarianceMatrix > &aHitCovarianceM, Eigen::MatrixBase< ResidualMatrix > &aHitResidualsM, Eigen::MatrixBase< LocalDerivativeMatrix > &aLocalDerivativesM)
 adds data for a specific virtual measurement from reference trajectory More...
 
void addVirtualMeas (const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iVirtualMeas)
 adds data for virtual measurements from reference trajectory More...
 
bool areEmptyParams (const align::Alignables &alignables) const
 
bool areIOVsSpecified () const
 
void buildUserVariables (const align::Alignables &alignables) const
 add MillePedeVariables for each AlignmentParameters (exception if no parameters...) More...
 
int callMille (const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, const std::vector< int > &globalLabels, const std::vector< float > &globalDerivativesX, const std::vector< float > &globalDerivativesY)
 calls callMille1D or callMille2D More...
 
int callMille1D (const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, const std::vector< int > &globalLabels, const std::vector< float > &globalDerivativesX)
 calls Mille for 1D hits More...
 
int callMille2D (const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, const std::vector< int > &globalLabels, const std::vector< float > &globalDerivativesx, const std::vector< float > &globalDerivativesy)
 
unsigned int decodeMode (const std::string &mode) const
 
template<typename CovarianceMatrix , typename LocalDerivativeMatrix , typename ResidualMatrix , typename GlobalDerivativeMatrix >
void diagonalize (Eigen::MatrixBase< CovarianceMatrix > &aHitCovarianceM, Eigen::MatrixBase< LocalDerivativeMatrix > &aLocalDerivativesM, Eigen::MatrixBase< ResidualMatrix > &aHitResidualsM, Eigen::MatrixBase< GlobalDerivativeMatrix > &aGlobalDerivativesM) const
 
unsigned int doIO (int loop) const
 
std::vector< std::string > getExistingFormattedFiles (const std::vector< std::string > &plainFiles, const std::string &theDir)
 
void globalDerivativesCalibration (const TransientTrackingRecHit::ConstRecHitPointer &recHit, const TrajectoryStateOnSurface &tsos, const edm::EventSetup &setup, const EventInfo &eventInfo, std::vector< float > &globalDerivativesX, std::vector< float > &globalDerivativesY, std::vector< int > &globalLabels) const
 adding derivatives from integrated calibrations More...
 
bool globalDerivativesHierarchy (const EventInfo &eventInfo, const TrajectoryStateOnSurface &tsos, Alignable *ali, const AlignableDetOrUnitPtr &alidet, std::vector< double > &globalDerivativesX, std::vector< double > &globalDerivativesY, std::vector< int > &globalLabels, AlignmentParameters *&lowestParams) const
 recursively adding derivatives (double) and labels, false if problems More...
 
bool globalDerivativesHierarchy (const EventInfo &eventInfo, const TrajectoryStateOnSurface &tsos, Alignable *ali, const AlignableDetOrUnitPtr &alidet, std::vector< float > &globalDerivativesX, std::vector< float > &globalDerivativesY, std::vector< int > &globalLabels, AlignmentParameters *&lowestParams) const
 recursively adding derivatives and labels, false if problems More...
 
bool is2D (const TransientTrackingRecHit::ConstRecHitPointer &recHit) const
 true if hit belongs to 2D detector (currently tracker specific) More...
 
bool isMode (unsigned int testMode) const
 
template<typename GlobalDerivativeMatrix >
void makeGlobDerivMatrix (const std::vector< float > &globalDerivativesx, const std::vector< float > &globalDerivativesy, Eigen::MatrixBase< GlobalDerivativeMatrix > &aGlobalDerivativesM)
 
bool readFromPede (const edm::ParameterSet &mprespset, bool setUserVars, const RunRange &runrange)
 read pede input defined by 'psetName', flag to create/not create MillePedeVariables More...
 

Private Attributes

const edm::ESGetToken< AlignPCLThresholds, AlignPCLThresholdsRcdaliThrToken_
 
std::vector< align::RunNumbercachedRuns_
 
const bool enableAlignableUpdates_
 
const bool enforceSingleIOVInput_
 
const align::RunNumber firstIOV_
 
const bool ignoreFirstIOVCheck_
 
const bool ignoreHitsWithoutGlobalDerivatives_
 
align::RunNumber lastProcessedRun_
 
const bool runAtPCL_
 
const bool skipGlobalPositionRcdCheck_
 
std::unique_ptr< AlignableNavigatortheAlignableNavigator
 
align::Alignables theAlignables
 
AlignmentParameterStoretheAlignmentParameterStore
 directory for all kind of files More...
 
std::unique_ptr< gbl::MilleBinary > theBinary
 
std::vector< IntegratedCalibrationBase * > theCalibrations
 
edm::ParameterSet theConfig
 
std::string theDir
 
bool theDoSurveyPixelBarrel
 
std::vector< float > theFloatBufferX
 
std::vector< float > theFloatBufferY
 
bool theGblDoubleBinary
 
std::vector< int > theIntBuffer
 
int theLastWrittenIov
 
double theMaximalCor2D
 
std::unique_ptr< MilletheMille
 
unsigned int theMinNumHits
 
unsigned int theMode
 
std::unique_ptr< MillePedeMonitortheMonitor
 
std::shared_ptr< PedeLabelerBasethePedeLabels
 
std::unique_ptr< PedeSteererthePedeSteer
 
std::shared_ptr< AlignPCLThresholdstheThresholds
 
std::unique_ptr< TrajectoryFactoryBasetheTrajectoryFactory
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtopoToken_
 
const align::RunRanges uniqueRunRanges_
 

Additional Inherited Members

- Public Types inherited from AlignmentAlgorithmBase
typedef std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
 
typedef std::vector< ConstTrajTrackPairConstTrajTrackPairCollection
 
using RunNumber = align::RunNumber
 
using RunRange = align::RunRange
 

Detailed Description

CMSSW interface to pede: produces pede's binary input and steering file(s)

Author
: Gero Flucke date : October 2006
Revision
1.36
Date
2012/08/10 09:01:11

(last update by

Author
flucke

)

Definition at line 59 of file MillePedeAlignmentAlgorithm.h.

Member Enumeration Documentation

◆ EModeBit

Enumerator
myMilleBit 
myPedeRunBit 
myPedeSteerBit 
myPedeReadBit 

Definition at line 276 of file MillePedeAlignmentAlgorithm.h.

276 { myMilleBit = 1 << 0, myPedeRunBit = 1 << 1, myPedeSteerBit = 1 << 2, myPedeReadBit = 1 << 3 };

◆ MeasurementDirection

Enumerator
kLocalX 
kLocalY 

Definition at line 121 of file MillePedeAlignmentAlgorithm.h.

121 { kLocalX = 0, kLocalY };

Constructor & Destructor Documentation

◆ MillePedeAlignmentAlgorithm()

MillePedeAlignmentAlgorithm::MillePedeAlignmentAlgorithm ( const edm::ParameterSet cfg,
edm::ConsumesCollector iC 
)

Constructor.

Definition at line 87 of file MillePedeAlignmentAlgorithm.cc.

91  theConfig(cfg),
95  theAlignables(),
96  theMinNumHits(cfg.getParameter<unsigned int>("minNumHits")),
97  theMaximalCor2D(cfg.getParameter<double>("max2Dcorrelation")),
98  firstIOV_(cfg.getUntrackedParameter<AlignmentAlgorithmBase::RunNumber>("firstIOV")),
99  ignoreFirstIOVCheck_(cfg.getUntrackedParameter<bool>("ignoreFirstIOVCheck")),
100  enableAlignableUpdates_(cfg.getUntrackedParameter<bool>("enableAlignableUpdates")),
102  theGblDoubleBinary(cfg.getParameter<bool>("doubleBinary")),
103  runAtPCL_(cfg.getParameter<bool>("runAtPCL")),
104  ignoreHitsWithoutGlobalDerivatives_(cfg.getParameter<bool>("ignoreHitsWithoutGlobalDerivatives")),
105  skipGlobalPositionRcdCheck_(cfg.getParameter<bool>("skipGlobalPositionRcdCheck")),
106  uniqueRunRanges_(align::makeUniqueRunRanges(cfg.getUntrackedParameter<edm::VParameterSet>("RunRangeSelection"),
110  if (!theDir.empty() && theDir.find_last_of('/') != theDir.size() - 1)
111  theDir += '/'; // may need '/'
112  edm::LogInfo("Alignment") << "@SUB=MillePedeAlignmentAlgorithm"
113  << "Start in mode '" << theConfig.getUntrackedParameter<std::string>("mode")
114  << "' with output directory '" << theDir << "'.";
115  if (this->isMode(myMilleBit)) {
116  theMille = std::make_unique<Mille>(
117  (theDir + theConfig.getParameter<std::string>("binaryFile")).c_str()); // add ', false);' for text output);
118  // use same file for GBL
119  theBinary = std::make_unique<MilleBinary>((theDir + theConfig.getParameter<std::string>("binaryFile")).c_str(),
121  }
122 }

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), isMode(), myMilleBit, AlCaHLTBitMon_QueryRunRegistry::string, theBinary, theConfig, theDir, theGblDoubleBinary, and theMille.

◆ ~MillePedeAlignmentAlgorithm()

MillePedeAlignmentAlgorithm::~MillePedeAlignmentAlgorithm ( )
override

Destructor.

Definition at line 126 of file MillePedeAlignmentAlgorithm.cc.

126 {}

Member Function Documentation

◆ addCalibrations()

bool MillePedeAlignmentAlgorithm::addCalibrations ( const std::vector< IntegratedCalibrationBase * > &  iCals)
override

Pass integrated calibrations to Millepede (they are not owned by Millepede!)

Definition at line 294 of file MillePedeAlignmentAlgorithm.cc.

294  {
295  theCalibrations.insert(theCalibrations.end(), iCals.begin(), iCals.end());
296  thePedeLabels->addCalibrations(iCals);
297  return true;
298 }

References theCalibrations, and thePedeLabels.

◆ addGlobalData()

int MillePedeAlignmentAlgorithm::addGlobalData ( const edm::EventSetup setup,
const EventInfo eventInfo,
const ReferenceTrajectoryBase::ReferenceTrajectoryPtr refTrajPtr,
unsigned int  iHit,
gbl::GblPoint &  gblPoint 
)
private

Add global data (labels, derivatives) to GBL trajectory Returns -1 if any problem (for params cf. globalDerivativesHierarchy)

Definition at line 775 of file MillePedeAlignmentAlgorithm.cc.

779  {
780  AlignmentParameters *params = nullptr;
781  std::vector<double> theDoubleBufferX, theDoubleBufferY;
782  theDoubleBufferX.clear();
783  theDoubleBufferY.clear();
784  theIntBuffer.clear();
785  int iret = 0;
786 
787  const TrajectoryStateOnSurface &tsos = refTrajPtr->trajectoryStates()[iHit];
788  const ConstRecHitPointer &recHitPtr = refTrajPtr->recHits()[iHit];
789  // ignore invalid hits
790  if (!recHitPtr->isValid())
791  return 0;
792 
793  // get AlignableDet/Unit for this hit
794  AlignableDetOrUnitPtr alidet(theAlignableNavigator->alignableFromDetId(recHitPtr->geographicalId()));
795 
796  if (!this->globalDerivativesHierarchy(eventInfo,
797  tsos,
798  alidet,
799  alidet,
800  theDoubleBufferX, // 2x alidet, sic!
801  theDoubleBufferY,
802  theIntBuffer,
803  params)) {
804  return -1; // problem
805  }
806  //calibration parameters
807  int globalLabel;
808  std::vector<IntegratedCalibrationBase::ValuesIndexPair> derivs;
809  for (auto iCalib = theCalibrations.begin(); iCalib != theCalibrations.end(); ++iCalib) {
810  // get all derivatives of this calibration // const unsigned int num =
811  (*iCalib)->derivatives(derivs, *recHitPtr, tsos, setup, eventInfo);
812  for (auto iValuesInd = derivs.begin(); iValuesInd != derivs.end(); ++iValuesInd) {
813  // transfer label and x/y derivatives
814  globalLabel = thePedeLabels->calibrationLabel(*iCalib, iValuesInd->second);
815  if (globalLabel > 0 && globalLabel <= 2147483647) {
816  theIntBuffer.push_back(globalLabel);
817  theDoubleBufferX.push_back(iValuesInd->first.first);
818  theDoubleBufferY.push_back(iValuesInd->first.second);
819  } else {
820  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::addGlobalData"
821  << "Invalid label " << globalLabel << " <= 0 or > 2147483647";
822  }
823  }
824  }
825  unsigned int numGlobals = theIntBuffer.size();
826  if (numGlobals > 0) {
827  Eigen::Matrix<double, 2, Eigen::Dynamic> globalDer{2, numGlobals};
828  for (unsigned int i = 0; i < numGlobals; ++i) {
829  globalDer(0, i) = theDoubleBufferX[i];
830  globalDer(1, i) = theDoubleBufferY[i];
831  }
832  gblPoint.addGlobals(theIntBuffer, globalDer);
833  iret = 1;
834  }
835  return iret;
836 }

References dumpTauVariables_cfi::eventInfo, globalDerivativesHierarchy(), mps_fire::i, CalibrationSummaryClient_cfi::params, singleTopDQM_cfi::setup, theAlignableNavigator, theCalibrations, theIntBuffer, and thePedeLabels.

Referenced by addReferenceTrajectory().

◆ addHitCount()

unsigned int MillePedeAlignmentAlgorithm::addHitCount ( const std::vector< AlignmentParameters * > &  parVec,
const std::vector< bool > &  validHitVecY 
) const
private

Increase hit counting of MillePedeVariables behind each parVec[i] (and also for parameters higher in hierarchy), assuming 'parVec' and 'validHitVecY' to be parallel. Returns number of valid y-hits.

Definition at line 590 of file MillePedeAlignmentAlgorithm.cc.

591  {
592  // Loop on all hit information in the input arrays and count valid y-hits:
593  unsigned int nHitY = 0;
594  for (unsigned int iHit = 0; iHit < validHitVecY.size(); ++iHit) {
595  Alignable *ali = (parVec[iHit] ? parVec[iHit]->alignable() : nullptr);
596  // Loop upwards on hierarchy of alignables to add hits to all levels
597  // that are currently aligned. If only a non-selected alignable was hit,
598  // (i.e. flagXY == 0 in addReferenceTrajectory(..)), there is no loop at all...
599  while (ali) {
601  if (pars) { // otherwise hierarchy level not selected
602  // cast ensured by previous checks:
603  MillePedeVariables *mpVar = static_cast<MillePedeVariables *>(pars->userVariables());
604  // every hit has an x-measurement, cf. addReferenceTrajectory(..):
605  mpVar->increaseHitsX();
606  if (validHitVecY[iHit]) {
607  mpVar->increaseHitsY();
608  if (pars == parVec[iHit])
609  ++nHitY; // do not count hits twice
610  }
611  }
612  ali = ali->mother();
613  }
614  }
615 
616  return nHitY;
617 }

References Alignable::alignmentParameters(), MillePedeVariables::increaseHitsX(), MillePedeVariables::increaseHitsY(), Alignable::mother(), and AlignmentParameters::userVariables().

Referenced by addReferenceTrajectory().

◆ addHits()

bool MillePedeAlignmentAlgorithm::addHits ( const align::Alignables alis,
const std::vector< AlignmentUserVariables * > &  mpVars 
) const
private

Definition at line 1220 of file MillePedeAlignmentAlgorithm.cc.

1221  {
1222  bool allOk = (mpVars.size() == alis.size());
1223  std::vector<AlignmentUserVariables *>::const_iterator iUser = mpVars.begin();
1224  for (auto iAli = alis.cbegin(); iAli != alis.cend() && iUser != mpVars.end(); ++iAli, ++iUser) {
1225  MillePedeVariables *mpVarNew = dynamic_cast<MillePedeVariables *>(*iUser);
1226  AlignmentParameters *ps = (*iAli)->alignmentParameters();
1227  MillePedeVariables *mpVarOld = (ps ? dynamic_cast<MillePedeVariables *>(ps->userVariables()) : nullptr);
1228  if (!mpVarNew || !mpVarOld || mpVarOld->size() != mpVarNew->size()) {
1229  allOk = false;
1230  continue; // FIXME error etc.?
1231  }
1232 
1233  mpVarOld->increaseHitsX(mpVarNew->hitsX());
1234  mpVarOld->increaseHitsY(mpVarNew->hitsY());
1235  }
1236 
1237  return allOk;
1238 }

References MillePedeVariables::hitsX(), MillePedeVariables::hitsY(), MillePedeVariables::increaseHitsX(), MillePedeVariables::increaseHitsY(), MillePedeVariables::size(), and AlignmentParameters::userVariables().

Referenced by addHitStatistics().

◆ addHitStatistics()

bool MillePedeAlignmentAlgorithm::addHitStatistics ( int  fromLoop,
const std::string &  outFile,
const std::vector< std::string > &  inFiles 
) const
private

Definition at line 1195 of file MillePedeAlignmentAlgorithm.cc.

1197  {
1198  bool allOk = true;
1199  int ierr = 0;
1200  MillePedeVariablesIORoot millePedeIO;
1201  for (std::vector<std::string>::const_iterator iFile = inFiles.begin(); iFile != inFiles.end(); ++iFile) {
1202  const std::string inFile(theDir + *iFile);
1203  const std::vector<AlignmentUserVariables *> mpVars =
1204  millePedeIO.readMillePedeVariables(theAlignables, inFile.c_str(), fromIov, ierr);
1205  if (ierr || !this->addHits(theAlignables, mpVars)) {
1206  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::addHitStatistics"
1207  << "Error " << ierr << " reading from " << inFile << ", tree " << fromIov
1208  << ", or problems in addHits";
1209  allOk = false;
1210  }
1211  for (std::vector<AlignmentUserVariables *>::const_iterator i = mpVars.begin(); i != mpVars.end(); ++i) {
1212  delete *i; // clean created objects
1213  }
1214  }
1215 
1216  return allOk;
1217 }

References addHits(), mps_fire::i, MillePedeVariablesIORoot::readMillePedeVariables(), AlCaHLTBitMon_QueryRunRegistry::string, theAlignables, and theDir.

Referenced by doIO().

◆ addLasBeam()

void MillePedeAlignmentAlgorithm::addLasBeam ( const EventInfo eventInfo,
const TkFittedLasBeam lasBeam,
const std::vector< TrajectoryStateOnSurface > &  tsoses 
)
private

Definition at line 1524 of file MillePedeAlignmentAlgorithm.cc.

1526  {
1527  AlignmentParameters *dummyPtr = nullptr; // for globalDerivativesHierarchy()
1528  std::vector<float> lasLocalDerivsX; // buffer for local derivatives
1529  const unsigned int beamLabel = thePedeLabels->lasBeamLabel(lasBeam.getBeamId()); // for global par
1530 
1531  for (unsigned int iHit = 0; iHit < tsoses.size(); ++iHit) {
1532  if (!tsoses[iHit].isValid())
1533  continue;
1534  // clear buffer
1535  theFloatBufferX.clear();
1536  theFloatBufferY.clear();
1537  theIntBuffer.clear();
1538  lasLocalDerivsX.clear();
1539  // get alignables and global parameters
1540  const SiStripLaserRecHit2D &hit = lasBeam.getData()[iHit];
1541  AlignableDetOrUnitPtr lasAli(theAlignableNavigator->alignableFromDetId(hit.getDetId()));
1543  eventInfo, tsoses[iHit], lasAli, lasAli, theFloatBufferX, theFloatBufferY, theIntBuffer, dummyPtr);
1544  // fill derivatives vector from derivatives matrix
1545  for (unsigned int nFitParams = 0; nFitParams < static_cast<unsigned int>(lasBeam.parameters().size());
1546  ++nFitParams) {
1547  const float derivative = lasBeam.derivatives()[iHit][nFitParams];
1548  if (nFitParams < lasBeam.firstFixedParameter()) { // first local beam parameters
1549  lasLocalDerivsX.push_back(derivative);
1550  } else { // now global ones
1551  const unsigned int numPar = nFitParams - lasBeam.firstFixedParameter();
1552  theIntBuffer.push_back(thePedeLabels->parameterLabel(beamLabel, numPar));
1553  theFloatBufferX.push_back(derivative);
1554  }
1555  } // end loop over parameters
1556 
1557  const float residual = hit.localPosition().x() - tsoses[iHit].localPosition().x();
1558  // error from file or assume 0.003
1559  const float error = 0.003; // hit.localPositionError().xx(); sqrt???
1560 
1561  theMille->mille(lasLocalDerivsX.size(),
1562  &(lasLocalDerivsX[0]),
1563  theFloatBufferX.size(),
1564  &(theFloatBufferX[0]),
1565  &(theIntBuffer[0]),
1566  residual,
1567  error);
1568  } // end of loop over hits
1569 
1570  theMille->end();
1571 }

References funct::derivative(), TkFittedLasBeam::derivatives(), relativeConstraints::error, TkFittedLasBeam::firstFixedParameter(), TkLasBeam::getBeamId(), TkLasBeam::getData(), globalDerivativesHierarchy(), sistrip::SpyUtilities::isValid(), TkFittedLasBeam::parameters(), theAlignableNavigator, theFloatBufferX, theFloatBufferY, theIntBuffer, theMille, thePedeLabels, and hit::x.

Referenced by addLaserData().

◆ addLaserData()

void MillePedeAlignmentAlgorithm::addLaserData ( const EventInfo eventInfo,
const TkFittedLasBeamCollection tkLasBeams,
const TsosVectorCollection tkLasBeamTsoses 
)
private

Definition at line 1507 of file MillePedeAlignmentAlgorithm.cc.

1509  {
1510  TsosVectorCollection::const_iterator iTsoses = lasBeamTsoses.begin();
1511  for (TkFittedLasBeamCollection::const_iterator iBeam = lasBeams.begin(), iEnd = lasBeams.end(); iBeam != iEnd;
1512  ++iBeam, ++iTsoses) { // beam/tsoses parallel!
1513 
1514  edm::LogInfo("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::addLaserData"
1515  << "Beam " << iBeam->getBeamId() << " with " << iBeam->parameters().size()
1516  << " parameters and " << iBeam->getData().size() << " hits.\n There are "
1517  << iTsoses->size() << " TSOSes.";
1518 
1519  this->addLasBeam(eventInfo, *iBeam, *iTsoses);
1520  }
1521 }

References addLasBeam().

Referenced by endRun().

◆ addMeasurementData()

int MillePedeAlignmentAlgorithm::addMeasurementData ( const edm::EventSetup setup,
const EventInfo eventInfo,
const ReferenceTrajectoryBase::ReferenceTrajectoryPtr refTrajPtr,
unsigned int  iHit,
AlignmentParameters *&  params 
)
private

If hit is usable: callMille for x and (probably) y direction. If globalDerivatives fine: returns 2 if 2D-hit, 1 if 1D-hit, 0 if no Alignable for hit. Returns -1 if any problem (for params cf. globalDerivativesHierarchy)

Definition at line 726 of file MillePedeAlignmentAlgorithm.cc.

730  {
731  params = nullptr;
732  theFloatBufferX.clear();
733  theFloatBufferY.clear();
734  theIntBuffer.clear();
735 
736  const TrajectoryStateOnSurface &tsos = refTrajPtr->trajectoryStates()[iHit];
737  const ConstRecHitPointer &recHitPtr = refTrajPtr->recHits()[iHit];
738  // ignore invalid hits
739  if (!recHitPtr->isValid())
740  return 0;
741 
742  // First add the derivatives from IntegratedCalibration's,
743  // should even be OK if problems for "usual" derivatives from Alignables
744  this->globalDerivativesCalibration(recHitPtr,
745  tsos,
746  setup,
747  eventInfo, // input
750  theIntBuffer); // output
751 
752  // get AlignableDet/Unit for this hit
753  AlignableDetOrUnitPtr alidet(theAlignableNavigator->alignableFromDetId(recHitPtr->geographicalId()));
754 
755  if (!this->globalDerivativesHierarchy(eventInfo,
756  tsos,
757  alidet,
758  alidet,
759  theFloatBufferX, // 2x alidet, sic!
761  theIntBuffer,
762  params)) {
763  return -1; // problem
765  return 0; // empty for X: no alignable for hit, nor calibrations
766  } else {
767  // store measurement even if no alignable or calibrations
768  // -> measurement used for pede-internal track-fit
769  return this->callMille(refTrajPtr, iHit, theIntBuffer, theFloatBufferX, theFloatBufferY);
770  }
771 }

References callMille(), dumpTauVariables_cfi::eventInfo, globalDerivativesCalibration(), globalDerivativesHierarchy(), ignoreHitsWithoutGlobalDerivatives_, CalibrationSummaryClient_cfi::params, singleTopDQM_cfi::setup, theAlignableNavigator, theFloatBufferX, theFloatBufferY, and theIntBuffer.

Referenced by addReferenceTrajectory().

◆ addPxbSurvey()

void MillePedeAlignmentAlgorithm::addPxbSurvey ( const edm::ParameterSet pxbSurveyCfg)
private

add measurement data from PXB survey

Definition at line 1573 of file MillePedeAlignmentAlgorithm.cc.

1573  {
1574  // do some printing, if requested
1575  const bool doOutputOnStdout(pxbSurveyCfg.getParameter<bool>("doOutputOnStdout"));
1576  if (doOutputOnStdout) {
1577  edm::LogInfo("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::addPxbSurvey"
1578  << "# Output from addPxbSurvey follows below because "
1579  << "doOutputOnStdout is set to True";
1580  }
1581 
1582  // instantiate a dicer object
1583  SurveyPxbDicer dicer(pxbSurveyCfg.getParameter<std::vector<edm::ParameterSet> >("toySurveyParameters"),
1584  pxbSurveyCfg.getParameter<unsigned int>("toySurveySeed"));
1585  std::ofstream outfile(pxbSurveyCfg.getUntrackedParameter<std::string>("toySurveyFile").c_str());
1586 
1587  // read data from file
1588  std::vector<SurveyPxbImageLocalFit> measurements;
1589  std::string filename(pxbSurveyCfg.getParameter<edm::FileInPath>("infile").fullPath());
1591 
1592  // loop over photographs (=measurements) and perform the fit
1593  for (std::vector<SurveyPxbImageLocalFit>::size_type i = 0; i != measurements.size(); i++) {
1594  if (doOutputOnStdout) {
1595  edm::LogInfo("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::addPxbSurvey"
1596  << "Module " << i << ": ";
1597  }
1598 
1599  // get the Alignables and their surfaces
1600  AlignableDetOrUnitPtr mod1(theAlignableNavigator->alignableFromDetId(measurements[i].getIdFirst()));
1601  AlignableDetOrUnitPtr mod2(theAlignableNavigator->alignableFromDetId(measurements[i].getIdSecond()));
1602  const AlignableSurface &surf1 = mod1->surface();
1603  const AlignableSurface &surf2 = mod2->surface();
1604 
1605  // the position of the fiducial points in local frame of a PXB module
1606  const LocalPoint fidpoint0(-0.91, +3.30);
1607  const LocalPoint fidpoint1(+0.91, +3.30);
1608  const LocalPoint fidpoint2(+0.91, -3.30);
1609  const LocalPoint fidpoint3(-0.91, -3.30);
1610 
1611  // We choose the local frame of the first module as reference,
1612  // so take the fidpoints of the second module and calculate their
1613  // positions in the reference frame
1614  const GlobalPoint surf2point0(surf2.toGlobal(fidpoint0));
1615  const GlobalPoint surf2point1(surf2.toGlobal(fidpoint1));
1616  const LocalPoint fidpoint0inSurf1frame(surf1.toLocal(surf2point0));
1617  const LocalPoint fidpoint1inSurf1frame(surf1.toLocal(surf2point1));
1618 
1619  // Create the vector for the fit
1621  fidpointvec.push_back(fidpoint0inSurf1frame);
1622  fidpointvec.push_back(fidpoint1inSurf1frame);
1623  fidpointvec.push_back(fidpoint2);
1624  fidpointvec.push_back(fidpoint3);
1625 
1626  // if toy survey is requested, dice the values now
1627  if (pxbSurveyCfg.getParameter<bool>("doToySurvey")) {
1628  dicer.doDice(fidpointvec, measurements[i].getIdPair(), outfile);
1629  }
1630 
1631  // do the fit
1632  measurements[i].doFit(fidpointvec, thePedeLabels->alignableLabel(mod1), thePedeLabels->alignableLabel(mod2));
1633  SurveyPxbImageLocalFit::localpars_t a; // local pars from fit
1634  a = measurements[i].getLocalParameters();
1635  const SurveyPxbImageLocalFit::value_t chi2 = measurements[i].getChi2();
1636 
1637  // do some reporting, if requested
1638  if (doOutputOnStdout) {
1639  edm::LogInfo("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::addPxbSurvey"
1640  << "a: " << a[0] << ", " << a[1] << ", " << a[2] << ", " << a[3]
1641  << " S= " << sqrt(a[2] * a[2] + a[3] * a[3]) << " phi= " << atan(a[3] / a[2])
1642  << " chi2= " << chi2 << std::endl;
1643  }
1644  if (theMonitor) {
1645  theMonitor->fillPxbSurveyHistsChi2(chi2);
1646  theMonitor->fillPxbSurveyHistsLocalPars(a[0], a[1], sqrt(a[2] * a[2] + a[3] * a[3]), atan(a[3] / a[2]));
1647  }
1648 
1649  // pass the results from the local fit to mille
1651  theMille->mille((int)measurements[i].getLocalDerivsSize(),
1652  measurements[i].getLocalDerivsPtr(j),
1653  (int)measurements[i].getGlobalDerivsSize(),
1654  measurements[i].getGlobalDerivsPtr(j),
1655  measurements[i].getGlobalDerivsLabelPtr(j),
1656  measurements[i].getResiduum(j),
1657  measurements[i].getSigma(j));
1658  }
1659  theMille->end();
1660  }
1661  outfile.close();
1662 }

References a, hltPixelTracks_cff::chi2, SurveyPxbDicer::doDice(), corrVsCorr::filename, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, dqmiolumiharvest::j, SurveyPxbImageLocalFit::nMsrmts, timingPdfMaker::outfile, DQM::reader, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, Alignable::surface(), theAlignableNavigator, theMille, theMonitor, thePedeLabels, AlignableSurface::toGlobal(), and AlignableSurface::toLocal().

Referenced by initialize().

◆ addReferenceTrajectory()

std::pair< unsigned int, unsigned int > MillePedeAlignmentAlgorithm::addReferenceTrajectory ( const edm::EventSetup setup,
const EventInfo eventInfo,
const ReferenceTrajectoryBase::ReferenceTrajectoryPtr refTrajPtr 
)
private

fill mille for a trajectory, returning number of x/y hits ([0,0] if 'bad' trajectory)

Definition at line 499 of file MillePedeAlignmentAlgorithm.cc.

500  {
501  std::pair<unsigned int, unsigned int> hitResultXy(0, 0);
502  if (refTrajPtr->isValid()) {
503  // GblTrajectory?
504  if (!refTrajPtr->gblInput().empty()) {
505  // by construction: number of GblPoints == number of recHits or == zero !!!
506  unsigned int iHit = 0;
507  unsigned int numPointsWithMeas = 0;
508  std::vector<GblPoint>::iterator itPoint;
509  auto theGblInput = refTrajPtr->gblInput();
510  for (unsigned int iTraj = 0; iTraj < refTrajPtr->gblInput().size(); ++iTraj) {
511  for (itPoint = refTrajPtr->gblInput()[iTraj].first.begin(); itPoint < refTrajPtr->gblInput()[iTraj].first.end();
512  ++itPoint) {
513  if (this->addGlobalData(setup, eventInfo, refTrajPtr, iHit++, *itPoint) < 0)
514  return hitResultXy;
515  if (itPoint->hasMeasurement() >= 1)
516  ++numPointsWithMeas;
517  }
518  }
519  hitResultXy.first = numPointsWithMeas;
520  // check #hits criterion
521  if (hitResultXy.first == 0 || hitResultXy.first < theMinNumHits)
522  return hitResultXy;
523  // construct GBL trajectory
524  if (refTrajPtr->gblInput().size() == 1) {
525  // from single track
526  GblTrajectory aGblTrajectory(refTrajPtr->gblInput()[0].first, refTrajPtr->nominalField() != 0);
527  // GBL fit trajectory
528  /*double Chi2;
529  int Ndf;
530  double lostWeight;
531  aGblTrajectory.fit(Chi2, Ndf, lostWeight);
532  std::cout << " GblFit: " << Chi2 << ", " << Ndf << ", " << lostWeight << std::endl; */
533  // write to MP binary file
534  if (aGblTrajectory.isValid() && aGblTrajectory.getNumPoints() >= theMinNumHits)
535  aGblTrajectory.milleOut(*theBinary);
536  }
537  if (refTrajPtr->gblInput().size() == 2) {
538  // from TwoBodyDecay
539  GblTrajectory aGblTrajectory(refTrajPtr->gblInput(),
540  refTrajPtr->gblExtDerivatives(),
541  refTrajPtr->gblExtMeasurements(),
542  refTrajPtr->gblExtPrecisions());
543  // write to MP binary file
544  if (aGblTrajectory.isValid() && aGblTrajectory.getNumPoints() >= theMinNumHits)
545  aGblTrajectory.milleOut(*theBinary);
546  }
547  } else {
548  // to add hits if all fine:
549  std::vector<AlignmentParameters *> parVec(refTrajPtr->recHits().size());
550  // collect hit statistics, assuming that there are no y-only hits
551  std::vector<bool> validHitVecY(refTrajPtr->recHits().size(), false);
552  // Use recHits from ReferenceTrajectory (since they have the right order!):
553  for (unsigned int iHit = 0; iHit < refTrajPtr->recHits().size(); ++iHit) {
554  const int flagXY = this->addMeasurementData(setup, eventInfo, refTrajPtr, iHit, parVec[iHit]);
555 
556  if (flagXY < 0) { // problem
557  hitResultXy.first = 0;
558  break;
559  } else { // hit is fine, increase x/y statistics
560  if (flagXY >= 1)
561  ++hitResultXy.first;
562  validHitVecY[iHit] = (flagXY >= 2);
563  }
564  } // end loop on hits
565 
566  // add virtual measurements
567  for (unsigned int iVirtualMeas = 0; iVirtualMeas < refTrajPtr->numberOfVirtualMeas(); ++iVirtualMeas) {
568  this->addVirtualMeas(refTrajPtr, iVirtualMeas);
569  }
570 
571  // kill or end 'track' for mille, depends on #hits criterion
572  if (hitResultXy.first == 0 || hitResultXy.first < theMinNumHits) {
573  theMille->kill();
574  hitResultXy.first = hitResultXy.second = 0; //reset
575  } else {
576  theMille->end();
577  // add x/y hit count to MillePedeVariables of parVec,
578  // returning number of y-hits of the reference trajectory
579  hitResultXy.second = this->addHitCount(parVec, validHitVecY);
580  //
581  }
582  }
583 
584  } // end if valid trajectory
585 
586  return hitResultXy;
587 }

References addGlobalData(), addHitCount(), addMeasurementData(), addVirtualMeas(), dumpTauVariables_cfi::eventInfo, theBinary, theMille, and theMinNumHits.

Referenced by run().

◆ addRefTrackData2D()

template<typename CovarianceMatrix , typename ResidualMatrix , typename LocalDerivativeMatrix >
void MillePedeAlignmentAlgorithm::addRefTrackData2D ( const ReferenceTrajectoryBase::ReferenceTrajectoryPtr refTrajPtr,
unsigned int  iTrajHit,
Eigen::MatrixBase< CovarianceMatrix > &  aHitCovarianceM,
Eigen::MatrixBase< ResidualMatrix > &  aHitResidualsM,
Eigen::MatrixBase< LocalDerivativeMatrix > &  aLocalDerivativesM 
)
private

adds data from reference trajectory from a specific Hit

Definition at line 1306 of file MillePedeAlignmentAlgorithm.cc.

1310  {
1311  // This Method is valid for 2D measurements only
1312 
1313  const unsigned int xIndex = iTrajHit * 2;
1314  const unsigned int yIndex = iTrajHit * 2 + 1;
1315 
1316  aHitCovarianceM(0, 0) = refTrajPtr->measurementErrors()[xIndex][xIndex];
1317  aHitCovarianceM(0, 1) = refTrajPtr->measurementErrors()[xIndex][yIndex];
1318  aHitCovarianceM(1, 0) = refTrajPtr->measurementErrors()[yIndex][xIndex];
1319  aHitCovarianceM(1, 1) = refTrajPtr->measurementErrors()[yIndex][yIndex];
1320 
1321  aHitResidualsM(0, 0) = refTrajPtr->measurements()[xIndex] - refTrajPtr->trajectoryPositions()[xIndex];
1322  aHitResidualsM(1, 0) = refTrajPtr->measurements()[yIndex] - refTrajPtr->trajectoryPositions()[yIndex];
1323 
1324  const auto &locDerivMatrix = refTrajPtr->derivatives();
1325  for (int i = 0; i < locDerivMatrix.num_col(); ++i) {
1326  aLocalDerivativesM(0, i) = locDerivMatrix[xIndex][i];
1327  aLocalDerivativesM(1, i) = locDerivMatrix[yIndex][i];
1328  }
1329 }

References mps_fire::i.

Referenced by callMille2D().

◆ addRefTrackVirtualMeas1D()

template<typename CovarianceMatrix , typename ResidualMatrix , typename LocalDerivativeMatrix >
void MillePedeAlignmentAlgorithm::addRefTrackVirtualMeas1D ( const ReferenceTrajectoryBase::ReferenceTrajectoryPtr refTrajPtr,
unsigned int  iVirtualMeas,
Eigen::MatrixBase< CovarianceMatrix > &  aHitCovarianceM,
Eigen::MatrixBase< ResidualMatrix > &  aHitResidualsM,
Eigen::MatrixBase< LocalDerivativeMatrix > &  aLocalDerivativesM 
)
private

adds data for a specific virtual measurement from reference trajectory

Definition at line 1285 of file MillePedeAlignmentAlgorithm.cc.

1290  {
1291  // This Method is valid for 1D measurements only
1292 
1293  const unsigned int xIndex = iVirtualMeas + refTrajPtr->numberOfHitMeas();
1294 
1295  aHitCovarianceM(0, 0) = refTrajPtr->measurementErrors()[xIndex][xIndex];
1296  aHitResidualsM(0, 0) = refTrajPtr->measurements()[xIndex];
1297 
1298  const auto &locDerivMatrix = refTrajPtr->derivatives();
1299  for (int i = 0; i < locDerivMatrix.num_col(); ++i) {
1300  aLocalDerivativesM(0, i) = locDerivMatrix[xIndex][i];
1301  }
1302 }

References mps_fire::i.

Referenced by addVirtualMeas().

◆ addVirtualMeas()

void MillePedeAlignmentAlgorithm::addVirtualMeas ( const ReferenceTrajectoryBase::ReferenceTrajectoryPtr refTrajPtr,
unsigned int  iVirtualMeas 
)
private

adds data for virtual measurements from reference trajectory

Definition at line 1479 of file MillePedeAlignmentAlgorithm.cc.

1480  {
1481  Eigen::Matrix<double, 1, 1> aHitCovarianceM;
1482  Eigen::Matrix<float, 1, 1> aHitResidualsM;
1483  Eigen::Matrix<float, 1, Eigen::Dynamic> aLocalDerivativesM{1, refTrajPtr->derivatives().num_col()};
1484  // below method fills above 3 'matrices'
1485  this->addRefTrackVirtualMeas1D(refTrajPtr, iVirtualMeas, aHitCovarianceM, aHitResidualsM, aLocalDerivativesM);
1486 
1487  // no global parameters (use dummy 0)
1488  auto aGlobalDerivativesM = Eigen::Matrix<float, 1, 1>::Zero();
1489 
1490  float newResidX = aHitResidualsM(0, 0);
1491  float newHitErrX = TMath::Sqrt(aHitCovarianceM(0, 0));
1492  std::vector<float> newLocalDerivsX(aLocalDerivativesM.size());
1493  Eigen::Map<Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> >(
1494  newLocalDerivsX.data(), aLocalDerivativesM.rows(), aLocalDerivativesM.cols()) = aLocalDerivativesM;
1495 
1496  std::vector<float> newGlobDerivsX(aGlobalDerivativesM.size());
1497  Eigen::Map<Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> >(
1498  newGlobDerivsX.data(), aGlobalDerivativesM.rows(), aGlobalDerivativesM.cols()) = aGlobalDerivativesM;
1499 
1500  const int nLocal = aLocalDerivativesM.cols();
1501  const int nGlobal = 0;
1502 
1503  theMille->mille(nLocal, newLocalDerivsX.data(), nGlobal, newGlobDerivsX.data(), &nGlobal, newResidX, newHitErrX);
1504 }

References addRefTrackVirtualMeas1D(), and theMille.

Referenced by addReferenceTrajectory().

◆ areEmptyParams()

bool MillePedeAlignmentAlgorithm::areEmptyParams ( const align::Alignables alignables) const
private

Definition at line 1068 of file MillePedeAlignmentAlgorithm.cc.

1068  {
1069  for (const auto &iAli : alignables) {
1070  const AlignmentParameters *params = iAli->alignmentParameters();
1071  if (params) {
1072  const auto &parVec(params->parameters());
1073  const auto &parCov(params->covariance());
1074  for (int i = 0; i < parVec.num_row(); ++i) {
1075  if (parVec[i] != 0.)
1076  return false;
1077  for (int j = i; j < parCov.num_col(); ++j) {
1078  if (parCov[i][j] != 0.)
1079  return false;
1080  }
1081  }
1082  }
1083  }
1084 
1085  return true;
1086 }

References mps_fire::i, dqmiolumiharvest::j, and CalibrationSummaryClient_cfi::params.

Referenced by readFromPede().

◆ areIOVsSpecified()

bool MillePedeAlignmentAlgorithm::areIOVsSpecified ( ) const
private

Definition at line 1664 of file MillePedeAlignmentAlgorithm.cc.

1664  {
1665  const auto runRangeSelection = theConfig.getUntrackedParameter<edm::VParameterSet>("RunRangeSelection");
1666 
1667  if (runRangeSelection.empty())
1668  return false;
1669 
1670  const auto runRanges =
1672 
1673  return !(runRanges.empty());
1674 }

References edm::ParameterSet::getUntrackedParameter(), align::makeNonOverlappingRunRanges(), cond::runnumber, theConfig, and cond::timeTypeSpecs.

◆ beginLuminosityBlock()

void MillePedeAlignmentAlgorithm::beginLuminosityBlock ( const edm::EventSetup )
overridevirtual

called at begin of luminosity block (resets Mille binary in mille mode)

Reimplemented from AlignmentAlgorithmBase.

Definition at line 710 of file MillePedeAlignmentAlgorithm.cc.

710  {
711  if (!runAtPCL_)
712  return;
713  if (this->isMode(myMilleBit))
714  theMille->resetOutputFile();
715 }

References isMode(), myMilleBit, runAtPCL_, and theMille.

◆ beginRun()

void MillePedeAlignmentAlgorithm::beginRun ( const edm::Run run,
const edm::EventSetup setup,
bool  changed 
)
overridevirtual

called at begin of run

Reimplemented from AlignmentAlgorithmBase.

Definition at line 619 of file MillePedeAlignmentAlgorithm.cc.

619  {
620  if (run.run() < firstIOV_ && !ignoreFirstIOVCheck_) {
621  throw cms::Exception("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::beginRun\n"
622  << "Using data (run = " << run.run() << ") prior to the first defined IOV ("
623  << firstIOV_ << ").";
624  }
625 
626  lastProcessedRun_ = run.run();
627 
628  if (changed && enableAlignableUpdates_) {
629  const auto runNumber = run.run();
631  for (auto runRange = uniqueRunRanges_.crbegin(); runRange != uniqueRunRanges_.crend(); ++runRange) {
632  if (runNumber >= runRange->first) {
633  firstRun = runRange->first;
634  break;
635  }
636  }
637  if (std::find(cachedRuns_.begin(), cachedRuns_.end(), firstRun) != cachedRuns_.end()) {
638  const auto &geometryRcd = setup.get<IdealGeometryRecord>();
639  const auto &globalPosRcd = setup.get<GlobalPositionRcd>();
640  const auto &alignmentRcd = setup.get<TrackerAlignmentRcd>();
641  const auto &surfaceRcd = setup.get<TrackerSurfaceDeformationRcd>();
642  const auto &errorRcd = setup.get<TrackerAlignmentErrorExtendedRcd>();
643 
644  std::ostringstream message;
645  bool throwException{false};
646  message << "Trying to cache tracker alignment payloads for a run (" << runNumber << ") in an IOV (" << firstRun
647  << ") that was already cached.\n"
648  << "The following records in your input database tag have an IOV "
649  << "boundary that does not match your IOV definition:\n";
650  if (geometryRcd.validityInterval().first().eventID().run() > firstRun) {
651  message << " - IdealGeometryRecord '" << geometryRcd.key().name() << "' (since "
652  << geometryRcd.validityInterval().first().eventID().run() << ")\n";
653  throwException = true;
654  }
655  if (globalPosRcd.validityInterval().first().eventID().run() > firstRun) {
656  message << " - GlobalPositionRecord '" << globalPosRcd.key().name() << "' (since "
657  << globalPosRcd.validityInterval().first().eventID().run() << ")";
659  message << " --> ignored\n";
660  } else {
661  message << "\n";
662  throwException = true;
663  }
664  }
665  if (alignmentRcd.validityInterval().first().eventID().run() > firstRun) {
666  message << " - TrackerAlignmentRcd '" << alignmentRcd.key().name() << "' (since "
667  << alignmentRcd.validityInterval().first().eventID().run() << ")\n";
668  throwException = true;
669  }
670  if (surfaceRcd.validityInterval().first().eventID().run() > firstRun) {
671  message << " - TrackerSurfaceDeformationRcd '" << surfaceRcd.key().name() << "' (since "
672  << surfaceRcd.validityInterval().first().eventID().run() << ")\n";
673  throwException = true;
674  }
675  if (errorRcd.validityInterval().first().eventID().run() > firstRun) {
676  message << " - TrackerAlignmentErrorExtendedRcd '" << errorRcd.key().name() << "' (since "
677  << errorRcd.validityInterval().first().eventID().run() << ")\n";
678  throwException = true;
679  }
680 
681  if (throwException) {
682  throw cms::Exception("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::beginRun\n" << message.str();
683  }
684  } else {
685  cachedRuns_.push_back(firstRun);
687  }
688  }
689 }

References cond::TimeTypeSpecs::beginValue, cachedRuns_, AlignmentParameterStore::cacheTransformations(), enableAlignableUpdates_, edm::IOVSyncValue::eventID(), Exception, spr::find(), edm::ValidityInterval::first(), firstIOV_, dataset::firstRun, ignoreFirstIOVCheck_, edm::eventsetup::EventSetupRecordImplementation< T >::key(), lastProcessedRun_, edm::eventsetup::EventSetupRecordKey::name(), edm::EventID::run(), run(), cond::runnumber, convertSQLiteXML::runNumber, singleTopDQM_cfi::setup, skipGlobalPositionRcdCheck_, theAlignmentParameterStore, cond::persistency::throwException(), cond::timeTypeSpecs, uniqueRunRanges_, and edm::eventsetup::EventSetupRecord::validityInterval().

◆ buildUserVariables()

void MillePedeAlignmentAlgorithm::buildUserVariables ( const align::Alignables alignables) const
private

add MillePedeVariables for each AlignmentParameters (exception if no parameters...)

Definition at line 1146 of file MillePedeAlignmentAlgorithm.cc.

1146  {
1147  for (const auto &iAli : alis) {
1148  AlignmentParameters *params = iAli->alignmentParameters();
1149  if (!params) {
1150  throw cms::Exception("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::buildUserVariables"
1151  << "No parameters for alignable";
1152  }
1153  MillePedeVariables *userVars = dynamic_cast<MillePedeVariables *>(params->userVariables());
1154  if (userVars) { // Just re-use existing, keeping label and numHits:
1155  for (unsigned int iPar = 0; iPar < userVars->size(); ++iPar) {
1156  // if (params->hierarchyLevel() > 0) {
1157  //std::cout << params->hierarchyLevel() << "\nBefore: " << userVars->parameter()[iPar];
1158  // }
1159  userVars->setAllDefault(iPar);
1160  //std::cout << "\nAfter: " << userVars->parameter()[iPar] << std::endl;
1161  }
1162  } else { // Nothing yet or erase wrong type:
1163  userVars = new MillePedeVariables(
1164  params->size(),
1165  thePedeLabels->alignableLabel(iAli),
1166  thePedeLabels->alignableTracker()->objectIdProvider().typeToName(iAli->alignableObjectId()));
1167  params->setUserVariables(userVars);
1168  }
1169  }
1170 }

References Exception, CalibrationSummaryClient_cfi::params, MillePedeVariables::setAllDefault(), MillePedeVariables::size(), and thePedeLabels.

Referenced by initialize(), and setParametersForRunRange().

◆ callMille()

int MillePedeAlignmentAlgorithm::callMille ( const ReferenceTrajectoryBase::ReferenceTrajectoryPtr refTrajPtr,
unsigned int  iTrajHit,
const std::vector< int > &  globalLabels,
const std::vector< float > &  globalDerivativesX,
const std::vector< float > &  globalDerivativesY 
)
private

calls callMille1D or callMille2D

Definition at line 1332 of file MillePedeAlignmentAlgorithm.cc.

1336  {
1337  const ConstRecHitPointer aRecHit(refTrajPtr->recHits()[iTrajHit]);
1338 
1339  if ((aRecHit)->dimension() == 1) {
1340  return this->callMille1D(refTrajPtr, iTrajHit, globalLabels, globalDerivativesX);
1341  } else {
1342  return this->callMille2D(refTrajPtr, iTrajHit, globalLabels, globalDerivativesX, globalDerivativesY);
1343  }
1344 }

References callMille1D(), and callMille2D().

Referenced by addMeasurementData().

◆ callMille1D()

int MillePedeAlignmentAlgorithm::callMille1D ( const ReferenceTrajectoryBase::ReferenceTrajectoryPtr refTrajPtr,
unsigned int  iTrajHit,
const std::vector< int > &  globalLabels,
const std::vector< float > &  globalDerivativesX 
)
private

calls Mille for 1D hits

Definition at line 1347 of file MillePedeAlignmentAlgorithm.cc.

1350  {
1351  const ConstRecHitPointer aRecHit(refTrajPtr->recHits()[iTrajHit]);
1352  const unsigned int xIndex = iTrajHit * 2; // the even ones are local x
1353 
1354  // local derivatives
1355  const AlgebraicMatrix &locDerivMatrix = refTrajPtr->derivatives();
1356  const int nLocal = locDerivMatrix.num_col();
1357  std::vector<float> localDerivatives(nLocal);
1358  for (unsigned int i = 0; i < localDerivatives.size(); ++i) {
1359  localDerivatives[i] = locDerivMatrix[xIndex][i];
1360  }
1361 
1362  // residuum and error
1363  float residX = refTrajPtr->measurements()[xIndex] - refTrajPtr->trajectoryPositions()[xIndex];
1364  float hitErrX = TMath::Sqrt(refTrajPtr->measurementErrors()[xIndex][xIndex]);
1365 
1366  // number of global derivatives
1367  const int nGlobal = globalDerivativesX.size();
1368 
1369  // &(localDerivatives[0]) etc. are valid - as long as vector is not empty
1370  // cf. http://www.parashift.com/c++-faq-lite/containers.html#faq-34.3
1371  theMille->mille(
1372  nLocal, &(localDerivatives[0]), nGlobal, &(globalDerivativesX[0]), &(globalLabels[0]), residX, hitErrX);
1373 
1374  if (theMonitor) {
1375  theMonitor->fillDerivatives(
1376  aRecHit, &(localDerivatives[0]), nLocal, &(globalDerivativesX[0]), nGlobal, &(globalLabels[0]));
1377  theMonitor->fillResiduals(aRecHit, refTrajPtr->trajectoryStates()[iTrajHit], iTrajHit, residX, hitErrX, false);
1378  }
1379 
1380  return 1;
1381 }

References mps_fire::i, theMille, and theMonitor.

Referenced by callMille().

◆ callMille2D()

int MillePedeAlignmentAlgorithm::callMille2D ( const ReferenceTrajectoryBase::ReferenceTrajectoryPtr refTrajPtr,
unsigned int  iTrajHit,
const std::vector< int > &  globalLabels,
const std::vector< float > &  globalDerivativesx,
const std::vector< float > &  globalDerivativesy 
)
private

calls Mille for x and possibly y component of hit, y is skipped for non-real 2D (e.g. SiStripRecHit2D), for TID/TEC first diagonalises if correlation is larger than configurable

Definition at line 1384 of file MillePedeAlignmentAlgorithm.cc.

1388  {
1389  const ConstRecHitPointer aRecHit(refTrajPtr->recHits()[iTrajHit]);
1390 
1391  if ((aRecHit)->dimension() != 2) {
1392  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::callMille2D"
1393  << "You try to call method for 2D hits for a " << (aRecHit)->dimension()
1394  << "D Hit. Hit gets ignored!";
1395  return -1;
1396  }
1397 
1398  Eigen::Matrix<double, 2, 2> aHitCovarianceM;
1399  Eigen::Matrix<float, 2, 1> aHitResidualsM;
1400  Eigen::Matrix<float, 2, Eigen::Dynamic> aLocalDerivativesM{2, refTrajPtr->derivatives().num_col()};
1401  // below method fills above 3 matrices
1402  this->addRefTrackData2D(refTrajPtr, iTrajHit, aHitCovarianceM, aHitResidualsM, aLocalDerivativesM);
1403  Eigen::Matrix<float, 2, Eigen::Dynamic> aGlobalDerivativesM{2, globalDerivativesx.size()};
1404  this->makeGlobDerivMatrix(globalDerivativesx, globalDerivativesy, aGlobalDerivativesM);
1405 
1406  // calculates correlation between Hit measurements
1407  // FIXME: Should take correlation (and resulting transformation) from original hit,
1408  // not 2x2 matrix from ReferenceTrajectory: That can come from error propagation etc.!
1409  const double corr = aHitCovarianceM(0, 1) / sqrt(aHitCovarianceM(0, 0) * aHitCovarianceM(1, 1));
1410  if (theMonitor)
1411  theMonitor->fillCorrelations2D(corr, aRecHit);
1412  bool diag = false; // diagonalise only tracker TID, TEC
1413  switch (aRecHit->geographicalId().subdetId()) {
1414  case SiStripDetId::TID:
1415  case SiStripDetId::TEC:
1416  if (aRecHit->geographicalId().det() == DetId::Tracker && TMath::Abs(corr) > theMaximalCor2D) {
1417  this->diagonalize(aHitCovarianceM, aLocalDerivativesM, aHitResidualsM, aGlobalDerivativesM);
1418  diag = true;
1419  }
1420  break;
1421  default:;
1422  }
1423 
1424  float newResidX = aHitResidualsM(0, 0);
1425  float newResidY = aHitResidualsM(1, 0);
1426  float newHitErrX = TMath::Sqrt(aHitCovarianceM(0, 0));
1427  float newHitErrY = TMath::Sqrt(aHitCovarianceM(1, 1));
1428 
1429  // change from column major (Eigen default) to row major to have row entries
1430  // in continuous memory
1431  std::vector<float> newLocalDerivs(aLocalDerivativesM.size());
1432  Eigen::Map<Eigen::Matrix<float, 2, Eigen::Dynamic, Eigen::RowMajor> >(
1433  newLocalDerivs.data(), aLocalDerivativesM.rows(), aLocalDerivativesM.cols()) = aLocalDerivativesM;
1434  float *newLocalDerivsX = &(newLocalDerivs[0]);
1435  float *newLocalDerivsY = &(newLocalDerivs[aLocalDerivativesM.cols()]);
1436 
1437  // change from column major (Eigen default) to row major to have row entries
1438  // in continuous memory
1439  std::vector<float> newGlobDerivs(aGlobalDerivativesM.size());
1440  Eigen::Map<Eigen::Matrix<float, 2, Eigen::Dynamic, Eigen::RowMajor> >(
1441  newGlobDerivs.data(), aGlobalDerivativesM.rows(), aGlobalDerivativesM.cols()) = aGlobalDerivativesM;
1442  float *newGlobDerivsX = &(newGlobDerivs[0]);
1443  float *newGlobDerivsY = &(newGlobDerivs[aGlobalDerivativesM.cols()]);
1444 
1445  const int nLocal = aLocalDerivativesM.cols();
1446  const int nGlobal = aGlobalDerivativesM.cols();
1447 
1448  if (diag && (newHitErrX > newHitErrY)) { // also for 2D hits?
1449  // measurement with smaller error is x-measurement (for !is2D do not fill y-measurement):
1450  std::swap(newResidX, newResidY);
1451  std::swap(newHitErrX, newHitErrY);
1452  std::swap(newLocalDerivsX, newLocalDerivsY);
1453  std::swap(newGlobDerivsX, newGlobDerivsY);
1454  }
1455 
1456  // &(globalLabels[0]) is valid - as long as vector is not empty
1457  // cf. http://www.parashift.com/c++-faq-lite/containers.html#faq-34.3
1458  theMille->mille(nLocal, newLocalDerivsX, nGlobal, newGlobDerivsX, &(globalLabels[0]), newResidX, newHitErrX);
1459 
1460  if (theMonitor) {
1461  theMonitor->fillDerivatives(aRecHit, newLocalDerivsX, nLocal, newGlobDerivsX, nGlobal, &(globalLabels[0]));
1462  theMonitor->fillResiduals(
1463  aRecHit, refTrajPtr->trajectoryStates()[iTrajHit], iTrajHit, newResidX, newHitErrX, false);
1464  }
1465  const bool isReal2DHit = this->is2D(aRecHit); // strip is 1D (except matched hits)
1466  if (isReal2DHit) {
1467  theMille->mille(nLocal, newLocalDerivsY, nGlobal, newGlobDerivsY, &(globalLabels[0]), newResidY, newHitErrY);
1468  if (theMonitor) {
1469  theMonitor->fillDerivatives(aRecHit, newLocalDerivsY, nLocal, newGlobDerivsY, nGlobal, &(globalLabels[0]));
1470  theMonitor->fillResiduals(
1471  aRecHit, refTrajPtr->trajectoryStates()[iTrajHit], iTrajHit, newResidY, newHitErrY, true); // true: y
1472  }
1473  }
1474 
1475  return (isReal2DHit ? 2 : 1);
1476 }

References Abs(), addRefTrackData2D(), alignCSCRings::corr, diagonalize(), pat::helper::ParametrizationHelper::dimension(), is2D(), makeGlobDerivMatrix(), mathSSE::sqrt(), std::swap(), SiStripDetId::TEC, theMaximalCor2D, theMille, theMonitor, SiStripDetId::TID, and DetId::Tracker.

Referenced by callMille().

◆ decodeMode()

unsigned int MillePedeAlignmentAlgorithm::decodeMode ( const std::string &  mode) const
private

Definition at line 1173 of file MillePedeAlignmentAlgorithm.cc.

1173  {
1174  if (mode == "full") {
1176  } else if (mode == "mille") {
1177  return myMilleBit; // + myPedeSteerBit; // sic! Including production of steerig file. NO!
1178  } else if (mode == "pede") {
1180  } else if (mode == "pedeSteer") {
1181  return myPedeSteerBit;
1182  } else if (mode == "pedeRun") {
1183  return myPedeSteerBit + myPedeRunBit + myPedeReadBit; // sic! Including steering and reading of result.
1184  } else if (mode == "pedeRead") {
1185  return myPedeReadBit;
1186  }
1187 
1188  throw cms::Exception("BadConfig") << "Unknown mode '" << mode
1189  << "', use 'full', 'mille', 'pede', 'pedeRun', 'pedeSteer' or 'pedeRead'.";
1190 
1191  return 0;
1192 }

References Exception, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, myMilleBit, myPedeReadBit, myPedeRunBit, and myPedeSteerBit.

◆ diagonalize()

template<typename CovarianceMatrix , typename LocalDerivativeMatrix , typename ResidualMatrix , typename GlobalDerivativeMatrix >
void MillePedeAlignmentAlgorithm::diagonalize ( Eigen::MatrixBase< CovarianceMatrix > &  aHitCovarianceM,
Eigen::MatrixBase< LocalDerivativeMatrix > &  aLocalDerivativesM,
Eigen::MatrixBase< ResidualMatrix > &  aHitResidualsM,
Eigen::MatrixBase< GlobalDerivativeMatrix > &  aGlobalDerivativesM 
) const
private

Definition at line 1258 of file MillePedeAlignmentAlgorithm.cc.

1261  {
1263  "'aLocalDerivativesM' and 'aHitResidualsM' must have the "
1264  "same underlying scalar type");
1266  "'aLocalDerivativesM' and 'aGlobalDerivativesM' must have the "
1267  "same underlying scalar type");
1268 
1269  Eigen::SelfAdjointEigenSolver<typename CovarianceMatrix::PlainObject> myDiag{aHitCovarianceM};
1270  // eigenvectors of real symmetric matrices are orthogonal, i.e. invert == transpose
1271  auto aTranfoToDiagonalSystemInv =
1272  myDiag.eigenvectors().transpose().template cast<typename LocalDerivativeMatrix::Scalar>();
1273 
1274  aHitCovarianceM = myDiag.eigenvalues().asDiagonal();
1275  aLocalDerivativesM = aTranfoToDiagonalSystemInv * aLocalDerivativesM;
1276  aHitResidualsM = aTranfoToDiagonalSystemInv * aHitResidualsM;
1277  if (aGlobalDerivativesM.size() > 0) {
1278  // diagonalize only if measurement depends on alignables or calibrations
1279  aGlobalDerivativesM = aTranfoToDiagonalSystemInv * aGlobalDerivativesM;
1280  }
1281 }

References relativeConstraints::value.

Referenced by callMille2D().

◆ doIO()

unsigned int MillePedeAlignmentAlgorithm::doIO ( int  loop) const
private

Definition at line 1089 of file MillePedeAlignmentAlgorithm.cc.

1089  {
1090  unsigned int result = 0;
1091 
1092  const std::string outFilePlain(theConfig.getParameter<std::string>("treeFile"));
1093  if (outFilePlain.empty()) {
1094  edm::LogInfo("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::doIO"
1095  << "treeFile parameter empty => skip writing for 'loop' " << loop;
1096  return result;
1097  }
1098 
1099  const std::string outFile(theDir + outFilePlain);
1100 
1101  AlignmentIORoot aliIO;
1102  int ioerr = 0;
1103  if (loop == 0) {
1104  aliIO.writeAlignableOriginalPositions(theAlignables, outFile.c_str(), loop, false, ioerr);
1105  if (ioerr) {
1106  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::doIO"
1107  << "Problem " << ioerr << " in writeAlignableOriginalPositions";
1108  ++result;
1109  }
1110  } else if (loop == 1) {
1111  // only for first iov add hit counts, else 2x, 3x,... number of hits in IOV 2, 3,...
1112  const std::vector<std::string> inFiles(theConfig.getParameter<std::vector<std::string> >("mergeTreeFiles"));
1113  const std::vector<std::string> binFiles(theConfig.getParameter<std::vector<std::string> >("mergeBinaryFiles"));
1114  if (inFiles.size() != binFiles.size()) {
1115  edm::LogWarning("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::doIO"
1116  << "'vstring mergeTreeFiles' and 'vstring mergeBinaryFiles' "
1117  << "differ in size";
1118  }
1119  this->addHitStatistics(0, outFile, inFiles); // add hit info from tree 0 in 'infiles'
1120  }
1121  MillePedeVariablesIORoot millePedeIO;
1122  millePedeIO.writeMillePedeVariables(theAlignables, outFile.c_str(), loop, false, ioerr);
1123  if (ioerr) {
1124  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::doIO"
1125  << "Problem " << ioerr << " writing MillePedeVariables";
1126  ++result;
1127  }
1128 
1129  aliIO.writeOrigRigidBodyAlignmentParameters(theAlignables, outFile.c_str(), loop, false, ioerr);
1130  if (ioerr) {
1131  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::doIO"
1132  << "Problem " << ioerr << " in writeOrigRigidBodyAlignmentParameters, " << loop;
1133  ++result;
1134  }
1135  aliIO.writeAlignableAbsolutePositions(theAlignables, outFile.c_str(), loop, false, ioerr);
1136  if (ioerr) {
1137  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::doIO"
1138  << "Problem " << ioerr << " in writeAlignableAbsolutePositions, " << loop;
1139  ++result;
1140  }
1141 
1142  return result;
1143 }

References addHitStatistics(), edm::ParameterSet::getParameter(), heppy_loop::loop, L1TdeCSCTF_cfi::outFile, mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, theAlignables, theConfig, theDir, AlignmentIORoot::writeAlignableAbsolutePositions(), AlignmentIORoot::writeAlignableOriginalPositions(), MillePedeVariablesIORoot::writeMillePedeVariables(), and AlignmentIORoot::writeOrigRigidBodyAlignmentParameters().

Referenced by setParametersForRunRange(), and terminate().

◆ endLuminosityBlock()

void MillePedeAlignmentAlgorithm::endLuminosityBlock ( const edm::EventSetup )
overridevirtual

called at end of luminosity block

Reimplemented from AlignmentAlgorithmBase.

Definition at line 718 of file MillePedeAlignmentAlgorithm.cc.

718  {
719  if (!runAtPCL_)
720  return;
721  if (this->isMode(myMilleBit))
722  theMille->flushOutputFile();
723 }

References isMode(), myMilleBit, runAtPCL_, and theMille.

◆ endRun() [1/2]

void MillePedeAlignmentAlgorithm::endRun ( const EndRunInfo runInfo,
const edm::EventSetup setup 
)
overridevirtual

called at end of run - order of arguments like in EDProducer etc.

Reimplemented from AlignmentAlgorithmBase.

Definition at line 704 of file MillePedeAlignmentAlgorithm.cc.

704  {
705  if (this->isMode(myMilleBit))
706  theMille->flushOutputFile();
707 }

References isMode(), myMilleBit, and theMille.

◆ endRun() [2/2]

void MillePedeAlignmentAlgorithm::endRun ( const EventInfo eventInfo,
const EndRunInfo runInfo,
const edm::EventSetup setup 
)
virtual

Run on run products, e.g. TkLAS.

Definition at line 692 of file MillePedeAlignmentAlgorithm.cc.

694  {
695  if (runInfo.tkLasBeams() && runInfo.tkLasBeamTsoses()) {
696  // LAS beam treatment
697  this->addLaserData(eventInfo, *(runInfo.tkLasBeams()), *(runInfo.tkLasBeamTsoses()));
698  }
699  if (this->isMode(myMilleBit))
700  theMille->flushOutputFile();
701 }

References addLaserData(), isMode(), myMilleBit, submitPVValidationJobs::runInfo, and theMille.

◆ getExistingFormattedFiles()

std::vector< std::string > MillePedeAlignmentAlgorithm::getExistingFormattedFiles ( const std::vector< std::string > &  plainFiles,
const std::string &  theDir 
)
private

Generates list of files to read, given the list and dir from the configuration. This will automatically expand formatting directives, if they appear.

Definition at line 422 of file MillePedeAlignmentAlgorithm.cc.

423  {
424  std::vector<std::string> files;
425  for (const auto &plainFile : plainFiles) {
426  const std::string &theInputFileName = plainFile;
427  int theNumber = 0;
428  while (true) {
429  // Create a formatted version of the filename, with growing numbers
430  // If the parameter doesn't contain a formatting directive, it just stays unchanged
431  char theNumberedInputFileName[200];
432  sprintf(theNumberedInputFileName, theInputFileName.c_str(), theNumber);
433  std::string theCompleteInputFileName = theDir + theNumberedInputFileName;
434  const auto endOfStrippedFileName = theCompleteInputFileName.rfind(" --");
435  const auto strippedInputFileName = theCompleteInputFileName.substr(0, endOfStrippedFileName);
436  // Check if the file exists
437  struct stat buffer;
438  if (stat(strippedInputFileName.c_str(), &buffer) == 0) {
439  // If the file exists, add it to the list
440  files.push_back(theCompleteInputFileName);
441  if (theNumberedInputFileName == theInputFileName) {
442  // If the filename didn't contain a formatting directive, no reason to look any further, break out of the loop
443  break;
444  } else {
445  // Otherwise look for the next number
446  theNumber++;
447  }
448  } else {
449  // The file doesn't exist, break out of the loop
450  break;
451  }
452  }
453  // warning if unformatted (-> theNumber stays at 0) does not exist
454  if (theNumber == 0 && (files.empty() || files.back() != plainFile)) {
455  edm::LogWarning("Alignment") << "The input file '" << plainFile << "' does not exist.";
456  }
457  }
458  return files;
459 }

References edmScanValgrind::buffer, submitPVResolutionJobs::files, edm_modernize_messagelogger::stat, AlCaHLTBitMon_QueryRunRegistry::string, and theDir.

Referenced by terminate().

◆ globalDerivativesCalibration()

void MillePedeAlignmentAlgorithm::globalDerivativesCalibration ( const TransientTrackingRecHit::ConstRecHitPointer recHit,
const TrajectoryStateOnSurface tsos,
const edm::EventSetup setup,
const EventInfo eventInfo,
std::vector< float > &  globalDerivativesX,
std::vector< float > &  globalDerivativesY,
std::vector< int > &  globalLabels 
) const
private

adding derivatives from integrated calibrations

Definition at line 956 of file MillePedeAlignmentAlgorithm.cc.

962  {
963  std::vector<IntegratedCalibrationBase::ValuesIndexPair> derivs;
964  for (auto iCalib = theCalibrations.begin(); iCalib != theCalibrations.end(); ++iCalib) {
965  // get all derivatives of this calibration // const unsigned int num =
966  (*iCalib)->derivatives(derivs, *recHit, tsos, setup, eventInfo);
967  for (auto iValuesInd = derivs.begin(); iValuesInd != derivs.end(); ++iValuesInd) {
968  // transfer label and x/y derivatives
969  globalLabels.push_back(thePedeLabels->calibrationLabel(*iCalib, iValuesInd->second));
970  globalDerivativesX.push_back(iValuesInd->first.first);
971  globalDerivativesY.push_back(iValuesInd->first.second);
972  }
973  }
974 }

References dumpTauVariables_cfi::eventInfo, rpcPointValidation_cfi::recHit, singleTopDQM_cfi::setup, theCalibrations, and thePedeLabels.

Referenced by addMeasurementData().

◆ globalDerivativesHierarchy() [1/2]

bool MillePedeAlignmentAlgorithm::globalDerivativesHierarchy ( const EventInfo eventInfo,
const TrajectoryStateOnSurface tsos,
Alignable ali,
const AlignableDetOrUnitPtr alidet,
std::vector< double > &  globalDerivativesX,
std::vector< double > &  globalDerivativesY,
std::vector< int > &  globalLabels,
AlignmentParameters *&  lowestParams 
) const
private

recursively adding derivatives (double) and labels, false if problems

Definition at line 894 of file MillePedeAlignmentAlgorithm.cc.

901  {
902  // derivatives and labels are recursively attached
903  if (!ali)
904  return true; // no mother might be OK
905 
906  if (false && theMonitor && alidet != ali)
907  theMonitor->fillFrameToFrame(alidet, ali);
908 
910 
911  if (params) {
912  if (!lowestParams)
913  lowestParams = params; // set parameters of lowest level
914 
915  bool hasSplitParameters = thePedeLabels->hasSplitParameters(ali);
916  const unsigned int alignableLabel = thePedeLabels->alignableLabel(ali);
917 
918  if (0 == alignableLabel) { // FIXME: what about regardAllHits in Markus' code?
919  edm::LogWarning("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::globalDerivativesHierarchy"
920  << "Label not found, skip Alignable.";
921  return false;
922  }
923 
924  const std::vector<bool> &selPars = params->selector();
925  const AlgebraicMatrix derivs(params->derivatives(tsos, alidet));
926  int globalLabel;
927 
928  // cols: 2, i.e. x&y, rows: parameters, usually RigidBodyAlignmentParameters::N_PARAM
929  for (unsigned int iSel = 0; iSel < selPars.size(); ++iSel) {
930  if (selPars[iSel]) {
931  if (hasSplitParameters == true) {
932  globalLabel = thePedeLabels->parameterLabel(ali, iSel, eventInfo, tsos);
933  } else {
934  globalLabel = thePedeLabels->parameterLabel(alignableLabel, iSel);
935  }
936  if (globalLabel > 0 && globalLabel <= 2147483647) {
937  globalLabels.push_back(globalLabel);
938  globalDerivativesX.push_back(derivs[iSel][kLocalX] / thePedeSteer->cmsToPedeFactor(iSel));
939  globalDerivativesY.push_back(derivs[iSel][kLocalY] / thePedeSteer->cmsToPedeFactor(iSel));
940  } else {
941  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::globalDerivativesHierarchy"
942  << "Invalid label " << globalLabel << " <= 0 or > 2147483647";
943  }
944  }
945  }
946  // Exclude mothers if Alignable selected to be no part of a hierarchy:
947  if (thePedeSteer->isNoHiera(ali))
948  return true;
949  }
950  // Call recursively for mother, will stop if mother == 0:
951  return this->globalDerivativesHierarchy(
952  eventInfo, tsos, ali->mother(), alidet, globalDerivativesX, globalDerivativesY, globalLabels, lowestParams);
953 }

References Alignable::alignmentParameters(), dumpTauVariables_cfi::eventInfo, globalDerivativesHierarchy(), kLocalX, kLocalY, Alignable::mother(), CalibrationSummaryClient_cfi::params, theMonitor, thePedeLabels, and thePedeSteer.

◆ globalDerivativesHierarchy() [2/2]

bool MillePedeAlignmentAlgorithm::globalDerivativesHierarchy ( const EventInfo eventInfo,
const TrajectoryStateOnSurface tsos,
Alignable ali,
const AlignableDetOrUnitPtr alidet,
std::vector< float > &  globalDerivativesX,
std::vector< float > &  globalDerivativesY,
std::vector< int > &  globalLabels,
AlignmentParameters *&  lowestParams 
) const
private

recursively adding derivatives and labels, false if problems

Definition at line 839 of file MillePedeAlignmentAlgorithm.cc.

846  {
847  // derivatives and labels are recursively attached
848  if (!ali)
849  return true; // no mother might be OK
850 
851  if (false && theMonitor && alidet != ali)
852  theMonitor->fillFrameToFrame(alidet, ali);
853 
855 
856  if (params) {
857  if (!lowestParams)
858  lowestParams = params; // set parameters of lowest level
859 
860  bool hasSplitParameters = thePedeLabels->hasSplitParameters(ali);
861  const unsigned int alignableLabel = thePedeLabels->alignableLabel(ali);
862 
863  if (0 == alignableLabel) { // FIXME: what about regardAllHits in Markus' code?
864  edm::LogWarning("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::globalDerivativesHierarchy"
865  << "Label not found, skip Alignable.";
866  return false;
867  }
868 
869  const std::vector<bool> &selPars = params->selector();
870  const AlgebraicMatrix derivs(params->derivatives(tsos, alidet));
871 
872  // cols: 2, i.e. x&y, rows: parameters, usually RigidBodyAlignmentParameters::N_PARAM
873  for (unsigned int iSel = 0; iSel < selPars.size(); ++iSel) {
874  if (selPars[iSel]) {
875  globalDerivativesX.push_back(derivs[iSel][kLocalX] / thePedeSteer->cmsToPedeFactor(iSel));
876  if (hasSplitParameters == true) {
877  globalLabels.push_back(thePedeLabels->parameterLabel(ali, iSel, eventInfo, tsos));
878  } else {
879  globalLabels.push_back(thePedeLabels->parameterLabel(alignableLabel, iSel));
880  }
881  globalDerivativesY.push_back(derivs[iSel][kLocalY] / thePedeSteer->cmsToPedeFactor(iSel));
882  }
883  }
884  // Exclude mothers if Alignable selected to be no part of a hierarchy:
885  if (thePedeSteer->isNoHiera(ali))
886  return true;
887  }
888  // Call recursively for mother, will stop if mother == 0:
889  return this->globalDerivativesHierarchy(
890  eventInfo, tsos, ali->mother(), alidet, globalDerivativesX, globalDerivativesY, globalLabels, lowestParams);
891 }

References Alignable::alignmentParameters(), dumpTauVariables_cfi::eventInfo, kLocalX, kLocalY, Alignable::mother(), CalibrationSummaryClient_cfi::params, theMonitor, thePedeLabels, and thePedeSteer.

Referenced by addGlobalData(), addLasBeam(), addMeasurementData(), and globalDerivativesHierarchy().

◆ initialize()

void MillePedeAlignmentAlgorithm::initialize ( const edm::EventSetup setup,
AlignableTracker tracker,
AlignableMuon muon,
AlignableExtras extras,
AlignmentParameterStore store 
)
overridevirtual

Called at beginning of job.

Implements AlignmentAlgorithmBase.

Definition at line 130 of file MillePedeAlignmentAlgorithm.cc.

134  {
135  if (muon) {
136  edm::LogWarning("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::initialize"
137  << "Running with AlignabeMuon not yet tested.";
138  }
139 
143  const auto &iov_alignments = setup.get<TrackerAlignmentRcd>().validityInterval();
144  const auto &iov_surfaces = setup.get<TrackerSurfaceDeformationRcd>().validityInterval();
145  const auto &iov_errors = setup.get<TrackerAlignmentErrorExtendedRcd>().validityInterval();
146 
147  std::ostringstream message;
148  bool throwException{false};
149  if (iov_alignments.first().eventID().run() != MIN_VAL || iov_alignments.last().eventID().run() != MAX_VAL) {
150  message << "\nTrying to apply " << setup.get<TrackerAlignmentRcd>().key().name()
151  << " with multiple IOVs in tag without specifying 'RunRangeSelection'.\n"
152  << "Validity range is " << iov_alignments.first().eventID().run() << " - "
153  << iov_alignments.last().eventID().run() << "\n";
154  throwException = true;
155  }
156  if (iov_surfaces.first().eventID().run() != MIN_VAL || iov_surfaces.last().eventID().run() != MAX_VAL) {
157  message << "\nTrying to apply " << setup.get<TrackerSurfaceDeformationRcd>().key().name()
158  << " with multiple IOVs in tag without specifying 'RunRangeSelection'.\n"
159  << "Validity range is " << iov_surfaces.first().eventID().run() << " - "
160  << iov_surfaces.last().eventID().run() << "\n";
161  throwException = true;
162  }
163  if (iov_errors.first().eventID().run() != MIN_VAL || iov_errors.last().eventID().run() != MAX_VAL) {
164  message << "\nTrying to apply " << setup.get<TrackerAlignmentErrorExtendedRcd>().key().name()
165  << " with multiple IOVs in tag without specifying 'RunRangeSelection'.\n"
166  << "Validity range is " << iov_errors.first().eventID().run() << " - "
167  << iov_errors.last().eventID().run() << "\n";
168  throwException = true;
169  }
170  if (throwException) {
171  throw cms::Exception("DatabaseError") << "@SUB=MillePedeAlignmentAlgorithm::initialize" << message.str();
172  }
173  }
174 
175  //Retrieve tracker topology from geometry
176  const TrackerTopology *const tTopo = &setup.getData(topoToken_);
177 
178  //Retrieve the thresolds cuts from DB for the PCL
179  if (runAtPCL_) {
180  const auto &th = &setup.getData(aliThrToken_);
181  theThresholds = std::make_shared<AlignPCLThresholds>();
182  storeThresholds(th->getNrecords(), th->getThreshold_Map());
183  }
184 
185  theAlignableNavigator = std::make_unique<AlignableNavigator>(extras, tracker, muon);
188 
189  edm::ParameterSet pedeLabelerCfg(theConfig.getParameter<edm::ParameterSet>("pedeLabeler"));
190  edm::VParameterSet RunRangeSelectionVPSet(theConfig.getUntrackedParameter<edm::VParameterSet>("RunRangeSelection"));
191  pedeLabelerCfg.addUntrackedParameter<edm::VParameterSet>("RunRangeSelection", RunRangeSelectionVPSet);
192 
193  std::string labelerPlugin = "PedeLabeler";
194  if (!RunRangeSelectionVPSet.empty()) {
195  labelerPlugin = "RunRangeDependentPedeLabeler";
196  if (pedeLabelerCfg.exists("plugin")) {
197  std::string labelerPluginCfg = pedeLabelerCfg.getParameter<std::string>("plugin");
198  if ((labelerPluginCfg != "PedeLabeler" && labelerPluginCfg != "RunRangeDependentPedeLabeler") ||
199  !pedeLabelerCfg.getUntrackedParameter<edm::VParameterSet>("parameterInstances").empty()) {
200  throw cms::Exception("BadConfig") << "MillePedeAlignmentAlgorithm::initialize"
201  << "both RunRangeSelection and generic labeler specified in config file. "
202  << "Please get rid of either one of them.\n";
203  }
204  }
205  } else {
206  if (pedeLabelerCfg.exists("plugin")) {
207  labelerPlugin = pedeLabelerCfg.getParameter<std::string>("plugin");
208  }
209  }
210 
211  if (!pedeLabelerCfg.exists("plugin")) {
212  pedeLabelerCfg.addUntrackedParameter<std::string>("plugin", labelerPlugin);
213  }
214 
215  edm::LogInfo("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::initialize"
216  << "Using plugin '" << labelerPlugin << "' to generate labels.";
217 
218  thePedeLabels = std::shared_ptr<PedeLabelerBase>(PedeLabelerPluginFactory::get()->create(
219  labelerPlugin, PedeLabelerBase::TopLevelAlignables(tracker, muon, extras), pedeLabelerCfg));
220 
221  // 1) Create PedeSteerer: correct alignable positions for coordinate system selection
222  edm::ParameterSet pedeSteerCfg(theConfig.getParameter<edm::ParameterSet>("pedeSteerer"));
223  thePedeSteer = std::make_unique<PedeSteerer>(tracker,
224  muon,
225  extras,
227  thePedeLabels.get(),
228  pedeSteerCfg,
229  theDir,
230  !this->isMode(myPedeSteerBit));
231 
232  // 2) If requested, directly read in and apply result of previous pede run,
233  // assuming that correction from 1) was also applied to create the result:
234  const std::vector<edm::ParameterSet> mprespset(
235  theConfig.getParameter<std::vector<edm::ParameterSet> >("pedeReaderInputs"));
236  if (!mprespset.empty()) {
237  edm::LogInfo("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::initialize"
238  << "Apply " << mprespset.end() - mprespset.begin()
239  << " previous MillePede constants from 'pedeReaderInputs'.";
240  }
241 
242  // FIXME: add selection of run range via 'pedeReaderInputs'
243  // Note: Results for parameters of IntegratedCalibration's cannot be treated...
245  for (std::vector<edm::ParameterSet>::const_iterator iSet = mprespset.begin(), iE = mprespset.end(); iSet != iE;
246  ++iSet) {
247  // This read will ignore calibrations as long as they are not yet passed to Millepede
248  // during/before initialize(..) - currently addCalibrations(..) is called later in AlignmentProducer
249  if (!this->readFromPede((*iSet), false, runrange)) { // false: do not erase SelectionUserVariables
250  throw cms::Exception("BadConfig")
251  << "MillePedeAlignmentAlgorithm::initialize: Problems reading input constants of "
252  << "pedeReaderInputs entry " << iSet - mprespset.begin() << '.';
253  }
255  // Needed to shut up later warning from checkAliParams:
257  }
258 
259  // 3) Now create steerings with 'final' start position:
260  thePedeSteer->buildSubSteer(tracker, muon, extras);
261 
262  // After (!) 1-3 of PedeSteerer which uses the SelectionUserVariables attached to the parameters:
263  this->buildUserVariables(theAlignables); // for hit statistics and/or pede result
264 
265  if (this->isMode(myMilleBit)) {
266  if (!theConfig.getParameter<std::vector<std::string> >("mergeBinaryFiles").empty() ||
267  !theConfig.getParameter<std::vector<std::string> >("mergeTreeFiles").empty()) {
268  throw cms::Exception("BadConfig") << "'vstring mergeTreeFiles' and 'vstring mergeBinaryFiles' must be empty for "
269  << "modes running mille.";
270  }
271  const std::string moniFile(theConfig.getUntrackedParameter<std::string>("monitorFile"));
272  if (!moniFile.empty())
273  theMonitor = std::make_unique<MillePedeMonitor>(tTopo, (theDir + moniFile).c_str());
274 
275  // Get trajectory factory. In case nothing found, FrameWork will throw...
276  const edm::ParameterSet fctCfg(theConfig.getParameter<edm::ParameterSet>("TrajectoryFactory"));
277  const std::string fctName(fctCfg.getParameter<std::string>("TrajectoryFactoryName"));
278  theTrajectoryFactory = TrajectoryFactoryPlugin::get()->create(fctName, fctCfg);
279  }
280 
281  if (this->isMode(myPedeSteerBit)) {
282  // Get config for survey and set flag accordingly
283  const edm::ParameterSet pxbSurveyCfg(theConfig.getParameter<edm::ParameterSet>("surveyPixelBarrel"));
284  theDoSurveyPixelBarrel = pxbSurveyCfg.getParameter<bool>("doSurvey");
286  this->addPxbSurvey(pxbSurveyCfg);
287  }
288 }

References addPxbSurvey(), edm::ParameterSet::addUntrackedParameter(), AlignmentParameterStore::alignables(), aliThrToken_, AlignmentParameterStore::applyParameters(), cond::TimeTypeSpecs::beginValue, buildUserVariables(), beamerCreator::create(), relativeConstraints::empty, cond::TimeTypeSpecs::endValue, enforceSingleIOVInput_, Exception, edm::ParameterSet::exists(), get, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), isMode(), crabWrapper::key, cond::time::MAX_VAL(), cond::time::MIN_VAL(), myMilleBit, myPedeSteerBit, readFromPede(), AlignmentParameterStore::resetParameters(), runAtPCL_, cond::runnumber, singleTopDQM_cfi::setup, storeThresholds(), AlCaHLTBitMon_QueryRunRegistry::string, theAlignableNavigator, theAlignables, theAlignmentParameterStore, theConfig, theDir, theDoSurveyPixelBarrel, theMonitor, thePedeLabels, thePedeSteer, theThresholds, theTrajectoryFactory, cond::persistency::throwException(), cond::timeTypeSpecs, topoToken_, and PbPb_ZMuSkimMuonDPG_cff::tracker.

◆ is2D()

bool MillePedeAlignmentAlgorithm::is2D ( const TransientTrackingRecHit::ConstRecHitPointer recHit) const
private

true if hit belongs to 2D detector (currently tracker specific)

Definition at line 1011 of file MillePedeAlignmentAlgorithm.cc.

1011  {
1012  // FIXME: Check whether this is a reliable and recommended way to find out...
1013 
1014  if (recHit->dimension() < 2) {
1015  return false; // some muon and TIB/TOB stuff really has RecHit1D
1016  } else if (recHit->detUnit()) { // detunit in strip is 1D, in pixel 2D
1017  return recHit->detUnit()->type().isTrackerPixel();
1018  } else { // stereo strips (FIXME: endcap trouble due to non-parallel strips (wedge sensors)?)
1019  if (dynamic_cast<const ProjectedSiStripRecHit2D *>(recHit->hit())) { // check persistent hit
1020  // projected: 1D measurement on 'glued' module
1021  return false;
1022  } else {
1023  return true;
1024  }
1025  }
1026 }

References rpcPointValidation_cfi::recHit.

Referenced by callMille2D().

◆ isMode()

bool MillePedeAlignmentAlgorithm::isMode ( unsigned int  testMode) const
inlineprivate

◆ makeGlobDerivMatrix()

template<typename GlobalDerivativeMatrix >
void MillePedeAlignmentAlgorithm::makeGlobDerivMatrix ( const std::vector< float > &  globalDerivativesx,
const std::vector< float > &  globalDerivativesy,
Eigen::MatrixBase< GlobalDerivativeMatrix > &  aGlobalDerivativesM 
)
private

Definition at line 1242 of file MillePedeAlignmentAlgorithm.cc.

1244  {
1245  static_assert(GlobalDerivativeMatrix::RowsAtCompileTime == 2, "global derivative matrix must have two rows");
1246 
1247  for (size_t i = 0; i < globalDerivativesx.size(); ++i) {
1248  aGlobalDerivativesM(0, i) = globalDerivativesx[i];
1249  aGlobalDerivativesM(1, i) = globalDerivativesy[i];
1250  }
1251 }

References mps_fire::i.

Referenced by callMille2D().

◆ processesEvents()

bool MillePedeAlignmentAlgorithm::processesEvents ( )
overridevirtual

Returns whether MP should process events in the current configuration.

Reimplemented from AlignmentAlgorithmBase.

Definition at line 308 of file MillePedeAlignmentAlgorithm.cc.

308  {
309  if (isMode(myMilleBit)) {
310  return true;
311  } else {
312  return false;
313  }
314 }

References isMode(), and myMilleBit.

◆ readFromPede()

bool MillePedeAlignmentAlgorithm::readFromPede ( const edm::ParameterSet mprespset,
bool  setUserVars,
const RunRange runrange 
)
private

read pede input defined by 'psetName', flag to create/not create MillePedeVariables

Definition at line 1029 of file MillePedeAlignmentAlgorithm.cc.

1031  {
1032  bool allEmpty = this->areEmptyParams(theAlignables);
1033 
1034  PedeReader reader(mprespset, *thePedeSteer, *thePedeLabels, runrange);
1035  align::Alignables alis;
1036  bool okRead = reader.read(alis, setUserVars); // also may set params of IntegratedCalibration's
1037  bool numMatch = true;
1038 
1039  std::stringstream out;
1040  out << "Read " << alis.size() << " alignables";
1041  if (alis.size() != theAlignables.size()) {
1042  out << " while " << theAlignables.size() << " in store";
1043  numMatch = false; // FIXME: Should we check one by one? Or transfer 'alis' to the store?
1044  }
1045  if (!okRead)
1046  out << ", but problems in reading";
1047  if (!allEmpty)
1048  out << ", possibly overwriting previous settings";
1049  out << ".";
1050 
1051  if (okRead && allEmpty) {
1052  if (numMatch) { // as many alignables with result as trying to align
1053  edm::LogInfo("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::readFromPede" << out.str();
1054  } else if (!alis.empty()) { // dead module do not get hits and no pede result
1055  edm::LogWarning("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::readFromPede" << out.str();
1056  } else { // serious problem: no result read - and not all modules can be dead...
1057  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::readFromPede" << out.str();
1058  return false;
1059  }
1060  return true;
1061  }
1062  // the rest is not OK:
1063  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::readFromPede" << out.str();
1064  return false;
1065 }

References areEmptyParams(), MillePedeFileConverter_cfg::out, DQM::reader, theAlignables, thePedeLabels, and thePedeSteer.

Referenced by initialize(), and setParametersForRunRange().

◆ run()

void MillePedeAlignmentAlgorithm::run ( const edm::EventSetup setup,
const EventInfo eventInfo 
)
overridevirtual

Run the algorithm on trajectories and tracks.

Implements AlignmentAlgorithmBase.

Definition at line 463 of file MillePedeAlignmentAlgorithm.cc.

463  {
464  if (!this->isMode(myMilleBit))
465  return; // no theMille created...
466  const auto &tracks = eventInfo.trajTrackPairs();
467 
468  if (theMonitor) { // monitor input tracks
469  for (const auto &iTrajTrack : tracks) {
470  theMonitor->fillTrack(iTrajTrack.second);
471  }
472  }
473 
474  const RefTrajColl trajectories(theTrajectoryFactory->trajectories(setup, tracks, eventInfo.beamSpot()));
475 
476  // Now loop over ReferenceTrajectoryCollection
477  unsigned int refTrajCount = 0; // counter for track monitoring
478  const auto tracksPerTraj = theTrajectoryFactory->tracksPerTrajectory();
479  for (auto iRefTraj = trajectories.cbegin(), iRefTrajE = trajectories.cend(); iRefTraj != iRefTrajE;
480  ++iRefTraj, ++refTrajCount) {
481  RefTrajColl::value_type refTrajPtr = *iRefTraj;
482  if (theMonitor)
483  theMonitor->fillRefTrajectory(refTrajPtr);
484 
485  const auto nHitXy = this->addReferenceTrajectory(setup, eventInfo, refTrajPtr);
486 
487  if (theMonitor && (nHitXy.first || nHitXy.second)) {
488  // if trajectory used (i.e. some hits), fill monitoring
489  const auto offset = tracksPerTraj * refTrajCount;
490  for (unsigned int iTrack = 0; iTrack < tracksPerTraj; ++iTrack) {
491  theMonitor->fillUsedTrack(tracks[offset + iTrack].second, nHitXy.first, nHitXy.second);
492  }
493  }
494 
495  } // end of reference trajectory and track loop
496 }

References addReferenceTrajectory(), dumpTauVariables_cfi::eventInfo, isMode(), myMilleBit, hltrates_dqm_sourceclient-live_cfg::offset, edm::second(), singleTopDQM_cfi::setup, theMonitor, theTrajectoryFactory, tracks, FastTrackerRecHitMaskProducer_cfi::trajectories, and AlignmentAlgorithmBase::EventInfo::trajTrackPairs().

Referenced by DTWorkflow.DTWorkflow::all(), beginRun(), Types.EventID::cppID(), Types.LuminosityBlockID::cppID(), o2olib.O2OTool::execute(), and terminate().

◆ setParametersForRunRange()

bool MillePedeAlignmentAlgorithm::setParametersForRunRange ( const RunRange runrange)
overridevirtual

Called in order to pass parameters to alignables for a specific run range in case the algorithm supports run range dependent alignment.

Reimplemented from AlignmentAlgorithmBase.

Definition at line 333 of file MillePedeAlignmentAlgorithm.cc.

333  {
334  if (this->isMode(myPedeReadBit)) {
335  if (not theAlignmentParameterStore) {
336  return false;
337  }
338  // restore initial positions, rotations and deformations
341  } else {
343  }
344 
345  // Needed to shut up later warning from checkAliParams:
347  // To avoid that they keep values from previous IOV if no new one in pede result
349 
350  if (!this->readFromPede(theConfig.getParameter<edm::ParameterSet>("pedeReader"), true, runrange)) {
351  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::setParametersForRunRange"
352  << "Problems reading pede result, but applying!";
353  }
355 
356  this->doIO(++theLastWrittenIov); // pre-increment!
357  }
358 
359  return true;
360 }

References AlignmentParameterStore::applyParameters(), buildUserVariables(), doIO(), enableAlignableUpdates_, edm::ParameterSet::getParameter(), isMode(), myPedeReadBit, readFromPede(), AlignmentParameterStore::resetParameters(), AlignmentParameterStore::restoreCachedTransformations(), theAlignables, theAlignmentParameterStore, theConfig, and theLastWrittenIov.

◆ storeAlignments()

bool MillePedeAlignmentAlgorithm::storeAlignments ( )
overridevirtual

Returns whether MP produced results to be stored.

Reimplemented from AlignmentAlgorithmBase.

Definition at line 317 of file MillePedeAlignmentAlgorithm.cc.

317  {
318  if (isMode(myPedeReadBit)) {
319  if (runAtPCL_) {
320  MillePedeFileReader mpReader(
322  mpReader.read();
323  return mpReader.storeAlignments();
324  } else {
325  return true;
326  }
327  } else {
328  return false;
329  }
330 }

References edm::ParameterSet::getParameter(), isMode(), myPedeReadBit, MillePedeFileReader::read(), runAtPCL_, MillePedeFileReader::storeAlignments(), theConfig, thePedeLabels, and theThresholds.

◆ storeThresholds()

bool MillePedeAlignmentAlgorithm::storeThresholds ( const int &  nRecords,
const AlignPCLThresholds::threshold_map thresholdMap 
)
virtual

Definition at line 301 of file MillePedeAlignmentAlgorithm.cc.

302  {
303  theThresholds->setAlignPCLThresholds(nRecords, thresholdMap);
304  return true;
305 }

References theThresholds.

Referenced by initialize().

◆ supportsCalibrations()

bool MillePedeAlignmentAlgorithm::supportsCalibrations ( )
overridevirtual

Returns whether MP supports calibrations.

Reimplemented from AlignmentAlgorithmBase.

Definition at line 291 of file MillePedeAlignmentAlgorithm.cc.

291 { return true; }

◆ terminate() [1/2]

void MillePedeAlignmentAlgorithm::terminate ( )
overridevirtual

Called at end of job.

Reimplemented from AlignmentAlgorithmBase.

Definition at line 365 of file MillePedeAlignmentAlgorithm.cc.

365  {
366  theMille.reset(); // delete to close binary before running pede below (flush would be enough...)
367  theBinary.reset();
368 
369  std::vector<std::string> files;
370  if (this->isMode(myMilleBit) || !theConfig.getParameter<std::string>("binaryFile").empty()) {
371  files.push_back(theDir + theConfig.getParameter<std::string>("binaryFile"));
372  } else {
373  const std::vector<std::string> plainFiles(theConfig.getParameter<std::vector<std::string> >("mergeBinaryFiles"));
374  files = getExistingFormattedFiles(plainFiles, theDir);
375  // Do some logging:
376  std::string filesForLogOutput;
377  for (const auto &file : files)
378  filesForLogOutput += " " + file + ",";
379  if (filesForLogOutput.length() != 0)
380  filesForLogOutput.pop_back();
381  edm::LogInfo("Alignment") << "Based on the config parameter mergeBinaryFiles, using the following "
382  << "files as input (assigned weights are indicated by ' -- <weight>'):"
383  << filesForLogOutput;
384  }
385 
387  return;
388 
389  // cache all positions, rotations and deformations
392  if (lastProcessedRun_ < uniqueRunRanges_.back().first) {
393  throw cms::Exception("BadConfig") << "@SUB=MillePedeAlignmentAlgorithm::terminate\n"
394  << "Last IOV of 'RunRangeSelection' has not been processed. "
395  << "Please reconfigure your source to process the runs at least up to "
396  << uniqueRunRanges_.back().first << ".";
397  }
398  auto lastCachedRun = uniqueRunRanges_.front().first;
399  for (const auto &runRange : uniqueRunRanges_) {
400  const auto run = runRange.first;
401  if (std::find(cachedRuns_.begin(), cachedRuns_.end(), run) == cachedRuns_.end()) {
404  } else {
405  lastCachedRun = run;
406  }
407  }
409  }
410 
411  const std::string masterSteer(thePedeSteer->buildMasterSteer(files)); // do only if myPedeSteerBit?
412  if (this->isMode(myPedeRunBit)) {
413  thePedeSteer->runPede(masterSteer);
414  }
415 
416  // parameters from pede are not yet applied,
417  // so we can still write start positions (but with hit statistics in case of mille):
418  this->doIO(0);
419  theLastWrittenIov = 0;
420 }

References cachedRuns_, AlignmentParameterStore::cacheTransformations(), doIO(), enableAlignableUpdates_, Exception, geometryDiff::file, submitPVResolutionJobs::files, spr::find(), getExistingFormattedFiles(), edm::ParameterSet::getParameter(), isMode(), lastProcessedRun_, myMilleBit, myPedeReadBit, myPedeRunBit, AlignmentParameterStore::restoreCachedTransformations(), run(), AlCaHLTBitMon_QueryRunRegistry::string, theAlignmentParameterStore, theBinary, theConfig, theDir, theLastWrittenIov, theMille, thePedeSteer, and uniqueRunRanges_.

Referenced by terminate().

◆ terminate() [2/2]

void MillePedeAlignmentAlgorithm::terminate ( const edm::EventSetup iSetup)
overridevirtual

Called at end of job.

Implements AlignmentAlgorithmBase.

Definition at line 364 of file MillePedeAlignmentAlgorithm.cc.

364 { terminate(); }

References terminate().

Member Data Documentation

◆ aliThrToken_

const edm::ESGetToken<AlignPCLThresholds, AlignPCLThresholdsRcd> MillePedeAlignmentAlgorithm::aliThrToken_
private

Definition at line 274 of file MillePedeAlignmentAlgorithm.h.

Referenced by initialize().

◆ cachedRuns_

std::vector<align::RunNumber> MillePedeAlignmentAlgorithm::cachedRuns_
private

Definition at line 316 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun(), and terminate().

◆ enableAlignableUpdates_

const bool MillePedeAlignmentAlgorithm::enableAlignableUpdates_
private

Definition at line 300 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun(), setParametersForRunRange(), and terminate().

◆ enforceSingleIOVInput_

const bool MillePedeAlignmentAlgorithm::enforceSingleIOVInput_
private

Definition at line 315 of file MillePedeAlignmentAlgorithm.h.

Referenced by initialize().

◆ firstIOV_

const align::RunNumber MillePedeAlignmentAlgorithm::firstIOV_
private

maximal correlation allowed for 2D hit in TID/TEC. If larger, the 2D measurement gets diagonalized!!!

Definition at line 298 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun().

◆ ignoreFirstIOVCheck_

const bool MillePedeAlignmentAlgorithm::ignoreFirstIOVCheck_
private

Definition at line 299 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun().

◆ ignoreHitsWithoutGlobalDerivatives_

const bool MillePedeAlignmentAlgorithm::ignoreHitsWithoutGlobalDerivatives_
private

Definition at line 311 of file MillePedeAlignmentAlgorithm.h.

Referenced by addMeasurementData().

◆ lastProcessedRun_

align::RunNumber MillePedeAlignmentAlgorithm::lastProcessedRun_
private

Definition at line 317 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun(), and terminate().

◆ runAtPCL_

const bool MillePedeAlignmentAlgorithm::runAtPCL_
private

◆ skipGlobalPositionRcdCheck_

const bool MillePedeAlignmentAlgorithm::skipGlobalPositionRcdCheck_
private

Definition at line 312 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun().

◆ theAlignableNavigator

std::unique_ptr<AlignableNavigator> MillePedeAlignmentAlgorithm::theAlignableNavigator
private

◆ theAlignables

align::Alignables MillePedeAlignmentAlgorithm::theAlignables
private

◆ theAlignmentParameterStore

AlignmentParameterStore* MillePedeAlignmentAlgorithm::theAlignmentParameterStore
private

directory for all kind of files

Definition at line 285 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun(), initialize(), setParametersForRunRange(), and terminate().

◆ theBinary

std::unique_ptr<gbl::MilleBinary> MillePedeAlignmentAlgorithm::theBinary
private

◆ theCalibrations

std::vector<IntegratedCalibrationBase *> MillePedeAlignmentAlgorithm::theCalibrations
private

◆ theConfig

edm::ParameterSet MillePedeAlignmentAlgorithm::theConfig
private

◆ theDir

std::string MillePedeAlignmentAlgorithm::theDir
private

◆ theDoSurveyPixelBarrel

bool MillePedeAlignmentAlgorithm::theDoSurveyPixelBarrel
private

Definition at line 305 of file MillePedeAlignmentAlgorithm.h.

Referenced by initialize().

◆ theFloatBufferX

std::vector<float> MillePedeAlignmentAlgorithm::theFloatBufferX
private

Definition at line 302 of file MillePedeAlignmentAlgorithm.h.

Referenced by addLasBeam(), and addMeasurementData().

◆ theFloatBufferY

std::vector<float> MillePedeAlignmentAlgorithm::theFloatBufferY
private

Definition at line 303 of file MillePedeAlignmentAlgorithm.h.

Referenced by addLasBeam(), and addMeasurementData().

◆ theGblDoubleBinary

bool MillePedeAlignmentAlgorithm::theGblDoubleBinary
private

Definition at line 308 of file MillePedeAlignmentAlgorithm.h.

Referenced by MillePedeAlignmentAlgorithm().

◆ theIntBuffer

std::vector<int> MillePedeAlignmentAlgorithm::theIntBuffer
private

Definition at line 304 of file MillePedeAlignmentAlgorithm.h.

Referenced by addGlobalData(), addLasBeam(), and addMeasurementData().

◆ theLastWrittenIov

int MillePedeAlignmentAlgorithm::theLastWrittenIov
private

Definition at line 301 of file MillePedeAlignmentAlgorithm.h.

Referenced by setParametersForRunRange(), and terminate().

◆ theMaximalCor2D

double MillePedeAlignmentAlgorithm::theMaximalCor2D
private

Definition at line 296 of file MillePedeAlignmentAlgorithm.h.

Referenced by callMille2D().

◆ theMille

std::unique_ptr<Mille> MillePedeAlignmentAlgorithm::theMille
private

◆ theMinNumHits

unsigned int MillePedeAlignmentAlgorithm::theMinNumHits
private

Definition at line 295 of file MillePedeAlignmentAlgorithm.h.

Referenced by addReferenceTrajectory().

◆ theMode

unsigned int MillePedeAlignmentAlgorithm::theMode
private

Definition at line 283 of file MillePedeAlignmentAlgorithm.h.

Referenced by isMode().

◆ theMonitor

std::unique_ptr<MillePedeMonitor> MillePedeAlignmentAlgorithm::theMonitor
private

◆ thePedeLabels

std::shared_ptr<PedeLabelerBase> MillePedeAlignmentAlgorithm::thePedeLabels
private

◆ thePedeSteer

std::unique_ptr<PedeSteerer> MillePedeAlignmentAlgorithm::thePedeSteer
private

◆ theThresholds

std::shared_ptr<AlignPCLThresholds> MillePedeAlignmentAlgorithm::theThresholds
private

Definition at line 294 of file MillePedeAlignmentAlgorithm.h.

Referenced by initialize(), storeAlignments(), and storeThresholds().

◆ theTrajectoryFactory

std::unique_ptr<TrajectoryFactoryBase> MillePedeAlignmentAlgorithm::theTrajectoryFactory
private

Definition at line 292 of file MillePedeAlignmentAlgorithm.h.

Referenced by initialize(), and run().

◆ topoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> MillePedeAlignmentAlgorithm::topoToken_
private

Definition at line 273 of file MillePedeAlignmentAlgorithm.h.

Referenced by initialize().

◆ uniqueRunRanges_

const align::RunRanges MillePedeAlignmentAlgorithm::uniqueRunRanges_
private

Definition at line 314 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun(), and terminate().

MillePedeAlignmentAlgorithm::topoToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Definition: MillePedeAlignmentAlgorithm.h:273
MillePedeAlignmentAlgorithm::theDir
std::string theDir
Definition: MillePedeAlignmentAlgorithm.h:284
MillePedeVariables::increaseHitsY
void increaseHitsY(unsigned int add=1)
increase hits for y-measurement
Definition: MillePedeVariables.h:84
dataset.firstRun
firstRun
Definition: dataset.py:940
pat::helper::ParametrizationHelper::dimension
uint32_t dimension(pat::CandKinResolution::Parametrization parametrization)
Returns the number of free parameters in a parametrization (3 or 4)
Definition: ParametrizationHelper.h:12
cond::time::MIN_VAL
const Time_t MIN_VAL(0)
SiStripLaserRecHit2D
Definition: SiStripLaserRecHit2D.h:12
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
MillePedeAlignmentAlgorithm::theLastWrittenIov
int theLastWrittenIov
Definition: MillePedeAlignmentAlgorithm.h:301
mps_fire.i
i
Definition: mps_fire.py:428
MillePedeAlignmentAlgorithm::thePedeSteer
std::unique_ptr< PedeSteerer > thePedeSteer
Definition: MillePedeAlignmentAlgorithm.h:291
cond::TimeTypeSpecs::beginValue
Time_t beginValue
Definition: Time.h:41
MillePedeAlignmentAlgorithm::theConfig
edm::ParameterSet theConfig
Definition: MillePedeAlignmentAlgorithm.h:282
MillePedeAlignmentAlgorithm::firstIOV_
const align::RunNumber firstIOV_
Definition: MillePedeAlignmentAlgorithm.h:298
MillePedeAlignmentAlgorithm::addRefTrackVirtualMeas1D
void addRefTrackVirtualMeas1D(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iVirtualMeas, Eigen::MatrixBase< CovarianceMatrix > &aHitCovarianceM, Eigen::MatrixBase< ResidualMatrix > &aHitResidualsM, Eigen::MatrixBase< LocalDerivativeMatrix > &aLocalDerivativesM)
adds data for a specific virtual measurement from reference trajectory
Definition: MillePedeAlignmentAlgorithm.cc:1285
MillePedeAlignmentAlgorithm::makeGlobDerivMatrix
void makeGlobDerivMatrix(const std::vector< float > &globalDerivativesx, const std::vector< float > &globalDerivativesy, Eigen::MatrixBase< GlobalDerivativeMatrix > &aGlobalDerivativesM)
Definition: MillePedeAlignmentAlgorithm.cc:1242
TkLasBeam::getBeamId
unsigned int getBeamId(void) const
return the full beam identifier
Definition: TkLasBeam.h:23
AlignmentParameterStore::alignables
const align::Alignables & alignables(void) const
get all alignables
Definition: AlignmentParameterStore.h:47
AlignmentParameterStore::resetParameters
void resetParameters(void)
reset parameters, correlations, user variables
Definition: AlignmentParameterStore.cc:271
muon
Definition: MuonCocktails.h:17
MillePedeAlignmentAlgorithm::globalDerivativesCalibration
void globalDerivativesCalibration(const TransientTrackingRecHit::ConstRecHitPointer &recHit, const TrajectoryStateOnSurface &tsos, const edm::EventSetup &setup, const EventInfo &eventInfo, std::vector< float > &globalDerivativesX, std::vector< float > &globalDerivativesY, std::vector< int > &globalLabels) const
adding derivatives from integrated calibrations
Definition: MillePedeAlignmentAlgorithm.cc:956
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
MillePedeAlignmentAlgorithm::theMonitor
std::unique_ptr< MillePedeMonitor > theMonitor
Definition: MillePedeAlignmentAlgorithm.h:288
TrackerTopology
Definition: TrackerTopology.h:16
MillePedeAlignmentAlgorithm::theFloatBufferX
std::vector< float > theFloatBufferX
Definition: MillePedeAlignmentAlgorithm.h:302
Alignable
Definition: Alignable.h:27
MillePedeAlignmentAlgorithm::kLocalY
Definition: MillePedeAlignmentAlgorithm.h:121
MillePedeAlignmentAlgorithm::theMaximalCor2D
double theMaximalCor2D
Definition: MillePedeAlignmentAlgorithm.h:296
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
PedeReader
Definition: PedeReader.h:33
AlignmentParameterStore::restoreCachedTransformations
void restoreCachedTransformations(void)
restore the previously cached position, rotation and other parameters
Definition: AlignmentParameterStore.cc:316
MillePedeAlignmentAlgorithm::theAlignables
align::Alignables theAlignables
Definition: MillePedeAlignmentAlgorithm.h:286
MillePedeAlignmentAlgorithm::theTrajectoryFactory
std::unique_ptr< TrajectoryFactoryBase > theTrajectoryFactory
Definition: MillePedeAlignmentAlgorithm.h:292
MillePedeAlignmentAlgorithm::uniqueRunRanges_
const align::RunRanges uniqueRunRanges_
Definition: MillePedeAlignmentAlgorithm.h:314
AlignmentParameters::userVariables
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
Definition: AlignmentParameters.cc:101
edm::VParameterSet
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:34
MillePedeAlignmentAlgorithm::theGblDoubleBinary
bool theGblDoubleBinary
Definition: MillePedeAlignmentAlgorithm.h:308
funct::derivative
Derivative< X, A >::type derivative(const A &_)
Definition: Derivative.h:18
edm::ValidityInterval::first
const IOVSyncValue & first() const
Definition: ValidityInterval.h:37
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
MillePedeAlignmentAlgorithm::cachedRuns_
std::vector< align::RunNumber > cachedRuns_
Definition: MillePedeAlignmentAlgorithm.h:316
TrackerAlignmentRcd
Definition: TrackerAlignmentRcd.h:6
FastTrackerRecHitMaskProducer_cfi.trajectories
trajectories
Definition: FastTrackerRecHitMaskProducer_cfi.py:7
AlignPCLThresholds
Definition: AlignPCLThresholds.h:11
AlignPCLThresholdsRcd
Definition: AlignPCLThresholdsRcd.h:23
edm::eventsetup::EventSetupRecordImplementation::key
EventSetupRecordKey key() const override
Definition: EventSetupRecordImplementation.h:45
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
MillePedeAlignmentAlgorithm::decodeMode
unsigned int decodeMode(const std::string &mode) const
Definition: MillePedeAlignmentAlgorithm.cc:1173
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
AlignableSurface::toLocal
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
Definition: AlignableSurface.cc:35
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
MillePedeAlignmentAlgorithm::theMille
std::unique_ptr< Mille > theMille
Definition: MillePedeAlignmentAlgorithm.h:289
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
AlignmentIORoot::writeAlignableOriginalPositions
void writeAlignableOriginalPositions(const align::Alignables &alivec, const char *filename, int iter, bool validCheck, int &ierr) override
write Alignable original (before misalignment) absolute positions
Definition: AlignmentIORoot.cc:201
SurveyPxbImageReader
Class to hold one picture of the BPix survey.
Definition: SurveyPxbImageReader.h:15
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
relativeConstraints.error
error
Definition: relativeConstraints.py:53
AlignableDetOrUnitPtr
Definition: AlignableDetOrUnitPtr.h:30
MillePedeAlignmentAlgorithm::terminate
void terminate() override
Called at end of job.
Definition: MillePedeAlignmentAlgorithm.cc:365
MillePedeAlignmentAlgorithm::getExistingFormattedFiles
std::vector< std::string > getExistingFormattedFiles(const std::vector< std::string > &plainFiles, const std::string &theDir)
Definition: MillePedeAlignmentAlgorithm.cc:422
edm::RunBase::run
RunNumber_t run() const
Definition: RunBase.h:40
MillePedeAlignmentAlgorithm::lastProcessedRun_
align::RunNumber lastProcessedRun_
Definition: MillePedeAlignmentAlgorithm.h:317
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
MillePedeAlignmentAlgorithm::theThresholds
std::shared_ptr< AlignPCLThresholds > theThresholds
Definition: MillePedeAlignmentAlgorithm.h:294
MillePedeAlignmentAlgorithm::theDoSurveyPixelBarrel
bool theDoSurveyPixelBarrel
Definition: MillePedeAlignmentAlgorithm.h:305
GlobalPositionRcd
Definition: GlobalPositionRcd.h:6
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
MillePedeAlignmentAlgorithm::myMilleBit
Definition: MillePedeAlignmentAlgorithm.h:276
AlignmentParameters
Definition: AlignmentParameters.h:35
convertSQLiteXML.runNumber
runNumber
Definition: convertSQLiteXML.py:91
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
MillePedeAlignmentAlgorithm::addGlobalData
int addGlobalData(const edm::EventSetup &setup, const EventInfo &eventInfo, const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iHit, gbl::GblPoint &gblPoint)
Definition: MillePedeAlignmentAlgorithm.cc:775
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
MillePedeAlignmentAlgorithm::addLaserData
void addLaserData(const EventInfo &eventInfo, const TkFittedLasBeamCollection &tkLasBeams, const TsosVectorCollection &tkLasBeamTsoses)
Definition: MillePedeAlignmentAlgorithm.cc:1507
MillePedeAlignmentAlgorithm::isMode
bool isMode(unsigned int testMode) const
Definition: MillePedeAlignmentAlgorithm.h:278
MillePedeAlignmentAlgorithm::myPedeSteerBit
Definition: MillePedeAlignmentAlgorithm.h:276
MillePedeAlignmentAlgorithm::theAlignableNavigator
std::unique_ptr< AlignableNavigator > theAlignableNavigator
Definition: MillePedeAlignmentAlgorithm.h:287
edm::FileInPath
Definition: FileInPath.h:61
MillePedeVariables::hitsY
unsigned int hitsY() const
get number of hits for y-measurement
Definition: MillePedeVariables.h:82
MillePedeAlignmentAlgorithm::callMille
int callMille(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, const std::vector< int > &globalLabels, const std::vector< float > &globalDerivativesX, const std::vector< float > &globalDerivativesY)
calls callMille1D or callMille2D
Definition: MillePedeAlignmentAlgorithm.cc:1332
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
MillePedeVariables::size
unsigned int size() const
number of parameters
Definition: MillePedeVariables.h:33
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
cond::timeTypeSpecs
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:16
TrackerSurfaceDeformationRcd
Definition: TrackerSurfaceDeformationRcd.h:6
ConstRecHitPointer
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
Definition: MillePedeAlignmentAlgorithm.cc:70
submitPVResolutionJobs.files
files
Definition: submitPVResolutionJobs.py:373
MillePedeAlignmentAlgorithm::myPedeRunBit
Definition: MillePedeAlignmentAlgorithm.h:276
SurveyPxbImageLocalFit::fidpoint_t
std::vector< coord_t > fidpoint_t
Definition: SurveyPxbImageLocalFit.h:17
Abs
T Abs(T a)
Definition: MathUtil.h:49
align::makeNonOverlappingRunRanges
RunRanges makeNonOverlappingRunRanges(const edm::VParameterSet &runRanges, const RunNumber &defaultRun)
Definition: Utilities.cc:202
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
MillePedeAlignmentAlgorithm::addHitStatistics
bool addHitStatistics(int fromLoop, const std::string &outFile, const std::vector< std::string > &inFiles) const
Definition: MillePedeAlignmentAlgorithm.cc:1195
AlignmentParameterStore::applyParameters
void applyParameters(void)
Obsolete: Use AlignableNavigator::alignableDetFromDetId and alignableFromAlignableDet.
Definition: AlignmentParameterStore.cc:255
DQM.reader
reader
Definition: DQM.py:105
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
MillePedeAlignmentAlgorithm::enableAlignableUpdates_
const bool enableAlignableUpdates_
Definition: MillePedeAlignmentAlgorithm.h:300
MillePedeAlignmentAlgorithm::globalDerivativesHierarchy
bool globalDerivativesHierarchy(const EventInfo &eventInfo, const TrajectoryStateOnSurface &tsos, Alignable *ali, const AlignableDetOrUnitPtr &alidet, std::vector< float > &globalDerivativesX, std::vector< float > &globalDerivativesY, std::vector< int > &globalLabels, AlignmentParameters *&lowestParams) const
recursively adding derivatives and labels, false if problems
Definition: MillePedeAlignmentAlgorithm.cc:839
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
MillePedeAlignmentAlgorithm::theCalibrations
std::vector< IntegratedCalibrationBase * > theCalibrations
Definition: MillePedeAlignmentAlgorithm.h:293
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
MillePedeAlignmentAlgorithm::theBinary
std::unique_ptr< gbl::MilleBinary > theBinary
Definition: MillePedeAlignmentAlgorithm.h:307
PedeLabelerBase::TopLevelAlignables
Definition: PedeLabelerBase.h:39
MillePedeAlignmentAlgorithm::diagonalize
void diagonalize(Eigen::MatrixBase< CovarianceMatrix > &aHitCovarianceM, Eigen::MatrixBase< LocalDerivativeMatrix > &aLocalDerivativesM, Eigen::MatrixBase< ResidualMatrix > &aHitResidualsM, Eigen::MatrixBase< GlobalDerivativeMatrix > &aGlobalDerivativesM) const
Definition: MillePedeAlignmentAlgorithm.cc:1258
edm::eventsetup::EventSetupRecordKey::name
const char * name() const
Definition: EventSetupRecordKey.h:46
MillePedeVariables::hitsX
unsigned int hitsX() const
get number of hits for x-measurement
Definition: MillePedeVariables.h:76
AlignableSurface::toGlobal
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
Definition: AlignableSurface.cc:15
MillePedeAlignmentAlgorithm::theIntBuffer
std::vector< int > theIntBuffer
Definition: MillePedeAlignmentAlgorithm.h:304
MillePedeAlignmentAlgorithm::theAlignmentParameterStore
AlignmentParameterStore * theAlignmentParameterStore
directory for all kind of files
Definition: MillePedeAlignmentAlgorithm.h:285
MillePedeAlignmentAlgorithm::aliThrToken_
const edm::ESGetToken< AlignPCLThresholds, AlignPCLThresholdsRcd > aliThrToken_
Definition: MillePedeAlignmentAlgorithm.h:274
Point3DBase< float, LocalTag >
MillePedeAlignmentAlgorithm::runAtPCL_
const bool runAtPCL_
Definition: MillePedeAlignmentAlgorithm.h:310
sistrip::SpyUtilities::isValid
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
Definition: SiStripSpyUtilities.cc:124
MillePedeAlignmentAlgorithm::addLasBeam
void addLasBeam(const EventInfo &eventInfo, const TkFittedLasBeam &lasBeam, const std::vector< TrajectoryStateOnSurface > &tsoses)
Definition: MillePedeAlignmentAlgorithm.cc:1524
SiStripDetId::TEC
static constexpr auto TEC
Definition: SiStripDetId.h:40
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
MillePedeAlignmentAlgorithm::thePedeLabels
std::shared_ptr< PedeLabelerBase > thePedeLabels
Definition: MillePedeAlignmentAlgorithm.h:290
L1TdeCSCTF_cfi.outFile
outFile
Definition: L1TdeCSCTF_cfi.py:5
RefTrajColl
TrajectoryFactoryBase::ReferenceTrajectoryCollection RefTrajColl
Definition: MillePedeAlignmentAlgorithm.cc:71
MillePedeAlignmentAlgorithm::run
void run(const edm::EventSetup &setup, const EventInfo &eventInfo) override
Run the algorithm on trajectories and tracks.
Definition: MillePedeAlignmentAlgorithm.cc:463
geometryDiff.file
file
Definition: geometryDiff.py:13
MillePedeAlignmentAlgorithm::theMinNumHits
unsigned int theMinNumHits
Definition: MillePedeAlignmentAlgorithm.h:295
MillePedeAlignmentAlgorithm::theMode
unsigned int theMode
Definition: MillePedeAlignmentAlgorithm.h:283
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
MillePedeAlignmentAlgorithm::addHits
bool addHits(const align::Alignables &alis, const std::vector< AlignmentUserVariables * > &mpVars) const
Definition: MillePedeAlignmentAlgorithm.cc:1220
MillePedeAlignmentAlgorithm::callMille2D
int callMille2D(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, const std::vector< int > &globalLabels, const std::vector< float > &globalDerivativesx, const std::vector< float > &globalDerivativesy)
Definition: MillePedeAlignmentAlgorithm.cc:1384
MillePedeVariables::setAllDefault
bool setAllDefault(unsigned int nParam)
set default values for all data concerning nParam (false if nParam out of range)
Definition: MillePedeVariables.cc:32
MillePedeAlignmentAlgorithm::enforceSingleIOVInput_
const bool enforceSingleIOVInput_
Definition: MillePedeAlignmentAlgorithm.h:315
edm::IOVSyncValue::eventID
const EventID & eventID() const
Definition: IOVSyncValue.h:40
MillePedeAlignmentAlgorithm::areEmptyParams
bool areEmptyParams(const align::Alignables &alignables) const
Definition: MillePedeAlignmentAlgorithm.cc:1068
edm::ParameterSet
Definition: ParameterSet.h:47
SurveyPxbImageLocalFit::count_t
unsigned int count_t
Definition: SurveyPxbImageLocalFit.h:18
a
double a
Definition: hdecay.h:119
DetId::Tracker
Definition: DetId.h:25
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
MillePedeVariables::increaseHitsX
void increaseHitsX(unsigned int add=1)
increase hits for x-measurement
Definition: MillePedeVariables.h:78
AlignmentAlgorithmBase::RunNumber
align::RunNumber RunNumber
Definition: AlignmentAlgorithmBase.h:69
MillePedeAlignmentAlgorithm::addPxbSurvey
void addPxbSurvey(const edm::ParameterSet &pxbSurveyCfg)
add measurement data from PXB survey
Definition: MillePedeAlignmentAlgorithm.cc:1573
heppy_loop.loop
loop
Definition: heppy_loop.py:28
cond::runnumber
Definition: Time.h:19
MillePedeFileReader
Definition: MillePedeFileReader.h:57
MillePedeAlignmentAlgorithm::addReferenceTrajectory
std::pair< unsigned int, unsigned int > addReferenceTrajectory(const edm::EventSetup &setup, const EventInfo &eventInfo, const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr)
fill mille for a trajectory, returning number of x/y hits ([0,0] if 'bad' trajectory)
Definition: MillePedeAlignmentAlgorithm.cc:499
TkFittedLasBeam::parameters
const std::vector< Scalar > & parameters() const
parallel to derivatives()
Definition: TkFittedLasBeam.h:29
AlignmentAlgorithmBase::EndRunInfo::tkLasBeams
const TkFittedLasBeamCollection * tkLasBeams() const
Definition: AlignmentAlgorithmBase.h:105
MillePedeAlignmentAlgorithm::addRefTrackData2D
void addRefTrackData2D(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, Eigen::MatrixBase< CovarianceMatrix > &aHitCovarianceM, Eigen::MatrixBase< ResidualMatrix > &aHitResidualsM, Eigen::MatrixBase< LocalDerivativeMatrix > &aLocalDerivativesM)
adds data from reference trajectory from a specific Hit
Definition: MillePedeAlignmentAlgorithm.cc:1306
cond::time::MAX_VAL
const Time_t MAX_VAL(std::numeric_limits< Time_t >::max())
cond::TimeTypeSpecs::endValue
Time_t endValue
Definition: Time.h:42
MillePedeAlignmentAlgorithm::addMeasurementData
int addMeasurementData(const edm::EventSetup &setup, const EventInfo &eventInfo, const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iHit, AlignmentParameters *&params)
Definition: MillePedeAlignmentAlgorithm.cc:726
AlignmentParameterStore::cacheTransformations
void cacheTransformations(void)
cache the current position, rotation and other parameters
Definition: AlignmentParameterStore.cc:303
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
MillePedeVariablesIORoot::readMillePedeVariables
std::vector< AlignmentUserVariables * > readMillePedeVariables(const align::Alignables &alivec, const char *filename, int iter, int &ierr)
Definition: MillePedeVariablesIORoot.cc:59
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MillePedeAlignmentAlgorithm::callMille1D
int callMille1D(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, const std::vector< int > &globalLabels, const std::vector< float > &globalDerivativesX)
calls Mille for 1D hits
Definition: MillePedeAlignmentAlgorithm.cc:1347
MillePedeVariablesIORoot
Definition: MillePedeVariablesIORoot.h:29
MillePedeAlignmentAlgorithm::theFloatBufferY
std::vector< float > theFloatBufferY
Definition: MillePedeAlignmentAlgorithm.h:303
MillePedeAlignmentAlgorithm::storeThresholds
virtual bool storeThresholds(const int &nRecords, const AlignPCLThresholds::threshold_map &thresholdMap)
Definition: MillePedeAlignmentAlgorithm.cc:301
looper.cfg
cfg
Definition: looper.py:296
AlignmentIORoot::writeOrigRigidBodyAlignmentParameters
void writeOrigRigidBodyAlignmentParameters(const align::Alignables &alivec, const char *filename, int iter, bool validCheck, int &ierr) override
write RigidBodyAlignmentParameters as applied on top of original positions
Definition: AlignmentIORoot.cc:65
SiStripDetId::TID
static constexpr auto TID
Definition: SiStripDetId.h:38
dumpTauVariables_cfi.eventInfo
eventInfo
add run, event number and lumi section
Definition: dumpTauVariables_cfi.py:12
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
MillePedeAlignmentAlgorithm::myPedeReadBit
Definition: MillePedeAlignmentAlgorithm.h:276
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
MillePedeAlignmentAlgorithm::skipGlobalPositionRcdCheck_
const bool skipGlobalPositionRcdCheck_
Definition: MillePedeAlignmentAlgorithm.h:312
MillePedeAlignmentAlgorithm::ignoreFirstIOVCheck_
const bool ignoreFirstIOVCheck_
Definition: MillePedeAlignmentAlgorithm.h:299
MillePedeAlignmentAlgorithm::ignoreHitsWithoutGlobalDerivatives_
const bool ignoreHitsWithoutGlobalDerivatives_
Definition: MillePedeAlignmentAlgorithm.h:311
SurveyPxbDicer
Definition: SurveyPxbDicer.h:21
MillePedeAlignmentAlgorithm::kLocalX
Definition: MillePedeAlignmentAlgorithm.h:121
MillePedeAlignmentAlgorithm::is2D
bool is2D(const TransientTrackingRecHit::ConstRecHitPointer &recHit) const
true if hit belongs to 2D detector (currently tracker specific)
Definition: MillePedeAlignmentAlgorithm.cc:1011
MillePedeAlignmentAlgorithm::addHitCount
unsigned int addHitCount(const std::vector< AlignmentParameters * > &parVec, const std::vector< bool > &validHitVecY) const
Definition: MillePedeAlignmentAlgorithm.cc:590
AlignableSurface
Definition: AlignableSurface.h:20
TkFittedLasBeam::firstFixedParameter
unsigned int firstFixedParameter() const
Definition: TkFittedLasBeam.h:36
MillePedeVariablesIORoot::writeMillePedeVariables
void writeMillePedeVariables(const align::Alignables &alivec, const char *filename, int iter, bool validCheck, int &ierr)
Definition: MillePedeVariablesIORoot.cc:35
AlignmentAlgorithmBase::AlignmentAlgorithmBase
AlignmentAlgorithmBase(const edm::ParameterSet &, const edm::ConsumesCollector &)
Constructor.
Definition: AlignmentAlgorithmBase.h:115
edm::Transition::BeginRun
relativeConstraints.value
value
Definition: relativeConstraints.py:53
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
Exception
Definition: hltDiff.cc:245
SurveyPxbImage::value_t
double value_t
Definition: SurveyPxbImage.h:16
MillePedeAlignmentAlgorithm::readFromPede
bool readFromPede(const edm::ParameterSet &mprespset, bool setUserVars, const RunRange &runrange)
read pede input defined by 'psetName', flag to create/not create MillePedeVariables
Definition: MillePedeAlignmentAlgorithm.cc:1029
align::makeUniqueRunRanges
RunRanges makeUniqueRunRanges(const edm::VParameterSet &runRanges, const RunNumber &defaultRun)
Definition: Utilities.cc:241
submitPVValidationJobs.runInfo
dictionary runInfo
Definition: submitPVValidationJobs.py:1013
TkLasBeam::getData
const std::vector< SiStripLaserRecHit2D > & getData(void) const
access the collection of hits
Definition: TkLasBeam.h:26
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
AlignmentAlgorithmBase::RunRange
align::RunRange RunRange
Definition: AlignmentAlgorithmBase.h:70
cond::persistency::throwException
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
AlignmentIORoot
Definition: AlignmentIORoot.h:15
mps_fire.result
result
Definition: mps_fire.py:311
timingPdfMaker.outfile
outfile
Definition: timingPdfMaker.py:350
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
MillePedeVariables
Definition: MillePedeVariables.h:21
MillePedeAlignmentAlgorithm::addVirtualMeas
void addVirtualMeas(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iVirtualMeas)
adds data for virtual measurements from reference trajectory
Definition: MillePedeAlignmentAlgorithm.cc:1479
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm_modernize_messagelogger.stat
stat
Definition: edm_modernize_messagelogger.py:27
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
MillePedeAlignmentAlgorithm::doIO
unsigned int doIO(int loop) const
Definition: MillePedeAlignmentAlgorithm.cc:1089
edm::eventsetup::EventSetupRecord::validityInterval
ValidityInterval validityInterval() const
Definition: EventSetupRecord.h:94
MillePedeAlignmentAlgorithm::buildUserVariables
void buildUserVariables(const align::Alignables &alignables) const
add MillePedeVariables for each AlignmentParameters (exception if no parameters......
Definition: MillePedeAlignmentAlgorithm.cc:1146
AlignmentAlgorithmBase::EventInfo::trajTrackPairs
const ConstTrajTrackPairCollection & trajTrackPairs() const
Definition: AlignmentAlgorithmBase.h:85
crabWrapper.key
key
Definition: crabWrapper.py:19
Alignable::alignmentParameters
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58
TrackerAlignmentErrorExtendedRcd
Definition: TrackerAlignmentErrorExtendedRcd.h:6
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
hit
Definition: SiStripHitEffFromCalibTree.cc:88
TkFittedLasBeam::derivatives
const AlgebraicMatrix & derivatives() const
matrix of local derivatives: columns are parameters, rows are hits
Definition: TkFittedLasBeam.h:33
SurveyPxbImageLocalFit::nMsrmts
static const count_t nMsrmts
Definition: SurveyPxbImageLocalFit.h:21
SurveyPxbImageLocalFit::localpars_t
std::vector< value_t > localpars_t
Definition: SurveyPxbImageLocalFit.h:16
Alignable::mother
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
MillePedeAlignmentAlgorithm::areIOVsSpecified
bool areIOVsSpecified() const
Definition: MillePedeAlignmentAlgorithm.cc:1664