CMS 3D CMS Logo

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

concrete class for ROOT based IO of Alignable positions More...

#include <AlignableDataIORoot.h>

Inheritance diagram for AlignableDataIORoot:
AlignmentIORootBase AlignableDataIO

Private Types

enum  { kMaxNumPar = 20 }
 
typedef std::map< std::pair< align::ID, align::StructureType >, int > treemaptype
 

Private Member Functions

 AlignableDataIORoot (PosType p)
 constructor More...
 
int close (void) override
 close IO More...
 
void createBranches (void) override
 create root branches More...
 
int findEntry (align::ID, align::StructureType)
 
int open (const char *filename, int iteration, bool writemode) override
 open IO More...
 
AlignableAbsData readAbsRaw (Alignable *ali, int &ierr) override
 read absolute positions More...
 
AlignableRelData readRelRaw (Alignable *ali, int &ierr) override
 read relative positions More...
 
void setBranchAddresses (void) override
 set root branches More...
 
int writeAbsRaw (const AlignableAbsData &ad) override
 write absolute positions More...
 
int writeRelRaw (const AlignableRelData &ad) override
 write relative positions More...
 

Private Attributes

Float_t deformationValues_ [kMaxNumPar]
 
align::ID Id
 
bool newopen
 
UInt_t numDeformationValues_
 
align::StructureType ObjId
 root tree contents More...
 
Double_t Pos [3]
 
Double_t Rot [9]
 
treemaptype treemap
 

Friends

class AlignmentIORoot
 

Additional Inherited Members

- Protected Types inherited from AlignableDataIO
enum  PosType { Abs, Org, Rel }
 
- 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 AlignableDataIO
 AlignableDataIO (PosType p)
 Constructor. More...
 
AlignableAbsData readAbsPos (Alignable *ali, int &ierr)
 Read absolute positions of one Alignable. More...
 
AlignablePositions readAbsPos (const align::Alignables &alivec, int &ierr)
 Read absolute positions of many Alignables. More...
 
AlignableAbsData readOrgPos (Alignable *ali, int &ierr)
 Read original positions of one Alignable. More...
 
AlignablePositions readOrgPos (const align::Alignables &alivec, int &ierr)
 Read original positions of many Alignables. More...
 
AlignableRelData readRelPos (Alignable *ali, int &ierr)
 Read relative positions of one Alignable. More...
 
AlignableShifts readRelPos (const align::Alignables &alivec, int &ierr)
 Read relative positions of many Alignables. More...
 
int writeAbsPos (Alignable *ali, bool validCheck)
 Write absolute positions of one Alignable. More...
 
int writeAbsPos (const align::Alignables &alivec, bool validCheck)
 Write absolute positions of many Alignables. More...
 
int writeOrgPos (Alignable *ali, bool validCheck)
 Write original positions of one Alignable. More...
 
int writeOrgPos (const align::Alignables &alivec, bool validCheck)
 Write original positions of many Alignables. More...
 
int writeRelPos (Alignable *ali, bool validCheck)
 Write relative positions of one Alignable. More...
 
int writeRelPos (const align::Alignables &alivec, bool validCheck)
 Write relative positions of many Alignables. More...
 
virtual ~AlignableDataIO ()
 Destructor. More...
 
- Protected Attributes inherited from AlignmentIORootBase
bool bWrite
 
TTree * tree
 
TString treename
 
TString treetxt
 
- Protected Attributes inherited from AlignableDataIO
PosType thePosType
 
- Static Protected Attributes inherited from AlignmentIORootBase
const static int itermax = 1000
 
const static int nParMax = 20
 

Detailed Description

concrete class for ROOT based IO of Alignable positions

Definition at line 14 of file AlignableDataIORoot.h.

Member Typedef Documentation

◆ treemaptype

typedef std::map<std::pair<align::ID, align::StructureType>, int> AlignableDataIORoot::treemaptype
private

Definition at line 56 of file AlignableDataIORoot.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
kMaxNumPar 

Definition at line 52 of file AlignableDataIORoot.h.

52 { kMaxNumPar = 20 }; // slighly above 'two bowed surfaces' limit

Constructor & Destructor Documentation

◆ AlignableDataIORoot()

AlignableDataIORoot::AlignableDataIORoot ( PosType  p)
private

constructor

Definition at line 10 of file AlignableDataIORoot.cc.

10  : AlignableDataIO(p) {
11  if (thePosType == Abs) {
12  treename = "AlignablesAbsPos";
13  treetxt = "Alignables abs.Pos";
14  } else if (thePosType == Org) {
15  treename = "AlignablesOrgPos";
16  treetxt = "Alignables org.Pos";
17  } else if (thePosType == Rel) {
18  treename = "AlignablesRelPos";
19  treetxt = "Alignables rel.Pos";
20  }
21 }

