CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MillePedeAlignmentAlgorithm.h
Go to the documentation of this file.
1 #ifndef Alignment_MillePedeAlignmentAlgorithm_MillePedeAlignmentAlgorithm_h
2 #define Alignment_MillePedeAlignmentAlgorithm_MillePedeAlignmentAlgorithm_h
3 
13 
15 
17 
20 
22 
23 #include <vector>
24 #include <string>
25 
26 #include <TMatrixDSym.h>
27 #include <TMatrixD.h>
28 #include <TMatrixF.h>
29 
30 class Alignable;
31 class AlignableTracker;
32 class AlignableMuon;
33 class AlignableExtras;
34 
36 class AlignableNavigator;
39 
41 
43 
44 class MillePedeMonitor;
45 class PedeSteerer;
46 class PedeLabelerBase;
47 class Mille;
49 
50 // already from base class - and forward declaration does not work since typedef!
51 /* class TkFittedLasBeamCollection; */
52 /* class TsosVectorCollection; */
53 
55 {
56  public:
59 
62 
64  virtual void initialize(const edm::EventSetup &setup,
67 
69  virtual bool addCalibrations(const std::vector<IntegratedCalibrationBase*> &iCals);
70 
72  virtual void terminate(const edm::EventSetup& iSetup);
73 
75  virtual void run(const edm::EventSetup &setup, const EventInfo &eventInfo);
76 
78  virtual void endRun(const EventInfo &eventInfo, const EndRunInfo &runInfo,
79  const edm::EventSetup &setup);
80 
81 /* virtual void beginLuminosityBlock(const edm::EventSetup &setup) {} */
82 /* virtual void endLuminosityBlock(const edm::EventSetup &setup) {} */
83 
86  virtual bool setParametersForRunRange(const RunRange &runrange);
87 
88  private:
90 
92  std::pair<unsigned int, unsigned int>
93  addReferenceTrajectory(const edm::EventSetup &setup, const EventInfo &eventInfo,
95 
99  int addMeasurementData(const edm::EventSetup &setup, const EventInfo &eventInfo,
101  unsigned int iHit, AlignmentParameters *&params);
102 
105  int addGlobalData(const edm::EventSetup &setup, const EventInfo &eventInfo,
107  unsigned int iHit, GblPoint &gblPoint);
108 
113  unsigned int addHitCount(const std::vector<AlignmentParameters*> &parVec,
114  const std::vector<bool> &validHitVecY) const;
115 
118  unsigned int iTrajHit, TMatrixDSym &aHitCovarianceM,
119  TMatrixF &aHitResidualsM, TMatrixF &aLocalDerivativesM);
120 
123  unsigned int iVirtualMeas);
124 
127  unsigned int iVirtualMeas,TMatrixDSym &aHitCovarianceM,
128  TMatrixF &aHitResidualsM, TMatrixF &aLocalDerivativesM);
129 
131  bool globalDerivativesHierarchy(const EventInfo &eventInfo,
132  const TrajectoryStateOnSurface &tsos,
133  Alignable *ali, const AlignableDetOrUnitPtr &alidet,
134  std::vector<float> &globalDerivativesX,
135  std::vector<float> &globalDerivativesY,
136  std::vector<int> &globalLabels,
137  AlignmentParameters *&lowestParams) const;
138 
140  bool globalDerivativesHierarchy(const EventInfo &eventInfo,
141  const TrajectoryStateOnSurface &tsos,
142  Alignable *ali, const AlignableDetOrUnitPtr &alidet,
143  std::vector<double> &globalDerivativesX,
144  std::vector<double> &globalDerivativesY,
145  std::vector<int> &globalLabels,
146  AlignmentParameters *&lowestParams) const;
147 
150  const TrajectoryStateOnSurface &tsos,
151  const edm::EventSetup &setup, const EventInfo &eventInfo,
152  std::vector<float> &globalDerivativesX,
153  std::vector<float> &globalDerivativesY,
154  std::vector<int> &globalLabels) const;
155 
158  unsigned int iTrajHit, const std::vector<int> &globalLabels,
159  const std::vector<float> &globalDerivativesX,
160  const std::vector<float> &globalDerivativesY);
161 
164  unsigned int iTrajHit, const std::vector<int> &globalLabels,
165  const std::vector<float> &globalDerivativesX);
166 
171  unsigned int iTrajHit, const std::vector<int> &globalLabels,
172  const std::vector<float> &globalDerivativesx,
173  const std::vector<float> &globalDerivativesy);
174  void diagonalize(TMatrixDSym &aHitCovarianceM, TMatrixF &aLocalDerivativesM,
175  TMatrixF &aHitResidualsM,TMatrixF &theGlobalDerivativesM) const;
176  // deals with the non matrix format of theFloatBufferX ...
177  void makeGlobDerivMatrix(const std::vector<float> &globalDerivativesx,
178  const std::vector<float> &globalDerivativesy,
179  TMatrixF &aGlobalDerivativesM);
180 
181 // void callMille(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr,
182 // unsigned int iTrajHit, MeasurementDirection xOrY,
183 // const std::vector<float> &globalDerivatives, const std::vector<int> &globalLabels);
185  bool is2D(const TransientTrackingRecHit::ConstRecHitPointer &recHit) const;
186 
188  bool readFromPede(const edm::ParameterSet &mprespset, bool setUserVars,
189  const RunRange &runrange);
190  bool areEmptyParams(const std::vector<Alignable*> &alignables) const;
191  unsigned int doIO(int loop) const;
193  void buildUserVariables(const std::vector<Alignable*> &alignables) const;
194 
195  void addLaserData(const EventInfo &eventInfo,
196  const TkFittedLasBeamCollection &tkLasBeams,
197  const TsosVectorCollection &tkLasBeamTsoses);
198  void addLasBeam(const EventInfo &eventInfo,
199  const TkFittedLasBeam &lasBeam,
200  const std::vector<TrajectoryStateOnSurface> &tsoses);
201 
203  void addPxbSurvey(const edm::ParameterSet &pxbSurveyCfg);
204 
205  //--------------------------------------------------------
206  // Data members
207  //--------------------------------------------------------
208  enum EModeBit {myMilleBit = 1 << 0, myPedeRunBit = 1 << 1, myPedeSteerBit = 1 << 2,
209  myPedeReadBit = 1 << 3};
210  unsigned int decodeMode(const std::string &mode) const;
211  bool isMode(unsigned int testMode) const {return (theMode & testMode);}
212  bool addHitStatistics(int fromLoop, const std::string &outFile,
213  const std::vector<std::string> &inFiles) const;
214  bool addHits(const std::vector<Alignable*> &alis,
215  const std::vector<AlignmentUserVariables*> &mpVars) const;
216 
218  unsigned int theMode;
221  std::vector<Alignable*> theAlignables;
228  std::vector<IntegratedCalibrationBase*> theCalibrations;
229  unsigned int theMinNumHits;
231  int theLastWrittenIov; // keeping track for output trees...
233  std::vector<float> theFloatBufferX;
234  std::vector<float> theFloatBufferY;
235  std::vector<int> theIntBuffer;
237  // CHK for GBL
240 };
241 
242 #endif
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
tuple cfg
Definition: looper.py:259
std::vector< Alignable * > theAlignables
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
unsigned int addHitCount(const std::vector< AlignmentParameters * > &parVec, const std::vector< bool > &validHitVecY) const
int loop
CMSSW
int callMille2D(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, const std::vector< int > &globalLabels, const std::vector< float > &globalDerivativesx, const std::vector< float > &globalDerivativesy)
std::pair< RunNumber, RunNumber > RunRange
virtual void initialize(const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras, AlignmentParameterStore *store)
Call at beginning of job.
void addLasBeam(const EventInfo &eventInfo, const TkFittedLasBeam &lasBeam, const std::vector< TrajectoryStateOnSurface > &tsoses)
define event information passed to algorithms
unsigned int doIO(int loop) const
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
int callMille1D(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, const std::vector< int > &globalLabels, const std::vector< float > &globalDerivativesX)
calls Mille for 1D hits
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)
virtual void terminate(const edm::EventSetup &iSetup)
Call at end of job.
bool isMode(unsigned int testMode) const
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
virtual bool setParametersForRunRange(const RunRange &runrange)
virtual void endRun(const EventInfo &eventInfo, const EndRunInfo &runInfo, const edm::EventSetup &setup)
Run on run products, e.g. TkLAS.
AlignmentParameterStore * theAlignmentParameterStore
directory for all kind of files
bool is2D(const TransientTrackingRecHit::ConstRecHitPointer &recHit) const
true if hit belongs to 2D detector (currently tracker specific)
int addGlobalData(const edm::EventSetup &setup, const EventInfo &eventInfo, const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iHit, GblPoint &gblPoint)
void diagonalize(TMatrixDSym &aHitCovarianceM, TMatrixF &aLocalDerivativesM, TMatrixF &aHitResidualsM, TMatrixF &theGlobalDerivativesM) const
(Abstract) Base class for alignment algorithm user variables
bool addHits(const std::vector< Alignable * > &alis, const std::vector< AlignmentUserVariables * > &mpVars) const
bool addHitStatistics(int fromLoop, const std::string &outFile, const std::vector< std::string > &inFiles) const
bool areEmptyParams(const std::vector< Alignable * > &alignables) const
void addVirtualMeas(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iVirtualMeas)
adds data for virtual measurements from reference trajectory
bool readFromPede(const edm::ParameterSet &mprespset, bool setUserVars, const RunRange &runrange)
read pede input defined by &#39;psetName&#39;, flag to create/not create MillePedeVariables ...
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 &#39;bad&#39; trajectory) ...
void addRefTrackData2D(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, TMatrixDSym &aHitCovarianceM, TMatrixF &aHitResidualsM, TMatrixF &aLocalDerivativesM)
adds data from reference trajectory from a specific Hit
std::vector< IntegratedCalibrationBase * > theCalibrations
void makeGlobDerivMatrix(const std::vector< float > &globalDerivativesx, const std::vector< float > &globalDerivativesy, TMatrixF &aGlobalDerivativesM)
virtual bool addCalibrations(const std::vector< IntegratedCalibrationBase * > &iCals)
pass integrated calibrations to Millepede (they are not owned by Millepede!)
virtual void run(const edm::EventSetup &setup, const EventInfo &eventInfo)
Run the algorithm on trajectories and tracks.
void buildUserVariables(const std::vector< Alignable * > &alignables) const
add MillePedeVariables for each AlignmentParameters (exception if no parameters...)
MillePedeAlignmentAlgorithm(const edm::ParameterSet &cfg)
Constructor.
TrajectoryFactoryBase * theTrajectoryFactory
virtual ~MillePedeAlignmentAlgorithm()
Destructor.
std::vector< TkFittedLasBeam > TkFittedLasBeamCollection
Definition: Mille.h:26
Millepede-II (binary) record.
Definition: MilleBinary.h:46
void addRefTrackVirtualMeas1D(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iVirtualMeas, TMatrixDSym &aHitCovarianceM, TMatrixF &aHitResidualsM, TMatrixF &aLocalDerivativesM)
adds data for a specific virtual measurement from reference trajectory
void addPxbSurvey(const edm::ParameterSet &pxbSurveyCfg)
add measurement data from PXB survey
unsigned int decodeMode(const std::string &mode) const
std::vector< std::vector< TrajectoryStateOnSurface > > TsosVectorCollection
define run information passed to algorithms (in endRun)
Constructor of the full muon geometry.
Definition: AlignableMuon.h:36
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Point on trajectory.
Definition: GblPoint.h:46