7 WELCOME_LOG <<
"Hello from the HyperBinningMemRes() Constructor";
79 ERROR_LOG <<
"This HyperVolume has the wrong dimensionality for this HyperBinningMemRes";
91 TTree* tree = dynamic_cast<TTree*>( file->Get(
"PrimaryVolumeNumbers") );
94 ERROR_LOG <<
"Could not open TTree in HyperBinningMemRes::loadPrimaryVolumeNumbers()";
99 int volumeNumber = -1;
101 tree->SetBranchAddress(
"volumeNumber", &volumeNumber);
104 for(
int i = 0; i < tree->GetEntries(); i++ ){
115 tree->SetBranchAddress(
"binNumber", binNumber);
116 tree->SetBranchAddress(
"linkedBins", linkedBins);
118 TString lowCornerName =
"lowCorner_"; lowCornerName += i;
119 TString highCornerName =
"highCorner_"; highCornerName += i;
120 tree->SetBranchAddress(lowCornerName, lowCorner + i);
121 tree->SetBranchAddress(highCornerName, highCorner + i);
143 if (option !=
"READ"){
144 INFO_LOG <<
"For a memory resident HyperBinning you should always use the READ option. Setting to READ" << std::endl;
148 TFile* file =
new TFile(
filename,
"READ");
151 ERROR_LOG <<
"Could not open TFile in HyperBinningMemRes::load(" <<
filename <<
")";
157 TTree* tree = (TTree*)file->Get(
"HyperBinning");
160 ERROR_LOG <<
"Could not open TTree in HyperBinningMemRes::load()";
171 std::vector<int>* linkedBins =
new std::vector<int>();
177 int nEntries = tree->GetEntries();
179 int currentBinNumber = -1;
181 std::vector<int> currentLinkedVolumes;
185 for(
int ent = 0; ent < nEntries; ent++){
190 if(ent == 0 || currentBinNumber == binNumber){
191 currentBinNumber = binNumber;
192 currentLinkedVolumes = *linkedBins;
196 lowCornerVect .
at(i) = lowCorner [i];
197 highCornerVect.
at(i) = highCorner[i];
200 currentHyperVolume->
addHyperCuboid(lowCornerVect, highCornerVect);
209 delete currentHyperVolume;
211 currentLinkedVolumes = *linkedBins;
212 currentBinNumber = binNumber;
216 lowCornerVect .
at(i) = lowCorner [i];
217 highCornerVect.
at(i) = highCorner[i];
220 currentHyperVolume->
addHyperCuboid(lowCornerVect, highCornerVect);
226 if (ent == nEntries - 1) {
235 delete currentHyperVolume;
255 GOODBYE_LOG <<
"Goodbye from the HyperBinningMemRes() Constructor";
virtual ~HyperBinningMemRes()
virtual TString filename() const
virtual void load(TString filename, TString option="READ")
int getHyperBinningDimFromTree(TTree *tree)
virtual std::vector< int > getPrimaryVolumeNumbers() const
virtual void reserveCapacity(int nElements)
virtual int getNumPrimaryVolumes() const
virtual void reserveCapacity(int nElements)
std::vector< HyperVolume > _hyperVolumes
virtual void setDimension(int dimension)
const int & getDimension() const
virtual BinningBase * clone() const
void loadPrimaryVolumeNumbers(TFile *file)
std::vector< std::vector< int > > _linkedHyperVolumes
const int & getDimension() const
const double & at(int i) const
virtual std::vector< int > getLinkedHyperVolumes(int volumeNumber) const
virtual int getPrimaryVolumeNumber(int i) const
virtual int getNumHyperVolumes() const
void addHyperCuboid(const HyperPoint &lowCorner, const HyperPoint &highCorner)
void setBranchAddresses(TTree *tree, int *binNumber, double *lowCorner, double *highCorner, std::vector< int > **linkedBins) const
std::vector< int > _primaryVolumeNumbers
virtual void setDimension(int dim)
virtual void addPrimaryVolumeNumber(int volumeNumber)
virtual HyperVolume getHyperVolume(int volumeNumber) const
virtual bool addHyperVolume(const HyperVolume &hyperVolume, std::vector< int > linkedVolumes=std::vector< int >(0, 0))
HyperBinningMemRes()
The only constructor.