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 
42 class MillePedeMonitor;
43 class PedeSteerer;
44 class PedeLabelerBase;
45 class Mille;
47 
48 // already from base class - and forward declaration does not work since typedef!
49 /* class TkFittedLasBeamCollection; */
50 /* class TsosVectorCollection; */
51 
53 {
54  public:
57 
60 
62  virtual void initialize(const edm::EventSetup &setup,
65 
67  virtual void terminate();
68 
70  virtual void run(const edm::EventSetup &setup, const EventInfo &eventInfo);
71 
73  virtual void endRun(const EventInfo &eventInfo, const EndRunInfo &runInfo,
74  const edm::EventSetup &setup);
75 
76 /* virtual void beginLuminosityBlock(const edm::EventSetup &setup) {} */
77 /* virtual void endLuminosityBlock(const edm::EventSetup &setup) {} */
78 
81  virtual bool setParametersForRunRange(const RunRange &runrange);
82 
83  private:
85 
87  std::pair<unsigned int, unsigned int>
88  addReferenceTrajectory(const EventInfo &eventInfo,
90 
94  int addMeasurementData(const EventInfo &eventInfo,
96  unsigned int iHit, AlignmentParameters *&params);
97 
102  unsigned int addHitCount(const std::vector<AlignmentParameters*> &parVec,
103  const std::vector<bool> &validHitVecY) const;
104 
107  unsigned int iTrajHit, TMatrixDSym &aHitCovarianceM,
108  TMatrixF &aHitResidualsM, TMatrixF &aLocalDerivativesM);
109 
112  unsigned int iVirtualMeas);
113 
116  unsigned int iVirtualMeas,TMatrixDSym &aHitCovarianceM,
117  TMatrixF &aHitResidualsM, TMatrixF &aLocalDerivativesM);
118 
120  bool globalDerivativesHierarchy(const EventInfo &eventInfo,
121  const TrajectoryStateOnSurface &tsos,
122  Alignable *ali, const AlignableDetOrUnitPtr &alidet,
123  std::vector<float> &globalDerivativesX,
124  std::vector<float> &globalDerivativesY,
125  std::vector<int> &globalLabels,
126  AlignmentParameters *&lowestParams) const;
127 
130  unsigned int iTrajHit, const std::vector<int> &globalLabels,
131  const std::vector<float> &globalDerivativesX,
132  const std::vector<float> &globalDerivativesY);
133 
136  unsigned int iTrajHit, const std::vector<int> &globalLabels,
137  const std::vector<float> &globalDerivativesX);
138 
143  unsigned int iTrajHit, const std::vector<int> &globalLabels,
144  const std::vector<float> &globalDerivativesx,
145  const std::vector<float> &globalDerivativesy);
146  void diagonalize(TMatrixDSym &aHitCovarianceM, TMatrixF &aLocalDerivativesM,
147  TMatrixF &aHitResidualsM,TMatrixF &theGlobalDerivativesM) const;
148  // deals with the non matrix format of theFloatBufferX ...
149  void makeGlobDerivMatrix(const std::vector<float> &globalDerivativesx,
150  const std::vector<float> &globalDerivativesy,
151  TMatrixF &aGlobalDerivativesM);
152 
153 // void callMille(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr,
154 // unsigned int iTrajHit, MeasurementDirection xOrY,
155 // const std::vector<float> &globalDerivatives, const std::vector<int> &globalLabels);
157  bool is2D(const TransientTrackingRecHit::ConstRecHitPointer &recHit) const;
158 
160  bool readFromPede(const edm::ParameterSet &mprespset, bool setUserVars,
161  const RunRange &runrange);
162  bool areEmptyParams(const std::vector<Alignable*> &alignables) const;
163  unsigned int doIO(int loop) const;
165  void buildUserVariables(const std::vector<Alignable*> &alignables) const;
166 
167  void addLaserData(const EventInfo &eventInfo,
168  const TkFittedLasBeamCollection &tkLasBeams,
169  const TsosVectorCollection &tkLasBeamTsoses);
170  void addLasBeam(const EventInfo &eventInfo,
171  const TkFittedLasBeam &lasBeam,
172  const std::vector<TrajectoryStateOnSurface> &tsoses);
173 
175  void addPxbSurvey(const edm::ParameterSet &pxbSurveyCfg);
176 
177  //--------------------------------------------------------
178  // Data members
179  //--------------------------------------------------------
180  enum EModeBit {myMilleBit = 1 << 0, myPedeRunBit = 1 << 1, myPedeSteerBit = 1 << 2,
181  myPedeReadBit = 1 << 3};
182  unsigned int decodeMode(const std::string &mode) const;
183  bool isMode(unsigned int testMode) const {return (theMode & testMode);}
184  bool addHitStatistics(int fromLoop, const std::string &outFile,
185  const std::vector<std::string> &inFiles) const;
186  bool addHits(const std::vector<Alignable*> &alis,
187  const std::vector<AlignmentUserVariables*> &mpVars) const;
188 
190  unsigned int theMode;
191  std::string theDir;
193  std::vector<Alignable*> theAlignables;
200  unsigned int theMinNumHits;
202  int theLastWrittenIov; // keeping track for output trees...
204  std::vector<float> theFloatBufferX;
205  std::vector<float> theFloatBufferY;
206  std::vector<int> theIntBuffer;
208 };
209 
210 #endif
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 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)
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)
bool isMode(unsigned int testMode) const
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)
void diagonalize(TMatrixDSym &aHitCovarianceM, TMatrixF &aLocalDerivativesM, TMatrixF &aHitResidualsM, TMatrixF &theGlobalDerivativesM) const
(Abstract) Base class for alignment algorithm user variables
int addMeasurementData(const EventInfo &eventInfo, const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iHit, AlignmentParameters *&params)
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 ...
void addRefTrackData2D(const ReferenceTrajectoryBase::ReferenceTrajectoryPtr &refTrajPtr, unsigned int iTrajHit, TMatrixDSym &aHitCovarianceM, TMatrixF &aHitResidualsM, TMatrixF &aLocalDerivativesM)
adds data from reference trajectory from a specific Hit
void makeGlobDerivMatrix(const std::vector< float > &globalDerivativesx, const std::vector< float > &globalDerivativesy, TMatrixF &aGlobalDerivativesM)
virtual void run(const edm::EventSetup &setup, const EventInfo &eventInfo)
Run the algorithm on trajectories and tracks.
define run information passed to algorithms (in endRun)
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
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::pair< unsigned int, unsigned int > addReferenceTrajectory(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) ...
std::vector< std::vector< TrajectoryStateOnSurface > > TsosVectorCollection
Constructor of the full muon geometry.
Definition: AlignableMuon.h:36
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
define event information passed to algorithms
virtual void terminate()
Call at end of job.