References AlignableDataIO::Abs, AlignableDataIO::Org, AlignableDataIO::Rel, AlignableDataIO::thePosType, AlignmentIORootBase::treename, and AlignmentIORootBase::treetxt.

Member Function Documentation

◆ close()

int AlignableDataIORoot::close ( void  )
inlineoverrideprivatevirtual

◆ createBranches()

void AlignableDataIORoot::createBranches ( void  )
overrideprivatevirtual

create root branches

Implements AlignmentIORootBase.

Definition at line 26 of file AlignableDataIORoot.cc.

26  {
27  tree->Branch("Id", &Id, "Id/i");
28  tree->Branch("ObjId", &ObjId, "ObjId/I");
29  tree->Branch("Pos", &Pos, "Pos[3]/D");
30  tree->Branch("Rot", &Rot, "Rot[9]/D");
31 
32  tree->Branch("NumDeform", &numDeformationValues_, "NumDeform/i");
33  tree->Branch("DeformValues", deformationValues_, "DeformValues[NumDeform]/F");
34 }

References deformationValues_, Id, numDeformationValues_, ObjId, Pos, and Rot.

◆ findEntry()

int AlignableDataIORoot::findEntry ( align::ID  id,
align::StructureType  comp 
)
private

Definition at line 52 of file AlignableDataIORoot.cc.

52  {
53  if (newopen) { // we're here first time
54  edm::LogInfo("Alignment") << "@SUB=AlignableDataIORoot::findEntry"
55  << "Filling map ...";
56  treemap.erase(treemap.begin(), treemap.end());
57  for (int ev = 0; ev < tree->GetEntries(); ev++) {
58  tree->GetEntry(ev);
59  treemap[std::make_pair(Id, ObjId)] = ev;
60  }
61  newopen = false;
62  }
63 
64  // now we have filled the map
65  treemaptype::iterator imap = treemap.find(std::make_pair(id, comp));
66  int result = -1;
67  if (imap != treemap.end())
68  result = (*imap).second;
69  return result;
70 }

References AlCaHLTBitMon_QueryRunRegistry::comp, ev, Id, newopen, ObjId, mps_fire::result, and treemap.

Referenced by QGLikelihoodCalculator.QGLikelihoodCalculator::computeQGLikelihood(), readAbsRaw(), and readRelRaw().

◆ open()

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

◆ readAbsRaw()

AlignableAbsData AlignableDataIORoot::readAbsRaw ( Alignable ali,
int &  ierr 
)
overrideprivatevirtual

read absolute positions

Implements AlignableDataIO.

Definition at line 131 of file AlignableDataIORoot.cc.

131  {
134 
135  align::StructureType typeId = ali->alignableObjectId();
136  align::ID id = ali->id();
137  std::vector<double> deformPars;
138  deformPars.reserve(numDeformationValues_);
139  int entry = findEntry(id, typeId);
140  if (entry != -1) {
141  tree->GetEntry(entry);
142  align::GlobalPoint pos2(Pos[0], Pos[1], Pos[2]);
143  align::RotationType rot2(Rot[0], Rot[1], Rot[2], Rot[3], Rot[4], Rot[5], Rot[6], Rot[7], Rot[8]);
144  pos = pos2;
145  rot = rot2;
146 
147  for (unsigned int i = 0; i < numDeformationValues_; ++i) {
148  deformPars.push_back((double)deformationValues_[i]);
149  }
150 
151  ierr = 0;
152  } else
153  ierr = -1;
154 
155  return AlignableAbsData(pos, rot, id, typeId, deformPars);
156 }

References Alignable::alignableObjectId(), deformationValues_, mps_splice::entry, findEntry(), mps_fire::i, Alignable::id(), numDeformationValues_, Pos, Rot, and makeMuonMisalignmentScenario::rot.

◆ readRelRaw()

AlignableRelData AlignableDataIORoot::readRelRaw ( Alignable ali,
int &  ierr 
)
overrideprivatevirtual

read relative positions

Implements AlignableDataIO.

Definition at line 160 of file AlignableDataIORoot.cc.

160  {
163 
164  align::StructureType typeId = ali->alignableObjectId();
165  align::ID id = ali->id();
166  std::vector<double> deformPars;
167  deformPars.reserve(numDeformationValues_);
168  int entry = findEntry(id, typeId);
169  if (entry != -1) {
170  tree->GetEntry(entry);
171  align::GlobalVector pos2(Pos[0], Pos[1], Pos[2]);
172  align::RotationType rot2(Rot[0], Rot[1], Rot[2], Rot[3], Rot[4], Rot[5], Rot[6], Rot[7], Rot[8]);
173  pos = pos2;
174  rot = rot2;
175 
176  for (unsigned int i = 0; i < numDeformationValues_; ++i) {
177  deformPars.push_back((double)deformationValues_[i]);
178  }
179 
180  ierr = 0;
181  } else
182  ierr = -1;
183 
184  return AlignableRelData(pos, rot, id, typeId, deformPars);
185 }

