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)
 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 &)
 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

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 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 53 of file MillePedeAlignmentAlgorithm.h.

Member Enumeration Documentation

◆ EModeBit

Enumerator
myMilleBit 
myPedeRunBit 
myPedeSteerBit 
myPedeReadBit 

Definition at line 266 of file MillePedeAlignmentAlgorithm.h.

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

◆ MeasurementDirection

Enumerator
kLocalX 
kLocalY 

Definition at line 115 of file MillePedeAlignmentAlgorithm.h.

115 { kLocalX = 0, kLocalY };

Constructor & Destructor Documentation

◆ MillePedeAlignmentAlgorithm()

MillePedeAlignmentAlgorithm::MillePedeAlignmentAlgorithm ( const edm::ParameterSet cfg)

Constructor.

Definition at line 92 of file MillePedeAlignmentAlgorithm.cc.

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

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 129 of file MillePedeAlignmentAlgorithm.cc.

129 {}

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 301 of file MillePedeAlignmentAlgorithm.cc.

301  {
302  theCalibrations.insert(theCalibrations.end(), iCals.begin(), iCals.end());
303  thePedeLabels->addCalibrations(iCals);
304  return true;
305 }

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 776 of file MillePedeAlignmentAlgorithm.cc.

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

References ZMuMuAnalysisNtupler_cff::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 591 of file MillePedeAlignmentAlgorithm.cc.

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

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 1221 of file MillePedeAlignmentAlgorithm.cc.

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

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 1196 of file MillePedeAlignmentAlgorithm.cc.

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

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 1525 of file MillePedeAlignmentAlgorithm.cc.

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

References funct::derivative(), TkFittedLasBeam::derivatives(), relativeConstraints::error, TkFittedLasBeam::firstFixedParameter(), TkLasBeam::getBeamId(), TkLasBeam::getData(), globalDerivativesHierarchy(), 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 1508 of file MillePedeAlignmentAlgorithm.cc.

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

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 727 of file MillePedeAlignmentAlgorithm.cc.

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

References callMille(), ZMuMuAnalysisNtupler_cff::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 1574 of file MillePedeAlignmentAlgorithm.cc.

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

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 500 of file MillePedeAlignmentAlgorithm.cc.

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

References addGlobalData(), addHitCount(), addMeasurementData(), addVirtualMeas(), ZMuMuAnalysisNtupler_cff::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 1307 of file MillePedeAlignmentAlgorithm.cc.

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

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 1286 of file MillePedeAlignmentAlgorithm.cc.

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

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 1480 of file MillePedeAlignmentAlgorithm.cc.

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

References addRefTrackVirtualMeas1D(), and theMille.

Referenced by addReferenceTrajectory().

◆ areEmptyParams()

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

Definition at line 1069 of file MillePedeAlignmentAlgorithm.cc.

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

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

Referenced by readFromPede().

◆ areIOVsSpecified()

bool MillePedeAlignmentAlgorithm::areIOVsSpecified ( ) const
private

Definition at line 1665 of file MillePedeAlignmentAlgorithm.cc.

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

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 711 of file MillePedeAlignmentAlgorithm.cc.

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

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 620 of file MillePedeAlignmentAlgorithm.cc.

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

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 1147 of file MillePedeAlignmentAlgorithm.cc.

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

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 1333 of file MillePedeAlignmentAlgorithm.cc.

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

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 1348 of file MillePedeAlignmentAlgorithm.cc.

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

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 1385 of file MillePedeAlignmentAlgorithm.cc.

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

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 1174 of file MillePedeAlignmentAlgorithm.cc.

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

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 1259 of file MillePedeAlignmentAlgorithm.cc.

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

References relativeConstraints::value.

Referenced by callMille2D().

◆ doIO()

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

Definition at line 1090 of file MillePedeAlignmentAlgorithm.cc.

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

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 719 of file MillePedeAlignmentAlgorithm.cc.

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

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 705 of file MillePedeAlignmentAlgorithm.cc.

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

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 693 of file MillePedeAlignmentAlgorithm.cc.

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

