using namespace std;
#include "hlocation.h"
#include <iostream>
#include <iomanip>
ClassImp(HLocation)
Int_t HLocation::getLinearIndex(Int_t *sizes,Int_t n) {
Int_t r=1,i;
r=fIndexes.fArray[0];
for (i=1;i<fIndexes.fN;i++)
r=r*(sizes[i])+fIndexes.fArray[i];
for(;i<n;i++) {
r*=sizes[i];
}
return (r);
}
Int_t HLocation::getLinearIndex(TArrayI *sizes) {
Int_t r=1,i;
r=fIndexes.fArray[0];
for (i=1;i<fIndexes.fN;i++)
r=r*(sizes->fArray[i])+fIndexes.fArray[i];
for(;i<sizes->fN;i++) {
r*=sizes->fArray[i];
}
return (r);
}
void HLocation::set(Int_t nIndex, Int_t i1, Int_t i2, Int_t i3, Int_t i4, Int_t i5) {
fIndexes.Set(nIndex);
switch(nIndex) {
case 5:
fIndexes[4] = i5;
case 4:
fIndexes[3] = i4;
case 3:
fIndexes[2] = i3;
case 2:
fIndexes[1] = i2;
case 1:
fIndexes[0] = i1;
default: ;
}
}
void HLocation::incIndex(Int_t nIndex) {
Int_t i;
fIndexes[nIndex]++;
for (i=nIndex+1;i<fIndexes.fN;i++) fIndexes[i]=0;
}
void HLocation::readIndexes(HLocation &loc) {
Int_t n=0,i=0;
Int_t nInd=loc.getNIndex();
n=((fIndexes.fN>nInd)? nInd : fIndexes.fN);
for (i=0;i<n;i++) {
fIndexes.fArray[i]=loc.fIndexes.fArray[i];
}
for (;i<fIndexes.fN;i++) fIndexes[i]=0;
}
void HLocation::Dump(void) {
Int_t i;
cout << "fIndexes.fN|";
for (i=0;i<fIndexes.fN;i++) {
if (i==fIndexes.fN-1) cout << fIndexes[i] << endl;
else cout << fIndexes[i] << ":" ;
}
}
Last change: Sat May 22 12:59:05 2010
Last generated: 2010-05-22 12:59
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.