CMS 3D CMS Logo

List of all members | Private Member Functions | Private Attributes | Friends
AlignmentParametersIORoot Class Reference

#include <AlignmentParametersIORoot.h>

Inheritance diagram for AlignmentParametersIORoot:
AlignmentIORootBase AlignmentParametersIO

Private Member Functions

 AlignmentParametersIORoot ()
 Constructor. More...
 
int close (void)
 Close IO. More...
 
void createBranches (void)
 Create all branches and give names. More...
 
int findEntry (align::ID, align::StructureType)
 
int open (const char *filename, int iteration, bool writemode)
 Open IO. More...
 
AlignmentParametersreadOne (Alignable *ali, int &ierr)
 Read AlignmentParameters of one Alignable. More...
 
void setBranchAddresses (void)
 Set branch adresses. More...
 
int writeOne (Alignable *ali)
 Write AlignmentParameters of one Alignable. More...
 

Private Attributes

double theCov [nParMax *(nParMax+1)/2]
 
int theCovarRang
 
int theCovRang
 
int theHieraLevel
 
align::ID theId
 
align::StructureType theObjId
 
double thePar [nParMax]
 
int theParamType
 

Friends

class AlignmentIORoot
 

Additional Inherited Members

- Protected Member Functions inherited from AlignmentIORootBase
 AlignmentIORootBase ()
 constructor More...
 
int closeRoot (void)
 close IO More...
 
int openRoot (const char *filename, int iteration, bool writemode)
 open IO More...
 
int testFile (const char *filename, const TString &tname)
 test if file is existing and if so, what the highest iteration is More...
 
TString treeName (int iter, const TString &tname)
 compose tree name More...
 
virtual ~AlignmentIORootBase ()
 destructor More...
 
- Protected Member Functions inherited from AlignmentParametersIO
align::Parameters read (const align::Alignables &alivec, int &ierr)
 read AlignmentParameters of many Alignables More...
 
int write (const align::Alignables &alivec, bool validCheck)
 write AlignmentParameters of many Alignables More...
 
virtual int writeOneOrigRigidBody (Alignable *ali)
 write original RigidBodyAlignmentParameters (i.e. 3 shifts and 3 rotation) More...
 
int writeOrigRigidBody (const align::Alignables &alivec, bool validCheck)
 write original RigidBodyAlignmentParameters of many Alignables More...
 
virtual ~AlignmentParametersIO ()
 
- Protected Attributes inherited from AlignmentIORootBase
bool bWrite
 
TTree * tree
 
TString treename
 
TString treetxt
 
- Static Protected Attributes inherited from AlignmentIORootBase
static const int itermax = 1000
 
static const int nParMax = 20
 

Detailed Description

Concrete class for ROOT-based I/O of AlignmentParameters

Date
2008/09/02 15:31:23
Revision
1.6

(last update by

Author
flucke

)

Definition at line 16 of file AlignmentParametersIORoot.h.

Constructor & Destructor Documentation

AlignmentParametersIORoot::AlignmentParametersIORoot ( )
private

Constructor.

Definition at line 15 of file AlignmentParametersIORoot.cc.

References AlignmentIORootBase::treename, and AlignmentIORootBase::treetxt.

16 {
17  treename = "AlignmentParameters";
18  treetxt = "Alignment Parameters";
19 }

Member Function Documentation

int AlignmentParametersIORoot::close ( void  )
privatevirtual
void AlignmentParametersIORoot::createBranches ( void  )
privatevirtual

Create all branches and give names.

Implements AlignmentIORootBase.

Definition at line 23 of file AlignmentParametersIORoot.cc.

References theCov, theCovarRang, theCovRang, theHieraLevel, theId, theObjId, thePar, and theParamType.

Referenced by open().

