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) override
 Close IO. More...
 
void createBranches (void) override
 Create all branches and give names. More...
 
int findEntry (align::ID, align::StructureType)
 
int open (const char *filename, int iteration, bool writemode) override
 Open IO. More...
 
AlignmentParametersreadOne (Alignable *ali, int &ierr) override
 Read AlignmentParameters of one Alignable. More...
 
void setBranchAddresses (void) override
 Set branch adresses. More...
 
int writeOne (Alignable *ali) override
 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::AlignmentParametersIORoot ( )
private

Constructor.

Definition at line 14 of file AlignmentParametersIORoot.cc.

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

14  {
15  treename = "AlignmentParameters";
16  treetxt = "Alignment Parameters";
17 }

Member Function Documentation

◆ close()

int AlignmentParametersIORoot::close ( void  )
overrideprivatevirtual

Close IO.

Implements AlignmentParametersIO.

Definition at line 109 of file AlignmentParametersIORoot.cc.

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

Referenced by esMonitoring.AsyncLineReaderMixin::handle_close(), esMonitoring.FDJsonServer::handle_close(), AlignmentIORoot::readAlignmentParameters(), AlignmentIORoot::writeAlignmentParameters(), and AlignmentIORoot::writeOrigRigidBodyAlignmentParameters().

109  {
110  if (bWrite) {
111  int nIndices = tree->BuildIndex("Id", "ObjId");
112  edm::LogInfo("Alignment") << "@SUB=AlignmentParametersIORoot::setBranchAddresses"
113  << "number of indexed entries: " << nIndices;
114  }
115 
116  return closeRoot();
117 }
Log< level::Info, false > LogInfo
int closeRoot(void)
close IO
Definition: tree.py:1

◆ createBranches()

void AlignmentParametersIORoot::createBranches ( void  )
overrideprivatevirtual

Create all branches and give names.

Implements AlignmentIORootBase.

Definition at line 20 of file AlignmentParametersIORoot.cc.

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

20  {
21  tree->Branch("parSize", &theCovRang, "CovRang/I");
22  tree->Branch("Id", &theId, "Id/i");
23  tree->Branch("paramType", &theParamType, "paramType/I");
24  tree->Branch("Par", &thePar, "Par[CovRang]/D");
25  tree->Branch("covarSize", &theCovarRang, "CovarRang/I");
26  tree->Branch("Cov", &theCov, "Cov[CovarRang]/D");
27  tree->Branch("ObjId", &theObjId, "ObjId/I");
28  tree->Branch("HieraLevel", &theHieraLevel, "HieraLevel/I");
29 }
double theCov[nParMax *(nParMax+1)/2]
Definition: tree.py:1

◆ findEntry()

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().

◆ open()

int AlignmentParametersIORoot::open ( const char *  filename,
int  iteration,
bool  writemode 
)
inlineoverrideprivatevirtual

◆ readOne()

AlignmentParameters * AlignmentParametersIORoot::readOne ( Alignable ali,
int &  ierr 
)
overrideprivatevirtual

Read AlignmentParameters of one Alignable.

Implements AlignmentParametersIO.

Definition at line 72 of file AlignmentParametersIORoot.cc.

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

