CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:
2009/01/23 15:47:42
Revision:
1.7

(last update by

Author:
ewidl

)

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

Close IO.

Implements AlignmentParametersIO.

Definition at line 118 of file AlignmentParametersIORoot.cc.

References AlignmentIORootBase::bWrite, AlignmentIORootBase::closeRoot(), and AlignmentIORootBase::tree.

Referenced by lumiQTWidget.ApplicationWindow::fileQuit(), Vispa.Gui.BoxContentDialog.BoxContentDialog::keyPressEvent(), Vispa.Gui.FindDialog.FindDialog::keyPressEvent(), AlignmentIORoot::readAlignmentParameters(), AlignmentIORoot::writeAlignmentParameters(), and AlignmentIORoot::writeOrigRigidBodyAlignmentParameters().

119 {
120  if ( bWrite )
121  {
122  int nIndices = tree->BuildIndex( "Id", "ObjId" );
123  edm::LogInfo( "Alignment" ) << "@SUB=AlignmentParametersIORoot::setBranchAddresses"
124  << "number of indexed entries: " << nIndices;
125  }
126 
127  return closeRoot();
128 }
int closeRoot(void)
close IO
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, theParamType, and AlignmentIORootBase::tree.

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]
int AlignmentParametersIORoot::findEntry ( align::ID  ,
align::StructureType   
)
private

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

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(), prof2calltree::count, AlignmentParametersFactory::createParameters(), Alignable::id(), AlignmentParametersFactory::parametersType(), EgammaValidation_Wenu_cff::sel, AlignmentParameters::selector(), AlignmentParameters::setValid(), theCov, theCovRang, thePar, theParamType, and AlignmentIORootBase::tree.

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:180
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
ParametersType
enums for all available AlignmentParameters
double theCov[nParMax *(nParMax+1)/2]
void setValid(bool v)
Set validity flag.
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
AlignmentParameters * createParameters(Alignable *ali, ParametersType parType, const std::vector< bool > &sel)
CLHEP::HepVector AlgebraicVector
virtual AlignmentParameters * clone(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
Enforce clone methods in derived classes.
CLHEP::HepSymMatrix AlgebraicSymMatrix
ParametersType parametersType(const std::string &typeString)
convert string to ParametersType - exception if not known
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, theParamType, and AlignmentIORootBase::tree.

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]
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(), prof2calltree::count, AlignmentParameters::covariance(), AlignmentParameters::hierarchyLevel(), Alignable::id(), AlignmentParameters::parameters(), theCov, theCovarRang, theCovRang, theHieraLevel, theId, theObjId, thePar, theParamType, AlignmentIORootBase::tree, 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:180
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
const AlgebraicVector & parameters(void) const
Get alignment parameters.
double theCov[nParMax *(nParMax+1)/2]
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
CLHEP::HepVector AlgebraicVector
virtual int type() const =0
tell type (AlignmentParametersFactory::ParametersType - but no circular dependency) ...
CLHEP::HepSymMatrix AlgebraicSymMatrix
virtual unsigned int hierarchyLevel() const
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().