concrete class for ROOT based IO of Alignable positions More...
#include <AlignableDataIORoot.h>
Private Types | |
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 | |
align::ID | Id |
bool | newopen |
align::StructureType | ObjId |
root tree contents | |
double | Pos [3] |
double | 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 51 of file AlignableDataIORoot.h.
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 Id, ObjId, Pos, Rot, and AlignmentIORootBase::tree.
int AlignableDataIORoot::findEntry | ( | align::ID | id, |
align::StructureType | comp | ||
) | [private] |
Definition at line 52 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 104 of file AlignableDataIORoot.cc.
References Alignable::alignableObjectId(), findEntry(), Alignable::id(), pos, Pos, 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; 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 129 of file AlignableDataIORoot.cc.
References Alignable::alignableObjectId(), findEntry(), Alignable::id(), pos, Pos, 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; 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 41 of file AlignableDataIORoot.cc.
References Id, ObjId, Pos, Rot, and AlignmentIORootBase::tree.
int AlignableDataIORoot::writeAbsRaw | ( | const AlignableAbsData & | ad | ) | [private, virtual] |
write absolute positions
Implements AlignableDataIO.
Definition at line 74 of file AlignableDataIORoot.cc.
References Id, AlignableData< T >::id(), ObjId, AlignableData< T >::objId(), pos, AlignableData< T >::pos(), Pos, 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(); tree->Fill(); return 0; }
int AlignableDataIORoot::writeRelRaw | ( | const AlignableRelData & | ad | ) | [private, virtual] |
write relative positions
Implements AlignableDataIO.
Definition at line 89 of file AlignableDataIORoot.cc.
References Id, AlignableData< T >::id(), ObjId, AlignableData< T >::objId(), pos, AlignableData< T >::pos(), Pos, 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(); tree->Fill(); return 0; }
friend class AlignmentIORoot [friend] |
Definition at line 15 of file AlignableDataIORoot.h.
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 50 of file AlignableDataIORoot.h.
Referenced by findEntry(), and open().
root tree contents
Definition at line 44 of file AlignableDataIORoot.h.
Referenced by createBranches(), findEntry(), setBranchAddresses(), writeAbsRaw(), and writeRelRaw().
double AlignableDataIORoot::Pos[3] [private] |
Definition at line 47 of file AlignableDataIORoot.h.
Referenced by createBranches(), readAbsRaw(), readRelRaw(), setBranchAddresses(), writeAbsRaw(), and writeRelRaw().
double 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 52 of file AlignableDataIORoot.h.
Referenced by findEntry().