concrete class for ROOT based IO of Alignable positions More...
#include <AlignableDataIORoot.h>
Private Types | |
enum | { kMaxNumPar = 20 } |
typedef std::map< std::pair < align::ID, align::StructureType >, int > | treemaptype |
Private Member Functions | |
AlignableDataIORoot (PosType p) | |
constructor | |
int | close (void) |
close IO | |
void | createBranches (void) |
create root branches | |
int | findEntry (align::ID, align::StructureType) |
int | open (const char *filename, int iteration, bool writemode) |
open IO | |
AlignableAbsData | readAbsRaw (Alignable *ali, int &ierr) |
read absolute positions | |
AlignableRelData | readRelRaw (Alignable *ali, int &ierr) |
read relative positions | |
void | setBranchAddresses (void) |
set root branches | |
int | writeAbsRaw (const AlignableAbsData &ad) |
write absolute positions | |
int | writeRelRaw (const AlignableRelData &ad) |
write relative positions | |
Private Attributes | |
Float_t | deformationValues_ [kMaxNumPar] |
align::ID | Id |
bool | newopen |
UInt_t | numDeformationValues_ |
align::StructureType | ObjId |
root tree contents | |
Double_t | Pos [3] |
Double_t | Rot [9] |
treemaptype | treemap |
Friends | |
class | AlignmentIORoot |
concrete class for ROOT based IO of Alignable positions
Definition at line 12 of file AlignableDataIORoot.h.
typedef std::map< std::pair<align::ID, align::StructureType>, int > AlignableDataIORoot::treemaptype [private] |
Definition at line 54 of file AlignableDataIORoot.h.
anonymous enum [private] |
Definition at line 50 of file AlignableDataIORoot.h.
{kMaxNumPar = 20}; // slighly above 'two bowed surfaces' limit
AlignableDataIORoot::AlignableDataIORoot | ( | PosType | p | ) | [private] |
constructor
Definition at line 10 of file AlignableDataIORoot.cc.
References AlignableDataIO::Abs, AlignableDataIO::Org, AlignableDataIO::Rel, AlignableDataIO::thePosType, AlignmentIORootBase::treename, and AlignmentIORootBase::treetxt.
: AlignableDataIO(p) { if (thePosType == Abs) { treename = "AlignablesAbsPos"; treetxt = "Alignables abs.Pos"; } else if (thePosType == Org) { treename = "AlignablesOrgPos"; treetxt = "Alignables org.Pos"; } else if (thePosType == Rel) { treename = "AlignablesRelPos"; treetxt = "Alignables rel.Pos"; } }
int AlignableDataIORoot::close | ( | void | ) | [inline, private, virtual] |
close IO
Implements AlignableDataIO.
Definition at line 26 of file AlignableDataIORoot.h.
References AlignmentIORootBase::closeRoot().
Referenced by AlignmentIORoot::readAlignableAbsolutePositions(), AlignmentIORoot::readAlignableOriginalPositions(), AlignmentIORoot::readAlignableRelativePositions(), AlignmentIORoot::writeAlignableAbsolutePositions(), AlignmentIORoot::writeAlignableOriginalPositions(), and AlignmentIORoot::writeAlignableRelativePositions().
{ return closeRoot(); }
void AlignableDataIORoot::createBranches | ( | void | ) | [private, virtual] |
create root branches
Implements AlignmentIORootBase.
Definition at line 30 of file AlignableDataIORoot.cc.
References deformationValues_, Id, numDeformationValues_, ObjId, Pos, Rot, and AlignmentIORootBase::tree.
{ tree->Branch("Id", &Id, "Id/i"); tree->Branch("ObjId", &ObjId, "ObjId/I"); tree->Branch("Pos", &Pos, "Pos[3]/D"); tree->Branch("Rot", &Rot, "Rot[9]/D"); tree->Branch("NumDeform", &numDeformationValues_, "NumDeform/i"); tree->Branch("DeformValues", deformationValues_, "DeformValues[NumDeform]/F"); }
int AlignableDataIORoot::findEntry | ( | align::ID | id, |
align::StructureType | comp | ||
) | [private] |
Definition at line 58 of file AlignableDataIORoot.cc.
References Id, newopen, ObjId, query::result, AlignmentIORootBase::tree, and treemap.
Referenced by readAbsRaw(), and readRelRaw().
{ if (newopen) { // we're here first time edm::LogInfo("Alignment") << "@SUB=AlignableDataIORoot::findEntry" << "Filling map ..."; treemap.erase(treemap.begin(),treemap.end()); for (int ev = 0;ev<tree->GetEntries();ev++) { tree->GetEntry(ev); treemap[ std::make_pair(Id,ObjId) ] = ev; } newopen=false; } // now we have filled the map treemaptype::iterator imap = treemap.find( std::make_pair(id,comp) ); int result=-1; if (imap != treemap.end()) result=(*imap).second; return result; }
int AlignableDataIORoot::open | ( | const char * | filename, |
int | iteration, | ||
bool | writemode | ||
) | [inline, private, virtual] |
open IO
Implements AlignableDataIO.
Definition at line 22 of file AlignableDataIORoot.h.
References newopen, and AlignmentIORootBase::openRoot().
Referenced by AlignmentIORoot::readAlignableAbsolutePositions(), AlignmentIORoot::readAlignableOriginalPositions(), AlignmentIORoot::readAlignableRelativePositions(), AlignmentIORoot::writeAlignableAbsolutePositions(), AlignmentIORoot::writeAlignableOriginalPositions(), and AlignmentIORoot::writeAlignableRelativePositions().
AlignableAbsData AlignableDataIORoot::readAbsRaw | ( | Alignable * | ali, |
int & | ierr | ||
) | [private, virtual] |
read absolute positions
Implements AlignableDataIO.
Definition at line 124 of file AlignableDataIORoot.cc.
References Alignable::alignableObjectId(), findEntry(), Alignable::id(), pos, Pos, makeMuonMisalignmentScenario::rot, Rot, and AlignmentIORootBase::tree.
{ align::GlobalPoint pos; align::RotationType rot; align::StructureType typeId = ali->alignableObjectId(); align::ID id = ali->id(); int entry = findEntry(id,typeId); if(entry!=-1) { tree->GetEntry(entry); align::GlobalPoint pos2(Pos[0],Pos[1],Pos[2]); align::RotationType rot2(Rot[0],Rot[1],Rot[2], Rot[3],Rot[4],Rot[5], Rot[6],Rot[7],Rot[8]); pos=pos2; rot=rot2; // FIXME: Should add reading of deformation values? // Then call Alignable::setSurfaceDeformation(..) ... ierr=0; } else ierr=-1; return AlignableAbsData(pos,rot,id,typeId); }
AlignableRelData AlignableDataIORoot::readRelRaw | ( | Alignable * | ali, |
int & | ierr | ||
) | [private, virtual] |
read relative positions
Implements AlignableDataIO.
Definition at line 152 of file AlignableDataIORoot.cc.
References Alignable::alignableObjectId(), findEntry(), Alignable::id(), pos, Pos, makeMuonMisalignmentScenario::rot, Rot, and AlignmentIORootBase::tree.
{ align::GlobalVector pos; align::RotationType rot; align::StructureType typeId = ali->alignableObjectId(); align::ID id = ali->id(); int entry = findEntry(id,typeId); if(entry!=-1) { tree->GetEntry(entry); align::GlobalVector pos2(Pos[0],Pos[1],Pos[2]); align::RotationType rot2(Rot[0],Rot[1],Rot[2], Rot[3],Rot[4],Rot[5], Rot[6],Rot[7],Rot[8]); pos=pos2; rot=rot2; // FIXME: Should add reading of deformation values? // Then call Alignable::setSurfaceDeformation(..) ... ierr=0; } else ierr=-1; return AlignableRelData(pos,rot,id,typeId); }
void AlignableDataIORoot::setBranchAddresses | ( | void | ) | [private, virtual] |
set root branches
Implements AlignmentIORootBase.
Definition at line 44 of file AlignableDataIORoot.cc.
References deformationValues_, Id, numDeformationValues_, ObjId, Pos, Rot, and AlignmentIORootBase::tree.
int AlignableDataIORoot::writeAbsRaw | ( | const AlignableAbsData & | ad | ) | [private, virtual] |
write absolute positions
Implements AlignableDataIO.
Definition at line 80 of file AlignableDataIORoot.cc.
References AlignableData< T >::deformationParameters(), deformationValues_, i, Id, AlignableData< T >::id(), kMaxNumPar, numDeformationValues_, ObjId, AlignableData< T >::objId(), pos, AlignableData< T >::pos(), Pos, makeMuonMisalignmentScenario::rot, AlignableData< T >::rot(), Rot, AlignmentIORootBase::tree, PV3DBase< T, PVType, FrameType >::x(), TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), PV3DBase< T, PVType, FrameType >::y(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), PV3DBase< T, PVType, FrameType >::z(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().
{ align::GlobalPoint pos = ad.pos(); align::RotationType rot = ad.rot(); Id = ad.id(); ObjId = ad.objId(); Pos[0]=pos.x(); Pos[1]=pos.y(); Pos[2]=pos.z(); Rot[0]=rot.xx(); Rot[1]=rot.xy(); Rot[2]=rot.xz(); Rot[3]=rot.yx(); Rot[4]=rot.yy(); Rot[5]=rot.yz(); Rot[6]=rot.zx(); Rot[7]=rot.zy(); Rot[8]=rot.zz(); const std::vector<double> &deformPars = ad.deformationParameters(); numDeformationValues_ = (deformPars.size() > kMaxNumPar ? kMaxNumPar : deformPars.size()); for (unsigned int i = 0; i < numDeformationValues_; ++i) { deformationValues_[i] = deformPars[i]; } tree->Fill(); return 0; }
int AlignableDataIORoot::writeRelRaw | ( | const AlignableRelData & | ad | ) | [private, virtual] |
write relative positions
Implements AlignableDataIO.
Definition at line 102 of file AlignableDataIORoot.cc.
References AlignableData< T >::deformationParameters(), deformationValues_, i, Id, AlignableData< T >::id(), kMaxNumPar, numDeformationValues_, ObjId, AlignableData< T >::objId(), pos, AlignableData< T >::pos(), Pos, makeMuonMisalignmentScenario::rot, AlignableData< T >::rot(), Rot, AlignmentIORootBase::tree, PV3DBase< T, PVType, FrameType >::x(), TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), PV3DBase< T, PVType, FrameType >::y(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), PV3DBase< T, PVType, FrameType >::z(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().
{ align::GlobalVector pos = ad.pos(); align::RotationType rot = ad.rot(); Id = ad.id(); ObjId = ad.objId(); Pos[0]=pos.x(); Pos[1]=pos.y(); Pos[2]=pos.z(); Rot[0]=rot.xx(); Rot[1]=rot.xy(); Rot[2]=rot.xz(); Rot[3]=rot.yx(); Rot[4]=rot.yy(); Rot[5]=rot.yz(); Rot[6]=rot.zx(); Rot[7]=rot.zy(); Rot[8]=rot.zz(); const std::vector<double> &deformPars = ad.deformationParameters(); numDeformationValues_ = (deformPars.size() > kMaxNumPar ? kMaxNumPar : deformPars.size()); for (unsigned int i = 0; i < numDeformationValues_; ++i) { deformationValues_[i] = deformPars[i]; } tree->Fill(); return 0; }
friend class AlignmentIORoot [friend] |
Definition at line 15 of file AlignableDataIORoot.h.
Float_t AlignableDataIORoot::deformationValues_[kMaxNumPar] [private] |
Definition at line 51 of file AlignableDataIORoot.h.
Referenced by createBranches(), setBranchAddresses(), writeAbsRaw(), and writeRelRaw().
align::ID AlignableDataIORoot::Id [private] |
Definition at line 46 of file AlignableDataIORoot.h.
Referenced by createBranches(), findEntry(), setBranchAddresses(), writeAbsRaw(), and writeRelRaw().
bool AlignableDataIORoot::newopen [private] |
Definition at line 53 of file AlignableDataIORoot.h.
Referenced by findEntry(), and open().
UInt_t AlignableDataIORoot::numDeformationValues_ [private] |
Definition at line 49 of file AlignableDataIORoot.h.
Referenced by createBranches(), setBranchAddresses(), writeAbsRaw(), and writeRelRaw().
root tree contents
Definition at line 44 of file AlignableDataIORoot.h.
Referenced by createBranches(), findEntry(), setBranchAddresses(), writeAbsRaw(), and writeRelRaw().
Double_t AlignableDataIORoot::Pos[3] [private] |
Definition at line 47 of file AlignableDataIORoot.h.
Referenced by createBranches(), readAbsRaw(), readRelRaw(), setBranchAddresses(), writeAbsRaw(), and writeRelRaw().
Double_t AlignableDataIORoot::Rot[9] [private] |
Definition at line 48 of file AlignableDataIORoot.h.
Referenced by createBranches(), readAbsRaw(), readRelRaw(), setBranchAddresses(), writeAbsRaw(), and writeRelRaw().
treemaptype AlignableDataIORoot::treemap [private] |
Definition at line 55 of file AlignableDataIORoot.h.
Referenced by findEntry().