References Alignable::alignableObjectId(), deformationValues_, mps_splice::entry, findEntry(), mps_fire::i, Alignable::id(), numDeformationValues_, Pos, Rot, and makeMuonMisalignmentScenario::rot.

◆ setBranchAddresses()

void AlignableDataIORoot::setBranchAddresses ( void  )
overrideprivatevirtual

set root branches

Implements AlignmentIORootBase.

Definition at line 39 of file AlignableDataIORoot.cc.

39  {
40  tree->SetBranchAddress("Id", &Id);
41  tree->SetBranchAddress("ObjId", &ObjId);
42  tree->SetBranchAddress("Pos", &Pos);
43  tree->SetBranchAddress("Rot", &Rot);
44 
45  tree->SetBranchAddress("NumDeform", &numDeformationValues_);
46  tree->SetBranchAddress("DeformValues", deformationValues_);
47 }

References deformationValues_, Id, numDeformationValues_, ObjId, Pos, and Rot.

◆ writeAbsRaw()

int AlignableDataIORoot::writeAbsRaw ( const AlignableAbsData ad)
overrideprivatevirtual

write absolute positions

Implements AlignableDataIO.

Definition at line 73 of file AlignableDataIORoot.cc.

73  {
74  const align::GlobalPoint& pos = ad.pos();
76  Id = ad.id();
77  ObjId = ad.objId();
78  Pos[0] = pos.x();
79  Pos[1] = pos.y();
80  Pos[2] = pos.z();
81  Rot[0] = rot.xx();
82  Rot[1] = rot.xy();
83  Rot[2] = rot.xz();
84  Rot[3] = rot.yx();
85  Rot[4] = rot.yy();
86  Rot[5] = rot.yz();
87  Rot[6] = rot.zx();
88  Rot[7] = rot.zy();
89  Rot[8] = rot.zz();
90 
91  const std::vector<double>& deformPars = ad.deformationParameters();
92  numDeformationValues_ = (deformPars.size() > kMaxNumPar ? (unsigned)kMaxNumPar : deformPars.size());
93  for (unsigned int i = 0; i < numDeformationValues_; ++i) {
94  deformationValues_[i] = deformPars[i];
95  }
96 
97  tree->Fill();
98  return 0;
99 }

References AlignableData< T >::deformationParameters(), deformationValues_, mps_fire::i, AlignableData< T >::id(), Id, kMaxNumPar, numDeformationValues_, AlignableData< T >::objId(), ObjId, AlignableData< T >::pos(), Pos, AlignableData< T >::rot(), Rot, and makeMuonMisalignmentScenario::rot.

◆ writeRelRaw()

int AlignableDataIORoot::writeRelRaw ( const AlignableRelData ad)
overrideprivatevirtual

write relative positions

Implements AlignableDataIO.

Definition at line 102 of file AlignableDataIORoot.cc.

102  {
103  const align::GlobalVector& pos = ad.pos();
104  align::RotationType rot = ad.rot();
105  Id = ad.id();
106  ObjId = ad.objId();
107  Pos[0] = pos.x();
108  Pos[1] = pos.y();
109  Pos[2] = pos.z();
110  Rot[0] = rot.xx();
111  Rot[1] = rot.xy();
112  Rot[2] = rot.xz();
113  Rot[3] = rot.yx();
114  Rot[4] = rot.yy();
115  Rot[5] = rot.yz();
116  Rot[6] = rot.zx();
117  Rot[7] = rot.zy();
118  Rot[8] = rot.zz();
119 
120  const std::vector<double>& deformPars = ad.deformationParameters();
121  numDeformationValues_ = (deformPars.size() > kMaxNumPar ? (unsigned)kMaxNumPar : deformPars.size());
122  for (unsigned int i = 0; i < numDeformationValues_; ++i) {
123  deformationValues_[i] = deformPars[i];
124  }
125 
126  tree->Fill();
127  return 0;
128 }

References AlignableData< T >::deformationParameters(), deformationValues_, mps_fire::i, AlignableData< T >::id(), Id, kMaxNumPar, numDeformationValues_, AlignableData< T >::objId(), ObjId, AlignableData< T >::pos(), Pos, AlignableData< T >::rot(), Rot, and makeMuonMisalignmentScenario::rot.

Friends And Related Function Documentation

◆ AlignmentIORoot

friend class AlignmentIORoot
friend