References addLaserData(), isMode(), myMilleBit, theMille, AlignmentAlgorithmBase::EndRunInfo::tkLasBeams(), and AlignmentAlgorithmBase::EndRunInfo::tkLasBeamTsoses().

◆ 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 423 of file MillePedeAlignmentAlgorithm.cc.

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

References edmScanValgrind::buffer, MainPageGenerator::files, hgcalPlots::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 957 of file MillePedeAlignmentAlgorithm.cc.

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

References ZMuMuAnalysisNtupler_cff::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 895 of file MillePedeAlignmentAlgorithm.cc.

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

References Alignable::alignmentParameters(), ZMuMuAnalysisNtupler_cff::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 840 of file MillePedeAlignmentAlgorithm.cc.

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

References Alignable::alignmentParameters(), ZMuMuAnalysisNtupler_cff::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 133 of file MillePedeAlignmentAlgorithm.cc.

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

References addPxbSurvey(), edm::ParameterSet::addUntrackedParameter(), AlignmentParameterStore::alignables(), 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, edm::ESHandle< T >::product(), 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, 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 1012 of file MillePedeAlignmentAlgorithm.cc.

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

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 1243 of file MillePedeAlignmentAlgorithm.cc.

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

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 315 of file MillePedeAlignmentAlgorithm.cc.

315  {
316  if (isMode(myMilleBit)) {
317  return true;
318  } else {
319  return false;
320  }
321 }

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 1030 of file MillePedeAlignmentAlgorithm.cc.

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

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 464 of file MillePedeAlignmentAlgorithm.cc.

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

References addReferenceTrajectory(), ZMuMuAnalysisNtupler_cff::eventInfo, isMode(), myMilleBit, hltrates_dqm_sourceclient-live_cfg::offset, edm::second(), singleTopDQM_cfi::setup, theMonitor, theTrajectoryFactory, PDWG_EXOHSCP_cff::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 340 of file MillePedeAlignmentAlgorithm.cc.

340  {
341  if (this->isMode(myPedeReadBit)) {
342  // restore initial positions, rotations and deformations
345  } else {
347  }
348 
349  // Needed to shut up later warning from checkAliParams:
351  // To avoid that they keep values from previous IOV if no new one in pede result
353 
354  if (!this->readFromPede(theConfig.getParameter<edm::ParameterSet>("pedeReader"), true, runrange)) {
355  edm::LogError("Alignment") << "@SUB=MillePedeAlignmentAlgorithm::setParametersForRunRange"
356  << "Problems reading pede result, but applying!";
357  }
359 
360  this->doIO(++theLastWrittenIov); // pre-increment!
361  }
362 
363  return true;
364 }

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 324 of file MillePedeAlignmentAlgorithm.cc.

