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
const static int itermax = 1000
 
const static 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.

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

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

Member Function Documentation

◆ close()

int AlignmentParametersIORoot::close ( void  )
overrideprivatevirtual

Close IO.

Implements AlignmentParametersIO.

Definition at line 109 of file AlignmentParametersIORoot.cc.

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 }

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

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

◆ createBranches()

void AlignmentParametersIORoot::createBranches ( void  )
overrideprivatevirtual

Create all branches and give names.

Implements AlignmentIORootBase.

Definition at line 20 of file AlignmentParametersIORoot.cc.

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 }

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

◆ 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.

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 }

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.

◆ setBranchAddresses()

void AlignmentParametersIORoot::setBranchAddresses ( void  )
overrideprivatevirtual

Set branch adresses.

Implements AlignmentIORootBase.

Definition at line 32 of file AlignmentParametersIORoot.cc.

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 }

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

◆ writeOne()

int AlignmentParametersIORoot::writeOne ( Alignable ali)
overrideprivatevirtual

Write AlignmentParameters of one Alignable.

Implements AlignmentParametersIO.

Definition at line 44 of file AlignmentParametersIORoot.cc.

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 }

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

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

AlignmentIORootBase::closeRoot
int closeRoot(void)
close IO
Definition: AlignmentIORootBase.cc:92
AlignmentParametersFactory::createParameters
AlignmentParameters * createParameters(Alignable *ali, ParametersType parType, const std::vector< bool > &sel)
Definition: AlignmentParametersFactory.cc:83
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
AlignmentParametersFactory::ParametersType
ParametersType
enums for all available AlignmentParameters
Definition: AlignmentParametersFactory.h:21
tree
Definition: tree.py:1
cuy.col
col
Definition: cuy.py:1010
AlignmentParametersFactory
AlignmentParametersIORoot::theId
align::ID theId
Definition: AlignmentParametersIORoot.h:51
AlignmentIORootBase::treename
TString treename
Definition: AlignmentIORootBase.h:39
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
AlignmentParameters
Definition: AlignmentParameters.h:35
AlignmentIORootBase::treetxt
TString treetxt
Definition: AlignmentIORootBase.h:40
AlignmentParameters::type
virtual int type() const =0
tell type (AlignmentParametersFactory::ParametersType - but no circular dependency)
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
AlignmentParametersIORoot::theHieraLevel
int theHieraLevel
Definition: AlignmentParametersIORoot.h:50
AlignmentParametersIORoot::theCovarRang
int theCovarRang
Definition: AlignmentParametersIORoot.h:50
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
AlignmentIORootBase::bWrite
bool bWrite
Definition: AlignmentIORootBase.h:41
AlignmentParametersIORoot::theCovRang
int theCovRang
Definition: AlignmentParametersIORoot.h:50
AlignmentParametersIORoot::thePar
double thePar[nParMax]
Definition: AlignmentParametersIORoot.h:54
Alignable::id
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
Definition: Alignable.h:180
AlignmentParameters::clone
virtual AlignmentParameters * clone(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
Enforce clone methods in derived classes.
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
AlignmentParameters::covariance
const AlgebraicSymMatrix & covariance(void) const
Get parameter covariance matrix.
Definition: AlignmentParameters.cc:67
AlignmentParameters::setValid
void setValid(bool v)
Set validity flag.
Definition: AlignmentParameters.cc:137
AlignmentIORootBase::openRoot
int openRoot(const char *filename, int iteration, bool writemode)
open IO
Definition: AlignmentIORootBase.cc:16
AlignmentParameters::selector
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
Definition: AlignmentParameters.cc:48
EgammaValidation_Wenu_cff.sel
sel
Definition: EgammaValidation_Wenu_cff.py:33
AlignmentParametersIORoot::theCov
double theCov[nParMax *(nParMax+1)/2]
Definition: AlignmentParametersIORoot.h:54
AlignmentParameters::parameters
const AlgebraicVector & parameters(void) const
Get alignment parameters.
Definition: AlignmentParameters.cc:64
AlignmentParametersIORoot::theParamType
int theParamType
Definition: AlignmentParametersIORoot.h:50
AlignmentParametersIORoot::theObjId
align::StructureType theObjId
Definition: AlignmentParametersIORoot.h:52
align_cfg.iteration
iteration
Definition: align_cfg.py:5
Alignable::alignmentParameters
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58
AlignmentParametersFactory::parametersType
ParametersType parametersType(const std::string &typeString)
convert string to ParametersType - exception if not known
Definition: AlignmentParametersFactory.cc:22
AlignmentParameters::hierarchyLevel
virtual unsigned int hierarchyLevel() const
Definition: AlignmentParameters.cc:107