ATLAS Offline Software
IMatrixTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRKALIGNINTERFACES_IMATRIXTOOL_IH
6 #define TRKALIGNINTERFACES_IMATRIXTOOL_IH
7 
21 #include "GaudiKernel/IAlgTool.h"
22 
23 #include <fstream>
24 
25 namespace Trk {
26 
27  class AlignModule;
28 
29  class AlVec;
30  class AlSymMatBase;
31 
32  static const InterfaceID
33  IID_TRKALIGNINTERFACES_IMatrixTool("IMatrixTool",1,0);
34 
35  class IMatrixTool : virtual public IAlgTool {
36 
37  public:
38 
40  IMatrixTool();
41 
43  virtual ~IMatrixTool() {}
44 
46  static const InterfaceID& interfaceID();
47 
49  virtual StatusCode allocateMatrix(int nDoF) = 0;
50 
52  virtual void prepareBinaryFiles(int solveOption) = 0;
53 
55  virtual void addFirstDerivatives(AlVec* vector) = 0;
56 
58  virtual void addFirstDerivatives(std::list<int,double>& derivatives) = 0;
59 
60  virtual void addFirstDerivative(int irow, double val) = 0;
61 
64 
66  virtual void addSecondDerivatives(std::list<std::pair<int,int>,double >& derivatives) = 0;
67  virtual void addSecondDerivative(int irow, int icol, double val) = 0;
68 
70  virtual bool accumulateFromFiles() = 0;
71 
73  virtual int solve() = 0;
74 
75  void addModule(int alignModuleIndex, int nAlignParam);
76  int entryNumber(int alignModuleIndex);
77 
79  //virtual void setAlignModule(int irow, const AlignModule* alignmodule,
80  // int ipar) = 0;
81 
83  void setNHits(int n) { m_nHits = n; }
84  int nHits() const { return m_nHits; }
85 
87  void setNTracks(int n) { m_nTracks = n; }
88  int nTracks() const { return m_nTracks; }
89 
92  int nMeasurements() const { return m_nMeasurements; }
93 
95  virtual void setLogStream(std::ostream * os) { m_logStream = os; }
96 
97  protected:
98  std::ostream * m_logStream;
99 
100  int m_nHits;
103 
104  private:
105  std::map<int,int> m_alignModuleMap;
107 
108  }; // end of class
109 
110  inline const InterfaceID& IMatrixTool::interfaceID() {
111  return IID_TRKALIGNINTERFACES_IMatrixTool;
112  }
113 
114  inline IMatrixTool::IMatrixTool() : m_logStream(0), m_nHits(0), m_nTracks(0), m_nMeasurements(0), m_nentries(0) {}
115 
116  inline void IMatrixTool::addModule(int alignModuleIndex, int nAlignParam) { m_alignModuleMap[alignModuleIndex]=m_nentries; m_nentries += nAlignParam; }
117 
118  inline int IMatrixTool::entryNumber(int alignModuleIndex) { if ( m_alignModuleMap.find(alignModuleIndex) == m_alignModuleMap.end()) return -1; else return m_alignModuleMap[alignModuleIndex]; }
119 
120 } // end of namespace
121 
122 #endif // TRKALIGNINTERFACES_IMATRIXTOOL_IH
Trk::IMatrixTool::m_nHits
int m_nHits
Definition: IMatrixTool.h:100
Trk::IMatrixTool
Definition: IMatrixTool.h:35
Trk::IMatrixTool::addFirstDerivative
virtual void addFirstDerivative(int irow, double val)=0
Trk::IMatrixTool::interfaceID
static const InterfaceID & interfaceID()
Retrieve interface ID.
Definition: IMatrixTool.h:110
Trk::IMatrixTool::solve
virtual int solve()=0
solves for alignment parameters
Trk::IMatrixTool::entryNumber
int entryNumber(int alignModuleIndex)
Definition: IMatrixTool.h:118
Trk::AlVec
Definition: AlVec.h:23
Trk::IMatrixTool::nTracks
int nTracks() const
Definition: IMatrixTool.h:88
Trk::IMatrixTool::prepareBinaryFiles
virtual void prepareBinaryFiles(int solveOption)=0
reads/writes matrix entries from/to binary files as necessary
Trk::AlSymMatBase
Definition: AlSymMatBase.h:38
Trk::IMatrixTool::setLogStream
virtual void setLogStream(std::ostream *os)
sets the output stream for the logfile
Definition: IMatrixTool.h:95
Trk::IMatrixTool::IMatrixTool
IMatrixTool()
constructor
Definition: IMatrixTool.h:114
Trk::IMatrixTool::~IMatrixTool
virtual ~IMatrixTool()
Virtual destructor.
Definition: IMatrixTool.h:43
atlasStyleMacro.icol
int icol
Definition: atlasStyleMacro.py:13
Trk::IMatrixTool::setNMeasurements
void setNMeasurements(int n)
set number of measurements
Definition: IMatrixTool.h:91
Trk::IMatrixTool::addSecondDerivatives
virtual void addSecondDerivatives(AlSymMatBase *matrix)=0
adds second derivatives to matrix
Trk::IMatrixTool::addFirstDerivatives
virtual void addFirstDerivatives(AlVec *vector)=0
adds first derivative to vector
AlignModule
AlignModule is a grouping of TrkDetElementBase objects, grouped according to the type of alignment,...
beamspotman.n
n
Definition: beamspotman.py:731
Trk::IMatrixTool::addFirstDerivatives
virtual void addFirstDerivatives(std::list< int, double > &derivatives)=0
adds first derivative to vector for only some entries
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
Trk::IMatrixTool::addSecondDerivative
virtual void addSecondDerivative(int irow, int icol, double val)=0
Trk::IMatrixTool::nMeasurements
int nMeasurements() const
Definition: IMatrixTool.h:92
Trk::IMatrixTool::addSecondDerivatives
virtual void addSecondDerivatives(std::list< std::pair< int, int >, double > &derivatives)=0
adds first derivative to vector for only some entries
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
Trk::IMatrixTool::m_nentries
int m_nentries
Definition: IMatrixTool.h:106
Trk::IMatrixTool::setNTracks
void setNTracks(int n)
set number of tracks
Definition: IMatrixTool.h:87
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::IMatrixTool::m_logStream
std::ostream * m_logStream
logfile output stream
Definition: IMatrixTool.h:98
Trk::IMatrixTool::m_alignModuleMap
std::map< int, int > m_alignModuleMap
Definition: IMatrixTool.h:105
Trk::IMatrixTool::addModule
void addModule(int alignModuleIndex, int nAlignParam)
Definition: IMatrixTool.h:116
Trk::IMatrixTool::m_nMeasurements
int m_nMeasurements
Definition: IMatrixTool.h:102
Trk::IMatrixTool::allocateMatrix
virtual StatusCode allocateMatrix(int nDoF)=0
allocates space in memory for the big matrix and vector
Trk::IMatrixTool::m_nTracks
int m_nTracks
Definition: IMatrixTool.h:101
Trk::IMatrixTool::nHits
int nHits() const
Definition: IMatrixTool.h:84
python.testIfMatch.matrix
matrix
Definition: testIfMatch.py:66
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
Trk::IMatrixTool::setNHits
void setNHits(int n)
set module identifier
Definition: IMatrixTool.h:83
Trk::IMatrixTool::accumulateFromFiles
virtual bool accumulateFromFiles()=0
accumulates first and second derivatives from files.