324  {
325  if (isMode(myPedeReadBit)) {
326  if (runAtPCL_) {
327  MillePedeFileReader mpReader(
329  mpReader.read();
330  return mpReader.storeAlignments();
331  } else {
332  return true;
333  }
334  } else {
335  return false;
336  }
337 }

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 308 of file MillePedeAlignmentAlgorithm.cc.

309  {
310  theThresholds->setAlignPCLThresholds(nRecords, thresholdMap);
311  return true;
312 }

References theThresholds.

Referenced by initialize().

◆ supportsCalibrations()

bool MillePedeAlignmentAlgorithm::supportsCalibrations ( )
overridevirtual

Returns whether MP supports calibrations.

Reimplemented from AlignmentAlgorithmBase.

Definition at line 298 of file MillePedeAlignmentAlgorithm.cc.

298 { return true; }

◆ terminate() [1/2]

void MillePedeAlignmentAlgorithm::terminate ( void  )
overridevirtual

Called at end of job.

Reimplemented from AlignmentAlgorithmBase.

Definition at line 369 of file MillePedeAlignmentAlgorithm.cc.

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

References cachedRuns_, AlignmentParameterStore::cacheTransformations(), doIO(), enableAlignableUpdates_, Exception, FrontierConditions_GlobalTag_cff::file, MainPageGenerator::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 368 of file MillePedeAlignmentAlgorithm.cc.

368 { terminate(); }

References terminate().

Member Data Documentation

◆ cachedRuns_

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

Definition at line 306 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun(), and terminate().

◆ enableAlignableUpdates_

const bool MillePedeAlignmentAlgorithm::enableAlignableUpdates_
private

Definition at line 290 of file MillePedeAlignmentAlgorithm.h.

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

◆ enforceSingleIOVInput_

const bool MillePedeAlignmentAlgorithm::enforceSingleIOVInput_
private

Definition at line 305 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 288 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun().

◆ ignoreFirstIOVCheck_

const bool MillePedeAlignmentAlgorithm::ignoreFirstIOVCheck_
private

Definition at line 289 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun().

◆ ignoreHitsWithoutGlobalDerivatives_

const bool MillePedeAlignmentAlgorithm::ignoreHitsWithoutGlobalDerivatives_
private

Definition at line 301 of file MillePedeAlignmentAlgorithm.h.

Referenced by addMeasurementData().

◆ lastProcessedRun_

align::RunNumber MillePedeAlignmentAlgorithm::lastProcessedRun_
private

Definition at line 307 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun(), and terminate().

◆ runAtPCL_

const bool MillePedeAlignmentAlgorithm::runAtPCL_
private

◆ skipGlobalPositionRcdCheck_

const bool MillePedeAlignmentAlgorithm::skipGlobalPositionRcdCheck_
private

Definition at line 302 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 275 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 295 of file MillePedeAlignmentAlgorithm.h.

Referenced by initialize().

◆ theFloatBufferX

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

Definition at line 292 of file MillePedeAlignmentAlgorithm.h.

Referenced by addLasBeam(), and addMeasurementData().

◆ theFloatBufferY

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

Definition at line 293 of file MillePedeAlignmentAlgorithm.h.

Referenced by addLasBeam(), and addMeasurementData().

◆ theGblDoubleBinary

bool MillePedeAlignmentAlgorithm::theGblDoubleBinary
private

Definition at line 298 of file MillePedeAlignmentAlgorithm.h.

Referenced by MillePedeAlignmentAlgorithm().

◆ theIntBuffer

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

Definition at line 294 of file MillePedeAlignmentAlgorithm.h.

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

◆ theLastWrittenIov

int MillePedeAlignmentAlgorithm::theLastWrittenIov
private

Definition at line 291 of file MillePedeAlignmentAlgorithm.h.

Referenced by setParametersForRunRange(), and terminate().

◆ theMaximalCor2D

double MillePedeAlignmentAlgorithm::theMaximalCor2D
private

Definition at line 286 of file MillePedeAlignmentAlgorithm.h.

Referenced by callMille2D().

◆ theMille

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

◆ theMinNumHits

unsigned int MillePedeAlignmentAlgorithm::theMinNumHits
private

Definition at line 285 of file MillePedeAlignmentAlgorithm.h.

Referenced by addReferenceTrajectory().

◆ theMode

unsigned int MillePedeAlignmentAlgorithm::theMode
private

Definition at line 273 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 284 of file MillePedeAlignmentAlgorithm.h.

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

◆ theTrajectoryFactory

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

Definition at line 282 of file MillePedeAlignmentAlgorithm.h.

Referenced by initialize(), and run().

◆ uniqueRunRanges_

const align::RunRanges MillePedeAlignmentAlgorithm::uniqueRunRanges_
private

Definition at line 304 of file MillePedeAlignmentAlgorithm.h.

Referenced by beginRun(), and terminate().

MillePedeAlignmentAlgorithm::theDir
std::string theDir
Definition: MillePedeAlignmentAlgorithm.h:274
MillePedeVariables::increaseHitsY
void increaseHitsY(unsigned int add=1)
increase hits for y-measurement
Definition: MillePedeVariables.h:84
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
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:291
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
MillePedeAlignmentAlgorithm::thePedeSteer
std::unique_ptr< PedeSteerer > thePedeSteer
Definition: MillePedeAlignmentAlgorithm.h:281
cond::TimeTypeSpecs::beginValue
Time_t beginValue
Definition: Time.h:41
MillePedeAlignmentAlgorithm::theConfig
edm::ParameterSet theConfig
Definition: MillePedeAlignmentAlgorithm.h:272
MillePedeAlignmentAlgorithm::firstIOV_
const align::RunNumber firstIOV_
Definition: MillePedeAlignmentAlgorithm.h:288
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:1286
MillePedeAlignmentAlgorithm::makeGlobDerivMatrix
void makeGlobDerivMatrix(const std::vector< float > &globalDerivativesx, const std::vector< float > &globalDerivativesy, Eigen::MatrixBase< GlobalDerivativeMatrix > &aGlobalDerivativesM)
Definition: MillePedeAlignmentAlgorithm.cc:1243
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:957
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
MillePedeAlignmentAlgorithm::theMonitor
std::unique_ptr< MillePedeMonitor > theMonitor
Definition: MillePedeAlignmentAlgorithm.h:278
TrackerTopology
Definition: TrackerTopology.h:16
MillePedeAlignmentAlgorithm::theFloatBufferX
std::vector< float > theFloatBufferX
Definition: MillePedeAlignmentAlgorithm.h:292
Alignable
Definition: Alignable.h:27
MillePedeAlignmentAlgorithm::kLocalY
Definition: MillePedeAlignmentAlgorithm.h:115
MillePedeAlignmentAlgorithm::theMaximalCor2D
double theMaximalCor2D
Definition: MillePedeAlignmentAlgorithm.h:286
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
edm::LogInfo
Definition: MessageLogger.h:254
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:276
MillePedeAlignmentAlgorithm::theTrajectoryFactory
std::unique_ptr< TrajectoryFactoryBase > theTrajectoryFactory
Definition: MillePedeAlignmentAlgorithm.h:282
MillePedeAlignmentAlgorithm::uniqueRunRanges_
const align::RunRanges uniqueRunRanges_
Definition: MillePedeAlignmentAlgorithm.h:304
AlignmentParameters::userVariables
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
Definition: AlignmentParameters.cc:101
edm::VParameterSet
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
MillePedeAlignmentAlgorithm::theGblDoubleBinary
bool theGblDoubleBinary
Definition: MillePedeAlignmentAlgorithm.h:298
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:215
MillePedeAlignmentAlgorithm::cachedRuns_
std::vector< align::RunNumber > cachedRuns_
Definition: MillePedeAlignmentAlgorithm.h:306
TrackerAlignmentRcd
Definition: TrackerAlignmentRcd.h:6
FastTrackerRecHitMaskProducer_cfi.trajectories
trajectories
Definition: FastTrackerRecHitMaskProducer_cfi.py:7
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:1174
AlignmentAlgorithmBase::AlignmentAlgorithmBase
AlignmentAlgorithmBase(const edm::ParameterSet &)
Constructor.
Definition: AlignmentAlgorithmBase.h:114
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:279
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
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:369
MillePedeAlignmentAlgorithm::getExistingFormattedFiles
std::vector< std::string > getExistingFormattedFiles(const std::vector< std::string > &plainFiles, const std::string &theDir)
Definition: MillePedeAlignmentAlgorithm.cc:423
edm::RunBase::run
RunNumber_t run() const
Definition: RunBase.h:40
MillePedeAlignmentAlgorithm::lastProcessedRun_
align::RunNumber lastProcessedRun_
Definition: MillePedeAlignmentAlgorithm.h:307
MillePedeAlignmentAlgorithm::theThresholds
std::shared_ptr< AlignPCLThresholds > theThresholds
Definition: MillePedeAlignmentAlgorithm.h:284
MillePedeAlignmentAlgorithm::theDoSurveyPixelBarrel
bool theDoSurveyPixelBarrel
Definition: MillePedeAlignmentAlgorithm.h:295
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:266
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:776
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
MillePedeAlignmentAlgorithm::addLaserData
void addLaserData(const EventInfo &eventInfo, const TkFittedLasBeamCollection &tkLasBeams, const TsosVectorCollection &tkLasBeamTsoses)
Definition: MillePedeAlignmentAlgorithm.cc:1508
MillePedeAlignmentAlgorithm::isMode
bool isMode(unsigned int testMode) const
Definition: MillePedeAlignmentAlgorithm.h:268
MillePedeAlignmentAlgorithm::myPedeSteerBit
Definition: MillePedeAlignmentAlgorithm.h:266
MillePedeAlignmentAlgorithm::theAlignableNavigator
std::unique_ptr< AlignableNavigator > theAlignableNavigator
Definition: MillePedeAlignmentAlgorithm.h:277
edm::FileInPath
Definition: FileInPath.h:64
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:1333
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:75
MainPageGenerator.files
files
Definition: MainPageGenerator.py:256
MillePedeAlignmentAlgorithm::myPedeRunBit
Definition: MillePedeAlignmentAlgorithm.h:266
hgcalPlots.stat
stat
Definition: hgcalPlots.py:1111
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:1196
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:290
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:840
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
edm::ESHandle< TrackerTopology >
MillePedeAlignmentAlgorithm::theCalibrations
std::vector< IntegratedCalibrationBase * > theCalibrations
Definition: MillePedeAlignmentAlgorithm.h:283
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
MillePedeAlignmentAlgorithm::theBinary
std::unique_ptr< gbl::MilleBinary > theBinary
Definition: MillePedeAlignmentAlgorithm.h:297
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:1259
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:294
MillePedeAlignmentAlgorithm::theAlignmentParameterStore
AlignmentParameterStore * theAlignmentParameterStore
directory for all kind of files
Definition: MillePedeAlignmentAlgorithm.h:275
Point3DBase< float, LocalTag >
MillePedeAlignmentAlgorithm::runAtPCL_
const bool runAtPCL_
Definition: MillePedeAlignmentAlgorithm.h:300
MillePedeAlignmentAlgorithm::addLasBeam
void addLasBeam(const EventInfo &eventInfo, const TkFittedLasBeam &lasBeam, const std::vector< TrajectoryStateOnSurface > &tsoses)
Definition: MillePedeAlignmentAlgorithm.cc:1525
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:280
L1TdeCSCTF_cfi.outFile
outFile
Definition: L1TdeCSCTF_cfi.py:5
RefTrajColl
TrajectoryFactoryBase::ReferenceTrajectoryCollection RefTrajColl
Definition: MillePedeAlignmentAlgorithm.cc:76
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MillePedeAlignmentAlgorithm::run
void run(const edm::EventSetup &setup, const EventInfo &eventInfo) override
Run the algorithm on trajectories and tracks.
Definition: MillePedeAlignmentAlgorithm.cc:464
edm::LogWarning
Definition: MessageLogger.h:141
MillePedeAlignmentAlgorithm::theMinNumHits
unsigned int theMinNumHits
Definition: MillePedeAlignmentAlgorithm.h:285
MillePedeAlignmentAlgorithm::theMode
unsigned int theMode
Definition: MillePedeAlignmentAlgorithm.h:273
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
ZMuMuAnalysisNtupler_cff.eventInfo
eventInfo
Definition: ZMuMuAnalysisNtupler_cff.py:15
MillePedeAlignmentAlgorithm::addHits
bool addHits(const align::Alignables &alis, const std::vector< AlignmentUserVariables * > &mpVars) const
Definition: MillePedeAlignmentAlgorithm.cc:1221
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:1385
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:305
edm::IOVSyncValue::eventID
const EventID & eventID() const
Definition: IOVSyncValue.h:40
MillePedeAlignmentAlgorithm::areEmptyParams
bool areEmptyParams(const align::Alignables &alignables) const
Definition: MillePedeAlignmentAlgorithm.cc:1069
edm::ParameterSet
Definition: ParameterSet.h:36
SurveyPxbImageLocalFit::count_t
unsigned int count_t
Definition: SurveyPxbImageLocalFit.h:18
edm::LogError
Definition: MessageLogger.h:183
a
double a
Definition: hdecay.h:119
DetId::Tracker
Definition: DetId.h:25
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:68
MillePedeAlignmentAlgorithm::addPxbSurvey
void addPxbSurvey(const edm::ParameterSet &pxbSurveyCfg)
add measurement data from PXB survey
Definition: MillePedeAlignmentAlgorithm.cc:1574
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:500
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:104
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:1307
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
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:727
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
get
#define get
MillePedeVariablesIORoot::readMillePedeVariables
std::vector< AlignmentUserVariables * > readMillePedeVariables(const align::Alignables &alivec, const char *filename, int iter, int &ierr)
Definition: MillePedeVariablesIORoot.cc:59
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:1348
MillePedeVariablesIORoot
Definition: MillePedeVariablesIORoot.h:29
MillePedeAlignmentAlgorithm::theFloatBufferY
std::vector< float > theFloatBufferY
Definition: MillePedeAlignmentAlgorithm.h:293
MillePedeAlignmentAlgorithm::storeThresholds
virtual bool storeThresholds(const int &nRecords, const AlignPCLThresholds::threshold_map &thresholdMap)
Definition: MillePedeAlignmentAlgorithm.cc:308
looper.cfg
cfg
Definition: looper.py:297
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
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
MillePedeAlignmentAlgorithm::myPedeReadBit
Definition: MillePedeAlignmentAlgorithm.h:266
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
MillePedeAlignmentAlgorithm::skipGlobalPositionRcdCheck_
const bool skipGlobalPositionRcdCheck_
Definition: MillePedeAlignmentAlgorithm.h:302
MillePedeAlignmentAlgorithm::ignoreFirstIOVCheck_
const bool ignoreFirstIOVCheck_
Definition: MillePedeAlignmentAlgorithm.h:289
MillePedeAlignmentAlgorithm::ignoreHitsWithoutGlobalDerivatives_
const bool ignoreHitsWithoutGlobalDerivatives_
Definition: MillePedeAlignmentAlgorithm.h:301
SurveyPxbDicer
Definition: SurveyPxbDicer.h:21
MillePedeAlignmentAlgorithm::kLocalX
Definition: MillePedeAlignmentAlgorithm.h:115
MillePedeAlignmentAlgorithm::is2D
bool is2D(const TransientTrackingRecHit::ConstRecHitPointer &recHit) const
true if hit belongs to 2D detector (currently tracker specific)
Definition: MillePedeAlignmentAlgorithm.cc:1012
MillePedeAlignmentAlgorithm::addHitCount
unsigned int addHitCount(const std::vector< AlignmentParameters * > &parVec, const std::vector< bool > &validHitVecY) const
Definition: MillePedeAlignmentAlgorithm.cc:591
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
relativeConstraints.value
value
Definition: relativeConstraints.py:53
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
Exception
Definition: hltDiff.cc:246
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:1030
align::makeUniqueRunRanges
RunRanges makeUniqueRunRanges(const edm::VParameterSet &runRanges, const RunNumber &defaultRun)
Definition: Utilities.cc:241
TkLasBeam::getData
const std::vector< SiStripLaserRecHit2D > & getData(void) const
access the collection of hits
Definition: TkLasBeam.h:26
AlignmentAlgorithmBase::RunRange
align::RunRange RunRange
Definition: AlignmentAlgorithmBase.h:69
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:303
timingPdfMaker.outfile
outfile
Definition: timingPdfMaker.py:351
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:1480
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:78
MillePedeAlignmentAlgorithm::doIO
unsigned int doIO(int loop) const
Definition: MillePedeAlignmentAlgorithm.cc:1090
edm::eventsetup::EventSetupRecord::validityInterval
ValidityInterval validityInterval() const
Definition: EventSetupRecord.h:93
MillePedeAlignmentAlgorithm::buildUserVariables
void buildUserVariables(const align::Alignables &alignables) const
add MillePedeVariables for each AlignmentParameters (exception if no parameters......
Definition: MillePedeAlignmentAlgorithm.cc:1147
AlignmentAlgorithmBase::EventInfo::trajTrackPairs
const ConstTrajTrackPairCollection & trajTrackPairs() const
Definition: AlignmentAlgorithmBase.h:84
crabWrapper.key
key
Definition: crabWrapper.py:19
Alignable::alignmentParameters
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58
TrackerAlignmentErrorExtendedRcd
Definition: TrackerAlignmentErrorExtendedRcd.h:6
AlignmentAlgorithmBase::EndRunInfo::tkLasBeamTsoses
const TsosVectorCollection * tkLasBeamTsoses() const
might be null!
Definition: AlignmentAlgorithmBase.h:105
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
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:1665