#include <Alignment/CommonAlignmentAlgorithm/interface/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 |
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.
00010 : 00011 AlignableDataIO(p) 00012 { 00013 if (thePosType == Abs) { 00014 treename = "AlignablesAbsPos"; 00015 treetxt = "Alignables abs.Pos"; 00016 } 00017 else if (thePosType == Org) { 00018 treename = "AlignablesOrgPos"; 00019 treetxt = "Alignables org.Pos"; 00020 } 00021 else if (thePosType == Rel) { 00022 treename = "AlignablesRelPos"; 00023 treetxt = "Alignables rel.Pos"; 00024 } 00025 }
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().
00026 { return closeRoot(); }
create root branches
Implements AlignmentIORootBase.
Definition at line 30 of file AlignableDataIORoot.cc.
References Id, ObjId, Pos, Rot, and AlignmentIORootBase::tree.
00031 { 00032 tree->Branch("Id", &Id, "Id/i"); 00033 tree->Branch("ObjId", &ObjId, "ObjId/I"); 00034 tree->Branch("Pos", &Pos, "Pos[3]/D"); 00035 tree->Branch("Rot", &Rot, "Rot[9]/D"); 00036 }
int AlignableDataIORoot::findEntry | ( | align::ID | id, | |
align::StructureType | comp | |||
) | [private] |
Definition at line 52 of file AlignableDataIORoot.cc.
References Id, newopen, ObjId, HLT_VtxMuL3::result, AlignmentIORootBase::tree, and treemap.
Referenced by readAbsRaw(), and readRelRaw().
00053 { 00054 if (newopen) { // we're here first time 00055 edm::LogInfo("Alignment") << "@SUB=AlignableDataIORoot::findEntry" 00056 << "Filling map ..."; 00057 treemap.erase(treemap.begin(),treemap.end()); 00058 for (int ev = 0;ev<tree->GetEntries();ev++) { 00059 tree->GetEntry(ev); 00060 treemap[ std::make_pair(Id,ObjId) ] = ev; 00061 } 00062 newopen=false; 00063 } 00064 00065 // now we have filled the map 00066 treemaptype::iterator imap = treemap.find( std::make_pair(id,comp) ); 00067 int result=-1; 00068 if (imap != treemap.end()) result=(*imap).second; 00069 return result; 00070 00071 }
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, rot, Rot, and AlignmentIORootBase::tree.
00105 { 00106 align::GlobalPoint pos; 00107 align::RotationType rot; 00108 00109 align::StructureType typeId = ali->alignableObjectId(); 00110 align::ID id = ali->id(); 00111 int entry = findEntry(id,typeId); 00112 if(entry!=-1) { 00113 tree->GetEntry(entry); 00114 align::GlobalPoint pos2(Pos[0],Pos[1],Pos[2]); 00115 align::RotationType rot2(Rot[0],Rot[1],Rot[2], 00116 Rot[3],Rot[4],Rot[5], 00117 Rot[6],Rot[7],Rot[8]); 00118 pos=pos2; 00119 rot=rot2; 00120 ierr=0; 00121 } 00122 else ierr=-1; 00123 00124 return AlignableAbsData(pos,rot,id,typeId); 00125 }
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, rot, Rot, and AlignmentIORootBase::tree.
00130 { 00131 align::GlobalVector pos; 00132 align::RotationType rot; 00133 00134 align::StructureType typeId = ali->alignableObjectId(); 00135 align::ID id = ali->id(); 00136 int entry = findEntry(id,typeId); 00137 if(entry!=-1) { 00138 tree->GetEntry(entry); 00139 align::GlobalVector pos2(Pos[0],Pos[1],Pos[2]); 00140 align::RotationType rot2(Rot[0],Rot[1],Rot[2], 00141 Rot[3],Rot[4],Rot[5], 00142 Rot[6],Rot[7],Rot[8]); 00143 pos=pos2; 00144 rot=rot2; 00145 ierr=0; 00146 } 00147 else ierr=-1; 00148 00149 return AlignableRelData(pos,rot,id,typeId); 00150 }
set root branches
Implements AlignmentIORootBase.
Definition at line 41 of file AlignableDataIORoot.cc.
References Id, ObjId, Pos, Rot, and AlignmentIORootBase::tree.
00042 { 00043 tree->SetBranchAddress("Id", &Id); 00044 tree->SetBranchAddress("ObjId", &ObjId); 00045 tree->SetBranchAddress("Pos", &Pos); 00046 tree->SetBranchAddress("Rot", &Rot); 00047 }
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(), AlignableData< T >::pos(), Pos, AlignableData< T >::rot(), 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().
00075 { 00076 align::GlobalPoint pos = ad.pos(); 00077 align::RotationType rot = ad.rot(); 00078 Id = ad.id(); 00079 ObjId = ad.objId(); 00080 Pos[0]=pos.x(); Pos[1]=pos.y(); Pos[2]=pos.z(); 00081 Rot[0]=rot.xx(); Rot[1]=rot.xy(); Rot[2]=rot.xz(); 00082 Rot[3]=rot.yx(); Rot[4]=rot.yy(); Rot[5]=rot.yz(); 00083 Rot[6]=rot.zx(); Rot[7]=rot.zy(); Rot[8]=rot.zz(); 00084 tree->Fill(); 00085 return 0; 00086 }
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(), AlignableData< T >::pos(), Pos, AlignableData< T >::rot(), 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().
00090 { 00091 align::GlobalVector pos = ad.pos(); 00092 align::RotationType rot = ad.rot(); 00093 Id = ad.id(); 00094 ObjId = ad.objId(); 00095 Pos[0]=pos.x(); Pos[1]=pos.y(); Pos[2]=pos.z(); 00096 Rot[0]=rot.xx(); Rot[1]=rot.xy(); Rot[2]=rot.xz(); 00097 Rot[3]=rot.yx(); Rot[4]=rot.yy(); Rot[5]=rot.yz(); 00098 Rot[6]=rot.zx(); Rot[7]=rot.zy(); Rot[8]=rot.zz(); 00099 tree->Fill(); 00100 return 0; 00101 }
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] |
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] |