#include <Alignment/CommonAlignmentAlgorithm/interface/AlignmentParametersIORoot.h>
Private Member Functions | |
AlignmentParametersIORoot () | |
Constructor. | |
int | close (void) |
Close IO. | |
void | createBranches (void) |
Create all branches and give names. | |
int | findEntry (align::ID, align::StructureType) |
Find entry number corresponding to ID and structure type. | |
int | open (const char *filename, int iteration, bool writemode) |
Open IO. | |
AlignmentParameters * | readOne (Alignable *ali, int &ierr) |
Read AlignmentParameters of one Alignable. | |
void | setBranchAddresses (void) |
Set branch adresses. | |
int | writeOne (Alignable *ali) |
Write AlignmentParameters of one Alignable. | |
Private Attributes | |
double | theCov [nParMax *(nParMax+1)/2] |
int | theCovarRang |
int | theCovRang |
int | theHieraLevel |
align::ID | theId |
align::StructureType | theObjId |
double | thePar [nParMax] |
Friends | |
class | AlignmentIORoot |
Definition at line 16 of file AlignmentParametersIORoot.h.
AlignmentParametersIORoot::AlignmentParametersIORoot | ( | ) | [private] |
Constructor.
Definition at line 12 of file AlignmentParametersIORoot.cc.
References AlignmentIORootBase::treename, and AlignmentIORootBase::treetxt.
Close IO.
Implements AlignmentParametersIO.
Definition at line 36 of file AlignmentParametersIORoot.h.
References AlignmentIORootBase::closeRoot().
Referenced by AlignmentIORoot::readAlignmentParameters(), AlignmentIORoot::writeAlignmentParameters(), and AlignmentIORoot::writeOrigRigidBodyAlignmentParameters().
00036 {return closeRoot();};
Create all branches and give names.
Implements AlignmentIORootBase.
Definition at line 20 of file AlignmentParametersIORoot.cc.
References theCov, theCovarRang, theCovRang, theHieraLevel, theId, theObjId, thePar, and AlignmentIORootBase::tree.
00021 { 00022 tree->Branch("parSize", &theCovRang, "CovRang/I"); 00023 tree->Branch("Id", &theId, "Id/i"); 00024 tree->Branch("Par", &thePar, "Par[CovRang]/D"); 00025 tree->Branch("covarSize", &theCovarRang, "CovarRang/I"); 00026 tree->Branch("Cov", &theCov, "Cov[CovarRang]/D"); 00027 tree->Branch("ObjId", &theObjId, "ObjId/I"); 00028 tree->Branch("HieraLevel",&theHieraLevel,"HieraLevel/I"); 00029 }
int AlignmentParametersIORoot::findEntry | ( | align::ID | id, | |
align::StructureType | comp | |||
) | [private] |
Find entry number corresponding to ID and structure type.
Returns -1 on failure.
Definition at line 46 of file AlignmentParametersIORoot.cc.
References theId, theObjId, and AlignmentIORootBase::tree.
Referenced by readOne().
00047 { 00048 double noAliPar = tree->GetEntries(); 00049 for (int ev = 0;ev<noAliPar;ev++) { 00050 tree->GetEntry(ev); 00051 if ( theId==id && theObjId==comp ) return (ev); 00052 } 00053 return -1; 00054 }
int AlignmentParametersIORoot::open | ( | const char * | filename, | |
int | iteration, | |||
bool | writemode | |||
) | [inline, private, virtual] |
Open IO.
Implements AlignmentParametersIO.
Definition at line 32 of file AlignmentParametersIORoot.h.
References AlignmentIORootBase::openRoot().
Referenced by AlignmentIORoot::readAlignmentParameters(), AlignmentIORoot::writeAlignmentParameters(), and AlignmentIORoot::writeOrigRigidBodyAlignmentParameters().
AlignmentParameters * AlignmentParametersIORoot::readOne | ( | Alignable * | ali, | |
int & | ierr | |||
) | [private, virtual] |
Read AlignmentParameters of one Alignable.
Implements AlignmentParametersIO.
Definition at line 83 of file AlignmentParametersIORoot.cc.
References Alignable::alignableObjectId(), Alignable::alignmentParameters(), parsecf::pyparsing::col(), count, findEntry(), Alignable::id(), AlignmentIORootBase::nParMax, row, EgammaValidation_Zee_cff::sel, AlignmentParameters::selector(), AlignmentParameters::setValid(), theCov, theCovRang, thePar, and AlignmentIORootBase::tree.
00084 { 00085 00086 AlignmentParameters* alipar = 0; 00087 AlgebraicVector par(nParMax,0); 00088 AlgebraicSymMatrix cov(nParMax,0); 00089 const std::vector<bool> &sel = ali->alignmentParameters()->selector(); 00090 00091 int entry = findEntry( ali->id(), ali->alignableObjectId() ); 00092 if( entry != -1 ) 00093 { 00094 tree->GetEntry(entry); 00095 int covsize = theCovRang; 00096 int count=0; 00097 for(int row=0;row<covsize;row++) 00098 { 00099 par[row]=thePar[row]; 00100 for(int col=0; col < covsize;col++) { 00101 if(row-1<col) {cov[row][col]=theCov[count];count++;} 00102 } 00103 } 00104 // FIXME: In future should check which kind of parameters to construct... 00105 alipar = new RigidBodyAlignmentParameters(ali,par,cov,sel); 00106 alipar->setValid(true); 00107 ierr=0; 00108 return alipar; 00109 } 00110 00111 ierr=-1; 00112 return(0); 00113 }
Set branch adresses.
Implements AlignmentIORootBase.
Definition at line 33 of file AlignmentParametersIORoot.cc.
References theCov, theCovarRang, theCovRang, theHieraLevel, theId, theObjId, thePar, and AlignmentIORootBase::tree.
00034 { 00035 tree->SetBranchAddress("parSize", &theCovRang); 00036 tree->SetBranchAddress("covarSize", &theCovarRang); 00037 tree->SetBranchAddress("Id", &theId); 00038 tree->SetBranchAddress("Par", &thePar); 00039 tree->SetBranchAddress("Cov", &theCov); 00040 tree->SetBranchAddress("ObjId", &theObjId); 00041 tree->SetBranchAddress("HieraLevel",&theHieraLevel); 00042 }
Write AlignmentParameters of one Alignable.
Implements AlignmentParametersIO.
Definition at line 57 of file AlignmentParametersIORoot.cc.
References Alignable::alignableObjectId(), Alignable::alignmentParameters(), parsecf::pyparsing::col(), count, AlignmentParameters::covariance(), AlignmentParameters::hierarchyLevel(), Alignable::id(), AlignmentParameters::parameters(), params, row, theCov, theCovarRang, theCovRang, theHieraLevel, theId, theObjId, thePar, and AlignmentIORootBase::tree.
00058 { 00059 const AlignmentParameters* ap =ali->alignmentParameters(); 00060 const AlgebraicVector& params = ap->parameters(); 00061 const AlgebraicSymMatrix& cov = ap->covariance(); 00062 00063 theCovRang = params.num_row(); 00064 theCovarRang = theCovRang*(theCovRang+1)/2; 00065 int count=0; 00066 for(int row=0;row<theCovRang;row++){ 00067 thePar[row]=params[row]; 00068 for(int col=0;col<theCovRang;col++){ 00069 if(row-1<col) { theCov[count] = cov[row][col]; count++; } 00070 } 00071 } 00072 00073 theId = ali->id(); 00074 theObjId = ali->alignableObjectId(); 00075 theHieraLevel = ap->hierarchyLevel(); 00076 00077 tree->Fill(); 00078 return 0; 00079 }
friend class AlignmentIORoot [friend] |
Definition at line 18 of file AlignmentParametersIORoot.h.
double AlignmentParametersIORoot::theCov[nParMax *(nParMax+1)/2] [private] |
Definition at line 55 of file AlignmentParametersIORoot.h.
Referenced by createBranches(), readOne(), setBranchAddresses(), and writeOne().
int AlignmentParametersIORoot::theCovarRang [private] |
Definition at line 51 of file AlignmentParametersIORoot.h.
Referenced by createBranches(), setBranchAddresses(), and writeOne().
int AlignmentParametersIORoot::theCovRang [private] |
Definition at line 51 of file AlignmentParametersIORoot.h.
Referenced by createBranches(), readOne(), setBranchAddresses(), and writeOne().
int AlignmentParametersIORoot::theHieraLevel [private] |
Definition at line 51 of file AlignmentParametersIORoot.h.
Referenced by createBranches(), setBranchAddresses(), and writeOne().
align::ID AlignmentParametersIORoot::theId [private] |
Definition at line 52 of file AlignmentParametersIORoot.h.
Referenced by createBranches(), findEntry(), setBranchAddresses(), and writeOne().
Definition at line 53 of file AlignmentParametersIORoot.h.
Referenced by createBranches(), findEntry(), setBranchAddresses(), and writeOne().
double AlignmentParametersIORoot::thePar[nParMax] [private] |
Definition at line 55 of file AlignmentParametersIORoot.h.
Referenced by createBranches(), readOne(), setBranchAddresses(), and writeOne().