24 {
25  tree->Branch("parSize", &theCovRang, "CovRang/I");
26  tree->Branch("Id", &theId, "Id/i");
27  tree->Branch("paramType", &theParamType, "paramType/I");
28  tree->Branch("Par", &thePar, "Par[CovRang]/D");
29  tree->Branch("covarSize", &theCovarRang, "CovarRang/I");
30  tree->Branch("Cov", &theCov, "Cov[CovarRang]/D");
31  tree->Branch("ObjId", &theObjId, "ObjId/I");
32  tree->Branch("HieraLevel",&theHieraLevel,"HieraLevel/I");
33 }
double theCov[nParMax *(nParMax+1)/2]
Definition: tree.py:1
int AlignmentParametersIORoot::findEntry ( align::ID  ,
align::StructureType   
)
private

Find entry number corresponding to ID and structure type. Returns -1 on failure.

Referenced by QGLikelihoodCalculator.QGLikelihoodCalculator::computeQGLikelihood(), and open().

int AlignmentParametersIORoot::open ( const char *  filename,
int  iteration,
bool  writemode 
)
inlineprivatevirtual
AlignmentParameters * AlignmentParametersIORoot::readOne ( Alignable ali,
int &  ierr 
)
privatevirtual

Read AlignmentParameters of one Alignable.

Implements AlignmentParametersIO.

Definition at line 78 of file AlignmentParametersIORoot.cc.

References Alignable::alignableObjectId(), Alignable::alignmentParameters(), AlignmentParameters::clone(), cuy::col, KineDebug3::count(), AlignmentParametersFactory::createParameters(), Alignable::id(), AlignmentParametersFactory::parametersType(), AlignmentParameters::selector(), AlignmentParameters::setValid(), theCov, theCovRang, thePar, and theParamType.