72  {
73  if (tree->GetEntryWithIndex(ali->id(), ali->alignableObjectId()) > 0) {
74  int covsize = theCovRang;
75  int count = 0;
76  AlgebraicVector par(covsize, 0);
77  AlgebraicSymMatrix cov(covsize, 0);
78  for (int row = 0; row < covsize; row++) {
79  par[row] = thePar[row];
80  for (int col = 0; col < covsize; col++) {
81  if (row - 1 < col) {
82  cov[row][col] = theCov[count];
83  count++;
84  }
85  }
86  }
87 
88  using namespace AlignmentParametersFactory;
90  AlignmentParameters* alipar1;
91  if (ali->alignmentParameters()) {
92  const std::vector<bool>& sel = ali->alignmentParameters()->selector();
93  alipar1 = createParameters(ali, parType, sel);
94  } else {
95  const std::vector<bool> sel(theCovRang, true);
96  alipar1 = createParameters(ali, parType, sel);
97  }
98  AlignmentParameters* alipar = alipar1->clone(par, cov);
99  alipar->setValid(true);
100  ierr = 0;
101  delete alipar1;
102  return alipar;
103  }
104 
105  ierr = -1;
106  return (nullptr);
107 }
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58
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
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
virtual AlignmentParameters * clone(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
Enforce clone methods in derived classes.
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
col
Definition: cuy.py:1009
CLHEP::HepSymMatrix AlgebraicSymMatrix
ParametersType parametersType(const std::string &typeString)
convert string to ParametersType - exception if not known
Definition: tree.py:1

◆ setBranchAddresses()

void AlignmentParametersIORoot::setBranchAddresses ( void  )
overrideprivatevirtual

Set branch adresses.

Implements AlignmentIORootBase.

Definition at line 32 of file AlignmentParametersIORoot.cc.

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

32  {
33  tree->SetBranchAddress("parSize", &theCovRang);
34  tree->SetBranchAddress("covarSize", &theCovarRang);
35  tree->SetBranchAddress("Id", &theId);
36  tree->SetBranchAddress("Par", &thePar);
37  tree->SetBranchAddress("paramType", &theParamType);
38  tree->SetBranchAddress("Cov", &theCov);
39  tree->SetBranchAddress("ObjId", &theObjId);
40  tree->SetBranchAddress("HieraLevel", &theHieraLevel);
41 }
double theCov[nParMax *(nParMax+1)/2]
Definition: tree.py:1

◆ writeOne()

int AlignmentParametersIORoot::writeOne ( Alignable ali)
overrideprivatevirtual

Write AlignmentParameters of one Alignable.

Implements AlignmentParametersIO.

Definition at line 44 of file AlignmentParametersIORoot.cc.

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

44  {
45  const AlignmentParameters* ap = ali->alignmentParameters();
46  const AlgebraicVector& params = ap->parameters();
47  const AlgebraicSymMatrix& cov = ap->covariance();
48 
49  theCovRang = params.num_row();
50  theCovarRang = theCovRang * (theCovRang + 1) / 2;
51  int count = 0;
52  for (int row = 0; row < theCovRang; row++) {
53  thePar[row] = params[row];
54  for (int col = 0; col < theCovRang; col++) {
55  if (row - 1 < col) {
56  theCov[count] = cov[row][col];
57  count++;
58  }
59  }
60  }
61 
62  theId = ali->id();
63  theParamType = ap->type();
64  theObjId = ali->alignableObjectId();
66 
67  tree->Fill();
68  return 0;
69 }
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58
const AlgebraicSymMatrix & covariance(void) const
Get parameter covariance matrix.
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
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
virtual unsigned int hierarchyLevel() const
virtual int type() const =0
tell type (AlignmentParametersFactory::ParametersType - but no circular dependency) ...
col
Definition: cuy.py:1009
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: tree.py:1

Friends And Related Function Documentation

◆ AlignmentIORoot

friend class AlignmentIORoot
friend

Definition at line 17 of file AlignmentParametersIORoot.h.

Member Data Documentation

◆ theCov

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

Definition at line 54 of file AlignmentParametersIORoot.h.

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

◆ theCovarRang

int AlignmentParametersIORoot::theCovarRang
private

Definition at line 50 of file AlignmentParametersIORoot.h.

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

◆ theCovRang

int AlignmentParametersIORoot::theCovRang
private

Definition at line 50 of file AlignmentParametersIORoot.h.

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

◆ theHieraLevel

int AlignmentParametersIORoot::theHieraLevel
private

Definition at line 50 of file AlignmentParametersIORoot.h.

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

◆ theId

align::ID AlignmentParametersIORoot::theId
private

Definition at line 51 of file AlignmentParametersIORoot.h.

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

◆ theObjId

align::StructureType AlignmentParametersIORoot::theObjId
private

Definition at line 52 of file AlignmentParametersIORoot.h.

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

◆ thePar

double AlignmentParametersIORoot::thePar[nParMax]
private

Definition at line 54 of file AlignmentParametersIORoot.h.

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

◆ theParamType

int AlignmentParametersIORoot::theParamType
private

Definition at line 50 of file AlignmentParametersIORoot.h.

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