Definition at line 15 of file AlignableDataIORoot.h.

Member Data Documentation

◆ deformationValues_

Float_t AlignableDataIORoot::deformationValues_[kMaxNumPar]
private

◆ Id

align::ID AlignableDataIORoot::Id
private

◆ newopen

bool AlignableDataIORoot::newopen
private

Definition at line 55 of file AlignableDataIORoot.h.

Referenced by findEntry(), and open().

◆ numDeformationValues_

UInt_t AlignableDataIORoot::numDeformationValues_
private

◆ ObjId

align::StructureType AlignableDataIORoot::ObjId
private

root tree contents

Definition at line 46 of file AlignableDataIORoot.h.

Referenced by createBranches(), findEntry(), setBranchAddresses(), writeAbsRaw(), and writeRelRaw().

◆ Pos

Double_t AlignableDataIORoot::Pos[3]
private

◆ Rot

Double_t AlignableDataIORoot::Rot[9]
private

◆ treemap

treemaptype AlignableDataIORoot::treemap
private

Definition at line 57 of file AlignableDataIORoot.h.

Referenced by findEntry().

Vector3DBase< Scalar, GlobalTag >
AlignableDataIORoot::deformationValues_
Float_t deformationValues_[kMaxNumPar]
Definition: AlignableDataIORoot.h:53
AlignmentIORootBase::closeRoot
int closeRoot(void)
close IO
Definition: AlignmentIORootBase.cc:92
TkRotation< Scalar >
AlCaHLTBitMon_QueryRunRegistry.comp
string comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
mps_fire.i
i
Definition: mps_fire.py:428
AlignableDataIORoot::Id
align::ID Id
Definition: AlignableDataIORoot.h:48
AlignableDataIO::AlignableDataIO
AlignableDataIO(PosType p)
Constructor.
Definition: AlignableDataIO.h:17
mps_splice.entry
entry
Definition: mps_splice.py:68
tree
Definition: tree.py:1
pos
Definition: PixelAliasList.h:18
AlignableDataIORoot::findEntry
int findEntry(align::ID, align::StructureType)
Definition: AlignableDataIORoot.cc:52
AlignableDataIORoot::treemap
treemaptype treemap
Definition: AlignableDataIORoot.h:57
AlignableDataIO::Org
Definition: AlignableDataIO.h:14
AlignmentIORootBase::treename
TString treename
Definition: AlignmentIORootBase.h:39
AlignableDataIORoot::newopen
bool newopen
Definition: AlignableDataIORoot.h:55
AlignableDataIORoot::Pos
Double_t Pos[3]
Definition: AlignableDataIORoot.h:49
AlignableDataIORoot::kMaxNumPar
Definition: AlignableDataIORoot.h:52
AlignableRelData
AlignableData< align::GlobalVector > AlignableRelData
relative position/rotation
Definition: AlignableData.h:45
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
AlignableDataIORoot::ObjId
align::StructureType ObjId
root tree contents
Definition: AlignableDataIORoot.h:46
AlignableDataIO::Abs
Definition: AlignableDataIO.h:14
AlignmentIORootBase::treetxt
TString treetxt
Definition: AlignmentIORootBase.h:40
AlignableDataIO::Rel
Definition: AlignableDataIO.h:14
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
AlignableData::objId
align::StructureType objId() const
Definition: AlignableData.h:28
Point3DBase< Scalar, GlobalTag >
align::StructureType
StructureType
Definition: StructureType.h:16
AlignableData::deformationParameters
const std::vector< double > deformationParameters() const
Definition: AlignableData.h:30
align::ID
uint32_t ID
Definition: Definitions.h:24
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Alignable::id
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
Definition: Alignable.h:180
AlignableData::pos
const T & pos() const
accessors
Definition: AlignableData.h:26
AlignableAbsData
AlignableData< align::GlobalPoint > AlignableAbsData
Absolute position/rotation.
Definition: AlignableData.h:43
AlignableDataIORoot::Rot
Double_t Rot[9]
Definition: AlignableDataIORoot.h:50
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
AlignmentIORootBase::openRoot
int openRoot(const char *filename, int iteration, bool writemode)
open IO
Definition: AlignmentIORootBase.cc:16
AlignableDataIO::thePosType
PosType thePosType
Definition: AlignableDataIO.h:77
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
AlignableData::id
align::ID id() const
Definition: AlignableData.h:29
mps_fire.result
result
Definition: mps_fire.py:311
align_cfg.iteration
iteration
Definition: align_cfg.py:5
AlignableDataIORoot::numDeformationValues_
UInt_t numDeformationValues_
Definition: AlignableDataIORoot.h:51
AlignableData::rot
const align::RotationType & rot() const
Definition: AlignableData.h:27