79 {
80 
81  if( tree->GetEntryWithIndex( ali->id(), ali->alignableObjectId() ) > 0 )
82  {
83  int covsize = theCovRang;
84  int count=0;
85  AlgebraicVector par(covsize, 0);
86  AlgebraicSymMatrix cov(covsize, 0);
87  for(int row=0;row<covsize;row++)
88  {
89  par[row]=thePar[row];
90  for(int col=0; col < covsize;col++) {
91  if(row-1<col) {cov[row][col]=theCov[count];count++;}
92  }
93  }
94 
95  using namespace AlignmentParametersFactory;
97  AlignmentParameters* alipar1;
98  if ( ali->alignmentParameters() )
99  {
100  const std::vector<bool>& sel = ali->alignmentParameters()->selector();
101  alipar1 = createParameters(ali, parType, sel);
102  } else {
103  const std::vector<bool> sel( theCovRang, true );
104  alipar1 = createParameters(ali, parType, sel);
105  }
106  AlignmentParameters* alipar = alipar1->clone(par,cov);
107  alipar->setValid(true);
108  ierr=0;
109  delete alipar1;
110  return alipar;
111  }
112 
113  ierr=-1;
114  return(0);
115 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
ParametersType
enums for all available AlignmentParameters
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
double theCov[nParMax *(nParMax+1)/2]
void setValid(bool v)
Set validity flag.
virtual AlignmentParameters * clone(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
Enforce clone methods in derived classes.
AlignmentParameters * createParameters(Alignable *ali, ParametersType parType, const std::vector< bool > &sel)
CLHEP::HepVector AlgebraicVector
col
Definition: cuy.py:1008
CLHEP::HepSymMatrix AlgebraicSymMatrix
ParametersType parametersType(const std::string &typeString)
convert string to ParametersType - exception if not known
Definition: tree.py:1
void AlignmentParametersIORoot::setBranchAddresses ( void  )
privatevirtual

Set branch adresses.

Implements AlignmentIORootBase.

Definition at line 37 of file AlignmentParametersIORoot.cc.

References theCov, theCovarRang, theCovRang, theHieraLevel, theId, theObjId, thePar, and theParamType.

Referenced by open().

38 {
39  tree->SetBranchAddress("parSize", &theCovRang);
40  tree->SetBranchAddress("covarSize", &theCovarRang);
41  tree->SetBranchAddress("Id", &theId);
42  tree->SetBranchAddress("Par", &thePar);
43  tree->SetBranchAddress("paramType", &theParamType);
44  tree->SetBranchAddress("Cov", &theCov);
45  tree->SetBranchAddress("ObjId", &theObjId);
46  tree->SetBranchAddress("HieraLevel",&theHieraLevel);
47 }
double theCov[nParMax *(nParMax+1)/2]
Definition: tree.py:1
int AlignmentParametersIORoot::writeOne ( Alignable ali)
privatevirtual

Write AlignmentParameters of one Alignable.

Implements AlignmentParametersIO.

Definition at line 51 of file AlignmentParametersIORoot.cc.

References Alignable::alignableObjectId(), Alignable::alignmentParameters(), cuy::col, KineDebug3::count(), AlignmentParameters::covariance(), AlignmentParameters::hierarchyLevel(), Alignable::id(), AlignmentParameters::parameters(), theCov, theCovarRang, theCovRang, theHieraLevel, theId, theObjId, thePar, theParamType, and AlignmentParameters::type().

52 {
53  const AlignmentParameters* ap =ali->alignmentParameters();
54  const AlgebraicVector& params = ap->parameters();
55  const AlgebraicSymMatrix& cov = ap->covariance();
56 
57  theCovRang = params.num_row();
59  int count=0;
60  for(int row=0;row<theCovRang;row++){
61  thePar[row]=params[row];
62  for(int col=0;col<theCovRang;col++){
63  if(row-1<col) { theCov[count] = cov[row][col]; count++; }
64  }
65  }
66 
67  theId = ali->id();
68  theParamType = ap->type();
69  theObjId = ali->alignableObjectId();
71 
72  tree->Fill();
73  return 0;
74 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
virtual int type() const =0
tell type (AlignmentParametersFactory::ParametersType - but no circular dependency) ...
const AlgebraicVector & parameters(void) const
Get alignment parameters.
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
double theCov[nParMax *(nParMax+1)/2]
CLHEP::HepVector AlgebraicVector
col
Definition: cuy.py:1008
CLHEP::HepSymMatrix AlgebraicSymMatrix
virtual unsigned int hierarchyLevel() const
Definition: tree.py:1
const AlgebraicSymMatrix & covariance(void) const
Get parameter covariance matrix.

Friends And Related Function Documentation

friend class AlignmentIORoot
friend

Definition at line 18 of file AlignmentParametersIORoot.h.

Member Data Documentation

double AlignmentParametersIORoot::theCov[nParMax *(nParMax+1)/2]
private

Definition at line 55 of file AlignmentParametersIORoot.h.

Referenced by createBranches(), readOne(), setBranchAddresses(), and writeOne().

int AlignmentParametersIORoot::theCovarRang
private

Definition at line 51 of file AlignmentParametersIORoot.h.

Referenced by createBranches(), setBranchAddresses(), and writeOne().

int AlignmentParametersIORoot::theCovRang
private

Definition at line 51 of file AlignmentParametersIORoot.h.

Referenced by createBranches(), readOne(), setBranchAddresses(), and writeOne().

int AlignmentParametersIORoot::theHieraLevel
private

Definition at line 51 of file AlignmentParametersIORoot.h.

Referenced by createBranches(), setBranchAddresses(), and writeOne().

align::ID AlignmentParametersIORoot::theId
private

Definition at line 52 of file AlignmentParametersIORoot.h.

Referenced by createBranches(), setBranchAddresses(), and writeOne().

align::StructureType AlignmentParametersIORoot::theObjId
private

Definition at line 53 of file AlignmentParametersIORoot.h.

Referenced by createBranches(), setBranchAddresses(), and writeOne().

double AlignmentParametersIORoot::thePar[nParMax]
private

Definition at line 55 of file AlignmentParametersIORoot.h.

Referenced by createBranches(), readOne(), setBranchAddresses(), and writeOne().

int AlignmentParametersIORoot::theParamType
private

Definition at line 51 of file AlignmentParametersIORoot.h.

Referenced by createBranches(), readOne(), setBranchAddresses(), and writeOne().